-- #########################################################
-- #########################################################
-- ConfigEnv.sql
-- #########################################################
-- #########################################################

SPOOL spool.txt
WHENEVER SQLERROR EXIT FAILURE ROLLBACK
WHENEVER OSERROR EXIT FAILURE ROLLBACK

-- #########################################################
-- #########################################################
-- VersionCheck.sql
-- #########################################################
-- #########################################################

declare
  Major$ NUMBER(10);
  Minor$ NUMBER(10);
begin
  select max(Major) into Major$ from DatabaseVersion;
  select max(Minor) into Minor$ from DatabaseVersion where Major = Major$;
  if (Major$ <> 900) or (Minor$ <> 00) then
    raise_application_error(-20000, 'Версия БД [' || TO_CHAR(Major$) || '.' || TO_CHAR(Minor$, 'FM00') || '] не соответствует требуемой [900.00]');
  end if;
end;
/

-- #########################################################
-- #########################################################
-- Correct_Enums_Doubles_ORA.sql
-- #########################################################
-- #########################################################


/* Убираем дубли в таблицах ENUMS и ENUMVALUES */
create table tmp_enumsvalues_counter1 (id int null, cnt int null)
/

insert into tmp_enumsvalues_counter1 
(id, cnt)
select e.id, count(ev.id) as cnt
from enums e
inner join enumvalues ev on ev.enumref = e.id
group by e.id
having count(ev.id) > 0
/

commit 
/

create table tmp_enums_min_ids (name varchar(255) null, min_enum_id int null)
/

insert into tmp_enums_min_ids 
(name, min_enum_id)
select name, min(id) min_enum_id
from enums
group by name
having count(name) > 1
/

commit 
/

create table tmp_enumsvalues_counter2 (id int null, cnt int null)
/

insert into tmp_enumsvalues_counter2
(id, cnt)
select e.id, count(ev.id) as cnt
from enums e
inner join enumvalues ev on ev.enumref = e.id
group by e.id
having count(ev.id) > 1
/

commit 
/

create table tmp_enums_max_counts (name varchar(255) null, max_total int null)
/

insert into tmp_enums_max_counts 
(name, max_total)
select tenum.name,  max(t.cnt) as max_total
from
enums tenum 
inner join tmp_enumsvalues_counter2 t on  tenum.id = t.id
group by tenum.name
/

commit 
/

create table tmp_drop_enums_doubles (id int null)
/

insert into tmp_drop_enums_doubles 
(id)
select enum.id
from enums enum
inner join
tmp_enumsvalues_counter1 valcnt on valcnt.id = enum.id
inner join
tmp_enums_min_ids edouble on edouble.name = enum.name
inner join
tmp_enums_max_counts tmax on tmax.name = enum.name
where
enum.id > edouble.min_enum_id and valcnt.cnt <= tmax.max_total
/

commit 
/

drop table tmp_enumsvalues_counter1
/

drop table tmp_enums_max_counts
/

drop table tmp_enums_min_ids
/

drop table tmp_enumsvalues_counter2
/

commit 
/

delete from enumvalues
where enumref in 
(select id from tmp_drop_enums_doubles)
/

delete from enums
where id in 
(select id from tmp_drop_enums_doubles)
/

commit 
/

create table tmp_drop_enumvalues (enumRef int null, val int null, id_need int null)
/

insert into tmp_drop_enumvalues
(enumRef, val, id_need)
select enumRef, val, min(id) as id_need from enumvalues
group by enumRef, val
having count(val) > 1
/

commit
/

delete from enumvalues
where id in (
    select id from
    enumvalues ev inner join
    tmp_drop_enumvalues doubles on ev.val = doubles.val and ev.enumRef = doubles.enumRef
    where
        ev.id is not null and doubles.id_need is not null
        and ev.id <> doubles.id_need
)
/

drop table tmp_drop_enums_doubles
/

drop table tmp_drop_enumvalues
/

commit 
/



-- #########################################################
-- #########################################################
-- Add_Check_For_Enums_Doubles.sql
-- #########################################################
-- #########################################################

/* Добавление проверки на уникальность значений ENUMS и ENUMVALUES */
-- drop trigger TR_ENUMVALUES_BI_10
CREATE OR REPLACE TRIGGER TR_ENUMVALUES_BI
  BEFORE INSERT
  ON ENUMVALUES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_ENUMVALUES_BI)
-- Create 05.09.2005
-- - - - - - - - - - - - -

    if (:new.id is null) then select g_Shared.nextval into :new.Id from DUAL; end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_ENUMVALUES_BI_500)
-- Create 05.09.2005
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;
  :NEW.CreaterUser := USER;
  :NEW.UpdaterUser := USER;

END;
/
ALTER TABLE enums ADD (
  CONSTRAINT ENUMS_NAME_UNIQUE UNIQUE (NAME)
)
/
ALTER TABLE enumvalues ADD (
  CONSTRAINT ENUMVALUES_VAL_ENUMREF_UNIQUE UNIQUE (ENUMREF, VAL)
)
/
commit work
/

-- #########################################################
-- #########################################################
-- Alter_TR_Promise_Detail_BU_510.sql
-- #########################################################
-- #########################################################

-- CREATE TRIGGER TR_PROMISE_DETAIL_BU_510
CREATE OR REPLACE TRIGGER TR_PROMISE_DETAIL_IU
  INSTEAD OF UPDATE
  ON PROMISE_DETAIL
  FOR EACH ROW
DECLARE
  new$ID PROMISE_DETAIL.ID%TYPE := :NEW.ID;
  new$TITLE_REF PROMISE_DETAIL.TITLE_REF%TYPE := :NEW.TITLE_REF;
  new$PARENT_PROMISE PROMISE_DETAIL.PARENT_PROMISE%TYPE := :NEW.PARENT_PROMISE;
  new$KFSR PROMISE_DETAIL.KFSR%TYPE := :NEW.KFSR;
  new$KVSR PROMISE_DETAIL.KVSR%TYPE := :NEW.KVSR;
  new$KCSR PROMISE_DETAIL.KCSR%TYPE := :NEW.KCSR;
  new$KVR PROMISE_DETAIL.KVR%TYPE := :NEW.KVR;
  new$KESR PROMISE_DETAIL.KESR%TYPE := :NEW.KESR;
  new$FACT PROMISE_DETAIL.FACT%TYPE := :NEW.FACT;
  new$FACIALACC_CLS PROMISE_DETAIL.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$DOCTYPE PROMISE_DETAIL.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$FINTYPE PROMISE_DETAIL.FINTYPE%TYPE := :NEW.FINTYPE;
  new$FINSOURCE PROMISE_DETAIL.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$SUBKESR PROMISE_DETAIL.SUBKESR%TYPE := :NEW.SUBKESR;
  new$REGIONCLS PROMISE_DETAIL.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$SUMMA PROMISE_DETAIL.SUMMA%TYPE := :NEW.SUMMA;
  new$REGISTRNUMBER PROMISE_DETAIL.REGISTRNUMBER%TYPE := :NEW.REGISTRNUMBER;
  new$CLOSEDATE PROMISE_DETAIL.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHILD_PROMISE PROMISE_DETAIL.CHILD_PROMISE%TYPE := :NEW.CHILD_PROMISE;
  new$MONTH01 PROMISE_DETAIL.MONTH01%TYPE := :NEW.MONTH01;
  new$MONTH02 PROMISE_DETAIL.MONTH02%TYPE := :NEW.MONTH02;
  new$MONTH03 PROMISE_DETAIL.MONTH03%TYPE := :NEW.MONTH03;
  new$MONTH04 PROMISE_DETAIL.MONTH04%TYPE := :NEW.MONTH04;
  new$MONTH05 PROMISE_DETAIL.MONTH05%TYPE := :NEW.MONTH05;
  new$MONTH06 PROMISE_DETAIL.MONTH06%TYPE := :NEW.MONTH06;
  new$MONTH07 PROMISE_DETAIL.MONTH07%TYPE := :NEW.MONTH07;
  new$MONTH08 PROMISE_DETAIL.MONTH08%TYPE := :NEW.MONTH08;
  new$MONTH09 PROMISE_DETAIL.MONTH09%TYPE := :NEW.MONTH09;
  new$MONTH10 PROMISE_DETAIL.MONTH10%TYPE := :NEW.MONTH10;
  new$MONTH11 PROMISE_DETAIL.MONTH11%TYPE := :NEW.MONTH11;
  new$MONTH12 PROMISE_DETAIL.MONTH12%TYPE := :NEW.MONTH12;
  new$BUDGETREF PROMISE_DETAIL.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER PROMISE_DETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE PROMISE_DETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE PROMISE_DETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER PROMISE_DETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$MEANSTYPE PROMISE_DETAIL.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$SENDERID PROMISE_DETAIL.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID PROMISE_DETAIL.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$RVERSION PROMISE_DETAIL.RVERSION%TYPE := :NEW.RVERSION;
  new$DIRECTIONCLS PROMISE_DETAIL.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$BUHOPERATIONCLS PROMISE_DETAIL.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$MONTH01DELTA PROMISE_DETAIL.MONTH01DELTA%TYPE := :NEW.MONTH01DELTA;
  new$MONTH02DELTA PROMISE_DETAIL.MONTH02DELTA%TYPE := :NEW.MONTH02DELTA;
  new$MONTH03DELTA PROMISE_DETAIL.MONTH03DELTA%TYPE := :NEW.MONTH03DELTA;
  new$MONTH04DELTA PROMISE_DETAIL.MONTH04DELTA%TYPE := :NEW.MONTH04DELTA;
  new$MONTH05DELTA PROMISE_DETAIL.MONTH05DELTA%TYPE := :NEW.MONTH05DELTA;
  new$MONTH06DELTA PROMISE_DETAIL.MONTH06DELTA%TYPE := :NEW.MONTH06DELTA;
  new$MONTH07DELTA PROMISE_DETAIL.MONTH07DELTA%TYPE := :NEW.MONTH07DELTA;
  new$MONTH08DELTA PROMISE_DETAIL.MONTH08DELTA%TYPE := :NEW.MONTH08DELTA;
  new$MONTH09DELTA PROMISE_DETAIL.MONTH09DELTA%TYPE := :NEW.MONTH09DELTA;
  new$MONTH10DELTA PROMISE_DETAIL.MONTH10DELTA%TYPE := :NEW.MONTH10DELTA;
  new$MONTH11DELTA PROMISE_DETAIL.MONTH11DELTA%TYPE := :NEW.MONTH11DELTA;
  new$MONTH12DELTA PROMISE_DETAIL.MONTH12DELTA%TYPE := :NEW.MONTH12DELTA;
  new$STIMATEID PROMISE_DETAIL.STIMATEID%TYPE := :NEW.STIMATEID;
  new$SUMMAYEAR1 PROMISE_DETAIL.SUMMAYEAR1%TYPE := :NEW.SUMMAYEAR1;
  new$SUMMAYEAR2 PROMISE_DETAIL.SUMMAYEAR2%TYPE := :NEW.SUMMAYEAR2;
  new$SUMMAYEAR3 PROMISE_DETAIL.SUMMAYEAR3%TYPE := :NEW.SUMMAYEAR3;
  new$SUMMAYEAR1DELTA PROMISE_DETAIL.SUMMAYEAR1DELTA%TYPE := :NEW.SUMMAYEAR1DELTA;
  new$SUMMAYEAR2DELTA PROMISE_DETAIL.SUMMAYEAR2DELTA%TYPE := :NEW.SUMMAYEAR2DELTA;
  new$SUMMAYEAR3DELTA PROMISE_DETAIL.SUMMAYEAR3DELTA%TYPE := :NEW.SUMMAYEAR3DELTA;
  new$ASSIGNMENTKIND PROMISE_DETAIL.ASSIGNMENTKIND%TYPE := :NEW.ASSIGNMENTKIND;
  new$TRANSFERTCLS PROMISE_DETAIL.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS PROMISE_DETAIL.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$BUDALLOCATIONCLS PROMISE_DETAIL.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS PROMISE_DETAIL.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
--
  CNT$ NUMBER(10);
  Parent_Promise$ tb_promise_detail.Parent_Promise%TYPE;
  Temp$ tb_promise_detail.Parent_Promise%TYPE;
  BudgetRef$ NUMBER(10);
  CNT$1 NUMBER(10);
  ParentDate$ NUMBER(10);
  Accept_Revert$ NUMBER(10);
  ChildNum1$ NUMBER(10);
  Promise_Count$ NUMBER(10);
  PayDoc_Count$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_PROMISE_DETAIL_BU)
-- Last update 07.12.2005
-- - - - - - - - - - - - -

   /*  проверка на изменение Бюджета */
   IF     (NEW$BudgetRef <> :OLD.BudgetRef)
      AND (NOT ((NEW$BudgetRef IS NULL) AND (:OLD.BudgetRef IS NULL))) THEN
      raiseException ('Ex_CantModufyBudget');
   END IF;

   IF (new$KFSR IS NULL) THEN new$KFSR := 0; END IF;
   IF (new$KVSR IS NULL) THEN new$KVSR := 0; END IF;
   IF (new$KCSR IS NULL) THEN new$KCSR := 0; END IF;
   IF (new$KVR IS NULL) THEN new$KVR := 0; END IF;
   IF (new$KESR IS NULL) THEN new$KESR := 0; END IF;
   IF (new$SubKESR IS NULL) THEN new$SubKESR := 0; END IF;
   IF (new$DirectionCls IS NULL) THEN new$DirectionCls := 0; END IF;
   IF (new$FacialAcc_Cls IS NULL) THEN new$FacialAcc_Cls := 0; END IF;
   IF (new$DocType IS NULL) THEN new$DocType := 0; END IF;
   IF (new$MeansType IS NULL) THEN new$MeansType := 0; END IF;
   IF (new$FinType IS NULL) THEN new$FinType := 0; END IF;
   IF (new$FinSource IS NULL) THEN new$FinSource := 0; END IF;
   IF (new$Fact IS NULL) THEN new$Fact := 0; END IF;
   IF (new$RegionCls IS NULL) THEN new$RegionCls := 0; END IF;
   IF (new$BuhOperationCLS IS NULL) THEN
     GetIntConst (60, 15, new$BuhOperationCLS);
   END IF;
   IF (new$Month01Delta IS NULL) THEN new$Month01Delta := 0; END IF;
   IF (new$Month02Delta IS NULL) THEN new$Month02Delta := 0; END IF;
   IF (new$Month03Delta IS NULL) THEN new$Month03Delta := 0; END IF;
   IF (new$Month04Delta IS NULL) THEN new$Month04Delta := 0; END IF;
   IF (new$Month05Delta IS NULL) THEN new$Month05Delta := 0; END IF;
   IF (new$Month06Delta IS NULL) THEN new$Month06Delta := 0; END IF;
   IF (new$Month07Delta IS NULL) THEN new$Month07Delta := 0; END IF;
   IF (new$Month08Delta IS NULL) THEN new$Month08Delta := 0; END IF;
   IF (new$Month09Delta IS NULL) THEN new$Month09Delta := 0; END IF;
   IF (new$Month10Delta IS NULL) THEN new$Month10Delta := 0; END IF;
   IF (new$Month11Delta IS NULL) THEN new$Month11Delta := 0; END IF;
   IF (new$Month12Delta IS NULL) THEN new$Month12Delta := 0; END IF;
   IF (new$Month01 IS NULL) THEN new$Month01 := 0; END IF;
   IF (new$Month02 IS NULL) THEN new$Month02 := 0; END IF;
   IF (new$Month03 IS NULL) THEN new$Month03 := 0; END IF;
   IF (new$Month04 IS NULL) THEN new$Month04 := 0; END IF;
   IF (new$Month05 IS NULL) THEN new$Month05 := 0; END IF;
   IF (new$Month06 IS NULL) THEN new$Month06 := 0; END IF;
   IF (new$Month07 IS NULL) THEN new$Month07 := 0; END IF;
   IF (new$Month08 IS NULL) THEN new$Month08 := 0; END IF;
   IF (new$Month09 IS NULL) THEN new$Month09 := 0; END IF;
   IF (new$Month10 IS NULL) THEN new$Month10 := 0; END IF;
   IF (new$Month11 IS NULL) THEN new$Month11 := 0; END IF;
   IF (new$Month12 IS NULL) THEN new$Month12 := 0; END IF;
   IF (new$Summa IS NULL) THEN new$Summa := 0; END IF;

   new$SummaYear1 := new$Month01+new$Month02+new$Month03+new$Month04+new$Month05+new$Month06+
                  new$Month07+new$Month08+new$Month09+new$Month10+new$Month11+new$Month12; 
   IF (NEW$SummaYear2 IS NULL) THEN NEW$SummaYear2 := 0; END IF;
   IF (NEW$SummaYear3 IS NULL) THEN NEW$SummaYear3 := 0; END IF;

   /*  проверка на уникальность регистрационного номера */
   IF new$RegistrNumber = :OLD.RegistrNumber THEN
      NULL;
   ELSE
      SELECT COUNT (ID)
        INTO CNT$
        FROM promise_detail
       WHERE (BudgetRef = new$BudgetRef)
         AND (RegistrNumber = new$RegistrNumber) AND (ROWNUM = 1);

      IF ((new$RegistrNumber IS NOT NULL) AND (CNT$ <> 0)) THEN
         RaiseException ('EX_PROMISE_NUMUQ');
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_PROMISE_DETAIL_BU_10)
-- Last update 03.07.2006
-- - - - - - - - - - - - -

  /*  Рассматриваем случай, когда проставили или изменили ссылку на уточняемое БО */
  if (((new$Parent_Promise is not null) and (:old.Parent_Promise is null)) or
      (new$Parent_Promise <> :old.Parent_Promise)) then

    select count(*) into CNT$ from  Promise_Detail pd  left join Promise_Caption pc
    on (pc.ID = pd.Title_Ref) where
     ((pd.Parent_Promise = new$Parent_Promise)
          and
     (pd.budgetref = new$budgetref)
          and
      /* есть принтый договор*/
     (pc.ACCEPTED_REVERTED = 0)
          and
     /* Исключаем саму запись*/
     (pd.ID <> :old.ID)) AND (ROWNUM = 1);

    if (CNT$ <> 0) then
      RaiseException('ex_promise_DeadLock');
    end if;

    Parent_Promise$ := new$Parent_Promise;
    budgetref$ := new$budgetref;
    /* Бежим по цепочку уточнений пока либо не нйдем крайнее либо не найдем
           одинаковое с первым */
    while ((Parent_Promise$ is not null) and
           (new$RegistrNumber <> Parent_Promise$))
    LOOP
      Temp$ := Parent_Promise$;
      /* Приходится так делать п.ч. если нет результата, то into никак не хочет
       занулять :Parent_Promise*/
      Parent_Promise$ := null;
      BEGIN
        select Parent_Promise into Parent_Promise$
        from Promise_Detail
        where (RegistrNumber = Temp$) and (budgetref = budgetref$);
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
           Parent_Promise$ := NULL;
      END;
    end LOOP;
    if (new$RegistrNumber = Parent_Promise$) then
      RaiseException('EX_Promise_Detail_CHECK_NUM');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_20 (TR_PROMISE_DETAIL_BU_20)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

   -- Проверка: БО не должно уточнять самого себя
   IF (    (new$RegistrNumber IS NOT NULL)
       AND (new$RegistrNumber = new$Parent_Promise)
      ) THEN
      RaiseException ('EX_PROMISE_DETAIL_CHECK_NUM');
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_PROMISE_DETAIL_BU_100)
-- Create 29.04.2005
-- Last update 03.07.2006
-- - - - - - - - - - - - -

  select count(*)
  into cnt$
  from promise_detail prd where (prd.registrnumber=new$parent_promise) and (prd.budgetref = new$budgetref) AND (ROWNUM = 1);

  if (not (new$parent_promise is null) and (cnt$ > 0))
  then promise_delta(new$budgetref,new$parent_promise,new$month01,new$month02,
    new$month03,new$month04,new$month05,new$month06,new$month07,new$month08,new$month09,
    new$month10,new$month11,new$month12,
    new$summayear1,new$summayear2,new$summayear3,
    new$month01delta,new$month02delta,new$month03delta,new$month04delta,
    new$month05delta,new$month06delta,new$month07delta,new$month08delta,new$month09delta,
    new$month10delta,new$month11delta,new$month12delta,
    new$summayear1delta, new$summayear2delta, new$summayear3delta);
  end if;

  /*  Заполняем первичные записи */
  if (new$Parent_Promise is null) then
    new$Month01Delta := new$Month01;
    new$Month02Delta := new$Month02;
    new$Month03Delta := new$Month03;
    new$Month04Delta := new$Month04;
    new$Month05Delta := new$Month05;
    new$Month06Delta := new$Month06;
    new$Month07Delta := new$Month07;
    new$Month08Delta := new$Month08;
    new$Month09Delta := new$Month09;
    new$Month10Delta := new$Month10;
    new$Month11Delta := new$Month11;
    new$Month12Delta := new$Month12;
    new$SummaYear1Delta := new$SummaYear1;
    new$SummaYear2Delta := new$SummaYear2;
    new$SummaYear3Delta := new$SummaYear3;
  end if;

-- - - - - - - - - - - - -
-- BU_510 (TR_PROMISE_DETAIL_BU_510)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  SELECT COUNT(pd.REGISTRNUMBER
  ) INTO CNT$1
  from promise_detail pd
  where ((pd.REGISTRNUMBER = new$Parent_promise)
  and
  (pd.budgetref = new$budgetref)
  ) AND (ROWNUM = 1)     ;
  if (not(new$Parent_promise is null) and (not(CNT$1<> 0))) then
    RaiseException('EX_NOTFINDPARENTPROMISE');
  END IF;
  /* Если пытаемся изменить номер договора, проверяем, существует ли уточнение для него*/
  if (((new$RegistrNumber is null) and (:old.RegistrNumber is not null)) or
  (:old.RegistrNumber <> new$RegistrNumber)) then
    if (:old.registrnumber is not null) then
      select count(pd.Parent_Promise)
      into Promise_Count$         from Promise_Detail pd
      where (:old.RegistrNumber = pd.Parent_Promise) and (:old.budgetref = pd.budgetref)
      ;
      /* если находим уточнение, тогда ругаемся.*/
      if (Promise_Count$ > 0) then
        RaiseException('EX_CANTCHANGEBONUMBER');      
      END IF;
    END IF;
    /* существует ли платежное поручение, которое ссылается на это БО*/
    if (:old.registrnumber is not null) then
      select count(ffd.id)
      into PayDoc_Count$         from FacialFinDetail ffd
      where (((ffd.sourcepromise = :old.registrnumber) or (ffd.destpromise = :old.registrnumber)) and (ffd.budgetref = :old.budgetref))
      ;
      /* Если находим такое, тогда ругаемся.*/
      if (PayDoc_Count$ > 0) then
        RaiseException('EX_Promise_ExPayDoc');      
      END IF;   
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_PROMISE_DETAIL_BU_700)
-- Create 17.09.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_PROMISE_DETAIL SET
    ID = new$ID,
    TITLE_REF = new$TITLE_REF,
    PARENT_PROMISE = new$PARENT_PROMISE,
    KFSR = new$KFSR,
    KVSR = new$KVSR,
    KCSR = new$KCSR,
    KVR = new$KVR,
    KESR = new$KESR,
    FACT = new$FACT,
    FACIALACC_CLS = new$FACIALACC_CLS,
    DOCTYPE = new$DOCTYPE,
    FINTYPE = new$FINTYPE,
    FINSOURCE = new$FINSOURCE,
    SUBKESR = new$SUBKESR,
    REGIONCLS = new$REGIONCLS,
    SUMMA = new$SUMMA,
    REGISTRNUMBER = new$REGISTRNUMBER,
    CLOSEDATE = new$CLOSEDATE,
    CHILD_PROMISE = new$CHILD_PROMISE,
    MONTH01 = new$MONTH01,
    MONTH02 = new$MONTH02,
    MONTH03 = new$MONTH03,
    MONTH04 = new$MONTH04,
    MONTH05 = new$MONTH05,
    MONTH06 = new$MONTH06,
    MONTH07 = new$MONTH07,
    MONTH08 = new$MONTH08,
    MONTH09 = new$MONTH09,
    MONTH10 = new$MONTH10,
    MONTH11 = new$MONTH11,
    MONTH12 = new$MONTH12,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    MEANSTYPE = new$MEANSTYPE,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    RVERSION = new$RVERSION,
    DIRECTIONCLS = new$DIRECTIONCLS,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    MONTH01DELTA = new$MONTH01DELTA,
    MONTH02DELTA = new$MONTH02DELTA,
    MONTH03DELTA = new$MONTH03DELTA,
    MONTH04DELTA = new$MONTH04DELTA,
    MONTH05DELTA = new$MONTH05DELTA,
    MONTH06DELTA = new$MONTH06DELTA,
    MONTH07DELTA = new$MONTH07DELTA,
    MONTH08DELTA = new$MONTH08DELTA,
    MONTH09DELTA = new$MONTH09DELTA,
    MONTH10DELTA = new$MONTH10DELTA,
    MONTH11DELTA = new$MONTH11DELTA,
    MONTH12DELTA = new$MONTH12DELTA,
    STIMATEID = new$STIMATEID,
    SUMMAYEAR1 = new$SUMMAYEAR1,
    SUMMAYEAR2 = new$SUMMAYEAR2,
    SUMMAYEAR3 = new$SUMMAYEAR3,
    SUMMAYEAR1DELTA = new$SUMMAYEAR1DELTA,
    SUMMAYEAR2DELTA = new$SUMMAYEAR2DELTA,
    SUMMAYEAR3DELTA = new$SUMMAYEAR3DELTA,
    ASSIGNMENTKIND = new$ASSIGNMENTKIND,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    BUDALLOCATIONCLS = new$BUDALLOCATIONCLS,
    PAYPROMISECLS = new$PAYPROMISECLS
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion
           OR RVersion IS NULL AND :OLD.RVersion IS NULL
          );

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_30 (TR_PROMISE_DETAIL_AU_30)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Если сняли или поменяли ссылку на уточняемое БО, тогда снимаем обратную связь*/
  if (((new$Parent_Promise is null) and (:old.Parent_Promise is not null)) or
  (:old.Parent_Promise <> new$Parent_Promise)) then 
    update Promise_Detail set
    Child_Promise = null,
    CloseDate = null
    where
    (RegistrNumber = :old.Parent_Promise) and
    (BudgetRef = :old.budgetref);
      
  END IF;
      
  /* если сняли номер БО, то убирем этот номер в потомке, что бы не было ссылки на не существующий*/
  if ((new$RegistrNumber is null) and (:old.RegistrNumber is not null)) then 
    update Promise_Detail set
    Child_Promise = null
    where
    (RegistrNumber = :old.Parent_Promise) and
    (budgetref = :old.budgetref);
      
  END IF;
      
  /* если надо, то корректируем поля в предке занчениями потомка*/
  if ((((new$Parent_Promise is not null) and  (:old.Parent_Promise is null)) or (:old.Parent_Promise <> new$Parent_Promise)) or
  (((new$RegistrNumber is not null) and  (:old.RegistrNumber is null)) or (:old.RegistrNumber <> new$RegistrNumber))) then
    BEGIN
      select AcceptDate, Accepted_Reverted
      into ParentDate$, Accept_Revert$     from Promise_Caption
      where (id = new$Title_Ref)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    /* Если обязательство отклонено, тогда не закрываем уточняемое БО */
    if (Accept_Revert$ = 1) then
      ParentDate$ := null;
    END IF;
        
    ChildNum1$ := new$RegistrNumber;
    if (ParentDate$ is null) then
      ChildNum1$ := null;
    END IF;

    /* Установим в уточняемом БО дату его закрытия и обратную связь */
    update Promise_Detail set
    Child_Promise = ChildNum1$,
    CloseDate = ParentDate$

    where
    (RegistrNumber = new$Parent_Promise) and
    (BudgetRef = new$BudgetRef);
      
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_PROMISE_DETAIL_AU_500)
-- Create 28.04.2005
-- Last update 24.05.2005
-- - - - - - - - - - - - -

   IF (new$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes
                  (TableID, RecordId, DeleteDate
                  )
           VALUES (76, :OLD.ID, SYSDATE
                  );

      DELETE FROM DelRecIndexes
            WHERE (TableID = 76) AND (RecordId = new$ID);
   END IF;

END;
/
commit work
/

-- #########################################################
-- #########################################################
-- Alter_TR_TenderCaption_BI.sql
-- #########################################################
-- #########################################################

-- CREATE TRIGGER TR_TENDERCAPTION_BI
CREATE OR REPLACE TRIGGER TR_TENDERCAPTION_II
  INSTEAD OF INSERT
  ON TENDERCAPTION
  FOR EACH ROW
DECLARE
  new$ID TENDERCAPTION.ID%TYPE := :NEW.ID;
  new$BUDGETREF TENDERCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$FACIALACCCLS TENDERCAPTION.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$MULTIPURPOSE TENDERCAPTION.MULTIPURPOSE%TYPE := :NEW.MULTIPURPOSE;
  new$DOCUMENTDATE TENDERCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE TENDERCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$PERIOD TENDERCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$ACCEPTSUMMA TENDERCAPTION.ACCEPTSUMMA%TYPE := :NEW.ACCEPTSUMMA;
  new$SALETYPE TENDERCAPTION.SALETYPE%TYPE := :NEW.SALETYPE;
  new$REJECTCLS TENDERCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE TENDERCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS TENDERCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID TENDERCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID TENDERCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DOCSTATEREF TENDERCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CREATERUSER TENDERCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE TENDERCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE TENDERCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER TENDERCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$LASTADJUSTMENT TENDERCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$LASTACCEPTED TENDERCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$ADJUSTMENTREF TENDERCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ACCEPTED TENDERCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$EXPORTDATE TENDERCAPTION.EXPORTDATE%TYPE := :NEW.EXPORTDATE;
  new$YEARACCEPTSUMMA TENDERCAPTION.YEARACCEPTSUMMA%TYPE := :NEW.YEARACCEPTSUMMA;
  new$TENDEROPTION TENDERCAPTION.TENDEROPTION%TYPE := :NEW.TENDEROPTION;
  new$TENDERTARGET TENDERCAPTION.TENDERTARGET%TYPE := :NEW.TENDERTARGET;
  new$RVERSION TENDERCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$ALLOWANCE TENDERCAPTION.ALLOWANCE%TYPE := :NEW.ALLOWANCE;
  new$REFINEMENTCAUSE TENDERCAPTION.REFINEMENTCAUSE%TYPE := :NEW.REFINEMENTCAUSE;
  new$PREFERENCE TENDERCAPTION.PREFERENCE%TYPE := :NEW.PREFERENCE;
  new$PREFERENCESIZE TENDERCAPTION.PREFERENCESIZE%TYPE := :NEW.PREFERENCESIZE;
  new$SECURITY TENDERCAPTION.SECURITY%TYPE := :NEW.SECURITY;
  new$UNKNOWNAMOUNT TENDERCAPTION.UNKNOWNAMOUNT%TYPE := :NEW.UNKNOWNAMOUNT;
  new$PERIODYEAR TENDERCAPTION.PERIODYEAR%TYPE := :NEW.PERIODYEAR;
  new$SUPPORTUNDERTAKER TENDERCAPTION.SUPPORTUNDERTAKER%TYPE := :NEW.SUPPORTUNDERTAKER;
  new$AYEAR TENDERCAPTION.AYEAR%TYPE := :NEW.AYEAR;
  new$REWORKCAUSE TENDERCAPTION.REWORKCAUSE%TYPE := :NEW.REWORKCAUSE;
  new$NOTE TENDERCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$REALID TENDERCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER TENDERCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTNUMBER TENDERCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$SENDERIDKEY TENDERCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY TENDERCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$PROTOCOLREASON TENDERCAPTION.PROTOCOLREASON%TYPE := :NEW.PROTOCOLREASON;
  new$PROGINDEX TENDERCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$DOCNUMBER TENDERCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SECURITYTSIZE TENDERCAPTION.SECURITYTSIZE%TYPE := :NEW.SECURITYTSIZE;
  new$SECURITYASIZE TENDERCAPTION.SECURITYASIZE%TYPE := :NEW.SECURITYASIZE;
  new$AVANSSIZE TENDERCAPTION.AVANSSIZE%TYPE := :NEW.AVANSSIZE;
  new$PREFERENCECRIPPLE TENDERCAPTION.PREFERENCECRIPPLE%TYPE := :NEW.PREFERENCECRIPPLE;
  new$PREFERENCERUSPRODUCT TENDERCAPTION.PREFERENCERUSPRODUCT%TYPE := :NEW.PREFERENCERUSPRODUCT;
  new$PREFERENCEPRISON TENDERCAPTION.PREFERENCEPRISON%TYPE := :NEW.PREFERENCEPRISON;
  new$PURCHASESOCIALNKO TENDERCAPTION.PURCHASESOCIALNKO%TYPE := :NEW.PURCHASESOCIALNKO;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  CurVal$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_TENDERCAPTION_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$FacialAccCls is null) then 
    new$FacialAccCls := 0;
  END IF;
  /* задействовано в качестве Основания по закону в планах (Новый Уренгой) */
  if (new$ProgIndex = 230 and new$Multipurpose is null) then 
    new$Multipurpose := 0;
  END IF;
  if (new$AcceptSumma is null) then 
    new$AcceptSumma := 0;
  END IF;
  if (new$YearAcceptSumma is null) then 
    new$YearAcceptSumma := 0;
  END IF;
  if (new$Allowance is null) then 
    new$Allowance := 0;
  END IF;
      
  /* Заполнение Бюджета. Если пустой или ноль, берем из лицевого счета */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    BEGIN
      select fa.BudgetRef       into new$BudgetRef from FacialAcc_Cls fa
      where fa.Id = new$FacialAccCls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    GetIntConst(-1,3,new$BudgetRef);
  END IF;
      
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$SaleType is null) then 
    new$SaleType := 0;
  END IF;
  if (new$TenderOption is null) then 
    new$TenderOption := 0;
  END IF;
  if (new$InnerNumber is Null) then 
    new$InnerNumber := GEN_ID('G_TenderInnerNumber',1);
  END IF;
  if (new$RefinementCause is Null) then 
    new$RefinementCause := 0;
  END IF;
  if (new$Preference is Null) then 
    new$Preference := 0;
  END IF;
  if (new$UnknownAmount is null) then 
    new$UnknownAmount := 0;
  END IF;
  if (new$SupportUndertaker is null) then 
    new$SupportUndertaker := 0;
  END IF;
  if (new$PurchaseSocialNKO is null) then 
    new$PurchaseSocialNKO := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_TENDERCAPTION_BI_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* только для работы без состояний, так как при работе по схеме причину отклонения могут заполнить еще в не отклоненном документе */
  if (new$DocStateRef is null) then
    if (new$AcceptDate is null or new$RejectCls is null) then
      new$Accepted := 1;
          
    else
      new$Accepted := 0;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_TENDERCAPTION_BI_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
      
  /* Проверка указания внутренних номеров.*/
  if (new$InnerNumber is null) then
    RaiseException('EX_Ten_InnerNumsIsNull');
  END IF;
      
  /* Получение внутреннего номера уточнения*/  
  select max(AdjustmentNumber)
  into Tmp$         from TenderCaption 
  where (InnerNumber = new$InnerNumber)
  ;
  /* Если это первая запись в цепочке, тогда устанавливаем 0*/   
  if (Tmp$ is null) then
    new$AdjustmentNumber := 0;
        
  else
    new$AdjustmentNumber := Tmp$ + 1;    
  END IF;
      
  /* Флаг последнего уточнения устанавливается в единицу при вставке, только если уточнение не отклонено*/
  if ((new$Accepted = 0) and (new$AcceptDate is not null)) then
    new$LastAdjustment := 0;
        
  else
    new$LastAdjustment := 1;
  END IF;
      
  /* Если документ принят, тогда устанавливаем флаг последнего принятого в цепочке*/
  if ((new$AcceptDate is not null) and (new$Accepted = 1)) then 
    new$LastAccepted := 1;
        
  else
    new$LastAccepted := 0;
  END IF;
          
  /* Если документ является уточнением*/
  if (new$AdjustmentNumber > 0) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID) 
    into Tmp$, AdjID$             from TenderCaption 
    where (InnerNumber = new$InnerNumber) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/    
    if (Tmp$ <> 1) then 
      RaiseException('EX_Ten_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID) 
    into Tmp$             from TenderCaption
    where (InnerNumber = new$InnerNumber) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then 
      RaiseException('EX_Ten_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/        
    new$AdjustmentRef := AdjID$;
        
  else /* Если договор не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/        
    new$AdjustmentRef := null;
        
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (TR_TENDERCAPTION_BI_40)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$senderId is null) then 
    new$senderIdKey := -1;
      
  else 
    new$senderIdKey := new$senderId;
  END IF;
  if (new$SenderRecordID is null) then
    new$SenderRecordIDKey := new$ID;
      
  else 
    new$SenderRecordIDKey := new$SenderRecordID;
  END IF;

-- - - - - - - - - - - - -
-- BI_50 (TR_TENDERCAPTION_BI_50)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  if (new$InnerNumber is not null) then
    CurVal$ := GEN_ID('G_TENDERINNERNUMBER',0);
    if (CurVal$ < new$InnerNumber) then
      CurVal$ := GEN_ID('G_TENDERINNERNUMBER',new$InnerNumber - CurVal$);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_TENDERCAPTION_BI_500)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_TENDERCAPTION (
    ID,
    BUDGETREF,
    FACIALACCCLS,
    MULTIPURPOSE,
    DOCUMENTDATE,
    ACCEPTDATE,
    PERIOD,
    ACCEPTSUMMA,
    SALETYPE,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    DOCSTATEREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    LASTADJUSTMENT,
    LASTACCEPTED,
    ADJUSTMENTREF,
    ACCEPTED,
    EXPORTDATE,
    YEARACCEPTSUMMA,
    TENDEROPTION,
    TENDERTARGET,
    RVERSION,
    ALLOWANCE,
    REFINEMENTCAUSE,
    PREFERENCE,
    PREFERENCESIZE,
    SECURITY,
    UNKNOWNAMOUNT,
    PERIODYEAR,
    SUPPORTUNDERTAKER,
    AYEAR,
    REWORKCAUSE,
    NOTE,
    REALID,
    INNERNUMBER,
    ADJUSTMENTNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    PROTOCOLREASON,
    PROGINDEX,
    DOCNUMBER,
    SECURITYTSIZE,
    SECURITYASIZE,
    AVANSSIZE,
    PREFERENCECRIPPLE,
    PREFERENCERUSPRODUCT,
    PREFERENCEPRISON,
    PURCHASESOCIALNKO
  ) VALUES (
    new$ID,
    new$BUDGETREF,
    new$FACIALACCCLS,
    new$MULTIPURPOSE,
    new$DOCUMENTDATE,
    new$ACCEPTDATE,
    new$PERIOD,
    new$ACCEPTSUMMA,
    new$SALETYPE,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$DOCSTATEREF,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$LASTADJUSTMENT,
    new$LASTACCEPTED,
    new$ADJUSTMENTREF,
    new$ACCEPTED,
    new$EXPORTDATE,
    new$YEARACCEPTSUMMA,
    new$TENDEROPTION,
    new$TENDERTARGET,
    new$RVERSION,
    new$ALLOWANCE,
    new$REFINEMENTCAUSE,
    new$PREFERENCE,
    new$PREFERENCESIZE,
    new$SECURITY,
    new$UNKNOWNAMOUNT,
    new$PERIODYEAR,
    new$SUPPORTUNDERTAKER,
    new$AYEAR,
    new$REWORKCAUSE,
    new$NOTE,
    new$REALID,
    new$INNERNUMBER,
    new$ADJUSTMENTNUMBER,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$PROTOCOLREASON,
    new$PROGINDEX,
    new$DOCNUMBER,
    new$SECURITYTSIZE,
    new$SECURITYASIZE,
    new$AVANSSIZE,
    new$PREFERENCECRIPPLE,
    new$PREFERENCERUSPRODUCT,
    new$PREFERENCEPRISON,
    new$PURCHASESOCIALNKO);

-- - - - - - - - - - - - -
-- AI_10 (TR_TENDERCAPTION_AI_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Коррекция вспомогательных флагов в уточняемой записи*/
  if ((new$AdjustmentNumber > 0) and (new$LastAdjustment = 1)) then
    update TenderCaption set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);            
    if (new$LastAccepted = 1) then
      update TenderCaption set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_TENDERCAPTION_AI_500)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

   DELETE FROM delrecindexes
         WHERE (tableid = 139) AND (recordid = new$ID);

END;
/
commit work
/

-- #########################################################
-- #########################################################
-- Alter_TR_SignDocumentsGroup_BD.sql
-- #########################################################
-- #########################################################

/* скрипт добавляет в триггер каскадное удаление для таблицы детализации.

*/
-- CREATE TRIGGER tr_signdocumentsgroup_bd_0
CREATE OR REPLACE TRIGGER TR_SIGNDOCUMENTSGROUP_BD
  BEFORE DELETE
  ON SIGNDOCUMENTSGROUP
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_SignDocumentsGroup_BD_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  delete
  from SignDocumentsGroupDetail
  where (RecordIndex = :old.ID);

  delete from SignProfile
  where (SignDocumentsGroupRef = :old.id);

END;
/
commit work
/

-- #########################################################
-- #########################################################
-- AppliedDetail_patch.sql
-- #########################################################
-- #########################################################


CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPESDETAIL_BI
  BEFORE INSERT
  ON LAYERFIELDTYPESDETAIL
  FOR EACH ROW
begin

-- - - - - - - - - - - - -
-- BI_(0)
-- Create 01.07.2013
-- - - - - - - - - - - - -

    if (:new.id is null) then 
     select g_shared.NEXTVAL into :new.id from dual; end if;
    if (:new.mask is null) then 
     :new.mask := '';
    end if; 
    if (:new.regexp is null) then 
     :new.regexp := '';
    end if; 
    if ((:new.fieldsize is null) or (:new.fieldsize < 0))  then 
     :new.fieldsize := 0;
    end if; 

-- - - - - - - - - - - - -
-- BI_500
-- Create 01.07.2013
-- - - - - - - - - - - - -
  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;
  :NEW.CreaterUser := USER;
  :NEW.UpdaterUser := USER;
end;
/

CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPESDETAIL_BU
  BEFORE UPDATE
  ON LAYERFIELDTYPESDETAIL
  FOR EACH ROW
begin

-- - - - - - - - - - - - -
-- BU_(0)
-- Create 01.07.2013
-- - - - - - - - - - - - -

    if (:new.mask is null) then 
     :new.mask := '';
    end if; 
    if (:new.regexp is null) then 
     :new.regexp := '';
    end if; 
    if ((:new.fieldsize is null) or (:new.fieldsize < 0))  then 
     :new.fieldsize := 0;
    end if; 
    
-- - - - - - - - - - - - -
-- BU_500
-- Create 01.07.2013
-- - - - - - - - - - - - -
    :new.UpdateDate := SYSDATE;
    :new.UpdaterUser := User;
end;
/

commit work;


-- #########################################################
-- #########################################################
-- Fix_Nullable_Authorization_Fields.sql
-- #########################################################
-- #########################################################


/* Скрипт исправляет поля авторизации (проставляя NOT NULL) в таблицах ArchiveDocParams, ArchiveDocType, ArchiveOpLog,
   SignLog, SignParams, Signs, SignSchemeCaption, SignSchemeDetail */
alter table ArchiveDocParams modify (
  CreateDate not null,
  UpdateDate not null,
  CreaterUser not null,
  UpdaterUser not null)
/

alter table ArchiveDocType modify (
  CreateDate not null,
  UpdateDate not null,
  CreaterUser not null,
  UpdaterUser not null)
/

alter table ArchiveOpLog modify (
  CreateDate not null,
  CreaterUser not null)
/

alter table SignLog modify (
  CreateDate not null,
  UpdateDate not null,
  CreaterUser not null,
  UpdaterUser not null)
/

alter table SignParams modify (
  CreateDate not null,
  UpdateDate not null,
  CreaterUser not null,
  UpdaterUser not null)
/

alter table Signs modify (
  CreateDate not null,
  UpdateDate not null,
  CreaterUser not null,
  UpdaterUser not null)
/

alter table SignSchemeCaption modify (
  CreateDate not null,
  UpdateDate not null,
  CreaterUser not null,
  UpdaterUser not null)
/

alter table TB_SignSchemeDetail modify (
  CreateDate not null,
  UpdateDate not null,
  CreaterUser not null,
  UpdaterUser not null)
/

commit work
/



-- #########################################################
-- #########################################################
-- Drop_Tables901.sql
-- #########################################################
-- #########################################################

/* Удаляет старые таблицы */
/* Отчеты организаций */
-- drop trigger tr_ormeanstemplatestitle_bd
DROP TRIGGER TR_ORMEANSTEMPLATESTITLE_BD
/
drop table ORMEANSTEMPLATESDETAIL 
/
drop table ORMEANSTEMPLATESTITLE 
/
-- drop trigger tr_ormeanstitle_bd
DROP TRIGGER TR_ORMEANSTITLE_BD
/
drop table ORMEANSDETAIL 
/
drop table ORMEANSTITLE 
/
-- drop trigger tr_ormonthtemplatestitle_bd
DROP TRIGGER TR_ORMONTHTEMPLATESTITLE_BD
/
drop table ORMONTHTEMPLATESREFERENCE 
/
drop table ORMONTHTEMPLATESDETAIL 
/
drop table ORMONTHTEMPLATESTITLE 
/
-- drop trigger tr_ormonthtitle_bd
DROP TRIGGER TR_ORMONTHTITLE_BD
/
-- drop trigger TR_ORMONTHTITLE_BU_100
DROP TRIGGER TR_ORMONTHTITLE_BU
/
drop table ORMONTHDETAIL 
/
drop table ORMONTHREFERENCE 
/
drop table ORMONTHTITLE 
/
-- drop trigger tr_orquartertemplatestitle_bd
DROP TRIGGER TR_ORQUARTERTEMPLATESTITLE_BD
/
drop table ORQUARTERTEMPLATESDETAIL 
/
drop table ORQUARTERTEMPLATESTITLE 
/
-- drop trigger tr_orquartertitle_bd
DROP TRIGGER TR_ORQUARTERTITLE_BD
/
drop table ORQUARTERDETAIL 
/
drop table ORQUARTERTITLE 
/
-- drop trigger tr_orstafftemplatestitle_bd
DROP TRIGGER TR_ORSTAFFTEMPLTITLE_BD
/
drop table ORSTAFFTEMPLATESDETAIL 
/
drop table ORSTAFFTEMPLATESTITLE 
/
-- drop trigger tr_orstafftitle_bd
DROP TRIGGER TR_ORSTAFFTITLE_BD
/
drop table ORSTAFFDETAIL 
/
drop table ORSTAFFTITLE 
/
-- drop trigger tr_orvaluetemplatestitle_bd
DROP TRIGGER TR_ORVALUETEMPLATESTITLE_BD
/
drop table ORVALUETEMPLATESDETAIL 
/
drop table ORVALUETEMPLATESTITLE 
/
-- drop trigger tr_orvaluetitle_bd
DROP TRIGGER TR_ORVALUETITLE_BD
/
drop table ORVALUEDETAIL 
/
drop table ORVALUETITLE 
/

commit work 
/


-- #########################################################
-- #########################################################
-- CreateTable_oos_сontract.sql
-- #########################################################
-- #########################################################

/* Создание буферной таблицы для хранения импортируемых из ООС (Общероссийский официальный сайт) контрактов.*//* *****************************************************************************//* **                                 Tables                                 ***//* *****************************************************************************/
/* Таблица контрактов импортируемых из ООС*/
CREATE TABLE OOS_CONTRACT (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  ARCHIVENAME VARCHAR2(150),
  PACKETNAME VARCHAR2(150),
  REGNUM VARCHAR2(50),/* Номер реестровой записи контракта*/
  ANUMBER VARCHAR2(30),
  SIGNDATE NUMBER,
  VERSIONNUMBER NUMBER(10),
    CHECK((VERSIONNUMBER<=2147483647)AND(VERSIONNUMBER>-2147483648)),
  CUSTOMER_REGNUM VARCHAR2(11),/* Код заказчика по СПЗ*/
  CUSTOMER_FULLNAME VARCHAR2(2000),
  CUSTOMER_INN VARCHAR2(12),/* ИНН заказчика*/
  CUSTOMER_KPP VARCHAR2(9),/* КПП заказчика*/
  PROTOCOLDATE NUMBER,
  DOCUMENTBASE VARCHAR2(4000),
  PRICE NUMBER(15,2) default 0,
  SINGLECUSTOMERREASON_ID NUMBER(10),
    CHECK((SINGLECUSTOMERREASON_ID<=2147483647)AND(SINGLECUSTOMERREASON_ID>-2147483648)),
  SINGLECUSTOMERREASON_NAME VARCHAR2(1000),
  EXECUTIONDATE_MONTH NUMBER(5),/* Месяц исполнения*/
  EXECUTIONDATE_YEAR NUMBER(10),/* Год исполнения*/
    CHECK((EXECUTIONDATE_YEAR<=2147483647)AND(EXECUTIONDATE_YEAR>-2147483648)),
  SUPPLIER_INN VARCHAR2(12),/* ИНН поставщика*/
  SUPPLIER_KPP VARCHAR2(9),/* КПП поставщика*/
  SUPPLIER_ORGANIZATIONNAME VARCHAR2(4000),
  HREF VARCHAR2(1024),
  FCSORDER_PLACING VARCHAR2(2),/* Контракт поставщика по закупкам*/
  CREATERUSER VARCHAR2(30) NOT NULL,
  CREATEDATE DATE NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL,
  UPDATEDATE DATE NOT NULL
)
/
/* *****************************************************************************//* **                              Primary Keys                              ***//* *****************************************************************************/
ALTER TABLE OOS_CONTRACT ADD (
  CONSTRAINT PK_OOS_CONTRACT PRIMARY KEY (ID)
)
/
-- CREATE TRIGGER OOS_CONTRACT_BI0
CREATE OR REPLACE TRIGGER TR_OOS_CONTRACT_BI
  BEFORE INSERT
  ON OOS_CONTRACT
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (OOS_CONTRACT_BI0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then
    select g_shared.nextval into :new.id from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_ED_OOS_CONTRACT_BI_500
CREATE OR REPLACE TRIGGER TR_OOS_CONTRACT_BI
  BEFORE INSERT
  ON OOS_CONTRACT
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (OOS_CONTRACT_BI0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then
    select g_shared.nextval into :new.id from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_ED_OOS_CONTRACT_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- CREATE TRIGGER TR_ED_OOS_CONTRACT_BU_500
CREATE OR REPLACE TRIGGER TR_ED_OOS_CONTRACT_BU_500
  BEFORE UPDATE
  ON OOS_CONTRACT
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_ED_OOS_CONTRACT_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdaterUser := user;
  :new.UpdateDate := SYSDATE;

END;
/


/* *****************************************************************************/
/* **                               Privileges                               ***/
/* *****************************************************************************/


/* Privileges of users */
GRANT SELECT, INSERT, UPDATE, DELETE ON OOS_CONTRACT TO BUDGET_USERS
/
commit work
/


-- #########################################################
-- #########################################################
-- Alter_TR_ORG_ACCOUNTS_AU.sql
-- #########################################################
-- #########################################################

/* Заполнение поля FACIAL_CODE при изменении расчётного счёта обслуживающей организации */
-- CREATE TRIGGER TR_ORG_ACCOUNTS_AU
CREATE OR REPLACE TRIGGER TR_ORG_ACCOUNTS_IU
  INSTEAD OF UPDATE
  ON ORG_ACCOUNTS
  FOR EACH ROW
DECLARE
  new$ID ORG_ACCOUNTS.ID%TYPE := :NEW.ID;
  new$ORG_REF ORG_ACCOUNTS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$BANK_REF ORG_ACCOUNTS.BANK_REF%TYPE := :NEW.BANK_REF;
  new$ACC ORG_ACCOUNTS.ACC%TYPE := :NEW.ACC;
  new$ACC_CLS ORG_ACCOUNTS.ACC_CLS%TYPE := :NEW.ACC_CLS;
  new$FINTYPE ORG_ACCOUNTS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$CREATERUSER ORG_ACCOUNTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORG_ACCOUNTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORG_ACCOUNTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORG_ACCOUNTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$CLOSED ORG_ACCOUNTS.CLOSED%TYPE := :NEW.CLOSED;
  new$ACCDEFAULT ORG_ACCOUNTS.ACCDEFAULT%TYPE := :NEW.ACCDEFAULT;
  new$BANKDEPNUMBER ORG_ACCOUNTS.BANKDEPNUMBER%TYPE := :NEW.BANKDEPNUMBER;
  new$FACIALCODE ORG_ACCOUNTS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$SERVICE_ORG_REF ORG_ACCOUNTS.SERVICE_ORG_REF%TYPE := :NEW.SERVICE_ORG_REF;
  new$ACOMMENT ORG_ACCOUNTS.ACOMMENT%TYPE := :NEW.ACOMMENT;
  new$ISDEFAULT ORG_ACCOUNTS.ISDEFAULT%TYPE := :NEW.ISDEFAULT;
  new$RVERSION ORG_ACCOUNTS.RVERSION%TYPE := :NEW.RVERSION;
  new$SERVICE_ACC_REF ORG_ACCOUNTS.SERVICE_ACC_REF%TYPE := :NEW.SERVICE_ACC_REF;
  new$CLOSECODE ORG_ACCOUNTS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$SERVICEACC ORG_ACCOUNTS.SERVICEACC%TYPE := :NEW.SERVICEACC;
  new$FACIALACC_CLS ORG_ACCOUNTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
--
  DiffCode1$ NUMBER(10);
  Code11$ NUMBER(10);
  Code21$ NUMBER(10);
  Code31$ NUMBER(10);
  Code41$ NUMBER(10);
  Code5$ NUMBER(10);
  Temp1$ NUMBER(10);
  TempD$ NUMBER;
  vOrgType$ NUMBER(10);
  CurDate$ NUMBER;
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_ORG_ACCOUNTS_BU)
-- Version 7.02.00.3
-- - - - - - - - - - - - -

  if (new$ACC_CLS is null) then 
    new$ACC_CLS:= 0;
  END IF;
  if (new$AccDefault is null) then 
    new$AccDefault:= 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType:= 0;
  END IF;
  if ((new$AComment is null) or (new$AComment  is null) 
  or (new$AComment = :old.AComment) and (:old.AComment = :old.Acc)) then
    new$AComment := new$Acc;
  END IF;
  if ((new$IsDefault is not Null) and (new$IsDefault <> 0)
  and ((:old.IsDefault is Null) or (:old.IsDefault = 0))) then
    update ORG_ACCOUNTS set
    IsDefault = 0
    where ORG_REF = new$ORG_REF
    and IsDefault is not Null
    and IsDefault <> 0;
  END IF;
  if ((new$SERVICE_ORG_REF is null)and(new$SERVICE_ACC_REF is not null)) then
    BEGIN
      select
      oa.Org_Ref
      into
      new$SERVICE_ORG_REF    from
      org_accounts oa
      where
      (oa.id = new$SERVICE_ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* При изменении типа счета сносить в вид обслуживания значение вида обслуживания из типа счета */
  if (new$ACC_CLS <> :old.ACC_CLS) then
    BEGIN
      select SERVICETYPE into new$ServiceAcc from ACC_CLS where (id = new$ACC_CLS) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если изменяем вид обслуживания на банк, то надо очистить ссылки на обслуживающую организацию*/
  if (:old.ServiceAcc is not null and new$ServiceAcc = 0 and :old.ServiceAcc <> new$ServiceAcc) then
    new$service_acc_ref := null;
    new$service_org_ref := null;
     
  END IF;
  /* Если вид обслуживания из типа счета NULL, то писать 0(банк) */
  if (new$ServiceAcc is null) then
    new$ServiceAcc := 0;
    if (new$SERVICE_ORG_REF is not null) then
      BEGIN
        select
        o.Org_Type
        into vOrgType$      from
        Organizations o
        where
        (o.id = new$SERVICE_ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      if ((vOrgType$  > 10099)and(vOrgType$  < 10200)) then
        new$ServiceAcc := 3;
             
      else
        if ((vOrgType$  > 39999)and(vOrgType$  < 50000)) then
          new$ServiceAcc := 1;
        END IF;   
      END IF; 
    END IF;
  END IF;
  /* если изменился код в УФК надо снести его в лицевые счета */
  if (new$Acc <> :old.Acc) then
    update facialacc_cls set
    FACIALCODE = new$Acc
    where
    FCACCOUNT = new$id;
     
  END IF;
  /* если у счета заполнен счет обсл. орг. и вид обсл. не банк, то проставим банк,
      такой же, как и у счета обсл. организации */
  if ((new$Service_Acc_Ref is not null) and (new$ServiceAcc <> 0)
  and (new$Service_Acc_Ref <> :old.Service_Acc_Ref)) then
    BEGIN
      select
      Bank_Ref, Acc
      into new$Bank_Ref, new$FacialCode    from
      Org_Accounts
      where
      new$Service_Acc_Ref = Id
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Каскадное обновление */
  /* Если у счета поменялся банк, то нужно посмотреть где используется этот счет 
   в качестве счета Обслуживающей организации. Если да, то нужно поменять его там на новый */
  /* Если меняется имя счета, то смотрим где этот счет используется в качестве счета обслуж. организации */
  if (((new$Bank_Ref <> :old.Bank_Ref) or (new$Acc <> :old.Acc)) and (:old.id <> new$id)) then
    update Org_Accounts
    set Bank_Ref = new$Bank_Ref,
    FacialCode = new$Acc
    where Service_Acc_Ref = new$ID;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORG_ACCOUNTS_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  CloseOrgCls_Div(:old.CloseCode,Code11$, Code21$, Code31$, Code41$, Code5$);
    
  /* Если меняется банк, то нужно проверить не является ли он открытым, а счет закрытым по банку */
  if ((new$Bank_ref <> :old.Bank_ref) and (Code41$ = 1)) then 
    BEGIN
      select DateClose into TempD$ from Banks where ID = new$Bank_ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (TempD$ is null) then 
      Code41$ := 0; /* Так надо для случая, когда одновременно меняются и банк и обслуж. орг. */
      new$CloseCode := :old.CloseCode - 1000;
      
    END IF;
  END IF;
    
  /* Если меняется обслуживающая организация, она открыта и счет закрыт по обслуж. орг. - надо открыть */
  if ((new$Service_Acc_ref <> :old.Service_Acc_Ref) and (Code31$ = 1)) then 
    BEGIN
      select Closed into Temp1$ from Org_Accounts where ID = new$Service_Acc_Ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (Temp1$ is null) then 
      Code31$ := 0;
      new$CloseCode := :old.CloseCode - 100;
      
    END IF;
  END IF;
  /* случай закрытия/открытия пользователем */
  if (((new$Closed is null) and not(:old.Closed is null)) or
  (not(new$Closed is null) and (:old.Closed is null)))
  then 
    if (new$ORG_REF is not null and  new$facialacc_cls is not null)
    then
      BEGIN
        select o.Org_Type       into vOrgType$ from Organizations o where (o.id = new$ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* Синхронное закрытие лицевого счета для БУ/АУ*/
      if ((vOrgType$  >= 10800)and(vOrgType$  <= 10900))
      then
        if (new$Closed = 1)
        then
          /* закрываем лицевой счет */
          CurDateToDouble(CurDate$);

          update facialacc_cls
          set
          dateclose = CurDate$,
          CloseCode = 10000
          where id = new$facialacc_cls;
                  
        END IF;
        if (new$Closed is null)
        then
          /* открываем лицевой счет */
          update facialacc_cls
          set dateclose = null,
          CloseCode = 0
          where id = new$facialacc_cls;
              
        END IF;    
      END IF;
    END IF;
    if (new$Closed = 1) then 
      new$CloseCode := 1;
    END IF;
    if (new$Closed is null) then 
      new$CloseCode := 0;
      
    END IF;
  END IF;
    
  /* случаи закрытия/открытия не пользователем */
  if (new$CloseCode <> :old.CloseCode) then 
    DiffCode1$ := new$CloseCode - :old.CloseCode; /* >0 - счет закрывается, <0 - счет открывается*/
        
    /* Защита от "перезакрытия" */
    if (DiffCode1$ = 1) then 
      Code11$ := 1;
    END IF;
    if (DiffCode1$ = 10) then 
      Code21$ := 1;
    END IF;
    if (DiffCode1$ = 100) then 
      Code31$ := 1;
    END IF;
    if (DiffCode1$ = 1000) then 
      Code41$ := 1;
    END IF;
    if (DiffCode1$ = 10000) then 
      Code5$ := 1;
    END IF;
    if (DiffCode1$ = -1) then 
      Code11$ := 0;
    END IF;
    if (DiffCode1$ = -10) then 
      Code21$ := 0;
    END IF;
    if (DiffCode1$ = -100) then 
      Code31$ := 0;
    END IF;
    if (DiffCode1$ = -1000) then 
      Code41$ := 0;
    END IF;
    if (DiffCode1$ = -10000) then 
      Code5$ := 0;
    END IF;
    new$CloseCode := Code11$ + Code21$*10 + Code31$*100 + Code41$*1000 + Code5$*10000;
        
    if (new$CloseCode = 0) then 
      new$Closed := null; 
    else 
      new$Closed := 1;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORG_ACCOUNTS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (New$RVersion is null) then
    new$RVersion := 1;
  elsif ((new$RVersion = -1) and (:Old.RVersion <> -1)) then
    new$RVersion := :Old.RVersion;
  else
    new$RVersion := :Old.RVersion + 1;
  end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORG_ACCOUNTS SET
    ID = new$ID,
    ORG_REF = new$ORG_REF,
    BANK_REF = new$BANK_REF,
    ACC = new$ACC,
    ACC_CLS = new$ACC_CLS,
    FINTYPE = new$FINTYPE,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    CLOSED = new$CLOSED,
    ACCDEFAULT = new$ACCDEFAULT,
    BANKDEPNUMBER = new$BANKDEPNUMBER,
    FACIALCODE = new$FACIALCODE,
    SERVICE_ORG_REF = new$SERVICE_ORG_REF,
    ACOMMENT = new$ACOMMENT,
    ISDEFAULT = new$ISDEFAULT,
    RVERSION = new$RVERSION,
    SERVICE_ACC_REF = new$SERVICE_ACC_REF,
    CLOSECODE = new$CLOSECODE,
    SERVICEACC = new$SERVICEACC,
    FACIALACC_CLS = new$FACIALACC_CLS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_0 (TR_ORG_ACCOUNTS_AU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* При закрытии счета закрываем счета, у которых он указан как "Счет обслуживающей организации". Аналогично при открытии */
  if (new$CloseCode <> :old.CloseCode)
  then 
    if ((new$Closed is null) or (new$CloseCode < :old.CloseCode)) then
      update Org_Accounts set
      CloseCode = CloseCode - 100,
      RVersion = -1
      where Service_Acc_Ref = :old.ID;
          
    else
      update Org_Accounts set
      CloseCode = CloseCode + 100,
      RVersion = -1
      where Service_Acc_Ref = :old.ID;
      
    END IF;
  END IF;
  if (new$acc <> :old.acc and new$acc is not null and :old.acc is not null)
  then
    update org_accounts t
    set t.facialcode = new$acc
    where t.id in(
    select oa1.id
    from org_accounts oa1
    where
    oa1.service_acc_ref = new$id
    and oa1.service_org_ref = new$org_ref
    and oa1.service_org_ref is not null
    and new$org_ref is not null
    );

  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORG_ACCOUNTS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (21, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=21) and (RecordId=new$ID);
  end if;

END;
/
commit work
/

-- #########################################################
-- #########################################################
-- AlterCascadeDelRemoteClientByDBUsers.sql
-- #########################################################
-- #########################################################

/* 
  Каскадно мочим RemoteClient при удалении DBUsers 
*/
-- ALTER TRIGGER TR_DBUSERS_AD_10
CREATE OR REPLACE TRIGGER TR_DBUSERS_ID
  INSTEAD OF DELETE
  ON DBUSERS
  FOR EACH ROW
DECLARE
  CNT$1 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_DBUSERS_BD)
-- - - - - - - - - - - - -

        -- Запрет удаления пользователя SYSDBA
        if (:old.id = 0) then
                RaiseException('EX_CANTDELETETHIS');
        end if;

-- - - - - - - - - - - - -
-- BD_1 (TR_DBUSERS_BD_1)
-- - - - - - - - - - - - -

/* Каскад при удалении пользователя */
        delete from User_Workplaces     where Users_ref = :old.id;
    delete from ReportsPermissions where Userid = :old.id;
    delete from UsersInGroups  where UserRef = :old.id;
    delete from UsersRights  where UserRef = :old.id;
    delete from DualRights  where (UserRef = :old.id) and (IsGroup = 0);

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_DBUSERS
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AD_10 (TR_DBUSERS_AD_10)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* не должно остаться RemoteClients без DBUsers */  
  if (:old.RemoteClientRef is not null) then
    SELECT COUNT(dbu.ID ) INTO CNT$1
    from DBUsers dbu where (dbu.RemoteClientRef = :old.RemoteClientRef) AND (ROWNUM = 1);
    /* может быть несколько записей DBUsers ссылающихся на тот же RemoteClient, поэтому сначал проверим, что таких нет  */
    if (not (CNT$1<> 0)) then
      delete from RemoteClient where ID = :old.RemoteClientRef;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AD_500 (TR_DBUSERS_AD_500)
-- - - - - - - - - - - - -

/* фиксация удалений записей для синхронизации */
  insert into DelRecIndexes(TableID,RecordId,DeleteDate)
       values(100,:old.ID, sysdate);

END;
/
commit work
/


-- #########################################################
-- #########################################################
-- Alter_UINCODE_to_VARCHAR30_Ora.sql
-- #########################################################
-- #########################################################


/* Увеличение размера поля UINCODE до 30 символов */
alter table TB_FACIALFINCAPTION modify (UINCODE varchar2(30))
/

alter table BANKEXCH_MERDOC modify (UINCODE varchar2(30))
/

alter table ED_OUTPAYDOC modify (UINCODE varchar2(30))
/

alter table TB_INCOMES32 modify (UINCODE varchar2(30))
/

alter table TB_CORRECTIONDETAIL modify (UINCODE varchar2(30))
/

commit work
/



-- #########################################################
-- #########################################################
-- Date_Track_Off.sql
-- #########################################################
-- #########################################################

/* Убираем фиксацию времени изменения таблиц в DateConst - это по сути блокировочная запись,
  создающая конфликты и ожидания при параллельных изменениях соответствующих таблиц */
-- CREATE TRIGGER tr_Org_Accounts_bi_500
CREATE OR REPLACE TRIGGER TR_ORG_ACCOUNTS_II
  INSTEAD OF INSERT
  ON ORG_ACCOUNTS
  FOR EACH ROW
DECLARE
  new$ID ORG_ACCOUNTS.ID%TYPE := :NEW.ID;
  new$ORG_REF ORG_ACCOUNTS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$BANK_REF ORG_ACCOUNTS.BANK_REF%TYPE := :NEW.BANK_REF;
  new$ACC ORG_ACCOUNTS.ACC%TYPE := :NEW.ACC;
  new$ACC_CLS ORG_ACCOUNTS.ACC_CLS%TYPE := :NEW.ACC_CLS;
  new$FINTYPE ORG_ACCOUNTS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$CREATERUSER ORG_ACCOUNTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORG_ACCOUNTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORG_ACCOUNTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORG_ACCOUNTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$CLOSED ORG_ACCOUNTS.CLOSED%TYPE := :NEW.CLOSED;
  new$ACCDEFAULT ORG_ACCOUNTS.ACCDEFAULT%TYPE := :NEW.ACCDEFAULT;
  new$BANKDEPNUMBER ORG_ACCOUNTS.BANKDEPNUMBER%TYPE := :NEW.BANKDEPNUMBER;
  new$FACIALCODE ORG_ACCOUNTS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$SERVICE_ORG_REF ORG_ACCOUNTS.SERVICE_ORG_REF%TYPE := :NEW.SERVICE_ORG_REF;
  new$ACOMMENT ORG_ACCOUNTS.ACOMMENT%TYPE := :NEW.ACOMMENT;
  new$ISDEFAULT ORG_ACCOUNTS.ISDEFAULT%TYPE := :NEW.ISDEFAULT;
  new$RVERSION ORG_ACCOUNTS.RVERSION%TYPE := :NEW.RVERSION;
  new$SERVICE_ACC_REF ORG_ACCOUNTS.SERVICE_ACC_REF%TYPE := :NEW.SERVICE_ACC_REF;
  new$CLOSECODE ORG_ACCOUNTS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$SERVICEACC ORG_ACCOUNTS.SERVICEACC%TYPE := :NEW.SERVICEACC;
  new$FACIALACC_CLS ORG_ACCOUNTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
--
  OrgDateClose$ Number;
  AClosed$ Number(10);
  vOrgType$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_ORG_ACCOUNTS_BI)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$Org_Ref = 0) then 
    RaiseException('ex_CantAddUnknownOrgAcc');
  END IF;
  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$ACC_CLS is null) then 
    new$ACC_CLS:= 0;
  END IF;
  if (new$AccDefault is null) then 
    new$AccDefault:= 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType:= 0;
  END IF;
  if ((new$AComment is null) or (new$AComment  is null)) then 
    new$AComment := new$Acc;
  END IF;
  if ((new$IsDefault is not Null) and (new$IsDefault <> 0)) then
    update ORG_ACCOUNTS set
    IsDefault = 0
    where ORG_REF = new$ORG_REF
    and IsDefault is not Null
    and IsDefault <> 0;
  END IF;
  if ((new$SERVICE_ORG_REF is null)and(new$SERVICE_ACC_REF is not null)) then
    BEGIN
      select
      oa.Org_Ref
      into
      new$SERVICE_ORG_REF    from
      org_accounts oa
      where
      (oa.id = new$SERVICE_ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* При изменении типа счета сносить в вид обслуживания значение вида обслуживания из типа счета */
  if (new$ServiceAcc is null) then
    BEGIN
      select SERVICETYPE into new$ServiceAcc from ACC_CLS where (id = new$ACC_CLS) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если вид обслуживания из типа счета NULL, то писать 0(банк) */
  if (new$ServiceAcc is null) then
    new$ServiceAcc := 0;
    if (new$SERVICE_ORG_REF is not null) then
      BEGIN
        select
        o.Org_Type
        into vOrgType$      from
        Organizations o
        where
        (o.id = new$SERVICE_ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      if ((vOrgType$  > 10099)and(vOrgType$  < 10200)) then
        new$ServiceAcc := 3;
             
      else
        if ((vOrgType$  > 39999)and(vOrgType$  < 50000)) then
          new$ServiceAcc := 1;
        END IF;   
      END IF; 
    END IF;
  END IF;
  /* если у счета заполнен счет обсл. орг. и вид обсл. не банк, то проставим банк,
      такой же, как и у счета обсл. организации */
  if ((new$Service_Acc_Ref is not null) and (new$ServiceAcc <> 0)) then
    BEGIN
      select
      Bank_Ref, Acc
      into new$Bank_Ref, new$FacialCode    from
      Org_Accounts
      where
      new$Service_Acc_Ref = Id
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_ORG_ACCOUNTS_BI_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

  if (new$CloseCode is null) then new$CloseCode := 0; end if;

  if (new$Org_Ref is not null) then
    BEGIN
		select DateClose into OrgDateClose$ from organizations where Id = new$Org_ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (OrgDateClose$ is not null) then
      new$Closed := 1;
      new$CloseCode := 10; /* закрыт владельцем */
    end if;
  end if;

  if (new$Bank_Ref is not null) then
    BEGIN
		select DateClose into OrgDateClose$ from Banks where Id = new$Bank_ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END; 
    if (OrgDateClose$ is not null) then
      new$Closed := 1;
      new$CloseCode := new$CloseCode + 1000; /* закрыт банком */
    end if;
  end if;

  if (new$Service_Acc_Ref is not null) then
    BEGIN
		select Closed into AClosed$ from Org_Accounts where Id = new$Service_Acc_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END; 
    if (AClosed$ is not null) then
      new$Closed := 1;
      new$CloseCode := new$CloseCode + 100; /* закрыт обслуживающей организацией */
    end if;
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORG_ACCOUNTS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORG_ACCOUNTS (
    ID,
    ORG_REF,
    BANK_REF,
    ACC,
    ACC_CLS,
    FINTYPE,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    CLOSED,
    ACCDEFAULT,
    BANKDEPNUMBER,
    FACIALCODE,
    SERVICE_ORG_REF,
    ACOMMENT,
    ISDEFAULT,
    RVERSION,
    SERVICE_ACC_REF,
    CLOSECODE,
    SERVICEACC,
    FACIALACC_CLS
  ) VALUES (
    new$ID,
    new$ORG_REF,
    new$BANK_REF,
    new$ACC,
    new$ACC_CLS,
    new$FINTYPE,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$CLOSED,
    new$ACCDEFAULT,
    new$BANKDEPNUMBER,
    new$FACIALCODE,
    new$SERVICE_ORG_REF,
    new$ACOMMENT,
    new$ISDEFAULT,
    new$RVERSION,
    new$SERVICE_ACC_REF,
    new$CLOSECODE,
    new$SERVICEACC,
    new$FACIALACC_CLS);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORG_ACCOUNTS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 21) and (RecordID = new$ID);

END;
/
-- CREATE TRIGGER tr_FACIALACC_CLS_bi_500
CREATE OR REPLACE TRIGGER TR_FACIALACC_CLS_II
  INSTEAD OF INSERT
  ON FACIALACC_CLS
  FOR EACH ROW
DECLARE
  new$ID FACIALACC_CLS.ID%TYPE := :NEW.ID;
  new$CODE1 FACIALACC_CLS.CODE1%TYPE := :NEW.CODE1;
  new$CODE2 FACIALACC_CLS.CODE2%TYPE := :NEW.CODE2;
  new$CODE3 FACIALACC_CLS.CODE3%TYPE := :NEW.CODE3;
  new$CODE4 FACIALACC_CLS.CODE4%TYPE := :NEW.CODE4;
  new$KVSR FACIALACC_CLS.KVSR%TYPE := :NEW.KVSR;
  new$KCSR FACIALACC_CLS.KCSR%TYPE := :NEW.KCSR;
  new$KFSR FACIALACC_CLS.KFSR%TYPE := :NEW.KFSR;
  new$KVR FACIALACC_CLS.KVR%TYPE := :NEW.KVR;
  new$KESR FACIALACC_CLS.KESR%TYPE := :NEW.KESR;
  new$FINTYPE FACIALACC_CLS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$ORG_REF FACIALACC_CLS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$DATEOPEN FACIALACC_CLS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$SERVICEACCOUNT FACIALACC_CLS.SERVICEACCOUNT%TYPE := :NEW.SERVICEACCOUNT;
  new$STATUSACCOUNT FACIALACC_CLS.STATUSACCOUNT%TYPE := :NEW.STATUSACCOUNT;
  new$HARACTERACCOUNT FACIALACC_CLS.HARACTERACCOUNT%TYPE := :NEW.HARACTERACCOUNT;
  new$REGIONCLS FACIALACC_CLS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$CREATEDATE FACIALACC_CLS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALACC_CLS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$FACIALCODE FACIALACC_CLS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$MEANSTYPE FACIALACC_CLS.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$GENERALORG_REF FACIALACC_CLS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$DEPARTMENTCLS FACIALACC_CLS.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$RVERSION FACIALACC_CLS.RVERSION%TYPE := :NEW.RVERSION;
  new$CLOSEDOCNUMBER FACIALACC_CLS.CLOSEDOCNUMBER%TYPE := :NEW.CLOSEDOCNUMBER;
  new$HIGHERORG_REF FACIALACC_CLS.HIGHERORG_REF%TYPE := :NEW.HIGHERORG_REF;
  new$BUDGETREF FACIALACC_CLS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$FCACCOUNT FACIALACC_CLS.FCACCOUNT%TYPE := :NEW.FCACCOUNT;
  new$CLOSECODE FACIALACC_CLS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$DATECLOSE FACIALACC_CLS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$CREATERUSER FACIALACC_CLS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER FACIALACC_CLS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE FACIALACC_CLS.NOTE%TYPE := :NEW.NOTE;
  new$NAME FACIALACC_CLS.NAME%TYPE := :NEW.NAME;
  new$FACIALCODEEX FACIALACC_CLS.FACIALCODEEX%TYPE := :NEW.FACIALCODEEX;
  new$ISRBS FACIALACC_CLS.ISRBS%TYPE := :NEW.ISRBS;
  new$ISPBS FACIALACC_CLS.ISPBS%TYPE := :NEW.ISPBS;
  new$ISBU FACIALACC_CLS.ISBU%TYPE := :NEW.ISBU;
  new$ISSEPARATEBU FACIALACC_CLS.ISSEPARATEBU%TYPE := :NEW.ISSEPARATEBU;
  new$ISPROXY FACIALACC_CLS.ISPROXY%TYPE := :NEW.ISPROXY;
  new$OPENDOCNUMBER FACIALACC_CLS.OPENDOCNUMBER%TYPE := :NEW.OPENDOCNUMBER;
  new$ISOMS FACIALACC_CLS.ISOMS%TYPE := :NEW.ISOMS;
  new$CHANGEDOCNUMBER FACIALACC_CLS.CHANGEDOCNUMBER%TYPE := :NEW.CHANGEDOCNUMBER;
  new$DATECHANGE FACIALACC_CLS.DATECHANGE%TYPE := :NEW.DATECHANGE;
  new$GENERALORGFACIALACC FACIALACC_CLS.GENERALORGFACIALACC%TYPE := :NEW.GENERALORGFACIALACC;
  new$GRANTEEORG_REF FACIALACC_CLS.GRANTEEORG_REF%TYPE := :NEW.GRANTEEORG_REF;
--
  OrgDateClose$ Number;
  FCExEnable$ NUMBER(10);
  id_org$ NUMBER(10);
  id_reg$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FACIALACC_CLS_BI_0)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  facialacc_clsdiv(new$id,new$code1,new$code2,new$code3,new$code4);
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$kcsr is null) then 
    new$kcsr := 0;
  END IF;
  if (new$kfsr is null) then 
    new$kfsr := 0;
  END IF;
  if (new$kvr is null) then 
    new$kvr := 0;
  END IF;
  if (new$kesr is null) then 
    new$kesr := 0;
  END IF;
  if (new$fintype is null) then 
    new$fintype := 0;
  END IF;
  if (new$meanstype is null) then 
    new$meanstype := 0;
  END IF;
  if (new$haracteraccount is null) then 
    new$haracteraccount := 0;
  END IF;
  if (new$org_ref is null) then 
    new$org_ref := 0; -- поправил, был ранее select min (...)
  END IF;
  BEGIN

    -- Ставим ссылку на текущую организацию
    select o.generalorg_ref
    into id_org$     from organizations o
    where o.id = new$org_ref
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  if (id_org$  is null) then 
    id_org$ := new$org_ref;
  END IF;
  new$generalorg_ref := id_org$;
  BEGIN

    -- насильственная установка региона в лицевой счет
    -- согласно организации-владельца
    -- запрос региона --------------------------
    select o.RegionCLS
    into id_reg$     from Organizations o
    where o.ID = new$Org_Ref
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  new$regioncls := id_reg$;

-- - - - - - - - - - - - -
-- BI_100 (TR_FACIALACC_CLS_BI_100)
-- Create 01.12.2005
-- - - - - - - - - - - - -

/* Триггер перед вставкой - заполение ссылки на бюджет*/
   IF (    (   (new$ID = 0)
            OR (new$serviceaccount = 0)
            OR (new$serviceaccount IS NULL)
           )
       AND (new$budgetref IS NULL)
      ) THEN
      new$budgetRef := 0;
   END IF;

   IF (    (new$ID <> 0)
       AND (new$serviceaccount = 1)
       AND ((new$budgetref IS NULL) OR (new$budgetref = 0))
      ) THEN
      getintconst (-1, 3, new$budgetRef);
   END IF;

-- - - - - - - - - - - - -
-- BI_200 (TR_FACIALACC_CLS_BI_200)
-- Create 27.07.2007
-- - - - - - - - - - - - -

    if (new$Org_Ref is not null) then
      select DateClose into OrgDateClose$ from organizations where Id = new$Org_ref;
      if (OrgDateClose$ is not null) then
         if ((new$DateClose is null) or (new$DateClose > OrgDateClose$)) then
           new$DateClose := OrgDateClose$;
         end if;
         new$StatusAccount := 1;
         new$CloseCode := 10; /* Закрыт владельцем */
      end if;
    end if;
 
    if ((new$DateClose is not null) and (new$StatusAccount = 0)) then
      new$StatusAccount := 1;
      new$CloseCode := 1;
    end if;
 
    if (new$CloseCode is null) then new$CloseCode := 0; end if;

-- - - - - - - - - - - - -
-- BI_300 (TR_FACIALACC_CLS_BI_300)
-- Create 03.11.2010
-- - - - - - - - - - - - -

  GetIntConst(32, 42, FCExEnable$);
  if ((FCExEnable$ = 1) and (new$FacialCodeEx is null)) then
    RaiseException('EX_FacialCodeEx_Req');
  end if;  

-- - - - - - - - - - - - -
-- BI_400 (TR_FACIALACC_CLS_BI_400)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$IsRBS is null) then
    if (new$HaracterAccount in (1, 2)) then
      new$IsRBS := 1;
          
    else
      new$IsRBS := 0;
      
    END IF;
  END IF;
  if (new$IsPBS is null) then
    if (new$HaracterAccount in (0, 2)) then
      new$IsPBS := 1;
          
    else
      new$IsPBS := 0;
      
    END IF;
  END IF;
  if (new$IsBU is null) then
    new$IsBU := 0;
  END IF;
  if (new$IsOMS is null) then
    new$IsOMS := 0;
  END IF;
  if (new$IsSeparateBU is null) then
    new$IsSeparateBU := 0;
  END IF;
  if (new$IsProxy is null) then
    new$IsProxy := 0;
  END IF;
  if ((new$IsRBS + new$IsPBS + new$IsBU + new$IsOMS + new$IsSeparateBU + new$IsProxy) = 0) then
    new$HaracterAccount := 3;
      
  else
    if ((new$IsBU + new$IsOMS + new$IsSeparateBU + new$IsProxy) > 0) then
      new$HaracterAccount := 0;
          
    else
      if (new$IsRBS = 1) then
        new$HaracterAccount := new$IsRBS + new$IsPBS;
              
      else
        new$HaracterAccount := 0;
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_FACIALACC_CLS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_FACIALACC_CLS (
    ID,
    CODE1,
    CODE2,
    CODE3,
    CODE4,
    KVSR,
    KCSR,
    KFSR,
    KVR,
    KESR,
    FINTYPE,
    ORG_REF,
    DATEOPEN,
    SERVICEACCOUNT,
    STATUSACCOUNT,
    HARACTERACCOUNT,
    REGIONCLS,
    CREATEDATE,
    UPDATEDATE,
    FACIALCODE,
    MEANSTYPE,
    GENERALORG_REF,
    DEPARTMENTCLS,
    RVERSION,
    CLOSEDOCNUMBER,
    HIGHERORG_REF,
    BUDGETREF,
    FCACCOUNT,
    CLOSECODE,
    DATECLOSE,
    CREATERUSER,
    UPDATERUSER,
    NOTE,
    NAME,
    FACIALCODEEX,
    ISRBS,
    ISPBS,
    ISBU,
    ISSEPARATEBU,
    ISPROXY,
    OPENDOCNUMBER,
    ISOMS,
    CHANGEDOCNUMBER,
    DATECHANGE,
    GENERALORGFACIALACC,
    GRANTEEORG_REF
  ) VALUES (
    new$ID,
    new$CODE1,
    new$CODE2,
    new$CODE3,
    new$CODE4,
    new$KVSR,
    new$KCSR,
    new$KFSR,
    new$KVR,
    new$KESR,
    new$FINTYPE,
    new$ORG_REF,
    new$DATEOPEN,
    new$SERVICEACCOUNT,
    new$STATUSACCOUNT,
    new$HARACTERACCOUNT,
    new$REGIONCLS,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$FACIALCODE,
    new$MEANSTYPE,
    new$GENERALORG_REF,
    new$DEPARTMENTCLS,
    new$RVERSION,
    new$CLOSEDOCNUMBER,
    new$HIGHERORG_REF,
    new$BUDGETREF,
    new$FCACCOUNT,
    new$CLOSECODE,
    new$DATECLOSE,
    new$CREATERUSER,
    new$UPDATERUSER,
    new$NOTE,
    new$NAME,
    new$FACIALCODEEX,
    new$ISRBS,
    new$ISPBS,
    new$ISBU,
    new$ISSEPARATEBU,
    new$ISPROXY,
    new$OPENDOCNUMBER,
    new$ISOMS,
    new$CHANGEDOCNUMBER,
    new$DATECHANGE,
    new$GENERALORGFACIALACC,
    new$GRANTEEORG_REF);

-- - - - - - - - - - - - -
-- AI_500 (TR_FACIALACC_CLS_AI_500)
-- Last update 15.05.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 19) AND (RecordID = new$ID);

END;
/
-- CREATE TRIGGER tr_Organizations_bi_500
CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_II
  INSTEAD OF INSERT
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
--
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_Organizations_bi)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$FUID is null) then 
    new$FUID := new$id;
  END IF;
  if (new$GOSNI is null) then 
    new$GOSNI := 0;
  END IF;
  if (new$Name is null) then 
    new$Name := 'Не указано наименование';
  END IF;
  if (new$City is null) then 
    GetVarcharConst(-1,7,new$City);
  END IF;
  if (new$COUNTRY is null) then 
    new$COUNTRY := 'Россия';
  END IF;
  if (new$CountryCode is null) then 
    new$CountryCode := 643;
  END IF;
  if (new$ORG_CLS is NULL) then 
    new$ORG_CLS:= 0;
  END IF;
  if (new$SubINN is null) then 
    new$SubINN:= 0;
  END IF;
  if (new$INN20 is null) then 
    new$INN20:= '';
  END IF;
  if (new$RCOrg is null) then 
    new$RCOrg := 0;
  END IF;
  if (new$RegionCls is null) then 
    new$RegionCls := 0;
  END IF;
  if (new$OKATO is null) then 
    new$OKATO := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$OKFS is null) then 
    new$OKFS := 0;
  END IF;
  if (new$OKOPF is null) then 
    new$OKOPF := 0;
  END IF;
  if (new$FederalRegionCode is null) then
    GetIntConst(-1, 27,new$FederalRegionCode);
  END IF;
  if (new$FederalRegionCode is null) then
    new$FederalRegionCode := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;
  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$INN > 9999999999.9) and (new$INN20 <> '') and (new$INN20 is not null)) then
    RaiseException('EX_WRONGKPP');
  END IF;
  check_unique_organization(new$inn,  new$inn20);
  if (new$CostAuthority is null) then 
    new$CostAuthority:= 0;
  END IF;
  if (new$IncomeAuthority is null) then 
    new$IncomeAuthority := 0;
  END IF;
  if (new$DebtAuthority is null) then 
    new$DebtAuthority := 0;
  END IF;
  if (new$SVRAuthority is null) then 
    new$SVRAuthority := 0;
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if (new$Org_Type is not null)
  then 
    if (new$Org_Type between 10100 and 10299) then
      new$CostAuthority:= 1;
    END IF;
    if (new$Org_Type between 10300 and 10399) then
      new$CostAuthority:= 2;
    END IF;
    if (new$Org_Type between 10400 and 10499) then
      new$CostAuthority:= 4;
    END IF;
    if (((new$Org_Type between 10500 and 10599) and (new$CostAuthority<>16)) or
    (((new$Org_Type between 10000 and 10099) or (new$Org_Type between 10600 and 10799))
    and (new$CostAuthority=0))) then
      new$CostAuthority:= 8;
        
    END IF;
  else 
    new$Org_Type := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_ORGANIZATIONS_BI_10)
-- Last update 19.10.2006
-- - - - - - - - - - - - -

  if (new$FacialAcc is not null) then
    select count(id) into cnt$ from Organizations where (FacialAcc = new$FacialAcc) AND (ROWNUM = 1);
    if (cnt$ <> 0) then RaiseException('ex_DublicateFacialAcc'); end if;
  end if;

-- - - - - - - - - - - - -
-- BI_200 (TR_ORGANIZATIONS_BI_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;

    /*  При вставке КВСР берем из распорядителя, если он уже не заполнен*/
    if (new$KVSR = 0) then
      select o.KVSR into new$KVSR
      from Organizations o
      where o.id = new$GeneralOrg_Ref;
    end if;
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORGANIZATIONS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORGANIZATIONS (
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO
  ) VALUES (
    new$ID,
    new$NAME,
    new$GOSNI,
    new$CITY,
    new$COUNTRY,
    new$PHONE,
    new$ADDRESS,
    new$ORG_CLS,
    new$INN20,
    new$SUBINN,
    new$FACIALACC,
    new$REGIONCLS,
    new$DIRNAME,
    new$BUGNAME,
    new$DIRPHONE,
    new$BUGPHONE,
    new$RCORG,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$INN,
    new$OKATO,
    new$EMAIL,
    new$WEBSITE,
    new$UFKCODE,
    new$ADDOKATO,
    new$SHORTNAME,
    new$RVERSION,
    new$SENDERID,
    new$KVSR,
    new$OKFS,
    new$OKOPF,
    new$OPENDATE,
    new$CLOSEDATE,
    new$CHANGEDATE,
    new$GENERALORG_REF,
    new$FEDERALREGIONCODE,
    new$ORG_TYPE,
    new$BUDGETREF,
    new$SUPPLIERSTATUS,
    new$COUNTRYCODE,
    new$DATECLOSE,
    new$ORGCODE,
    new$COSTAUTHORITY,
    new$INCOMEAUTHORITY,
    new$DEBTAUTHORITY,
    new$SVRAUTHORITY,
    new$CLIENTID,
    new$DATEOPEN,
    new$FUID,
    new$OKPO,
    new$OKTMO);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORGANIZATIONS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 27) and (RecordID = new$ID);

END;
/
commit work
/


-- #########################################################
-- #########################################################
-- alter_ConstsTables.sql
-- #########################################################
-- #########################################################

ALTER TABLE intconst ADD (
  EditDocCode NUMBER(10),
    CHECK((EditDocCode<=2147483647)AND(EditDocCode>-2147483648)),
  CloseDate DATE
)
/
ALTER TABLE VarcharConst ADD (
  EditDocCode NUMBER(10),
    CHECK((EditDocCode<=2147483647)AND(EditDocCode>-2147483648)),
  CloseDate DATE
)
/
ALTER TABLE REALCONST ADD (
  EditDocCode NUMBER(10),
    CHECK((EditDocCode<=2147483647)AND(EditDocCode>-2147483648)),
  CloseDate DATE
)
/
ALTER TABLE DATECONST ADD (
  EditDocCode NUMBER(10),
    CHECK((EditDocCode<=2147483647)AND(EditDocCode>-2147483648)),
  CloseDate DATE
)
/
commit work
/
CREATE TABLE ChangeConstLog (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  IntValue NUMBER(10),
    CHECK((IntValue<=2147483647)AND(IntValue>-2147483648)),
  StrValue VARCHAR2(1024),
  FloatValue NUMBER,
  CreateDate DATE,
  CreaterUser VARCHAR2(30)
)
/
commit work 
/
-- CREATE TRIGGER TR_ChangeConstLog_BI_500
CREATE OR REPLACE TRIGGER TR_ChangeConstLog_BI
  BEFORE INSERT
  ON ChangeConstLog
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (TR_ChangeConstLog_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.CreaterUser := user;

END;
/
commit work 
/
-- CREATE TRIGGER TR_INTCONST_BU_0
CREATE OR REPLACE TRIGGER TR_INTCONST_BU
  BEFORE UPDATE
  ON INTCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INTCONST_BU_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.ConstValue <> :old.ConstValue) then
    insert into ChangeConstLog
    (ID, IntValue)
    values
    (:old.ID,:old.ConstValue);
  END IF;

END;
/
-- CREATE TRIGGER TR_VARCHARCONST_BU_0
CREATE OR REPLACE TRIGGER TR_VARCHARCONST_BU
  BEFORE UPDATE
  ON VARCHARCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_VARCHARCONST_BU_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.ConstValue <> :old.ConstValue) then
    insert into ChangeConstLog
    (ID, StrValue)
    values
    (:old.ID,:old.ConstValue);
  END IF;

END;
/
-- CREATE TRIGGER TR_REALCONST_BU_0
CREATE OR REPLACE TRIGGER TR_REALCONST_BU
  BEFORE UPDATE
  ON REALCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_REALCONST_BU_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.ConstValue <> :old.ConstValue) then
    insert into ChangeConstLog
    (ID, FloatValue)
    values
    (:old.ID,:old.ConstValue);
  END IF;

END;
/
-- CREATE TRIGGER TR_DATECONST_BU_0
CREATE OR REPLACE TRIGGER TR_DATECONST_BU
  BEFORE UPDATE
  ON DATECONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_DATECONST_BU_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.ConstValue <> :old.ConstValue) then
    insert into ChangeConstLog
    (ID, StrValue)
    values
    (:old.ID,:old.ConstValue);
  END IF;

END;
/
commit work 
/
grant SELECT, INSERT, UPDATE, DELETE on ChangeConstLog to BUDGET_USERS
/
commit work 
/

-- #########################################################
-- #########################################################
-- CreateTable_oos_сontract_finances.sql
-- #########################################################
-- #########################################################

/* Создание буферной таблицы для хранения детализации финансирования импортируемых из ООС (Общероссийский официальный сайт) контрактов.*//* *****************************************************************************//* **                                 Tables                                 ***//* *****************************************************************************/
/* Таблица детализации финансирования импортируемых из ООС контрактов*/
CREATE TABLE OOS_CONTRACT_FINANCES (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  RECORDINDEX NUMBER(10),
    CHECK((RECORDINDEX<=2147483647)AND(RECORDINDEX>-2147483648)),
  ISBUDGETARY NUMBER(5) default 0 NOT NULL,/* Тип финансирования 0 - Внебюджет, 1 - Бюджет*/
    CHECK (ISBUDGETARY in (0,1)),
  AYEAR NUMBER(10),/* Год*/
    CHECK((AYEAR<=2147483647)AND(AYEAR>-2147483648)),
  SUBSTAGEMONTH NUMBER(10),/* Месяц подэтапа*/
    CHECK((SUBSTAGEMONTH<=2147483647)AND(SUBSTAGEMONTH>-2147483648)),
  SUBSTAGEYEAR NUMBER(10),/* Год подэтапа*/
    CHECK((SUBSTAGEYEAR<=2147483647)AND(SUBSTAGEYEAR>-2147483648)),
  KBK VARCHAR2(20),
  PRICE NUMBER(15,2) default 0,
  CREATERUSER VARCHAR2(30) NOT NULL,
  CREATEDATE DATE NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL,
  UPDATEDATE DATE NOT NULL
)
/
/* *****************************************************************************//* **                              Primary Keys                              ***//* *****************************************************************************/
ALTER TABLE OOS_CONTRACT_FINANCES ADD (
  CONSTRAINT PK_OOS_CONTRACT_FINANCES PRIMARY KEY (ID)
)
/
/* *****************************************************************************//* **                              Foreign Keys                              ***//* *****************************************************************************/
ALTER TABLE OOS_CONTRACT_FINANCES ADD (
  CONSTRAINT FK_OOS_CONTRACT FOREIGN KEY (RECORDINDEX) REFERENCES OOS_CONTRACT (ID)
)
/
CREATE INDEX FK_OOS_CONTRACT ON OOS_CONTRACT_FINANCES(RECORDINDEX)
/
-- CREATE TRIGGER OOS_C_F_BI0
CREATE OR REPLACE TRIGGER TR_OOS_CONTRACT_FINANCES_BI
  BEFORE INSERT
  ON OOS_CONTRACT_FINANCES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (OOS_C_F_BI0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then
    select g_shared.nextval into :new.id from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_OOS_C_F_BI_500
CREATE OR REPLACE TRIGGER TR_OOS_CONTRACT_FINANCES_BI
  BEFORE INSERT
  ON OOS_CONTRACT_FINANCES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (OOS_C_F_BI0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then
    select g_shared.nextval into :new.id from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_OOS_C_F_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- CREATE TRIGGER TR_OOS_C_F_BU_500
CREATE OR REPLACE TRIGGER TR_OOS_C_F_BU_500
  BEFORE UPDATE
  ON OOS_CONTRACT_FINANCES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_OOS_C_F_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdaterUser := user;
  :new.UpdateDate := SYSDATE;

END;
/


/* *****************************************************************************/
/* **                               Privileges                               ***/
/* *****************************************************************************/


/* Privileges of users */
GRANT SELECT, INSERT, UPDATE, DELETE ON OOS_CONTRACT_FINANCES TO BUDGET_USERS
/
commit work
/


-- #########################################################
-- #########################################################
-- CreateTable_oos_сontract_products.sql
-- #########################################################
-- #########################################################

/* Создание буферной таблицы для хранения детализации предметов контракта импортируемых из ООС (Общероссийский официальный сайт) контрактов.*//* *****************************************************************************//* **                                 Tables                                 ***//* *****************************************************************************/
/* Таблица детализации предметов контрактов импортируемых из ООС*/
CREATE TABLE OOS_CONTRACT_PRODUCTS (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  RECORDINDEX NUMBER(10),
    CHECK((RECORDINDEX<=2147483647)AND(RECORDINDEX>-2147483648)),
  NAME VARCHAR2(4000),
  CREATERUSER VARCHAR2(30) NOT NULL,
  CREATEDATE DATE NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL,
  UPDATEDATE DATE NOT NULL
)
/
/* *****************************************************************************//* **                              Primary Keys                              ***//* *****************************************************************************/
ALTER TABLE OOS_CONTRACT_PRODUCTS ADD (
  CONSTRAINT PK_OOS_CONTRACT_PRODUCTS PRIMARY KEY (ID)
)
/
/* *****************************************************************************//* **                              Foreign Keys                              ***//* *****************************************************************************/
ALTER TABLE OOS_CONTRACT_PRODUCTS ADD (
  CONSTRAINT FK_OOS_CONTRACT_PRODUCTS FOREIGN KEY (RECORDINDEX) REFERENCES OOS_CONTRACT (ID)
)
/
CREATE INDEX FK_OOS_CONTRACT_PRODUCTS ON OOS_CONTRACT_PRODUCTS(RECORDINDEX)
/
-- CREATE TRIGGER OOS_C_P_BI0
CREATE OR REPLACE TRIGGER TR_OOS_CONTRACT_PRODUCTS_BI
  BEFORE INSERT
  ON OOS_CONTRACT_PRODUCTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (OOS_C_P_BI0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then
    select g_shared.nextval into :new.id from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_OOS_C_P_BI_500
CREATE OR REPLACE TRIGGER TR_OOS_CONTRACT_PRODUCTS_BI
  BEFORE INSERT
  ON OOS_CONTRACT_PRODUCTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (OOS_C_P_BI0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then
    select g_shared.nextval into :new.id from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_OOS_C_P_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- CREATE TRIGGER TR_OOS_C_P_BU_500
CREATE OR REPLACE TRIGGER TR_OOS_C_P_BU_500
  BEFORE UPDATE
  ON OOS_CONTRACT_PRODUCTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_OOS_C_P_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdaterUser := user;
  :new.UpdateDate := SYSDATE;

END;
/


/* *****************************************************************************/
/* **                               Privileges                               ***/
/* *****************************************************************************/


/* Privileges of users */
GRANT SELECT, INSERT, UPDATE, DELETE ON OOS_CONTRACT_PRODUCTS TO BUDGET_USERS
/
commit work
/


-- #########################################################
-- #########################################################
-- Alter_TR_WritDetail_BI_BU_UpdateSumm.sql
-- #########################################################
-- #########################################################

/* 
  В детализации исполнительных листов добавляем обнуление сум месяцев и кварталов , если они не были заполнены
*/
/* обновляем старые данные*/

update WritExecutionDetail 
set Month01 = 0
where Month01 is null
/
update WritExecutionDetail 
set Month02 = 0
where Month02 is null
/
update WritExecutionDetail 
set Month03 = 0
where Month03 is null
/
update WritExecutionDetail 
set Month04 = 0
where Month04 is null
/
update WritExecutionDetail 
set Month05 = 0
where Month05 is null
/
update WritExecutionDetail 
set Month06 = 0
where Month06 is null
/
update WritExecutionDetail 
set Month07 = 0
where Month07 is null
/
update WritExecutionDetail 
set Month08 = 0
where Month08 is null
/
update WritExecutionDetail 
set Month09 = 0
where Month09 is null
/
update WritExecutionDetail 
set Month10 = 0
where Month10 is null
/
update WritExecutionDetail 
set Month11 = 0
where Month11 is null
/
update WritExecutionDetail 
set Month12 = 0
where Month12 is null
/
update WritExecutionDetail 
set Quarter1 = 0
where Quarter1 is null
/
update WritExecutionDetail 
set Quarter2 = 0
where Quarter2 is null
/
update WritExecutionDetail 
set Quarter3 = 0
where Quarter3 is null
/
update WritExecutionDetail 
set Quarter4 = 0
where Quarter4 is null
/
update WritExecutionDetail 
set WritExecutionSumma = 0
where WritExecutionSumma is null
/
-- ALTER TRIGGER TR_WRITEXECUTIONDETAIL_BI
CREATE OR REPLACE TRIGGER TR_WRITEXECUTIONDETAIL_BI
  BEFORE INSERT
  ON WRITEXECUTIONDETAIL
  FOR EACH ROW
DECLARE
  BPInnerNum$ NUMBER(10);
  PromiseMode$ NUMBER(10);
  Promise_Count$ NUMBER(10);
  ConstCheck$ NUMBER(10);
  PromiseMode1$ NUMBER(10);
  ProgIndex$ NUMBER(10);
  ExecID$ NUMBER(10);
  ExecInnerNumber$ NUMBER(10);
  AgrInnerNumber$ NUMBER(10);
  ScheduleRef1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_WRITEXECUTIONDETAIL_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then 
    select g_shared.nextval into :new.id from dual;
  END IF;
  if (:new.BudgetRef is null) then
    BEGIN
      select 
      writ_c.BudgetRef 
      into :new.BudgetRef     from 
      WritExecutionCaption writ_c
      where 
      writ_c.id = :new.RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
    
  if (:new.Progindex is null) then 
    :new.Progindex := 556;  
  END IF;
  if (:new.FacialAcc_Cls is null) then 
    :new.FacialAcc_Cls := 0;
  END IF;
  if (:new.KVSR is null) then 
    :new.KVSR := 0;
  END IF;
  if (:new.KFSR is null) then 
    :new.KFSR := 0;
  END IF;
  if (:new.KESR is null) then 
    :new.KESR := 0;
  END IF;
  if (:new.KVR is null) then 
    :new.KVR := 0;
  END IF;
  if (:new.KCSR is null) then 
    :new.KCSR := 0;
  END IF;
  if (:new.MeansType is null) then 
    :new.MeansType := 0;
  END IF;
  if (:new.Fact is null) then 
    :new.Fact := 0;
  END IF;
  if (:new.DirectionCls is null) then 
    :new.DirectionCls := 0;
  END IF;
  if (:new.RegionCLS is null) then 
    :new.RegionCLS := 0;
  END IF;
  if (:new.Finsource is null) then 
    :new.Finsource := 0;
  END IF;
  if (:new.FinType is null) then 
    :new.FinType := 0;
  END IF;
  if (:new.DocType is null) then 
    :new.DocType := 0;
  END IF;
  if (:new.SubKesr is null) then 
    :new.SubKesr := 0;
  END IF;
    
  if (:new.Month01 IS NULL) then  
    :new.Month01 := 0;
  END IF;
  if (:new.Month02 IS NULL) then  
    :new.Month02 := 0;
  END IF;
  if (:new.Month03 IS NULL) then  
    :new.Month03 := 0;
  END IF;
  if (:new.Month04 IS NULL) then  
    :new.Month04 := 0;
  END IF;
  if (:new.Month05 IS NULL) then  
    :new.Month05 := 0;
  END IF;
  if (:new.Month06 IS NULL) then  
    :new.Month06 := 0;
  END IF;
  if (:new.Month07 IS NULL) then  
    :new.Month07 := 0;
  END IF;
  if (:new.Month08 IS NULL) then  
    :new.Month08 := 0;
  END IF;
  if (:new.Month09 IS NULL) then  
    :new.Month09 := 0;
  END IF;
  if (:new.Month10 IS NULL) then  
    :new.Month10 := 0;
  END IF;
  if (:new.Month11 IS NULL) then  
    :new.Month11 := 0;
  END IF;
  if (:new.Month12 IS NULL) then  
    :new.Month12 := 0;
  END IF;
    
  if (:new.Quarter1 IS NULL) then  
    :new.Quarter1 := 0;
  END IF;
  if (:new.Quarter2 IS NULL) then  
    :new.Quarter2 := 0;
  END IF;
  if (:new.Quarter3 IS NULL) then  
    :new.Quarter3 := 0;
  END IF;
  if (:new.Quarter4 IS NULL) then  
    :new.Quarter4 := 0;
  END IF;
    
  if (:new.WritExecutionSumma is Null) then 
    :new.WritExecutionSumma := 0; 
  END IF;
  if ((not :new.PROMISE is null) and (not :new.BUDGETPROMISE is null)) then
    BEGIN
      select ps.id     into ScheduleRef1$ from PaymentSchedule ps
      where (ps.InnerPromiseNum = :new.BUDGETPROMISE) and
      (ps.ANumber = :new.PROMISE)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (ScheduleRef1$ <> 0) then
    :new.PScheduleRef := ScheduleRef1$;
      
  else
    :new.PScheduleRef := null;
  END IF;

-- - - - - - - - - - - - -
-- BI_200 (TR_WRITEXECUTIONDETAIL_BI_200)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* проставляем номера бюджетных обязательств по Учету договоров*/
  GetIntConst(30, 15,PromiseMode$);
  getintconst(30, 35,ConstCheck$);
  /* (старые БО) Проверка существует ли такой номер БО, на который ссылается уведомление*/
  if ((PromiseMode$ <> 1) and (ConstCheck$ = 1)) then
    if (:new.Promise is not null) then
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count$        from
      promise_detail pr
      where
      (pr.registrnumber = :new.PROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count$ = 0) then
        RaiseException('EX_BP_NotExist');    
      END IF;  
    END IF;/* end проверки PromiseMode <> 1*/
  END IF;
  /* (новые БО) Проверка существует ли такой номер БО, на который ссылается уведомление*/
  /* и простановка старого БО по новому номеру БО */
  if (PromiseMode$ = 1) then
    if ((:new.Promise is not null) and (:new.BudgetPromise is null)) then
      select 
      max(InnerPromiseNum) 
      into BPInnerNum$       from 
      PaymentSchedule 
      where 
      (ANumber = :new.Promise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum$ <> 0) then
        :new.BudgetPromise := BPInnerNum$;
              
      else
        RaiseException('EX_BP_NotExist');    
      END IF;
    END IF;
    /* Если есть новый номер, но нет старого, тогда проставляем старый*/
    if ((:new.BudgetPromise is not null) and (:new.Promise is null)) then
      BEGIN
        select 
        ANumber 
        into BPInnerNum$       from 
        PaymentSchedule
        where 
        (InnerPromiseNum = :new.BudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
            
      :new.Promise := BPInnerNum$;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_210 (TR_WRITEXECUTIONDETAIL_BI_210)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  /* используем болк учета договоров?*/
  GetIntConst(30, 15,PromiseMode1$);
  if (PromiseMode1$ = 1) then
    /* при простановке БО плательщика или его изменении */
    if (:new.Promise is not null) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = :new.Promise and ps.InnerPromiseNum = :new.BudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;  
    END IF;/* использование блока "Учет договоров"*/
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_WRITEXECUTIONDETAIL_BI_500)
-- Create 02.04.2010
-- Last update 02.04.2010
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- ALTER TRIGGER TR_WRITEXECUTIONDETAIL_BU
CREATE OR REPLACE TRIGGER TR_WRITEXECUTIONDETAIL_BU
  BEFORE UPDATE
  ON WRITEXECUTIONDETAIL
  FOR EACH ROW
DECLARE
  BPInnerNum1$ NUMBER(10);
  PromiseMode1$ NUMBER(10);
  Promise_Count1$ NUMBER(10);
  ConstCheck1$ NUMBER(10);
  PromiseMode$ NUMBER(10);
  ProgIndex$ NUMBER(10);
  ExecID$ NUMBER(10);
  ExecInnerNumber$ NUMBER(10);
  AgrInnerNumber$ NUMBER(10);
  ScheduleRef1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_WRITEXECUTIONDETAIL_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.BudgetRef is null) then
    BEGIN
      select 
      writ_c.BudgetRef 
      into :new.BudgetRef     from 
      WritExecutionCaption writ_c
      where 
      writ_c.id = :new.RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (:new.Progindex is null) then 
    :new.Progindex := 556;    
  END IF;
  if (:new.FacialAcc_Cls is null) then 
    :new.FacialAcc_Cls := 0;
  END IF;
  if (:new.KVSR is null) then 
    :new.KVSR := 0;
  END IF;
  if (:new.KFSR is null) then 
    :new.KFSR := 0;
  END IF;
  if (:new.KESR is null) then 
    :new.KESR := 0;
  END IF;
  if (:new.KVR is null) then 
    :new.KVR := 0;
  END IF;
  if (:new.KCSR is null) then 
    :new.KCSR := 0;
  END IF;
  if (:new.MeansType is null) then 
    :new.MeansType := 0;
  END IF;
  if (:new.Fact is null) then 
    :new.Fact := 0;
  END IF;
  if (:new.DirectionCls is null) then 
    :new.DirectionCls := 0;
  END IF;
  if (:new.RegionCLS is null) then 
    :new.RegionCLS := 0;
  END IF;
  if (:new.Finsource is null) then 
    :new.Finsource := 0;
  END IF;
  if (:new.FinType is null) then 
    :new.FinType := 0;
  END IF;
  if (:new.DocType is null) then 
    :new.DocType := 0;
  END IF;
  if (:new.SubKesr is null) then 
    :new.SubKesr := 0;
  END IF;
    
  if (:new.Month01 IS NULL) then  
    :new.Month01 := 0;
  END IF;
  if (:new.Month02 IS NULL) then  
    :new.Month02 := 0;
  END IF;
  if (:new.Month03 IS NULL) then  
    :new.Month03 := 0;
  END IF;
  if (:new.Month04 IS NULL) then  
    :new.Month04 := 0;
  END IF;
  if (:new.Month05 IS NULL) then  
    :new.Month05 := 0;
  END IF;
  if (:new.Month06 IS NULL) then  
    :new.Month06 := 0;
  END IF;
  if (:new.Month07 IS NULL) then  
    :new.Month07 := 0;
  END IF;
  if (:new.Month08 IS NULL) then  
    :new.Month08 := 0;
  END IF;
  if (:new.Month09 IS NULL) then  
    :new.Month09 := 0;
  END IF;
  if (:new.Month10 IS NULL) then  
    :new.Month10 := 0;
  END IF;
  if (:new.Month11 IS NULL) then  
    :new.Month11 := 0;
  END IF;
  if (:new.Month12 IS NULL) then  
    :new.Month12 := 0;
  END IF;
    
  if (:new.Quarter1 IS NULL) then  
    :new.Quarter1 := 0;
  END IF;
  if (:new.Quarter2 IS NULL) then  
    :new.Quarter2 := 0;
  END IF;
  if (:new.Quarter3 IS NULL) then  
    :new.Quarter3 := 0;
  END IF;
  if (:new.Quarter4 IS NULL) then  
    :new.Quarter4 := 0;
  END IF;
    
  if (:new.WritExecutionSumma is Null) then 
    :new.WritExecutionSumma := 0; 
  END IF;
  if ((not :new.PROMISE is null) and (not :new.BUDGETPROMISE is null)) then
    BEGIN
      select ps.id     into ScheduleRef1$ from PaymentSchedule ps
      where (ps.InnerPromiseNum = :new.BUDGETPROMISE) and
      (ps.ANumber = :new.PROMISE)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (ScheduleRef1$ <> 0) then
    :new.PScheduleRef := ScheduleRef1$;
      
  else
    :new.PScheduleRef := null;
    
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_WRITEXECUTIONDETAIL_BU_200)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* проставляем номера бюджетных обязательств по Учету договоров*/
  GetIntConst(30, 15,PromiseMode1$);
  getintconst(30, 35,ConstCheck1$);
  /* (старые БО) Проверка существует ли такой номер БО, на который ссылается уведомление*/
  if ((PromiseMode1$ <> 1) and (ConstCheck1$ = 1)) then
    if ((:new.Promise is not null)and((:old.Promise is null)or(:old.Promise <> :new.Promise ))) then
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count1$        from
      promise_detail pr
      where
      (pr.registrnumber = :new.PROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count1$ = 0) then
        RaiseException('EX_BP_NotExist');    
      END IF;  
    END IF;/* end проверки PromiseMode <> 1*/
  END IF;
  /* (новые БО) Проверка существует ли такой номер БО, на который ссылается уведомление*/
  /* и простановка старого БО по новому номеру БО */
  if (PromiseMode1$ = 1) then
    if ((:new.Promise is not null)and((:old.Promise is null)or(:old.Promise <> :new.Promise )) and 
    (:new.BudgetPromise is null) and (:old.BudgetPromise is null)) then
      select 
      max(InnerPromiseNum) 
      into BPInnerNum1$       from 
      PaymentSchedule 
      where 
      (ANumber = :new.Promise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum1$ <> 0) then
        :new.BudgetPromise := BPInnerNum1$;
              
      else
        RaiseException('EX_BP_NotExist');    
      END IF;
    END IF;
        
    /* Если изменился новый номер и при этом старый NULL, тогда устанавливаем старый */
    if (:new.Promise is null and ((:new.BudgetPromise is not null and :old.BudgetPromise is null) or
    (:new.BudgetPromise <> :old.BudgetPromise))) then
      BEGIN
        select 
        ANumber 
        into BPInnerNum1$       from 
        PaymentSchedule
        where 
        (InnerPromiseNum = :new.BudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
            
      :new.Promise := BPInnerNum1$;
          
    END IF;
        
    /* Если удалили новый номер, то нужно удалить и старый*/
    if ((:new.BudgetPromise is null) and (:old.BudgetPromise is not null)) then
      :new.Promise := null;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_210 (TR_WRITEXECUTIONDETAIL_BU_210)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  /* используем болк учета договоров?*/
  GetIntConst(30, 15,PromiseMode$);
  if (PromiseMode$ = 1) then
    /* при изменении БО плательщика или изменили ДИ */
    if (:new.Promise is not null and (
    (:old.Promise is null or :old.Promise <> :new.Promise) or
    (:old.ExecDoc is null or :new.ExecDoc is null or :old.ExecDoc <> :new.ExecDoc)
    )) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = :new.Promise and ps.InnerPromiseNum = :new.BudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;  
    END IF;/* использование блока "Учет договоров"*/
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_WRITEXECUTIONDETAIL_BU_700)
-- Create 02.04.2010
-- Last update 02.04.2010
-- - - - - - - - - - - - -

  if (:new.RVersion is null) then
    :new.RVersion := 1;
  elsif ((:new.RVersion = -1) and (:old.RVersion <> -1)) then
    :new.RVersion := :old.RVersion;
  else
    :new.RVersion := :old.RVersion + 1;
  end if;

END;
/

commit work
/

-- #########################################################
-- #########################################################
-- Add_DocChangeDate.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет дату изменения заголовка/детали для таблиц 
   BudNotify, QuotesTitle, CorrectionCaption, BuhOperationCls; 
   добавляет триггер на удаление для FACIALFINDETAIL */
-- CREATE TRIGGER TR_FACIALFINDETAIL_BD_500
CREATE OR REPLACE TRIGGER TR_FACIALFINDETAIL_ID
  INSTEAD OF DELETE
  ON FACIALFINDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_500 (TR_FACIALFINDETAIL_BD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  Update facialfincaption set
  DocChangeDate = SYSDATE,
  RVersion=-1
  where id=:old.recordindex;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_FACIALFINDETAIL
  WHERE id = :old.id;

-- - - - - - - - - - - - -
-- AD_500 (TR_FACIALFINDETAIL_AD_500)
-- Last update 27.08.2004
-- - - - - - - - - - - - -

  INSERT INTO DelRecIndexes
              (TableID, RecordId, DeleteDate, ProgIndex, Summa)
       VALUES (22, :OLD.ID, SYSDATE, :OLD.ProgIndex, :OLD.Credit);

END;
/
/* BudNotify */
ALTER TABLE TB_BudNotify ADD (
  DocChangeDate DATE
)
/

CREATE OR REPLACE VIEW BudNotify (
  ID,
  DAT,
  DOCDAT,
  NOTE1,
  NOTIFYTYPE,
  BUDGETREF,
  DOCBASE,
  VARIANT,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  SENDERID,
  SENDERRECORDID,
  ANUMBER,
  ATYPE,
  DOCUMENTSTATE,
  USERSVISA,
  DATEINPUT,
  ORGREF,
  REJECTCLS,
  REJECTNOTE,
  PLANDOCTYPE,
  RECORDINDEX,
  STIMATEID,
  CRYPTOSTATUS,
  RVERSION,
  DOCSTATEREF,
  DOCNUMBER,
  FACIALACCCLS,
  LASTEXTRCHANGE,
  BIDNUMBER,
  FAXDOCCOUNT,
  PLANKIND,
  ASSIGNMENTSOURCE,
  BA_LBO_FLAG,
  KPPERIOD,
  CLSTYPE,
  DATE_UTV_PP,
  PROGINDEX,
  NOTE,
  NOTE2,
  DOCCHANGEDATE)
AS
  SELECT
    ID,
    DAT,
    DOCDAT,
    NOTE1,
    NOTIFYTYPE,
    BUDGETREF,
    DOCBASE,
    VARIANT,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    SENDERID,
    SENDERRECORDID,
    ANUMBER,
    ATYPE,
    DOCUMENTSTATE,
    USERSVISA,
    DATEINPUT,
    ORGREF,
    REJECTCLS,
    REJECTNOTE,
    PLANDOCTYPE,
    RECORDINDEX,
    STIMATEID,
    CRYPTOSTATUS,
    RVERSION,
    DOCSTATEREF,
    DOCNUMBER,
    FACIALACCCLS,
    LASTEXTRCHANGE,
    BIDNUMBER,
    FAXDOCCOUNT,
    PLANKIND,
    ASSIGNMENTSOURCE,
    BA_LBO_FLAG,
    KPPERIOD,
    CLSTYPE,
    DATE_UTV_PP,
    PROGINDEX,
    NOTE,
    NOTE2,
    DOCCHANGEDATE
  FROM TB_BudNotify
/

CREATE OR REPLACE TRIGGER TR_BUDNOTIFY_ID
  INSTEAD OF DELETE
  ON BUDNOTIFY
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_BUDNOTIFY_BD)
-- - - - - - - - - - - - -

  delete from BudgetData where (RecordIndex = :old.id);

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_BUDNOTIFY
  WHERE id=:old.id;

-- - - - - - - - - - - - -
-- AD_500 (TR_BUDNOTIFY_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(tableid, recordid, deletedate, createruser, progindex) values(28, :old.id, SYSDATE, user, :old.progindex);

END;
/

CREATE OR REPLACE TRIGGER TR_BUDNOTIFY_II
  INSTEAD OF INSERT
  ON BUDNOTIFY
  FOR EACH ROW
DECLARE
  new$ID BUDNOTIFY.ID%TYPE := :NEW.ID;
  new$DAT BUDNOTIFY.DAT%TYPE := :NEW.DAT;
  new$DOCDAT BUDNOTIFY.DOCDAT%TYPE := :NEW.DOCDAT;
  new$NOTE1 BUDNOTIFY.NOTE1%TYPE := :NEW.NOTE1;
  new$NOTIFYTYPE BUDNOTIFY.NOTIFYTYPE%TYPE := :NEW.NOTIFYTYPE;
  new$BUDGETREF BUDNOTIFY.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DOCBASE BUDNOTIFY.DOCBASE%TYPE := :NEW.DOCBASE;
  new$VARIANT BUDNOTIFY.VARIANT%TYPE := :NEW.VARIANT;
  new$CREATERUSER BUDNOTIFY.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE BUDNOTIFY.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE BUDNOTIFY.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER BUDNOTIFY.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$SENDERID BUDNOTIFY.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID BUDNOTIFY.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$ANUMBER BUDNOTIFY.ANUMBER%TYPE := :NEW.ANUMBER;
  new$ATYPE BUDNOTIFY.ATYPE%TYPE := :NEW.ATYPE;
  new$DOCUMENTSTATE BUDNOTIFY.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA BUDNOTIFY.USERSVISA%TYPE := :NEW.USERSVISA;
  new$DATEINPUT BUDNOTIFY.DATEINPUT%TYPE := :NEW.DATEINPUT;
  new$ORGREF BUDNOTIFY.ORGREF%TYPE := :NEW.ORGREF;
  new$REJECTCLS BUDNOTIFY.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTNOTE BUDNOTIFY.REJECTNOTE%TYPE := :NEW.REJECTNOTE;
  new$PLANDOCTYPE BUDNOTIFY.PLANDOCTYPE%TYPE := :NEW.PLANDOCTYPE;
  new$RECORDINDEX BUDNOTIFY.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$STIMATEID BUDNOTIFY.STIMATEID%TYPE := :NEW.STIMATEID;
  new$CRYPTOSTATUS BUDNOTIFY.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$RVERSION BUDNOTIFY.RVERSION%TYPE := :NEW.RVERSION;
  new$DOCSTATEREF BUDNOTIFY.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$DOCNUMBER BUDNOTIFY.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$FACIALACCCLS BUDNOTIFY.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$LASTEXTRCHANGE BUDNOTIFY.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$BIDNUMBER BUDNOTIFY.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$FAXDOCCOUNT BUDNOTIFY.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$PLANKIND BUDNOTIFY.PLANKIND%TYPE := :NEW.PLANKIND;
  new$ASSIGNMENTSOURCE BUDNOTIFY.ASSIGNMENTSOURCE%TYPE := :NEW.ASSIGNMENTSOURCE;
  new$BA_LBO_FLAG BUDNOTIFY.BA_LBO_FLAG%TYPE := :NEW.BA_LBO_FLAG;
  new$KPPERIOD BUDNOTIFY.KPPERIOD%TYPE := :NEW.KPPERIOD;
  new$CLSTYPE BUDNOTIFY.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$DATE_UTV_PP BUDNOTIFY.DATE_UTV_PP%TYPE := :NEW.DATE_UTV_PP;
  new$PROGINDEX BUDNOTIFY.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$NOTE BUDNOTIFY.NOTE%TYPE := :NEW.NOTE;
  new$NOTE2 BUDNOTIFY.NOTE2%TYPE := :NEW.NOTE2;
  new$DOCCHANGEDATE BUDNOTIFY.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
--
  UseFax$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_BUDNOTIFY_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$NotifyType is null) then 
    new$NotifyType := 0;
  END IF;
  if (new$DocBase is null) then 
    new$DocBase := 0;
  END IF;
  if (new$PlanKind is null) then 
    new$PlanKind := 0;
  END IF;
  if (new$AssignmentSource is null) then
    new$AssignmentSource := 0;
  END IF;
  if ((new$PlanDocType is null) or (new$PlanDocType < 100)) then
    new$PlanDocType := 200;
  END IF;
  if ((new$PlanDocType > 99)and(new$PlanDocType < 200)) then
    new$AType := 0;
      
  else
    new$AType := 1;
  END IF;
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  if (new$FacialAccCls is null) then 
    new$FacialAccCls := 0;
  END IF;
  if (new$BA_LBO_Flag is null) then 
    new$BA_LBO_Flag := 0;
  END IF;
  if (new$KPPeriod is null) then 
    new$KPPeriod := 0;
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 3;
  END IF;
  if ((new$ProgIndex = 262)and(new$FacialAccCLS <> 0)and(new$OrgRef is null)) then
    BEGIN
      /* на вставку записи – при условии неуказанности организации автозаполнение
          организации заголовка по огранизации-владельцу л\с из заголовка*/
      select
      fac.ORG_REF
      into new$OrgRef     from
      FacialACC_CLS fac
      where
      (fac.ID = new$FacialAccCLS)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$Dat is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_430 (TR_BUDNOTIFY_BI_430)
-- Create 18.09.2006
-- - - - - - - - - - - - -

  IF (NEW$SenderID IS NOT NULL) THEN
    /* Заявка на бюджетные ассигнования получена из УРМ */
    GetIntConst(30, 19, UseFax$);
    IF ((NEW$BidNumber IS NULL) AND (UseFax$ = 1)) THEN
      NEW$BidNumber := NEW$ANumber;
    end if;
    NEW$FaxDocCount := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_BUDNOTIFY_BI_500)
-- Last update 14.02.2006
-- - - - - - - - - - - - -

  NEW$CreateDate := SYSDATE;
  NEW$UpdateDate := NEW$CreateDate;
  NEW$CreaterUser := USER;
  NEW$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_BUDNOTIFY (
    ID,
    DAT,
    DOCDAT,
    NOTE1,
    NOTIFYTYPE,
    BUDGETREF,
    DOCBASE,
    VARIANT,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    SENDERID,
    SENDERRECORDID,
    ANUMBER,
    ATYPE,
    DOCUMENTSTATE,
    USERSVISA,
    DATEINPUT,
    ORGREF,
    REJECTCLS,
    REJECTNOTE,
    PLANDOCTYPE,
    RECORDINDEX,
    STIMATEID,
    CRYPTOSTATUS,
    RVERSION,
    DOCSTATEREF,
    DOCNUMBER,
    FACIALACCCLS,
    LASTEXTRCHANGE,
    BIDNUMBER,
    FAXDOCCOUNT,
    PLANKIND,
    ASSIGNMENTSOURCE,
    BA_LBO_FLAG,
    KPPERIOD,
    CLSTYPE,
    DATE_UTV_PP,
    PROGINDEX,
    NOTE,
    NOTE2,
    DOCCHANGEDATE
  ) VALUES (
    new$ID,
    new$DAT,
    new$DOCDAT,
    new$NOTE1,
    new$NOTIFYTYPE,
    new$BUDGETREF,
    new$DOCBASE,
    new$VARIANT,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$SENDERID,
    new$SENDERRECORDID,
    new$ANUMBER,
    new$ATYPE,
    new$DOCUMENTSTATE,
    new$USERSVISA,
    new$DATEINPUT,
    new$ORGREF,
    new$REJECTCLS,
    new$REJECTNOTE,
    new$PLANDOCTYPE,
    new$RECORDINDEX,
    new$STIMATEID,
    new$CRYPTOSTATUS,
    new$RVERSION,
    new$DOCSTATEREF,
    new$DOCNUMBER,
    new$FACIALACCCLS,
    new$LASTEXTRCHANGE,
    new$BIDNUMBER,
    new$FAXDOCCOUNT,
    new$PLANKIND,
    new$ASSIGNMENTSOURCE,
    new$BA_LBO_FLAG,
    new$KPPERIOD,
    new$CLSTYPE,
    new$DATE_UTV_PP,
    new$PROGINDEX,
    new$NOTE,
    new$NOTE2,
    new$DOCCHANGEDATE);

-- - - - - - - - - - - - -
-- AI_500 (TR_BUDNOTIFY_AI_500)
-- - - - - - - - - - - - -

        delete from DelRecIndexes where (TableID = 28) and (RecordID = NEW$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_BUDNOTIFY_IU
  INSTEAD OF UPDATE
  ON BUDNOTIFY
  FOR EACH ROW
DECLARE
  new$ID BUDNOTIFY.ID%TYPE := :NEW.ID;
  new$DAT BUDNOTIFY.DAT%TYPE := :NEW.DAT;
  new$DOCDAT BUDNOTIFY.DOCDAT%TYPE := :NEW.DOCDAT;
  new$NOTE1 BUDNOTIFY.NOTE1%TYPE := :NEW.NOTE1;
  new$NOTIFYTYPE BUDNOTIFY.NOTIFYTYPE%TYPE := :NEW.NOTIFYTYPE;
  new$BUDGETREF BUDNOTIFY.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DOCBASE BUDNOTIFY.DOCBASE%TYPE := :NEW.DOCBASE;
  new$VARIANT BUDNOTIFY.VARIANT%TYPE := :NEW.VARIANT;
  new$CREATERUSER BUDNOTIFY.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE BUDNOTIFY.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE BUDNOTIFY.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER BUDNOTIFY.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$SENDERID BUDNOTIFY.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID BUDNOTIFY.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$ANUMBER BUDNOTIFY.ANUMBER%TYPE := :NEW.ANUMBER;
  new$ATYPE BUDNOTIFY.ATYPE%TYPE := :NEW.ATYPE;
  new$DOCUMENTSTATE BUDNOTIFY.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA BUDNOTIFY.USERSVISA%TYPE := :NEW.USERSVISA;
  new$DATEINPUT BUDNOTIFY.DATEINPUT%TYPE := :NEW.DATEINPUT;
  new$ORGREF BUDNOTIFY.ORGREF%TYPE := :NEW.ORGREF;
  new$REJECTCLS BUDNOTIFY.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTNOTE BUDNOTIFY.REJECTNOTE%TYPE := :NEW.REJECTNOTE;
  new$PLANDOCTYPE BUDNOTIFY.PLANDOCTYPE%TYPE := :NEW.PLANDOCTYPE;
  new$RECORDINDEX BUDNOTIFY.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$STIMATEID BUDNOTIFY.STIMATEID%TYPE := :NEW.STIMATEID;
  new$CRYPTOSTATUS BUDNOTIFY.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$RVERSION BUDNOTIFY.RVERSION%TYPE := :NEW.RVERSION;
  new$DOCSTATEREF BUDNOTIFY.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$DOCNUMBER BUDNOTIFY.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$FACIALACCCLS BUDNOTIFY.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$LASTEXTRCHANGE BUDNOTIFY.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$BIDNUMBER BUDNOTIFY.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$FAXDOCCOUNT BUDNOTIFY.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$PLANKIND BUDNOTIFY.PLANKIND%TYPE := :NEW.PLANKIND;
  new$ASSIGNMENTSOURCE BUDNOTIFY.ASSIGNMENTSOURCE%TYPE := :NEW.ASSIGNMENTSOURCE;
  new$BA_LBO_FLAG BUDNOTIFY.BA_LBO_FLAG%TYPE := :NEW.BA_LBO_FLAG;
  new$KPPERIOD BUDNOTIFY.KPPERIOD%TYPE := :NEW.KPPERIOD;
  new$CLSTYPE BUDNOTIFY.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$DATE_UTV_PP BUDNOTIFY.DATE_UTV_PP%TYPE := :NEW.DATE_UTV_PP;
  new$PROGINDEX BUDNOTIFY.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$NOTE BUDNOTIFY.NOTE%TYPE := :NEW.NOTE;
  new$NOTE2 BUDNOTIFY.NOTE2%TYPE := :NEW.NOTE2;
  new$DOCCHANGEDATE BUDNOTIFY.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
--
  IsReject$ NUMBER(10);
  DetCount$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_BUDNOTIFY_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$NotifyType is null) then 
    new$NotifyType := 0;
  END IF;
  if (new$DocBase is null) then 
    new$DocBase := 0;
  END IF;
  if (new$PlanKind is null) then 
    new$PlanKind := 0;
  END IF;
  if (new$AssignmentSource is null) then 
    new$AssignmentSource := 0;
  END IF;
  if ((new$PlanDocType > 99)and(new$PlanDocType < 200)) then
    new$AType := 0;
      
  else
    if (new$PlanDocType > 199) then
      new$AType := 1;
    END IF;
  END IF;
  if (new$PlanDocType is null) then
    if (new$AType = 1) then
      new$PlanDocType := 200;
          
    else
      new$PlanDocType := 100;
      
    END IF;
  END IF;
  /* проверка на изменение Бюджета*/
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      select count(ID)              into DetCount$ from BudgetData where RecordIndex = :old.ID
      ;
      if (DetCount$ > 0) then 
        RaiseException('Ex_CantModufyBudget');        
      END IF;
    END IF;
  END IF;
  if (new$FacialAccCls is null) then 
    new$FacialAccCls := 0;
  END IF;
  if (new$BA_LBO_Flag is null) then 
    new$BA_LBO_Flag := 0;
  END IF;
  if (new$KPPeriod is null) then 
    new$KPPeriod := 0;
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 3;
  END IF;
  if ((new$ProgIndex = 262)and(new$FacialAccCLS <> :old.FacialAccCLS)
  and(new$FacialAccCLS <> 0)) then
    BEGIN
      /* на изменение записи  - при условии изменения л\с из заголовка автозаполнение
          организации заголовка по огранизации-владельцу л\с из заголовка,
          при условии, что новый л\с заголовка ненулевой*/
      select
      fac.ORG_REF
      into new$OrgRef     from
      FacialACC_CLS fac
      where
      (fac.ID = new$FacialAccCLS)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* документ не может быть одновременно принятым и отклоненным*/
  if ((new$Dat is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_BUDNOTIFY_BU_200)
-- Create 08.02.2005
-- - - - - - - - - - - - -

   --Сохранение в базу истории изменений состояний
  IF (:OLD.DOCSTATEREF <> NEW$DOCSTATEREF) THEN
    INSERT INTO StateJumpHistory(DocID, BeginStateRef, EndStateRef)
      VALUES (NEW$ID, :OLD.DOCSTATEREF, NEW$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_BUDNOTIFY_BU_300)
-- Create 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from BudgetData d where d.RecordIndex = :new.id));
  end if;    

-- - - - - - - - - - - - -
-- BU_700 (TR_BUDNOTIFY_BU_700)
-- Create 17.09.2004
-- - - - - - - - - - - - -

  IF (NEW$RVersion IS NULL) THEN
    NEW$RVersion := 1;
  ELSIF ((NEW$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
    NEW$RVersion := :OLD.RVersion;
  ELSE
    NEW$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_BUDNOTIFY SET
    ID = new$ID,
    DAT = new$DAT,
    DOCDAT = new$DOCDAT,
    NOTE1 = new$NOTE1,
    NOTIFYTYPE = new$NOTIFYTYPE,
    BUDGETREF = new$BUDGETREF,
    DOCBASE = new$DOCBASE,
    VARIANT = new$VARIANT,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    ANUMBER = new$ANUMBER,
    ATYPE = new$ATYPE,
    DOCUMENTSTATE = new$DOCUMENTSTATE,
    USERSVISA = new$USERSVISA,
    DATEINPUT = new$DATEINPUT,
    ORGREF = new$ORGREF,
    REJECTCLS = new$REJECTCLS,
    REJECTNOTE = new$REJECTNOTE,
    PLANDOCTYPE = new$PLANDOCTYPE,
    RECORDINDEX = new$RECORDINDEX,
    STIMATEID = new$STIMATEID,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    RVERSION = new$RVERSION,
    DOCSTATEREF = new$DOCSTATEREF,
    DOCNUMBER = new$DOCNUMBER,
    FACIALACCCLS = new$FACIALACCCLS,
    LASTEXTRCHANGE = new$LASTEXTRCHANGE,
    BIDNUMBER = new$BIDNUMBER,
    FAXDOCCOUNT = new$FAXDOCCOUNT,
    PLANKIND = new$PLANKIND,
    ASSIGNMENTSOURCE = new$ASSIGNMENTSOURCE,
    BA_LBO_FLAG = new$BA_LBO_FLAG,
    KPPERIOD = new$KPPERIOD,
    CLSTYPE = new$CLSTYPE,
    DATE_UTV_PP = new$DATE_UTV_PP,
    PROGINDEX = new$PROGINDEX,
    NOTE = new$NOTE,
    NOTE2 = new$NOTE2,
    DOCCHANGEDATE = new$DOCCHANGEDATE
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_300 (TR_BudNotify_AU_300)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$ClsType <> :old.ClsType)and(new$ClsType <> 3)
  and
  ((new$RVersion<>:old.RVersion)
  or
  ((:old.RVersion is null)and(new$RVersion is not null)))) then
    if (new$ClsType = 0) then
      update BudgetData set
      KD = 0,
      IFS = 0,
      ClsType = new$ClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(ClsType=:old.ClsType);
    END IF;
    if (new$ClsType = 1) then
      update BudgetData set
      KD = 0,
      KVSR = 0,
      KFSR = 0,
      KCSR = 0,
      KVR = 0,
      KESR = 0,
      ClsType = new$ClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(ClsType=:old.ClsType);
    END IF;
    if (new$ClsType = 2) then
      update BudgetData set
      IFS = 0,
      KVSR = 0,
      KFSR = 0,
      KCSR = 0,
      KVR = 0,
      KESR = 0,
      ClsType = new$ClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(ClsType=:old.ClsType);
      
    END IF;
  END IF;
  if ((new$ProgIndex in (252, 253))and(new$FacialAccCLS <> :old.FacialAccCLS)) then
    update BudgetData set
    facialacc_cls = new$FacialAccCLS
    where
    RecordIndex = new$id;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_BUDNOTIFY_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

  if (NEW$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (28, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=28) and (RecordId=NEW$ID);
  end if;

END;
/
CREATE INDEX BN_DocChangeDate ON TB_BudNotify(DocChangeDate) 
/
-- CREATE TRIGGER TR_BUDNOTIFY_BI_500
CREATE OR REPLACE TRIGGER TR_BUDNOTIFY_II
  INSTEAD OF INSERT
  ON BUDNOTIFY
  FOR EACH ROW
DECLARE
  new$ID BUDNOTIFY.ID%TYPE := :NEW.ID;
  new$DAT BUDNOTIFY.DAT%TYPE := :NEW.DAT;
  new$DOCDAT BUDNOTIFY.DOCDAT%TYPE := :NEW.DOCDAT;
  new$NOTE1 BUDNOTIFY.NOTE1%TYPE := :NEW.NOTE1;
  new$NOTIFYTYPE BUDNOTIFY.NOTIFYTYPE%TYPE := :NEW.NOTIFYTYPE;
  new$BUDGETREF BUDNOTIFY.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DOCBASE BUDNOTIFY.DOCBASE%TYPE := :NEW.DOCBASE;
  new$VARIANT BUDNOTIFY.VARIANT%TYPE := :NEW.VARIANT;
  new$CREATERUSER BUDNOTIFY.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE BUDNOTIFY.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE BUDNOTIFY.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER BUDNOTIFY.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$SENDERID BUDNOTIFY.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID BUDNOTIFY.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$ANUMBER BUDNOTIFY.ANUMBER%TYPE := :NEW.ANUMBER;
  new$ATYPE BUDNOTIFY.ATYPE%TYPE := :NEW.ATYPE;
  new$DOCUMENTSTATE BUDNOTIFY.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA BUDNOTIFY.USERSVISA%TYPE := :NEW.USERSVISA;
  new$DATEINPUT BUDNOTIFY.DATEINPUT%TYPE := :NEW.DATEINPUT;
  new$ORGREF BUDNOTIFY.ORGREF%TYPE := :NEW.ORGREF;
  new$REJECTCLS BUDNOTIFY.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTNOTE BUDNOTIFY.REJECTNOTE%TYPE := :NEW.REJECTNOTE;
  new$PLANDOCTYPE BUDNOTIFY.PLANDOCTYPE%TYPE := :NEW.PLANDOCTYPE;
  new$RECORDINDEX BUDNOTIFY.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$STIMATEID BUDNOTIFY.STIMATEID%TYPE := :NEW.STIMATEID;
  new$CRYPTOSTATUS BUDNOTIFY.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$RVERSION BUDNOTIFY.RVERSION%TYPE := :NEW.RVERSION;
  new$DOCSTATEREF BUDNOTIFY.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$DOCNUMBER BUDNOTIFY.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$FACIALACCCLS BUDNOTIFY.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$LASTEXTRCHANGE BUDNOTIFY.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$BIDNUMBER BUDNOTIFY.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$FAXDOCCOUNT BUDNOTIFY.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$PLANKIND BUDNOTIFY.PLANKIND%TYPE := :NEW.PLANKIND;
  new$ASSIGNMENTSOURCE BUDNOTIFY.ASSIGNMENTSOURCE%TYPE := :NEW.ASSIGNMENTSOURCE;
  new$BA_LBO_FLAG BUDNOTIFY.BA_LBO_FLAG%TYPE := :NEW.BA_LBO_FLAG;
  new$KPPERIOD BUDNOTIFY.KPPERIOD%TYPE := :NEW.KPPERIOD;
  new$CLSTYPE BUDNOTIFY.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$DATE_UTV_PP BUDNOTIFY.DATE_UTV_PP%TYPE := :NEW.DATE_UTV_PP;
  new$PROGINDEX BUDNOTIFY.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$NOTE BUDNOTIFY.NOTE%TYPE := :NEW.NOTE;
  new$NOTE2 BUDNOTIFY.NOTE2%TYPE := :NEW.NOTE2;
  new$DOCCHANGEDATE BUDNOTIFY.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
--
  UseFax$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_BUDNOTIFY_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$NotifyType is null) then 
    new$NotifyType := 0;
  END IF;
  if (new$DocBase is null) then 
    new$DocBase := 0;
  END IF;
  if (new$PlanKind is null) then 
    new$PlanKind := 0;
  END IF;
  if (new$AssignmentSource is null) then
    new$AssignmentSource := 0;
  END IF;
  if ((new$PlanDocType is null) or (new$PlanDocType < 100)) then
    new$PlanDocType := 200;
  END IF;
  if ((new$PlanDocType > 99)and(new$PlanDocType < 200)) then
    new$AType := 0;
      
  else
    new$AType := 1;
  END IF;
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  if (new$FacialAccCls is null) then 
    new$FacialAccCls := 0;
  END IF;
  if (new$BA_LBO_Flag is null) then 
    new$BA_LBO_Flag := 0;
  END IF;
  if (new$KPPeriod is null) then 
    new$KPPeriod := 0;
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 3;
  END IF;
  if ((new$ProgIndex = 262)and(new$FacialAccCLS <> 0)and(new$OrgRef is null)) then
    BEGIN
      /* на вставку записи – при условии неуказанности организации автозаполнение
          организации заголовка по огранизации-владельцу л\с из заголовка*/
      select
      fac.ORG_REF
      into new$OrgRef     from
      FacialACC_CLS fac
      where
      (fac.ID = new$FacialAccCLS)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$Dat is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_430 (TR_BUDNOTIFY_BI_430)
-- Create 18.09.2006
-- - - - - - - - - - - - -

  IF (NEW$SenderID IS NOT NULL) THEN
    /* Заявка на бюджетные ассигнования получена из УРМ */
    GetIntConst(30, 19, UseFax$);
    IF ((NEW$BidNumber IS NULL) AND (UseFax$ = 1)) THEN
      NEW$BidNumber := NEW$ANumber;
    end if;
    NEW$FaxDocCount := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_BUDNOTIFY_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$DocChangeDate := new$UpdateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_BUDNOTIFY (
    ID,
    DAT,
    DOCDAT,
    NOTE1,
    NOTIFYTYPE,
    BUDGETREF,
    DOCBASE,
    VARIANT,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    SENDERID,
    SENDERRECORDID,
    ANUMBER,
    ATYPE,
    DOCUMENTSTATE,
    USERSVISA,
    DATEINPUT,
    ORGREF,
    REJECTCLS,
    REJECTNOTE,
    PLANDOCTYPE,
    RECORDINDEX,
    STIMATEID,
    CRYPTOSTATUS,
    RVERSION,
    DOCSTATEREF,
    DOCNUMBER,
    FACIALACCCLS,
    LASTEXTRCHANGE,
    BIDNUMBER,
    FAXDOCCOUNT,
    PLANKIND,
    ASSIGNMENTSOURCE,
    BA_LBO_FLAG,
    KPPERIOD,
    CLSTYPE,
    DATE_UTV_PP,
    PROGINDEX,
    NOTE,
    NOTE2,
    DOCCHANGEDATE
  ) VALUES (
    new$ID,
    new$DAT,
    new$DOCDAT,
    new$NOTE1,
    new$NOTIFYTYPE,
    new$BUDGETREF,
    new$DOCBASE,
    new$VARIANT,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$SENDERID,
    new$SENDERRECORDID,
    new$ANUMBER,
    new$ATYPE,
    new$DOCUMENTSTATE,
    new$USERSVISA,
    new$DATEINPUT,
    new$ORGREF,
    new$REJECTCLS,
    new$REJECTNOTE,
    new$PLANDOCTYPE,
    new$RECORDINDEX,
    new$STIMATEID,
    new$CRYPTOSTATUS,
    new$RVERSION,
    new$DOCSTATEREF,
    new$DOCNUMBER,
    new$FACIALACCCLS,
    new$LASTEXTRCHANGE,
    new$BIDNUMBER,
    new$FAXDOCCOUNT,
    new$PLANKIND,
    new$ASSIGNMENTSOURCE,
    new$BA_LBO_FLAG,
    new$KPPERIOD,
    new$CLSTYPE,
    new$DATE_UTV_PP,
    new$PROGINDEX,
    new$NOTE,
    new$NOTE2,
    new$DOCCHANGEDATE);

-- - - - - - - - - - - - -
-- AI_500 (TR_BUDNOTIFY_AI_500)
-- - - - - - - - - - - - -

        delete from DelRecIndexes where (TableID = 28) and (RecordID = NEW$ID);

END;
/
-- CREATE TRIGGER TR_BUDNOTIFY_BU_500
CREATE OR REPLACE TRIGGER TR_BUDNOTIFY_BU_500
  BEFORE UPDATE
  ON TB_BUDNOTIFY
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_BUDNOTIFY_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.Updatedate := SYSDATE;
  :new.DocChangeDate := :new.UpdateDate;
  :new.UpdaterUser := User;

END;
/
-- CREATE TRIGGER TR_BUDGETDATA_BI_500
CREATE OR REPLACE TRIGGER TR_BUDGETDATA_BI
  BEFORE INSERT
  ON BUDGETDATA
  FOR EACH ROW
DECLARE
  OrgRefByAcc$ NUMBER(10);
  CapClsType$ NUMBER(10);
  AutoKesrCorr$ NUMBER(10);
  doubleUse$ NUMBER(10);
  BALBOFlag$ NUMBER(10);
  AllowDivideBA$ NUMBER(10);
  StimateKind$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_BUDGETDATA_BI)
-- Version 7.02.00.3
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;
  IF (:new.KFSR IS NULL) THEN  
    :new.KFSR := 0;
  END IF;
  IF (:new.KVSR IS NULL) THEN  
    :new.KVSR := 0;
  END IF;
  IF (:new.KVR IS NULL) THEN  
    :new.KVR := 0;
  END IF;
  IF (:new.KCSR IS NULL) THEN  
    :new.KCSR := 0;
  END IF;
  IF (:new.KESR IS NULL) THEN  
    :new.KESR := 0;
  END IF;
  IF (:new.SubKESR IS NULL) THEN  
    :new.SubKESR := 0;
  END IF;
  IF (:new.RegionCLS IS NULL) THEN  
    :new.RegionCLS := 0;
  END IF;
  IF (:new.DirectionCls IS NULL) THEN 
    :new.DirectionCls := 0;
  END IF;
  IF (:new.FundsSource IS NULL) THEN 
    :new.FundsSource := 0;
  END IF;
  IF (:new.KD IS NULL) THEN 
    :new.KD := 0;
  END IF;
  IF (:new.subkd IS NULL) THEN 
    :new.subkd := 0;
  END IF;
  IF (:new.Fact IS NULL) THEN  
    :new.Fact := 0;
  END IF;
  IF (:new.FacialAcc_Cls IS NULL) THEN 
    :new.FacialAcc_Cls := 0;
  END IF;
  IF (:new.KESRCorr IS NULL) THEN 
    :new.KESRCorr := 0;
  END IF;
  IF (:new.AssignmentKind IS NULL) THEN 
    :new.AssignmentKind := 0;
  END IF;
  IF (:new.Quarter1 IS NULL) THEN  
    :new.Quarter1 := 0;
  END IF;
  IF (:new.Quarter2 IS NULL) THEN  
    :new.Quarter2 := 0;
  END IF;
  IF (:new.Quarter3 IS NULL) THEN  
    :new.Quarter3 := 0;
  END IF;
  IF (:new.Quarter4 IS NULL) THEN  
    :new.Quarter4 := 0;
  END IF;
  IF (:new.DayPlanSumma IS NULL) THEN 
    :new.DayPlanSumma := 0;
  END IF;
  IF (:new.FinType IS NULL) THEN  
    :new.FinType := 0;
  END IF;
  IF (:new.MeansType IS NULL) THEN 
    :new.MeansType := 0;
  END IF;
  IF (:new.DepartmentCls IS NULL) THEN 
    :new.DepartmentCls := 0;
  END IF;
  /* заполнение поля бух. операции и классификации по умолчанию */
  IF (:new.IFS IS NULL) THEN 
    :new.IFS := 0;
  END IF;
  IF (:new.BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;
  BEGIN

    /* Заполнение Бюджета. Безусловно по мастеру*/
    SELECT bn.BudgetRef      INTO :new.BudgetRef FROM BudNotify bn
    WHERE bn.id = :new.RecordIndex
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  IF (:new.Month01 IS NULL) THEN  
    :new.Month01 := 0;
  END IF;
  IF (:new.Month02 IS NULL) THEN  
    :new.Month02 := 0;
  END IF;
  IF (:new.Month03 IS NULL) THEN  
    :new.Month03 := 0;
  END IF;
  IF (:new.Month04 IS NULL) THEN  
    :new.Month04 := 0;
  END IF;
  IF (:new.Month05 IS NULL) THEN  
    :new.Month05 := 0;
  END IF;
  IF (:new.Month06 IS NULL) THEN  
    :new.Month06 := 0;
  END IF;
  IF (:new.Month07 IS NULL) THEN  
    :new.Month07 := 0;
  END IF;
  IF (:new.Month08 IS NULL) THEN  
    :new.Month08 := 0;
  END IF;
  IF (:new.Month09 IS NULL) THEN  
    :new.Month09 := 0;
  END IF;
  IF (:new.Month10 IS NULL) THEN  
    :new.Month10 := 0;
  END IF;
  IF (:new.Month11 IS NULL) THEN  
    :new.Month11 := 0;
  END IF;
  IF (:new.Month12 IS NULL) THEN  
    :new.Month12 := 0;
  END IF;
  IF (:new.SummaYear1 IS NULL) THEN  
    :new.SummaYear1 := 0;
  END IF;
  IF (:new.SummaYear2 IS NULL) THEN  
    :new.SummaYear2 := 0;
  END IF;
  IF (:new.SummaYear3 IS NULL) THEN  
    :new.SummaYear3 := 0;
  END IF;
  BEGIN

    SELECT
    c.BA_LBO_FLAG
    INTO
    BALBOFlag$  FROM
    BudNotify c
    WHERE
    c.id = :new.RecordIndex
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* Смета по ПД*/
  IF (:new.ProgIndex = 262) THEN
    GetIntConst(32, 43,StimateKind$);
    IF ((StimateKind$  = 0) OR (StimateKind$  IS NULL)) THEN
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
         
    ELSE
      IF (StimateKind$  = 1) THEN
        :new.Quarter1 := :new.SummaYear1;
             
      ELSE
        :new.Quarter1 := :new.Month01 + :new.Month02 +:new.Month03;
        :new.Quarter2 := :new.Month04 + :new.Month05 +:new.Month06;
        :new.Quarter3 := :new.Month07 + :new.Month08 +:new.Month09;
        :new.Quarter4 := :new.Month10 + :new.Month11 +:new.Month12;
        :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
             
      END IF; 
    END IF;
  END IF;
  /* СБР(расходы)*/
  IF (:new.ProgIndex = 260) THEN
    GetIntConst(32, 30,doubleUse$);
    GetIntConst(32, 40,AllowDivideBA$);
    IF ((doubleUse$=1) AND ((BALBOFlag$  <> 1) OR (AllowDivideBA$ = 1))) THEN  /* если используется совмещенное ведение КП и СБР, то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;
  END IF;
  /* СБР(источники)*/
  IF (:new.ProgIndex = 264) THEN
    GetIntConst(32, 34,doubleUse$);
    GetIntConst(32, 40,AllowDivideBA$);
    IF ((doubleUse$=1) AND ((BALBOFlag$  <> 1) OR (AllowDivideBA$ = 1))) THEN  /* если используется совмещенное ведение КП и СБР, то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;
  END IF;
  /* БР ГРБС(расходы)*/
  IF (:new.ProgIndex = 32) THEN
    GetIntConst(32, 31,doubleUse$);
    GetIntConst(32, 40,AllowDivideBA$);
    IF ((doubleUse$=1) AND ((BALBOFlag$  <> 1) OR (AllowDivideBA$ = 1))) THEN  /* если используется совмещенное ведение КП по ПБС и БР , то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;
  END IF;
  /* БР ГРБС(источники)*/
  IF (:new.ProgIndex = 215) THEN
    GetIntConst(32, 35,doubleUse$);
    GetIntConst(32, 40,AllowDivideBA$);
    IF ((doubleUse$=1) AND ((BALBOFlag$  <> 1) OR (AllowDivideBA$ = 1))) THEN  /* если используется совмещенное ведение КП по АИФ и БР, то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;/* 
   IF ((NEW.TransfertOrg_Ref IS NULL) AND (NEW.REGIONCLS <> 0)) THEN
      SELECT Organizations FROM REGIONCLS
        WHERE NEW.REGIONCLS = ID
      INTO NEW.TransfertOrg_Ref;
  */
  END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_BUDGETDATA_BI_100)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (:new.ClsType is NULL) then
    BEGIN
      select
      bn.ClsType
      into
      CapClsType$     from
      BudNotify bn
      where
      bn.id = :new.RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (CapClsType$  = 3) then
      if (:new.IFS <> 0) then
        :new.ClsType := 1; /* если это источник и забыли ввести ClsType */
            
      else
        if (:new.KD <> 0) then
          :new.ClsType := 2; /* доходная*/
                
        else
          :new.ClsType := 0; /* расходная*/
        END IF;    
      END IF;
    else
      :new.ClsType := CapClsType$;
      
    END IF;
  END IF;
  IF ((:new.ClsType = 0) AND ((:new.IFS <> 0)or(:new.KD <> 0))) THEN  /* классификация расходная */
    RaiseException('EX_WRONGBUDCLS');
  END IF;
  IF ((:new.ClsType <> 0) AND (
  (:new.KVSR <> 0) OR (:new.KFSR <> 0) OR
  (:new.KCSR <> 0) OR (:new.KVR <> 0) OR
  (:new.KESR <> 0)
  )) THEN
    RaiseException('EX_WRONGBUDCLS');
  END IF;
  if (((:new.ClsType = 1)and(:new.KD <> 0))or((:new.ClsType = 2)and(:new.IFS <> 0))) then
    RaiseException('EX_WRONGBUDCLS');
  END IF;
  IF ((:new.ClsType <> 0) AND (:new.ClsType <> 1) AND (:new.ClsType <> 2)) THEN /* неверный тип классификации*/
    RaiseException('EX_WRONGBUDCLSTYPE');
  END IF;
  IF (:new.ACC_REF IS NOT NULL) THEN /* Определяем организацию по р/с */
    BEGIN
      SELECT oa.ORG_REF
      INTO OrgRefByAcc$     FROM ORG_ACCOUNTS oa
      WHERE (oa.ID = :new.ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (:new.FacialAcc_CLS = 0) then 
      :new.Org_Ref := OrgRefByAcc$;
      
    END IF;
  END IF;
  /* если л\с указан, то организация в детали и организация р\с должна соответствовать организации л\с, иначе р\с очищаем*/
  if (:new.FacialAcc_CLS <> 0) then
    BEGIN
      SELECT
      fac.ORG_REF
      INTO :new.Org_Ref     FROM
      FacialACC_CLS fac
      WHERE
      (fac.ID = :new.FacialAcc_CLS)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (OrgRefByAcc$<>:new.Org_Ref) then 
      :new.ACC_REF := null;
      
    END IF;
  END IF;
  if ((:new.ProgIndex in (252, 253))and(:new.FacialAcc_CLS = 0)) then
    BEGIN
      SELECT
      bn.FacialAccCLS
      INTO :new.FacialAcc_CLS     FROM
      BudNotify bn
      WHERE
      (bn.ID = :new.RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_200 (TR_BUDGETDATA_BI_200)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* Для всех прогиндексов с расходной классификацией 32-БР, 260-СБР, 261-КП, 262-Сметы по ПД, 263-Бюджет, 268-КП по ПБС */
  if (:new.ProgIndex in (32, 260, 261, 262, 263, 268)) then
    /* для прогиднекса бюджетной росписи расходов(32 БР ГРБС(расходы)) 
         анализируем константу использования детализации ЭКР(расходы):
         при значении =0 сносим ЭКР в корреспондирующий ЭКР,
         при значении =1 не заполняем,
         при значении =2 заполняем в 0 корреспондирующий ЭКР.*//* для прогиндекса СБР расходов 260 СБР(расходы)
         анализируем константу использования детализации ЭКР:
         при значении =2 заполняем в 0 ЭКР и корреспондирующий ЭКР.*/
    GetIntConst(32, 25,AutoKesrCorr$);
    if (:new.ProgIndex = 32) then /* БР ГРБС(расходы)*/
      if (AutoKesrCorr$  = 0) then
        :new.KesrCorr := :new.Kesr;
              
      else
        if (AutoKesrCorr$  = 2) then
          :new.KesrCorr := 0;
        END IF;    
      END IF;
    else 
      if ((:new.ProgIndex = 260)and (AutoKesrCorr$  = 2)) then  /* СБР(расходы)*/
        :new.KesrCorr := 0;
        :new.Kesr := 0;     
              
      else 
        :new.KesrCorr := :new.Kesr; /* Для остальных прогиндексов всегда сносим ЭКР в корреспондирующий ЭКР*/
      END IF;  
    END IF;
  else
    /* Для всех прогиндексов с источниковой классификацией 215-БР, 264-СБР, 265-КП, 267-Бюджет, 271-КП по ПБС */
    if (:new.ProgIndex in (215, 264, 265, 267, 271)) then
      /* для прогиднекса бюджетной росписи источников(215 БР ГАИФ (источники))
         анализируем константу использования детализации ЭКР(источники):
         при значении =0 сносим ЭКР в корреспондирующий ЭКР,
         при значении =1 не заполняем. значение 2 для источников отсутствует.
         Для остальных прогиндексов всегда сносим ЭКР в корреспондирующий ЭКР*/
      GetIntConst(32, 26,AutoKesrCorr$);
      if (((AutoKesrCorr$  = 0)and(:new.ProgIndex=215))or(:new.ProgIndex<>215)) then
        BEGIN
          select
          ifs.KESR
          into
          :new.KesrCorr       from
          InnerFinSource ifs
          where
          ifs.id = :new.ifs
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;  
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_BUDGETDATA_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

  Update BudNotify set
  DocChangeDate = :new.UpdateDate,
  RVersion = -1
  where id = :new.recordindex;

END;
/
-- CREATE TRIGGER TR_BUDGETDATA_BU_500
CREATE OR REPLACE TRIGGER TR_BUDGETDATA_BU_500
  BEFORE UPDATE
  ON BUDGETDATA
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_BUDGETDATA_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.Updatedate := SYSDATE;
  :new.UpdaterUser := User;

  Update BudNotify set
  DocChangeDate = :new.UpdateDate,
  RVersion = -1
  where id = :new.recordindex;

END;
/
-- CREATE TRIGGER TR_BUDGETDATA_BD_500
CREATE OR REPLACE TRIGGER TR_BUDGETDATA_BD
  BEFORE DELETE
  ON BUDGETDATA
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_500 (TR_BUDGETDATA_BD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  Update BudNotify set
  DocChangeDate = SYSDATE,
  RVersion = -1
  where id = :old.recordindex;

END;
/
ALTER TRIGGER TR_BUDNOTIFY_BU_500 DISABLE
/
Update BudNotify bn set
    DocChangeDate = (select max(UpdateDate) from BudgetData bdat
where (bdat.recordindex = bn.id))
/
Update BudNotify set
    DocChangeDate = UpdateDate
where (DocChangeDate < UpdateDate) or (DocChangeDate is null)
/
ALTER TRIGGER TR_BUDNOTIFY_BU_500 ENABLE
/
/* QuotesTitle */
ALTER TABLE TB_QuotesTitle ADD (
  DocChangeDate DATE
)
/

CREATE OR REPLACE VIEW QuotesTitle (
  ID,
  BUILDDATE,
  ACCEPTDATE,
  INCACCOUNT,
  BUDGETREF,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  RECORDINDEX,
  PROGINDEX,
  DOCNUMBER,
  TYPEOPERATIONCLS,
  RVERSION,
  REESTRDATE,
  REESTRNUMBER,
  SENDERID,
  SENDERRECORDID,
  FACIALACCCLS,
  REJECTCLS,
  REJECTCAUSE,
  CRYPTOSTATUS,
  STIMATEID,
  SUMMA,
  DOCSTATEREF,
  DEPARTMENTCLS,
  DOCCHANGEDATE)
AS
  SELECT
    ID,
    BUILDDATE,
    ACCEPTDATE,
    INCACCOUNT,
    BUDGETREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    RECORDINDEX,
    PROGINDEX,
    DOCNUMBER,
    TYPEOPERATIONCLS,
    RVERSION,
    REESTRDATE,
    REESTRNUMBER,
    SENDERID,
    SENDERRECORDID,
    FACIALACCCLS,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    STIMATEID,
    SUMMA,
    DOCSTATEREF,
    DEPARTMENTCLS,
    DOCCHANGEDATE
  FROM TB_QuotesTitle
/

CREATE OR REPLACE TRIGGER TR_QUOTESTITLE_ID
  INSTEAD OF DELETE
  ON QUOTESTITLE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (T_QUOTESTITLE_BD)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

  delete from Incomes32 where (ProgIndex = 45 or ProgIndex =140) and (RecordIndex = :old.ID);

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_QUOTESTITLE
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);
   
  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_500 (TR_QUOTESTITLE_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordID, DeleteDate, ProgIndex, SUMMA) values (160, :old.ID, SYSDATE, :old.ProgIndex, :old.SUMMA);

END;
/

CREATE OR REPLACE TRIGGER TR_QUOTESTITLE_II
  INSTEAD OF INSERT
  ON QUOTESTITLE
  FOR EACH ROW
DECLARE
  new$ID QUOTESTITLE.ID%TYPE := :NEW.ID;
  new$BUILDDATE QUOTESTITLE.BUILDDATE%TYPE := :NEW.BUILDDATE;
  new$ACCEPTDATE QUOTESTITLE.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$INCACCOUNT QUOTESTITLE.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$BUDGETREF QUOTESTITLE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER QUOTESTITLE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE QUOTESTITLE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE QUOTESTITLE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER QUOTESTITLE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$RECORDINDEX QUOTESTITLE.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$PROGINDEX QUOTESTITLE.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$DOCNUMBER QUOTESTITLE.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$TYPEOPERATIONCLS QUOTESTITLE.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$RVERSION QUOTESTITLE.RVERSION%TYPE := :NEW.RVERSION;
  new$REESTRDATE QUOTESTITLE.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$REESTRNUMBER QUOTESTITLE.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$SENDERID QUOTESTITLE.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID QUOTESTITLE.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$FACIALACCCLS QUOTESTITLE.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$REJECTCLS QUOTESTITLE.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE QUOTESTITLE.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS QUOTESTITLE.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$STIMATEID QUOTESTITLE.STIMATEID%TYPE := :NEW.STIMATEID;
  new$SUMMA QUOTESTITLE.SUMMA%TYPE := :NEW.SUMMA;
  new$DOCSTATEREF QUOTESTITLE.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$DEPARTMENTCLS QUOTESTITLE.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$DOCCHANGEDATE QUOTESTITLE.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (T_QUOTESTITLE_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  /* Заполнение Бюджета. Если пустой или 0, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  if (new$IncAccount is null) then
    GetDefDFAccRefForBudget(new$BudgetRef,new$IncAccount);
  END IF;
  if (new$FacialAccCls is null) then
    new$FacialAccCls := 0;
  END IF;
  if (new$DepartmentCls is null) then
    new$DepartmentCls := 0;
  END IF;
  if (new$Summa is null ) then
    new$Summa := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (T_QUOTESTITLE_BI_500)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_QUOTESTITLE (
    ID,
    BUILDDATE,
    ACCEPTDATE,
    INCACCOUNT,
    BUDGETREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    RECORDINDEX,
    PROGINDEX,
    DOCNUMBER,
    TYPEOPERATIONCLS,
    RVERSION,
    REESTRDATE,
    REESTRNUMBER,
    SENDERID,
    SENDERRECORDID,
    FACIALACCCLS,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    STIMATEID,
    SUMMA,
    DOCSTATEREF,
    DEPARTMENTCLS,
    DOCCHANGEDATE
  ) VALUES (
    new$ID,
    new$BUILDDATE,
    new$ACCEPTDATE,
    new$INCACCOUNT,
    new$BUDGETREF,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$RECORDINDEX,
    new$PROGINDEX,
    new$DOCNUMBER,
    new$TYPEOPERATIONCLS,
    new$RVERSION,
    new$REESTRDATE,
    new$REESTRNUMBER,
    new$SENDERID,
    new$SENDERRECORDID,
    new$FACIALACCCLS,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$STIMATEID,
    new$SUMMA,
    new$DOCSTATEREF,
    new$DEPARTMENTCLS,
    new$DOCCHANGEDATE);

-- - - - - - - - - - - - -
-- AI_500 (TR_QUOTESTITLE_AI_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 160) AND (RecordID = :NEW.ID);

END;
/

CREATE OR REPLACE TRIGGER TR_QUOTESTITLE_IU
  INSTEAD OF UPDATE
  ON QUOTESTITLE
  FOR EACH ROW
DECLARE
  new$ID QUOTESTITLE.ID%TYPE := :NEW.ID;
  new$BUILDDATE QUOTESTITLE.BUILDDATE%TYPE := :NEW.BUILDDATE;
  new$ACCEPTDATE QUOTESTITLE.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$INCACCOUNT QUOTESTITLE.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$BUDGETREF QUOTESTITLE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER QUOTESTITLE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE QUOTESTITLE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE QUOTESTITLE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER QUOTESTITLE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$RECORDINDEX QUOTESTITLE.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$PROGINDEX QUOTESTITLE.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$DOCNUMBER QUOTESTITLE.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$TYPEOPERATIONCLS QUOTESTITLE.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$RVERSION QUOTESTITLE.RVERSION%TYPE := :NEW.RVERSION;
  new$REESTRDATE QUOTESTITLE.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$REESTRNUMBER QUOTESTITLE.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$SENDERID QUOTESTITLE.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID QUOTESTITLE.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$FACIALACCCLS QUOTESTITLE.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$REJECTCLS QUOTESTITLE.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE QUOTESTITLE.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS QUOTESTITLE.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$STIMATEID QUOTESTITLE.STIMATEID%TYPE := :NEW.STIMATEID;
  new$SUMMA QUOTESTITLE.SUMMA%TYPE := :NEW.SUMMA;
  new$DOCSTATEREF QUOTESTITLE.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$DEPARTMENTCLS QUOTESTITLE.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$DOCCHANGEDATE QUOTESTITLE.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
--
  IsReject$ NUMBER(10);
  DetCount1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (T_QUOTESTITLE_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if (not((new$BudgetRef is null) and (:old.BudgetRef is null))) then
      select count(ID)       into DetCount1$ from Incomes32 where RecordIndex = :old.ID
      ;
      if (DetCount1$ > 0) then 
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  if (new$IncAccount is null) then
    GetDefDFAccRefForBudget(new$BudgetRef,new$IncAccount);
  END IF;
  if (new$FacialAccCls is null) then
    new$FacialAccCls := 0;
  END IF;
  if (new$DepartmentCls is null) then
    new$DepartmentCls := 0;
  END IF;
  if (new$Summa is null) then
    new$Summa := 0;
  END IF;

-- - - - - - - - - - - - -
-- BU_300 (T_QUOTESTITLE_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(new$RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(new$RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = new$ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = new$id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_QUOTESTITLE_BU_700)
-- Create 19.09.2004
-- Last update 25.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_QUOTESTITLE SET
    ID = new$ID,
    BUILDDATE = new$BUILDDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    INCACCOUNT = new$INCACCOUNT,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    RECORDINDEX = new$RECORDINDEX,
    PROGINDEX = new$PROGINDEX,
    DOCNUMBER = new$DOCNUMBER,
    TYPEOPERATIONCLS = new$TYPEOPERATIONCLS,
    RVERSION = new$RVERSION,
    REESTRDATE = new$REESTRDATE,
    REESTRNUMBER = new$REESTRNUMBER,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    FACIALACCCLS = new$FACIALACCCLS,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    STIMATEID = new$STIMATEID,
    SUMMA = new$SUMMA,
    DOCSTATEREF = new$DOCSTATEREF,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    DOCCHANGEDATE = new$DOCCHANGEDATE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_20 (T_QUOTESTITLE_AU_20)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

   /*  для любого прогиндекса. необходимые действия будут определяться уже в детализации */

   /*  При изменении значимых полей необходимо снести их в детализацию и/или */
   /*  вызвать тригер на обновление детализации */
   /*  Записано в  else, т.к. при сранении с null получим UNKNOWN, и в then не попадем*/
   
      /*  Счет не изменился, но возможно поменялись другие поля*/
      /*  Записано в  else, т.к. при сранении с null получим UNKNOWN, и в then не попадем*/
      IF (    
              /*  важно для п/п и сносится в детализацию */
              (new$IncAccount = :OLD.IncAccount)
          AND 
              /*  важно для п/п и сносится в детализацию */
              (   (new$AcceptDate = :OLD.AcceptDate)
               OR ((new$AcceptDate IS NULL) AND (:OLD.AcceptDate IS NULL))
              )
          AND 
              /*  важно для п/п и сносится в детализацию */
              (   (new$DocNumber = :OLD.DocNumber)
               OR ((new$DocNumber IS NULL) AND (:OLD.DocNumber IS NULL))
              )
          AND 
              /*  важно для федеральных средств */
              (   (new$ReestrNumber = :OLD.ReestrNumber)
               OR ((new$ReestrNumber IS NULL) AND (:OLD.ReestrNumber IS NULL)
                  )
              )
         ) THEN
         /*  заглушка */
         NULL;                        /*  new$AcceptDate := :old.AcceptDate; */
      ELSE
         /*  устанавливаем счет из заголовка (он может быть тем же)*/
         /*  при этом вызывается тригер на update Incomes32, где изменяется платежка*/
         UPDATE Incomes32 i
            SET i.iDate = new$AcceptDate,
                i.IncAccount = new$IncAccount,
                i.RVersion = -1
          WHERE i.RecordIndex = new$ID;
      END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_QUOTESTITLE_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (:NEW.ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes
                  (TableID, RecordId, DeleteDate
                  )
           VALUES (160, :OLD.ID, SYSDATE
                  );

      DELETE FROM DelRecIndexes
            WHERE (TableID = 160) AND (RecordId = :NEW.ID);
   END IF;

END;
/
CREATE INDEX QT_DocChangeDate ON TB_QuotesTitle(DocChangeDate) 
/
-- CREATE TRIGGER T_QUOTESTITLE_BI_500
CREATE OR REPLACE TRIGGER TR_QUOTESTITLE_II
  INSTEAD OF INSERT
  ON QUOTESTITLE
  FOR EACH ROW
DECLARE
  new$ID QUOTESTITLE.ID%TYPE := :NEW.ID;
  new$BUILDDATE QUOTESTITLE.BUILDDATE%TYPE := :NEW.BUILDDATE;
  new$ACCEPTDATE QUOTESTITLE.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$INCACCOUNT QUOTESTITLE.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$BUDGETREF QUOTESTITLE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER QUOTESTITLE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE QUOTESTITLE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE QUOTESTITLE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER QUOTESTITLE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$RECORDINDEX QUOTESTITLE.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$PROGINDEX QUOTESTITLE.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$DOCNUMBER QUOTESTITLE.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$TYPEOPERATIONCLS QUOTESTITLE.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$RVERSION QUOTESTITLE.RVERSION%TYPE := :NEW.RVERSION;
  new$REESTRDATE QUOTESTITLE.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$REESTRNUMBER QUOTESTITLE.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$SENDERID QUOTESTITLE.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID QUOTESTITLE.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$FACIALACCCLS QUOTESTITLE.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$REJECTCLS QUOTESTITLE.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE QUOTESTITLE.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS QUOTESTITLE.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$STIMATEID QUOTESTITLE.STIMATEID%TYPE := :NEW.STIMATEID;
  new$SUMMA QUOTESTITLE.SUMMA%TYPE := :NEW.SUMMA;
  new$DOCSTATEREF QUOTESTITLE.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$DEPARTMENTCLS QUOTESTITLE.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$DOCCHANGEDATE QUOTESTITLE.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (T_QUOTESTITLE_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  /* Заполнение Бюджета. Если пустой или 0, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  if (new$IncAccount is null) then
    GetDefDFAccRefForBudget(new$BudgetRef,new$IncAccount);
  END IF;
  if (new$FacialAccCls is null) then
    new$FacialAccCls := 0;
  END IF;
  if (new$DepartmentCls is null) then
    new$DepartmentCls := 0;
  END IF;
  if (new$Summa is null ) then
    new$Summa := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (T_QUOTESTITLE_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$DocChangeDate := new$UpdateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_QUOTESTITLE (
    ID,
    BUILDDATE,
    ACCEPTDATE,
    INCACCOUNT,
    BUDGETREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    RECORDINDEX,
    PROGINDEX,
    DOCNUMBER,
    TYPEOPERATIONCLS,
    RVERSION,
    REESTRDATE,
    REESTRNUMBER,
    SENDERID,
    SENDERRECORDID,
    FACIALACCCLS,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    STIMATEID,
    SUMMA,
    DOCSTATEREF,
    DEPARTMENTCLS,
    DOCCHANGEDATE
  ) VALUES (
    new$ID,
    new$BUILDDATE,
    new$ACCEPTDATE,
    new$INCACCOUNT,
    new$BUDGETREF,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$RECORDINDEX,
    new$PROGINDEX,
    new$DOCNUMBER,
    new$TYPEOPERATIONCLS,
    new$RVERSION,
    new$REESTRDATE,
    new$REESTRNUMBER,
    new$SENDERID,
    new$SENDERRECORDID,
    new$FACIALACCCLS,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$STIMATEID,
    new$SUMMA,
    new$DOCSTATEREF,
    new$DEPARTMENTCLS,
    new$DOCCHANGEDATE);

-- - - - - - - - - - - - -
-- AI_500 (TR_QUOTESTITLE_AI_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 160) AND (RecordID = :NEW.ID);

END;
/
-- CREATE TRIGGER T_QUOTESTITLE_BU_500
CREATE OR REPLACE TRIGGER TR_QUOTESTITLE_BU_500
  BEFORE UPDATE
  ON TB_QUOTESTITLE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (T_QUOTESTITLE_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.Updatedate := SYSDATE;
  :new.DocChangeDate := :new.UpdateDate;
  :new.UpdaterUser := User;

END;
/
-- CREATE TRIGGER TR_INCOMES32_BI_500
CREATE OR REPLACE TRIGGER TR_INCOMES32_II
  INSTEAD OF INSERT
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
--
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  CapDocNumber VARCHAR2(20);
  unkKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  Kd_Master NUMBER(10);
  idKD$ NUMBER(10);
  unkVKD$ VARCHAR2(20);
  val_DocCount$ NUMBER(10);
  val_DocType$ NUMBER(10);
  val_Org_Ref$ NUMBER(10);
  val_AccountIndex$ NUMBER(10);
  val_SubKD$ NUMBER(10);
  val_RegionCLS$ NUMBER(10);
  val_GosNI$ NUMBER(10);
  val_IncAccount$ NUMBER(10);
  val_BudgetRef$ NUMBER(10);
  val_MEANSTYPE$ NUMBER(10);
  val_FACIALACC_CLS$ NUMBER(10);
  val_TransfertCls$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapAcceptDate$ NUMBER;
  CapReestrNumber$ VARCHAR2(20);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_INCOMES32_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  IF (new$id IS NULL) THEN 
    select g_shared.nextval into new$id from dual;
  END IF;
  /* Заполнение лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$KD IS NULL) THEN 
    new$KD := 0;
  END IF;
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3;
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0;
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS IS NULL) THEN 
    new$IFS := 0;
  END IF;
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
   
  /* Заполнение Бюджета, берем из мастера */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0)) THEN
    BEGIN
      SELECT qt.BudgetRef      INTO new$BudgetRef FROM QuotesTitle qt
      WHERE qt.Id = new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или 0, берем из лицевого счета */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0)) THEN
    BEGIN
      SELECT fa.BudgetRef      INTO new$BudgetRef FROM FacialAcc_Cls fa
      WHERE fa.Id = new$FacialAcc_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или 0, берем из константы */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0))
  THEN 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
   
  IF (new$ProgIndex = 45) 
  THEN 
    IF (new$IncAccount IS NULL) THEN
      GetDefDFAccRefForBudget(new$BudgetRef,new$IncAccount);
    END IF;
    BEGIN

      /* Получить поля из заголовка */
      SELECT qt.ProgIndex, qt.AcceptDate, qt.IncAccount, qt.ReestrNumber 
      INTO CapProgIndex$, CapAcceptDate$, new$IncAccount, CapReestrNumber$       FROM QuotesTitle qt
      WHERE 
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* ставим дату документа для тех записей по которым не будет п/п */
    /* для п/п отрабатывает скрипт after insert */
    IF (CapProgIndex$ <> 145) THEN 
      new$iDate := CapAcceptDate$;
    END IF;
    IF ((CapProgIndex$ = 145)AND (NOT ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0)OR (new$Credit<0)))) )
    THEN 
      new$Idate := CapAcceptDate$;      
    END IF;
    /* если заголовок - реестр федеральных средств (поступление) */
    IF ((CapProgIndex$ = 45) AND (CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя, *//* необходимо для идентификации ФС*/            
                  
      new$FederalFundsRef := new$ID;
      /* if-then */  
    END IF;/* if-then*/
  END IF;
  BEGIN
    /* заполняем вид организации владелца л\с*/
    SELECT org.Org_Type   INTO new$FAOrgType FROM Organizations org
    INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
    WHERE fac.ID = new$FacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BI_5 (TR_INCOMES_BI_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BI_9 (TR_INCOMES32_BI_VZ)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   IF (new$ProgIndex = 9) THEN
      /* Установить фиктивный РС*/
      GetIntConst (9, 1, new$IncAccount);

      BEGIN
        /* Выбрать даты из заголовка взаимозачета */
        SELECT ACCEPTDATE, BUDGETREF
          INTO new$IDate, new$BudgetRef
          FROM VZ_OFFSET
         WHERE ID = new$RecordIndex;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_INCOMES32_BI_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   BEGIN
      SELECT Inn
        INTO new$Inn
        FROM Organizations o
       WHERE (o.ID = new$Org_Ref);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

/* Заполнение Бюджета. Если пустой или ноль, берем из мастера */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      BEGIN
         SELECT c.BudgetRef
           INTO new$budgetref
           FROM QuotesTitle c
          WHERE c.ID = NEW$RecordIndex;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

   /* Заполнение Бюджета. Если пустой, берем из лицевого счета */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      BEGIN
         SELECT fa.BudgetRef
           INTO new$budgetref
           FROM FacialAcc_Cls fa
          WHERE fa.ID = NEW$FacialAcc_Cls;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

   /* Если пустой, берем из константы */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      GetIntConst (-1, 3, new$budgetref);
   END IF;

-- - - - - - - - - - - - -
-- BI_30 (TR_INCOMES32_BI_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_70 (TR_INCOMES32_BI_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
            необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_INCOMES32_BI_100)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if ((not (newKD$  like unkKD$)) and
    (not (newKD$  like unkVKD$))) then
      /* если это налог(вообще здесь может быть сторнирование
         или дебитование невыясненных доходов) ,то создаем зеркальную
         запись,дебитующую код невыясненных доходов*/

      /* сумма в дебете должна быть равна нулю*/
      if (new$Debit <> 0) then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      BEGIN

        /* Почти всю запись подставляем из заголовка*/
        select KD,DocCount,DocType,
        Org_Ref,AccountIndex,SubKD,RegionCLS,GosNI,
        IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,
        TransfertCls
        into
        idKD$,
        val_DocCount$,
        val_DocType$,
        val_Org_Ref$,
        val_AccountIndex$,
        val_SubKD$,
        val_RegionCLS$,
        val_GosNI$,
        val_IncAccount$,
        val_BudgetRef$,
        val_MEANSTYPE$  ,
        val_FACIALACC_CLS$,
        val_TransfertCls$         from incomes32 where id=new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
         
      if (not idKD$ is null) then
        insert into
        /* KD=невыясненный код дохода (должен быть равен коду из мастер записи)
              Debit=0
              сredit=-new.credit
              ProgIndex=43
              RecordIndex=new.id
              id вставляется триггером на Incomes32*/
        Incomes32(CreaterUser, DocNum,DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS, TransfertCls)
        Values(new$CreaterUser, new$DocNum, val_DocCount$, new$iDate, new$DOCDATE, 0, -new$Credit, val_DocType$,
        val_Org_Ref$, val_AccountIndex$, idKD$, val_SubKD$, val_RegionCLS$, val_GosNI$,
        43,new$Id, val_IncAccount$, val_BudgetRef$, new$Note,val_MEANSTYPE$,val_FACIALACC_CLS$,val_TransfertCls$);
        
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_110 (TR_INCOMES32_BI_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       /* если это источник и забыли ввести ClsType */
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                /* иначе - доходная */
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      /* классификация источниковая */
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      /* классификация доходная */
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      /* неверный тип классификации*/
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_INCOMES32_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

  Update QuotesTitle set
  DocChangeDate = new$UpdateDate,
  RVersion = -1
  where id = new$recordindex;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_INCOMES32 (
    ID,
    DOCNUMBER,
    DOCCOUNT,
    IDATE,
    DEBIT,
    CREDIT,
    DOCTYPE,
    INN,
    ORG_REF,
    ACCOUNTINDEX,
    KD,
    SUBKD,
    REGIONCLS,
    GOSNI,
    INCACCOUNT,
    PROGINDEX,
    RECORDINDEX,
    BUDGETREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    NOTE,
    RECORDINDEX2,
    ELNUM,
    NOTEEX,
    BUHPAYMENTCLS,
    ACCOUNTREF,
    ELPACKETNUM,
    FACIALACC_CLS,
    NDS,
    MEANSTYPE,
    RECORDDATE,
    TOTALREF,
    REQUESTSINDEX,
    KVSR,
    TAXNOTE,
    DOCNUM,
    REALPAYERORG_REF,
    DOCDATE,
    DOCBASE,
    FACT,
    RVERSION,
    KFSR,
    KESR,
    KVR,
    KCSR,
    SUMCOMPLETE,
    ELDOCREF,
    REQUESTSINDEX2,
    FEDERALFUNDSREF,
    BUHOPERATIONCLS,
    IFS,
    IFS_CORR,
    CLSTYPE,
    NDSNOTE,
    DOGNUM,
    SENDERID,
    SENDERRECORDID,
    OKATO,
    ADDOKATO,
    REJECTCLS,
    REJECTCAUSE,
    FUNDSSOURCE,
    DIRECTIONCLS,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    STIMATEID,
    TRANSFERTCLS,
    SUBSIDYCLS,
    FAORGTYPE,
    OKTMO,
    UINCODE
  ) VALUES (
    new$ID,
    new$DOCNUMBER,
    new$DOCCOUNT,
    new$IDATE,
    new$DEBIT,
    new$CREDIT,
    new$DOCTYPE,
    new$INN,
    new$ORG_REF,
    new$ACCOUNTINDEX,
    new$KD,
    new$SUBKD,
    new$REGIONCLS,
    new$GOSNI,
    new$INCACCOUNT,
    new$PROGINDEX,
    new$RECORDINDEX,
    new$BUDGETREF,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$NOTE,
    new$RECORDINDEX2,
    new$ELNUM,
    new$NOTEEX,
    new$BUHPAYMENTCLS,
    new$ACCOUNTREF,
    new$ELPACKETNUM,
    new$FACIALACC_CLS,
    new$NDS,
    new$MEANSTYPE,
    new$RECORDDATE,
    new$TOTALREF,
    new$REQUESTSINDEX,
    new$KVSR,
    new$TAXNOTE,
    new$DOCNUM,
    new$REALPAYERORG_REF,
    new$DOCDATE,
    new$DOCBASE,
    new$FACT,
    new$RVERSION,
    new$KFSR,
    new$KESR,
    new$KVR,
    new$KCSR,
    new$SUMCOMPLETE,
    new$ELDOCREF,
    new$REQUESTSINDEX2,
    new$FEDERALFUNDSREF,
    new$BUHOPERATIONCLS,
    new$IFS,
    new$IFS_CORR,
    new$CLSTYPE,
    new$NDSNOTE,
    new$DOGNUM,
    new$SENDERID,
    new$SENDERRECORDID,
    new$OKATO,
    new$ADDOKATO,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$FUNDSSOURCE,
    new$DIRECTIONCLS,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$STIMATEID,
    new$TRANSFERTCLS,
    new$SUBSIDYCLS,
    new$FAORGTYPE,
    new$OKTMO,
    new$UINCODE);

-- - - - - - - - - - - - -
-- AI_20 (T_INCOMES32_AI_20)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   -- Получить поля из заголовка ВД
   if (new$ProgIndex <> 42) then
     BEGIN
       SELECT ProgIndex, DocNumber, AcceptDate
        INTO CapProgIndex, CapDocNumber, CapAcceptDate
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
     EXCEPTION
       WHEN NO_DATA_FOUND THEN NULL;
     END;
   end if;

   -- если заголовок - ВД, то обрабатывать
   IF ((CapProgIndex = 145) or (new$ProgIndex=42)) THEN

      If ((new$ProgIndex=42) and (new$DocType between 1010 and 1019) and
         (new$Debit>0) and (new$DOCDATE is not null))
      then
        BEGIN
          select kd into Kd_Master
    From Incomes32 inc
          where inc.id = new$RecordIndex;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;

        if (Kd_Master = new$Kd) then
          CapAcceptDate := new$DOCDATE;
          CapProgIndex  := new$ProgIndex;
          CapDocNumber  := new$DocNum;
        end if;
      end if; -- нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)

      -- сумма может быть или по кредиту с минусом или по дебету с плюсом
      IF ((CapAcceptDate IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit > 0) OR (new$Credit < 0))) THEN
         -- Создать платежное поручение (Добавлено RealPayerOrg_Ref(PayDoc32)=new$RealPayerOrg_Ref(Incomes32))
         INSERT INTO PayDoc32
            (BudgetRef, AccountRef, PayerAttrRef, InputDate,
             Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref, FACIALACC_CLS)
         VALUES (new$BudgetRef, new$AccountRef, new$IncAccount, CapAcceptDate,
             (new$Debit - new$Credit), new$Note, new$ProgIndex, new$id, CapDocNumber, new$TaxNote,
             new$RealPayerOrg_Ref,new$FACIALACC_CLS);
      -- (new$Debit - new$Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
      -- что в сумму платежного поручения будут попадать или дебет или кредит по модулю
      END IF;

   END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_INCOMES32_AI_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 161) AND (RecordID = NEW$ID);

END;
/
-- CREATE TRIGGER TR_INCOMES32_BU_500
CREATE OR REPLACE TRIGGER TR_INCOMES32_BU_500
  BEFORE UPDATE
  ON TB_INCOMES32
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_INCOMES32_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.Updatedate := SYSDATE;
  :new.UpdaterUser := User;

  Update QuotesTitle set
  DocChangeDate = :new.UpdateDate,
  RVersion = -1
  where id = :new.recordindex;

END;
/
-- CREATE TRIGGER TR_INCOMES32_BD_500
CREATE OR REPLACE TRIGGER TR_INCOMES32_ID
  INSTEAD OF DELETE
  ON INCOMES32
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_10 (TR_INCOMES32_BD10)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

  delete
  from CurrencyIncomes
  where (id = :old.id);

-- - - - - - - - - - - - -
-- BD_20 (T_INCOMES32_BD_20)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

  /* Удалить платежные поручения */
  if (:old.DocType between 1010 and 1019) then
    delete from PayDoc32
    where 
      (ProgIndex = :old.ProgIndex) 
    and 
     (RecordIndex = :old.id);
  end if;

-- - - - - - - - - - - - -
-- BD_500 (TR_INCOMES32_BD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  Update QuotesTitle set
  DocChangeDate = SYSDATE,
  RVersion = -1
  where id = :old.recordindex;

-- - - - - - - - - - - - -
-- BD_600 (TR_INCOMES32_BD_600)
-- Last update 14.10.2009
-- - - - - - - - - - - - -

    --удаляем детализацию если удаляют заголовок
    if (:old.ProgIndex = 41) then
        delete
            from Incomes32
        where
           (ProgIndex=42)and
           (RecordIndex=:old.id);
    end if;

    --удаляем зеркальную запись(если она есть)
    if (:old.ProgIndex = 42) then
        delete
            from Incomes32
        where
            (ProgIndex=43)and
            (RecordIndex=:old.id);
    end if;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_INCOMES32
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);
   
  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_500 (TR_INCOMES32_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordID, DeleteDate, ProgIndex, SUMMA) values (161, :old.ID, SYSDATE, :old.ProgIndex, :old.DEBIT + :old.CREDIT);

END;
/
ALTER TRIGGER TR_QUOTESTITLE_BU_500 DISABLE
/
Update QuotesTitle qt set
    DocChangeDate = (select max(UpdateDate) from Incomes32 inc
where (inc.recordindex = qt.id))
/
Update QuotesTitle set
    DocChangeDate = UpdateDate
where (DocChangeDate < UpdateDate) or (DocChangeDate is null)
/
ALTER TRIGGER TR_QUOTESTITLE_BU_500 ENABLE
/
/* CorrectionCaption */
ALTER TABLE CorrectionCaption ADD (
  DocChangeDate DATE
)
/
CREATE INDEX CC_DocChangeDate ON CorrectionCaption(DocChangeDate) 
/
-- CREATE TRIGGER TR_CORRECTIONCAPTION_BI_500
CREATE OR REPLACE TRIGGER TR_CORRECTIONCAPTION_BI
  BEFORE INSERT
  ON CORRECTIONCAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_CORRECTIONCAPTION_BI)
-- Version 7.01.00.2
-- - - - - - - - - - - - -

  if (:new.id is null) then 
    select g_shared.nextval into :new.id from dual;
  END IF;
  if ((:new.BudgetRef is null) or (:new.BudgetRef = 0))
  then 
    GetIntConst(-1, 3,:new.BudgetRef);
  END IF;
    
  if (:new.FacialAcc_Cls is null) then 
    :new.FacialAcc_Cls := 0;
  END IF;
  if (:new.DocType is null) then 
    :new.DocType := 0;
  END IF;
  if (:new.OriginalPayerOrgName is null) then 
    :new.OriginalPayerOrgName := '';
  END IF;
  if (:new.OriginalAcceptorOrgName is null) then 
    :new.OriginalAcceptorOrgName := '';
  END IF;
    
  if (:new.OperationDirection is null) then 
    :new.OperationDirection := 0;
  END IF;
     
  if (:new.OperationDirection = 0) then
    :new.SourceType := 1;
    :new.DestType := 1;
        
  else
    if (:new.OperationDirection = 1) then
      :new.SourceType := 1; 
      :new.DestType := -1;
            
    else
      if (:new.OperationDirection = 2) then
        :new.SourceType := -1;
        :new.DestType := 1;
                
      else
        :new.SourceType := -1;
        :new.DestType := -1;
                
      END IF;
    END IF;
  END IF;
  /* документ не может быть одновременно принятым и отклоненным*/
  if ((:new.AcceptDate is not null) and (:new.Reject_Cls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;
      
  if (:new.DepartmentCls is null) then
    :new.DepartmentCls := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_CORRECTIONCAPTION_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.DocChangeDate := :new.UpdateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- CREATE TRIGGER TR_CORRECTIONCAPTION_BU_500
CREATE OR REPLACE TRIGGER TR_CORRECTIONCAPTION_BU_500
  BEFORE UPDATE
  ON CORRECTIONCAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_CORRECTIONCAPTION_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.Updatedate := SYSDATE;
  :new.DocChangeDate := :new.UpdateDate;
  :new.UpdaterUser := User;

END;
/
-- CREATE TRIGGER TR_CORRECTIONDETAIL_BI_500
CREATE OR REPLACE TRIGGER TR_CORRECTIONDETAIL_II
  INSTEAD OF INSERT
  ON CORRECTIONDETAIL
  FOR EACH ROW
DECLARE
  new$ID CORRECTIONDETAIL.ID%TYPE := :NEW.ID;
  new$PARENTID CORRECTIONDETAIL.PARENTID%TYPE := :NEW.PARENTID;
  new$BUDGETREF CORRECTIONDETAIL.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUMMA CORRECTIONDETAIL.SUMMA%TYPE := :NEW.SUMMA;
  new$CLSTYPE CORRECTIONDETAIL.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$FACIALACC_CLS CORRECTIONDETAIL.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$KVSR CORRECTIONDETAIL.KVSR%TYPE := :NEW.KVSR;
  new$KFSR CORRECTIONDETAIL.KFSR%TYPE := :NEW.KFSR;
  new$KCSR CORRECTIONDETAIL.KCSR%TYPE := :NEW.KCSR;
  new$KVR CORRECTIONDETAIL.KVR%TYPE := :NEW.KVR;
  new$KESR CORRECTIONDETAIL.KESR%TYPE := :NEW.KESR;
  new$DIRECTIONCLS CORRECTIONDETAIL.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$MEANSTYPE CORRECTIONDETAIL.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$FACT CORRECTIONDETAIL.FACT%TYPE := :NEW.FACT;
  new$REGIONCLS CORRECTIONDETAIL.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$FINSOURCE CORRECTIONDETAIL.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$FINTYPE CORRECTIONDETAIL.FINTYPE%TYPE := :NEW.FINTYPE;
  new$DOCTYPE CORRECTIONDETAIL.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$SUBKESR CORRECTIONDETAIL.SUBKESR%TYPE := :NEW.SUBKESR;
  new$FUNDSSOURCE CORRECTIONDETAIL.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$KD CORRECTIONDETAIL.KD%TYPE := :NEW.KD;
  new$IFS CORRECTIONDETAIL.IFS%TYPE := :NEW.IFS;
  new$BUHOPERATIONCLS CORRECTIONDETAIL.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CHANGEACC_REF CORRECTIONDETAIL.CHANGEACC_REF%TYPE := :NEW.CHANGEACC_REF;
  new$CHANGEACC CORRECTIONDETAIL.CHANGEACC%TYPE := :NEW.CHANGEACC;
  new$CHANGEORGNAME CORRECTIONDETAIL.CHANGEORGNAME%TYPE := :NEW.CHANGEORGNAME;
  new$CHANGEORGINN CORRECTIONDETAIL.CHANGEORGINN%TYPE := :NEW.CHANGEORGINN;
  new$CHANGEORGINN20 CORRECTIONDETAIL.CHANGEORGINN20%TYPE := :NEW.CHANGEORGINN20;
  new$PROGINDEX CORRECTIONDETAIL.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX CORRECTIONDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$DOCUMENTPROGINDEX CORRECTIONDETAIL.DOCUMENTPROGINDEX%TYPE := :NEW.DOCUMENTPROGINDEX;
  new$DOCUMENTRECORDINDEX CORRECTIONDETAIL.DOCUMENTRECORDINDEX%TYPE := :NEW.DOCUMENTRECORDINDEX;
  new$ISBLOCKED CORRECTIONDETAIL.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE CORRECTIONDETAIL.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE CORRECTIONDETAIL.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE CORRECTIONDETAIL.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$SENDERID CORRECTIONDETAIL.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID CORRECTIONDETAIL.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$RVERSION CORRECTIONDETAIL.RVERSION%TYPE := :NEW.RVERSION;
  new$CREATERUSER CORRECTIONDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE CORRECTIONDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATERUSER CORRECTIONDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$UPDATEDATE CORRECTIONDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$NOTE CORRECTIONDETAIL.NOTE%TYPE := :NEW.NOTE;
  new$ISCLSCHANGED CORRECTIONDETAIL.ISCLSCHANGED%TYPE := :NEW.ISCLSCHANGED;
  new$PROMISE CORRECTIONDETAIL.PROMISE%TYPE := :NEW.PROMISE;
  new$BUDGETPROMISE CORRECTIONDETAIL.BUDGETPROMISE%TYPE := :NEW.BUDGETPROMISE;
  new$EXECDOC CORRECTIONDETAIL.EXECDOC%TYPE := :NEW.EXECDOC;
  new$OKATO CORRECTIONDETAIL.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO CORRECTIONDETAIL.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$TRANSFERTCLS CORRECTIONDETAIL.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$ORIGINALCLSSUMMA CORRECTIONDETAIL.ORIGINALCLSSUMMA%TYPE := :NEW.ORIGINALCLSSUMMA;
  new$NOTECLS CORRECTIONDETAIL.NOTECLS%TYPE := :NEW.NOTECLS;
  new$OPERATIONTYPE CORRECTIONDETAIL.OPERATIONTYPE%TYPE := :NEW.OPERATIONTYPE;
  new$REVERSEFLAG CORRECTIONDETAIL.REVERSEFLAG%TYPE := :NEW.REVERSEFLAG;
  new$EXECINNERNUMBER CORRECTIONDETAIL.EXECINNERNUMBER%TYPE := :NEW.EXECINNERNUMBER;
  new$CLSFIELFCHANGED CORRECTIONDETAIL.CLSFIELFCHANGED%TYPE := :NEW.CLSFIELFCHANGED;
  new$FAORGTYPE CORRECTIONDETAIL.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$SUBSIDYCLS CORRECTIONDETAIL.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$BUDALLOCATIONCLS CORRECTIONDETAIL.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS CORRECTIONDETAIL.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
  new$NOTEQUALEX CORRECTIONDETAIL.NOTEQUALEX%TYPE := :NEW.NOTEQUALEX;
  new$OKTMO CORRECTIONDETAIL.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE CORRECTIONDETAIL.UINCODE%TYPE := :NEW.UINCODE;
--
  BPInnerNum$ NUMBER(10);
  PromiseMode$ NUMBER(10);
  Promise_Count$ NUMBER(10);
  ConstCheck$ NUMBER(10);
  vOperationTypeS1$ NUMBER(10);
  vOperationTypeD1$ NUMBER(10);
  vOperationType1$ NUMBER(10);
  PromiseMode1$ NUMBER(10);
  ProgIndex$ NUMBER(10);
  ExecID$ NUMBER(10);
  ExecInnerNumber$ NUMBER(10);
  ExecRegType$ NUMBER(10);
  ExecAgrInnerNum$ NUMBER(10);
  AgrInnerNumber$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_CORRECTIONDETAIL_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  IF (new$id IS NULL) THEN 
    select g_shared.nextval into new$id from dual;
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$IFS := 0;
  END IF;
  IF (new$FacialAcc_Cls IS NULL) THEN 
    new$FacialAcc_Cls := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DirectionCls IS NULL) THEN 
    new$DirectionCls := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$Finsource IS NULL) THEN 
    new$Finsource := 0;
  END IF;
  IF (new$FinType IS NULL) THEN 
    new$FinType := 0;
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;  
  END IF;
  IF (new$SubKesr IS NULL) THEN 
    new$SubKesr := 0;
  END IF;
  IF (new$buhoperationCls IS NULL) THEN 
    new$buhoperationCls := 0;
  END IF;
  IF (new$ReverseFlag IS NULL) THEN 
    new$ReverseFlag := 1;
  END IF;
  IF (new$OperationType IS NULL) THEN 
    BEGIN
      SELECT CorCap.SourceType, CorCap.DestType
      INTO
      vOperationTypeS1$, vOperationTypeD1$       FROM correctioncaption CorCap
      WHERE
      (CorCap.id = new$recordindex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    IF (new$ProgIndex = 315) THEN 
      vOperationType1$ := vOperationTypeS1$;
          
    ELSE 
      vOperationType1$ := vOperationTypeD1$;
    END IF;
    new$OperationType := vOperationType1$;
      
  END IF;
  BEGIN

    SELECT org.Org_Type   INTO new$FAOrgType FROM Organizations org
    INNER JOIN FacialAcc_Cls fac  ON (org.ID = fac.Org_ref)
    WHERE fac.ID = new$FacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BI_100 (tr_correctiondetail_bi_100)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$progindex = 316) then
    update correctiondetail set
    buhoperationcls = new$buhoperationcls
    where ID = new$parentid;
  END IF;

-- - - - - - - - - - - - -
-- BI_120 (TR_CORRECTIONDETAIL_BI_120)
-- Create 13.08.2007
-- - - - - - - - - - - - -

  if ((new$ClsType is NULL) and (new$IFS <> 0)) then
    new$ClsType := 1; /* если это источник и забыли ввести ClsType */
  else
    if ((new$ClsType is NULL) and (new$KD <> 0)) then
      new$ClsType := 2; /* если это код дохода и забыли ввести ClsType */
      else
        if (new$ClsType is null)
          then new$ClsType := 0; /* иначе - расходная */
        end if;
    end if;
  end if;
 
  IF ((new$ClsType = 0) AND ((new$IFS <> 0) or (new$KD <> 0)))THEN /* классификация расходная */
    RaiseException('EX_WRONGBUDCLS');
  end if;
 
  IF ( (new$ClsType = 1) AND (
       (new$KVSR <> 0) OR (new$KFSR <> 0) OR
       (new$KCSR <> 0) OR (new$KVR <> 0) OR
       (new$KESR <> 0) OR (new$KD <> 0)
     ))
  THEN /* классификация источниковая */
    RaiseException('EX_WRONGBUDCLS');
  end if;
 
  IF ((new$ClsType = 2) AND (
      (new$KVSR <> 0) OR (new$KFSR <> 0) OR
      (new$KCSR <> 0) OR (new$KVR <> 0) OR
      (new$KESR <> 0) OR
      (new$IFS <> 0)
    ))
  THEN /* классификация доходная */
    RaiseException('EX_WRONGBUDCLS');
  end if;

-- - - - - - - - - - - - -
-- BI_200 (TR_CORRECTIONDETAIL_BI_200)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* проставляем номера бюджетных обязательств по Учету договоров*/
  GetIntConst(30, 15,PromiseMode$);
  getintconst(30, 35,ConstCheck$);
  /* (старые БО) Проверка существует ли такой номер БО, на который ссылается уведомление*/
  if ((PromiseMode$ <> 1) and (ConstCheck$ = 1)) then
    if (new$Promise is not null) then
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count$        from
      promise_detail pr
      where
      (pr.registrnumber = new$PROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count$ = 0) then
        RaiseException('EX_BP_NotExist');    
      END IF;  
    END IF;/* end проверки PromiseMode <> 1*/
  END IF;
  /* (новые БО) Проверка существует ли такой номер БО, на который ссылается уведомление*/
  /* и простановка старого БО по новому номеру БО */
  if (PromiseMode$ = 1) then
    if ((new$Promise is not null) and (new$BudgetPromise is null)) then
      select 
      max(InnerPromiseNum) 
      into BPInnerNum$       from 
      PaymentSchedule 
      where 
      (ANumber = new$Promise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum$ <> 0) then
        new$BudgetPromise := BPInnerNum$;
              
      else
        RaiseException('EX_BP_NotExist');    
      END IF;
    END IF;
    /* Если есть новый номер, но нет старого, тогда проставляем старый*/
    if ((new$BudgetPromise is not null) and (new$Promise is null)) then
      BEGIN
        select 
        ANumber 
        into BPInnerNum$       from 
        PaymentSchedule
        where 
        (InnerPromiseNum = new$BudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
            
      new$Promise := BPInnerNum$;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_210 (TR_CORRECTIONDETAIL_BI_210)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* используем болк учета договоров?*/
  GetIntConst(30, 15,PromiseMode1$);
  if (PromiseMode1$ = 1) then
    /* при простановке БО плательщика или его изменении */
    if (new$Promise is not null) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$Promise and ps.InnerPromiseNum = new$BudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$ExecDoc := ExecID$;
        new$ExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$ExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$ExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$ExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано, а ДИ указано, то */
    else 
      if (new$ExecDoc is not null) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$ExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$ExecInnerNumber := ExecInnerNumber$;
            
      END IF;  
    END IF;/* использование блока "Учет договоров"*/
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_CORRECTIONDETAIL_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

  Update CorrectionCaption set
  DocChangeDate = new$UpdateDate,
  RVersion = -1
  where id = new$recordindex;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_CORRECTIONDETAIL (
    ID,
    PARENTID,
    BUDGETREF,
    SUMMA,
    CLSTYPE,
    FACIALACC_CLS,
    KVSR,
    KFSR,
    KCSR,
    KVR,
    KESR,
    DIRECTIONCLS,
    MEANSTYPE,
    FACT,
    REGIONCLS,
    FINSOURCE,
    FINTYPE,
    DOCTYPE,
    SUBKESR,
    FUNDSSOURCE,
    KD,
    IFS,
    BUHOPERATIONCLS,
    CHANGEACC_REF,
    CHANGEACC,
    CHANGEORGNAME,
    CHANGEORGINN,
    CHANGEORGINN20,
    PROGINDEX,
    RECORDINDEX,
    DOCUMENTPROGINDEX,
    DOCUMENTRECORDINDEX,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    SENDERID,
    SENDERRECORDID,
    RVERSION,
    CREATERUSER,
    CREATEDATE,
    UPDATERUSER,
    UPDATEDATE,
    NOTE,
    ISCLSCHANGED,
    PROMISE,
    BUDGETPROMISE,
    EXECDOC,
    OKATO,
    ADDOKATO,
    TRANSFERTCLS,
    ORIGINALCLSSUMMA,
    NOTECLS,
    OPERATIONTYPE,
    REVERSEFLAG,
    EXECINNERNUMBER,
    CLSFIELFCHANGED,
    FAORGTYPE,
    SUBSIDYCLS,
    BUDALLOCATIONCLS,
    PAYPROMISECLS,
    NOTEQUALEX,
    OKTMO,
    UINCODE
  ) VALUES (
    new$ID,
    new$PARENTID,
    new$BUDGETREF,
    new$SUMMA,
    new$CLSTYPE,
    new$FACIALACC_CLS,
    new$KVSR,
    new$KFSR,
    new$KCSR,
    new$KVR,
    new$KESR,
    new$DIRECTIONCLS,
    new$MEANSTYPE,
    new$FACT,
    new$REGIONCLS,
    new$FINSOURCE,
    new$FINTYPE,
    new$DOCTYPE,
    new$SUBKESR,
    new$FUNDSSOURCE,
    new$KD,
    new$IFS,
    new$BUHOPERATIONCLS,
    new$CHANGEACC_REF,
    new$CHANGEACC,
    new$CHANGEORGNAME,
    new$CHANGEORGINN,
    new$CHANGEORGINN20,
    new$PROGINDEX,
    new$RECORDINDEX,
    new$DOCUMENTPROGINDEX,
    new$DOCUMENTRECORDINDEX,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$SENDERID,
    new$SENDERRECORDID,
    new$RVERSION,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATERUSER,
    new$UPDATEDATE,
    new$NOTE,
    new$ISCLSCHANGED,
    new$PROMISE,
    new$BUDGETPROMISE,
    new$EXECDOC,
    new$OKATO,
    new$ADDOKATO,
    new$TRANSFERTCLS,
    new$ORIGINALCLSSUMMA,
    new$NOTECLS,
    new$OPERATIONTYPE,
    new$REVERSEFLAG,
    new$EXECINNERNUMBER,
    new$CLSFIELFCHANGED,
    new$FAORGTYPE,
    new$SUBSIDYCLS,
    new$BUDALLOCATIONCLS,
    new$PAYPROMISECLS,
    new$NOTEQUALEX,
    new$OKTMO,
    new$UINCODE);

-- - - - - - - - - - - - -
-- AI_500 (TR_CORRECTIONDETAIL_AI_500)
-- Create 29.12.2009
-- - - - - - - - - - - - -

 delete from DelRecIndexes where (TableID =5504 ) and (RecordID = new$ID);

END;
/
-- CREATE TRIGGER TR_CORRECTIONDETAIL_BU_500
CREATE OR REPLACE TRIGGER TR_CORRECTIONDETAIL_BU_500
  BEFORE UPDATE
  ON TB_CORRECTIONDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_CORRECTIONDETAIL_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.Updatedate := SYSDATE;
  :new.UpdaterUser := User;

  Update CorrectionCaption set
  DocChangeDate = :new.UpdateDate,
  RVersion = -1
  where id = :new.recordindex;

END;
/
-- CREATE TRIGGER TR_CORRECTIONDETAIL_BD_500
CREATE OR REPLACE TRIGGER TR_CORRECTIONDETAIL_ID
  INSTEAD OF DELETE
  ON CORRECTIONDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_500 (TR_CORRECTIONDETAIL_BD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  Update CorrectionCaption set
  DocChangeDate = SYSDATE,
  RVersion = -1
  where id = :old.recordindex;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_CORRECTIONDETAIL
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AD_500 (TR_CORRECTIONDETAIL_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate, ProgIndex, SUMMA) values(5504,:old.ID,SYSDATE,:old.ProgIndex, :old.SUMMA);

END;
/
ALTER TRIGGER TR_CORRECTIONCAPTION_BU_500 DISABLE
/
Update CorrectionCaption cc set
    DocChangeDate = (select max(UpdateDate) from CorrectionDetail cd
where (cd.recordindex = cc.id))
/
Update CorrectionCaption set
    DocChangeDate = UpdateDate
where (DocChangeDate < UpdateDate) or (DocChangeDate is null)
/
ALTER TRIGGER TR_CORRECTIONCAPTION_BU_500 ENABLE
/
/* BuhOperationCls */
ALTER TABLE BuhOperationCls ADD (
  DocChangeDate DATE
)
/
CREATE INDEX BO_DocChangeDate ON BuhOperationCls(DocChangeDate) 
/
-- CREATE TRIGGER TR_BUHOPERATIONCLS_BI_500
CREATE OR REPLACE TRIGGER TR_BUHOPERATIONCLS_BI
  BEFORE INSERT
  ON BUHOPERATIONCLS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_BUHOPERATIONCLS_BI)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (:new.CorrectionFlag is null) then
    :new.CorrectionFlag := 0;
  END IF;
  /* количество записей детали при вставке всегда 0*/  
  :new.CountDetailRecords := 0;

-- - - - - - - - - - - - -
-- BI_500 (TR_BUHOPERATIONCLS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.DocChangeDate := :new.UpdateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- CREATE TRIGGER TR_BUHOPERATIONCLS_BU_500
CREATE OR REPLACE TRIGGER TR_BUHOPERATIONCLS_BU_500
  BEFORE UPDATE
  ON BUHOPERATIONCLS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_BUHOPERATIONCLS_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.Updatedate := SYSDATE;
  :new.DocChangeDate := :new.UpdateDate;
  :new.UpdaterUser := User;

END;
/
-- CREATE TRIGGER TR_BUHACCCORR_BI_500
CREATE OR REPLACE TRIGGER TR_BUHACCCORR_II
  INSTEAD OF INSERT
  ON BUHACCCORR
  FOR EACH ROW
DECLARE
  new$ID BUHACCCORR.ID%TYPE := :NEW.ID;
  new$BUHOPERATIONCLS BUHACCCORR.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$DEBITACCREF BUHACCCORR.DEBITACCREF%TYPE := :NEW.DEBITACCREF;
  new$CREDITACCREF BUHACCCORR.CREDITACCREF%TYPE := :NEW.CREDITACCREF;
  new$BALANCECLS BUHACCCORR.BALANCECLS%TYPE := :NEW.BALANCECLS;
  new$DEBITBUDCLSKIND BUHACCCORR.DEBITBUDCLSKIND%TYPE := :NEW.DEBITBUDCLSKIND;
  new$CREDITBUDCLSKIND BUHACCCORR.CREDITBUDCLSKIND%TYPE := :NEW.CREDITBUDCLSKIND;
  new$CREATEDATE BUHACCCORR.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE BUHACCCORR.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CORRECTIONFLAG BUHACCCORR.CORRECTIONFLAG%TYPE := :NEW.CORRECTIONFLAG;
  new$NAME BUHACCCORR.NAME%TYPE := :NEW.NAME;
  new$BACKNAME BUHACCCORR.BACKNAME%TYPE := :NEW.BACKNAME;
  new$HEADACTIVITYKIND BUHACCCORR.HEADACTIVITYKIND%TYPE := :NEW.HEADACTIVITYKIND;
  new$ACTIVITYKIND BUHACCCORR.ACTIVITYKIND%TYPE := :NEW.ACTIVITYKIND;
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_BUHACCCORR_BI)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  IF (new$ID IS NULL) THEN
    select g_shared.nextval into new$ID from dual;
  END IF;
  if (new$DebitBudClsKind is null) then
    new$DebitBudClsKind := 0;
  END IF;
  if (new$CreditBudClsKind is null) then
    new$CreditBudClsKind := 0;
  END IF;
    
  if (new$CorrectionFlag is null) then
    new$CorrectionFlag := 0;
  END IF;
  if (new$HeadActivityKind is null) then
    new$HeadActivityKind := 0;
  END IF;
  if (new$ActivityKind is null) then
    new$ActivityKind := 1;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_BUHACCCORR_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;

  Update BuhOperationCls set
  DocChangeDate = new$UpdateDate
  where id = new$BuhOperationCls;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_BUHACCCORR (
    ID,
    BUHOPERATIONCLS,
    DEBITACCREF,
    CREDITACCREF,
    BALANCECLS,
    DEBITBUDCLSKIND,
    CREDITBUDCLSKIND,
    CREATEDATE,
    UPDATEDATE,
    CORRECTIONFLAG,
    NAME,
    BACKNAME,
    HEADACTIVITYKIND,
    ACTIVITYKIND
  ) VALUES (
    new$ID,
    new$BUHOPERATIONCLS,
    new$DEBITACCREF,
    new$CREDITACCREF,
    new$BALANCECLS,
    new$DEBITBUDCLSKIND,
    new$CREDITBUDCLSKIND,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$CORRECTIONFLAG,
    new$NAME,
    new$BACKNAME,
    new$HEADACTIVITYKIND,
    new$ACTIVITYKIND);

-- - - - - - - - - - - - -
-- AI_0 (tr_buhacccorr_ai)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* изменим занчение поля-количество записей детали в заголовке*/
  update buhoperationcls boc set
  boc.CountDetailRecords = (select count(bac.ID) from buhacccorr bac
  where bac.BuhOperationCls = new$BuhOperationCls)
  where boc.id = new$BuhOperationCls;

-- - - - - - - - - - - - -
-- AI_500 (TR_BUHACCCORR_AI_500)
-- Last update 28.04.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 149) and (RecordId = new$ID);

END;
/
-- CREATE TRIGGER TR_BUHACCCORR_BU_500
CREATE OR REPLACE TRIGGER TR_BUHACCCORR_BU_500
  BEFORE UPDATE
  ON TB_BUHACCCORR
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_BUHACCCORR_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.Updatedate := SYSDATE;

  Update BuhOperationCls set
  DocChangeDate = :new.UpdateDate
  where id = :new.BuhOperationCls;

END;
/
-- CREATE TRIGGER TR_BUHACCCORR_BD_500
CREATE OR REPLACE TRIGGER TR_BUHACCCORR_ID
  INSTEAD OF DELETE
  ON BUHACCCORR
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_500 (TR_BUHACCCORR_BD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  Update BuhOperationCls set
  DocChangeDate = SYSDATE
  where id = :old.BuhOperationCls;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_BUHACCCORR
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AD_0 (tr_buhacccorr_ad)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* изменим значение поля-количество записей детали в заголовке*/
  update buhoperationcls boc set
  boc.CountDetailRecords = (select count(bac.ID) from buhacccorr bac
  where bac.BuhOperationCls = :old.BuhOperationCls)
  where boc.id = :old.BuhOperationCls;

-- - - - - - - - - - - - -
-- AD_500 (TR_BUHACCCORR_AD_500)
-- Last update 28.04.2005
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(149,:old.ID,SYSDATE);

END;
/
ALTER TRIGGER TR_BUHOPERATIONCLS_BU_500 DISABLE
/
Update BuhOperationCls bo set
    DocChangeDate = (select max(UpdateDate) from BuhAccCorr ba
where (ba.BuhOperationCls = bo.id))
/
Update BuhOperationCls set
    DocChangeDate = UpdateDate
where (DocChangeDate < UpdateDate) or (DocChangeDate is null)
/
ALTER TRIGGER TR_BUHOPERATIONCLS_BU_500 ENABLE
/
COMMIT WORK 
/


-- #########################################################
-- #########################################################
-- Alter_Selections_Add_Group.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет в таблицу выборок идентификатор события, флаг логирования;
   номер группы в состав выборки для возможности задания нескольких запросов */
ALTER TABLE Selections ADD (
  GroupID NUMBER(10),
    CHECK((GroupID<=2147483647)AND(GroupID>-2147483648)),
  IsLogged NUMBER(5) default 0,
    CHECK (IsLogged in (0,1))
)
/
ALTER TABLE SelectionsDetail ADD (
  QueryGroup NUMBER(10) default 0,
    CHECK((QueryGroup<=2147483647)AND(QueryGroup>-2147483648))
)
/
COMMIT WORK 
/

ALTER TABLE Selections MODIFY(IsLogged NOT NULL)
/
ALTER TABLE SelectionsDetail MODIFY(QueryGroup NOT NULL)
/

-- #########################################################
-- #########################################################
-- add_IFS_LEVEL.sql
-- #########################################################
-- #########################################################


/* реализован ручной перевод на Oracle по причине наличия конструкций условного выполнения*/
/* <TRANS_COMMAND>
ALTER TABLE TB_innerfinsource ADD IFS_LEVEL NUMBER(10,0);
*/
-- <TRANS_IGNORE>
DECLARE
  v_exists INTEGER;
BEGIN
  SELECT COUNT(*)
  INTO v_exists
  FROM USER_TAB_COLUMNS
  WHERE TABLE_NAME = 'TB_INNERFINSOURCE'
  AND COLUMN_NAME = 'IFS_LEVEL';
  IF (v_exists = 0) THEN
    EXECUTE IMMEDIATE 
    'ALTER TABLE TB_INNERFINSOURCE ADD IFS_LEVEL NUMBER(10,0)';
  END IF;
END;
/

CREATE OR REPLACE VIEW innerfinsource (
  ID,
  CREATEDATE,
  UPDATEDATE,
  DIRECTION,
  KVSR,
  DESCRIPTIONCODE,
  MAINDESCRIPTIONCODE,
  ITEMCODE,
  PROGRAMCODE,
  KESR,
  FINSOURCEVALUE,
  UNIONFLAG,
  REMOTEFLAG,
  BUDGETREF,
  DELETEDATE,
  NAME,
  STARTDATE,
  SHORTNAME,
  CLSASPECT,
  CREATERUSER,
  UPDATERUSER,
  IFS_LEVEL)
AS
  SELECT
    ID,
    CREATEDATE,
    UPDATEDATE,
    DIRECTION,
    KVSR,
    DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE,
    ITEMCODE,
    PROGRAMCODE,
    KESR,
    FINSOURCEVALUE,
    UNIONFLAG,
    REMOTEFLAG,
    BUDGETREF,
    DELETEDATE,
    NAME,
    STARTDATE,
    SHORTNAME,
    CLSASPECT,
    CREATERUSER,
    UPDATERUSER,
    IFS_LEVEL
  FROM TB_INNERFINSOURCE
/

CREATE OR REPLACE TRIGGER TR_INNERFINSOURCE_II
  INSTEAD OF INSERT
  ON INNERFINSOURCE
  FOR EACH ROW
DECLARE
  new$ID INNERFINSOURCE.ID%TYPE := :NEW.ID;
  new$CREATEDATE INNERFINSOURCE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INNERFINSOURCE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$DIRECTION INNERFINSOURCE.DIRECTION%TYPE := :NEW.DIRECTION;
  new$KVSR INNERFINSOURCE.KVSR%TYPE := :NEW.KVSR;
  new$DESCRIPTIONCODE INNERFINSOURCE.DESCRIPTIONCODE%TYPE := :NEW.DESCRIPTIONCODE;
  new$MAINDESCRIPTIONCODE INNERFINSOURCE.MAINDESCRIPTIONCODE%TYPE := :NEW.MAINDESCRIPTIONCODE;
  new$ITEMCODE INNERFINSOURCE.ITEMCODE%TYPE := :NEW.ITEMCODE;
  new$PROGRAMCODE INNERFINSOURCE.PROGRAMCODE%TYPE := :NEW.PROGRAMCODE;
  new$KESR INNERFINSOURCE.KESR%TYPE := :NEW.KESR;
  new$FINSOURCEVALUE INNERFINSOURCE.FINSOURCEVALUE%TYPE := :NEW.FINSOURCEVALUE;
  new$UNIONFLAG INNERFINSOURCE.UNIONFLAG%TYPE := :NEW.UNIONFLAG;
  new$REMOTEFLAG INNERFINSOURCE.REMOTEFLAG%TYPE := :NEW.REMOTEFLAG;
  new$BUDGETREF INNERFINSOURCE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DELETEDATE INNERFINSOURCE.DELETEDATE%TYPE := :NEW.DELETEDATE;
  new$NAME INNERFINSOURCE.NAME%TYPE := :NEW.NAME;
  new$STARTDATE INNERFINSOURCE.STARTDATE%TYPE := :NEW.STARTDATE;
  new$SHORTNAME INNERFINSOURCE.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$CLSASPECT INNERFINSOURCE.CLSASPECT%TYPE := :NEW.CLSASPECT;
  new$CREATERUSER INNERFINSOURCE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER INNERFINSOURCE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$IFS_LEVEL INNERFINSOURCE.IFS_LEVEL%TYPE := :NEW.IFS_LEVEL;
--
  CNT$ NUMBER(10);
  tmp$ NUMBER(15,0);
  DescrCode1 NUMBER(10);
  DescrCode2 NUMBER(10);
  KVSRCode$ NUMBER(10);
  sKVSR VARCHAR2(3);
  sDescrCode1 VARCHAR2(7);
  sDescrCode2 VARCHAR2(7);
  sKESR VARCHAR2(3);
  sIFSLevel$ NUMBER(10);
  sDirection$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_INNERFINSOURCE_BI_0)
-- Last update 27.10.2009
-- - - - - - - - - - - - -

  -- Генерация Id, установка значений по умолчанию
  IF (new$ID IS NULL) THEN SELECT g_Shared.NEXTVAL INTO new$ID FROM DUAL; END IF;
  IF (new$KVSR IS NULL) THEN new$KVSR := 0; END IF;
  IF (new$KESR IS NULL) THEN new$KESR := 0; END IF;
  IF (new$ClsAspect IS NULL) THEN new$ClsAspect := 0; END IF;
  if (new$UnionFlag is null) then new$UnionFlag := 0; END IF;
  if (new$RemoteFlag is null) then new$RemoteFlag := 0; END IF;
  if (new$BudgetRef is null) then new$BudgetRef := 0; end if;

  /* Для подведомственных берем уровень базового*/
  if (new$KVSR <> 0) then
    BEGIN
      select IFS_Level, Direction into sIFSLevel$, sDirection$ from innerfinsource where ((KESR = new$KESR) and (BudgetRef=new$BudgetRef)
      and (DESCRIPTIONCODE = new$DESCRIPTIONCODE) and (KVSR = 0))  ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (sIFSLevel$ is not null) then
    new$IFS_Level := sIFSLevel$;
  END IF;
  if (sDirection$ is not null) then
    new$Direction := sDirection$;
  END IF;

  -- Для внутренних источников направление определяется по коду операции ГС
  --   6xx, 8xx - погашение
  IF (new$Direction IS NULL) THEN
    if ((new$KESR between 300 and 399) or (new$KESR between 500 and 599)or (new$KESR between 800 and 899))
    THEN
      new$Direction := -1;
    ELSE
      new$Direction := 1;
    END IF;
  END IF;

  /*  Выбираем код КВСР по ключу */ 
  BEGIN
    select Code into KVSRCode$ from KVSR where (ID = new$KVSR);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      KVSRCode$ := NULL;
  END;    

  -- Вычисление 20-разрядного строкового кода источника
  -- Вычисление КВСР с лидирующими нулями
  if (KVSRCode$ = 0) then
      sKVSR := '000';
  elsif (KVSRCode$ < 10) then
      sKVSR := '00' || KVSRCode$;
  elsif (KVSRCode$ < 100) then
      sKVSR := '0' || KVSRCode$;
  else
      sKVSR := KVSRCode$;
  END IF;

  -- Заполнение Значимого вида источника, элемента, программы
  tmp$ := new$DescriptionCode;
  DescrCode1 := TRUNC (tmp$ / 1000000);

  IF (DescrCode1 * 1000000 > tmp$) THEN
    DescrCode1 := DescrCode1 - 1;
  END IF;

  new$MainDescriptionCode := DescrCode1;          -- Значимый вид источников
  DescrCode2 := tmp$ - DescrCode1 * 1000000;
  DescrCode1 := TRUNC (DescrCode2 / 10000);

  IF (DescrCode1 * 10000 > DescrCode2) THEN
    DescrCode1 := DescrCode1 - 1;
  END IF;

  new$ItemCode := DescrCode1;                                     --Элемент
  new$ProgramCode := DescrCode2 - DescrCode1 * 10000;             --Программа
  -- Вычисление Вида источника с лидирующими нулями
  DescrCode1 := TRUNC (tmp$ / 10000000);

  IF (DescrCode1 * 10000000 > tmp$) THEN
    DescrCode1 := DescrCode1 - 1;
  END IF;

  DescrCode2 := tmp$ - DescrCode1 * 10000000;

  IF (DescrCode1 = 0) THEN
    sDescrCode1 := '0000000';
  ELSIF (DescrCode1 < 10) THEN
    sDescrCode1 := '000000' || DescrCode1;
  ELSIF (DescrCode1 < 100) THEN
    sDescrCode1 := '00000' || DescrCode1;
  ELSIF (DescrCode1 < 1000) THEN
    sDescrCode1 := '0000' || DescrCode1;
  ELSIF (DescrCode1 < 10000) THEN
    sDescrCode1 := '000' || DescrCode1;
  ELSIF (DescrCode1 < 100000) THEN
    sDescrCode1 := '00' || DescrCode1;
  ELSIF (DescrCode1 < 1000000) THEN
    sDescrCode1 := '0' || DescrCode1;
  ELSE
    sDescrCode1 := DescrCode1;
  END IF;

  IF (DescrCode2 = 0) THEN
    sDescrCode2 := '0000000';
  ELSIF (DescrCode2 < 10) THEN
    sDescrCode2 := '000000' || DescrCode2;
  ELSIF (DescrCode2 < 100) THEN
    sDescrCode2 := '00000' || DescrCode2;
  ELSIF (DescrCode2 < 1000) THEN
    sDescrCode2 := '0000' || DescrCode2;
  ELSIF (DescrCode2 < 10000) THEN
    sDescrCode2 := '000' || DescrCode2;
  ELSIF (DescrCode2 < 100000) THEN
    sDescrCode2 := '00' || DescrCode2;
  ELSIF (DescrCode2 < 1000000) THEN
    sDescrCode2 := '0' || DescrCode2;
  ELSE
    sDescrCode2 := DescrCode2;
  END IF;

  -- Вычисление КЭСР с лидирующими нулями
  IF (new$kesr = 0) THEN
    sKESR := '000';
  ELSIF (new$kesr < 10) THEN
    sKESR := '00' || new$kesr;
  ELSIF (new$kesr < 100) THEN
    sKESR := '0' || new$kesr;
  ELSE
    sKESR := new$kesr;
  END IF;

  -- Объединение всех строк в одну
  new$FinSourceValue := sKVSR || sDescrCode1 || sDescrCode2 || sKESR;

  if ((new$ID = 0) and (new$FinSourceValue <> '00000000000000000000')) then
    RaiseException('ex_CantModify_ZeroIFS');
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_INNERFINSOURCE_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_INNERFINSOURCE (
    ID,
    CREATEDATE,
    UPDATEDATE,
    DIRECTION,
    KVSR,
    DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE,
    ITEMCODE,
    PROGRAMCODE,
    KESR,
    FINSOURCEVALUE,
    UNIONFLAG,
    REMOTEFLAG,
    BUDGETREF,
    DELETEDATE,
    NAME,
    STARTDATE,
    SHORTNAME,
    CLSASPECT,
    CREATERUSER,
    UPDATERUSER,
    IFS_LEVEL
  ) VALUES (
    new$ID,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$DIRECTION,
    new$KVSR,
    new$DESCRIPTIONCODE,
    new$MAINDESCRIPTIONCODE,
    new$ITEMCODE,
    new$PROGRAMCODE,
    new$KESR,
    new$FINSOURCEVALUE,
    new$UNIONFLAG,
    new$REMOTEFLAG,
    new$BUDGETREF,
    new$DELETEDATE,
    new$NAME,
    new$STARTDATE,
    new$SHORTNAME,
    new$CLSASPECT,
    new$CREATERUSER,
    new$UPDATERUSER,
    new$IFS_LEVEL);

-- - - - - - - - - - - - -
-- AI_100 (TR_INNERFINSOURCE_AI_100)
-- Last update 02.04.2010
-- - - - - - - - - - - - -

  if (new$kvsr <> 0) then
    select count(*) into CNT$
                     from InnerFinSource ifs1
                     where ((ifs1.kvsr = 0) and
                           ((ifs1.descriptioncode-new$descriptioncode>-1) and (ifs1.descriptioncode-new$descriptioncode<1)) and
                           (ifs1.kesr = new$kesr)) AND (ROWNUM = 1);
    if (CNT$ = 0) then
        insert into InnerFinSource (KVSR, DescriptionCode, KESR, Name, ShortName, CLSAspect, RemoteFlag, Direction, IFS_Level)
        values (0, new$DescriptionCode, new$KESR, new$Name, new$ShortName, new$CLSAspect, new$RemoteFlag, new$direction, new$IFS_Level);
    end if; 
  end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_INNERFINSOURCE_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 145) and (RecordId = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_INNERFINSOURCE_IU
  INSTEAD OF UPDATE
  ON INNERFINSOURCE
  FOR EACH ROW
DECLARE
  new$ID INNERFINSOURCE.ID%TYPE := :NEW.ID;
  new$CREATEDATE INNERFINSOURCE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INNERFINSOURCE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$DIRECTION INNERFINSOURCE.DIRECTION%TYPE := :NEW.DIRECTION;
  new$KVSR INNERFINSOURCE.KVSR%TYPE := :NEW.KVSR;
  new$DESCRIPTIONCODE INNERFINSOURCE.DESCRIPTIONCODE%TYPE := :NEW.DESCRIPTIONCODE;
  new$MAINDESCRIPTIONCODE INNERFINSOURCE.MAINDESCRIPTIONCODE%TYPE := :NEW.MAINDESCRIPTIONCODE;
  new$ITEMCODE INNERFINSOURCE.ITEMCODE%TYPE := :NEW.ITEMCODE;
  new$PROGRAMCODE INNERFINSOURCE.PROGRAMCODE%TYPE := :NEW.PROGRAMCODE;
  new$KESR INNERFINSOURCE.KESR%TYPE := :NEW.KESR;
  new$FINSOURCEVALUE INNERFINSOURCE.FINSOURCEVALUE%TYPE := :NEW.FINSOURCEVALUE;
  new$UNIONFLAG INNERFINSOURCE.UNIONFLAG%TYPE := :NEW.UNIONFLAG;
  new$REMOTEFLAG INNERFINSOURCE.REMOTEFLAG%TYPE := :NEW.REMOTEFLAG;
  new$BUDGETREF INNERFINSOURCE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DELETEDATE INNERFINSOURCE.DELETEDATE%TYPE := :NEW.DELETEDATE;
  new$NAME INNERFINSOURCE.NAME%TYPE := :NEW.NAME;
  new$STARTDATE INNERFINSOURCE.STARTDATE%TYPE := :NEW.STARTDATE;
  new$SHORTNAME INNERFINSOURCE.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$CLSASPECT INNERFINSOURCE.CLSASPECT%TYPE := :NEW.CLSASPECT;
  new$CREATERUSER INNERFINSOURCE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER INNERFINSOURCE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$IFS_LEVEL INNERFINSOURCE.IFS_LEVEL%TYPE := :NEW.IFS_LEVEL;
--
  tmp$ NUMBER(15,0);
  tmp_Double$ NUMBER;
  DescrCode1$ NUMBER(10);
  DescrCode2$ NUMBER(10);
  KVSRCode1$ NUMBER(10);
  sKVSR$ VARCHAR2(3);
  sDescrCode1$ VARCHAR2(7);
  sDescrCode2$ VARCHAR2(7);
  sKESR$ VARCHAR2(3);
  CNT$1 NUMBER(10);
  sIFSLevel$ NUMBER(10);
  sDirection$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INNERFINSOURCE_BU_0)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Установка значений по умолчанию */
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$ClsAspect is null) then 
    new$ClsAspect := 0;
  END IF;
  if (new$RemoteFlag is null) then 
    new$RemoteFlag := 0;
  END IF;
  if (new$UnionFlag is null) then 
    new$UnionFlag := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  
  /* Для подведомственных берем уровень базового*/
  if (new$KVSR <> 0) then
    BEGIN
      select IFS_Level, Direction into sIFSLevel$, sDirection$ from innerfinsource where ((KESR = new$KESR) and (BudgetRef=new$BudgetRef)
      and (DESCRIPTIONCODE = new$DESCRIPTIONCODE) and (KVSR = 0))  ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (sIFSLevel$ is not null) then
    new$IFS_Level := sIFSLevel$;
  END IF;
  if (sDirection$ is not null) then
    new$Direction := sDirection$;
  END IF;  
  
  /* Для внутренних источников направление определяется по коду операции ГС
       Погашение – это кода с косгу=3хх,5хх,8хх */
  if ((new$Direction is null)or(new$kesr <> :old.kesr)) then
    if ((new$KESR between 300 and 399) or (new$KESR between 500 and 599)or (new$KESR between 800 and 899))
    then
      new$Direction := -1;
          
    else
      new$Direction := 1;
      
    END IF;
  END IF;
  BEGIN

    /* Выбираем код КВСР по ключу */ 
    select Code into KVSRCode1$ from KVSR where (ID = new$KVSR) ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
    
  /* Вычисление 20-разрядного строкового кода источника */
  /* Вычисление КВСР с лидирующими нулями */
  if (KVSRCode1$ = 0) then
    sKVSR$ := '000';
        
  else
    if (KVSRCode1$ < 10) then
      sKVSR$ := '00' || KVSRCode1$;
          
    else
      if (KVSRCode1$ < 100) then
        sKVSR$ := '0' || KVSRCode1$;
            
      else
        sKVSR$ := KVSRCode1$;
      END IF;
    END IF;
  END IF;
  /* Заполнение Значимого вида источника, элемента, программы */
      
  tmp$ := new$DescriptionCode;
  tmp_Double$ := tmp$ / 1000000;
  DescrCode1$ := tmp_Double$;
  /* надо чтобы округлилось отбрасыванием дробной части,
      если после округления число увеличилось, то надо вычесть 1 */
  if (DescrCode1$  > tmp_Double$) then 
    DescrCode1$ := DescrCode1$ - 1;
  END IF;
  new$MainDescriptionCode := DescrCode1$; /* Значимый вид источников */
  /* сначала присваиваем дробному для совместимости типов */    
  tmp_Double$ := DescrCode1$;
  tmp_Double$ := tmp$ - tmp_Double$ * 1000000;
  DescrCode2$ := tmp_Double$;
  tmp_Double$ := DescrCode2$ / 10000;
  DescrCode1$ := tmp_Double$;
  /* такой же приём с округлением */
  if (DescrCode1$ > tmp_Double$) then 
    DescrCode1$ := DescrCode1$ - 1;
  END IF;
  new$ItemCode := DescrCode1$; /* Элемент*/
  tmp_Double$ := DescrCode2$ - DescrCode1$ * 10000;
  new$ProgramCode := tmp_Double$; /* Программа*/
  /* Вычисление Вида источника с лидирующими нулями */
      
  tmp_Double$ := tmp$ / 10000000;
  DescrCode1$ := tmp_Double$;
  if (DescrCode1$ > tmp_Double$) then 
    DescrCode1$ := DescrCode1$ - 1;
  END IF;
  tmp_Double$ := DescrCode1$;
  tmp_Double$ := tmp$ - tmp_Double$ * 10000000;
  DescrCode2$ := tmp_Double$;
  if (DescrCode1$ = 0) then
    sDescrCode1$ := '0000000';
        
  else
    if (DescrCode1$ < 10) then
      sDescrCode1$ := '000000' || DescrCode1$;
          
    else
      if (DescrCode1$ < 100) then
        sDescrCode1$ := '00000' || DescrCode1$;
            
      else
        if (DescrCode1$ < 1000) then
          sDescrCode1$ := '0000' || DescrCode1$;
              
        else
          if (DescrCode1$ < 10000) then
            sDescrCode1$ := '000' || DescrCode1$;
                
          else
            if (DescrCode1$ < 100000) then
              sDescrCode1$ := '00' || DescrCode1$;
                  
            else
              if (DescrCode1$ < 1000000) then
                sDescrCode1$ := '0' || DescrCode1$;
                    
              else
                sDescrCode1$ := DescrCode1$;
              END IF;
            END IF;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
  if (DescrCode2$ = 0) then
    sDescrCode2$ := '0000000';
        
  else
    if (DescrCode2$ < 10) then
      sDescrCode2$ := '000000' || DescrCode2$;
          
    else
      if (DescrCode2$ < 100) then
        sDescrCode2$ := '00000' || DescrCode2$;
            
      else
        if (DescrCode2$ < 1000) then
          sDescrCode2$ := '0000' || DescrCode2$;
              
        else
          if (DescrCode2$ < 10000) then
            sDescrCode2$ := '000' || DescrCode2$;
                
          else
            if (DescrCode2$ < 100000) then
              sDescrCode2$ := '00' || DescrCode2$;
                  
            else
              if (DescrCode2$ < 1000000) then
                sDescrCode2$ := '0' || DescrCode2$;
                    
              else
                sDescrCode2$ := DescrCode2$;
              END IF;
            END IF;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
  /* Вычисление КЭСР с лидирующими нулями */
  if (new$kesr = 0) then
    sKESR$ := '000';
        
  else
    if (new$kesr < 10) then
      sKESR$ := '00' || new$kesr;
          
    else
      if (new$kesr < 100) then
        sKESR$ := '0' || new$kesr;
            
      else
        sKESR$ := new$kesr;
      END IF;
    END IF;
  END IF;
  /* Объединение всех строк в одну */
      
  new$FinSourceValue := sKVSR$ || sDescrCode1$ || sDescrCode2$ || sKESR$;
      
  if ((new$ID = 0) and (new$FinSourceValue <> '00000000000000000000') and (new$BudgetRef <> 0)) then
    RaiseException('ex_CantModify_ZeroIFS');
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INNERFINSOURCE SET
    ID = new$ID,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    DIRECTION = new$DIRECTION,
    KVSR = new$KVSR,
    DESCRIPTIONCODE = new$DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE = new$MAINDESCRIPTIONCODE,
    ITEMCODE = new$ITEMCODE,
    PROGRAMCODE = new$PROGRAMCODE,
    KESR = new$KESR,
    FINSOURCEVALUE = new$FINSOURCEVALUE,
    UNIONFLAG = new$UNIONFLAG,
    REMOTEFLAG = new$REMOTEFLAG,
    BUDGETREF = new$BUDGETREF,
    DELETEDATE = new$DELETEDATE,
    NAME = new$NAME,
    STARTDATE = new$STARTDATE,
    SHORTNAME = new$SHORTNAME,
    CLSASPECT = new$CLSASPECT,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER,
    IFS_LEVEL = new$IFS_LEVEL
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_100 (TR_INNERFINSOURCE_AU_100)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (new$kvsr <> 0) then
    SELECT COUNT(*) INTO CNT$1
    from InnerFinSource ifs1
    where ((ifs1.kvsr = 0) and
    ((ifs1.descriptioncode-new$descriptioncode>-1) and (ifs1.descriptioncode-new$descriptioncode<1)) and
    (ifs1.kesr = new$kesr)
    ) AND (ROWNUM = 1)                   ;
    if (not (CNT$1<> 0))
    then  
      insert into InnerFinSource (KVSR, DescriptionCode, KESR, Name, ShortName, CLSAspect, RemoteFlag, IFS_Level)
      values (0, new$DescriptionCode, new$KESR, new$Name, new$ShortName, new$CLSAspect, new$RemoteFlag, new$IFS_Level);
      
    END IF;
  else
    /* Если КВСР = 0, то нужно обновить связанные записи с таким же кодом, но не нулевым КВСР */
    update InnerFinSource ifs1 set
    name = new$name,
    ShortName = new$ShortName,
    ifs_level = new$ifs_level,
    Direction = new$Direction
    where
    (ifs1.kvsr <> 0) and
    ((ifs1.descriptioncode-new$descriptioncode>-1) and (ifs1.descriptioncode-new$descriptioncode<1)) and
    (ifs1.kesr = new$kesr);
    /* При закрытии базового кода закрываются все связанные */
    if (new$deletedate is not null) then
      update InnerFinSource ifs1 set
      deletedate = new$deletedate
      where
      (ifs1.kvsr <> 0) and
      ((ifs1.descriptioncode-new$descriptioncode>-1) and (ifs1.descriptioncode-new$descriptioncode<1)) and
      (ifs1.kesr = new$kesr) and
      (ifs1.DeleteDate is null);
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INNERFINSOURCE_AU_500)
-- Create 28.04.2005
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (145, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=145) and (RecordId=new$ID);
  end if;

END;
/

-- ALTER TRIGGER tr_kd_bi_0
CREATE OR REPLACE TRIGGER TR_KD_II
  INSTEAD OF INSERT
  ON KD
  FOR EACH ROW
DECLARE
  new$ID KD.ID%TYPE := :NEW.ID;
  new$REPCODE KD.REPCODE%TYPE := :NEW.REPCODE;
  new$CREATEDATE KD.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE KD.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$KVSR KD.KVSR%TYPE := :NEW.KVSR;
  new$DESCRIPTIONCODE KD.DESCRIPTIONCODE%TYPE := :NEW.DESCRIPTIONCODE;
  new$MAINDESCRIPTIONCODE KD.MAINDESCRIPTIONCODE%TYPE := :NEW.MAINDESCRIPTIONCODE;
  new$ITEMCODE KD.ITEMCODE%TYPE := :NEW.ITEMCODE;
  new$PROGRAMCODE KD.PROGRAMCODE%TYPE := :NEW.PROGRAMCODE;
  new$KESR KD.KESR%TYPE := :NEW.KESR;
  new$KDVALUE KD.KDVALUE%TYPE := :NEW.KDVALUE;
  new$REMOTEFLAG KD.REMOTEFLAG%TYPE := :NEW.REMOTEFLAG;
  new$UNIONFLAG KD.UNIONFLAG%TYPE := :NEW.UNIONFLAG;
  new$BUDGETREF KD.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DELETEDATE KD.DELETEDATE%TYPE := :NEW.DELETEDATE;
  new$NAME KD.NAME%TYPE := :NEW.NAME;
  new$KD_LEVEL KD.KD_LEVEL%TYPE := :NEW.KD_LEVEL;
  new$STARTDATE KD.STARTDATE%TYPE := :NEW.STARTDATE;
  new$SHORTNAME KD.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$CREATERUSER KD.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER KD.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
--
  CNT$ NUMBER(10);
  tmp$ NUMBER(15,0);
  tmp_Double$ NUMBER;
  DescrCode1$ NUMBER(10);
  DescrCode2$ NUMBER(10);
  KVSRCode1$ NUMBER(10);
  sKVSR$ VARCHAR2(3);
  sDescrCode1$ VARCHAR2(5);
  sDescrCode2$ VARCHAR2(5);
  sProgCode$ VARCHAR2(4);
  sKESR$ VARCHAR2(3);
  sKDLevel$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_KD_BI_0)
-- Version 7.00.00.1
-- - - - - - - - - - - - -

  /* Генерация Id, установка значений по умолчанию */
  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$ProgramCode is null) then 
    new$ProgramCode := 0;
  END IF;
  if (new$RemoteFlag is null) then 
    new$RemoteFlag := 0;
  END IF;
  if (new$UnionFlag is null) then 
    new$UnionFlag := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  if (new$KVSR <> 0) then
    BEGIN
      select kd_level into sKDLevel$ from KD where ((KESR = new$KESR) and (ProgramCode=new$ProgramCode)and (BudgetRef=new$BudgetRef)
      and (DESCRIPTIONCODE = new$DESCRIPTIONCODE) and (KVSR = 0))  ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (sKDLevel$ is not null) then
    new$kd_Level := sKDLevel$;
  END IF;
  /* Разделение вида дохода на значимый вид дохода и элемент */
    
  tmp$ := new$DescriptionCode;
  tmp_Double$ := tmp$ / 100;
  new$MainDescriptionCode := tmp_Double$;
  if (new$MainDescriptionCode > tmp_Double$) then 
    new$MainDescriptionCode := new$MainDescriptionCode - 1;
  END IF;
  tmp_Double$ := new$MainDescriptionCode;
  tmp_Double$ := tmp_Double$ * 100;
  new$ItemCode := tmp$ - tmp_Double$; 
  BEGIN

    /* Выбираем код КВСР по ключу */ 
    select Code into KVSRCode1$ from KVSR where (ID = new$KVSR) ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* Вычисление 20-разрядного строкового КД */
  /* Вычисление КВСР с лидирующими нулями */
  if (KVSRCode1$ = 0) then
    sKVSR$ := '000';
        
  else
    if (KVSRCode1$ < 10) then
      sKVSR$ := '00' || KVSRCode1$;
          
    else
      if (KVSRCode1$ < 100) then
        sKVSR$ := '0' || KVSRCode1$;
            
      else
        sKVSR$ := KVSRCode1$;
      END IF;
    END IF;
  END IF;
  /* Вычисление Вида дохода с лидирующими нулями */    
      
  tmp$ := new$DescriptionCode;
  tmp_Double$ := tmp$ / 100000;
  DescrCode1$ := tmp_Double$;
  if (DescrCode1$ > tmp_Double$) then 
    DescrCode1$ := DescrCode1$ - 1;
  END IF;
  tmp_Double$ := DescrCode1$;
  tmp_Double$ := tmp$ - tmp_Double$ * 100000;
  DescrCode2$ := tmp_Double$;
      
  if (DescrCode1$ = 0) then
    sDescrCode1$ := '00000';
        
  else
    if (DescrCode1$ < 10) then
      sDescrCode1$ := '0000' || DescrCode1$;
          
    else
      if (DescrCode1$ < 100) then
        sDescrCode1$ := '000' || DescrCode1$;
            
      else
        if (DescrCode1$ < 1000) then
          sDescrCode1$ := '00' || DescrCode1$;
              
        else
          if (DescrCode1$ < 10000) then
            sDescrCode1$ := '0' || DescrCode1$;
                
          else
            sDescrCode1$ := DescrCode1$;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
      
  if (DescrCode2$ = 0) then
    sDescrCode2$ := '00000';
        
  else
    if (DescrCode2$ < 10) then
      sDescrCode2$ := '0000' || DescrCode2$;
          
    else
      if (DescrCode2$ < 100) then
        sDescrCode2$ := '000' || DescrCode2$;
            
      else
        if (DescrCode2$ < 1000) then
          sDescrCode2$ := '00' || DescrCode2$;
              
        else
          if (DescrCode2$ < 10000) then
            sDescrCode2$ := '0' || DescrCode2$;
                
          else
            sDescrCode2$ := DescrCode2$;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
      
  /* Вычисление Программы с лидирующими нулями */
  if (new$programcode = 0) then
    sProgCode$ := '0000';
        
  else
    if (new$programcode < 10) then
      sProgCode$ := '000' || new$programcode;
          
    else
      if (new$programcode < 100) then
        sProgCode$ := '00' || new$programcode;
            
      else
        if (new$programcode < 1000) then
          sProgCode$ := '0' || new$programcode;
              
        else
          sProgCode$ := new$programcode;
        END IF;
      END IF;
    END IF;
  END IF;
      
  /* Вычисление КЭСР с лидирующими нулями */
  if (new$kesr = 0) then
    sKESR$ := '000';
        
  else
    if (new$kesr < 10) then
      sKESR$ := '00' || new$kesr;
          
    else
      if (new$kesr < 100) then
        sKESR$ := '0' || new$kesr;
            
      else
        sKESR$ := new$kesr;
      END IF;
    END IF;
  END IF;
  /* Объединение всех строк в одну */    
      
  new$kdvalue := sKVSR$ || sDescrCode1$ || sDescrCode2$ || sProgCode$ || sKESR$;
      
  if ((new$ID = 0) and (new$kdvalue <> '00000000000000000000') and (new$BudgetRef <> 0)) then
    RaiseException('ex_CantModify_ZeroKD');
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_KD_BI_500)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_KD (
    ID,
    REPCODE,
    CREATEDATE,
    UPDATEDATE,
    KVSR,
    DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE,
    ITEMCODE,
    PROGRAMCODE,
    KESR,
    KDVALUE,
    REMOTEFLAG,
    UNIONFLAG,
    BUDGETREF,
    DELETEDATE,
    NAME,
    KD_LEVEL,
    STARTDATE,
    SHORTNAME,
    CREATERUSER,
    UPDATERUSER
  ) VALUES (
    new$ID,
    new$REPCODE,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$KVSR,
    new$DESCRIPTIONCODE,
    new$MAINDESCRIPTIONCODE,
    new$ITEMCODE,
    new$PROGRAMCODE,
    new$KESR,
    new$KDVALUE,
    new$REMOTEFLAG,
    new$UNIONFLAG,
    new$BUDGETREF,
    new$DELETEDATE,
    new$NAME,
    new$KD_LEVEL,
    new$STARTDATE,
    new$SHORTNAME,
    new$CREATERUSER,
    new$UPDATERUSER);

-- - - - - - - - - - - - -
-- AI_100 (TR_KD_AI_100)
-- Create 03.05.2005
-- Last update 02.04.2010
-- - - - - - - - - - - - -

  if (new$kvsr <> 0) then
    select count(*) into CNT$
                     from kd kd1
                     where ((kd1.kvsr = 0) and
                           ((kd1.descriptioncode-new$descriptioncode>-1) and (kd1.descriptioncode-new$descriptioncode<1)) and
                           (kd1.programcode = new$programcode) and
                           (kd1.kesr = new$kesr)) and (ROWNUM = 1);
    if (CNT$ = 0) then  
        insert into KD (KVSR, DescriptionCode, ProgramCode, KESR, Name, ShortName, RemoteFlag, kd_level)
        values (0, new$DescriptionCode, new$ProgramCode, new$KESR, new$Name, new$ShortName, new$RemoteFlag, new$kd_level);
    end if;  
  end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_KD_AI_500)
-- Last update 14.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 80)  and (RecordID = new$ID);

END;
/

-- ALTER TRIGGER tr_kd_bu_0
CREATE OR REPLACE TRIGGER TR_KD_IU
  INSTEAD OF UPDATE
  ON KD
  FOR EACH ROW
DECLARE
  new$ID KD.ID%TYPE := :NEW.ID;
  new$REPCODE KD.REPCODE%TYPE := :NEW.REPCODE;
  new$CREATEDATE KD.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE KD.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$KVSR KD.KVSR%TYPE := :NEW.KVSR;
  new$DESCRIPTIONCODE KD.DESCRIPTIONCODE%TYPE := :NEW.DESCRIPTIONCODE;
  new$MAINDESCRIPTIONCODE KD.MAINDESCRIPTIONCODE%TYPE := :NEW.MAINDESCRIPTIONCODE;
  new$ITEMCODE KD.ITEMCODE%TYPE := :NEW.ITEMCODE;
  new$PROGRAMCODE KD.PROGRAMCODE%TYPE := :NEW.PROGRAMCODE;
  new$KESR KD.KESR%TYPE := :NEW.KESR;
  new$KDVALUE KD.KDVALUE%TYPE := :NEW.KDVALUE;
  new$REMOTEFLAG KD.REMOTEFLAG%TYPE := :NEW.REMOTEFLAG;
  new$UNIONFLAG KD.UNIONFLAG%TYPE := :NEW.UNIONFLAG;
  new$BUDGETREF KD.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DELETEDATE KD.DELETEDATE%TYPE := :NEW.DELETEDATE;
  new$NAME KD.NAME%TYPE := :NEW.NAME;
  new$KD_LEVEL KD.KD_LEVEL%TYPE := :NEW.KD_LEVEL;
  new$STARTDATE KD.STARTDATE%TYPE := :NEW.STARTDATE;
  new$SHORTNAME KD.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$CREATERUSER KD.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER KD.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
--
  tmp$ NUMBER(15,0);
  CNT$1 NUMBER(10);
  tmp_Double$ NUMBER;
  DescrCode1$ NUMBER(10);
  DescrCode2$ NUMBER(10);
  KVSRCode1$ NUMBER(10);
  sKVSR$ VARCHAR2(3);
  sDescrCode1$ VARCHAR2(5);
  sDescrCode2$ VARCHAR2(5);
  sProgCode$ VARCHAR2(4);
  sKESR$ VARCHAR2(3);
  sKDLevel$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_KD_BU_0)
-- Version 7.00.00.1
-- - - - - - - - - - - - -

  /* Установка значений по умолчанию */
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$ProgramCode is null) then 
    new$ProgramCode := 0;
  END IF;
  if (new$RemoteFlag is null) then 
    new$RemoteFlag := 0;
  END IF;
  if (new$UnionFlag is null) then 
    new$UnionFlag := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  /* Разделение вида дохода на значимый вид дохода и элемент */
    
  tmp$ := new$DescriptionCode;
  tmp_Double$ := tmp$ / 100;
  new$MainDescriptionCode := tmp_Double$;
  if (new$MainDescriptionCode > tmp_Double$) then 
    new$MainDescriptionCode := new$MainDescriptionCode - 1;
  END IF;
  tmp_Double$ := new$MainDescriptionCode;
  tmp_Double$ := tmp_Double$ * 100;
  new$ItemCode := tmp$ - tmp_Double$; 
  if (new$KVSR <> 0) then
    BEGIN
      select kd_level into sKDLevel$ from KD where ((KESR = new$KESR) and (ProgramCode=new$ProgramCode)and (BudgetRef=new$BudgetRef)
      and (DESCRIPTIONCODE = new$DESCRIPTIONCODE) and (KVSR = 0)) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (sKDLevel$ is not null) then
    new$kd_Level := sKDLevel$;
  END IF;
  BEGIN

    /* Выбираем код КВСР по ключу */ 
    select Code into KVSRCode1$ from KVSR where (ID = new$KVSR) ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* Вычисление 20-разрядного строкового КД */
  /* Вычисление КВСР с лидирующими нулями */
  if (KVSRCode1$ = 0) then
    sKVSR$ := '000';
        
  else
    if (KVSRCode1$ < 10) then
      sKVSR$ := '00' || KVSRCode1$;
          
    else
      if (KVSRCode1$ < 100) then
        sKVSR$ := '0' || KVSRCode1$;
            
      else
        sKVSR$ := KVSRCode1$;
      END IF;
    END IF;
  END IF;
  /* Вычисление Вида дохода с лидирующими нулями */
      
  tmp$ := new$DescriptionCode;
  tmp_Double$ := tmp$ / 100000;
  DescrCode1$ := tmp_Double$;
  if (DescrCode1$ > tmp_Double$) then 
    DescrCode1$ := DescrCode1$ - 1;
  END IF;
  tmp_Double$ := DescrCode1$;
  tmp_Double$ := tmp$ - tmp_Double$ * 100000;
  DescrCode2$ := tmp_Double$;

  if (DescrCode1$ = 0) then
    sDescrCode1$ := '00000';
        
  else
    if (DescrCode1$ < 10) then
      sDescrCode1$ := '0000' || DescrCode1$;
          
    else
      if (DescrCode1$ < 100) then
        sDescrCode1$ := '000' || DescrCode1$;
            
      else
        if (DescrCode1$ < 1000) then
          sDescrCode1$ := '00' || DescrCode1$;
              
        else
          if (DescrCode1$ < 10000) then
            sDescrCode1$ := '0' || DescrCode1$;
                
          else
            sDescrCode1$ := DescrCode1$;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
  if (DescrCode2$ = 0) then
    sDescrCode2$ := '00000';
        
  else
    if (DescrCode2$ < 10) then
      sDescrCode2$ := '0000' || DescrCode2$;
          
    else
      if (DescrCode2$ < 100) then
        sDescrCode2$ := '000' || DescrCode2$;
            
      else
        if (DescrCode2$ < 1000) then
          sDescrCode2$ := '00' || DescrCode2$;
              
        else
          if (DescrCode2$ < 10000) then
            sDescrCode2$ := '0' || DescrCode2$;
                
          else
            sDescrCode2$ := DescrCode2$;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
  /* Вычисление Программы с лидирующими нулями */
  if (new$programcode = 0) then
    sProgCode$ := '0000';
        
  else
    if (new$programcode < 10) then
      sProgCode$ := '000' || new$programcode;
          
    else
      if (new$programcode < 100) then
        sProgCode$ := '00' || new$programcode;
            
      else
        if (new$programcode < 1000) then
          sProgCode$ := '0' || new$programcode;
              
        else
          sProgCode$ := new$programcode;
        END IF;
      END IF;
    END IF;
  END IF;
  /* Вычисление КЭСР с лидирующими нулями */
  if (new$kesr = 0) then
    sKESR$ := '000';
        
  else
    if (new$kesr < 10) then
      sKESR$ := '00' || new$kesr;
          
    else
      if (new$kesr < 100) then
        sKESR$ := '0' || new$kesr;
            
      else
        sKESR$ := new$kesr;
      END IF;
    END IF;
  END IF;
  /* Объединение всех строк в одну */    
      
  new$kdvalue := sKVSR$ || sDescrCode1$ || sDescrCode2$ || sProgCode$ || sKESR$;
      
  if ((new$ID = 0) and (new$kdvalue <> '00000000000000000000') and (new$BudgetRef <> 0)) then
    RaiseException('ex_CantModify_ZeroKD');
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_KD SET
    ID = new$ID,
    REPCODE = new$REPCODE,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    KVSR = new$KVSR,
    DESCRIPTIONCODE = new$DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE = new$MAINDESCRIPTIONCODE,
    ITEMCODE = new$ITEMCODE,
    PROGRAMCODE = new$PROGRAMCODE,
    KESR = new$KESR,
    KDVALUE = new$KDVALUE,
    REMOTEFLAG = new$REMOTEFLAG,
    UNIONFLAG = new$UNIONFLAG,
    BUDGETREF = new$BUDGETREF,
    DELETEDATE = new$DELETEDATE,
    NAME = new$NAME,
    KD_LEVEL = new$KD_LEVEL,
    STARTDATE = new$STARTDATE,
    SHORTNAME = new$SHORTNAME,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER
  WHERE id = :old.id;

-- - - - - - - - - - - - -
-- AU_100 (TR_KD_AU_100)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (new$kvsr <> 0) then
    SELECT COUNT(*) INTO CNT$1
    from kd kd1
    where ((kd1.kvsr = 0) and
    ((kd1.descriptioncode-new$descriptioncode>-1) and (kd1.descriptioncode-new$descriptioncode<1)) and
    (kd1.programcode = new$programcode) and
    (kd1.kesr = new$kesr)
    ) AND (ROWNUM = 1)                     ;
    /* Если КВСР не 0, то нужно такую же вставить запись с КВСР=0 */
    if (not (CNT$1<> 0))
    then
      insert into KD (KVSR, DescriptionCode, ProgramCode, KESR, Name, ShortName, RemoteFlag, kd_level)
      values (0, new$DescriptionCode, new$ProgramCode, new$KESR, new$Name, new$ShortName, new$RemoteFlag, new$kd_level);
        
    END IF;
  else
    /* Если КВСР = 0, то нужно обновить связанные записи с таким же кодом, но не нулевым КВСР */
    update kd kd1 set
    name = new$name,
    ShortName = new$ShortName, 
    kd_level = new$kd_level
    where
    (kd1.kvsr <> 0) and
    ((kd1.descriptioncode-new$descriptioncode>-1) and (kd1.descriptioncode-new$descriptioncode<1)) and
    (kd1.programcode = new$programcode) and
    (kd1.kesr = new$kesr);
    /* При закрытии базового кода закрываются все связанные */
    if (new$deletedate is not null) then
      update kd kd1 set
      deletedate = new$deletedate
      where
      (kd1.kvsr <> 0) and
      ((kd1.descriptioncode-new$descriptioncode>-1) and (kd1.descriptioncode-new$descriptioncode<1)) and
      (kd1.programcode = new$programcode) and
      (kd1.kesr = new$kesr) and
      (kd1.DeleteDate is null);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_KD_AU_500)
-- Create 28.04.2005
-- Last update 14.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (80, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=80) and (RecordId=new$ID);
  end if;

END;
/

COMMIT WORK
/



-- #########################################################
-- #########################################################
-- AddConstPOF.sql
-- #########################################################
-- #########################################################

CALL addvarcharconst(1001, 274, 0, 'Шаблоны логического контроля для кассовых планов ПБС подневно')
/
CALL addvarcharconst(1002, 274, 0, 'Шаблоны контроля по остаткам для кассовых планов ПБС подневно')
/
CALL addintconst(1005, 274, 0, 'Определение даты контроля для принятых кассовых планов ПБС подневно')
/
CALL addintconst(1006, 274, 0, 'Определение даты контроля для непринятых кассовых планов ПБС подневно')
/
commit work
/

-- #########################################################
-- #########################################################
-- add_DepartmentCls_toDataPacket.sql
-- #########################################################
-- #########################################################

/* добавляет код отдела для пакетов УРМ*/
ALTER TABLE DataPacket ADD (
  DEPARTMENTCLS NUMBER(10),
    CHECK((DEPARTMENTCLS<=2147483647)AND(DEPARTMENTCLS>-2147483648))
)
/
commit work
/
ALTER TABLE DataPacket ADD (
  CONSTRAINT FK_DATAPACKET_TRDEPART FOREIGN KEY (DEPARTMENTCLS) REFERENCES DEPARTMENTCLS (ID)
)
/
CREATE INDEX FK_DATAPACKET_TRDEPART ON DataPacket(DEPARTMENTCLS)
/
commit work
/
-- CREATE TRIGGER TR_DATAPACKET_BI
CREATE OR REPLACE TRIGGER TR_DATAPACKET_BI
  BEFORE INSERT
  ON DATAPACKET
  FOR EACH ROW
DECLARE
  DocNumber$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_DataPacket_bi)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then 
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.PacketID is null) then 
    :new.PacketID := :new.ID;
  END IF;
  if (:new.PacketState is null) then 
    :new.PacketState := 0;
  END IF;
  if (:new.Format is null) then
    if (:new.ProgIndex = 527) then
      :new.Format := 1;
          
    else
      :new.Format := 0;
    END IF;
  END IF;
  if ((:new.ArchiveDocType is null) and (:new.PacketTypeCls is not null)) then
    BEGIN
      select
      dpt.ArchiveDocType
      into
      :new.ArchiveDocType     from
      DataPacketTypes dpt
      where
      dpt.id = :new.PacketTypeCls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((:new.Name is null)and(:new.ArchiveDocType is not null)) then
    BEGIN
      select
      adt.Name
      into
      :new.Name     from
      ArchiveDocType adt
      where
      adt.id = :new.ArchiveDocType
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (((:new.ProgIndex = 525) or (:new.ProgIndex = 526)) and
  ((:new.PacketTypeCls is null) or (:new.FacialAcc_Cls is null) or (:new.ReportDate is null)))
  then 
    RaiseException('ex_NotFilledRequired');
  END IF;
  if (:new.DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber$); 
    if (DocNumber$ is null) then 
      :new.DepartmentCls:= 0;
          
    else 
      :new.DepartmentCls:= DocNumber$;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DATAPACKET_BI_500)
-- Create 11.10.2006
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;
  :NEW.CreaterUser := USER;
  :NEW.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_DATAPACKET_BU
CREATE OR REPLACE TRIGGER TR_DATAPACKET_BU
  BEFORE UPDATE
  ON DATAPACKET
  FOR EACH ROW
DECLARE
  IsReject$ NUMBER(10);
  DocNumber$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_DataPacket_bu)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.PacketID is null) then 
    :new.PacketID := :new.ID;
  END IF;
  if (:new.PacketState is null) then 
    :new.PacketState := 0;
  END IF;
  if (:new.Format is null) then
    if (:new.ProgIndex = 527) then
      :new.Format := 1;
          
    else
      :new.Format := 0; 
    END IF;
  END IF;
  if ((:new.Name is null)and(:new.ArchiveDocType is not null)) then
    BEGIN
      select
      adt.Name
      into
      :new.Name     from
      ArchiveDocType adt
      where
      adt.id = :new.ArchiveDocType
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (((:new.ProgIndex = 525) or (:new.ProgIndex = 526)) and
  ((:new.PacketTypeCls is null) or (:new.FacialAcc_Cls is null) or (:new.ReportDate is null)))
  then 
    RaiseException('ex_NotFilledRequired');
  END IF;
  if (:new.DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber$); 
    if (DocNumber$ is null) then 
      :new.DepartmentCls:= 0;
          
    else 
      :new.DepartmentCls:= DocNumber$;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (tr_DataPacket_bu_200)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* Сохранение в базу истории изменений состояний*/
  if (:new.DocStateRef <> :old.DocStateRef) then
    insert into StateJumpHistory
    (DocID, BeginStateRef, EndStateRef)
    values
    (:new.ID, :old.DocStateRef, :new.DocStateRef);
  END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_DATAPACKET_BU_300)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.REJECTDATE is null)and(:new.REJECTDATE is not null)) then
    IsReject$ := 1;
      
  else
    if ((:old.REJECTDATE is not null)and(:new.REJECTDATE is null)) then
      IsReject$ := 0;
    END IF;
  END IF;
  if (IsReject$  <> -1) then
    update LinkRecords set
    IsRejected = IsReject$

    where
    (ChildID = :new.ID);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_DATAPACKET_BU_700)
-- Create 11.10.2006
-- - - - - - - - - - - - -

  if (:new.RVersion is null) then
    :new.RVersion := 1;
  elsif ((:new.RVersion = -1) and (:old.RVersion <> -1)) then
    :new.RVersion := :old.RVersion;
  else
    :new.RVersion := :old.RVersion + 1; 
  end if;  

END;
/
commit work 
/
ALTER TRIGGER TR_DATAPACKET_BU_500 DISABLE
/
update datapacket
  set DepartmentCls = 0
  where departmentcls is null
/
ALTER TRIGGER TR_DATAPACKET_BU_500 ENABLE
/
commit work 
/





ALTER TABLE DataPacket MODIFY(DEPARTMENTCLS NOT NULL)
/

-- #########################################################
-- #########################################################
-- Alter_TR_PAYMENTSCHEDULE_BD.sql
-- #########################################################
-- #########################################################

/* Доработка условия вызова исключения
  "Невозможно удалить бюджетные обязательства, по которым есть оплата."
  Раньше только первую версию цепочки, по которой оплата есть, нельзя было удалить.
  Теперь любое БО, по которому оплата есть */
-- ALTER TRIGGER TR_PaymentSchedule_BD
CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_ID
  INSTEAD OF DELETE
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  SummInMonths$ NUMBER(15,2);
  cnt1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_PAYMENTSCHEDULE_BD)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 6.0*/
  select count(ID) into cnt1$ from PaymentSchedule where (AdjustmentRef = :old.ID) ;
  if (cnt1$ > 0) then
    RaiseException('EX_Agr_CantDelAdjustmented');
  END IF;

  select count(ID)
  into cnt1$   from FacialFinDetail
  where (SourceBudgetPromise = :old.InnerPromiseNum and SourcePromise=:old.ANumber)
  or (DestBudgetPromise = :old.InnerPromiseNum and DestPromise=:old.ANumber)
  ;
  if (cnt1$ > 0) then
    RaiseException('ex_CantDeleteAgreement');
  END IF;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_PAYMENTSCHEDULE
  WHERE Id = :old.id;

-- - - - - - - - - - - - -
-- AD_10 (TR_PAYMENTSCHEDULE_AD_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Восстановление флага LastAdjustment у предыдущей записи в цепочке*/
  if ((:old.AdjustmentNumber > 0) and (:old.LastAdjustment = 1)) then
    update PaymentSchedule set
    LastAdjustment = 1,
    RVersion = -1
    where (ID = :old.AdjustmentRef);
  END IF;
  /* Восстановление флага LastAccepted у предыдущей записи в цепочке*/    
  if ((:old.AdjustmentNumber > 0) and (:old.LastAccepted = 1)) then
    update PaymentSchedule set
    LastAccepted = 1,
    RVersion = -1
    where (ID = :old.AdjustmentRef);        
  END IF;

-- - - - - - - - - - - - -
-- AD_500 (TR_PAYMENTSCHEDULE_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  SummInMonths$ := :old.Month01+:old.Month02+:old.Month03+:old.Month04+:old.Month05+
  :old.Month06+:old.Month07+:old.Month08+:old.Month09+:old.Month10+:old.Month11+:old.Month12;
  if ((SummInMonths$  < 0.005) and (SummInMonths$  > -0.005)) then
    SummInMonths$ := :old.SummaYear1;
  END IF;
  insert into DelRecIndexes(TableID, RecordID, DeleteDate, ProgIndex, SUMMA) values (113, :old.ID, SYSDATE, :old.ProgIndex, SummInMonths$);

END;
/
commit work
/

-- #########################################################
-- #########################################################
-- add_Agreement_ReestrRecordNumber.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет поле ReestrRecordNumber в таблицу договоров и контрактов */
/* Уникальный номер реестровой записи в реестре контрактов */
ALTER TABLE TB_agreements ADD (
  ReestrRecordNumber VARCHAR2(50)
)
/

CREATE OR REPLACE VIEW agreements (
  ID,
  SUMMA,
  AGREEMENTDATE,
  AGREEMENTENDDATE,
  EXECUTER_REF,
  CLIENT_REF,
  FACIALACC_CLS,
  AGREEMENTTYPE,
  ACCEPTED,
  ACCEPTDATE,
  CARDADVANCEPERCENT,
  CARDADVANCE,
  CLOSEDOC,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  BUDGETREF,
  LASTADJUSTMENT,
  LASTACCEPTED,
  FACT,
  REGION,
  CLOSEDATE,
  DELIVERYRULES,
  AGREEMENTSUMMA,
  AGREEMENTFINSUMMA,
  ADJUSTMENTREF,
  REESTRNUMBER,
  PAYMENTDATE,
  AGREEMENTCARDADVANCE,
  FINCARDADVANCE,
  STATEORDERREF,
  REJECTCLS,
  REJECTCAUSE,
  CRYPTOSTATUS,
  SENDERID,
  SENDERRECORDID,
  AGREEMENTBEGINDATE,
  PROTOCOLNUMBER,
  PROTOCOLDATE,
  REVIEWNOTE,
  DOCSTATEREF,
  RVERSION,
  EXPORTDATE,
  FSORGAN,
  FSBUDGETNAME,
  FSOFFBUDGET,
  RNYEAR,
  RNNUMBER,
  RNDATE,
  PROTOCOLNOTICE,
  PROTOCOLRESULTDATE,
  PROTOCOLDOCTYPE,
  PROTOCOLSALETYPE,
  NOTIFYDATE,
  EXECUTERACCREF,
  DOCBASEDATE,
  DOCBASENOTIFYDATE,
  DOCBASETEXT,
  DOCBASETYPE,
  DOCBASESUMMA,
  UNKNOWNAMOUNT,
  PROTOCOLREASON,
  DOCNUMBER,
  ADJUSTMENTDOCNUMBER,
  OLDDOCNUMBER,
  LOTMAXSUM,
  CLIENT_INN,
  CLIENT_INN20,
  CLIENT_NAME,
  EXECUTER_INN,
  EXECUTER_INN20,
  EXECUTER_NAME,
  EXECUTER_STATUS,
  EXECUTER_COUNTRY,
  EXECUTER_ADDRESS,
  EXECUTER_PHONE,
  REALID,
  ADJUSTMENTNUMBER,
  INNERNUMBER,
  SENDERIDKEY,
  SENDERRECORDIDKEY,
  REESTRVERSION,
  DOCTYPE,
  RNCLIENTID,
  INFONUMBER,
  STATEORDERINNERNUMBER,
  PROGINDEX,
  NOTE,
  PURPORTDOC,
  REESTRRECORDNUMBER)
AS
  SELECT
    ID,
    SUMMA,
    AGREEMENTDATE,
    AGREEMENTENDDATE,
    EXECUTER_REF,
    CLIENT_REF,
    FACIALACC_CLS,
    AGREEMENTTYPE,
    ACCEPTED,
    ACCEPTDATE,
    CARDADVANCEPERCENT,
    CARDADVANCE,
    CLOSEDOC,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    LASTADJUSTMENT,
    LASTACCEPTED,
    FACT,
    REGION,
    CLOSEDATE,
    DELIVERYRULES,
    AGREEMENTSUMMA,
    AGREEMENTFINSUMMA,
    ADJUSTMENTREF,
    REESTRNUMBER,
    PAYMENTDATE,
    AGREEMENTCARDADVANCE,
    FINCARDADVANCE,
    STATEORDERREF,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    AGREEMENTBEGINDATE,
    PROTOCOLNUMBER,
    PROTOCOLDATE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXPORTDATE,
    FSORGAN,
    FSBUDGETNAME,
    FSOFFBUDGET,
    RNYEAR,
    RNNUMBER,
    RNDATE,
    PROTOCOLNOTICE,
    PROTOCOLRESULTDATE,
    PROTOCOLDOCTYPE,
    PROTOCOLSALETYPE,
    NOTIFYDATE,
    EXECUTERACCREF,
    DOCBASEDATE,
    DOCBASENOTIFYDATE,
    DOCBASETEXT,
    DOCBASETYPE,
    DOCBASESUMMA,
    UNKNOWNAMOUNT,
    PROTOCOLREASON,
    DOCNUMBER,
    ADJUSTMENTDOCNUMBER,
    OLDDOCNUMBER,
    LOTMAXSUM,
    CLIENT_INN,
    CLIENT_INN20,
    CLIENT_NAME,
    EXECUTER_INN,
    EXECUTER_INN20,
    EXECUTER_NAME,
    EXECUTER_STATUS,
    EXECUTER_COUNTRY,
    EXECUTER_ADDRESS,
    EXECUTER_PHONE,
    REALID,
    ADJUSTMENTNUMBER,
    INNERNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REESTRVERSION,
    DOCTYPE,
    RNCLIENTID,
    INFONUMBER,
    STATEORDERINNERNUMBER,
    PROGINDEX,
    NOTE,
    PURPORTDOC,
    REESTRRECORDNUMBER
  FROM TB_agreements
/

CREATE OR REPLACE TRIGGER TR_AGREEMENTS_ID
  INSTEAD OF DELETE
  ON AGREEMENTS
  FOR EACH ROW
DECLARE
  cnt1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_AGREEMENTS_BD)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  select count(id) into cnt1$ from agreements where (adjustmentref = :old.id) ;
  /* Каскадное удаление. Удалять можно только непринятые и отклоненные договора.*/
  if (cnt1$ = 0) then
    delete from estimate where (recordindex = :old.id);
    delete from agreementsteps where (recordindex = :old.id);
    delete from paymentschedule where agreementref = :old.id;
        
  else
    RaiseException('ex_agr_cantdeladjustmented');
  END IF;

-- - - - - - - - - - - - -
-- BD_20 (TR_AGREEMENTS_BD_20)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  /* Чистить нужно только для первой версии договора или контракта */
  if ((:old.ProgIndex = 305)and(:old.AdjustmentNumber = 0)) then
    update tenderresultcaption set
    StateOrder = null
    where
    StateOrder = :old.ID;
  END IF;
  if ((:old.ProgIndex = 314)and(:old.AdjustmentNumber = 0)) then
    update tenderresultcaption set
    StateOrder = null,
    Agreement = null
    where
    StateOrder = :old.ID;
  END IF;
  if ((:old.ProgIndex = 304)and(:old.AdjustmentNumber = 0)) then
    update tenderresultcaption set
    Agreement = null
    where
    Agreement = :old.ID;
  END IF;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_AGREEMENTS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_10 (TR_AGREEMENTS_AD_10)
-- Last update 05.02.2010
-- - - - - - - - - - - - -

/*Версия триггера 5.0*/
    /*Восстановление флага LastAdjustment у предыдущей записи в цепочке*/
    if ((:old.AdjustmentNumber > 0) and (:old.LastAdjustment = 1)) then
        update Agreements set
            LastAdjustment = 1,
            RVersion = -1
        where (ID = :old.AdjustmentRef);
    end if;    
    /*Восстановление флага LastAccepted у предыдущей записи в цепочке*/    
    if ((:old.AdjustmentNumber > 0) and (:old.LastAccepted = 1)) then
        update Agreements set
            LastAccepted = 1,
            RVersion = -1
        where (ID = :old.AdjustmentRef);
    end if;    

-- - - - - - - - - - - - -
-- AD_200 (TR_AGREEMENTS_AD_200)
-- Create 04.10.2004
-- Last update 19.05.2005
-- - - - - - - - - - - - -

  /* Удаление истории изменений состоний для удаленного документа */
  delete from StateJumpHistory where DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_500 (TR_AGREEMENTS_AD_500)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordId, DeleteDate, Summa, ProgIndex)
  values (110, :old.ID, SYSDATE, :old.AgreementSumma, :old.ProgIndex);

END;
/

CREATE OR REPLACE TRIGGER TR_AGREEMENTS_II
  INSTEAD OF INSERT
  ON AGREEMENTS
  FOR EACH ROW
DECLARE
  new$ID AGREEMENTS.ID%TYPE := :NEW.ID;
  new$SUMMA AGREEMENTS.SUMMA%TYPE := :NEW.SUMMA;
  new$AGREEMENTDATE AGREEMENTS.AGREEMENTDATE%TYPE := :NEW.AGREEMENTDATE;
  new$AGREEMENTENDDATE AGREEMENTS.AGREEMENTENDDATE%TYPE := :NEW.AGREEMENTENDDATE;
  new$EXECUTER_REF AGREEMENTS.EXECUTER_REF%TYPE := :NEW.EXECUTER_REF;
  new$CLIENT_REF AGREEMENTS.CLIENT_REF%TYPE := :NEW.CLIENT_REF;
  new$FACIALACC_CLS AGREEMENTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$AGREEMENTTYPE AGREEMENTS.AGREEMENTTYPE%TYPE := :NEW.AGREEMENTTYPE;
  new$ACCEPTED AGREEMENTS.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$ACCEPTDATE AGREEMENTS.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$CARDADVANCEPERCENT AGREEMENTS.CARDADVANCEPERCENT%TYPE := :NEW.CARDADVANCEPERCENT;
  new$CARDADVANCE AGREEMENTS.CARDADVANCE%TYPE := :NEW.CARDADVANCE;
  new$CLOSEDOC AGREEMENTS.CLOSEDOC%TYPE := :NEW.CLOSEDOC;
  new$CREATERUSER AGREEMENTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE AGREEMENTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE AGREEMENTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER AGREEMENTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF AGREEMENTS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$LASTADJUSTMENT AGREEMENTS.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$LASTACCEPTED AGREEMENTS.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$FACT AGREEMENTS.FACT%TYPE := :NEW.FACT;
  new$REGION AGREEMENTS.REGION%TYPE := :NEW.REGION;
  new$CLOSEDATE AGREEMENTS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$DELIVERYRULES AGREEMENTS.DELIVERYRULES%TYPE := :NEW.DELIVERYRULES;
  new$AGREEMENTSUMMA AGREEMENTS.AGREEMENTSUMMA%TYPE := :NEW.AGREEMENTSUMMA;
  new$AGREEMENTFINSUMMA AGREEMENTS.AGREEMENTFINSUMMA%TYPE := :NEW.AGREEMENTFINSUMMA;
  new$ADJUSTMENTREF AGREEMENTS.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$REESTRNUMBER AGREEMENTS.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$PAYMENTDATE AGREEMENTS.PAYMENTDATE%TYPE := :NEW.PAYMENTDATE;
  new$AGREEMENTCARDADVANCE AGREEMENTS.AGREEMENTCARDADVANCE%TYPE := :NEW.AGREEMENTCARDADVANCE;
  new$FINCARDADVANCE AGREEMENTS.FINCARDADVANCE%TYPE := :NEW.FINCARDADVANCE;
  new$STATEORDERREF AGREEMENTS.STATEORDERREF%TYPE := :NEW.STATEORDERREF;
  new$REJECTCLS AGREEMENTS.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE AGREEMENTS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS AGREEMENTS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID AGREEMENTS.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID AGREEMENTS.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$AGREEMENTBEGINDATE AGREEMENTS.AGREEMENTBEGINDATE%TYPE := :NEW.AGREEMENTBEGINDATE;
  new$PROTOCOLNUMBER AGREEMENTS.PROTOCOLNUMBER%TYPE := :NEW.PROTOCOLNUMBER;
  new$PROTOCOLDATE AGREEMENTS.PROTOCOLDATE%TYPE := :NEW.PROTOCOLDATE;
  new$REVIEWNOTE AGREEMENTS.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF AGREEMENTS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION AGREEMENTS.RVERSION%TYPE := :NEW.RVERSION;
  new$EXPORTDATE AGREEMENTS.EXPORTDATE%TYPE := :NEW.EXPORTDATE;
  new$FSORGAN AGREEMENTS.FSORGAN%TYPE := :NEW.FSORGAN;
  new$FSBUDGETNAME AGREEMENTS.FSBUDGETNAME%TYPE := :NEW.FSBUDGETNAME;
  new$FSOFFBUDGET AGREEMENTS.FSOFFBUDGET%TYPE := :NEW.FSOFFBUDGET;
  new$RNYEAR AGREEMENTS.RNYEAR%TYPE := :NEW.RNYEAR;
  new$RNNUMBER AGREEMENTS.RNNUMBER%TYPE := :NEW.RNNUMBER;
  new$RNDATE AGREEMENTS.RNDATE%TYPE := :NEW.RNDATE;
  new$PROTOCOLNOTICE AGREEMENTS.PROTOCOLNOTICE%TYPE := :NEW.PROTOCOLNOTICE;
  new$PROTOCOLRESULTDATE AGREEMENTS.PROTOCOLRESULTDATE%TYPE := :NEW.PROTOCOLRESULTDATE;
  new$PROTOCOLDOCTYPE AGREEMENTS.PROTOCOLDOCTYPE%TYPE := :NEW.PROTOCOLDOCTYPE;
  new$PROTOCOLSALETYPE AGREEMENTS.PROTOCOLSALETYPE%TYPE := :NEW.PROTOCOLSALETYPE;
  new$NOTIFYDATE AGREEMENTS.NOTIFYDATE%TYPE := :NEW.NOTIFYDATE;
  new$EXECUTERACCREF AGREEMENTS.EXECUTERACCREF%TYPE := :NEW.EXECUTERACCREF;
  new$DOCBASEDATE AGREEMENTS.DOCBASEDATE%TYPE := :NEW.DOCBASEDATE;
  new$DOCBASENOTIFYDATE AGREEMENTS.DOCBASENOTIFYDATE%TYPE := :NEW.DOCBASENOTIFYDATE;
  new$DOCBASETEXT AGREEMENTS.DOCBASETEXT%TYPE := :NEW.DOCBASETEXT;
  new$DOCBASETYPE AGREEMENTS.DOCBASETYPE%TYPE := :NEW.DOCBASETYPE;
  new$DOCBASESUMMA AGREEMENTS.DOCBASESUMMA%TYPE := :NEW.DOCBASESUMMA;
  new$UNKNOWNAMOUNT AGREEMENTS.UNKNOWNAMOUNT%TYPE := :NEW.UNKNOWNAMOUNT;
  new$PROTOCOLREASON AGREEMENTS.PROTOCOLREASON%TYPE := :NEW.PROTOCOLREASON;
  new$DOCNUMBER AGREEMENTS.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$ADJUSTMENTDOCNUMBER AGREEMENTS.ADJUSTMENTDOCNUMBER%TYPE := :NEW.ADJUSTMENTDOCNUMBER;
  new$OLDDOCNUMBER AGREEMENTS.OLDDOCNUMBER%TYPE := :NEW.OLDDOCNUMBER;
  new$LOTMAXSUM AGREEMENTS.LOTMAXSUM%TYPE := :NEW.LOTMAXSUM;
  new$CLIENT_INN AGREEMENTS.CLIENT_INN%TYPE := :NEW.CLIENT_INN;
  new$CLIENT_INN20 AGREEMENTS.CLIENT_INN20%TYPE := :NEW.CLIENT_INN20;
  new$CLIENT_NAME AGREEMENTS.CLIENT_NAME%TYPE := :NEW.CLIENT_NAME;
  new$EXECUTER_INN AGREEMENTS.EXECUTER_INN%TYPE := :NEW.EXECUTER_INN;
  new$EXECUTER_INN20 AGREEMENTS.EXECUTER_INN20%TYPE := :NEW.EXECUTER_INN20;
  new$EXECUTER_NAME AGREEMENTS.EXECUTER_NAME%TYPE := :NEW.EXECUTER_NAME;
  new$EXECUTER_STATUS AGREEMENTS.EXECUTER_STATUS%TYPE := :NEW.EXECUTER_STATUS;
  new$EXECUTER_COUNTRY AGREEMENTS.EXECUTER_COUNTRY%TYPE := :NEW.EXECUTER_COUNTRY;
  new$EXECUTER_ADDRESS AGREEMENTS.EXECUTER_ADDRESS%TYPE := :NEW.EXECUTER_ADDRESS;
  new$EXECUTER_PHONE AGREEMENTS.EXECUTER_PHONE%TYPE := :NEW.EXECUTER_PHONE;
  new$REALID AGREEMENTS.REALID%TYPE := :NEW.REALID;
  new$ADJUSTMENTNUMBER AGREEMENTS.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$INNERNUMBER AGREEMENTS.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$SENDERIDKEY AGREEMENTS.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY AGREEMENTS.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REESTRVERSION AGREEMENTS.REESTRVERSION%TYPE := :NEW.REESTRVERSION;
  new$DOCTYPE AGREEMENTS.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$RNCLIENTID AGREEMENTS.RNCLIENTID%TYPE := :NEW.RNCLIENTID;
  new$INFONUMBER AGREEMENTS.INFONUMBER%TYPE := :NEW.INFONUMBER;
  new$STATEORDERINNERNUMBER AGREEMENTS.STATEORDERINNERNUMBER%TYPE := :NEW.STATEORDERINNERNUMBER;
  new$PROGINDEX AGREEMENTS.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$NOTE AGREEMENTS.NOTE%TYPE := :NEW.NOTE;
  new$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  new$REESTRRECORDNUMBER AGREEMENTS.REESTRRECORDNUMBER%TYPE := :NEW.REESTRRECORDNUMBER;
--
  tmp$ NUMBER (10);
  adjid$ NUMBER (10);
  adjdocnum$ tb_agreements.docnumber%TYPE;
  CurVal$ NUMBER (10);
  CountAcc$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_AGREEMENTS_BI)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 3.1.2*/
  /* установка значений полей по-умолчанию*/
  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$CardAdvancePercent is null) then 
    new$CardAdvancePercent := 0;
  END IF;
  if (new$CardAdvance is null) then 
    new$CardAdvance := 0;
  END IF;
  if (new$AgreementCardAdvance is null) then 
    new$AgreementCardAdvance := 0;
  END IF;
  if (new$FinCardAdvance is null) then 
    new$FinCardAdvance := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$AgreementSumma is null) then 
    new$AgreementSumma := 0;
  END IF;
  if (new$AgreementFinSumma is null) then 
    new$AgreementFinSumma := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$UnknownAmount is null) then 
    new$UnknownAmount := 0;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$client_ref is null) then 
    new$client_ref := 0;
  END IF;
    
  /* Заполнение Бюджета. Если пустой или ноль, берем из лицевого счета */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    BEGIN
      select fa.BudgetRef     into new$BudgetRef from FacialAcc_Cls fa
      where fa.Id = new$FacialAcc_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) 
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
    
  /* У ГосКонтракта своя нумерация 
     и если у договора как-то не заполнили InnerNumber*/
  if (((new$ProgIndex = 305) or (new$ProgIndex = 304) or (new$ProgIndex = 314)) and (new$InnerNumber is null)) then
    new$InnerNumber := GEN_ID('G_AgreementNumber',1);
  END IF;
  /* тип документа */
  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  /* заполнение номера цепочки гос. контракта */
    
  new$stateorderinnernumber := null;
  if (new$stateorderref is not null) then
    BEGIN
      select
      innernumber
      into new$stateorderinnernumber     from agreements
      where
      id = new$stateorderref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_AGREEMENTS_BI_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* только для работы без состояний, так как при работе по схеме причину отклонения могут заполнить еще в не отклоненном документе */
  if (new$DocStateRef is null) then
    if (new$AcceptDate is null or new$RejectCls is null) then
      new$Accepted := 1;
          
    else
      new$Accepted := 0;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_AGREEMENTS_BI_10)
-- Last update 08.02.2010
-- - - - - - - - - - - - -

/*Версия триггера 5.0*/

    /*Проверка указания внутренних номеров.*/
    if (new$InnerNumber is null) then
        RaiseException('EX_AGR_InnerNumsIsNull');
    end if;
    /*Получение внутреннего номера уточнения*/
    select max(AdjustmentNumber) into Tmp$
        from Agreements
        where (InnerNumber = new$InnerNumber);
        
    /*Если это первая запись в цепочке, тогда устанавливаем 0*/
    if (Tmp$ is null) then
        new$AdjustmentNumber := 0;
    else
        new$AdjustmentNumber := Tmp$ + 1;
    end if;    

    /*Проверка соответствия значения номера уточнения и типа соглашения*/
    if (((new$AgreementType = 0) and (new$AdjustmentNumber > 0)) or
        ((new$AgreementType = 1) and (new$AdjustmentNumber = 0))) then
        RaiseException('EX_AGR_AgrTypeViolation');
    end if;    

    /*Флаг последнего уточнения устанавливается в единицу при вставке, только если уточнение не отклонено*/
    if ((new$Accepted = 0) and (new$AcceptDate is not null)) then
        new$LastAdjustment := 0;
    else
        new$LastAdjustment := 1;
    end if;    

    /*Если договор принят, тогда устанавливаем флаг последнего принятого в цепочке*/
    if ((new$AcceptDate is not null) and (new$Accepted = 1)) then
        new$LastAccepted := 1;
    else
        new$LastAccepted := 0;
    end if;    



    /*Если договор является уточнением*/
    if (new$AdjustmentNumber > 0) then
        /*Получаем последний принятый в цепочке - он должен быть один*/
        select count(ID), max(ID), max(DocNumber)
            into Tmp$, AdjID$, AdjDocNum$
            from Agreements
            where (InnerNumber = new$InnerNumber) and (LastAccepted = 1);
            
        /*Если не один, тогда ругаемся*/
        if (Tmp$ <> 1) then
            RaiseException('EX_AGR_AdjustNotAccept');
        end if;    
        /*Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
        select count(ID) into Tmp$
            from Agreements
            where (InnerNumber = new$InnerNumber) and (AcceptDate is null) and ROWNUM = 1;
        if (Tmp$ > 0) then
           RaiseException('EX_AGR_AdjustDuplicate');
        end if;   
        /*Теперь, когда все в порядке, можно настроить все ссылочки*/
        new$AdjustmentRef := AdjID$;
        new$AdjustmentDocNumber := AdjDocNum$;
    else /*Если договор не является уточнением*/
        /*Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/
        new$AdjustmentRef := null;
        new$AdjustmentDocNumber := null;
    end if;

-- - - - - - - - - - - - -
-- BI_20 (TR_AGREEMENTS_BI_20)
-- Create 21.05.2009
-- - - - - - - - - - - - -

  /*Нужно подтянуть атрибуты организации-заказчика, если этого не было сделано*/
  if ((new$Client_INN   is null) and
      (new$Client_INN20 is null) and
      (new$Client_Name  is null))then
    BEGIN  
      select
        o.INN,
        o.INN20,
        o.Name
      into
        new$Client_INN,
        new$Client_INN20,
        new$Client_Name
      from Organizations o
      where o.Id=new$Client_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        new$Client_INN := NULL;
        new$Client_INN20 := NULL;
        new$Client_Name := NULL;
    END;
  END IF;
    
  /*Нужно подтянуть атрибуты организации-исполнителя, если этого не было сделано*/
  if ((new$Executer_INN     is null) and
      (new$Executer_INN20   is null) and
      (new$Executer_Name    is null) and
      (new$Executer_Status  is null) and
      (new$Executer_Country is null) and
      (new$Executer_Address is null) and
      (new$Executer_Phone   is null))then
    BEGIN    
      select
        o.INN,
        o.INN20,
        o.Name,
        o.SupplierStatus,
        o.Country,
        o.Address,
        o.Phone
      into
        new$Executer_INN,
        new$Executer_INN20,
        new$Executer_Name,
        new$Executer_Status,
        new$Executer_Country,
        new$Executer_Address,
        new$Executer_Phone
      from Organizations o
      where o.Id=new$Executer_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        new$Executer_INN := NULL;
        new$Executer_INN20 := NULL;
        new$Executer_Name := NULL;
        new$Executer_Status := NULL;
        new$Executer_Country := NULL;
        new$Executer_Address := NULL;
        new$Executer_Phone := NULL;
    END; 
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (TR_AGREEMENTS_BI_40)
-- Create 06.08.2010
-- - - - - - - - - - - - -

  /*автозаполнение полей информации о строке в УРМ*/
  if (new$senderId is null) then 
    new$senderIdKey := -1;
  else
    new$senderIdKey := new$senderId;
  end if;

  if (new$SenderRecordID is null)then
    new$SenderRecordIDKey := new$ID;
  else
    new$SenderRecordIDKey := new$SenderRecordID;
  end if;       

-- - - - - - - - - - - - -
-- BI_50 (TR_AGREEMENTS_BI_50)
-- Create 06.08.2010
-- - - - - - - - - - - - -

    if (new$InnerNumber is not null) then
        CurVal$ := gen_id('G_AgreementNumber', 0);
        if (CurVal$ < new$InnerNumber) then
          CurVal$ := gen_id('G_AgreementNumber', new$InnerNumber - CurVal$);
        end if;  
    end if;

-- - - - - - - - - - - - -
-- BI_300 (tr_agreements_bi_300)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$ExecuterAccRef is not null) then
    select count(ID)
    into CountAcc$     from org_accounts oa
    where oa.id = new$ExecuterAccRef and oa.Org_ref = new$Executer_Ref
    ;
    if (CountAcc$ = 0) then
      RaiseException('EX_AGR_ACCORGCHECK');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_AGREEMENTS_BI_500)
-- Last update 19.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_AGREEMENTS (
    ID,
    SUMMA,
    AGREEMENTDATE,
    AGREEMENTENDDATE,
    EXECUTER_REF,
    CLIENT_REF,
    FACIALACC_CLS,
    AGREEMENTTYPE,
    ACCEPTED,
    ACCEPTDATE,
    CARDADVANCEPERCENT,
    CARDADVANCE,
    CLOSEDOC,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    LASTADJUSTMENT,
    LASTACCEPTED,
    FACT,
    REGION,
    CLOSEDATE,
    DELIVERYRULES,
    AGREEMENTSUMMA,
    AGREEMENTFINSUMMA,
    ADJUSTMENTREF,
    REESTRNUMBER,
    PAYMENTDATE,
    AGREEMENTCARDADVANCE,
    FINCARDADVANCE,
    STATEORDERREF,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    AGREEMENTBEGINDATE,
    PROTOCOLNUMBER,
    PROTOCOLDATE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXPORTDATE,
    FSORGAN,
    FSBUDGETNAME,
    FSOFFBUDGET,
    RNYEAR,
    RNNUMBER,
    RNDATE,
    PROTOCOLNOTICE,
    PROTOCOLRESULTDATE,
    PROTOCOLDOCTYPE,
    PROTOCOLSALETYPE,
    NOTIFYDATE,
    EXECUTERACCREF,
    DOCBASEDATE,
    DOCBASENOTIFYDATE,
    DOCBASETEXT,
    DOCBASETYPE,
    DOCBASESUMMA,
    UNKNOWNAMOUNT,
    PROTOCOLREASON,
    DOCNUMBER,
    ADJUSTMENTDOCNUMBER,
    OLDDOCNUMBER,
    LOTMAXSUM,
    CLIENT_INN,
    CLIENT_INN20,
    CLIENT_NAME,
    EXECUTER_INN,
    EXECUTER_INN20,
    EXECUTER_NAME,
    EXECUTER_STATUS,
    EXECUTER_COUNTRY,
    EXECUTER_ADDRESS,
    EXECUTER_PHONE,
    REALID,
    ADJUSTMENTNUMBER,
    INNERNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REESTRVERSION,
    DOCTYPE,
    RNCLIENTID,
    INFONUMBER,
    STATEORDERINNERNUMBER,
    PROGINDEX,
    NOTE,
    PURPORTDOC,
    REESTRRECORDNUMBER
  ) VALUES (
    new$ID,
    new$SUMMA,
    new$AGREEMENTDATE,
    new$AGREEMENTENDDATE,
    new$EXECUTER_REF,
    new$CLIENT_REF,
    new$FACIALACC_CLS,
    new$AGREEMENTTYPE,
    new$ACCEPTED,
    new$ACCEPTDATE,
    new$CARDADVANCEPERCENT,
    new$CARDADVANCE,
    new$CLOSEDOC,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$LASTADJUSTMENT,
    new$LASTACCEPTED,
    new$FACT,
    new$REGION,
    new$CLOSEDATE,
    new$DELIVERYRULES,
    new$AGREEMENTSUMMA,
    new$AGREEMENTFINSUMMA,
    new$ADJUSTMENTREF,
    new$REESTRNUMBER,
    new$PAYMENTDATE,
    new$AGREEMENTCARDADVANCE,
    new$FINCARDADVANCE,
    new$STATEORDERREF,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$AGREEMENTBEGINDATE,
    new$PROTOCOLNUMBER,
    new$PROTOCOLDATE,
    new$REVIEWNOTE,
    new$DOCSTATEREF,
    new$RVERSION,
    new$EXPORTDATE,
    new$FSORGAN,
    new$FSBUDGETNAME,
    new$FSOFFBUDGET,
    new$RNYEAR,
    new$RNNUMBER,
    new$RNDATE,
    new$PROTOCOLNOTICE,
    new$PROTOCOLRESULTDATE,
    new$PROTOCOLDOCTYPE,
    new$PROTOCOLSALETYPE,
    new$NOTIFYDATE,
    new$EXECUTERACCREF,
    new$DOCBASEDATE,
    new$DOCBASENOTIFYDATE,
    new$DOCBASETEXT,
    new$DOCBASETYPE,
    new$DOCBASESUMMA,
    new$UNKNOWNAMOUNT,
    new$PROTOCOLREASON,
    new$DOCNUMBER,
    new$ADJUSTMENTDOCNUMBER,
    new$OLDDOCNUMBER,
    new$LOTMAXSUM,
    new$CLIENT_INN,
    new$CLIENT_INN20,
    new$CLIENT_NAME,
    new$EXECUTER_INN,
    new$EXECUTER_INN20,
    new$EXECUTER_NAME,
    new$EXECUTER_STATUS,
    new$EXECUTER_COUNTRY,
    new$EXECUTER_ADDRESS,
    new$EXECUTER_PHONE,
    new$REALID,
    new$ADJUSTMENTNUMBER,
    new$INNERNUMBER,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$REESTRVERSION,
    new$DOCTYPE,
    new$RNCLIENTID,
    new$INFONUMBER,
    new$STATEORDERINNERNUMBER,
    new$PROGINDEX,
    new$NOTE,
    new$PURPORTDOC,
    new$REESTRRECORDNUMBER);

-- - - - - - - - - - - - -
-- AI_10 (TR_AGREEMENTS_AI_10)
-- Last update 05.02.2010
-- - - - - - - - - - - - -

/*Версия триггера 5.0*/
    if ((new$AdjustmentNumber > 0) and (new$LastAdjustment = 1)) then
        update Agreements set
            LastAdjustment = 0,
            RVersion = -1
        where (ID = new$AdjustmentRef);        
        if (new$LastAccepted = 1) then
            update Agreements set
                LastAccepted = 0,
                RVersion = -1
            where (ID = new$AdjustmentRef);
        end if;    
    end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_AGREEMENTS_AI_500)
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 110) AND (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_AGREEMENTS_IU
  INSTEAD OF UPDATE
  ON AGREEMENTS
  FOR EACH ROW
DECLARE
  new$ID AGREEMENTS.ID%TYPE := :NEW.ID;
  new$SUMMA AGREEMENTS.SUMMA%TYPE := :NEW.SUMMA;
  new$AGREEMENTDATE AGREEMENTS.AGREEMENTDATE%TYPE := :NEW.AGREEMENTDATE;
  new$AGREEMENTENDDATE AGREEMENTS.AGREEMENTENDDATE%TYPE := :NEW.AGREEMENTENDDATE;
  new$EXECUTER_REF AGREEMENTS.EXECUTER_REF%TYPE := :NEW.EXECUTER_REF;
  new$CLIENT_REF AGREEMENTS.CLIENT_REF%TYPE := :NEW.CLIENT_REF;
  new$FACIALACC_CLS AGREEMENTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$AGREEMENTTYPE AGREEMENTS.AGREEMENTTYPE%TYPE := :NEW.AGREEMENTTYPE;
  new$ACCEPTED AGREEMENTS.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$ACCEPTDATE AGREEMENTS.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$CARDADVANCEPERCENT AGREEMENTS.CARDADVANCEPERCENT%TYPE := :NEW.CARDADVANCEPERCENT;
  new$CARDADVANCE AGREEMENTS.CARDADVANCE%TYPE := :NEW.CARDADVANCE;
  new$CLOSEDOC AGREEMENTS.CLOSEDOC%TYPE := :NEW.CLOSEDOC;
  new$CREATERUSER AGREEMENTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE AGREEMENTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE AGREEMENTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER AGREEMENTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF AGREEMENTS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$LASTADJUSTMENT AGREEMENTS.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$LASTACCEPTED AGREEMENTS.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$FACT AGREEMENTS.FACT%TYPE := :NEW.FACT;
  new$REGION AGREEMENTS.REGION%TYPE := :NEW.REGION;
  new$CLOSEDATE AGREEMENTS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$DELIVERYRULES AGREEMENTS.DELIVERYRULES%TYPE := :NEW.DELIVERYRULES;
  new$AGREEMENTSUMMA AGREEMENTS.AGREEMENTSUMMA%TYPE := :NEW.AGREEMENTSUMMA;
  new$AGREEMENTFINSUMMA AGREEMENTS.AGREEMENTFINSUMMA%TYPE := :NEW.AGREEMENTFINSUMMA;
  new$ADJUSTMENTREF AGREEMENTS.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$REESTRNUMBER AGREEMENTS.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$PAYMENTDATE AGREEMENTS.PAYMENTDATE%TYPE := :NEW.PAYMENTDATE;
  new$AGREEMENTCARDADVANCE AGREEMENTS.AGREEMENTCARDADVANCE%TYPE := :NEW.AGREEMENTCARDADVANCE;
  new$FINCARDADVANCE AGREEMENTS.FINCARDADVANCE%TYPE := :NEW.FINCARDADVANCE;
  new$STATEORDERREF AGREEMENTS.STATEORDERREF%TYPE := :NEW.STATEORDERREF;
  new$REJECTCLS AGREEMENTS.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE AGREEMENTS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS AGREEMENTS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID AGREEMENTS.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID AGREEMENTS.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$AGREEMENTBEGINDATE AGREEMENTS.AGREEMENTBEGINDATE%TYPE := :NEW.AGREEMENTBEGINDATE;
  new$PROTOCOLNUMBER AGREEMENTS.PROTOCOLNUMBER%TYPE := :NEW.PROTOCOLNUMBER;
  new$PROTOCOLDATE AGREEMENTS.PROTOCOLDATE%TYPE := :NEW.PROTOCOLDATE;
  new$REVIEWNOTE AGREEMENTS.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF AGREEMENTS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION AGREEMENTS.RVERSION%TYPE := :NEW.RVERSION;
  new$EXPORTDATE AGREEMENTS.EXPORTDATE%TYPE := :NEW.EXPORTDATE;
  new$FSORGAN AGREEMENTS.FSORGAN%TYPE := :NEW.FSORGAN;
  new$FSBUDGETNAME AGREEMENTS.FSBUDGETNAME%TYPE := :NEW.FSBUDGETNAME;
  new$FSOFFBUDGET AGREEMENTS.FSOFFBUDGET%TYPE := :NEW.FSOFFBUDGET;
  new$RNYEAR AGREEMENTS.RNYEAR%TYPE := :NEW.RNYEAR;
  new$RNNUMBER AGREEMENTS.RNNUMBER%TYPE := :NEW.RNNUMBER;
  new$RNDATE AGREEMENTS.RNDATE%TYPE := :NEW.RNDATE;
  new$PROTOCOLNOTICE AGREEMENTS.PROTOCOLNOTICE%TYPE := :NEW.PROTOCOLNOTICE;
  new$PROTOCOLRESULTDATE AGREEMENTS.PROTOCOLRESULTDATE%TYPE := :NEW.PROTOCOLRESULTDATE;
  new$PROTOCOLDOCTYPE AGREEMENTS.PROTOCOLDOCTYPE%TYPE := :NEW.PROTOCOLDOCTYPE;
  new$PROTOCOLSALETYPE AGREEMENTS.PROTOCOLSALETYPE%TYPE := :NEW.PROTOCOLSALETYPE;
  new$NOTIFYDATE AGREEMENTS.NOTIFYDATE%TYPE := :NEW.NOTIFYDATE;
  new$EXECUTERACCREF AGREEMENTS.EXECUTERACCREF%TYPE := :NEW.EXECUTERACCREF;
  new$DOCBASEDATE AGREEMENTS.DOCBASEDATE%TYPE := :NEW.DOCBASEDATE;
  new$DOCBASENOTIFYDATE AGREEMENTS.DOCBASENOTIFYDATE%TYPE := :NEW.DOCBASENOTIFYDATE;
  new$DOCBASETEXT AGREEMENTS.DOCBASETEXT%TYPE := :NEW.DOCBASETEXT;
  new$DOCBASETYPE AGREEMENTS.DOCBASETYPE%TYPE := :NEW.DOCBASETYPE;
  new$DOCBASESUMMA AGREEMENTS.DOCBASESUMMA%TYPE := :NEW.DOCBASESUMMA;
  new$UNKNOWNAMOUNT AGREEMENTS.UNKNOWNAMOUNT%TYPE := :NEW.UNKNOWNAMOUNT;
  new$PROTOCOLREASON AGREEMENTS.PROTOCOLREASON%TYPE := :NEW.PROTOCOLREASON;
  new$DOCNUMBER AGREEMENTS.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$ADJUSTMENTDOCNUMBER AGREEMENTS.ADJUSTMENTDOCNUMBER%TYPE := :NEW.ADJUSTMENTDOCNUMBER;
  new$OLDDOCNUMBER AGREEMENTS.OLDDOCNUMBER%TYPE := :NEW.OLDDOCNUMBER;
  new$LOTMAXSUM AGREEMENTS.LOTMAXSUM%TYPE := :NEW.LOTMAXSUM;
  new$CLIENT_INN AGREEMENTS.CLIENT_INN%TYPE := :NEW.CLIENT_INN;
  new$CLIENT_INN20 AGREEMENTS.CLIENT_INN20%TYPE := :NEW.CLIENT_INN20;
  new$CLIENT_NAME AGREEMENTS.CLIENT_NAME%TYPE := :NEW.CLIENT_NAME;
  new$EXECUTER_INN AGREEMENTS.EXECUTER_INN%TYPE := :NEW.EXECUTER_INN;
  new$EXECUTER_INN20 AGREEMENTS.EXECUTER_INN20%TYPE := :NEW.EXECUTER_INN20;
  new$EXECUTER_NAME AGREEMENTS.EXECUTER_NAME%TYPE := :NEW.EXECUTER_NAME;
  new$EXECUTER_STATUS AGREEMENTS.EXECUTER_STATUS%TYPE := :NEW.EXECUTER_STATUS;
  new$EXECUTER_COUNTRY AGREEMENTS.EXECUTER_COUNTRY%TYPE := :NEW.EXECUTER_COUNTRY;
  new$EXECUTER_ADDRESS AGREEMENTS.EXECUTER_ADDRESS%TYPE := :NEW.EXECUTER_ADDRESS;
  new$EXECUTER_PHONE AGREEMENTS.EXECUTER_PHONE%TYPE := :NEW.EXECUTER_PHONE;
  new$REALID AGREEMENTS.REALID%TYPE := :NEW.REALID;
  new$ADJUSTMENTNUMBER AGREEMENTS.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$INNERNUMBER AGREEMENTS.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$SENDERIDKEY AGREEMENTS.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY AGREEMENTS.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REESTRVERSION AGREEMENTS.REESTRVERSION%TYPE := :NEW.REESTRVERSION;
  new$DOCTYPE AGREEMENTS.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$RNCLIENTID AGREEMENTS.RNCLIENTID%TYPE := :NEW.RNCLIENTID;
  new$INFONUMBER AGREEMENTS.INFONUMBER%TYPE := :NEW.INFONUMBER;
  new$STATEORDERINNERNUMBER AGREEMENTS.STATEORDERINNERNUMBER%TYPE := :NEW.STATEORDERINNERNUMBER;
  new$PROGINDEX AGREEMENTS.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$NOTE AGREEMENTS.NOTE%TYPE := :NEW.NOTE;
  new$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  new$REESTRRECORDNUMBER AGREEMENTS.REESTRRECORDNUMBER%TYPE := :NEW.REESTRRECORDNUMBER;
--
  MaxNumber$ NUMBER (10);
  CurVal$ NUMBER (10);
  CNT$1 NUMBER(10);
  DetCount$ NUMBER(10);
  CountAcc$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_AGREEMENTS_BU)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 3.1*/
  /* установка значений полей по-умолчанию*/
  if (new$CardAdvancePercent is null) then 
    new$CardAdvancePercent := 0;
  END IF;
  if (new$CardAdvance is null) then 
    new$CardAdvance := 0;
  END IF;
  if (new$AgreementCardAdvance is null) then 
    new$AgreementCardAdvance := 0;
  END IF;
  if (new$FinCardAdvance is null) then 
    new$FinCardAdvance := 0;    
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$AgreementSumma is null) then 
    new$AgreementSumma := 0;
  END IF;
  if (new$AgreementFinSumma is null) then 
    new$AgreementFinSumma := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$UnknownAmount is null) then 
    new$UnknownAmount := 0;
  END IF;
  if (new$client_ref is null) then 
    new$client_ref := 0;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      select count(ID)       into DetCount$ from AgreementSteps where RecordIndex = :old.ID
      ;
      if (DetCount$ > 0) then
        RaiseException('Ex_CantModufyBudget');
      END IF;
      select count(ID)       into DetCount$ from Estimate where RecordIndex = :old.ID
      ;
      if (DetCount$ > 0) then
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* У ГосКонтракта своя нумерация и если у договора как-то не заполнили InnerNumber*/
  if (((new$ProgIndex = 305) or (new$ProgIndex = 304) or (new$ProgIndex = 314)) and (new$InnerNumber is null)) then
    new$InnerNumber := GEN_ID('G_AgreementNumber',1);
  END IF;
  /* тип документа */
  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  /* заполнение номера цепочки гос. контракта */
    
  new$stateorderinnernumber := null;
  if (new$stateorderref is not null) then
    BEGIN
      select
      innernumber
      into new$stateorderinnernumber     from agreements
      where
      id = new$stateorderref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_3 (TR_AGREEMENTS_BU_3)
-- Create 03.12.2004
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   /* Это поле проставляется при вставке и никогда не может изменить значение */
   new$AdjustmentRef := :OLD.AdjustmentRef;

-- - - - - - - - - - - - -
-- BU_5 (TR_AGREEMENTS_BU_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* только для работы без состояний, так как при работе по схеме причину отклонения могут заполнить еще в не отклоненном документе */
  if (new$DocStateRef is null) then
    if (new$AcceptDate is null or new$RejectCls is null) then
      new$Accepted := 1;
          
    else
      new$Accepted := 0;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_AGREEMENTS_BU_10)
-- Last update 08.02.2010
-- - - - - - - - - - - - -

/*Версия триггера 5.0*/
    /*Следим, чтобы никто не поменял внутреннюю нумерацию, иначе все накернится*/
    if ((new$InnerNumber <> :old.InnerNumber) or 
        (new$AdjustmentNumber <> :old.AdjustmentNumber) or
        (new$AgreementType <> :old.AgreementType)) then
        RaiseException('EX_AGR_ChangeInnerNums');
    end if;    
    
    /*Отменять отклонение договора нельзя!!!*/
    if (((:old.AcceptDate is not null) and (:old.Accepted = 0)) and 
        ((new$Accepted = 1) or (new$AcceptDate is null))) then
        RaiseException('EX_RollbackCancel');
    end if;    
    
    /*Если приняли договор, тогда необходимо установить флаг LastAccepted*/
    if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 1)) or 
        ((:old.Accepted = 0) and (new$Accepted = 1) and (new$AcceptDate is not null))) then
        /*Менять LastAccepted таким образом можно только у последней записи в цепочке*/
        if (new$LastAdjustment = 1) then
            new$LastAccepted := 1;
        else
            RaiseException('EX_AGR_ChangeStateAdjust');
        end if;    
    end if;
    
    /*Если отменили принятие договора, тогда необходимо снять флаг LastAccepted*/
    if (((:old.AcceptDate is not null) and (:old.Accepted = 1)) and
        ((new$Accepted = 0) or (new$AcceptDate is null))) then
        /*Менять LastAccepted таким образом можно только у последней записи в цепочке*/
        if (new$LastAdjustment = 1) then
            new$LastAccepted := 0;
        else
            RaiseException('EX_AGR_ChangeStateAdjust');
        end if;    
    end if;
    
    /*Если отклонили договор, тогда необходимо скинуть флаг LastAdjustment*/
    if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 0)) or 
        ((:old.Accepted = 1) and (new$Accepted = 0) and (new$AcceptDate is not null))) then
        
        if (new$LastAdjustment = 1) then
            new$LastAdjustment := 0;
            new$LastAccepted := 0;
        else
            RaiseException('EX_AGR_ChangeStateAdjust');
        end if;    

        SELECT Max(AdjustmentNumber) INTO MaxNumber$ FROm AgreementS 
        WHERE (InnerNumber = new$InnerNumber);
        /*нельзя отклонять первоначальный договор, если к нему существуют уточнения*/
        if ((new$adjustmentNumber=0) and (MaxNumber$<>0)) then
          RaiseException('EX_Agr_PrimaryAgrHasNotify');
        end if;
    end if;

-- - - - - - - - - - - - -
-- BU_20 (TR_AGREEMENTS_BU_20)
-- Create 21.05.2009
-- - - - - - - - - - - - -

  /*Нужно подтянуть атрибуты организации-заказчика,если этого не было сделано при перевыборе*/
  if ((new$Client_Ref <> :old.Client_Ref) and
      (((new$Client_INN is null) and
        (:old.Client_INN is null)) or
       (new$Client_INN = :old.Client_INN)) and
      (((new$Client_INN20 is null) and
        (:old.Client_INN20 is null)) or
       (new$Client_INN20 = :old.Client_INN20)) and
      (new$Client_Name = :old.Client_Name)) then
    BEGIN  
      select
        o.INN,
        o.INN20,
        o.Name
      into
        new$Client_INN,
        new$Client_INN20,
        new$Client_Name
      from Organizations o
      where o.Id=new$Client_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        new$Client_INN := NULL;
        new$Client_INN20 := NULL;
        new$Client_Name := NULL;
    END;
  END IF;
      
  /*Нужно подтянуть атрибуты организации-исполнителя,если этого не было сделано при перевыборе*/
  if ((new$Executer_Ref <> :old.Executer_Ref) and
      (((new$Executer_INN is null) and
        (:old.Executer_INN is null)) or
       (new$Executer_INN = :old.Executer_INN)) and
      (((new$Executer_INN20 is null) and
        (:old.Executer_INN20 is null)) or
       (new$Executer_INN20 = :old.Executer_INN20)) and
      (new$Executer_Name = :old.Executer_Name) and
      (((new$Executer_Status is null) and
        (:old.Executer_Status is null)) or
       (new$Executer_Status = :old.Executer_Status)) and
      (((new$Executer_Country is null) and
        (:old.Executer_Country is null)) or
       (new$Executer_Country = :old.Executer_Country)) and
      (((new$Executer_Address is null) and
        (:old.Executer_Address is null)) or
       (new$Executer_Address = :old.Executer_Address)) and
      (((new$Executer_Phone is null) and
        (:old.Executer_Phone is null)) or
       (new$Executer_Phone = :old.Executer_Phone))) then
     BEGIN    
      select
        o.INN,
        o.INN20,
        o.Name,
        o.SupplierStatus,
        o.Country,
        o.Address,
        o.Phone
      into
        new$Executer_INN,
        new$Executer_INN20,
        new$Executer_Name,
        new$Executer_Status,
        new$Executer_Country,
        new$Executer_Address,
        new$Executer_Phone
      from Organizations o
      where o.Id=new$Executer_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        new$Executer_INN := NULL;
        new$Executer_INN20 := NULL;
        new$Executer_Name := NULL;
        new$Executer_Status := NULL;
        new$Executer_Country := NULL;
        new$Executer_Address := NULL;
        new$Executer_Phone := NULL;
    END; 
  END IF;

-- - - - - - - - - - - - -
-- BU_50 (TR_AGREEMENTS_BU_50)
-- Create 06.08.2010
-- - - - - - - - - - - - -

    if (new$InnerNumber is not null) then
        CurVal$ := gen_id('G_AgreementNumber', 0);
        if (CurVal$ < new$InnerNumber) then
          CurVal$ := gen_id('G_AgreementNumber', new$InnerNumber - CurVal$);
        end if;  
    end if;

-- - - - - - - - - - - - -
-- BU_60 (tr_agreements_bu_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* если у первой версии договора есть неотклоненные ДИ, то нельзя отклонить договор */
  if (:old.accepted = 1 and new$accepted = 0 and new$acceptdate is not null and new$adjustmentnumber = 0) then
    SELECT COUNT(*) INTO CNT$1
    from executiondocumentscaption
    where
    (            agreementinnernumber = new$innernumber
    and (accepted <> 0 or acceptdate is null)) AND (ROWNUM = 1);
    if ((CNT$1<> 0)) then
      RaiseException('EX_Agr_CannotReject');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_AGREEMENTS_BU_200)
-- Create 04.10.2004
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   /* Сохранение в базу истории изменений состояний */
   IF (new$DocStateRef <> :OLD.DocStateRef) THEN
      INSERT INTO StateJumpHistory
                  (DocID, BeginStateRef, EndStateRef
                  )
           VALUES (new$id, :OLD.DocStateRef, new$DocStateRef
                  );
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (tr_agreements_bu_300)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$ExecuterAccRef is not null) then
    select count(ID)
    into CountAcc$     from org_accounts oa
    where oa.id = new$ExecuterAccRef and oa.Org_ref = new$Executer_Ref
    ;
    if (CountAcc$ = 0) then
      RaiseException('EX_AGR_ACCORGCHECK');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_AGREEMENTS_BU_700)
-- Create 14.10.2004
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSE
      IF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
         new$RVersion := :OLD.RVersion;
      ELSE
         new$RVersion := :OLD.RVersion + 1;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_AGREEMENTS SET
    ID = new$ID,
    SUMMA = new$SUMMA,
    AGREEMENTDATE = new$AGREEMENTDATE,
    AGREEMENTENDDATE = new$AGREEMENTENDDATE,
    EXECUTER_REF = new$EXECUTER_REF,
    CLIENT_REF = new$CLIENT_REF,
    FACIALACC_CLS = new$FACIALACC_CLS,
    AGREEMENTTYPE = new$AGREEMENTTYPE,
    ACCEPTED = new$ACCEPTED,
    ACCEPTDATE = new$ACCEPTDATE,
    CARDADVANCEPERCENT = new$CARDADVANCEPERCENT,
    CARDADVANCE = new$CARDADVANCE,
    CLOSEDOC = new$CLOSEDOC,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    LASTACCEPTED = new$LASTACCEPTED,
    FACT = new$FACT,
    REGION = new$REGION,
    CLOSEDATE = new$CLOSEDATE,
    DELIVERYRULES = new$DELIVERYRULES,
    AGREEMENTSUMMA = new$AGREEMENTSUMMA,
    AGREEMENTFINSUMMA = new$AGREEMENTFINSUMMA,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    REESTRNUMBER = new$REESTRNUMBER,
    PAYMENTDATE = new$PAYMENTDATE,
    AGREEMENTCARDADVANCE = new$AGREEMENTCARDADVANCE,
    FINCARDADVANCE = new$FINCARDADVANCE,
    STATEORDERREF = new$STATEORDERREF,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    AGREEMENTBEGINDATE = new$AGREEMENTBEGINDATE,
    PROTOCOLNUMBER = new$PROTOCOLNUMBER,
    PROTOCOLDATE = new$PROTOCOLDATE,
    REVIEWNOTE = new$REVIEWNOTE,
    DOCSTATEREF = new$DOCSTATEREF,
    RVERSION = new$RVERSION,
    EXPORTDATE = new$EXPORTDATE,
    FSORGAN = new$FSORGAN,
    FSBUDGETNAME = new$FSBUDGETNAME,
    FSOFFBUDGET = new$FSOFFBUDGET,
    RNYEAR = new$RNYEAR,
    RNNUMBER = new$RNNUMBER,
    RNDATE = new$RNDATE,
    PROTOCOLNOTICE = new$PROTOCOLNOTICE,
    PROTOCOLRESULTDATE = new$PROTOCOLRESULTDATE,
    PROTOCOLDOCTYPE = new$PROTOCOLDOCTYPE,
    PROTOCOLSALETYPE = new$PROTOCOLSALETYPE,
    NOTIFYDATE = new$NOTIFYDATE,
    EXECUTERACCREF = new$EXECUTERACCREF,
    DOCBASEDATE = new$DOCBASEDATE,
    DOCBASENOTIFYDATE = new$DOCBASENOTIFYDATE,
    DOCBASETEXT = new$DOCBASETEXT,
    DOCBASETYPE = new$DOCBASETYPE,
    DOCBASESUMMA = new$DOCBASESUMMA,
    UNKNOWNAMOUNT = new$UNKNOWNAMOUNT,
    PROTOCOLREASON = new$PROTOCOLREASON,
    DOCNUMBER = new$DOCNUMBER,
    ADJUSTMENTDOCNUMBER = new$ADJUSTMENTDOCNUMBER,
    OLDDOCNUMBER = new$OLDDOCNUMBER,
    LOTMAXSUM = new$LOTMAXSUM,
    CLIENT_INN = new$CLIENT_INN,
    CLIENT_INN20 = new$CLIENT_INN20,
    CLIENT_NAME = new$CLIENT_NAME,
    EXECUTER_INN = new$EXECUTER_INN,
    EXECUTER_INN20 = new$EXECUTER_INN20,
    EXECUTER_NAME = new$EXECUTER_NAME,
    EXECUTER_STATUS = new$EXECUTER_STATUS,
    EXECUTER_COUNTRY = new$EXECUTER_COUNTRY,
    EXECUTER_ADDRESS = new$EXECUTER_ADDRESS,
    EXECUTER_PHONE = new$EXECUTER_PHONE,
    REALID = new$REALID,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    INNERNUMBER = new$INNERNUMBER,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    REESTRVERSION = new$REESTRVERSION,
    DOCTYPE = new$DOCTYPE,
    RNCLIENTID = new$RNCLIENTID,
    INFONUMBER = new$INFONUMBER,
    STATEORDERINNERNUMBER = new$STATEORDERINNERNUMBER,
    PROGINDEX = new$PROGINDEX,
    NOTE = new$NOTE,
    PURPORTDOC = new$PURPORTDOC,
    REESTRRECORDNUMBER = new$REESTRRECORDNUMBER
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion
           OR RVersion IS NULL AND :OLD.RVersion IS NULL
          );

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_10 (TR_AGREEMENTS_AU_10)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 6.0*/
  /* Коррекция вспомогательных флагов в уточняемой записи*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentNumber > 0) and (new$LastAccepted <> :old.LastAccepted) and (:old.LastAdjustment = 1)) then
    update Agreements set
    LastAccepted = :old.LastAccepted,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;
  /* После отклонения договора необходимо восстановить флаг LastAdjustment у последней принятой версии договора*/
  if ((new$AdjustmentNumber > 0) and (:old.LastAdjustment = 1) and (new$LastAdjustment = 0) and
  (new$AcceptDate is not null) and (new$Accepted = 0)) then
    update Agreements set
    LastAdjustment = 1,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;
  /* Обновляем лицевой счет в смете для договоров и муп контрактов*/
  if ((new$FacialAcc_Cls <> :old.FacialAcc_Cls) and ((new$ProgIndex = 304)or(new$ProgIndex = 314)))then
    update Estimate
    set
    FacialAcc_Cls = new$FacialAcc_Cls,
    RVersion = -1
    where
    (RecordIndex = new$Id);
  END IF;
  /* Обновляем лицевой счет в общем плане финансирования в контрактах*/
  if ((new$FacialAcc_Cls <> :old.FacialAcc_Cls) and ((new$ProgIndex = 305) or (new$ProgIndex = 314))) then
    update paymentschedule set
    FacialAcc_Cls = new$FacialAcc_Cls,
    RVersion = -1
    where
    AgreementRef = new$ID and
    ProgIndex in (317, 318);

  END IF;

-- - - - - - - - - - - - -
-- AU_20 (TR_AGREEMENTS_AU_20)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* обновление ссылки итогов для государственных контрактов*/
  if ((new$ProgIndex = 305) and (new$AdjustmentNumber = 0) and
  (new$Accepted = 0) and (:old.LastAdjustment = 1) and (new$LastAdjustment = 0)) then
    update tenderresultcaption set
    StateOrder = null
    where
    StateOrder = :old.ID;
  END IF;
  /* обновление ссылки итогов для муниципальных контрактов*/
  if ((new$ProgIndex = 314) and (new$AdjustmentNumber = 0) and
  (new$Accepted = 0) and (:old.LastAdjustment = 1) and (new$LastAdjustment = 0)) then
    update tenderresultcaption set
    StateOrder = null,
    Agreement = null
    where
    StateOrder = :old.ID;
  END IF;
  /* обновление ссылки итогов для договоров*/
  if ((:old.ProgIndex = 304) and (new$AdjustmentNumber = 0) and (new$Accepted = 0) and
  (:old.LastAdjustment = 1) and (new$LastAdjustment = 0)) then
    update tenderresultcaption set
    Agreement = null
    where
    Agreement = :old.ID;
  END IF;

-- - - - - - - - - - - - -
-- AU_30 (TR_AGREEMENTS_AU_30)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if ((new$DocStateRef is null) and /* только для работы без состояний, так как в Новосибирске области даты разнятся */
  ((new$ProgIndex = 304) or (new$ProgIndex = 314)) and 
  ((new$Accepted <> :old.Accepted) or 
  (new$AcceptDate is not null and :old.AcceptDate is null) or 
  (new$AcceptDate is null and :old.AcceptDate is not null) or
  (new$AcceptDate is not null and :old.AcceptDate is not null and new$AcceptDate <> :old.AcceptDate))) then
    update paymentschedule set
    Accepted = new$Accepted,
    AcceptDate = new$AcceptDate
    where AgreementRef=new$ID;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_AGREEMENTS_AU_500)
-- Create 28.04.2005
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   IF (new$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes
                  (TableID, RecordId, DeleteDate
                  )
           VALUES (110, :OLD.ID, SYSDATE
                  );

      DELETE FROM DelRecIndexes
            WHERE (TableID = 110) AND (RecordId = new$ID);
   END IF;

END;
/
commit work 
/
-- CREATE TRIGGER TR_AGREEMENTS_BI_400
CREATE OR REPLACE TRIGGER TR_AGREEMENTS_II
  INSTEAD OF INSERT
  ON AGREEMENTS
  FOR EACH ROW
DECLARE
  new$ID AGREEMENTS.ID%TYPE := :NEW.ID;
  new$SUMMA AGREEMENTS.SUMMA%TYPE := :NEW.SUMMA;
  new$AGREEMENTDATE AGREEMENTS.AGREEMENTDATE%TYPE := :NEW.AGREEMENTDATE;
  new$AGREEMENTENDDATE AGREEMENTS.AGREEMENTENDDATE%TYPE := :NEW.AGREEMENTENDDATE;
  new$EXECUTER_REF AGREEMENTS.EXECUTER_REF%TYPE := :NEW.EXECUTER_REF;
  new$CLIENT_REF AGREEMENTS.CLIENT_REF%TYPE := :NEW.CLIENT_REF;
  new$FACIALACC_CLS AGREEMENTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$AGREEMENTTYPE AGREEMENTS.AGREEMENTTYPE%TYPE := :NEW.AGREEMENTTYPE;
  new$ACCEPTED AGREEMENTS.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$ACCEPTDATE AGREEMENTS.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$CARDADVANCEPERCENT AGREEMENTS.CARDADVANCEPERCENT%TYPE := :NEW.CARDADVANCEPERCENT;
  new$CARDADVANCE AGREEMENTS.CARDADVANCE%TYPE := :NEW.CARDADVANCE;
  new$CLOSEDOC AGREEMENTS.CLOSEDOC%TYPE := :NEW.CLOSEDOC;
  new$CREATERUSER AGREEMENTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE AGREEMENTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE AGREEMENTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER AGREEMENTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF AGREEMENTS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$LASTADJUSTMENT AGREEMENTS.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$LASTACCEPTED AGREEMENTS.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$FACT AGREEMENTS.FACT%TYPE := :NEW.FACT;
  new$REGION AGREEMENTS.REGION%TYPE := :NEW.REGION;
  new$CLOSEDATE AGREEMENTS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$DELIVERYRULES AGREEMENTS.DELIVERYRULES%TYPE := :NEW.DELIVERYRULES;
  new$AGREEMENTSUMMA AGREEMENTS.AGREEMENTSUMMA%TYPE := :NEW.AGREEMENTSUMMA;
  new$AGREEMENTFINSUMMA AGREEMENTS.AGREEMENTFINSUMMA%TYPE := :NEW.AGREEMENTFINSUMMA;
  new$ADJUSTMENTREF AGREEMENTS.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$REESTRNUMBER AGREEMENTS.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$PAYMENTDATE AGREEMENTS.PAYMENTDATE%TYPE := :NEW.PAYMENTDATE;
  new$AGREEMENTCARDADVANCE AGREEMENTS.AGREEMENTCARDADVANCE%TYPE := :NEW.AGREEMENTCARDADVANCE;
  new$FINCARDADVANCE AGREEMENTS.FINCARDADVANCE%TYPE := :NEW.FINCARDADVANCE;
  new$STATEORDERREF AGREEMENTS.STATEORDERREF%TYPE := :NEW.STATEORDERREF;
  new$REJECTCLS AGREEMENTS.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE AGREEMENTS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS AGREEMENTS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID AGREEMENTS.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID AGREEMENTS.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$AGREEMENTBEGINDATE AGREEMENTS.AGREEMENTBEGINDATE%TYPE := :NEW.AGREEMENTBEGINDATE;
  new$PROTOCOLNUMBER AGREEMENTS.PROTOCOLNUMBER%TYPE := :NEW.PROTOCOLNUMBER;
  new$PROTOCOLDATE AGREEMENTS.PROTOCOLDATE%TYPE := :NEW.PROTOCOLDATE;
  new$REVIEWNOTE AGREEMENTS.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF AGREEMENTS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION AGREEMENTS.RVERSION%TYPE := :NEW.RVERSION;
  new$EXPORTDATE AGREEMENTS.EXPORTDATE%TYPE := :NEW.EXPORTDATE;
  new$FSORGAN AGREEMENTS.FSORGAN%TYPE := :NEW.FSORGAN;
  new$FSBUDGETNAME AGREEMENTS.FSBUDGETNAME%TYPE := :NEW.FSBUDGETNAME;
  new$FSOFFBUDGET AGREEMENTS.FSOFFBUDGET%TYPE := :NEW.FSOFFBUDGET;
  new$RNYEAR AGREEMENTS.RNYEAR%TYPE := :NEW.RNYEAR;
  new$RNNUMBER AGREEMENTS.RNNUMBER%TYPE := :NEW.RNNUMBER;
  new$RNDATE AGREEMENTS.RNDATE%TYPE := :NEW.RNDATE;
  new$PROTOCOLNOTICE AGREEMENTS.PROTOCOLNOTICE%TYPE := :NEW.PROTOCOLNOTICE;
  new$PROTOCOLRESULTDATE AGREEMENTS.PROTOCOLRESULTDATE%TYPE := :NEW.PROTOCOLRESULTDATE;
  new$PROTOCOLDOCTYPE AGREEMENTS.PROTOCOLDOCTYPE%TYPE := :NEW.PROTOCOLDOCTYPE;
  new$PROTOCOLSALETYPE AGREEMENTS.PROTOCOLSALETYPE%TYPE := :NEW.PROTOCOLSALETYPE;
  new$NOTIFYDATE AGREEMENTS.NOTIFYDATE%TYPE := :NEW.NOTIFYDATE;
  new$EXECUTERACCREF AGREEMENTS.EXECUTERACCREF%TYPE := :NEW.EXECUTERACCREF;
  new$DOCBASEDATE AGREEMENTS.DOCBASEDATE%TYPE := :NEW.DOCBASEDATE;
  new$DOCBASENOTIFYDATE AGREEMENTS.DOCBASENOTIFYDATE%TYPE := :NEW.DOCBASENOTIFYDATE;
  new$DOCBASETEXT AGREEMENTS.DOCBASETEXT%TYPE := :NEW.DOCBASETEXT;
  new$DOCBASETYPE AGREEMENTS.DOCBASETYPE%TYPE := :NEW.DOCBASETYPE;
  new$DOCBASESUMMA AGREEMENTS.DOCBASESUMMA%TYPE := :NEW.DOCBASESUMMA;
  new$UNKNOWNAMOUNT AGREEMENTS.UNKNOWNAMOUNT%TYPE := :NEW.UNKNOWNAMOUNT;
  new$PROTOCOLREASON AGREEMENTS.PROTOCOLREASON%TYPE := :NEW.PROTOCOLREASON;
  new$DOCNUMBER AGREEMENTS.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$ADJUSTMENTDOCNUMBER AGREEMENTS.ADJUSTMENTDOCNUMBER%TYPE := :NEW.ADJUSTMENTDOCNUMBER;
  new$OLDDOCNUMBER AGREEMENTS.OLDDOCNUMBER%TYPE := :NEW.OLDDOCNUMBER;
  new$LOTMAXSUM AGREEMENTS.LOTMAXSUM%TYPE := :NEW.LOTMAXSUM;
  new$CLIENT_INN AGREEMENTS.CLIENT_INN%TYPE := :NEW.CLIENT_INN;
  new$CLIENT_INN20 AGREEMENTS.CLIENT_INN20%TYPE := :NEW.CLIENT_INN20;
  new$CLIENT_NAME AGREEMENTS.CLIENT_NAME%TYPE := :NEW.CLIENT_NAME;
  new$EXECUTER_INN AGREEMENTS.EXECUTER_INN%TYPE := :NEW.EXECUTER_INN;
  new$EXECUTER_INN20 AGREEMENTS.EXECUTER_INN20%TYPE := :NEW.EXECUTER_INN20;
  new$EXECUTER_NAME AGREEMENTS.EXECUTER_NAME%TYPE := :NEW.EXECUTER_NAME;
  new$EXECUTER_STATUS AGREEMENTS.EXECUTER_STATUS%TYPE := :NEW.EXECUTER_STATUS;
  new$EXECUTER_COUNTRY AGREEMENTS.EXECUTER_COUNTRY%TYPE := :NEW.EXECUTER_COUNTRY;
  new$EXECUTER_ADDRESS AGREEMENTS.EXECUTER_ADDRESS%TYPE := :NEW.EXECUTER_ADDRESS;
  new$EXECUTER_PHONE AGREEMENTS.EXECUTER_PHONE%TYPE := :NEW.EXECUTER_PHONE;
  new$REALID AGREEMENTS.REALID%TYPE := :NEW.REALID;
  new$ADJUSTMENTNUMBER AGREEMENTS.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$INNERNUMBER AGREEMENTS.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$SENDERIDKEY AGREEMENTS.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY AGREEMENTS.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REESTRVERSION AGREEMENTS.REESTRVERSION%TYPE := :NEW.REESTRVERSION;
  new$DOCTYPE AGREEMENTS.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$RNCLIENTID AGREEMENTS.RNCLIENTID%TYPE := :NEW.RNCLIENTID;
  new$INFONUMBER AGREEMENTS.INFONUMBER%TYPE := :NEW.INFONUMBER;
  new$STATEORDERINNERNUMBER AGREEMENTS.STATEORDERINNERNUMBER%TYPE := :NEW.STATEORDERINNERNUMBER;
  new$PROGINDEX AGREEMENTS.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$NOTE AGREEMENTS.NOTE%TYPE := :NEW.NOTE;
  new$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  new$REESTRRECORDNUMBER AGREEMENTS.REESTRRECORDNUMBER%TYPE := :NEW.REESTRRECORDNUMBER;
--
  tmp$ NUMBER (10);
  adjid$ NUMBER (10);
  adjdocnum$ tb_agreements.docnumber%TYPE;
  CurVal$ NUMBER (10);
  CountAcc$ NUMBER(10);
  rnClientID1$ VARCHAR2(15);
  rnYear1$ VARCHAR2(15);
  rnNumber1$ VARCHAR2(15);
  ReestrVersion1$ VARCHAR2(15);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_AGREEMENTS_BI)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 3.1.2*/
  /* установка значений полей по-умолчанию*/
  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$CardAdvancePercent is null) then 
    new$CardAdvancePercent := 0;
  END IF;
  if (new$CardAdvance is null) then 
    new$CardAdvance := 0;
  END IF;
  if (new$AgreementCardAdvance is null) then 
    new$AgreementCardAdvance := 0;
  END IF;
  if (new$FinCardAdvance is null) then 
    new$FinCardAdvance := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$AgreementSumma is null) then 
    new$AgreementSumma := 0;
  END IF;
  if (new$AgreementFinSumma is null) then 
    new$AgreementFinSumma := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$UnknownAmount is null) then 
    new$UnknownAmount := 0;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$client_ref is null) then 
    new$client_ref := 0;
  END IF;
    
  /* Заполнение Бюджета. Если пустой или ноль, берем из лицевого счета */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    BEGIN
      select fa.BudgetRef     into new$BudgetRef from FacialAcc_Cls fa
      where fa.Id = new$FacialAcc_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) 
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
    
  /* У ГосКонтракта своя нумерация 
     и если у договора как-то не заполнили InnerNumber*/
  if (((new$ProgIndex = 305) or (new$ProgIndex = 304) or (new$ProgIndex = 314)) and (new$InnerNumber is null)) then
    new$InnerNumber := GEN_ID('G_AgreementNumber',1);
  END IF;
  /* тип документа */
  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  /* заполнение номера цепочки гос. контракта */
    
  new$stateorderinnernumber := null;
  if (new$stateorderref is not null) then
    BEGIN
      select
      innernumber
      into new$stateorderinnernumber     from agreements
      where
      id = new$stateorderref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_AGREEMENTS_BI_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* только для работы без состояний, так как при работе по схеме причину отклонения могут заполнить еще в не отклоненном документе */
  if (new$DocStateRef is null) then
    if (new$AcceptDate is null or new$RejectCls is null) then
      new$Accepted := 1;
          
    else
      new$Accepted := 0;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_AGREEMENTS_BI_10)
-- Last update 08.02.2010
-- - - - - - - - - - - - -

/*Версия триггера 5.0*/

    /*Проверка указания внутренних номеров.*/
    if (new$InnerNumber is null) then
        RaiseException('EX_AGR_InnerNumsIsNull');
    end if;
    /*Получение внутреннего номера уточнения*/
    select max(AdjustmentNumber) into Tmp$
        from Agreements
        where (InnerNumber = new$InnerNumber);
        
    /*Если это первая запись в цепочке, тогда устанавливаем 0*/
    if (Tmp$ is null) then
        new$AdjustmentNumber := 0;
    else
        new$AdjustmentNumber := Tmp$ + 1;
    end if;    

    /*Проверка соответствия значения номера уточнения и типа соглашения*/
    if (((new$AgreementType = 0) and (new$AdjustmentNumber > 0)) or
        ((new$AgreementType = 1) and (new$AdjustmentNumber = 0))) then
        RaiseException('EX_AGR_AgrTypeViolation');
    end if;    

    /*Флаг последнего уточнения устанавливается в единицу при вставке, только если уточнение не отклонено*/
    if ((new$Accepted = 0) and (new$AcceptDate is not null)) then
        new$LastAdjustment := 0;
    else
        new$LastAdjustment := 1;
    end if;    

    /*Если договор принят, тогда устанавливаем флаг последнего принятого в цепочке*/
    if ((new$AcceptDate is not null) and (new$Accepted = 1)) then
        new$LastAccepted := 1;
    else
        new$LastAccepted := 0;
    end if;    



    /*Если договор является уточнением*/
    if (new$AdjustmentNumber > 0) then
        /*Получаем последний принятый в цепочке - он должен быть один*/
        select count(ID), max(ID), max(DocNumber)
            into Tmp$, AdjID$, AdjDocNum$
            from Agreements
            where (InnerNumber = new$InnerNumber) and (LastAccepted = 1);
            
        /*Если не один, тогда ругаемся*/
        if (Tmp$ <> 1) then
            RaiseException('EX_AGR_AdjustNotAccept');
        end if;    
        /*Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
        select count(ID) into Tmp$
            from Agreements
            where (InnerNumber = new$InnerNumber) and (AcceptDate is null) and ROWNUM = 1;
        if (Tmp$ > 0) then
           RaiseException('EX_AGR_AdjustDuplicate');
        end if;   
        /*Теперь, когда все в порядке, можно настроить все ссылочки*/
        new$AdjustmentRef := AdjID$;
        new$AdjustmentDocNumber := AdjDocNum$;
    else /*Если договор не является уточнением*/
        /*Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/
        new$AdjustmentRef := null;
        new$AdjustmentDocNumber := null;
    end if;

-- - - - - - - - - - - - -
-- BI_20 (TR_AGREEMENTS_BI_20)
-- Create 21.05.2009
-- - - - - - - - - - - - -

  /*Нужно подтянуть атрибуты организации-заказчика, если этого не было сделано*/
  if ((new$Client_INN   is null) and
      (new$Client_INN20 is null) and
      (new$Client_Name  is null))then
    BEGIN  
      select
        o.INN,
        o.INN20,
        o.Name
      into
        new$Client_INN,
        new$Client_INN20,
        new$Client_Name
      from Organizations o
      where o.Id=new$Client_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        new$Client_INN := NULL;
        new$Client_INN20 := NULL;
        new$Client_Name := NULL;
    END;
  END IF;
    
  /*Нужно подтянуть атрибуты организации-исполнителя, если этого не было сделано*/
  if ((new$Executer_INN     is null) and
      (new$Executer_INN20   is null) and
      (new$Executer_Name    is null) and
      (new$Executer_Status  is null) and
      (new$Executer_Country is null) and
      (new$Executer_Address is null) and
      (new$Executer_Phone   is null))then
    BEGIN    
      select
        o.INN,
        o.INN20,
        o.Name,
        o.SupplierStatus,
        o.Country,
        o.Address,
        o.Phone
      into
        new$Executer_INN,
        new$Executer_INN20,
        new$Executer_Name,
        new$Executer_Status,
        new$Executer_Country,
        new$Executer_Address,
        new$Executer_Phone
      from Organizations o
      where o.Id=new$Executer_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        new$Executer_INN := NULL;
        new$Executer_INN20 := NULL;
        new$Executer_Name := NULL;
        new$Executer_Status := NULL;
        new$Executer_Country := NULL;
        new$Executer_Address := NULL;
        new$Executer_Phone := NULL;
    END; 
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (TR_AGREEMENTS_BI_40)
-- Create 06.08.2010
-- - - - - - - - - - - - -

  /*автозаполнение полей информации о строке в УРМ*/
  if (new$senderId is null) then 
    new$senderIdKey := -1;
  else
    new$senderIdKey := new$senderId;
  end if;

  if (new$SenderRecordID is null)then
    new$SenderRecordIDKey := new$ID;
  else
    new$SenderRecordIDKey := new$SenderRecordID;
  end if;       

-- - - - - - - - - - - - -
-- BI_50 (TR_AGREEMENTS_BI_50)
-- Create 06.08.2010
-- - - - - - - - - - - - -

    if (new$InnerNumber is not null) then
        CurVal$ := gen_id('G_AgreementNumber', 0);
        if (CurVal$ < new$InnerNumber) then
          CurVal$ := gen_id('G_AgreementNumber', new$InnerNumber - CurVal$);
        end if;  
    end if;

-- - - - - - - - - - - - -
-- BI_300 (tr_agreements_bi_300)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$ExecuterAccRef is not null) then
    select count(ID)
    into CountAcc$     from org_accounts oa
    where oa.id = new$ExecuterAccRef and oa.Org_ref = new$Executer_Ref
    ;
    if (CountAcc$ = 0) then
      RaiseException('EX_AGR_ACCORGCHECK');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_400 (TR_AGREEMENTS_BI_400)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if ((new$rnClientID is not null) and (new$rnYear is not null) and (new$rnNumber is not null)) then

    rnClientID1$ := new$rnClientID;
    rnYear1$ := new$rnYear;
    rnNumber1$ := new$rnNumber;
    ReestrVersion1$ := new$ReestrVersion;
    while (LENGTH(rnClientID1$) < 11) LOOP
      rnClientID1$ := '0' || rnClientID1$;
    END LOOP;
    while (LENGTH(rnNumber1$) < 6) LOOP
      rnNumber1$ := '0' || rnNumber1$;
    END LOOP;
    if (LENGTH(ReestrVersion1$) < 2) then
      ReestrVersion1$ := '0' || ReestrVersion1$;
    END IF;
    /* Вычисление ReestrRecordNumber*/
    if (new$ReestrVersion is null) then
      new$ReestrRecordNumber := rnClientID1$ || rnYear1$ || rnNumber1$;
          
    else
      new$ReestrRecordNumber := rnClientID1$ || rnYear1$ || rnNumber1$ || ReestrVersion1$;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_AGREEMENTS_BI_500)
-- Last update 19.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_AGREEMENTS (
    ID,
    SUMMA,
    AGREEMENTDATE,
    AGREEMENTENDDATE,
    EXECUTER_REF,
    CLIENT_REF,
    FACIALACC_CLS,
    AGREEMENTTYPE,
    ACCEPTED,
    ACCEPTDATE,
    CARDADVANCEPERCENT,
    CARDADVANCE,
    CLOSEDOC,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    LASTADJUSTMENT,
    LASTACCEPTED,
    FACT,
    REGION,
    CLOSEDATE,
    DELIVERYRULES,
    AGREEMENTSUMMA,
    AGREEMENTFINSUMMA,
    ADJUSTMENTREF,
    REESTRNUMBER,
    PAYMENTDATE,
    AGREEMENTCARDADVANCE,
    FINCARDADVANCE,
    STATEORDERREF,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    AGREEMENTBEGINDATE,
    PROTOCOLNUMBER,
    PROTOCOLDATE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXPORTDATE,
    FSORGAN,
    FSBUDGETNAME,
    FSOFFBUDGET,
    RNYEAR,
    RNNUMBER,
    RNDATE,
    PROTOCOLNOTICE,
    PROTOCOLRESULTDATE,
    PROTOCOLDOCTYPE,
    PROTOCOLSALETYPE,
    NOTIFYDATE,
    EXECUTERACCREF,
    DOCBASEDATE,
    DOCBASENOTIFYDATE,
    DOCBASETEXT,
    DOCBASETYPE,
    DOCBASESUMMA,
    UNKNOWNAMOUNT,
    PROTOCOLREASON,
    DOCNUMBER,
    ADJUSTMENTDOCNUMBER,
    OLDDOCNUMBER,
    LOTMAXSUM,
    CLIENT_INN,
    CLIENT_INN20,
    CLIENT_NAME,
    EXECUTER_INN,
    EXECUTER_INN20,
    EXECUTER_NAME,
    EXECUTER_STATUS,
    EXECUTER_COUNTRY,
    EXECUTER_ADDRESS,
    EXECUTER_PHONE,
    REALID,
    ADJUSTMENTNUMBER,
    INNERNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REESTRVERSION,
    DOCTYPE,
    RNCLIENTID,
    INFONUMBER,
    STATEORDERINNERNUMBER,
    PROGINDEX,
    NOTE,
    PURPORTDOC,
    REESTRRECORDNUMBER
  ) VALUES (
    new$ID,
    new$SUMMA,
    new$AGREEMENTDATE,
    new$AGREEMENTENDDATE,
    new$EXECUTER_REF,
    new$CLIENT_REF,
    new$FACIALACC_CLS,
    new$AGREEMENTTYPE,
    new$ACCEPTED,
    new$ACCEPTDATE,
    new$CARDADVANCEPERCENT,
    new$CARDADVANCE,
    new$CLOSEDOC,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$LASTADJUSTMENT,
    new$LASTACCEPTED,
    new$FACT,
    new$REGION,
    new$CLOSEDATE,
    new$DELIVERYRULES,
    new$AGREEMENTSUMMA,
    new$AGREEMENTFINSUMMA,
    new$ADJUSTMENTREF,
    new$REESTRNUMBER,
    new$PAYMENTDATE,
    new$AGREEMENTCARDADVANCE,
    new$FINCARDADVANCE,
    new$STATEORDERREF,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$AGREEMENTBEGINDATE,
    new$PROTOCOLNUMBER,
    new$PROTOCOLDATE,
    new$REVIEWNOTE,
    new$DOCSTATEREF,
    new$RVERSION,
    new$EXPORTDATE,
    new$FSORGAN,
    new$FSBUDGETNAME,
    new$FSOFFBUDGET,
    new$RNYEAR,
    new$RNNUMBER,
    new$RNDATE,
    new$PROTOCOLNOTICE,
    new$PROTOCOLRESULTDATE,
    new$PROTOCOLDOCTYPE,
    new$PROTOCOLSALETYPE,
    new$NOTIFYDATE,
    new$EXECUTERACCREF,
    new$DOCBASEDATE,
    new$DOCBASENOTIFYDATE,
    new$DOCBASETEXT,
    new$DOCBASETYPE,
    new$DOCBASESUMMA,
    new$UNKNOWNAMOUNT,
    new$PROTOCOLREASON,
    new$DOCNUMBER,
    new$ADJUSTMENTDOCNUMBER,
    new$OLDDOCNUMBER,
    new$LOTMAXSUM,
    new$CLIENT_INN,
    new$CLIENT_INN20,
    new$CLIENT_NAME,
    new$EXECUTER_INN,
    new$EXECUTER_INN20,
    new$EXECUTER_NAME,
    new$EXECUTER_STATUS,
    new$EXECUTER_COUNTRY,
    new$EXECUTER_ADDRESS,
    new$EXECUTER_PHONE,
    new$REALID,
    new$ADJUSTMENTNUMBER,
    new$INNERNUMBER,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$REESTRVERSION,
    new$DOCTYPE,
    new$RNCLIENTID,
    new$INFONUMBER,
    new$STATEORDERINNERNUMBER,
    new$PROGINDEX,
    new$NOTE,
    new$PURPORTDOC,
    new$REESTRRECORDNUMBER);

-- - - - - - - - - - - - -
-- AI_10 (TR_AGREEMENTS_AI_10)
-- Last update 05.02.2010
-- - - - - - - - - - - - -

/*Версия триггера 5.0*/
    if ((new$AdjustmentNumber > 0) and (new$LastAdjustment = 1)) then
        update Agreements set
            LastAdjustment = 0,
            RVersion = -1
        where (ID = new$AdjustmentRef);        
        if (new$LastAccepted = 1) then
            update Agreements set
                LastAccepted = 0,
                RVersion = -1
            where (ID = new$AdjustmentRef);
        end if;    
    end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_AGREEMENTS_AI_500)
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 110) AND (RecordID = new$ID);

END;
/
commit work
/
-- CREATE TRIGGER TR_AGREEMENTS_BU_400
CREATE OR REPLACE TRIGGER TR_AGREEMENTS_IU
  INSTEAD OF UPDATE
  ON AGREEMENTS
  FOR EACH ROW
DECLARE
  new$ID AGREEMENTS.ID%TYPE := :NEW.ID;
  new$SUMMA AGREEMENTS.SUMMA%TYPE := :NEW.SUMMA;
  new$AGREEMENTDATE AGREEMENTS.AGREEMENTDATE%TYPE := :NEW.AGREEMENTDATE;
  new$AGREEMENTENDDATE AGREEMENTS.AGREEMENTENDDATE%TYPE := :NEW.AGREEMENTENDDATE;
  new$EXECUTER_REF AGREEMENTS.EXECUTER_REF%TYPE := :NEW.EXECUTER_REF;
  new$CLIENT_REF AGREEMENTS.CLIENT_REF%TYPE := :NEW.CLIENT_REF;
  new$FACIALACC_CLS AGREEMENTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$AGREEMENTTYPE AGREEMENTS.AGREEMENTTYPE%TYPE := :NEW.AGREEMENTTYPE;
  new$ACCEPTED AGREEMENTS.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$ACCEPTDATE AGREEMENTS.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$CARDADVANCEPERCENT AGREEMENTS.CARDADVANCEPERCENT%TYPE := :NEW.CARDADVANCEPERCENT;
  new$CARDADVANCE AGREEMENTS.CARDADVANCE%TYPE := :NEW.CARDADVANCE;
  new$CLOSEDOC AGREEMENTS.CLOSEDOC%TYPE := :NEW.CLOSEDOC;
  new$CREATERUSER AGREEMENTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE AGREEMENTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE AGREEMENTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER AGREEMENTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF AGREEMENTS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$LASTADJUSTMENT AGREEMENTS.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$LASTACCEPTED AGREEMENTS.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$FACT AGREEMENTS.FACT%TYPE := :NEW.FACT;
  new$REGION AGREEMENTS.REGION%TYPE := :NEW.REGION;
  new$CLOSEDATE AGREEMENTS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$DELIVERYRULES AGREEMENTS.DELIVERYRULES%TYPE := :NEW.DELIVERYRULES;
  new$AGREEMENTSUMMA AGREEMENTS.AGREEMENTSUMMA%TYPE := :NEW.AGREEMENTSUMMA;
  new$AGREEMENTFINSUMMA AGREEMENTS.AGREEMENTFINSUMMA%TYPE := :NEW.AGREEMENTFINSUMMA;
  new$ADJUSTMENTREF AGREEMENTS.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$REESTRNUMBER AGREEMENTS.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$PAYMENTDATE AGREEMENTS.PAYMENTDATE%TYPE := :NEW.PAYMENTDATE;
  new$AGREEMENTCARDADVANCE AGREEMENTS.AGREEMENTCARDADVANCE%TYPE := :NEW.AGREEMENTCARDADVANCE;
  new$FINCARDADVANCE AGREEMENTS.FINCARDADVANCE%TYPE := :NEW.FINCARDADVANCE;
  new$STATEORDERREF AGREEMENTS.STATEORDERREF%TYPE := :NEW.STATEORDERREF;
  new$REJECTCLS AGREEMENTS.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE AGREEMENTS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS AGREEMENTS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID AGREEMENTS.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID AGREEMENTS.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$AGREEMENTBEGINDATE AGREEMENTS.AGREEMENTBEGINDATE%TYPE := :NEW.AGREEMENTBEGINDATE;
  new$PROTOCOLNUMBER AGREEMENTS.PROTOCOLNUMBER%TYPE := :NEW.PROTOCOLNUMBER;
  new$PROTOCOLDATE AGREEMENTS.PROTOCOLDATE%TYPE := :NEW.PROTOCOLDATE;
  new$REVIEWNOTE AGREEMENTS.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF AGREEMENTS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION AGREEMENTS.RVERSION%TYPE := :NEW.RVERSION;
  new$EXPORTDATE AGREEMENTS.EXPORTDATE%TYPE := :NEW.EXPORTDATE;
  new$FSORGAN AGREEMENTS.FSORGAN%TYPE := :NEW.FSORGAN;
  new$FSBUDGETNAME AGREEMENTS.FSBUDGETNAME%TYPE := :NEW.FSBUDGETNAME;
  new$FSOFFBUDGET AGREEMENTS.FSOFFBUDGET%TYPE := :NEW.FSOFFBUDGET;
  new$RNYEAR AGREEMENTS.RNYEAR%TYPE := :NEW.RNYEAR;
  new$RNNUMBER AGREEMENTS.RNNUMBER%TYPE := :NEW.RNNUMBER;
  new$RNDATE AGREEMENTS.RNDATE%TYPE := :NEW.RNDATE;
  new$PROTOCOLNOTICE AGREEMENTS.PROTOCOLNOTICE%TYPE := :NEW.PROTOCOLNOTICE;
  new$PROTOCOLRESULTDATE AGREEMENTS.PROTOCOLRESULTDATE%TYPE := :NEW.PROTOCOLRESULTDATE;
  new$PROTOCOLDOCTYPE AGREEMENTS.PROTOCOLDOCTYPE%TYPE := :NEW.PROTOCOLDOCTYPE;
  new$PROTOCOLSALETYPE AGREEMENTS.PROTOCOLSALETYPE%TYPE := :NEW.PROTOCOLSALETYPE;
  new$NOTIFYDATE AGREEMENTS.NOTIFYDATE%TYPE := :NEW.NOTIFYDATE;
  new$EXECUTERACCREF AGREEMENTS.EXECUTERACCREF%TYPE := :NEW.EXECUTERACCREF;
  new$DOCBASEDATE AGREEMENTS.DOCBASEDATE%TYPE := :NEW.DOCBASEDATE;
  new$DOCBASENOTIFYDATE AGREEMENTS.DOCBASENOTIFYDATE%TYPE := :NEW.DOCBASENOTIFYDATE;
  new$DOCBASETEXT AGREEMENTS.DOCBASETEXT%TYPE := :NEW.DOCBASETEXT;
  new$DOCBASETYPE AGREEMENTS.DOCBASETYPE%TYPE := :NEW.DOCBASETYPE;
  new$DOCBASESUMMA AGREEMENTS.DOCBASESUMMA%TYPE := :NEW.DOCBASESUMMA;
  new$UNKNOWNAMOUNT AGREEMENTS.UNKNOWNAMOUNT%TYPE := :NEW.UNKNOWNAMOUNT;
  new$PROTOCOLREASON AGREEMENTS.PROTOCOLREASON%TYPE := :NEW.PROTOCOLREASON;
  new$DOCNUMBER AGREEMENTS.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$ADJUSTMENTDOCNUMBER AGREEMENTS.ADJUSTMENTDOCNUMBER%TYPE := :NEW.ADJUSTMENTDOCNUMBER;
  new$OLDDOCNUMBER AGREEMENTS.OLDDOCNUMBER%TYPE := :NEW.OLDDOCNUMBER;
  new$LOTMAXSUM AGREEMENTS.LOTMAXSUM%TYPE := :NEW.LOTMAXSUM;
  new$CLIENT_INN AGREEMENTS.CLIENT_INN%TYPE := :NEW.CLIENT_INN;
  new$CLIENT_INN20 AGREEMENTS.CLIENT_INN20%TYPE := :NEW.CLIENT_INN20;
  new$CLIENT_NAME AGREEMENTS.CLIENT_NAME%TYPE := :NEW.CLIENT_NAME;
  new$EXECUTER_INN AGREEMENTS.EXECUTER_INN%TYPE := :NEW.EXECUTER_INN;
  new$EXECUTER_INN20 AGREEMENTS.EXECUTER_INN20%TYPE := :NEW.EXECUTER_INN20;
  new$EXECUTER_NAME AGREEMENTS.EXECUTER_NAME%TYPE := :NEW.EXECUTER_NAME;
  new$EXECUTER_STATUS AGREEMENTS.EXECUTER_STATUS%TYPE := :NEW.EXECUTER_STATUS;
  new$EXECUTER_COUNTRY AGREEMENTS.EXECUTER_COUNTRY%TYPE := :NEW.EXECUTER_COUNTRY;
  new$EXECUTER_ADDRESS AGREEMENTS.EXECUTER_ADDRESS%TYPE := :NEW.EXECUTER_ADDRESS;
  new$EXECUTER_PHONE AGREEMENTS.EXECUTER_PHONE%TYPE := :NEW.EXECUTER_PHONE;
  new$REALID AGREEMENTS.REALID%TYPE := :NEW.REALID;
  new$ADJUSTMENTNUMBER AGREEMENTS.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$INNERNUMBER AGREEMENTS.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$SENDERIDKEY AGREEMENTS.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY AGREEMENTS.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REESTRVERSION AGREEMENTS.REESTRVERSION%TYPE := :NEW.REESTRVERSION;
  new$DOCTYPE AGREEMENTS.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$RNCLIENTID AGREEMENTS.RNCLIENTID%TYPE := :NEW.RNCLIENTID;
  new$INFONUMBER AGREEMENTS.INFONUMBER%TYPE := :NEW.INFONUMBER;
  new$STATEORDERINNERNUMBER AGREEMENTS.STATEORDERINNERNUMBER%TYPE := :NEW.STATEORDERINNERNUMBER;
  new$PROGINDEX AGREEMENTS.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$NOTE AGREEMENTS.NOTE%TYPE := :NEW.NOTE;
  new$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  new$REESTRRECORDNUMBER AGREEMENTS.REESTRRECORDNUMBER%TYPE := :NEW.REESTRRECORDNUMBER;
--
  MaxNumber$ NUMBER (10);
  CurVal$ NUMBER (10);
  CNT$1 NUMBER(10);
  DetCount$ NUMBER(10);
  CountAcc$ NUMBER(10);
  rnClientID1$ VARCHAR2(15);
  rnYear1$ VARCHAR2(15);
  rnNumber1$ VARCHAR2(15);
  ReestrVersion1$ VARCHAR2(15);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_AGREEMENTS_BU)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 3.1*/
  /* установка значений полей по-умолчанию*/
  if (new$CardAdvancePercent is null) then 
    new$CardAdvancePercent := 0;
  END IF;
  if (new$CardAdvance is null) then 
    new$CardAdvance := 0;
  END IF;
  if (new$AgreementCardAdvance is null) then 
    new$AgreementCardAdvance := 0;
  END IF;
  if (new$FinCardAdvance is null) then 
    new$FinCardAdvance := 0;    
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$AgreementSumma is null) then 
    new$AgreementSumma := 0;
  END IF;
  if (new$AgreementFinSumma is null) then 
    new$AgreementFinSumma := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$UnknownAmount is null) then 
    new$UnknownAmount := 0;
  END IF;
  if (new$client_ref is null) then 
    new$client_ref := 0;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      select count(ID)       into DetCount$ from AgreementSteps where RecordIndex = :old.ID
      ;
      if (DetCount$ > 0) then
        RaiseException('Ex_CantModufyBudget');
      END IF;
      select count(ID)       into DetCount$ from Estimate where RecordIndex = :old.ID
      ;
      if (DetCount$ > 0) then
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* У ГосКонтракта своя нумерация и если у договора как-то не заполнили InnerNumber*/
  if (((new$ProgIndex = 305) or (new$ProgIndex = 304) or (new$ProgIndex = 314)) and (new$InnerNumber is null)) then
    new$InnerNumber := GEN_ID('G_AgreementNumber',1);
  END IF;
  /* тип документа */
  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  /* заполнение номера цепочки гос. контракта */
    
  new$stateorderinnernumber := null;
  if (new$stateorderref is not null) then
    BEGIN
      select
      innernumber
      into new$stateorderinnernumber     from agreements
      where
      id = new$stateorderref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_3 (TR_AGREEMENTS_BU_3)
-- Create 03.12.2004
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   /* Это поле проставляется при вставке и никогда не может изменить значение */
   new$AdjustmentRef := :OLD.AdjustmentRef;

-- - - - - - - - - - - - -
-- BU_5 (TR_AGREEMENTS_BU_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* только для работы без состояний, так как при работе по схеме причину отклонения могут заполнить еще в не отклоненном документе */
  if (new$DocStateRef is null) then
    if (new$AcceptDate is null or new$RejectCls is null) then
      new$Accepted := 1;
          
    else
      new$Accepted := 0;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_AGREEMENTS_BU_10)
-- Last update 08.02.2010
-- - - - - - - - - - - - -

/*Версия триггера 5.0*/
    /*Следим, чтобы никто не поменял внутреннюю нумерацию, иначе все накернится*/
    if ((new$InnerNumber <> :old.InnerNumber) or 
        (new$AdjustmentNumber <> :old.AdjustmentNumber) or
        (new$AgreementType <> :old.AgreementType)) then
        RaiseException('EX_AGR_ChangeInnerNums');
    end if;    
    
    /*Отменять отклонение договора нельзя!!!*/
    if (((:old.AcceptDate is not null) and (:old.Accepted = 0)) and 
        ((new$Accepted = 1) or (new$AcceptDate is null))) then
        RaiseException('EX_RollbackCancel');
    end if;    
    
    /*Если приняли договор, тогда необходимо установить флаг LastAccepted*/
    if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 1)) or 
        ((:old.Accepted = 0) and (new$Accepted = 1) and (new$AcceptDate is not null))) then
        /*Менять LastAccepted таким образом можно только у последней записи в цепочке*/
        if (new$LastAdjustment = 1) then
            new$LastAccepted := 1;
        else
            RaiseException('EX_AGR_ChangeStateAdjust');
        end if;    
    end if;
    
    /*Если отменили принятие договора, тогда необходимо снять флаг LastAccepted*/
    if (((:old.AcceptDate is not null) and (:old.Accepted = 1)) and
        ((new$Accepted = 0) or (new$AcceptDate is null))) then
        /*Менять LastAccepted таким образом можно только у последней записи в цепочке*/
        if (new$LastAdjustment = 1) then
            new$LastAccepted := 0;
        else
            RaiseException('EX_AGR_ChangeStateAdjust');
        end if;    
    end if;
    
    /*Если отклонили договор, тогда необходимо скинуть флаг LastAdjustment*/
    if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 0)) or 
        ((:old.Accepted = 1) and (new$Accepted = 0) and (new$AcceptDate is not null))) then
        
        if (new$LastAdjustment = 1) then
            new$LastAdjustment := 0;
            new$LastAccepted := 0;
        else
            RaiseException('EX_AGR_ChangeStateAdjust');
        end if;    

        SELECT Max(AdjustmentNumber) INTO MaxNumber$ FROm AgreementS 
        WHERE (InnerNumber = new$InnerNumber);
        /*нельзя отклонять первоначальный договор, если к нему существуют уточнения*/
        if ((new$adjustmentNumber=0) and (MaxNumber$<>0)) then
          RaiseException('EX_Agr_PrimaryAgrHasNotify');
        end if;
    end if;

-- - - - - - - - - - - - -
-- BU_20 (TR_AGREEMENTS_BU_20)
-- Create 21.05.2009
-- - - - - - - - - - - - -

  /*Нужно подтянуть атрибуты организации-заказчика,если этого не было сделано при перевыборе*/
  if ((new$Client_Ref <> :old.Client_Ref) and
      (((new$Client_INN is null) and
        (:old.Client_INN is null)) or
       (new$Client_INN = :old.Client_INN)) and
      (((new$Client_INN20 is null) and
        (:old.Client_INN20 is null)) or
       (new$Client_INN20 = :old.Client_INN20)) and
      (new$Client_Name = :old.Client_Name)) then
    BEGIN  
      select
        o.INN,
        o.INN20,
        o.Name
      into
        new$Client_INN,
        new$Client_INN20,
        new$Client_Name
      from Organizations o
      where o.Id=new$Client_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        new$Client_INN := NULL;
        new$Client_INN20 := NULL;
        new$Client_Name := NULL;
    END;
  END IF;
      
  /*Нужно подтянуть атрибуты организации-исполнителя,если этого не было сделано при перевыборе*/
  if ((new$Executer_Ref <> :old.Executer_Ref) and
      (((new$Executer_INN is null) and
        (:old.Executer_INN is null)) or
       (new$Executer_INN = :old.Executer_INN)) and
      (((new$Executer_INN20 is null) and
        (:old.Executer_INN20 is null)) or
       (new$Executer_INN20 = :old.Executer_INN20)) and
      (new$Executer_Name = :old.Executer_Name) and
      (((new$Executer_Status is null) and
        (:old.Executer_Status is null)) or
       (new$Executer_Status = :old.Executer_Status)) and
      (((new$Executer_Country is null) and
        (:old.Executer_Country is null)) or
       (new$Executer_Country = :old.Executer_Country)) and
      (((new$Executer_Address is null) and
        (:old.Executer_Address is null)) or
       (new$Executer_Address = :old.Executer_Address)) and
      (((new$Executer_Phone is null) and
        (:old.Executer_Phone is null)) or
       (new$Executer_Phone = :old.Executer_Phone))) then
     BEGIN    
      select
        o.INN,
        o.INN20,
        o.Name,
        o.SupplierStatus,
        o.Country,
        o.Address,
        o.Phone
      into
        new$Executer_INN,
        new$Executer_INN20,
        new$Executer_Name,
        new$Executer_Status,
        new$Executer_Country,
        new$Executer_Address,
        new$Executer_Phone
      from Organizations o
      where o.Id=new$Executer_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        new$Executer_INN := NULL;
        new$Executer_INN20 := NULL;
        new$Executer_Name := NULL;
        new$Executer_Status := NULL;
        new$Executer_Country := NULL;
        new$Executer_Address := NULL;
        new$Executer_Phone := NULL;
    END; 
  END IF;

-- - - - - - - - - - - - -
-- BU_50 (TR_AGREEMENTS_BU_50)
-- Create 06.08.2010
-- - - - - - - - - - - - -

    if (new$InnerNumber is not null) then
        CurVal$ := gen_id('G_AgreementNumber', 0);
        if (CurVal$ < new$InnerNumber) then
          CurVal$ := gen_id('G_AgreementNumber', new$InnerNumber - CurVal$);
        end if;  
    end if;

-- - - - - - - - - - - - -
-- BU_60 (tr_agreements_bu_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* если у первой версии договора есть неотклоненные ДИ, то нельзя отклонить договор */
  if (:old.accepted = 1 and new$accepted = 0 and new$acceptdate is not null and new$adjustmentnumber = 0) then
    SELECT COUNT(*) INTO CNT$1
    from executiondocumentscaption
    where
    (            agreementinnernumber = new$innernumber
    and (accepted <> 0 or acceptdate is null)) AND (ROWNUM = 1);
    if ((CNT$1<> 0)) then
      RaiseException('EX_Agr_CannotReject');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_AGREEMENTS_BU_200)
-- Create 04.10.2004
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   /* Сохранение в базу истории изменений состояний */
   IF (new$DocStateRef <> :OLD.DocStateRef) THEN
      INSERT INTO StateJumpHistory
                  (DocID, BeginStateRef, EndStateRef
                  )
           VALUES (new$id, :OLD.DocStateRef, new$DocStateRef
                  );
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (tr_agreements_bu_300)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$ExecuterAccRef is not null) then
    select count(ID)
    into CountAcc$     from org_accounts oa
    where oa.id = new$ExecuterAccRef and oa.Org_ref = new$Executer_Ref
    ;
    if (CountAcc$ = 0) then
      RaiseException('EX_AGR_ACCORGCHECK');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_400 (TR_AGREEMENTS_BU_400)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (((new$rnClientID <> :old.rnClientID) or (new$rnYear <> :old.rnYear) or
  (new$rnNumber <> :old.rnNumber) or (new$ReestrVersion <> :old.ReestrVersion)) and
  (new$rnClientID is not null) and (new$rnYear is not null) and (new$rnNumber is not null)) then

    rnClientID1$ := new$rnClientID;
    rnYear1$ := new$rnYear;
    rnNumber1$ := new$rnNumber;
    ReestrVersion1$ := new$ReestrVersion;
    while (LENGTH(rnClientID1$) < 11) LOOP
      rnClientID1$ := '0' || rnClientID1$;
    END LOOP;
    while (LENGTH(rnNumber1$) < 6) LOOP
      rnNumber1$ := '0' || rnNumber1$;
    END LOOP;
    if (LENGTH(ReestrVersion1$) < 2) then
      ReestrVersion1$ := '0' || ReestrVersion1$;
    END IF;
    /* Вычисление ReestrRecordNumber*/
    if (new$ReestrVersion is null) then
      new$ReestrRecordNumber := rnClientID1$ || rnYear1$ || rnNumber1$;
          
    else
      new$ReestrRecordNumber := rnClientID1$ || rnYear1$ || rnNumber1$ || ReestrVersion1$;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_AGREEMENTS_BU_700)
-- Create 14.10.2004
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSE
      IF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
         new$RVersion := :OLD.RVersion;
      ELSE
         new$RVersion := :OLD.RVersion + 1;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_AGREEMENTS SET
    ID = new$ID,
    SUMMA = new$SUMMA,
    AGREEMENTDATE = new$AGREEMENTDATE,
    AGREEMENTENDDATE = new$AGREEMENTENDDATE,
    EXECUTER_REF = new$EXECUTER_REF,
    CLIENT_REF = new$CLIENT_REF,
    FACIALACC_CLS = new$FACIALACC_CLS,
    AGREEMENTTYPE = new$AGREEMENTTYPE,
    ACCEPTED = new$ACCEPTED,
    ACCEPTDATE = new$ACCEPTDATE,
    CARDADVANCEPERCENT = new$CARDADVANCEPERCENT,
    CARDADVANCE = new$CARDADVANCE,
    CLOSEDOC = new$CLOSEDOC,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    LASTACCEPTED = new$LASTACCEPTED,
    FACT = new$FACT,
    REGION = new$REGION,
    CLOSEDATE = new$CLOSEDATE,
    DELIVERYRULES = new$DELIVERYRULES,
    AGREEMENTSUMMA = new$AGREEMENTSUMMA,
    AGREEMENTFINSUMMA = new$AGREEMENTFINSUMMA,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    REESTRNUMBER = new$REESTRNUMBER,
    PAYMENTDATE = new$PAYMENTDATE,
    AGREEMENTCARDADVANCE = new$AGREEMENTCARDADVANCE,
    FINCARDADVANCE = new$FINCARDADVANCE,
    STATEORDERREF = new$STATEORDERREF,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    AGREEMENTBEGINDATE = new$AGREEMENTBEGINDATE,
    PROTOCOLNUMBER = new$PROTOCOLNUMBER,
    PROTOCOLDATE = new$PROTOCOLDATE,
    REVIEWNOTE = new$REVIEWNOTE,
    DOCSTATEREF = new$DOCSTATEREF,
    RVERSION = new$RVERSION,
    EXPORTDATE = new$EXPORTDATE,
    FSORGAN = new$FSORGAN,
    FSBUDGETNAME = new$FSBUDGETNAME,
    FSOFFBUDGET = new$FSOFFBUDGET,
    RNYEAR = new$RNYEAR,
    RNNUMBER = new$RNNUMBER,
    RNDATE = new$RNDATE,
    PROTOCOLNOTICE = new$PROTOCOLNOTICE,
    PROTOCOLRESULTDATE = new$PROTOCOLRESULTDATE,
    PROTOCOLDOCTYPE = new$PROTOCOLDOCTYPE,
    PROTOCOLSALETYPE = new$PROTOCOLSALETYPE,
    NOTIFYDATE = new$NOTIFYDATE,
    EXECUTERACCREF = new$EXECUTERACCREF,
    DOCBASEDATE = new$DOCBASEDATE,
    DOCBASENOTIFYDATE = new$DOCBASENOTIFYDATE,
    DOCBASETEXT = new$DOCBASETEXT,
    DOCBASETYPE = new$DOCBASETYPE,
    DOCBASESUMMA = new$DOCBASESUMMA,
    UNKNOWNAMOUNT = new$UNKNOWNAMOUNT,
    PROTOCOLREASON = new$PROTOCOLREASON,
    DOCNUMBER = new$DOCNUMBER,
    ADJUSTMENTDOCNUMBER = new$ADJUSTMENTDOCNUMBER,
    OLDDOCNUMBER = new$OLDDOCNUMBER,
    LOTMAXSUM = new$LOTMAXSUM,
    CLIENT_INN = new$CLIENT_INN,
    CLIENT_INN20 = new$CLIENT_INN20,
    CLIENT_NAME = new$CLIENT_NAME,
    EXECUTER_INN = new$EXECUTER_INN,
    EXECUTER_INN20 = new$EXECUTER_INN20,
    EXECUTER_NAME = new$EXECUTER_NAME,
    EXECUTER_STATUS = new$EXECUTER_STATUS,
    EXECUTER_COUNTRY = new$EXECUTER_COUNTRY,
    EXECUTER_ADDRESS = new$EXECUTER_ADDRESS,
    EXECUTER_PHONE = new$EXECUTER_PHONE,
    REALID = new$REALID,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    INNERNUMBER = new$INNERNUMBER,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    REESTRVERSION = new$REESTRVERSION,
    DOCTYPE = new$DOCTYPE,
    RNCLIENTID = new$RNCLIENTID,
    INFONUMBER = new$INFONUMBER,
    STATEORDERINNERNUMBER = new$STATEORDERINNERNUMBER,
    PROGINDEX = new$PROGINDEX,
    NOTE = new$NOTE,
    PURPORTDOC = new$PURPORTDOC,
    REESTRRECORDNUMBER = new$REESTRRECORDNUMBER
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion
           OR RVersion IS NULL AND :OLD.RVersion IS NULL
          );

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_10 (TR_AGREEMENTS_AU_10)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 6.0*/
  /* Коррекция вспомогательных флагов в уточняемой записи*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentNumber > 0) and (new$LastAccepted <> :old.LastAccepted) and (:old.LastAdjustment = 1)) then
    update Agreements set
    LastAccepted = :old.LastAccepted,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;
  /* После отклонения договора необходимо восстановить флаг LastAdjustment у последней принятой версии договора*/
  if ((new$AdjustmentNumber > 0) and (:old.LastAdjustment = 1) and (new$LastAdjustment = 0) and
  (new$AcceptDate is not null) and (new$Accepted = 0)) then
    update Agreements set
    LastAdjustment = 1,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;
  /* Обновляем лицевой счет в смете для договоров и муп контрактов*/
  if ((new$FacialAcc_Cls <> :old.FacialAcc_Cls) and ((new$ProgIndex = 304)or(new$ProgIndex = 314)))then
    update Estimate
    set
    FacialAcc_Cls = new$FacialAcc_Cls,
    RVersion = -1
    where
    (RecordIndex = new$Id);
  END IF;
  /* Обновляем лицевой счет в общем плане финансирования в контрактах*/
  if ((new$FacialAcc_Cls <> :old.FacialAcc_Cls) and ((new$ProgIndex = 305) or (new$ProgIndex = 314))) then
    update paymentschedule set
    FacialAcc_Cls = new$FacialAcc_Cls,
    RVersion = -1
    where
    AgreementRef = new$ID and
    ProgIndex in (317, 318);

  END IF;

-- - - - - - - - - - - - -
-- AU_20 (TR_AGREEMENTS_AU_20)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* обновление ссылки итогов для государственных контрактов*/
  if ((new$ProgIndex = 305) and (new$AdjustmentNumber = 0) and
  (new$Accepted = 0) and (:old.LastAdjustment = 1) and (new$LastAdjustment = 0)) then
    update tenderresultcaption set
    StateOrder = null
    where
    StateOrder = :old.ID;
  END IF;
  /* обновление ссылки итогов для муниципальных контрактов*/
  if ((new$ProgIndex = 314) and (new$AdjustmentNumber = 0) and
  (new$Accepted = 0) and (:old.LastAdjustment = 1) and (new$LastAdjustment = 0)) then
    update tenderresultcaption set
    StateOrder = null,
    Agreement = null
    where
    StateOrder = :old.ID;
  END IF;
  /* обновление ссылки итогов для договоров*/
  if ((:old.ProgIndex = 304) and (new$AdjustmentNumber = 0) and (new$Accepted = 0) and
  (:old.LastAdjustment = 1) and (new$LastAdjustment = 0)) then
    update tenderresultcaption set
    Agreement = null
    where
    Agreement = :old.ID;
  END IF;

-- - - - - - - - - - - - -
-- AU_30 (TR_AGREEMENTS_AU_30)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if ((new$DocStateRef is null) and /* только для работы без состояний, так как в Новосибирске области даты разнятся */
  ((new$ProgIndex = 304) or (new$ProgIndex = 314)) and 
  ((new$Accepted <> :old.Accepted) or 
  (new$AcceptDate is not null and :old.AcceptDate is null) or 
  (new$AcceptDate is null and :old.AcceptDate is not null) or
  (new$AcceptDate is not null and :old.AcceptDate is not null and new$AcceptDate <> :old.AcceptDate))) then
    update paymentschedule set
    Accepted = new$Accepted,
    AcceptDate = new$AcceptDate
    where AgreementRef=new$ID;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_AGREEMENTS_AU_500)
-- Create 28.04.2005
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   IF (new$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes
                  (TableID, RecordId, DeleteDate
                  )
           VALUES (110, :OLD.ID, SYSDATE
                  );

      DELETE FROM DelRecIndexes
            WHERE (TableID = 110) AND (RecordId = new$ID);
   END IF;

END;
/
commit work
/

-- #########################################################
-- #########################################################
-- Alter_TR_ESTIMATE_BD_10.sql
-- #########################################################
-- #########################################################

/* При смене в контракте (25.04), 
   который был создан по итогам, 
   в состоянии на доработке лицевого счета в заголовке и удалении строки сметы, 
   связь в итогах очищалась только в колонке "договор", 
   а должна была и в колонке "контракт". Исправлено. (Новый Уренгой) */
-- ALTER TRIGGER TR_ESTIMATE_BD_10
CREATE OR REPLACE TRIGGER TR_ESTIMATE_BD
  BEFORE DELETE
  ON ESTIMATE
  FOR EACH ROW
DECLARE
  AgrID1$ NUMBER(10);
  AgrAdjNumber1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_10 (TR_ESTIMATE_BD_10)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if ((:old.ProgIndex = 304) or (:old.ProgIndex = 305) or (:old.ProgIndex = 314)) then
    BEGIN
      /* Выбираем внутренний номер и номер уточнения из заголовка*/
      select ID, AdjustmentNumber
      into AgrID1$, AgrAdjNumber1$             from Agreements
      where (ID = :old.RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* Чистить нужно только для первой версии договора */
    if (AgrAdjNumber1$ = 0) then
      if (:old.ProgIndex in (304, 314)) then
        update TenderResultCaption trc set
        trc.Agreement = null
        where trc.Agreement = AgrID1$

        and exists (select tpd.id from TenderProposalDetail tpd where
        (trc.proposaldetid = tpd.id) and
        (tpd.productcls = :old.ProductCls) and
        (tpd.Price = :old.Price)
        );
      END IF;
      if (:old.ProgIndex in (305, 314)) then
        update TenderResultCaption trc set
        trc.StateOrder = null
        where (trc.StateOrder = AgrID1$)
        and exists (select tpd.id from TenderProposalDetail tpd where
        (trc.proposaldetid = tpd.id) and
        (tpd.productcls = :old.ProductCls) and
        (tpd.Price = :old.Price)
        );
              
      END IF;    
    END IF;
  END IF;

END;
/
commit work
/

-- #########################################################
-- #########################################################
-- Add_BudgetRef_for_PZK.sql
-- #########################################################
-- #########################################################

ALTER TABLE ReplacementClsCaption ADD (
  budgetref NUMBER(10),
    CHECK((budgetref<=2147483647)AND(budgetref>-2147483648)),
  CONSTRAINT FK_REPCLSCAP_BUDGETREF FOREIGN KEY (BUDGETREF) REFERENCES TB_BUDGETS_S (ID)
)
/
CREATE INDEX FK_REPCLSCAP_BUDGETREF ON ReplacementClsCaption(BUDGETREF)
/
ALTER TABLE ReplacementClsDetailInfo ADD (
  budgetref NUMBER(10),
    CHECK((budgetref<=2147483647)AND(budgetref>-2147483648)),
  CONSTRAINT FK_REPCLSDETINFO_BUDGETREF FOREIGN KEY (BUDGETREF) REFERENCES TB_BUDGETS_S (ID)
)
/
CREATE INDEX FK_REPCLSDETINFO_BUDGETREF ON ReplacementClsDetailInfo(BUDGETREF)
/
CREATE OR REPLACE procedure Fill_BudgetRef_PZK
AS
  BudRef$ NUMBER(10);
BEGIN
  GetIntConst(-1, 3,BudRef$);
  update ReplacementClsCaption
  set budgetref = BudRef$

  where budgetref is null;
  update ReplacementClsDetailInfo
  set budgetref = BudRef$

  where budgetref is null;
END;
/
CALL Fill_BudgetRef_PZK()
/
drop procedure Fill_BudgetRef_PZK
/
-- CREATE TRIGGER TR_REPCLSCAPTION_BI_10
CREATE OR REPLACE TRIGGER TR_REPLACEMENTCLSCAPTION_BI
  BEFORE INSERT
  ON REPLACEMENTCLSCAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_REPCLSCAPTION_BI)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  if (:new.id is null) then 
    select g_shared.nextval into :new.id from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_REPCLSCAPTION_BI_10)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if ((:new.BudgetRef is null) or (:new.BudgetRef = 0))
  then 
    GetIntConst(-1, 3,:new.BudgetRef);
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_REPCLSCAPTION_BI_500)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- CREATE TRIGGER TR_REPCLSDETINFO_BI_10
CREATE OR REPLACE TRIGGER TR_REPLACEMENTCLSDETAILINFO_BI
  BEFORE INSERT
  ON REPLACEMENTCLSDETAILINFO
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_RepClsDetailInfo_BI)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  if (:new.id is null) then 
    select g_shared.nextval into :new.id from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_REPCLSDETINFO_BI_10)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  BEGIN
    select 
    rep_c.BudgetRef
    into
    :new.BudgetRef   from 
    ReplacementClsCaption rep_c
    where
    rep_c.id = :new.RecordIndex
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BI_120 (TR_REPLCLSDETINFO_BI_120)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if ((:new.ClsType is NULL) and (:new.IFS <> 0)) then
    :new.ClsType := 1; 
      
  else
    if ((:new.ClsType is NULL) and (:new.KD <> 0)) then
      :new.ClsType := 2; 
          
    else
      if (:new.ClsType is null) then
        :new.ClsType := 0; 
      END IF;
    END IF;
  END IF;
  IF ((:new.ClsType = 0) AND ((:new.IFS <> 0) or (:new.KD <> 0)))THEN 
    RaiseException('EX_WRONGBUDCLS');
  END IF;
  IF ( (:new.ClsType = 1) AND (
  (:new.KVSR <> 0) OR (:new.KFSR <> 0) OR
  (:new.KCSR <> 0) OR (:new.KVR <> 0) OR
  (:new.KESR <> 0) OR (:new.KD <> 0)
  )) 
  THEN 
    RaiseException('EX_WRONGBUDCLS');
  END IF;
  IF ((:new.ClsType = 2) AND (
  (:new.KVSR <> 0) OR (:new.KFSR <> 0) OR
  (:new.KCSR <> 0) OR (:new.KVR <> 0) OR
  (:new.KESR <> 0) OR
  (:new.IFS <> 0)
  )) 
  THEN 
    RaiseException('EX_WRONGBUDCLS');
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_RepClsDetailInfo_BI_500)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- CREATE TRIGGER TR_REPCLSCAPTION_BU_10
CREATE OR REPLACE TRIGGER TR_REPLACEMENTCLSCAPTION_BU
  BEFORE UPDATE
  ON REPLACEMENTCLSCAPTION
  FOR EACH ROW
DECLARE
  DetCount$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_REPLCLSCAPTION_BU)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* документ не может быть одновременно принятым и отклоненным*/
  if ((:new.AcceptDate is not null) and (:new.Reject_Cls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_REPCLSCAPTION_BU_10)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* РїСЂРѕРІРµСЂРєР° РЅР° РёР·РјРµРЅРµРЅРёРµ Р‘СЋРґР¶РµС‚Р° */
  if (:new.BudgetRef <> :old.BudgetRef) then
    if ( not((:new.BudgetRef is null) and (:old.BudgetRef is null)) ) then
      select count(ID)       into DetCount$ from ReplacementClsDetailInfo where RecordIndex = :old.ID
      ;
      if (DetCount$ > 0) then 
        RaiseException('Ex_CantModufyBudget');	
      END IF;
    END IF;
  END IF;

END;
/
COMMIT WORK
/
ALTER TABLE ReplacementClsCaption MODIFY(budgetref NOT NULL)
/
ALTER TABLE ReplacementClsDetailInfo MODIFY(budgetref NOT NULL)
/

-- #########################################################
-- #########################################################
-- add_DepartmentCls_toUnionNotify.sql
-- #########################################################
-- #########################################################

/* добавляет код отдела для UnionNotify*/
ALTER TABLE UNIONNOTIFYCAPTION ADD (
  DEPARTMENTCLS NUMBER(10),
    CHECK((DEPARTMENTCLS<=2147483647)AND(DEPARTMENTCLS>-2147483648))
)
/
commit work
/
ALTER TABLE UNIONNOTIFYCAPTION ADD (
  CONSTRAINT FK_UNIONNOTIFYCAPTION_TRDEPART FOREIGN KEY (DEPARTMENTCLS) REFERENCES DEPARTMENTCLS (ID)
)
/
CREATE INDEX FK_UNIONNOTIFYCAPTION_TRDEPART ON UNIONNOTIFYCAPTION(DEPARTMENTCLS)
/
commit work
/
-- CREATE TRIGGER TR_UNIONNOTIFYCAPTION_BI
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYCAPTION_BI
  BEFORE INSERT
  ON UNIONNOTIFYCAPTION
  FOR EACH ROW
DECLARE
  DocNumber$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_UNIONNOTIFYCAPTION_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if ((:new.BudgetRef is null) or (:new.BudgetRef = 0)) then
    GetIntConst(-1, 3,:new.BudgetRef);
  END IF;
  /* Заполнить счет ДФ по умолчанию */
  if (:new.DFAccount is null) then
    GetDefDFAccRefForBudget(:new.BudgetRef,:new.DFAccount);
  END IF;
      
  if (:new.facialacccls is null) then
    :new.FacialAccCls := 0;
  END IF;
  if ((:new.ProgIndex in (251, 252))and(:new.AcceptDateFK is not null)and(:new.AcceptDate is null)) then
    /* Расходное уведомленией и уведомление по источникам */    
    :new.AcceptDate := :new.AcceptDateFK;
  END IF;
  if ((:new.ProgIndex in (253, 254)) and (:new.AcceptDate is not null)) then
    /* Расходное расписание и Казначейское уведомление */    
    :new.AcceptDateFK := :new.AcceptDate;
  END IF;
  /* документ не может быть одновременно принятым и отклоненным */
  if ((:new.AcceptDate is not null) and (:new.RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;
  if (:new.DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber$); 
    if (DocNumber$ is null) then 
      :new.DepartmentCls:= 0;
          
    else 
      :new.DepartmentCls:= DocNumber$;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_UNIONNOTIFYCAPTION_BI_500)
-- Create 15.02.2006
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;
  :NEW.CreaterUser := USER;
  :NEW.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_UNIONNOTIFYCAPTION_BU
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYCAPTION_BU
  BEFORE UPDATE
  ON UNIONNOTIFYCAPTION
  FOR EACH ROW
DECLARE
  IsReject$ NUMBER(10);
  DocNumber$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_UNIONNOTIFYCAPTION_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if ((:new.BudgetRef is null) or (:new.BudgetRef = 0)) then
    GetIntConst(-1, 3,:new.BudgetRef);
  END IF;
  /* Заполнить счет ДФ по умолчанию */
  if (:new.DFAccount is null) then
    GetDefDFAccRefForBudget(:new.BudgetRef,:new.DFAccount);
  END IF;
  if (:new.facialacccls is null) then
    :new.FacialAccCls := 0;
  END IF;
  if ((:new.ProgIndex in (251, 252))and(:new.AcceptDateFK is not null)and(:new.AcceptDate is null)) then
    /* Расходное уведомленией и уведомление по источникам */    
    :new.AcceptDate := :new.AcceptDateFK;
  END IF;
  if (:new.ProgIndex in (253, 254)) then
    /* Расходное расписание и Казначейское уведомление */
    if (:new.AcceptDate is not null) then
      :new.AcceptDateFK := :new.AcceptDate;
          
    else
      :new.AcceptDateFK := null;
      
    END IF;
  END IF;
  if ((:new.ClsType is not null)and((:old.ClsType is null)or(:new.ClsType <> :old.ClsType))) then
    update UnionNotifyDetail set
    ClsType = :new.ClsType
    where
    RecordIndex = :new.id;
      
  END IF;
  /* документ не может быть одновременно принятым и отклоненным*/
  if ((:new.AcceptDate is not null) and (:new.RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;
  if (:new.DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber$); 
    if (DocNumber$ is null) then 
      :new.DepartmentCls:= 0;
          
    else 
      :new.DepartmentCls:= DocNumber$;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_210 (TR_UNIONNOTIFYCAPTION_BU_210)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Сохранение в базу истории изменений состояний*/
  if (:new.DOCSTATEREF <> :old.DOCSTATEREF) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(:new.id, :old.DOCSTATEREF, :new.DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_UNIONNOTIFYCAPTION_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from UnionNotifyDetail d where d.RecordIndex = :new.id));
  end if;    

-- - - - - - - - - - - - -
-- BU_700 (TR_UNIONNOTIFYCAPTION_BU_700)
-- Create 15.02.2006
-- - - - - - - - - - - - -

  if (:New.RVersion is null) then
    :New.RVersion := 1;
  elsif ((:New.RVersion = -1) and (:Old.RVersion <> -1)) then
    :New.RVersion := :Old.RVersion;
  else
    :New.RVersion := :Old.RVersion + 1;
  end if;

END;
/
commit work 
/
ALTER TRIGGER TR_UNIONNOTIFYCAPTION_BU_500 DISABLE
/
update UNIONNOTIFYCAPTION
  set DepartmentCls = 0
  where departmentcls is null
/
ALTER TRIGGER TR_UNIONNOTIFYCAPTION_BU_500 ENABLE
/
commit work 
/


ALTER TABLE UNIONNOTIFYCAPTION MODIFY(DEPARTMENTCLS NOT NULL)
/

-- #########################################################
-- #########################################################
-- Add_Exeption_and_Trig_for_Fac_Acc.sql
-- #########################################################
-- #########################################################

/* CREATE OR ALTER - не переварил транслятор */
INSERT INTO SqlExceptions(Name, Code, Text) VALUES ('EX_CANNOTDELETE_FACIAL_ACC', -20355, 'Лицевой счет не может быть удален, так как он используется в константах казначейства.')
/
-- CREATE TRIGGER facialacc_cls_bd0
CREATE OR REPLACE TRIGGER TR_FACIALACC_CLS_ID
  INSTEAD OF DELETE
  ON FACIALACC_CLS
  FOR EACH ROW
DECLARE
  CNT$1 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (facialacc_cls_bd0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  SELECT COUNT(CONSTVALUE ) INTO CNT$1
  from INTCONST where ((CONSTVALUE = :old.id)) AND (ROWNUM = 1);
  if ((CNT$1<> 0)) then
    RaiseException('EX_CANNOTDELETE_FACIAL_ACC');
  END IF;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_FACIALACC_CLS
  WHERE ID = :OLD.ID
       AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AD_500 (TR_FACIALACC_CLS_AD_500)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
     VALUES (19, :OLD.ID, SYSDATE);

END;
/
commit work 
/

-- #########################################################
-- #########################################################
-- LayersInsertCRCData.sql
-- #########################################################
-- #########################################################


-- Слой с описанием установленных компонентов

/* <TRANS_COMMAND>

INSERT INTO LAYERTYPES (ID, NAME) VALUES (99000000, 'Платформа')
/

INSERT INTO LAYERS (ID, NAME, ALIAS, LAYERTYPE, TABLENAME, READONLY, USEVERSIONS, MACROSNAME, VERSION, NOTE) VALUES (10, 'УстановленныеКомпоненты', 'Платформа.УстановленныеКомпоненты', 99000000, 'LayerData', 0, 0, NULL, '1.00', NULL)
/

INSERT INTO LAYERFIELDS (ID, RECORDINDEX, PROGINDEX, FIELDNAME, DISPLAYLABEL, DBNAME, FIELDTYPE, FIELDROLE, DEFAULTVALUE, READONLY, REQUIRED, HIDDEN, FIELDSIZE, MASK, CLSNAME, ENUMREF, HANDLERNAME, LINKEDFIELD, LINKEDNAME, AGGREGATEFUNC, FORMULA1, FORMULA2, FIELDPOSITION, WIDTH, VALIDATEVALUES, AGGREGATIONTYPE, NATURALKEY) VALUES (11, 10, 602, 'COMPNAME', 'COMPNAME', 'STRFIELD00', 3, 2, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 50, 0, NULL, NULL)
/
INSERT INTO LAYERFIELDS (ID, RECORDINDEX, PROGINDEX, FIELDNAME, DISPLAYLABEL, DBNAME, FIELDTYPE, FIELDROLE, DEFAULTVALUE, READONLY, REQUIRED, HIDDEN, FIELDSIZE, MASK, CLSNAME, ENUMREF, HANDLERNAME, LINKEDFIELD, LINKEDNAME, AGGREGATEFUNC, FORMULA1, FORMULA2, FIELDPOSITION, WIDTH, VALIDATEVALUES, AGGREGATIONTYPE, NATURALKEY) VALUES (12, 10, 602, 'COMPTYPE', 'COMPTYPE', 'STRFIELD01', 3, 2, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 50, 0, NULL, NULL)
/
INSERT INTO LAYERFIELDS (ID, RECORDINDEX, PROGINDEX, FIELDNAME, DISPLAYLABEL, DBNAME, FIELDTYPE, FIELDROLE, DEFAULTVALUE, READONLY, REQUIRED, HIDDEN, FIELDSIZE, MASK, CLSNAME, ENUMREF, HANDLERNAME, LINKEDFIELD, LINKEDNAME, AGGREGATEFUNC, FORMULA1, FORMULA2, FIELDPOSITION, WIDTH, VALIDATEVALUES, AGGREGATIONTYPE, NATURALKEY) VALUES (13, 10, 602, 'COMPVER', 'COMPVER', 'STRFIELD02', 3, 2, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 50, 0, NULL, NULL)
/
INSERT INTO LAYERFIELDS (ID, RECORDINDEX, PROGINDEX, FIELDNAME, DISPLAYLABEL, DBNAME, FIELDTYPE, FIELDROLE, DEFAULTVALUE, READONLY, REQUIRED, HIDDEN, FIELDSIZE, MASK, CLSNAME, ENUMREF, HANDLERNAME, LINKEDFIELD, LINKEDNAME, AGGREGATEFUNC, FORMULA1, FORMULA2, FIELDPOSITION, WIDTH, VALIDATEVALUES, AGGREGATIONTYPE, NATURALKEY) VALUES (14, 10, 602, 'COMPCRC32', 'COMPCRC32', 'STRFIELD03', 3, 2, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 50, 0, NULL, NULL)
/

COMMIT WORK
/
*/
-- <TRANS_IGNORE>
DECLARE
  v_exists INTEGER;
BEGIN
  SELECT COUNT(*)
  INTO v_exists
  FROM Layers
  WHERE ID = 10;
  IF (v_exists = 0) THEN
    SELECT COUNT(*)
    INTO v_exists
    FROM LayerTypes
    WHERE ID = 99000000;
    IF (v_exists = 0) THEN
      EXECUTE IMMEDIATE 'INSERT INTO LAYERTYPES (ID, NAME) VALUES (99000000, ''Платформа'')';
    END IF;
    EXECUTE IMMEDIATE 'INSERT INTO LAYERS (ID, NAME, ALIAS, LAYERTYPE, TABLENAME, READONLY, USEVERSIONS, MACROSNAME, VERSION, NOTE) VALUES (10, ''УстановленныеКомпоненты'', ''Платформа.УстановленныеКомпоненты'', 99000000, ''LayerData'', 0, 0, NULL, ''1.00'', NULL)';
    EXECUTE IMMEDIATE 'INSERT INTO LAYERFIELDS (ID, RECORDINDEX, PROGINDEX, FIELDNAME, DISPLAYLABEL, DBNAME, FIELDTYPE, FIELDROLE, DEFAULTVALUE, READONLY, REQUIRED, HIDDEN, FIELDSIZE, MASK, CLSNAME, ENUMREF, HANDLERNAME, LINKEDFIELD, LINKEDNAME, AGGREGATEFUNC, FORMULA1, FORMULA2, FIELDPOSITION, WIDTH, VALIDATEVALUES, AGGREGATIONTYPE, NATURALKEY) VALUES (11, 10, 602, ''COMPNAME'', ''COMPNAME'', ''STRFIELD00'', 3, 2, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 50, 0, NULL, NULL)';
    EXECUTE IMMEDIATE 'INSERT INTO LAYERFIELDS (ID, RECORDINDEX, PROGINDEX, FIELDNAME, DISPLAYLABEL, DBNAME, FIELDTYPE, FIELDROLE, DEFAULTVALUE, READONLY, REQUIRED, HIDDEN, FIELDSIZE, MASK, CLSNAME, ENUMREF, HANDLERNAME, LINKEDFIELD, LINKEDNAME, AGGREGATEFUNC, FORMULA1, FORMULA2, FIELDPOSITION, WIDTH, VALIDATEVALUES, AGGREGATIONTYPE, NATURALKEY) VALUES (12, 10, 602, ''COMPTYPE'', ''COMPTYPE'', ''STRFIELD01'', 3, 2, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 50, 0, NULL, NULL)';
    EXECUTE IMMEDIATE 'INSERT INTO LAYERFIELDS (ID, RECORDINDEX, PROGINDEX, FIELDNAME, DISPLAYLABEL, DBNAME, FIELDTYPE, FIELDROLE, DEFAULTVALUE, READONLY, REQUIRED, HIDDEN, FIELDSIZE, MASK, CLSNAME, ENUMREF, HANDLERNAME, LINKEDFIELD, LINKEDNAME, AGGREGATEFUNC, FORMULA1, FORMULA2, FIELDPOSITION, WIDTH, VALIDATEVALUES, AGGREGATIONTYPE, NATURALKEY) VALUES (13, 10, 602, ''COMPVER'', ''COMPVER'', ''STRFIELD02'', 3, 2, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 50, 0, NULL, NULL)';
    EXECUTE IMMEDIATE 'INSERT INTO LAYERFIELDS (ID, RECORDINDEX, PROGINDEX, FIELDNAME, DISPLAYLABEL, DBNAME, FIELDTYPE, FIELDROLE, DEFAULTVALUE, READONLY, REQUIRED, HIDDEN, FIELDSIZE, MASK, CLSNAME, ENUMREF, HANDLERNAME, LINKEDFIELD, LINKEDNAME, AGGREGATEFUNC, FORMULA1, FORMULA2, FIELDPOSITION, WIDTH, VALIDATEVALUES, AGGREGATIONTYPE, NATURALKEY) VALUES (14, 10, 602, ''COMPCRC32'', ''COMPCRC32'', ''STRFIELD03'', 3, 2, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 50, 0, NULL, NULL)';
    EXECUTE IMMEDIATE 'COMMIT WORK';
  END IF;
END;
/



-- #########################################################
-- #########################################################
-- Alter_LayerData_AddBudgetRef.sql
-- #########################################################
-- #########################################################


/* <TRANS_COMMAND>
  ALTER TABLE LAYERS
      ADD isMultiBudget NUMBER(5,0)
  /
  ALTER TABLE LAYERDATA
    ADD BUDGETREF NUMBER(10,0);
  /
  ALTER TABLE LAYERDATA ADD(
    CHECK((BUDGETREF<=2147483647)AND(BUDGETREF>-2147483648))
  );
  /
  CREATE INDEX IDX_LAYERDATA_BUDGETREF ON LAYERDATA (BUDGETREF);
  /
  COMMIT WORK
/
*/
-- <TRANS_IGNORE>

DECLARE 
  v_exists integer;
BEGIN
  SELECT count(*) 
    INTO v_exists
    FROM USER_TAB_COLUMNS 
    WHERE TABLE_NAME='LAYERDATA' AND COLUMN_NAME='BUDGETREF';
  IF (v_exists=0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA
      ADD BUDGETREF NUMBER(10,0)';
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERS
      ADD isMultiBudget NUMBER(5,0)';
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA ADD(
      CHECK((BUDGETREF<=2147483647)AND(BUDGETREF>-2147483648))
    )';
    EXECUTE IMMEDIATE 'CREATE INDEX IDX_LAYERDATA_BUDGETREF ON LAYERDATA (BUDGETREF)';
    EXECUTE IMMEDIATE 'COMMIT WORK';
  END IF;
END;
/


-- #########################################################
-- #########################################################
-- Upd_DevInterfaces.sql
-- #########################################################
-- #########################################################

/* Скрываем некоторые интерфейсы для всех кроме разработчиков */
update Workplaces_Interface set
  OrderBy = -1001
where
  Interfaces_Ref in (select id from Interfaces where GUID = '{031D78FC-AFEA-4961-9615-B88E04E4CD93}')
/
commit work
/


-- #########################################################
-- #########################################################
-- add_TC_AgreementExecutionDate.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет поле Дата исполнения контракта (AgreementExecutionDate) в таблицу планов-графиков (TenderCaption) */
ALTER TABLE TB_TenderCaption ADD (
  AgreementExecutionDate NUMBER/* Дата исполнения контракта */
)
/

CREATE OR REPLACE VIEW TenderCaption (
  ID,
  BUDGETREF,
  FACIALACCCLS,
  MULTIPURPOSE,
  DOCUMENTDATE,
  ACCEPTDATE,
  PERIOD,
  ACCEPTSUMMA,
  SALETYPE,
  REJECTCLS,
  REJECTCAUSE,
  CRYPTOSTATUS,
  SENDERID,
  SENDERRECORDID,
  DOCSTATEREF,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  LASTADJUSTMENT,
  LASTACCEPTED,
  ADJUSTMENTREF,
  ACCEPTED,
  EXPORTDATE,
  YEARACCEPTSUMMA,
  TENDEROPTION,
  TENDERTARGET,
  RVERSION,
  ALLOWANCE,
  REFINEMENTCAUSE,
  PREFERENCE,
  PREFERENCESIZE,
  SECURITY,
  UNKNOWNAMOUNT,
  PERIODYEAR,
  SUPPORTUNDERTAKER,
  AYEAR,
  REWORKCAUSE,
  NOTE,
  REALID,
  INNERNUMBER,
  ADJUSTMENTNUMBER,
  SENDERIDKEY,
  SENDERRECORDIDKEY,
  PROTOCOLREASON,
  PROGINDEX,
  DOCNUMBER,
  SECURITYTSIZE,
  SECURITYASIZE,
  AVANSSIZE,
  PREFERENCECRIPPLE,
  PREFERENCERUSPRODUCT,
  PREFERENCEPRISON,
  PURCHASESOCIALNKO,
  AGREEMENTEXECUTIONDATE)
AS
  SELECT
    ID,
    BUDGETREF,
    FACIALACCCLS,
    MULTIPURPOSE,
    DOCUMENTDATE,
    ACCEPTDATE,
    PERIOD,
    ACCEPTSUMMA,
    SALETYPE,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    DOCSTATEREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    LASTADJUSTMENT,
    LASTACCEPTED,
    ADJUSTMENTREF,
    ACCEPTED,
    EXPORTDATE,
    YEARACCEPTSUMMA,
    TENDEROPTION,
    TENDERTARGET,
    RVERSION,
    ALLOWANCE,
    REFINEMENTCAUSE,
    PREFERENCE,
    PREFERENCESIZE,
    SECURITY,
    UNKNOWNAMOUNT,
    PERIODYEAR,
    SUPPORTUNDERTAKER,
    AYEAR,
    REWORKCAUSE,
    NOTE,
    REALID,
    INNERNUMBER,
    ADJUSTMENTNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    PROTOCOLREASON,
    PROGINDEX,
    DOCNUMBER,
    SECURITYTSIZE,
    SECURITYASIZE,
    AVANSSIZE,
    PREFERENCECRIPPLE,
    PREFERENCERUSPRODUCT,
    PREFERENCEPRISON,
    PURCHASESOCIALNKO,
    AGREEMENTEXECUTIONDATE
  FROM TB_TenderCaption
/

CREATE OR REPLACE TRIGGER TR_TENDERCAPTION_ID
  INSTEAD OF DELETE
  ON TENDERCAPTION
  FOR EACH ROW
DECLARE
  cnt$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_TENDERCAPTION_BD)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.1 */
  select count(ID) into cnt$ from TenderCaption where (AdjustmentRef = :old.ID) ;
  /* Удалять можно только документы, у которых нет уточнений*/
  if (cnt$ = 0) then
    delete from TenderSupDocument where (RecordIndex = :old.ID);
    delete from TenderYardsticks where (RecordIndex = :old.ID);
    delete from TenderSourceOrg where (RecordIndex = :old.ID);
    delete from TenderContacts where (RecordIndex = :old.ID);
    delete from TenderSupplements where (RecordIndex = :old.ID);        
    delete from TenderProduct where (RecordIndex = :old.ID);
    delete from TenderLot where (RecordIndex = :old.ID);
        
  else
    RaiseException('EX_Ten_CantDelAdjustmented');
  END IF;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_TENDERCAPTION
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_0 (TR_TenderCaption_AD)
-- Last update 06.08.2010
-- - - - - - - - - - - - -

  delete from TENDERPRODUCT where (RecordIndex = :old.ID);
  delete from TenderSourceOrg where (RecordIndex = :old.ID);

-- - - - - - - - - - - - -
-- AD_10 (TR_TENDERCAPTION_AD_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Восстановление флага LastAdjustment у предыдущей записи в цепочке*/
  if ((:old.AdjustmentNumber > 0) and (:old.LastAdjustment = 1)) then
    update TenderCaption set
    LastAdjustment = 1,
    RVersion = -1
    where (ID = :old.AdjustmentRef);
  END IF;
  /* Восстановление флага LastAccepted у предыдущей записи в цепочке*/    
  if ((:old.AdjustmentNumber > 0) and (:old.LastAccepted = 1)) then
    update TenderCaption set
    LastAccepted = 1,
    RVersion = -1
    where (ID = :old.AdjustmentRef);
  END IF;

-- - - - - - - - - - - - -
-- AD_200 (TR_TENDERCAPTION_AD_200)
-- Create 03.12.2004
-- Last update 25.05.2005
-- - - - - - - - - - - - -

  /*  Удаление истории изменений состоний для удаленного документа */
  delete from StateJumpHistory where DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_500 (TR_TENDERCAPTION_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordId, DeleteDate, ProgIndex) values (139, :old.ID, SYSDATE, :old.ProgIndex);

END;
/

CREATE OR REPLACE TRIGGER TR_TENDERCAPTION_II
  INSTEAD OF INSERT
  ON TENDERCAPTION
  FOR EACH ROW
DECLARE
  new$ID TENDERCAPTION.ID%TYPE := :NEW.ID;
  new$BUDGETREF TENDERCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$FACIALACCCLS TENDERCAPTION.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$MULTIPURPOSE TENDERCAPTION.MULTIPURPOSE%TYPE := :NEW.MULTIPURPOSE;
  new$DOCUMENTDATE TENDERCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE TENDERCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$PERIOD TENDERCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$ACCEPTSUMMA TENDERCAPTION.ACCEPTSUMMA%TYPE := :NEW.ACCEPTSUMMA;
  new$SALETYPE TENDERCAPTION.SALETYPE%TYPE := :NEW.SALETYPE;
  new$REJECTCLS TENDERCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE TENDERCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS TENDERCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID TENDERCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID TENDERCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DOCSTATEREF TENDERCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CREATERUSER TENDERCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE TENDERCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE TENDERCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER TENDERCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$LASTADJUSTMENT TENDERCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$LASTACCEPTED TENDERCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$ADJUSTMENTREF TENDERCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ACCEPTED TENDERCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$EXPORTDATE TENDERCAPTION.EXPORTDATE%TYPE := :NEW.EXPORTDATE;
  new$YEARACCEPTSUMMA TENDERCAPTION.YEARACCEPTSUMMA%TYPE := :NEW.YEARACCEPTSUMMA;
  new$TENDEROPTION TENDERCAPTION.TENDEROPTION%TYPE := :NEW.TENDEROPTION;
  new$TENDERTARGET TENDERCAPTION.TENDERTARGET%TYPE := :NEW.TENDERTARGET;
  new$RVERSION TENDERCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$ALLOWANCE TENDERCAPTION.ALLOWANCE%TYPE := :NEW.ALLOWANCE;
  new$REFINEMENTCAUSE TENDERCAPTION.REFINEMENTCAUSE%TYPE := :NEW.REFINEMENTCAUSE;
  new$PREFERENCE TENDERCAPTION.PREFERENCE%TYPE := :NEW.PREFERENCE;
  new$PREFERENCESIZE TENDERCAPTION.PREFERENCESIZE%TYPE := :NEW.PREFERENCESIZE;
  new$SECURITY TENDERCAPTION.SECURITY%TYPE := :NEW.SECURITY;
  new$UNKNOWNAMOUNT TENDERCAPTION.UNKNOWNAMOUNT%TYPE := :NEW.UNKNOWNAMOUNT;
  new$PERIODYEAR TENDERCAPTION.PERIODYEAR%TYPE := :NEW.PERIODYEAR;
  new$SUPPORTUNDERTAKER TENDERCAPTION.SUPPORTUNDERTAKER%TYPE := :NEW.SUPPORTUNDERTAKER;
  new$AYEAR TENDERCAPTION.AYEAR%TYPE := :NEW.AYEAR;
  new$REWORKCAUSE TENDERCAPTION.REWORKCAUSE%TYPE := :NEW.REWORKCAUSE;
  new$NOTE TENDERCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$REALID TENDERCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER TENDERCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTNUMBER TENDERCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$SENDERIDKEY TENDERCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY TENDERCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$PROTOCOLREASON TENDERCAPTION.PROTOCOLREASON%TYPE := :NEW.PROTOCOLREASON;
  new$PROGINDEX TENDERCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$DOCNUMBER TENDERCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SECURITYTSIZE TENDERCAPTION.SECURITYTSIZE%TYPE := :NEW.SECURITYTSIZE;
  new$SECURITYASIZE TENDERCAPTION.SECURITYASIZE%TYPE := :NEW.SECURITYASIZE;
  new$AVANSSIZE TENDERCAPTION.AVANSSIZE%TYPE := :NEW.AVANSSIZE;
  new$PREFERENCECRIPPLE TENDERCAPTION.PREFERENCECRIPPLE%TYPE := :NEW.PREFERENCECRIPPLE;
  new$PREFERENCERUSPRODUCT TENDERCAPTION.PREFERENCERUSPRODUCT%TYPE := :NEW.PREFERENCERUSPRODUCT;
  new$PREFERENCEPRISON TENDERCAPTION.PREFERENCEPRISON%TYPE := :NEW.PREFERENCEPRISON;
  new$PURCHASESOCIALNKO TENDERCAPTION.PURCHASESOCIALNKO%TYPE := :NEW.PURCHASESOCIALNKO;
  new$AGREEMENTEXECUTIONDATE TENDERCAPTION.AGREEMENTEXECUTIONDATE%TYPE := :NEW.AGREEMENTEXECUTIONDATE;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  CurVal$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_TENDERCAPTION_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$FacialAccCls is null) then 
    new$FacialAccCls := 0;
  END IF;
  /* задействовано в качестве Основания по закону в планах (Новый Уренгой) */
  if (new$ProgIndex = 230 and new$Multipurpose is null) then 
    new$Multipurpose := 0;
  END IF;
  if (new$AcceptSumma is null) then 
    new$AcceptSumma := 0;
  END IF;
  if (new$YearAcceptSumma is null) then 
    new$YearAcceptSumma := 0;
  END IF;
  if (new$Allowance is null) then 
    new$Allowance := 0;
  END IF;
      
  /* Заполнение Бюджета. Если пустой или ноль, берем из лицевого счета */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    BEGIN
      select fa.BudgetRef       into new$BudgetRef from FacialAcc_Cls fa
      where fa.Id = new$FacialAccCls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    GetIntConst(-1,3,new$BudgetRef);
  END IF;
      
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$SaleType is null) then 
    new$SaleType := 0;
  END IF;
  if (new$TenderOption is null) then 
    new$TenderOption := 0;
  END IF;
  if (new$InnerNumber is Null) then 
    new$InnerNumber := GEN_ID('G_TenderInnerNumber',1);
  END IF;
  if (new$RefinementCause is Null) then 
    new$RefinementCause := 0;
  END IF;
  if (new$Preference is Null) then 
    new$Preference := 0;
  END IF;
  if (new$UnknownAmount is null) then 
    new$UnknownAmount := 0;
  END IF;
  if (new$SupportUndertaker is null) then 
    new$SupportUndertaker := 0;
  END IF;
  if (new$PurchaseSocialNKO is null) then 
    new$PurchaseSocialNKO := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_TENDERCAPTION_BI_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* только для работы без состояний, так как при работе по схеме причину отклонения могут заполнить еще в не отклоненном документе */
  if (new$DocStateRef is null) then
    if (new$AcceptDate is null or new$RejectCls is null) then
      new$Accepted := 1;
          
    else
      new$Accepted := 0;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_TENDERCAPTION_BI_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
      
  /* Проверка указания внутренних номеров.*/
  if (new$InnerNumber is null) then
    RaiseException('EX_Ten_InnerNumsIsNull');
  END IF;
      
  /* Получение внутреннего номера уточнения*/  
  select max(AdjustmentNumber)
  into Tmp$         from TenderCaption 
  where (InnerNumber = new$InnerNumber)
  ;
  /* Если это первая запись в цепочке, тогда устанавливаем 0*/   
  if (Tmp$ is null) then
    new$AdjustmentNumber := 0;
        
  else
    new$AdjustmentNumber := Tmp$ + 1;    
  END IF;
      
  /* Флаг последнего уточнения устанавливается в единицу при вставке, только если уточнение не отклонено*/
  if ((new$Accepted = 0) and (new$AcceptDate is not null)) then
    new$LastAdjustment := 0;
        
  else
    new$LastAdjustment := 1;
  END IF;
      
  /* Если документ принят, тогда устанавливаем флаг последнего принятого в цепочке*/
  if ((new$AcceptDate is not null) and (new$Accepted = 1)) then 
    new$LastAccepted := 1;
        
  else
    new$LastAccepted := 0;
  END IF;
          
  /* Если документ является уточнением*/
  if (new$AdjustmentNumber > 0) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID) 
    into Tmp$, AdjID$             from TenderCaption 
    where (InnerNumber = new$InnerNumber) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/    
    if (Tmp$ <> 1) then 
      RaiseException('EX_Ten_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID) 
    into Tmp$             from TenderCaption
    where (InnerNumber = new$InnerNumber) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then 
      RaiseException('EX_Ten_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/        
    new$AdjustmentRef := AdjID$;
        
  else /* Если договор не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/        
    new$AdjustmentRef := null;
        
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (TR_TENDERCAPTION_BI_40)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$senderId is null) then 
    new$senderIdKey := -1;
      
  else 
    new$senderIdKey := new$senderId;
  END IF;
  if (new$SenderRecordID is null) then
    new$SenderRecordIDKey := new$ID;
      
  else 
    new$SenderRecordIDKey := new$SenderRecordID;
  END IF;

-- - - - - - - - - - - - -
-- BI_50 (TR_TENDERCAPTION_BI_50)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  if (new$InnerNumber is not null) then
    CurVal$ := GEN_ID('G_TENDERINNERNUMBER',0);
    if (CurVal$ < new$InnerNumber) then
      CurVal$ := GEN_ID('G_TENDERINNERNUMBER',new$InnerNumber - CurVal$);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_TENDERCAPTION_BI_500)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_TENDERCAPTION (
    ID,
    BUDGETREF,
    FACIALACCCLS,
    MULTIPURPOSE,
    DOCUMENTDATE,
    ACCEPTDATE,
    PERIOD,
    ACCEPTSUMMA,
    SALETYPE,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    DOCSTATEREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    LASTADJUSTMENT,
    LASTACCEPTED,
    ADJUSTMENTREF,
    ACCEPTED,
    EXPORTDATE,
    YEARACCEPTSUMMA,
    TENDEROPTION,
    TENDERTARGET,
    RVERSION,
    ALLOWANCE,
    REFINEMENTCAUSE,
    PREFERENCE,
    PREFERENCESIZE,
    SECURITY,
    UNKNOWNAMOUNT,
    PERIODYEAR,
    SUPPORTUNDERTAKER,
    AYEAR,
    REWORKCAUSE,
    NOTE,
    REALID,
    INNERNUMBER,
    ADJUSTMENTNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    PROTOCOLREASON,
    PROGINDEX,
    DOCNUMBER,
    SECURITYTSIZE,
    SECURITYASIZE,
    AVANSSIZE,
    PREFERENCECRIPPLE,
    PREFERENCERUSPRODUCT,
    PREFERENCEPRISON,
    PURCHASESOCIALNKO,
    AGREEMENTEXECUTIONDATE
  ) VALUES (
    new$ID,
    new$BUDGETREF,
    new$FACIALACCCLS,
    new$MULTIPURPOSE,
    new$DOCUMENTDATE,
    new$ACCEPTDATE,
    new$PERIOD,
    new$ACCEPTSUMMA,
    new$SALETYPE,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$DOCSTATEREF,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$LASTADJUSTMENT,
    new$LASTACCEPTED,
    new$ADJUSTMENTREF,
    new$ACCEPTED,
    new$EXPORTDATE,
    new$YEARACCEPTSUMMA,
    new$TENDEROPTION,
    new$TENDERTARGET,
    new$RVERSION,
    new$ALLOWANCE,
    new$REFINEMENTCAUSE,
    new$PREFERENCE,
    new$PREFERENCESIZE,
    new$SECURITY,
    new$UNKNOWNAMOUNT,
    new$PERIODYEAR,
    new$SUPPORTUNDERTAKER,
    new$AYEAR,
    new$REWORKCAUSE,
    new$NOTE,
    new$REALID,
    new$INNERNUMBER,
    new$ADJUSTMENTNUMBER,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$PROTOCOLREASON,
    new$PROGINDEX,
    new$DOCNUMBER,
    new$SECURITYTSIZE,
    new$SECURITYASIZE,
    new$AVANSSIZE,
    new$PREFERENCECRIPPLE,
    new$PREFERENCERUSPRODUCT,
    new$PREFERENCEPRISON,
    new$PURCHASESOCIALNKO,
    new$AGREEMENTEXECUTIONDATE);

-- - - - - - - - - - - - -
-- AI_10 (TR_TENDERCAPTION_AI_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Коррекция вспомогательных флагов в уточняемой записи*/
  if ((new$AdjustmentNumber > 0) and (new$LastAdjustment = 1)) then
    update TenderCaption set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);            
    if (new$LastAccepted = 1) then
      update TenderCaption set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_TENDERCAPTION_AI_500)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

   DELETE FROM delrecindexes
         WHERE (tableid = 139) AND (recordid = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_TENDERCAPTION_IU
  INSTEAD OF UPDATE
  ON TENDERCAPTION
  FOR EACH ROW
DECLARE
  new$ID TENDERCAPTION.ID%TYPE := :NEW.ID;
  new$BUDGETREF TENDERCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$FACIALACCCLS TENDERCAPTION.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$MULTIPURPOSE TENDERCAPTION.MULTIPURPOSE%TYPE := :NEW.MULTIPURPOSE;
  new$DOCUMENTDATE TENDERCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE TENDERCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$PERIOD TENDERCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$ACCEPTSUMMA TENDERCAPTION.ACCEPTSUMMA%TYPE := :NEW.ACCEPTSUMMA;
  new$SALETYPE TENDERCAPTION.SALETYPE%TYPE := :NEW.SALETYPE;
  new$REJECTCLS TENDERCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE TENDERCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS TENDERCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID TENDERCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID TENDERCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DOCSTATEREF TENDERCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CREATERUSER TENDERCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE TENDERCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE TENDERCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER TENDERCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$LASTADJUSTMENT TENDERCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$LASTACCEPTED TENDERCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$ADJUSTMENTREF TENDERCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ACCEPTED TENDERCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$EXPORTDATE TENDERCAPTION.EXPORTDATE%TYPE := :NEW.EXPORTDATE;
  new$YEARACCEPTSUMMA TENDERCAPTION.YEARACCEPTSUMMA%TYPE := :NEW.YEARACCEPTSUMMA;
  new$TENDEROPTION TENDERCAPTION.TENDEROPTION%TYPE := :NEW.TENDEROPTION;
  new$TENDERTARGET TENDERCAPTION.TENDERTARGET%TYPE := :NEW.TENDERTARGET;
  new$RVERSION TENDERCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$ALLOWANCE TENDERCAPTION.ALLOWANCE%TYPE := :NEW.ALLOWANCE;
  new$REFINEMENTCAUSE TENDERCAPTION.REFINEMENTCAUSE%TYPE := :NEW.REFINEMENTCAUSE;
  new$PREFERENCE TENDERCAPTION.PREFERENCE%TYPE := :NEW.PREFERENCE;
  new$PREFERENCESIZE TENDERCAPTION.PREFERENCESIZE%TYPE := :NEW.PREFERENCESIZE;
  new$SECURITY TENDERCAPTION.SECURITY%TYPE := :NEW.SECURITY;
  new$UNKNOWNAMOUNT TENDERCAPTION.UNKNOWNAMOUNT%TYPE := :NEW.UNKNOWNAMOUNT;
  new$PERIODYEAR TENDERCAPTION.PERIODYEAR%TYPE := :NEW.PERIODYEAR;
  new$SUPPORTUNDERTAKER TENDERCAPTION.SUPPORTUNDERTAKER%TYPE := :NEW.SUPPORTUNDERTAKER;
  new$AYEAR TENDERCAPTION.AYEAR%TYPE := :NEW.AYEAR;
  new$REWORKCAUSE TENDERCAPTION.REWORKCAUSE%TYPE := :NEW.REWORKCAUSE;
  new$NOTE TENDERCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$REALID TENDERCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER TENDERCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTNUMBER TENDERCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$SENDERIDKEY TENDERCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY TENDERCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$PROTOCOLREASON TENDERCAPTION.PROTOCOLREASON%TYPE := :NEW.PROTOCOLREASON;
  new$PROGINDEX TENDERCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$DOCNUMBER TENDERCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SECURITYTSIZE TENDERCAPTION.SECURITYTSIZE%TYPE := :NEW.SECURITYTSIZE;
  new$SECURITYASIZE TENDERCAPTION.SECURITYASIZE%TYPE := :NEW.SECURITYASIZE;
  new$AVANSSIZE TENDERCAPTION.AVANSSIZE%TYPE := :NEW.AVANSSIZE;
  new$PREFERENCECRIPPLE TENDERCAPTION.PREFERENCECRIPPLE%TYPE := :NEW.PREFERENCECRIPPLE;
  new$PREFERENCERUSPRODUCT TENDERCAPTION.PREFERENCERUSPRODUCT%TYPE := :NEW.PREFERENCERUSPRODUCT;
  new$PREFERENCEPRISON TENDERCAPTION.PREFERENCEPRISON%TYPE := :NEW.PREFERENCEPRISON;
  new$PURCHASESOCIALNKO TENDERCAPTION.PURCHASESOCIALNKO%TYPE := :NEW.PURCHASESOCIALNKO;
  new$AGREEMENTEXECUTIONDATE TENDERCAPTION.AGREEMENTEXECUTIONDATE%TYPE := :NEW.AGREEMENTEXECUTIONDATE;
--
  CurVal$ NUMBER(10);
  DetCount$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_TENDERCAPTION_BU_0)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$FacialAccCls is null) then 
    new$FacialAccCls := 0;
  END IF;
  /* задействовано в качестве Основания по закону в планах (Новый Уренгой) */
  if (new$ProgIndex = 230 and new$Multipurpose is null) then 
    new$Multipurpose := 0;
  END IF;
  if (new$AcceptSumma is null) then 
    new$AcceptSumma := 0;
  END IF;
  if (new$YearAcceptSumma is null) then 
    new$YearAcceptSumma := 0;
  END IF;
  if (new$Allowance is null) then 
    new$Allowance := 0;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if (not((new$BudgetRef is null) and (:old.BudgetRef is null))) then
      select count(ID)         into DetCount$ from TENDERSOURCEORG where RecordIndex = :old.ID
      ;
      if (DetCount$ > 0) then 
        RaiseException('Ex_CantModufyBudget');
      else
        select count(ID)         into DetCount$ from TENDERCONTACTS where RecordIndex = :old.ID
        ;
      END IF;
      if (DetCount$ > 0) then 
        RaiseException('Ex_CantModufyBudget');
      else
        select count(ID)         into DetCount$ from TENDERSUPDOCUMENT where RecordIndex = :old.ID
        ;
      END IF;
      if (DetCount$ > 0) then 
        RaiseException('Ex_CantModufyBudget');
      else
        select count(ID)         into DetCount$ from TENDERSUPPLEMENTS where RecordIndex = :old.ID
        ;
      END IF;
      if (DetCount$ > 0) then 
        RaiseException('Ex_CantModufyBudget');
      else
        select count(ID)         into DetCount$ from TENDERYARDSTICKS where RecordIndex = :old.ID
        ;
      END IF;
      if (DetCount$ > 0) then 
        RaiseException('Ex_CantModufyBudget');
      else
        select count(ID)         into DetCount$ from TenderLot where RecordIndex = :old.ID
        ;
      END IF;
      if (DetCount$ > 0) then 
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  if (new$SaleType is null) then 
    new$SaleType := 0;
  END IF;
  if (new$TenderOption is null) then 
    new$TenderOption := 0;
  END IF;
  if (new$InnerNumber is Null) then 
    new$InnerNumber := GEN_ID('G_TenderInnerNumber',1);
  END IF;
  if (new$RefinementCause is Null) then 
    new$RefinementCause := 0;
  END IF;
  if (new$Preference is Null) then 
    new$Preference := 0;
  END IF;
  if (new$UnknownAmount is null) then 
    new$UnknownAmount := 0;
  END IF;
  if (new$SupportUndertaker is null) then 
    new$SupportUndertaker := 0;
  END IF;

-- - - - - - - - - - - - -
-- BU_3 (TR_TENDERCAPTION_BU_3)
-- Create 03.12.2004
-- Last update 25.05.2005
-- - - - - - - - - - - - -

   /*  Это поле проставляется при вставке и никогда не может изменить значение */
   new$AdjustmentRef := :OLD.AdjustmentRef;

-- - - - - - - - - - - - -
-- BU_5 (TR_TENDERCAPTION_BU_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* только для работы без состояний, так как при работе по схеме причину отклонения могут заполнить еще в не отклоненном документе */
  if (new$DocStateRef is null) then
    if (new$AcceptDate is null or new$RejectCls is null) then
      new$Accepted := 1;
          
    else
      new$Accepted := 0;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_TENDERCAPTION_BU_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  if ((new$InnerNumber <> :old.InnerNumber) or
  (new$AdjustmentNumber <> :old.AdjustmentNumber)) then
    RaiseException('EX_AGR_CHANGEINNERNUMS');
  END IF;
      
  /* Отменять отклонение нельзя!!!*/
  if (((:old.AcceptDate is not null) and (:old.Accepted = 0)) and 
  ((new$Accepted = 1) or (new$AcceptDate is null))) then
    RaiseException('EX_RollbackCancel');
  END IF;
      
  /* Если приняли, тогда необходимо установить флаг LastAccepted*/
  if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 1)) or 
  ((:old.Accepted = 0) and (new$Accepted = 1) and (new$AcceptDate is not null))) then
    /* Менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (new$LastAdjustment = 1) then
      new$LastAccepted := 1;
              
    else
      RaiseException('EX_Ten_ChangeStateAdjust');    
    END IF;
  END IF;
      
  /* Если отменили принятие документа, тогда необходимо снять флаг LastAccepted*/
  if (((:old.AcceptDate is not null) and (:old.Accepted = 1)) and
  ((new$Accepted = 0) or (new$AcceptDate is null))) then
    /* Менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (new$LastAdjustment = 1) then
      new$LastAccepted := 0;
              
    else
      RaiseException('EX_Ten_ChangeStateAdjust');    
    END IF;
  END IF;
      
  /* Если отклонили документ, тогда необходимо скинуть флаг LastAdjustment*/
  if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 0)) or 
  ((:old.Accepted = 1) and (new$Accepted = 0) and (new$AcceptDate is not null))) then
    if (new$LastAdjustment = 1) then
      new$LastAdjustment := 0;
      new$LastAccepted := 0;
              
    else
      RaiseException('EX_Ten_ChangeStateAdjust');    
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_50 (TR_TENDERCAPTION_BU_50)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  if (new$InnerNumber is not null) then
    CurVal$ := GEN_ID('G_TENDERINNERNUMBER',0);
    if (CurVal$ < new$InnerNumber) then
      CurVal$ := GEN_ID('G_TENDERINNERNUMBER',new$InnerNumber - CurVal$);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_TENDERCAPTION_BU_200)
-- Create 03.12.2004
-- Last update 25.05.2005
-- - - - - - - - - - - - -

   /*  Сохранение в базу истории изменений состояний */
   IF (new$DocStateRef <> :OLD.DocStateRef) THEN
      INSERT INTO StateJumpHistory(DocID, BeginStateRef, EndStateRef)
        VALUES (new$ID, :OLD.DocStateRef, new$DocStateRef);
   END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_TENDERCAPTION_BU_700)
-- Create 14.10.2004
-- Last update 25.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_TENDERCAPTION SET
    ID = new$ID,
    BUDGETREF = new$BUDGETREF,
    FACIALACCCLS = new$FACIALACCCLS,
    MULTIPURPOSE = new$MULTIPURPOSE,
    DOCUMENTDATE = new$DOCUMENTDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    PERIOD = new$PERIOD,
    ACCEPTSUMMA = new$ACCEPTSUMMA,
    SALETYPE = new$SALETYPE,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    DOCSTATEREF = new$DOCSTATEREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    LASTACCEPTED = new$LASTACCEPTED,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    ACCEPTED = new$ACCEPTED,
    EXPORTDATE = new$EXPORTDATE,
    YEARACCEPTSUMMA = new$YEARACCEPTSUMMA,
    TENDEROPTION = new$TENDEROPTION,
    TENDERTARGET = new$TENDERTARGET,
    RVERSION = new$RVERSION,
    ALLOWANCE = new$ALLOWANCE,
    REFINEMENTCAUSE = new$REFINEMENTCAUSE,
    PREFERENCE = new$PREFERENCE,
    PREFERENCESIZE = new$PREFERENCESIZE,
    SECURITY = new$SECURITY,
    UNKNOWNAMOUNT = new$UNKNOWNAMOUNT,
    PERIODYEAR = new$PERIODYEAR,
    SUPPORTUNDERTAKER = new$SUPPORTUNDERTAKER,
    AYEAR = new$AYEAR,
    REWORKCAUSE = new$REWORKCAUSE,
    NOTE = new$NOTE,
    REALID = new$REALID,
    INNERNUMBER = new$INNERNUMBER,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    PROTOCOLREASON = new$PROTOCOLREASON,
    PROGINDEX = new$PROGINDEX,
    DOCNUMBER = new$DOCNUMBER,
    SECURITYTSIZE = new$SECURITYTSIZE,
    SECURITYASIZE = new$SECURITYASIZE,
    AVANSSIZE = new$AVANSSIZE,
    PREFERENCECRIPPLE = new$PREFERENCECRIPPLE,
    PREFERENCERUSPRODUCT = new$PREFERENCERUSPRODUCT,
    PREFERENCEPRISON = new$PREFERENCEPRISON,
    PURCHASESOCIALNKO = new$PURCHASESOCIALNKO,
    AGREEMENTEXECUTIONDATE = new$AGREEMENTEXECUTIONDATE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion
           OR RVersion IS NULL AND :OLD.RVersion IS NULL
          );

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_10 (TR_TENDERCAPTION_AU_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.1*/
  /* Коррекция вспомогательных флагов в уточняемой записи*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentNumber > 0) and (new$LastAccepted <> :old.LastAccepted) and (:old.LastAdjustment = 1)) then
    update TenderCaption set
    LastAccepted = :old.LastAccepted,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;
          
  /* После отклонения документа необходимо восстановить флаг LastAdjustment у последней принятой версии*/
  if ((new$AdjustmentNumber > 0) and (:old.LastAdjustment = 1) and (new$LastAdjustment = 0) and 
  (new$AcceptDate is not null) and (new$Accepted = 0)) then
    update TenderCaption set
    LastAdjustment = 1,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;

-- - - - - - - - - - - - -
-- AU_20 (TR_TENDERCAPTION_AU_20)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 2.0*/
  /* Если поменяли лицевой счет в заголовке заявки, тогда надо проставить его в детализации*/
  if (:old.FacialAccCls <> new$FacialAccCls) then
    update TenderProduct set
    RVersion = -1,
    FacialAccCls = new$FacialAccCls
    where
    (RecordIndex = new$ID) and (ProgIndex = 230);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_TENDERCAPTION_AU_500)
-- Create 28.04.2005
-- Last update 25.05.2005
-- - - - - - - - - - - - -

   IF (new$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
           VALUES (139, :OLD.ID, SYSDATE);

      DELETE FROM DelRecIndexes
            WHERE (TableID = 139) AND (RecordId = new$ID);
   END IF;

END;
/
commit work 
/

-- #########################################################
-- #########################################################
-- alter_Cls_AddFields.sql
-- #########################################################
-- #########################################################

/* Добавление различных полей в классификаторы к 10.0 */
ALTER TABLE DirectionCls ADD (
  Code VARCHAR2(20),/* Код */
  BudgetRef NUMBER(10)/* Бюджет */,
    CHECK((BudgetRef<=2147483647)AND(BudgetRef>-2147483648))
)
/
ALTER TABLE Fact ADD (
  Code VARCHAR2(20),/* Код */
  BudgetRef NUMBER(10)/* Бюджет */,
    CHECK((BudgetRef<=2147483647)AND(BudgetRef>-2147483648))
)
/
ALTER TABLE FinType ADD (
  Code VARCHAR2(20),/* Код */
  BudgetRef NUMBER(10)/* Бюджет */,
    CHECK((BudgetRef<=2147483647)AND(BudgetRef>-2147483648))
)
/
ALTER TABLE BudAllocationCls ADD (
  AssignmentKind NUMBER(10)/* Вид ассигнований */,
    CHECK((AssignmentKind<=2147483647)AND(AssignmentKind>-2147483648))
)
/
ALTER TABLE SubsidyCls ADD (
  DocBase NUMBER(10),/* Документ-основание */
    CHECK((DocBase<=2147483647)AND(DocBase>-2147483648)),
  NPAGroup VARCHAR2(1024),/* Группа НПА */
  NPAName VARCHAR2(1024),/* Название НПА */
  NPADate NUMBER,/* Дата НПА */
  NPANumber VARCHAR2(50)/* Номер НПА */
)
/
ALTER TABLE DocBase ADD (
  Code VARCHAR2(20),/* Код */
  BudgetRef NUMBER(10),/* Бюджет */
    CHECK((BudgetRef<=2147483647)AND(BudgetRef>-2147483648)),
  DeleteDate DATE,/* Дата закрытия*/
  StartDate DATE,/* Дата вступления в действие */
  KVSR NUMBER(10)/* КВСР */,
    CHECK((KVSR<=2147483647)AND(KVSR>-2147483648))
)
/
ALTER TABLE BudStruct ADD (
  SubsidyCls NUMBER(10)/* Код субсидии */,
    CHECK((SubsidyCls<=2147483647)AND(SubsidyCls>-2147483648))
)
/
ALTER TABLE BudStruct ADD (
  constraint FK_BudStruct_SubsidyCls FOREIGN KEY (SubsidyCls) REFERENCES SubsidyCls (ID)
)
/
CREATE INDEX FK_BudStruct_SubsidyCls ON BudStruct(SubsidyCls)
/
ALTER TABLE BudStructRights ADD (
  SubsidyCls VARCHAR2(20),/* Код субсидии */
  SubsidyClsUp VARCHAR2(20)
)
/
ALTER TABLE BUDSTRUCT DROP CONSTRAINT UNIQUEREC DROP INDEX
/
commit work 
/
ALTER TABLE BUDSTRUCT ADD (
  CONSTRAINT UNIQUEREC UNIQUE 
  (KFSR, KVSR, KCSR, KVR, KESR, SUBKESR, REGIONCLS, FACT, FINTYPE, MEANSTYPE, DIRECTIONCLS, TRANSFERTCLS, BUDALLOCATIONCLS, PAYPROMISECLS, SUBSIDYCLS, BUDGETREF)
)
/
commit work 
/
-- CREATE TRIGGER tr_directioncls_bi_0
CREATE OR REPLACE TRIGGER TR_DIRECTIONCLS_BI
  BEFORE INSERT
  ON DIRECTIONCLS
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_directioncls_bi_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.Code is null) then
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if (:new.BudgetRef = 0) then
    /* Для всех бюджетов */
    IsNumericString(:new.Code,IsNumeric$);
    /* Пишем в ID код, если он числовой */
    if (IsNumeric$ = 1) then
      :new.id := :new.Code;
          
    else
      /* Если код строковый, то ID должно быть суррогатным */
      if ((:new.id is null) or (:new.Id < 10000000)) then
        select g_shared.nextval into :new.id from dual;
      END IF;  
    END IF;
  else
    /* Для конкретного бюджета ID должно быть суррогатным */
    if ((:new.id is null) or (:new.Id < 10000000)) then
      select g_shared.nextval into :new.id from dual;  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DIRECTIONCLS_BI_500)
-- - - - - - - - - - - - -

-- Created 28.09.2004
  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;

END;
/
-- CREATE TRIGGER tr_directioncls_bu_0
CREATE OR REPLACE TRIGGER TR_directioncls_BU
  BEFORE UPDATE
  ON directioncls
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_directioncls_bu_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.Code is null) then
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if (:new.BudgetRef = 0) then
    /* Для всех бюджетов */
    IsNumericString(:new.Code,IsNumeric$);
    /* Пишем в ID код, если он числовой */
    if (IsNumeric$ = 1) then
      :new.id := :new.Code;
          
    else
      /* Если код строковый, то ID должно быть суррогатным */
      if ((:new.id is null) or (:new.Id < 10000000)) then
        select g_shared.nextval into :new.id from dual;
      END IF;  
    END IF;
  else
    /* Для конкретного бюджета ID должно быть суррогатным */
    if ((:new.id is null) or (:new.Id < 10000000)) then
      select g_shared.nextval into :new.id from dual;  
    END IF;
  END IF;

END;
/
-- ALTER TRIGGER tr_fact_bi_0
CREATE OR REPLACE TRIGGER TR_FACT_BI
  BEFORE INSERT
  ON FACT
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FACT_BI_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.Code is null) then
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if (:new.BudgetRef = 0) then
    /* Для всех бюджетов */
    IsNumericString(:new.Code,IsNumeric$);
    /* Пишем в ID код, если он числовой */
    if (IsNumeric$ = 1) then
      :new.id := :new.Code;
          
    else
      /* Если код строковый, то ID должно быть суррогатным */
      if ((:new.id is null) or (:new.Id < 10000000)) then
        select g_shared.nextval into :new.id from dual;
      END IF;  
    END IF;
  else
    /* Для конкретного бюджета ID должно быть суррогатным */
    if ((:new.id is null) or (:new.Id < 10000000)) then
      select g_shared.nextval into :new.id from dual;  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_FACT_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- ALTER TRIGGER tr_fact_bu_0
CREATE OR REPLACE TRIGGER TR_FACT_BU
  BEFORE UPDATE
  ON FACT
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_1 (TR_FACT_BU_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.Code is null) then
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if (:new.BudgetRef = 0) then
    /* Для всех бюджетов */
    IsNumericString(:new.Code,IsNumeric$);
    /* Пишем в ID код, если он числовой */
    if (IsNumeric$ = 1) then
      :new.id := :new.Code;
          
    else
      /* Если код строковый, то ID должно быть суррогатным */
      if ((:new.id is null) or (:new.Id < 10000000)) then
        select g_shared.nextval into :new.id from dual;
      END IF;  
    END IF;
  else
    /* Для конкретного бюджета ID должно быть суррогатным */
    if ((:new.id is null) or (:new.Id < 10000000)) then
      select g_shared.nextval into :new.id from dual;  
    END IF;
  END IF;

END;
/
-- ALTER TRIGGER tr_fintypediv_bi_0
CREATE OR REPLACE TRIGGER TR_FINTYPE_BI
  BEFORE INSERT
  ON FINTYPE
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FINTYPEDIV_BI_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.Code is null) then
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if (:new.BudgetRef = 0) then
    /* Для всех бюджетов */
    IsNumericString(:new.Code,IsNumeric$);
    /* Пишем в ID код, если он числовой */
    if (IsNumeric$ = 1) then
      :new.id := :new.Code;
          
    else
      /* Если код строковый, то ID должно быть суррогатным */
      if ((:new.id is null) or (:new.Id < 10000000)) then
        select g_shared.nextval into :new.id from dual;
      END IF;  
    END IF;
  else
    /* Для конкретного бюджета ID должно быть суррогатным */
    if ((:new.id is null) or (:new.Id < 10000000)) then
      select g_shared.nextval into :new.id from dual;  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_FINTYPE_BI_500)
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;

END;
/
-- ALTER TRIGGER tr_fintypediv_bu_0
CREATE OR REPLACE TRIGGER TR_FINTYPE_BU
  BEFORE UPDATE
  ON FINTYPE
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_FINTYPEDIV_BU_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.Code is null) then
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if (:new.BudgetRef = 0) then
    /* Для всех бюджетов */
    IsNumericString(:new.Code,IsNumeric$);
    /* Пишем в ID код, если он числовой */
    if (IsNumeric$ = 1) then
      :new.id := :new.Code;
          
    else
      /* Если код строковый, то ID должно быть суррогатным */
      if ((:new.id is null) or (:new.Id < 10000000)) then
        select g_shared.nextval into :new.id from dual;
      END IF;  
    END IF;
  else
    /* Для конкретного бюджета ID должно быть суррогатным */
    if ((:new.id is null) or (:new.Id < 10000000)) then
      select g_shared.nextval into :new.id from dual;  
    END IF;
  END IF;

END;
/
-- ALTER TRIGGER tr_docbase_bi_0
CREATE OR REPLACE TRIGGER TR_DOCBASE_BI
  BEFORE INSERT
  ON DOCBASE
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DOCBASE_BI_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.Code is null) then
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if (:new.KVSR is null) then
    :new.KVSR := 0;
  END IF;
  if (:new.BudgetRef = 0) then
    /* Для всех бюджетов */
    IsNumericString(:new.Code,IsNumeric$);
    /* Пишем в ID код, если он числовой */
    if (IsNumeric$ = 1) then
      :new.id := :new.Code;
          
    else
      /* Если код строковый, то ID должно быть суррогатным */
      if ((:new.id is null) or (:new.Id < 10000000)) then
        select g_shared.nextval into :new.id from dual;
      END IF;  
    END IF;
  else
    /* Для конкретного бюджета ID должно быть суррогатным */
    if ((:new.id is null) or (:new.Id < 10000000)) then
      select g_shared.nextval into :new.id from dual;  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DOCBASE_BI_500)
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;

END;
/
-- ALTER TRIGGER tr_docbase_bu_0
CREATE OR REPLACE TRIGGER TR_DOCBASE_BU
  BEFORE UPDATE
  ON DOCBASE
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_1 (TR_DOCBASE_BU_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.Code is null) then
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if (:new.KVSR is null) then
    :new.KVSR := 0;
  END IF;
  if (:new.BudgetRef = 0) then
    /* Для всех бюджетов */
    IsNumericString(:new.Code,IsNumeric$);
    /* Пишем в ID код, если он числовой */
    if (IsNumeric$ = 1) then
      :new.id := :new.Code;
          
    else
      /* Если код строковый, то ID должно быть суррогатным */
      if ((:new.id is null) or (:new.Id < 10000000)) then
        select g_shared.nextval into :new.id from dual;
      END IF;  
    END IF;
  else
    /* Для конкретного бюджета ID должно быть суррогатным */
    if ((:new.id is null) or (:new.Id < 10000000)) then
      select g_shared.nextval into :new.id from dual;  
    END IF;
  END IF;

END;
/
-- ALTER TRIGGER tr_budstructrights_bi_0
CREATE OR REPLACE TRIGGER TR_BUDSTRUCTRIGHTS_BI
  BEFORE INSERT
  ON BUDSTRUCTRIGHTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_BUDSTRUCTRIGHTS_BI_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then 
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.RightRef is null) then 
    :new.RightRef := 4;
  END IF;
  if (:new.IsGroup is null) then 
    :new.IsGroup := 0;
  END IF;
  if (:new.KVSR is null) then 
    :new.KVSR := 0;
  END IF;
  if ((:new.KCSR is null) or (:new.KCSR  is null)) then 
    :new.KCSR := '0';
  END IF;
  if (:new.KFSR is null) then 
    :new.KFSR := 0;
  END IF;
  if ((:new.KVR is null) or (:new.KVR  is null)) then 
    :new.KVR := '0';
  END IF;
  if (:new.KESR is null) then 
    :new.KESR := 0;
  END IF;
  if (:new.SubKESR is null) then 
    :new.SubKESR := 0;
  END IF;
  if (:new.RegionCls is null) then 
    :new.RegionCls := 0;
  END IF;
  if (:new.DirectionCls is null) then 
    :new.DirectionCls := 0;
  END IF;
  if (:new.Fact is null) then 
    :new.Fact := 0;
  END IF;
  if (:new.FinType is null) then 
    :new.FinType := 0;
  END IF;
  if (:new.MeansType is null) then 
    :new.MeansType := 0;
  END IF;
  if (:new.TransfertCls is null) then 
    :new.TransfertCls := 0;
  END IF;
  if ((:new.BudAllocationCls is null) or (:new.BudAllocationCls  is null)) then 
    :new.BudAllocationCls := '0';
  END IF;
  if ((:new.PayPromiseCls is null) or (:new.PayPromiseCls  is null)) then 
    :new.PayPromiseCls := '0';
  END IF;
  if ((:new.SubsidyCls is null) or (:new.SubsidyCls  is null)) then 
    :new.SubsidyCls := '0';
  END IF;
  if (:new.KfsrUP is null) then 
    :new.KFSRUp := :new.KFSR;
  END IF;
  if (:new.KVSRUP is null) then 
    :new.KVSRUP := :new.KVSR;
  END IF;
  if (:new.KCSRUP is null) then 
    :new.KCSRUP := :new.KCSR;
  END IF;
  if (:new.KVRUP is null) then 
    :new.KVRUP := :new.KVR;
  END IF;
  if (:new.KesrUP is null) then 
    :new.KesrUP := :new.Kesr;
  END IF;
  if (:new.SubKESRUP is null) then 
    :new.SubKESRUP := :new.SubKESR;
  END IF;
  if (:new.RegionClsUP is null) then 
    :new.RegionClsUP := :new.RegionCls;
  END IF;
  if (:new.DirectionClsUp is null) then 
    :new.DirectionClsUp := :new.DirectionCls;
  END IF;
  if (:new.FactUP is null) then 
    :new.FactUP := :new.Fact;
  END IF;
  if (:new.FinTypeUP is null) then 
    :new.FinTypeUP := :new.FinType;
  END IF;
  if (:new.MeansTypeUP is null) then 
    :new.MeansTypeUP := :new.MeansType;
  END IF;
  if (:new.TransfertClsUp is null) then 
    :new.TransfertClsUp := :new.TransfertCls;
  END IF;
  if ((:new.BudAllocationClsUp is null) or (:new.BudAllocationClsUp  is null)) then 
    :new.BudAllocationClsUp := :new.BudAllocationCls;
  END IF;
  if ((:new.PayPromiseClsUp is null) or (:new.PayPromiseClsUp  is null)) then 
    :new.PayPromiseClsUp := :new.PayPromiseCls;
  END IF;
  if ((:new.SubsidyClsUp is null) or (:new.SubsidyClsUp  is null)) then 
    :new.SubsidyClsUp := :new.SubsidyCls;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_BUDSTRUCTRIGHTS_BI_500)
-- Create 26.08.2004
-- Last update 26.08.2004
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;

END;
/
-- ALTER TRIGGER tr_budstructrights_bu_0
CREATE OR REPLACE TRIGGER TR_BUDSTRUCTRIGHTS_BU
  BEFORE UPDATE
  ON BUDSTRUCTRIGHTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_BUDSTRUCTRIGHTS_BU_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.RightRef is null) then 
    :new.RightRef := 4;
  END IF;
  if (:new.IsGroup is null) then 
    :new.IsGroup := 0;
  END IF;
  if (:new.KVSR is null) then 
    :new.KVSR := 0;
  END IF;
  if ((:new.KCSR is null) or (:new.KCSR  is null)) then 
    :new.KCSR := '0';
  END IF;
  if (:new.KFSR is null) then 
    :new.KFSR := 0;
  END IF;
  if ((:new.KVR is null) or (:new.KVR  is null)) then 
    :new.KVR := '0';
  END IF;
  if (:new.KESR is null) then 
    :new.KESR := 0;
  END IF;
  if (:new.SubKESR is null) then 
    :new.SubKESR := 0;
  END IF;
  if (:new.RegionCls is null) then 
    :new.RegionCls := 0;
  END IF;
  if (:new.DirectionCls is null) then 
    :new.DirectionCls := 0;
  END IF;
  if (:new.Fact is null) then 
    :new.Fact := 0;
  END IF;
  if (:new.FinType is null) then 
    :new.FinType := 0;
  END IF;
  if (:new.MeansType is null) then 
    :new.MeansType := 0;
  END IF;
  if (:new.TransfertCls is null) then 
    :new.TransfertCls := 0;
  END IF;
  if ((:new.BudAllocationCls is null) or (:new.BudAllocationCls  is null)) then 
    :new.BudAllocationCls := '0';
  END IF;
  if ((:new.PayPromiseCls is null) or (:new.PayPromiseCls  is null)) then 
    :new.PayPromiseCls := '0';
  END IF;
  if ((:new.SubsidyCls is null) or (:new.SubsidyCls  is null)) then 
    :new.SubsidyCls := '0';
  END IF;
  if (:new.KfsrUP is null) then 
    :new.KFSRUp := :new.KFSR;
  END IF;
  if (:new.KVSRUP is null) then 
    :new.KVSRUP := :new.KVSR;
  END IF;
  if (:new.KCSRUP is null) then 
    :new.KCSRUP := :new.KCSR;
  END IF;
  if (:new.KVRUP is null) then 
    :new.KVRUP := :new.KVR;
  END IF;
  if (:new.KesrUP is null) then 
    :new.KesrUP := :new.Kesr;
  END IF;
  if (:new.SubKESRUP is null) then 
    :new.SubKESRUP := :new.SubKESR;
  END IF;
  if (:new.RegionClsUP is null) then 
    :new.RegionClsUP := :new.RegionCls;
  END IF;
  if (:new.DirectionClsUp is null) then 
    :new.DirectionClsUp := :new.DirectionCls;
  END IF;
  if (:new.FactUP is null) then 
    :new.FactUP := :new.Fact;
  END IF;
  if (:new.FinTypeUP is null) then 
    :new.FinTypeUP := :new.FinType;
  END IF;
  if (:new.MeansTypeUP is null) then 
    :new.MeansTypeUP := :new.MeansType;
  END IF;
  if (:new.TransfertClsUp is null) then 
    :new.TransfertClsUp := :new.TransfertCls;
  END IF;
  if ((:new.BudAllocationClsUp is null) or (:new.BudAllocationClsUp  is null)) then 
    :new.BudAllocationClsUp := :new.BudAllocationCls;
  END IF;
  if ((:new.PayPromiseClsUp is null) or (:new.PayPromiseClsUp  is null)) then 
    :new.PayPromiseClsUp := :new.PayPromiseCls;
  END IF;
  if ((:new.SubsidyClsUp is null) or (:new.SubsidyClsUp  is null)) then 
    :new.SubsidyClsUp := :new.SubsidyCls;
  END IF;

END;
/
commit work 
/
/* Удаление устаревших полей */
DROP PROCEDURE FACTUP 
/
DROP PROCEDURE FACTDIV 
/
DROP PROCEDURE FINTYPEUP 
/
DROP PROCEDURE FINTYPEDIV 
/
DROP PROCEDURE DOCBASEUP 
/
DROP PROCEDURE DOCBASEDIV 
/
commit work 
/
ALTER TABLE Fact DROP (Code1)
/
ALTER TABLE Fact DROP (Code2)
/
ALTER TABLE Fact DROP (Code3)
/
ALTER TABLE FinType DROP (Code1)
/
ALTER TABLE FinType DROP (Code2)
/
ALTER TABLE DocBase DROP (Code1)
/
ALTER TABLE DocBase DROP (Code2)
/
ALTER TABLE DocBase DROP (Code3)
/
commit work 
/
ALTER TRIGGER TR_DIRECTIONCLS_BU_500 DISABLE
/
ALTER TRIGGER TR_FACT_BU_500 DISABLE
/
ALTER TRIGGER TR_FINTYPE_BU_500 DISABLE
/
ALTER TRIGGER TR_DOCBASE_BU_500 DISABLE
/
update DirectionCls set
  BudgetRef = 0,
  Code = ID
/
update Fact set
  BudgetRef = 0,
  Code = ID
/
update FinType set
  BudgetRef = 0,
  Code = ID
/
update DocBase set
  BudgetRef = 0,
  Code = ID,
  KVSR = 0
/
/* Форматирование строковх кодов */

/* Направление */

update DirectionCls set
  code='00' || code
where
  code like '_'
/
update DirectionCls set
  code='0' || code
where
  code like '__'
/
/* Мероприятие */

update Fact set
  code='00000' || code
where
  code like '_'
/
update Fact set
  code='0000' || code
where
  code like '__'
/
update Fact set
  code='000' || code
where
  code like '___'
/
update Fact set
  code='00' || code
where
  code like '____'
/
update Fact set
  code='0' || code
where
  code like '_____'
/
/* Тип финансирование */

update FinType set
  code='00' || code
where
  code like '_'
/
update FinType set
  code='0' || code
where
  code like '__'
/
/* Документ-основание */

update DocBase set
  code='000000' || code
where
  code like '_'
/
update DocBase set
  code='00000' || code
where
  code like '__'
/
update DocBase set
  code='0000' || code
where
  code like '___'
/
update DocBase set
  code='000' || code
where
  code like '____'
/
update DocBase set
  code='00' || code
where
  code like '_____'
/
update DocBase set
  code='0' || code
where
  code like '______'
/
ALTER TRIGGER TR_DIRECTIONCLS_BU_500 ENABLE
/
ALTER TRIGGER TR_FACT_BU_500 ENABLE
/
ALTER TRIGGER TR_FINTYPE_BU_500 ENABLE
/
ALTER TRIGGER TR_DOCBASE_BU_500 ENABLE
/
update BudStructRights set
  SubsidyCls = '000000000',
  SubsidyClsUp = 'ЯЯЯЯЯЯЯЯЯ'
/
commit work 
/
/* Добавление внешних ключей */
ALTER TABLE DirectionCls ADD (
  constraint FK_DirCls_BUDGETREF FOREIGN KEY (BUDGETREF) REFERENCES TB_BUDGETS_S (ID)
)
/
CREATE INDEX FK_DirCls_BUDGETREF ON DirectionCls(BUDGETREF)
/
ALTER TABLE Fact ADD (
  constraint FK_Fact_BUDGETREF FOREIGN KEY (BUDGETREF) REFERENCES TB_BUDGETS_S (ID)
)
/
CREATE INDEX FK_Fact_BUDGETREF ON Fact(BUDGETREF)
/
ALTER TABLE FinType ADD (
  constraint FK_FinType_BUDGETREF FOREIGN KEY (BUDGETREF) REFERENCES TB_BUDGETS_S (ID)
)
/
CREATE INDEX FK_FinType_BUDGETREF ON FinType(BUDGETREF)
/
ALTER TABLE BudAllocationCls ADD (
  constraint FK_BudAlloc_AssignKind FOREIGN KEY (AssignmentKind) REFERENCES AssignmentKind (ID)
)
/
CREATE INDEX FK_BudAlloc_AssignKind ON BudAllocationCls(AssignmentKind)
/
ALTER TABLE SubsidyCls ADD (
  constraint FK_SubsidyCls_DocBase FOREIGN KEY (DocBase) REFERENCES DocBase (ID)
)
/
CREATE INDEX FK_SubsidyCls_DocBase ON SubsidyCls(DocBase)
/
ALTER TABLE DocBase ADD (
  constraint FK_DocBase_KVSR FOREIGN KEY (KVSR) REFERENCES KVSR (ID),
  constraint FK_DocBase_BUDGETREF FOREIGN KEY (BUDGETREF) REFERENCES TB_BUDGETS_S (ID)
)
/
CREATE INDEX FK_DocBase_KVSR ON DocBase(KVSR)
/
CREATE INDEX FK_DocBase_BUDGETREF ON DocBase(BUDGETREF)
/
commit work 
/
/* Добавление FinType в Incomes32, UnionNotifyDetail */
ALTER TABLE TB_Incomes32 ADD (
  FinType NUMBER(10),
    CHECK((FinType<=2147483647)AND(FinType>-2147483648))
)
/

CREATE OR REPLACE VIEW Incomes32 (
  ID,
  DOCNUMBER,
  DOCCOUNT,
  IDATE,
  DEBIT,
  CREDIT,
  DOCTYPE,
  INN,
  ORG_REF,
  ACCOUNTINDEX,
  KD,
  SUBKD,
  REGIONCLS,
  GOSNI,
  INCACCOUNT,
  PROGINDEX,
  RECORDINDEX,
  BUDGETREF,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  NOTE,
  RECORDINDEX2,
  ELNUM,
  NOTEEX,
  BUHPAYMENTCLS,
  ACCOUNTREF,
  ELPACKETNUM,
  FACIALACC_CLS,
  NDS,
  MEANSTYPE,
  RECORDDATE,
  TOTALREF,
  REQUESTSINDEX,
  KVSR,
  TAXNOTE,
  DOCNUM,
  REALPAYERORG_REF,
  DOCDATE,
  DOCBASE,
  FACT,
  RVERSION,
  KFSR,
  KESR,
  KVR,
  KCSR,
  SUMCOMPLETE,
  ELDOCREF,
  REQUESTSINDEX2,
  FEDERALFUNDSREF,
  BUHOPERATIONCLS,
  IFS,
  IFS_CORR,
  CLSTYPE,
  NDSNOTE,
  DOGNUM,
  SENDERID,
  SENDERRECORDID,
  OKATO,
  ADDOKATO,
  REJECTCLS,
  REJECTCAUSE,
  FUNDSSOURCE,
  DIRECTIONCLS,
  ISBLOCKED,
  BLOCKEDCAUSE,
  UNBLOCKEDDATE,
  UNBLOCKEDCAUSE,
  STIMATEID,
  TRANSFERTCLS,
  SUBSIDYCLS,
  FAORGTYPE,
  OKTMO,
  UINCODE,
  FINTYPE)
AS
  SELECT
    ID,
    DOCNUMBER,
    DOCCOUNT,
    IDATE,
    DEBIT,
    CREDIT,
    DOCTYPE,
    INN,
    ORG_REF,
    ACCOUNTINDEX,
    KD,
    SUBKD,
    REGIONCLS,
    GOSNI,
    INCACCOUNT,
    PROGINDEX,
    RECORDINDEX,
    BUDGETREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    NOTE,
    RECORDINDEX2,
    ELNUM,
    NOTEEX,
    BUHPAYMENTCLS,
    ACCOUNTREF,
    ELPACKETNUM,
    FACIALACC_CLS,
    NDS,
    MEANSTYPE,
    RECORDDATE,
    TOTALREF,
    REQUESTSINDEX,
    KVSR,
    TAXNOTE,
    DOCNUM,
    REALPAYERORG_REF,
    DOCDATE,
    DOCBASE,
    FACT,
    RVERSION,
    KFSR,
    KESR,
    KVR,
    KCSR,
    SUMCOMPLETE,
    ELDOCREF,
    REQUESTSINDEX2,
    FEDERALFUNDSREF,
    BUHOPERATIONCLS,
    IFS,
    IFS_CORR,
    CLSTYPE,
    NDSNOTE,
    DOGNUM,
    SENDERID,
    SENDERRECORDID,
    OKATO,
    ADDOKATO,
    REJECTCLS,
    REJECTCAUSE,
    FUNDSSOURCE,
    DIRECTIONCLS,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    STIMATEID,
    TRANSFERTCLS,
    SUBSIDYCLS,
    FAORGTYPE,
    OKTMO,
    UINCODE,
    FINTYPE
  FROM TB_Incomes32
/

CREATE OR REPLACE TRIGGER TR_INCOMES32_ID
  INSTEAD OF DELETE
  ON INCOMES32
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_10 (TR_INCOMES32_BD10)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

  delete
  from CurrencyIncomes
  where (id = :old.id);

-- - - - - - - - - - - - -
-- BD_20 (T_INCOMES32_BD_20)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

  /* Удалить платежные поручения */
  if (:old.DocType between 1010 and 1019) then
    delete from PayDoc32
    where 
      (ProgIndex = :old.ProgIndex) 
    and 
     (RecordIndex = :old.id);
  end if;

-- - - - - - - - - - - - -
-- BD_500 (TR_INCOMES32_BD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  Update QuotesTitle set
  DocChangeDate = SYSDATE,
  RVersion = -1
  where id = :old.recordindex;

-- - - - - - - - - - - - -
-- BD_600 (TR_INCOMES32_BD_600)
-- Last update 14.10.2009
-- - - - - - - - - - - - -

    --удаляем детализацию если удаляют заголовок
    if (:old.ProgIndex = 41) then
        delete
            from Incomes32
        where
           (ProgIndex=42)and
           (RecordIndex=:old.id);
    end if;

    --удаляем зеркальную запись(если она есть)
    if (:old.ProgIndex = 42) then
        delete
            from Incomes32
        where
            (ProgIndex=43)and
            (RecordIndex=:old.id);
    end if;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_INCOMES32
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);
   
  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_500 (TR_INCOMES32_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordID, DeleteDate, ProgIndex, SUMMA) values (161, :old.ID, SYSDATE, :old.ProgIndex, :old.DEBIT + :old.CREDIT);

END;
/

CREATE OR REPLACE TRIGGER TR_INCOMES32_II
  INSTEAD OF INSERT
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  CapDocNumber VARCHAR2(20);
  unkKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  Kd_Master NUMBER(10);
  idKD$ NUMBER(10);
  unkVKD$ VARCHAR2(20);
  val_DocCount$ NUMBER(10);
  val_DocType$ NUMBER(10);
  val_Org_Ref$ NUMBER(10);
  val_AccountIndex$ NUMBER(10);
  val_SubKD$ NUMBER(10);
  val_RegionCLS$ NUMBER(10);
  val_GosNI$ NUMBER(10);
  val_IncAccount$ NUMBER(10);
  val_BudgetRef$ NUMBER(10);
  val_MEANSTYPE$ NUMBER(10);
  val_FACIALACC_CLS$ NUMBER(10);
  val_TransfertCls$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapAcceptDate$ NUMBER;
  CapReestrNumber$ VARCHAR2(20);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_INCOMES32_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  IF (new$id IS NULL) THEN 
    select g_shared.nextval into new$id from dual;
  END IF;
  /* Заполнение лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$KD IS NULL) THEN 
    new$KD := 0;
  END IF;
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3;
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0;
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS IS NULL) THEN 
    new$IFS := 0;
  END IF;
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
   
  /* Заполнение Бюджета, берем из мастера */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0)) THEN
    BEGIN
      SELECT qt.BudgetRef      INTO new$BudgetRef FROM QuotesTitle qt
      WHERE qt.Id = new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или 0, берем из лицевого счета */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0)) THEN
    BEGIN
      SELECT fa.BudgetRef      INTO new$BudgetRef FROM FacialAcc_Cls fa
      WHERE fa.Id = new$FacialAcc_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или 0, берем из константы */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0))
  THEN 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
   
  IF (new$ProgIndex = 45) 
  THEN 
    IF (new$IncAccount IS NULL) THEN
      GetDefDFAccRefForBudget(new$BudgetRef,new$IncAccount);
    END IF;
    BEGIN

      /* Получить поля из заголовка */
      SELECT qt.ProgIndex, qt.AcceptDate, qt.IncAccount, qt.ReestrNumber 
      INTO CapProgIndex$, CapAcceptDate$, new$IncAccount, CapReestrNumber$       FROM QuotesTitle qt
      WHERE 
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* ставим дату документа для тех записей по которым не будет п/п */
    /* для п/п отрабатывает скрипт after insert */
    IF (CapProgIndex$ <> 145) THEN 
      new$iDate := CapAcceptDate$;
    END IF;
    IF ((CapProgIndex$ = 145)AND (NOT ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0)OR (new$Credit<0)))) )
    THEN 
      new$Idate := CapAcceptDate$;      
    END IF;
    /* если заголовок - реестр федеральных средств (поступление) */
    IF ((CapProgIndex$ = 45) AND (CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя, *//* необходимо для идентификации ФС*/            
                  
      new$FederalFundsRef := new$ID;
      /* if-then */  
    END IF;/* if-then*/
  END IF;
  BEGIN
    /* заполняем вид организации владелца л\с*/
    SELECT org.Org_Type   INTO new$FAOrgType FROM Organizations org
    INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
    WHERE fac.ID = new$FacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BI_5 (TR_INCOMES_BI_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BI_9 (TR_INCOMES32_BI_VZ)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   IF (new$ProgIndex = 9) THEN
      /* Установить фиктивный РС*/
      GetIntConst (9, 1, new$IncAccount);

      BEGIN
        /* Выбрать даты из заголовка взаимозачета */
        SELECT ACCEPTDATE, BUDGETREF
          INTO new$IDate, new$BudgetRef
          FROM VZ_OFFSET
         WHERE ID = new$RecordIndex;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_INCOMES32_BI_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   BEGIN
      SELECT Inn
        INTO new$Inn
        FROM Organizations o
       WHERE (o.ID = new$Org_Ref);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

/* Заполнение Бюджета. Если пустой или ноль, берем из мастера */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      BEGIN
         SELECT c.BudgetRef
           INTO new$budgetref
           FROM QuotesTitle c
          WHERE c.ID = NEW$RecordIndex;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

   /* Заполнение Бюджета. Если пустой, берем из лицевого счета */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      BEGIN
         SELECT fa.BudgetRef
           INTO new$budgetref
           FROM FacialAcc_Cls fa
          WHERE fa.ID = NEW$FacialAcc_Cls;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

   /* Если пустой, берем из константы */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      GetIntConst (-1, 3, new$budgetref);
   END IF;

-- - - - - - - - - - - - -
-- BI_30 (TR_INCOMES32_BI_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_70 (TR_INCOMES32_BI_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
            необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_INCOMES32_BI_100)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if ((not (newKD$  like unkKD$)) and
    (not (newKD$  like unkVKD$))) then
      /* если это налог(вообще здесь может быть сторнирование
         или дебитование невыясненных доходов) ,то создаем зеркальную
         запись,дебитующую код невыясненных доходов*/

      /* сумма в дебете должна быть равна нулю*/
      if (new$Debit <> 0) then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      BEGIN

        /* Почти всю запись подставляем из заголовка*/
        select KD,DocCount,DocType,
        Org_Ref,AccountIndex,SubKD,RegionCLS,GosNI,
        IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,
        TransfertCls
        into
        idKD$,
        val_DocCount$,
        val_DocType$,
        val_Org_Ref$,
        val_AccountIndex$,
        val_SubKD$,
        val_RegionCLS$,
        val_GosNI$,
        val_IncAccount$,
        val_BudgetRef$,
        val_MEANSTYPE$  ,
        val_FACIALACC_CLS$,
        val_TransfertCls$         from incomes32 where id=new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
         
      if (not idKD$ is null) then
        insert into
        /* KD=невыясненный код дохода (должен быть равен коду из мастер записи)
              Debit=0
              сredit=-new.credit
              ProgIndex=43
              RecordIndex=new.id
              id вставляется триггером на Incomes32*/
        Incomes32(CreaterUser, DocNum,DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS, TransfertCls)
        Values(new$CreaterUser, new$DocNum, val_DocCount$, new$iDate, new$DOCDATE, 0, -new$Credit, val_DocType$,
        val_Org_Ref$, val_AccountIndex$, idKD$, val_SubKD$, val_RegionCLS$, val_GosNI$,
        43,new$Id, val_IncAccount$, val_BudgetRef$, new$Note,val_MEANSTYPE$,val_FACIALACC_CLS$,val_TransfertCls$);
        
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_110 (TR_INCOMES32_BI_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       /* если это источник и забыли ввести ClsType */
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                /* иначе - доходная */
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      /* классификация источниковая */
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      /* классификация доходная */
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      /* неверный тип классификации*/
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_INCOMES32_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

  Update QuotesTitle set
  DocChangeDate = new$UpdateDate,
  RVersion = -1
  where id = new$recordindex;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_INCOMES32 (
    ID,
    DOCNUMBER,
    DOCCOUNT,
    IDATE,
    DEBIT,
    CREDIT,
    DOCTYPE,
    INN,
    ORG_REF,
    ACCOUNTINDEX,
    KD,
    SUBKD,
    REGIONCLS,
    GOSNI,
    INCACCOUNT,
    PROGINDEX,
    RECORDINDEX,
    BUDGETREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    NOTE,
    RECORDINDEX2,
    ELNUM,
    NOTEEX,
    BUHPAYMENTCLS,
    ACCOUNTREF,
    ELPACKETNUM,
    FACIALACC_CLS,
    NDS,
    MEANSTYPE,
    RECORDDATE,
    TOTALREF,
    REQUESTSINDEX,
    KVSR,
    TAXNOTE,
    DOCNUM,
    REALPAYERORG_REF,
    DOCDATE,
    DOCBASE,
    FACT,
    RVERSION,
    KFSR,
    KESR,
    KVR,
    KCSR,
    SUMCOMPLETE,
    ELDOCREF,
    REQUESTSINDEX2,
    FEDERALFUNDSREF,
    BUHOPERATIONCLS,
    IFS,
    IFS_CORR,
    CLSTYPE,
    NDSNOTE,
    DOGNUM,
    SENDERID,
    SENDERRECORDID,
    OKATO,
    ADDOKATO,
    REJECTCLS,
    REJECTCAUSE,
    FUNDSSOURCE,
    DIRECTIONCLS,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    STIMATEID,
    TRANSFERTCLS,
    SUBSIDYCLS,
    FAORGTYPE,
    OKTMO,
    UINCODE,
    FINTYPE
  ) VALUES (
    new$ID,
    new$DOCNUMBER,
    new$DOCCOUNT,
    new$IDATE,
    new$DEBIT,
    new$CREDIT,
    new$DOCTYPE,
    new$INN,
    new$ORG_REF,
    new$ACCOUNTINDEX,
    new$KD,
    new$SUBKD,
    new$REGIONCLS,
    new$GOSNI,
    new$INCACCOUNT,
    new$PROGINDEX,
    new$RECORDINDEX,
    new$BUDGETREF,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$NOTE,
    new$RECORDINDEX2,
    new$ELNUM,
    new$NOTEEX,
    new$BUHPAYMENTCLS,
    new$ACCOUNTREF,
    new$ELPACKETNUM,
    new$FACIALACC_CLS,
    new$NDS,
    new$MEANSTYPE,
    new$RECORDDATE,
    new$TOTALREF,
    new$REQUESTSINDEX,
    new$KVSR,
    new$TAXNOTE,
    new$DOCNUM,
    new$REALPAYERORG_REF,
    new$DOCDATE,
    new$DOCBASE,
    new$FACT,
    new$RVERSION,
    new$KFSR,
    new$KESR,
    new$KVR,
    new$KCSR,
    new$SUMCOMPLETE,
    new$ELDOCREF,
    new$REQUESTSINDEX2,
    new$FEDERALFUNDSREF,
    new$BUHOPERATIONCLS,
    new$IFS,
    new$IFS_CORR,
    new$CLSTYPE,
    new$NDSNOTE,
    new$DOGNUM,
    new$SENDERID,
    new$SENDERRECORDID,
    new$OKATO,
    new$ADDOKATO,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$FUNDSSOURCE,
    new$DIRECTIONCLS,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$STIMATEID,
    new$TRANSFERTCLS,
    new$SUBSIDYCLS,
    new$FAORGTYPE,
    new$OKTMO,
    new$UINCODE,
    new$FINTYPE);

-- - - - - - - - - - - - -
-- AI_20 (T_INCOMES32_AI_20)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   -- Получить поля из заголовка ВД
   if (new$ProgIndex <> 42) then
     BEGIN
       SELECT ProgIndex, DocNumber, AcceptDate
        INTO CapProgIndex, CapDocNumber, CapAcceptDate
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
     EXCEPTION
       WHEN NO_DATA_FOUND THEN NULL;
     END;
   end if;

   -- если заголовок - ВД, то обрабатывать
   IF ((CapProgIndex = 145) or (new$ProgIndex=42)) THEN

      If ((new$ProgIndex=42) and (new$DocType between 1010 and 1019) and
         (new$Debit>0) and (new$DOCDATE is not null))
      then
        BEGIN
          select kd into Kd_Master
    From Incomes32 inc
          where inc.id = new$RecordIndex;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;

        if (Kd_Master = new$Kd) then
          CapAcceptDate := new$DOCDATE;
          CapProgIndex  := new$ProgIndex;
          CapDocNumber  := new$DocNum;
        end if;
      end if; -- нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)

      -- сумма может быть или по кредиту с минусом или по дебету с плюсом
      IF ((CapAcceptDate IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit > 0) OR (new$Credit < 0))) THEN
         -- Создать платежное поручение (Добавлено RealPayerOrg_Ref(PayDoc32)=new$RealPayerOrg_Ref(Incomes32))
         INSERT INTO PayDoc32
            (BudgetRef, AccountRef, PayerAttrRef, InputDate,
             Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref, FACIALACC_CLS)
         VALUES (new$BudgetRef, new$AccountRef, new$IncAccount, CapAcceptDate,
             (new$Debit - new$Credit), new$Note, new$ProgIndex, new$id, CapDocNumber, new$TaxNote,
             new$RealPayerOrg_Ref,new$FACIALACC_CLS);
      -- (new$Debit - new$Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
      -- что в сумму платежного поручения будут попадать или дебет или кредит по модулю
      END IF;

   END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_INCOMES32_AI_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 161) AND (RecordID = NEW$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapProgIndex1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex1$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex1$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
ALTER TABLE UnionNotifyDetail ADD (
  FinType NUMBER(10),
    CHECK((FinType<=2147483647)AND(FinType>-2147483648))
)
/
commit work 
/
-- ALTER TRIGGER tr_incomes32_bi
CREATE OR REPLACE TRIGGER TR_INCOMES32_II
  INSTEAD OF INSERT
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  CapDocNumber VARCHAR2(20);
  unkKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  Kd_Master NUMBER(10);
  idKD$ NUMBER(10);
  unkVKD$ VARCHAR2(20);
  val_DocCount$ NUMBER(10);
  val_DocType$ NUMBER(10);
  val_Org_Ref$ NUMBER(10);
  val_AccountIndex$ NUMBER(10);
  val_SubKD$ NUMBER(10);
  val_RegionCLS$ NUMBER(10);
  val_GosNI$ NUMBER(10);
  val_IncAccount$ NUMBER(10);
  val_BudgetRef$ NUMBER(10);
  val_MEANSTYPE$ NUMBER(10);
  val_FACIALACC_CLS$ NUMBER(10);
  val_TransfertCls$ NUMBER(10);
  CapAcceptDate$ NUMBER;
  CapReestrNumber$ VARCHAR2(20);
  CapProgIndex1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_INCOMES32_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$id IS NULL) THEN 
    select g_shared.nextval into new$id from dual;
  END IF;
  /* Заполнение лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$KD IS NULL) THEN 
    new$KD := 0;
  END IF;
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3;
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0;
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS IS NULL) THEN 
    new$IFS := 0;
  END IF;
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
   
  /* Заполнение Бюджета, берем из мастера */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0)) THEN
    BEGIN
      SELECT qt.BudgetRef      INTO new$BudgetRef FROM QuotesTitle qt
      WHERE qt.Id = new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или 0, берем из лицевого счета */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0)) THEN
    BEGIN
      SELECT fa.BudgetRef      INTO new$BudgetRef FROM FacialAcc_Cls fa
      WHERE fa.Id = new$FacialAcc_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или 0, берем из константы */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0))
  THEN 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
   
  IF (new$ProgIndex = 45) 
  THEN 
    IF (new$IncAccount IS NULL) THEN
      GetDefDFAccRefForBudget(new$BudgetRef,new$IncAccount);
    END IF;
    BEGIN

      /* Получить поля из заголовка */
      SELECT qt.ProgIndex, qt.AcceptDate, qt.IncAccount, qt.ReestrNumber 
      INTO CapProgIndex1$, CapAcceptDate$, new$IncAccount, CapReestrNumber$       FROM QuotesTitle qt
      WHERE 
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* ставим дату документа для тех записей по которым не будет п/п */
    /* для п/п отрабатывает скрипт after insert */
    IF (CapProgIndex1$ <> 145) THEN 
      new$iDate := CapAcceptDate$;
    END IF;
    IF ((CapProgIndex1$ = 145)AND (NOT ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0)OR (new$Credit<0)))) )
    THEN 
      new$Idate := CapAcceptDate$;      
    END IF;
    /* если заголовок - реестр федеральных средств (поступление) */
    IF ((CapProgIndex1$ = 45) AND (CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя, *//* необходимо для идентификации ФС*/            
                  
      new$FederalFundsRef := new$ID;
      /* if-then */  
    END IF;/* if-then*/
  END IF;
  BEGIN
    /* заполняем вид организации владелца л\с*/
    SELECT org.Org_Type   INTO new$FAOrgType FROM Organizations org
    INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
    WHERE fac.ID = new$FacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BI_5 (TR_INCOMES_BI_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BI_9 (TR_INCOMES32_BI_VZ)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   IF (new$ProgIndex = 9) THEN
      /* Установить фиктивный РС*/
      GetIntConst (9, 1, new$IncAccount);

      BEGIN
        /* Выбрать даты из заголовка взаимозачета */
        SELECT ACCEPTDATE, BUDGETREF
          INTO new$IDate, new$BudgetRef
          FROM VZ_OFFSET
         WHERE ID = new$RecordIndex;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_INCOMES32_BI_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   BEGIN
      SELECT Inn
        INTO new$Inn
        FROM Organizations o
       WHERE (o.ID = new$Org_Ref);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

/* Заполнение Бюджета. Если пустой или ноль, берем из мастера */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      BEGIN
         SELECT c.BudgetRef
           INTO new$budgetref
           FROM QuotesTitle c
          WHERE c.ID = NEW$RecordIndex;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

   /* Заполнение Бюджета. Если пустой, берем из лицевого счета */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      BEGIN
         SELECT fa.BudgetRef
           INTO new$budgetref
           FROM FacialAcc_Cls fa
          WHERE fa.ID = NEW$FacialAcc_Cls;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

   /* Если пустой, берем из константы */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      GetIntConst (-1, 3, new$budgetref);
   END IF;

-- - - - - - - - - - - - -
-- BI_30 (TR_INCOMES32_BI_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_70 (TR_INCOMES32_BI_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
            необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_INCOMES32_BI_100)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if ((not (newKD$  like unkKD$)) and
    (not (newKD$  like unkVKD$))) then
      /* если это налог(вообще здесь может быть сторнирование
         или дебитование невыясненных доходов) ,то создаем зеркальную
         запись,дебитующую код невыясненных доходов*/

      /* сумма в дебете должна быть равна нулю*/
      if (new$Debit <> 0) then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      BEGIN

        /* Почти всю запись подставляем из заголовка*/
        select KD,DocCount,DocType,
        Org_Ref,AccountIndex,SubKD,RegionCLS,GosNI,
        IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,
        TransfertCls
        into
        idKD$,
        val_DocCount$,
        val_DocType$,
        val_Org_Ref$,
        val_AccountIndex$,
        val_SubKD$,
        val_RegionCLS$,
        val_GosNI$,
        val_IncAccount$,
        val_BudgetRef$,
        val_MEANSTYPE$  ,
        val_FACIALACC_CLS$,
        val_TransfertCls$         from incomes32 where id=new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
         
      if (not idKD$ is null) then
        insert into
        /* KD=невыясненный код дохода (должен быть равен коду из мастер записи)
              Debit=0
              сredit=-new.credit
              ProgIndex=43
              RecordIndex=new.id
              id вставляется триггером на Incomes32*/
        Incomes32(CreaterUser, DocNum,DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS, TransfertCls)
        Values(new$CreaterUser, new$DocNum, val_DocCount$, new$iDate, new$DOCDATE, 0, -new$Credit, val_DocType$,
        val_Org_Ref$, val_AccountIndex$, idKD$, val_SubKD$, val_RegionCLS$, val_GosNI$,
        43,new$Id, val_IncAccount$, val_BudgetRef$, new$Note,val_MEANSTYPE$,val_FACIALACC_CLS$,val_TransfertCls$);
        
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_110 (TR_INCOMES32_BI_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       /* если это источник и забыли ввести ClsType */
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                /* иначе - доходная */
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      /* классификация источниковая */
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      /* классификация доходная */
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      /* неверный тип классификации*/
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_INCOMES32_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

  Update QuotesTitle set
  DocChangeDate = new$UpdateDate,
  RVersion = -1
  where id = new$recordindex;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_INCOMES32 (
    ID,
    DOCNUMBER,
    DOCCOUNT,
    IDATE,
    DEBIT,
    CREDIT,
    DOCTYPE,
    INN,
    ORG_REF,
    ACCOUNTINDEX,
    KD,
    SUBKD,
    REGIONCLS,
    GOSNI,
    INCACCOUNT,
    PROGINDEX,
    RECORDINDEX,
    BUDGETREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    NOTE,
    RECORDINDEX2,
    ELNUM,
    NOTEEX,
    BUHPAYMENTCLS,
    ACCOUNTREF,
    ELPACKETNUM,
    FACIALACC_CLS,
    NDS,
    MEANSTYPE,
    RECORDDATE,
    TOTALREF,
    REQUESTSINDEX,
    KVSR,
    TAXNOTE,
    DOCNUM,
    REALPAYERORG_REF,
    DOCDATE,
    DOCBASE,
    FACT,
    RVERSION,
    KFSR,
    KESR,
    KVR,
    KCSR,
    SUMCOMPLETE,
    ELDOCREF,
    REQUESTSINDEX2,
    FEDERALFUNDSREF,
    BUHOPERATIONCLS,
    IFS,
    IFS_CORR,
    CLSTYPE,
    NDSNOTE,
    DOGNUM,
    SENDERID,
    SENDERRECORDID,
    OKATO,
    ADDOKATO,
    REJECTCLS,
    REJECTCAUSE,
    FUNDSSOURCE,
    DIRECTIONCLS,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    STIMATEID,
    TRANSFERTCLS,
    SUBSIDYCLS,
    FAORGTYPE,
    OKTMO,
    UINCODE,
    FINTYPE
  ) VALUES (
    new$ID,
    new$DOCNUMBER,
    new$DOCCOUNT,
    new$IDATE,
    new$DEBIT,
    new$CREDIT,
    new$DOCTYPE,
    new$INN,
    new$ORG_REF,
    new$ACCOUNTINDEX,
    new$KD,
    new$SUBKD,
    new$REGIONCLS,
    new$GOSNI,
    new$INCACCOUNT,
    new$PROGINDEX,
    new$RECORDINDEX,
    new$BUDGETREF,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$NOTE,
    new$RECORDINDEX2,
    new$ELNUM,
    new$NOTEEX,
    new$BUHPAYMENTCLS,
    new$ACCOUNTREF,
    new$ELPACKETNUM,
    new$FACIALACC_CLS,
    new$NDS,
    new$MEANSTYPE,
    new$RECORDDATE,
    new$TOTALREF,
    new$REQUESTSINDEX,
    new$KVSR,
    new$TAXNOTE,
    new$DOCNUM,
    new$REALPAYERORG_REF,
    new$DOCDATE,
    new$DOCBASE,
    new$FACT,
    new$RVERSION,
    new$KFSR,
    new$KESR,
    new$KVR,
    new$KCSR,
    new$SUMCOMPLETE,
    new$ELDOCREF,
    new$REQUESTSINDEX2,
    new$FEDERALFUNDSREF,
    new$BUHOPERATIONCLS,
    new$IFS,
    new$IFS_CORR,
    new$CLSTYPE,
    new$NDSNOTE,
    new$DOGNUM,
    new$SENDERID,
    new$SENDERRECORDID,
    new$OKATO,
    new$ADDOKATO,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$FUNDSSOURCE,
    new$DIRECTIONCLS,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$STIMATEID,
    new$TRANSFERTCLS,
    new$SUBSIDYCLS,
    new$FAORGTYPE,
    new$OKTMO,
    new$UINCODE,
    new$FINTYPE);

-- - - - - - - - - - - - -
-- AI_20 (T_INCOMES32_AI_20)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   -- Получить поля из заголовка ВД
   if (new$ProgIndex <> 42) then
     BEGIN
       SELECT ProgIndex, DocNumber, AcceptDate
        INTO CapProgIndex, CapDocNumber, CapAcceptDate
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
     EXCEPTION
       WHEN NO_DATA_FOUND THEN NULL;
     END;
   end if;

   -- если заголовок - ВД, то обрабатывать
   IF ((CapProgIndex = 145) or (new$ProgIndex=42)) THEN

      If ((new$ProgIndex=42) and (new$DocType between 1010 and 1019) and
         (new$Debit>0) and (new$DOCDATE is not null))
      then
        BEGIN
          select kd into Kd_Master
    From Incomes32 inc
          where inc.id = new$RecordIndex;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;

        if (Kd_Master = new$Kd) then
          CapAcceptDate := new$DOCDATE;
          CapProgIndex  := new$ProgIndex;
          CapDocNumber  := new$DocNum;
        end if;
      end if; -- нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)

      -- сумма может быть или по кредиту с минусом или по дебету с плюсом
      IF ((CapAcceptDate IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit > 0) OR (new$Credit < 0))) THEN
         -- Создать платежное поручение (Добавлено RealPayerOrg_Ref(PayDoc32)=new$RealPayerOrg_Ref(Incomes32))
         INSERT INTO PayDoc32
            (BudgetRef, AccountRef, PayerAttrRef, InputDate,
             Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref, FACIALACC_CLS)
         VALUES (new$BudgetRef, new$AccountRef, new$IncAccount, CapAcceptDate,
             (new$Debit - new$Credit), new$Note, new$ProgIndex, new$id, CapDocNumber, new$TaxNote,
             new$RealPayerOrg_Ref,new$FACIALACC_CLS);
      -- (new$Debit - new$Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
      -- что в сумму платежного поручения будут попадать или дебет или кредит по модулю
      END IF;

   END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_INCOMES32_AI_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 161) AND (RecordID = NEW$ID);

END;
/
-- ALTER TRIGGER tr_incomes32_bu
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER tr_unionnotifydetail_bi
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BI
  BEFORE INSERT
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_UNIONNOTIFYDETAIL_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.kesr is null) then
    :new.kesr := 0;
  END IF;
  if (:new.kvsr is null) then
    :new.kvsr := 0;
  END IF;
  if (:new.kcsr is null) then
    :new.kcsr := 0;
  END IF;
  if (:new.kfsr is null) then
    :new.kfsr := 0;
  END IF;
  if (:new.kvr is null) then
    :new.kvr := 0;
  END IF;
  if (:new.ifs is null) then
    :new.ifs := 0;
  END IF;
  if (:new.ActivityKind is null) then
    :new.ActivityKind := 0;
  END IF;
  if (:new.Fact is null) then
    :new.Fact := 0;
  END IF;
  if (:new.MeansType is null) then
    :new.MeansType := 0;
  END IF;
  if (:new.DirectionCLS is null) then
    :new.DirectionCLS := 0;
  END IF;
  if (:new.RegionCLS is null) then
    :new.RegionCLS := 0;
  END IF;
  if (:new.SubKESR is null) then
    :new.SubKESR := 0;
  END IF;
  if (:new.FinType is null) then 
    :new.FinType := 0;
  END IF;
  if (:new.summalimit is null) then
    :new.summalimit := 0;
  END IF;
  if (:new.summaassignment is null) then
    :new.summaassignment := 0;
  END IF;
  if (:new.summafin is null) then
    :new.summafin := 0;
  END IF;
  if (:new.SummaLimitYear is null) then
    :new.SummaLimitYear := 0;
  END IF;
  if (:new.SummaAssignmentYear is null) then
    :new.SummaAssignmentYear := 0;
  END IF;
  if (:new.SummaFinYear is null) then
    :new.SummaFinYear := 0;
  END IF;
  if (:new.SummaYear1 is null) then
    :new.SummaYear1 := 0;
  END IF;
  if (:new.SummaYear2 is null) then
    :new.SummaYear2 := 0;
  END IF;
  if (:new.SummaYear3 is null) then
    :new.SummaYear3 := 0;
  END IF;
  if (:new.BA_LBO_Flag is null) then
    :new.BA_LBO_Flag := 0;
  END IF;
  if (:new.BuhOperationCLS is null) then
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;
  if (:new.ClsType is null) then
    BEGIN
      select
      c.ClsType
      into :new.ClsType     from
      UnionNotifyCaption c
      where
      (c.id = :new.RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_120 (TR_UNIONNOTIFYDETAIL_BI_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -

  if (:new.ClsType is null) then
    if (:new.IFS <> 0) then
      :new.ClsType := 1;
    else
      :new.ClsType := 0;
    end if;  
  end if;
  if ((:new.ClsType = 0) and (:new.IFS <> 0)) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  
  if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
      (:new.KESR <> 0)or(:new.KFSR <> 0))) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BI_500 (TR_UNIONNOTIFYDETAIL_BI_500)
-- Create 15.02.2006
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;
  :NEW.CreaterUser := USER;
  :NEW.UpdaterUser := USER;

END;
/
-- ALTER TRIGGER tr_unionnotifydetail_bu
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BU
  BEFORE UPDATE
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_UNIONNOTIFYDETAIL_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.kesr is null) then
    :new.kesr := 0;
  END IF;
  if (:new.kvsr is null) then
    :new.kvsr := 0;
  END IF;
  if (:new.kcsr is null) then
    :new.kcsr := 0;
  END IF;
  if (:new.kfsr is null) then
    :new.kfsr := 0;
  END IF;
  if (:new.kvr is null) then
    :new.kvr := 0;
  END IF;
  if (:new.ifs is null) then
    :new.ifs := 0;
  END IF;
  if (:new.ActivityKind is null) then
    :new.ActivityKind := 0;
  END IF;
  if (:new.Fact is null) then
    :new.Fact := 0;
  END IF;
  if (:new.MeansType is null) then
    :new.MeansType := 0;
  END IF;
  if (:new.DirectionCLS is null) then
    :new.DirectionCLS := 0;
  END IF;
  if (:new.RegionCLS is null) then
    :new.RegionCLS := 0;
  END IF;
  if (:new.SubKESR is null) then
    :new.SubKESR := 0;
  END IF;
  if (:new.FinType is null) then 
    :new.FinType := 0;
  END IF;
  if (:new.summalimit is null) then
    :new.summalimit := 0;
  END IF;
  if (:new.summaassignment is null) then
    :new.summaassignment := 0;
  END IF;
  if (:new.summafin is null) then
    :new.summafin := 0;
  END IF;
  if (:new.SummaLimitYear is null) then
    :new.SummaLimitYear := 0;
  END IF;
  if (:new.SummaAssignmentYear is null) then
    :new.SummaAssignmentYear := 0;
  END IF;
  if (:new.SummaFinYear is null) then
    :new.SummaFinYear := 0;
  END IF;
  if (:new.SummaYear1 is null) then
    :new.SummaYear1 := 0;
  END IF;
  if (:new.SummaYear2 is null) then
    :new.SummaYear2 := 0;
  END IF;
  if (:new.SummaYear3 is null) then
    :new.SummaYear3 := 0;
  END IF;
  if (:new.BA_LBO_Flag is null) then
    :new.BA_LBO_Flag := 0;
  END IF;
  if (:new.BuhOperationCLS is null) then
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_UNIONNOTIFYDETAIL_BU_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -

  if (:new.ClsType is null) then
    if (:new.IFS <> 0) then
      :new.ClsType := 1;
    else
      :new.ClsType := 0;
    end if;  
  end if;
  if ((:new.ClsType = 0)and(:new.IFS <> 0)) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  
  if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
      (:new.KESR <> 0)or(:new.KFSR <> 0))) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BU_700 (TR_UNIONNOTIFYDETAIL_BU_700)
-- Create 15.02.2006
-- - - - - - - - - - - - -

  if (:New.RVersion is null) then
    :New.RVersion := 1;
  elsif ((:New.RVersion = -1) and (:Old.RVersion <> -1)) then
    :New.RVersion := :Old.RVersion;
  else
    :New.RVersion := :Old.RVersion + 1;
  end if;

END;
/
commit work 
/
-- ALTER TRIGGER TR_INCOMES32_BU
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES_BU_5
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_0
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER T_INCOMES32_BU_20
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_30
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_70
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_100
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_105
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_110
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_300
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
ALTER TRIGGER TR_INCOMES32_BU_500 DISABLE
/
-- ALTER TRIGGER TR_INCOMES32_BU_700
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_AU_500
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   IF (new$Fact IS NULL) THEN 
--     new$Fact := 0;
--   END IF;
--   IF (new$DocBase IS NULL) THEN 
--     new$DocBase := 0;
--   END IF;
--   IF (new$Gosni IS NULL) THEN 
--     new$Gosni := 0;
--   END IF;
--   /* 3 - Индекс программы доходов */
--   IF (new$ProgIndex IS NULL) THEN 
--     new$ProgIndex := 3; 
--   END IF;
--   IF (new$KD IS NULL) THEN 
--     new$KD := 0; 
--   END IF;
--   /* для лицевого счета*/
--   IF (new$FACIALACC_CLS IS NULL) THEN 
--     new$FACIALACC_CLS := 0; 
--   END IF;
--   IF (new$MeansType IS NULL) THEN 
--     new$MeansType := 0;
--   END IF;
--   IF (new$Debit IS NULL) THEN 
--     new$Debit := 0;
--   END IF;
--   IF (new$Credit IS NULL) THEN 
--     new$Credit := 0;
--   END IF;
--   IF (new$Org_Ref IS NULL) THEN 
--     new$Org_Ref := 0;
--   END IF;
--   IF (new$AccountIndex IS NULL) THEN 
--     new$AccountIndex := 0; 
--   END IF;
--   IF (new$DocType IS NULL) THEN 
--     new$DocType := 0;
--   END IF;
--   IF (new$SubKD IS NULL) THEN 
--     new$SubKD := 0;
--   END IF;
--   IF (new$RegionCLS IS NULL) THEN 
--     new$RegionCLS := 0;
--   END IF;
--   IF (new$DocCount IS NULL) THEN 
--     new$DocCount := 1;
--   END IF;
--   IF (new$BuhPaymentCLS IS NULL) THEN 
--     new$BuhPaymentCLS := 0;
--   END IF;
--   IF (new$KVSR IS NULL) THEN 
--     new$KVSR := 0;
--   END IF;
--   IF (new$KFSR IS NULL) THEN 
--     new$KFSR := 0;
--   END IF;
--   IF (new$KESR IS NULL) THEN 
--     new$KESR := 0;
--   END IF;
--   IF (new$KVR IS NULL) THEN 
--     new$KVR := 0;
--   END IF;
--   IF (new$KCSR IS NULL) THEN 
--     new$KCSR := 0;
--   END IF;
--   IF (new$OKATO IS NULL) THEN 
--     new$OKATO := 0;
--   END IF;
--   IF (new$FundsSource IS NULL) THEN 
--     new$FundsSource := 0;
--   END IF;
--   IF (new$DirectionCLS IS NULL) THEN 
--     new$DirectionCLS := 0;
--   END IF;
--   IF (new$FinType is null) then 
--     new$FinType := 0;
--   END IF;
--   IF (new$Debit * new$Credit <> 0) THEN
--     RaiseException('ex_FailDebetCretitValue');
--   END IF;
--   /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
--   IF (new$IFS_CORR IS NULL) THEN 
--     new$Ifs_Corr := 0;
--   END IF;
--   IF (new$IFS IS NULL) THEN 
--     new$Ifs := 0;
--   END IF;
--   IF (new$BuhOperationCLS IS NULL)
--   THEN 
--     GetIntConst(60, 15,new$BuhOperationCLS);
--   END IF;
--   BEGIN
-- 
--     /* Получить поля из заголовка */
--     /* должно срабатывать after изменений в заголовке,*/ 
--     /* чтобы получать реальные значения полей */
--     SELECT ProgIndex, AcceptDate, ReestrNumber
--     INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
--     WHERE
--     (qt.ID = new$RecordIndex)
--     ;
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;
--   /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
--       или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
--   /* если заголовок - реестр федеральных средств (поступление) */
--   IF (CapProgIndex2$ = 45)
--   THEN 
--     IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
--     THEN 
--       /* для поступлений федеральных средств ссылка будет на себя,
--                   необходимо для идентификации ФС*/            
--       new$FederalFundsRef := new$ID;
--       /* if-then*/
--     ELSE 
--       new$FederalFundsRef := NULL;
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=45) */
--   END IF;
--   /* проверка на изменение Бюджета */
--   IF (new$BudgetRef <> :old.BudgetRef) THEN
--     IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
--       IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
--         RaiseException('Ex_CantModufyBudget');
--       END IF;
--       IF (new$Progindex = 41) THEN
--         SELECT COUNT(inc.id ) INTO CNT$1
--         FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
--         IF ((CNT$1<> 0)) THEN
--           RaiseException('Ex_CantModufyBudget');
--         END IF;   
--       END IF;
--     END IF;
--   END IF;
--   /* заполняем вид организации владельца л\с*/
--   IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
--   ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
--     BEGIN
--       SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
--       INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
--       WHERE fac.ID = new$FacialACC_Cls
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
-- ALTER TRIGGER TR_UNIONNOTIFYDETAIL_BU
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BU
  BEFORE UPDATE
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_UNIONNOTIFYDETAIL_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (:new.kesr is null) then
--     :new.kesr := 0;
--   END IF;
--   if (:new.kvsr is null) then
--     :new.kvsr := 0;
--   END IF;
--   if (:new.kcsr is null) then
--     :new.kcsr := 0;
--   END IF;
--   if (:new.kfsr is null) then
--     :new.kfsr := 0;
--   END IF;
--   if (:new.kvr is null) then
--     :new.kvr := 0;
--   END IF;
--   if (:new.ifs is null) then
--     :new.ifs := 0;
--   END IF;
--   if (:new.ActivityKind is null) then
--     :new.ActivityKind := 0;
--   END IF;
--   if (:new.Fact is null) then
--     :new.Fact := 0;
--   END IF;
--   if (:new.MeansType is null) then
--     :new.MeansType := 0;
--   END IF;
--   if (:new.DirectionCLS is null) then
--     :new.DirectionCLS := 0;
--   END IF;
--   if (:new.RegionCLS is null) then
--     :new.RegionCLS := 0;
--   END IF;
--   if (:new.SubKESR is null) then
--     :new.SubKESR := 0;
--   END IF;
--   if (:new.FinType is null) then 
--     :new.FinType := 0;
--   END IF;
--   if (:new.summalimit is null) then
--     :new.summalimit := 0;
--   END IF;
--   if (:new.summaassignment is null) then
--     :new.summaassignment := 0;
--   END IF;
--   if (:new.summafin is null) then
--     :new.summafin := 0;
--   END IF;
--   if (:new.SummaLimitYear is null) then
--     :new.SummaLimitYear := 0;
--   END IF;
--   if (:new.SummaAssignmentYear is null) then
--     :new.SummaAssignmentYear := 0;
--   END IF;
--   if (:new.SummaFinYear is null) then
--     :new.SummaFinYear := 0;
--   END IF;
--   if (:new.SummaYear1 is null) then
--     :new.SummaYear1 := 0;
--   END IF;
--   if (:new.SummaYear2 is null) then
--     :new.SummaYear2 := 0;
--   END IF;
--   if (:new.SummaYear3 is null) then
--     :new.SummaYear3 := 0;
--   END IF;
--   if (:new.BA_LBO_Flag is null) then
--     :new.BA_LBO_Flag := 0;
--   END IF;
--   if (:new.BuhOperationCLS is null) then
--     GetIntConst(60, 15,:new.BuhOperationCLS);
--   END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_UNIONNOTIFYDETAIL_BU_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -

  if (:new.ClsType is null) then
    if (:new.IFS <> 0) then
      :new.ClsType := 1;
    else
      :new.ClsType := 0;
    end if;  
  end if;
  if ((:new.ClsType = 0)and(:new.IFS <> 0)) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  
  if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
      (:new.KESR <> 0)or(:new.KFSR <> 0))) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BU_700 (TR_UNIONNOTIFYDETAIL_BU_700)
-- Create 15.02.2006
-- - - - - - - - - - - - -

  if (:New.RVersion is null) then
    :New.RVersion := 1;
  elsif ((:New.RVersion = -1) and (:Old.RVersion <> -1)) then
    :New.RVersion := :Old.RVersion;
  else
    :New.RVersion := :Old.RVersion + 1;
  end if;

END;
/
-- ALTER TRIGGER TR_UNIONNOTIFYDETAIL_BU_120
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BU
  BEFORE UPDATE
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_UNIONNOTIFYDETAIL_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (:new.kesr is null) then
--     :new.kesr := 0;
--   END IF;
--   if (:new.kvsr is null) then
--     :new.kvsr := 0;
--   END IF;
--   if (:new.kcsr is null) then
--     :new.kcsr := 0;
--   END IF;
--   if (:new.kfsr is null) then
--     :new.kfsr := 0;
--   END IF;
--   if (:new.kvr is null) then
--     :new.kvr := 0;
--   END IF;
--   if (:new.ifs is null) then
--     :new.ifs := 0;
--   END IF;
--   if (:new.ActivityKind is null) then
--     :new.ActivityKind := 0;
--   END IF;
--   if (:new.Fact is null) then
--     :new.Fact := 0;
--   END IF;
--   if (:new.MeansType is null) then
--     :new.MeansType := 0;
--   END IF;
--   if (:new.DirectionCLS is null) then
--     :new.DirectionCLS := 0;
--   END IF;
--   if (:new.RegionCLS is null) then
--     :new.RegionCLS := 0;
--   END IF;
--   if (:new.SubKESR is null) then
--     :new.SubKESR := 0;
--   END IF;
--   if (:new.FinType is null) then 
--     :new.FinType := 0;
--   END IF;
--   if (:new.summalimit is null) then
--     :new.summalimit := 0;
--   END IF;
--   if (:new.summaassignment is null) then
--     :new.summaassignment := 0;
--   END IF;
--   if (:new.summafin is null) then
--     :new.summafin := 0;
--   END IF;
--   if (:new.SummaLimitYear is null) then
--     :new.SummaLimitYear := 0;
--   END IF;
--   if (:new.SummaAssignmentYear is null) then
--     :new.SummaAssignmentYear := 0;
--   END IF;
--   if (:new.SummaFinYear is null) then
--     :new.SummaFinYear := 0;
--   END IF;
--   if (:new.SummaYear1 is null) then
--     :new.SummaYear1 := 0;
--   END IF;
--   if (:new.SummaYear2 is null) then
--     :new.SummaYear2 := 0;
--   END IF;
--   if (:new.SummaYear3 is null) then
--     :new.SummaYear3 := 0;
--   END IF;
--   if (:new.BA_LBO_Flag is null) then
--     :new.BA_LBO_Flag := 0;
--   END IF;
--   if (:new.BuhOperationCLS is null) then
--     GetIntConst(60, 15,:new.BuhOperationCLS);
--   END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_UNIONNOTIFYDETAIL_BU_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -
  NULL;
--   if (:new.ClsType is null) then
--     if (:new.IFS <> 0) then
--       :new.ClsType := 1;
--     else
--       :new.ClsType := 0;
--     end if;  
--   end if;
--   if ((:new.ClsType = 0)and(:new.IFS <> 0)) then
--     RaiseEXCEPTION('EX_WRONGBUDCLS');
--   end if;  
--   if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
--       (:new.KESR <> 0)or(:new.KFSR <> 0))) then
--     RaiseEXCEPTION('EX_WRONGBUDCLS');
--   end if;  

-- - - - - - - - - - - - -
-- BU_700 (TR_UNIONNOTIFYDETAIL_BU_700)
-- Create 15.02.2006
-- - - - - - - - - - - - -

  if (:New.RVersion is null) then
    :New.RVersion := 1;
  elsif ((:New.RVersion = -1) and (:Old.RVersion <> -1)) then
    :New.RVersion := :Old.RVersion;
  else
    :New.RVersion := :Old.RVersion + 1;
  end if;

END;
/
ALTER TRIGGER TR_UNIONNOTIFYDETAIL_BU_500 DISABLE
/
-- ALTER TRIGGER TR_UNIONNOTIFYDETAIL_BU_700
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BU
  BEFORE UPDATE
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_UNIONNOTIFYDETAIL_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (:new.kesr is null) then
--     :new.kesr := 0;
--   END IF;
--   if (:new.kvsr is null) then
--     :new.kvsr := 0;
--   END IF;
--   if (:new.kcsr is null) then
--     :new.kcsr := 0;
--   END IF;
--   if (:new.kfsr is null) then
--     :new.kfsr := 0;
--   END IF;
--   if (:new.kvr is null) then
--     :new.kvr := 0;
--   END IF;
--   if (:new.ifs is null) then
--     :new.ifs := 0;
--   END IF;
--   if (:new.ActivityKind is null) then
--     :new.ActivityKind := 0;
--   END IF;
--   if (:new.Fact is null) then
--     :new.Fact := 0;
--   END IF;
--   if (:new.MeansType is null) then
--     :new.MeansType := 0;
--   END IF;
--   if (:new.DirectionCLS is null) then
--     :new.DirectionCLS := 0;
--   END IF;
--   if (:new.RegionCLS is null) then
--     :new.RegionCLS := 0;
--   END IF;
--   if (:new.SubKESR is null) then
--     :new.SubKESR := 0;
--   END IF;
--   if (:new.FinType is null) then 
--     :new.FinType := 0;
--   END IF;
--   if (:new.summalimit is null) then
--     :new.summalimit := 0;
--   END IF;
--   if (:new.summaassignment is null) then
--     :new.summaassignment := 0;
--   END IF;
--   if (:new.summafin is null) then
--     :new.summafin := 0;
--   END IF;
--   if (:new.SummaLimitYear is null) then
--     :new.SummaLimitYear := 0;
--   END IF;
--   if (:new.SummaAssignmentYear is null) then
--     :new.SummaAssignmentYear := 0;
--   END IF;
--   if (:new.SummaFinYear is null) then
--     :new.SummaFinYear := 0;
--   END IF;
--   if (:new.SummaYear1 is null) then
--     :new.SummaYear1 := 0;
--   END IF;
--   if (:new.SummaYear2 is null) then
--     :new.SummaYear2 := 0;
--   END IF;
--   if (:new.SummaYear3 is null) then
--     :new.SummaYear3 := 0;
--   END IF;
--   if (:new.BA_LBO_Flag is null) then
--     :new.BA_LBO_Flag := 0;
--   END IF;
--   if (:new.BuhOperationCLS is null) then
--     GetIntConst(60, 15,:new.BuhOperationCLS);
--   END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_UNIONNOTIFYDETAIL_BU_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -
  NULL;
--   if (:new.ClsType is null) then
--     if (:new.IFS <> 0) then
--       :new.ClsType := 1;
--     else
--       :new.ClsType := 0;
--     end if;  
--   end if;
--   if ((:new.ClsType = 0)and(:new.IFS <> 0)) then
--     RaiseEXCEPTION('EX_WRONGBUDCLS');
--   end if;  
--   if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
--       (:new.KESR <> 0)or(:new.KFSR <> 0))) then
--     RaiseEXCEPTION('EX_WRONGBUDCLS');
--   end if;  

-- - - - - - - - - - - - -
-- BU_700 (TR_UNIONNOTIFYDETAIL_BU_700)
-- Create 15.02.2006
-- - - - - - - - - - - - -
  NULL;
--   if (:New.RVersion is null) then
--     :New.RVersion := 1;
--   elsif ((:New.RVersion = -1) and (:Old.RVersion <> -1)) then
--     :New.RVersion := :Old.RVersion;
--   else
--     :New.RVersion := :Old.RVersion + 1;
--   end if;

END;
/
update incomes32 set
  FinType = 0
/
update UnionNotifyDetail set
  FinType = 0
/
-- ALTER TRIGGER TR_INCOMES32_BU
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
--       new$DocNum := CAST (new$DocNumber AS VARCHAR2);
--    END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES_BU_5
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--   BEGIN
--     SELECT Inn
--      INTO new$Inn
--      FROM Organizations o
--     WHERE (o.ID = new$Org_Ref);
--   EXCEPTION
--     WHEN NO_DATA_FOUND THEN NULL;
--   END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_0
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -
  NULL;
--   /* Получить поля из заголовка ВД */
--   IF (new$ProgIndex <> 42) THEN
--     BEGIN
--       SELECT ProgIndex, DocNumber, AcceptDate
--       INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
--       WHERE
--       (qt.ID = new$RecordIndex)
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   /* если заголовок - Возврат доходов, то обрабатывать */
--   IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
--   THEN 
--     IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
--     (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
--     THEN 
--       BEGIN
--         SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
--         WHERE inc.id = new$RecordIndex
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
--       IF (Kd_Master$ = new$Kd) THEN 
--         CapAcceptDate$ := new$DOCDATE;
--         CapProgIndex$  := new$ProgIndex;
--         CapDocNumber$  := new$DocNum;
--         /*  */        
--       END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
--     END IF;
--     IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
--     THEN 
-- 
--       /* Обновление или создание платежных поручений */
--       /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/
-- 
--       /* Определяет создано ли уже п/п по записи */
--       SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
--       INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
--       ;
--       /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
--       /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
--                       ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
--                      ) THEN
--                     EXCEPTION EX_CANNOTUPDATENUMBER;*/
--                  
--                 
--       IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
--       then
--         if ((new$DocType <> :old.DocType )
--         or (new$Debit <> :old.Debit )
--         or (new$Credit <> :old.Credit)
--         or (new$org_ref <> :old.org_ref)
--         or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
--         or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
--         )
--         then
--           RaiseException('EX_CANNOTUPDATENUMBER');
--         END IF;
--       END IF;
--                 
-- 
-- 
--       /* Если пользователь установил дату или поменял код документа на ПП */
--       IF (PayDocCount$ = 0)
--       THEN 
--         /* Получить Очередность платежа из констант системы */
--         GetIntConst(11, 2,ConstPayQueue$);
--         /* Получить вид платежа из констант системы */
--         GetIntConst(11, 1,ConstSendBy$);
-- 
--         /* Создать платежное поручение */
--         INSERT INTO PayDoc32
--         (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
--         Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
--         VALUES
--         (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
--         new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
--         /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
--                         что в сумму платежного поручения будут попадать или дебет или кредит по модулю */
-- 
--         /* if-then */
--       ELSE 
--         /* Сменить аттрибуты платежного поручения */
--         IF (((new$AccountRef = :old.AccountRef) OR
--         ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
--         AND (new$IncAccount = :old.IncAccount)
--         AND (new$BudgetRef = :old.BudgetRef)
--         AND ((new$Note = :old.Note) OR
--         ((new$Note IS NULL) AND (:old.Note IS NULL)))
--         AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
--         ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
--         AND ((new$TaxNote = :old.TaxNote) OR
--         ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
--         )  THEN
--           new$AccountRef := new$AccountRef;
--                           
--         ELSE
-- 
--           UPDATE PayDoc32 pd
--           SET
--           pd.AccountRef = new$AccountRef,
--           pd.PayerAttrRef = new$IncAccount,
--           pd.AcceptorAttrRef = new$AccountRef,
--           pd.TextNote = new$Note,
--           pd.TaxNote = new$TaxNote,
--           pd.BudgetRef = new$BudgetRef,
--           pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
--           pd.InputDate = CapAcceptDate$,
--           pd.SourceDocNumber = CapDocNumber$,
--           pd.FACIALACC_CLS = new$FACIALACC_CLS
--           WHERE
--           (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--         END IF;
--         IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
--         OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
--         THEN  
--           IF (Divided$ > 0)
--           THEN
--             /* Платежка раздроблена, и сумму у нее менять нельзя*/
--             RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
--           ELSE
--             UPDATE PayDoc32 pd
--             SET
--             pd.Credit = new$Debit - new$Credit
--             WHERE
--             (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
--                           
--           END IF;/* if-then*/            
--         END IF;/* if-else*/
--       END IF;
--       /* проставляем дату датой проведения п/п */
--       /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
--       /* берем максимальную, чтобы не было исключения */
--       SELECT MAX(pd.AcceptDate)
--       INTO Date_Pd$           FROM PayDoc32 pd
--       WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
--       ;
--       new$Idate := Date_Pd$;
--       /* if-then*/
--     ELSE 
--       /* Если вновь установленные значения даты принятия документа
--                   и типа документа не удовлетворяют условию создания ПП -
--                   удалить платежные поручения. */
--       DELETE FROM PayDoc32 pd
--       WHERE
--       (pd.ProgIndex = new$ProgIndex)
--       AND (pd.RecordIndex = new$id);
--       /* if-else*/  
--     END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
--   END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
-- ALTER TRIGGER T_INCOMES32_BU_20
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((new$DocDate is null) and (new$ProgIndex=45)) then 
--     BEGIN
--       select q.BuildDate 
--       into 
--       new$DocDate        from QuotesTitle q 
--       where q.id = new$RecordIndex 
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--   END IF;
--   if ((new$DocDate is null) and (new$IDATE is not null)) then
--     new$DocDate := new$IDATE;
--   END IF;
--   if ((new$DOCDATE is not null)) then
--     new$RecordDate := new$DOCDATE;
--   END IF;
--   /* документ не может быть одновременно и принятым и отклоненным*/
--   if ((new$IDate is not null) and (new$RejectCls is not null)) then
--     RaiseException('EX_DOCNOTACCEPTREJECT');
--   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_30
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -
  NULL;
--    /* Получить поля из заголовка */
--    BEGIN
--       SELECT ProgIndex, AcceptDate, ReestrNumber
--         INTO CapProgIndex, CapAcceptDate, CapReestrNumber
--         FROM QuotesTitle qt
--        WHERE (qt.ID = new$RecordIndex);
--    EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--    END;
-- 
--    /* если заголовок - реестр федеральных средств (поступление) */
--    IF (CapProgIndex = 45) THEN
--       IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
--          /* для поступлений федеральных средств ссылка будет на себя,
--          необходимо для идентификации ФС*/
--          new$FederalFundsRef := new$ID;
--       ELSE
--          new$FederalFundsRef := NULL;
--       END IF;
--    END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_70
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 42)
--   then 
--     /* найдем диапазон невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     BEGIN
-- 
--       select KDValue   into newKD$ from kd where Id=new$kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
--       select KDValue   into oldKD$ from kd where Id=:old.kd
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     BEGIN
-- 
--       /* Всю запись подставляем из заголовка*/
--       select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
--       IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
--       into
--       idKD1$,
--       val_DocCount1$,
--       val_DocType1$,
--       val_Org_Ref1$,
--       val_AccountIndex1$,
--       val_SubKD1$,
--       val_RegionCLS1$,
--       val_GosNI1$,
--       val_IncAccount1$,
--       val_BudgetRef1$,
--       val_MEANSTYPE1$  , 
--       val_FACIALACC_CLS1$,
--       val_TransfertCls1$         from incomes32 where id=new$RecordIndex
--       ;
--     EXCEPTION
--       WHEN NO_DATA_FOUND THEN NULL;
--     END;
--     if (not idKD1$ is null) then
--       if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
--       (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
--         /* удаляем зеркальную запись,если ее не должно быть*/
--         delete
--         from Incomes32
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       (new$Debit<>0))
--       /* сумма в дебете должна быть равна нулю*/
--       then 
--         RaiseException('ex_UnknownRedirect');
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
--       ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
--         /* вставляем зеркальную запись,если ее не было,но должна быть */
--         insert into
--         Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
--         Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
--         RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
--         Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
--         val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
--         val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
--         new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
--       END IF;
--       if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
--       and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
--         /* если зеркальная запись была и остается, то изменяем ее*/
--         update Incomes32
--         set
--         DocNum = new$DocNum,
--         DocCount = val_DocCount1$,
--         iDate = new$iDate,
--         DOCDATE = new$DOCDATE,
--         Debit = 0,
--         Credit = -new$Credit,
--         DocType = val_DocType1$,
--         Org_Ref = val_Org_Ref1$,
--         AccountIndex = val_AccountIndex1$,
--         KD = idKD1$,
--         SubKD = val_SubKD1$,
--         RegionCLS = val_RegionCLS1$,
--         GosNI = val_GosNI1$,
--         ProgIndex = 43,
--         RecordIndex = new$Id,
--         IncAccount = val_IncAccount1$,
--         BudgetRef = val_BudgetRef1$,
--         Note = new$Note,
--         MEANSTYPE = val_MEANSTYPE1$,
--         FACIALACC_CLS = val_FACIALACC_CLS1$,
--         TransfertCls = val_TransfertCls1$,
--         RVersion = -1
--         where
--         (ProgIndex=43)and
--         (RecordIndex=:old.id);
--          
--       END IF; 
--     END IF;
--   END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_100
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
--   then 
--     /* найдем маску невыясненных доходов*/
--     GetVarCharConst(3,0,unkKD$);
--     /* найдем маску внебюджетных невыясненных доходов*/
--     GetVarCharConst(3,11,unkVKD$);  
--     /* Найдем все соотнесенные доходы данного невыясненного поступления*/
--     FOR REC$1 IN (SELECT inc.id
--      AS val_ID42    FROM Incomes32 inc
--     LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
--     WHERE (inc.ProgIndex =  42) and
--     (inc.RecordIndex =  new$id) and
--     (inc.debit = 0) and
--     (not(kd.kdvalue like unkKD$)) and
--     (not(kd.kdvalue like unkVKD$))
--     )
--     LOOP
--       BEGIN
--         /* Находим зеркальную запись для каждой соотнесенной */
--         select inc.id
--         into val_ID431$         FROM Incomes32 inc
--         WHERE (inc.ProgIndex =  43) and
--         (inc.RecordIndex =  REC$1.val_ID42)
--         ;
--       EXCEPTION
--         WHEN NO_DATA_FOUND THEN NULL;
--       END;
-- 
--       /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
--       update Incomes32
--       set
--       DocNum = new$DocNum,
--       DocCount = new$DocCount,       
--       DOCDATE = new$DOCDATE,
--       Debit = 0,
--       DocType = new$DocType,
--       Org_Ref = new$Org_Ref,
--       AccountIndex = new$AccountIndex,
--       KD = new$Kd,
--       SubKD = new$SubKD,
--       RegionCLS = new$RegionCLS,
--       GosNI = new$GosNI,
--       IncAccount = new$IncAccount,
--       BudgetRef = new$BudgetRef,
--       Note = new$Note,
--       MEANSTYPE = new$MEANSTYPE,
--       FACIALACC_CLS = new$FACIALACC_CLS,
--       FACT = new$FACT,
--       TransfertCls = new$TransfertCls,
--       DirectionCls = new$DirectionCls,
--       rversion = -1
--       where id = val_ID431$;
-- 
--         
--     END LOOP;
--   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_105
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       new$ClsType := 1;       -- если это источник и забыли ввести ClsType
--    ELSIF (new$ClsType IS NULL) THEN
--       new$ClsType := 2;                                -- иначе - доходная
--    END IF;
-- 
--    IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
--       -- классификация источниковая
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
--       -- классификация доходная
--       RaiseEXCEPTION ('EX_WRONGBUDCLS');
--    END IF;
-- 
--    IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
--       -- неверный тип классификации
--       RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
--    END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_110
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -
  NULL;
--   IsReject$ := -1;
--   if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
--     IsReject$ := 1;
--   elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
--     IsReject$ := 0;
--   end if;  
--   if (IsReject$ <> -1) then
--     update LinkRecords set
--       IsRejected = IsReject$
--     where
--       (ChildID = :new.ID)
--       or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
--   end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_BU_300
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (new$RVersion IS NULL) THEN
--       new$RVersion := 1;
--    ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
--       new$RVersion := :OLD.RVersion;
--    ELSE
--       new$RVersion := :OLD.RVersion + 1;
--    END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
ALTER TRIGGER TR_INCOMES32_BU_500 ENABLE
/
-- ALTER TRIGGER TR_INCOMES32_BU_700
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -
  NULL;
--    IF (NEW$ID <> :OLD.ID) THEN
--       INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
--         VALUES (161, :OLD.ID, SYSDATE);
--       DELETE FROM DelRecIndexes
--         WHERE (TableID = 161) AND (RecordId = NEW$ID);
--    END IF;

END;
/
-- ALTER TRIGGER TR_INCOMES32_AU_500
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex2$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex2$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex2$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- ALTER TRIGGER TR_UNIONNOTIFYDETAIL_BU
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BU
  BEFORE UPDATE
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_UNIONNOTIFYDETAIL_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.kesr is null) then
    :new.kesr := 0;
  END IF;
  if (:new.kvsr is null) then
    :new.kvsr := 0;
  END IF;
  if (:new.kcsr is null) then
    :new.kcsr := 0;
  END IF;
  if (:new.kfsr is null) then
    :new.kfsr := 0;
  END IF;
  if (:new.kvr is null) then
    :new.kvr := 0;
  END IF;
  if (:new.ifs is null) then
    :new.ifs := 0;
  END IF;
  if (:new.ActivityKind is null) then
    :new.ActivityKind := 0;
  END IF;
  if (:new.Fact is null) then
    :new.Fact := 0;
  END IF;
  if (:new.MeansType is null) then
    :new.MeansType := 0;
  END IF;
  if (:new.DirectionCLS is null) then
    :new.DirectionCLS := 0;
  END IF;
  if (:new.RegionCLS is null) then
    :new.RegionCLS := 0;
  END IF;
  if (:new.SubKESR is null) then
    :new.SubKESR := 0;
  END IF;
  if (:new.FinType is null) then 
    :new.FinType := 0;
  END IF;
  if (:new.summalimit is null) then
    :new.summalimit := 0;
  END IF;
  if (:new.summaassignment is null) then
    :new.summaassignment := 0;
  END IF;
  if (:new.summafin is null) then
    :new.summafin := 0;
  END IF;
  if (:new.SummaLimitYear is null) then
    :new.SummaLimitYear := 0;
  END IF;
  if (:new.SummaAssignmentYear is null) then
    :new.SummaAssignmentYear := 0;
  END IF;
  if (:new.SummaFinYear is null) then
    :new.SummaFinYear := 0;
  END IF;
  if (:new.SummaYear1 is null) then
    :new.SummaYear1 := 0;
  END IF;
  if (:new.SummaYear2 is null) then
    :new.SummaYear2 := 0;
  END IF;
  if (:new.SummaYear3 is null) then
    :new.SummaYear3 := 0;
  END IF;
  if (:new.BA_LBO_Flag is null) then
    :new.BA_LBO_Flag := 0;
  END IF;
  if (:new.BuhOperationCLS is null) then
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_UNIONNOTIFYDETAIL_BU_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -
  NULL;
--   if (:new.ClsType is null) then
--     if (:new.IFS <> 0) then
--       :new.ClsType := 1;
--     else
--       :new.ClsType := 0;
--     end if;  
--   end if;
--   if ((:new.ClsType = 0)and(:new.IFS <> 0)) then
--     RaiseEXCEPTION('EX_WRONGBUDCLS');
--   end if;  
--   if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
--       (:new.KESR <> 0)or(:new.KFSR <> 0))) then
--     RaiseEXCEPTION('EX_WRONGBUDCLS');
--   end if;  

-- - - - - - - - - - - - -
-- BU_700 (TR_UNIONNOTIFYDETAIL_BU_700)
-- Create 15.02.2006
-- - - - - - - - - - - - -
  NULL;
--   if (:New.RVersion is null) then
--     :New.RVersion := 1;
--   elsif ((:New.RVersion = -1) and (:Old.RVersion <> -1)) then
--     :New.RVersion := :Old.RVersion;
--   else
--     :New.RVersion := :Old.RVersion + 1;
--   end if;

END;
/
-- ALTER TRIGGER TR_UNIONNOTIFYDETAIL_BU_120
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BU
  BEFORE UPDATE
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_UNIONNOTIFYDETAIL_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.kesr is null) then
    :new.kesr := 0;
  END IF;
  if (:new.kvsr is null) then
    :new.kvsr := 0;
  END IF;
  if (:new.kcsr is null) then
    :new.kcsr := 0;
  END IF;
  if (:new.kfsr is null) then
    :new.kfsr := 0;
  END IF;
  if (:new.kvr is null) then
    :new.kvr := 0;
  END IF;
  if (:new.ifs is null) then
    :new.ifs := 0;
  END IF;
  if (:new.ActivityKind is null) then
    :new.ActivityKind := 0;
  END IF;
  if (:new.Fact is null) then
    :new.Fact := 0;
  END IF;
  if (:new.MeansType is null) then
    :new.MeansType := 0;
  END IF;
  if (:new.DirectionCLS is null) then
    :new.DirectionCLS := 0;
  END IF;
  if (:new.RegionCLS is null) then
    :new.RegionCLS := 0;
  END IF;
  if (:new.SubKESR is null) then
    :new.SubKESR := 0;
  END IF;
  if (:new.FinType is null) then 
    :new.FinType := 0;
  END IF;
  if (:new.summalimit is null) then
    :new.summalimit := 0;
  END IF;
  if (:new.summaassignment is null) then
    :new.summaassignment := 0;
  END IF;
  if (:new.summafin is null) then
    :new.summafin := 0;
  END IF;
  if (:new.SummaLimitYear is null) then
    :new.SummaLimitYear := 0;
  END IF;
  if (:new.SummaAssignmentYear is null) then
    :new.SummaAssignmentYear := 0;
  END IF;
  if (:new.SummaFinYear is null) then
    :new.SummaFinYear := 0;
  END IF;
  if (:new.SummaYear1 is null) then
    :new.SummaYear1 := 0;
  END IF;
  if (:new.SummaYear2 is null) then
    :new.SummaYear2 := 0;
  END IF;
  if (:new.SummaYear3 is null) then
    :new.SummaYear3 := 0;
  END IF;
  if (:new.BA_LBO_Flag is null) then
    :new.BA_LBO_Flag := 0;
  END IF;
  if (:new.BuhOperationCLS is null) then
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_UNIONNOTIFYDETAIL_BU_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -

  if (:new.ClsType is null) then
    if (:new.IFS <> 0) then
      :new.ClsType := 1;
    else
      :new.ClsType := 0;
    end if;  
  end if;
  if ((:new.ClsType = 0)and(:new.IFS <> 0)) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  
  if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
      (:new.KESR <> 0)or(:new.KFSR <> 0))) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BU_700 (TR_UNIONNOTIFYDETAIL_BU_700)
-- Create 15.02.2006
-- - - - - - - - - - - - -
  NULL;
--   if (:New.RVersion is null) then
--     :New.RVersion := 1;
--   elsif ((:New.RVersion = -1) and (:Old.RVersion <> -1)) then
--     :New.RVersion := :Old.RVersion;
--   else
--     :New.RVersion := :Old.RVersion + 1;
--   end if;

END;
/
ALTER TRIGGER TR_UNIONNOTIFYDETAIL_BU_500 ENABLE
/
-- ALTER TRIGGER TR_UNIONNOTIFYDETAIL_BU_700
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BU
  BEFORE UPDATE
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_UNIONNOTIFYDETAIL_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.kesr is null) then
    :new.kesr := 0;
  END IF;
  if (:new.kvsr is null) then
    :new.kvsr := 0;
  END IF;
  if (:new.kcsr is null) then
    :new.kcsr := 0;
  END IF;
  if (:new.kfsr is null) then
    :new.kfsr := 0;
  END IF;
  if (:new.kvr is null) then
    :new.kvr := 0;
  END IF;
  if (:new.ifs is null) then
    :new.ifs := 0;
  END IF;
  if (:new.ActivityKind is null) then
    :new.ActivityKind := 0;
  END IF;
  if (:new.Fact is null) then
    :new.Fact := 0;
  END IF;
  if (:new.MeansType is null) then
    :new.MeansType := 0;
  END IF;
  if (:new.DirectionCLS is null) then
    :new.DirectionCLS := 0;
  END IF;
  if (:new.RegionCLS is null) then
    :new.RegionCLS := 0;
  END IF;
  if (:new.SubKESR is null) then
    :new.SubKESR := 0;
  END IF;
  if (:new.FinType is null) then 
    :new.FinType := 0;
  END IF;
  if (:new.summalimit is null) then
    :new.summalimit := 0;
  END IF;
  if (:new.summaassignment is null) then
    :new.summaassignment := 0;
  END IF;
  if (:new.summafin is null) then
    :new.summafin := 0;
  END IF;
  if (:new.SummaLimitYear is null) then
    :new.SummaLimitYear := 0;
  END IF;
  if (:new.SummaAssignmentYear is null) then
    :new.SummaAssignmentYear := 0;
  END IF;
  if (:new.SummaFinYear is null) then
    :new.SummaFinYear := 0;
  END IF;
  if (:new.SummaYear1 is null) then
    :new.SummaYear1 := 0;
  END IF;
  if (:new.SummaYear2 is null) then
    :new.SummaYear2 := 0;
  END IF;
  if (:new.SummaYear3 is null) then
    :new.SummaYear3 := 0;
  END IF;
  if (:new.BA_LBO_Flag is null) then
    :new.BA_LBO_Flag := 0;
  END IF;
  if (:new.BuhOperationCLS is null) then
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_UNIONNOTIFYDETAIL_BU_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -

  if (:new.ClsType is null) then
    if (:new.IFS <> 0) then
      :new.ClsType := 1;
    else
      :new.ClsType := 0;
    end if;  
  end if;
  if ((:new.ClsType = 0)and(:new.IFS <> 0)) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  
  if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
      (:new.KESR <> 0)or(:new.KFSR <> 0))) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BU_700 (TR_UNIONNOTIFYDETAIL_BU_700)
-- Create 15.02.2006
-- - - - - - - - - - - - -

  if (:New.RVersion is null) then
    :New.RVersion := 1;
  elsif ((:New.RVersion = -1) and (:Old.RVersion <> -1)) then
    :New.RVersion := :Old.RVersion;
  else
    :New.RVersion := :Old.RVersion + 1;
  end if;

END;
/
commit work 
/
ALTER TABLE TB_incomes32 ADD (
  constraint FK_incomes32_FinType FOREIGN KEY (FinType) REFERENCES FinType (ID)
)
/
CREATE INDEX FK_incomes32_FinType ON TB_incomes32(FinType)
/
ALTER TABLE UnionNotifyDetail ADD (
  constraint FK_UnionNotDet_FinType FOREIGN KEY (FinType) REFERENCES FinType (ID)
)
/
CREATE INDEX FK_UnionNotDet_FinType ON UnionNotifyDetail(FinType)
/
commit work 
/
-- CREATE TRIGGER TR_INCOMES32_BI
CREATE OR REPLACE TRIGGER TR_INCOMES32_II
  INSTEAD OF INSERT
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  CapDocNumber VARCHAR2(20);
  unkKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  Kd_Master NUMBER(10);
  idKD$ NUMBER(10);
  unkVKD$ VARCHAR2(20);
  val_DocCount$ NUMBER(10);
  val_DocType$ NUMBER(10);
  val_Org_Ref$ NUMBER(10);
  val_AccountIndex$ NUMBER(10);
  val_SubKD$ NUMBER(10);
  val_RegionCLS$ NUMBER(10);
  val_GosNI$ NUMBER(10);
  val_IncAccount$ NUMBER(10);
  val_BudgetRef$ NUMBER(10);
  val_MEANSTYPE$ NUMBER(10);
  val_FACIALACC_CLS$ NUMBER(10);
  val_TransfertCls$ NUMBER(10);
  CapAcceptDate$ NUMBER;
  CapReestrNumber$ VARCHAR2(20);
  CapProgIndex$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_INCOMES32_BI)
-- Version 10.00.00.2
-- - - - - - - - - - - - -

  IF (new$id IS NULL) THEN 
    select g_shared.nextval into new$id from dual;
  END IF;
  /* Заполнение лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$KD IS NULL) THEN 
    new$KD := 0;
  END IF;
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3;
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0;
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  IF (new$FinType IS NULL) THEN  
    new$FinType := 0;
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS IS NULL) THEN 
    new$IFS := 0;
  END IF;
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
   
  /* Заполнение Бюджета, берем из мастера */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0)) THEN
    BEGIN
      SELECT qt.BudgetRef      INTO new$BudgetRef FROM QuotesTitle qt
      WHERE qt.Id = new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или 0, берем из лицевого счета */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0)) THEN
    BEGIN
      SELECT fa.BudgetRef      INTO new$BudgetRef FROM FacialAcc_Cls fa
      WHERE fa.Id = new$FacialAcc_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или 0, берем из константы */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0))
  THEN 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
   
  IF (new$ProgIndex = 45) 
  THEN 
    IF (new$IncAccount IS NULL) THEN
      GetDefDFAccRefForBudget(new$BudgetRef,new$IncAccount);
    END IF;
    BEGIN

      /* Получить поля из заголовка */
      SELECT qt.ProgIndex, qt.AcceptDate, qt.IncAccount, qt.ReestrNumber 
      INTO CapProgIndex$, CapAcceptDate$, new$IncAccount, CapReestrNumber$       FROM QuotesTitle qt
      WHERE 
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* ставим дату документа для тех записей по которым не будет п/п */
    /* для п/п отрабатывает скрипт after insert */
    IF (CapProgIndex$ <> 145) THEN 
      new$iDate := CapAcceptDate$;
    END IF;
    IF ((CapProgIndex$ = 145)AND (NOT ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0)OR (new$Credit<0)))) )
    THEN 
      new$Idate := CapAcceptDate$;      
    END IF;
    /* если заголовок - реестр федеральных средств (поступление) */
    IF ((CapProgIndex$ = 45) AND (CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя, *//* необходимо для идентификации ФС*/            
                  
      new$FederalFundsRef := new$ID;
      /* if-then */  
    END IF;/* if-then*/
  END IF;
  BEGIN
    /* заполняем вид организации владелца л\с*/
    SELECT org.Org_Type   INTO new$FAOrgType FROM Organizations org
    INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
    WHERE fac.ID = new$FacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BI_5 (TR_INCOMES_BI_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BI_9 (TR_INCOMES32_BI_VZ)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   IF (new$ProgIndex = 9) THEN
      /* Установить фиктивный РС*/
      GetIntConst (9, 1, new$IncAccount);

      BEGIN
        /* Выбрать даты из заголовка взаимозачета */
        SELECT ACCEPTDATE, BUDGETREF
          INTO new$IDate, new$BudgetRef
          FROM VZ_OFFSET
         WHERE ID = new$RecordIndex;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_INCOMES32_BI_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   BEGIN
      SELECT Inn
        INTO new$Inn
        FROM Organizations o
       WHERE (o.ID = new$Org_Ref);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

/* Заполнение Бюджета. Если пустой или ноль, берем из мастера */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      BEGIN
         SELECT c.BudgetRef
           INTO new$budgetref
           FROM QuotesTitle c
          WHERE c.ID = NEW$RecordIndex;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

   /* Заполнение Бюджета. Если пустой, берем из лицевого счета */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      BEGIN
         SELECT fa.BudgetRef
           INTO new$budgetref
           FROM FacialAcc_Cls fa
          WHERE fa.ID = NEW$FacialAcc_Cls;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

   /* Если пустой, берем из константы */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      GetIntConst (-1, 3, new$budgetref);
   END IF;

-- - - - - - - - - - - - -
-- BI_30 (TR_INCOMES32_BI_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_70 (TR_INCOMES32_BI_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
            необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_INCOMES32_BI_100)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if ((not (newKD$  like unkKD$)) and
    (not (newKD$  like unkVKD$))) then
      /* если это налог(вообще здесь может быть сторнирование
         или дебитование невыясненных доходов) ,то создаем зеркальную
         запись,дебитующую код невыясненных доходов*/

      /* сумма в дебете должна быть равна нулю*/
      if (new$Debit <> 0) then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      BEGIN

        /* Почти всю запись подставляем из заголовка*/
        select KD,DocCount,DocType,
        Org_Ref,AccountIndex,SubKD,RegionCLS,GosNI,
        IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,
        TransfertCls
        into
        idKD$,
        val_DocCount$,
        val_DocType$,
        val_Org_Ref$,
        val_AccountIndex$,
        val_SubKD$,
        val_RegionCLS$,
        val_GosNI$,
        val_IncAccount$,
        val_BudgetRef$,
        val_MEANSTYPE$  ,
        val_FACIALACC_CLS$,
        val_TransfertCls$         from incomes32 where id=new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
         
      if (not idKD$ is null) then
        insert into
        /* KD=невыясненный код дохода (должен быть равен коду из мастер записи)
              Debit=0
              сredit=-new.credit
              ProgIndex=43
              RecordIndex=new.id
              id вставляется триггером на Incomes32*/
        Incomes32(CreaterUser, DocNum,DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS, TransfertCls)
        Values(new$CreaterUser, new$DocNum, val_DocCount$, new$iDate, new$DOCDATE, 0, -new$Credit, val_DocType$,
        val_Org_Ref$, val_AccountIndex$, idKD$, val_SubKD$, val_RegionCLS$, val_GosNI$,
        43,new$Id, val_IncAccount$, val_BudgetRef$, new$Note,val_MEANSTYPE$,val_FACIALACC_CLS$,val_TransfertCls$);
        
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_110 (TR_INCOMES32_BI_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       /* если это источник и забыли ввести ClsType */
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                /* иначе - доходная */
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      /* классификация источниковая */
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      /* классификация доходная */
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      /* неверный тип классификации*/
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_INCOMES32_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

  Update QuotesTitle set
  DocChangeDate = new$UpdateDate,
  RVersion = -1
  where id = new$recordindex;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_INCOMES32 (
    ID,
    DOCNUMBER,
    DOCCOUNT,
    IDATE,
    DEBIT,
    CREDIT,
    DOCTYPE,
    INN,
    ORG_REF,
    ACCOUNTINDEX,
    KD,
    SUBKD,
    REGIONCLS,
    GOSNI,
    INCACCOUNT,
    PROGINDEX,
    RECORDINDEX,
    BUDGETREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    NOTE,
    RECORDINDEX2,
    ELNUM,
    NOTEEX,
    BUHPAYMENTCLS,
    ACCOUNTREF,
    ELPACKETNUM,
    FACIALACC_CLS,
    NDS,
    MEANSTYPE,
    RECORDDATE,
    TOTALREF,
    REQUESTSINDEX,
    KVSR,
    TAXNOTE,
    DOCNUM,
    REALPAYERORG_REF,
    DOCDATE,
    DOCBASE,
    FACT,
    RVERSION,
    KFSR,
    KESR,
    KVR,
    KCSR,
    SUMCOMPLETE,
    ELDOCREF,
    REQUESTSINDEX2,
    FEDERALFUNDSREF,
    BUHOPERATIONCLS,
    IFS,
    IFS_CORR,
    CLSTYPE,
    NDSNOTE,
    DOGNUM,
    SENDERID,
    SENDERRECORDID,
    OKATO,
    ADDOKATO,
    REJECTCLS,
    REJECTCAUSE,
    FUNDSSOURCE,
    DIRECTIONCLS,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    STIMATEID,
    TRANSFERTCLS,
    SUBSIDYCLS,
    FAORGTYPE,
    OKTMO,
    UINCODE,
    FINTYPE
  ) VALUES (
    new$ID,
    new$DOCNUMBER,
    new$DOCCOUNT,
    new$IDATE,
    new$DEBIT,
    new$CREDIT,
    new$DOCTYPE,
    new$INN,
    new$ORG_REF,
    new$ACCOUNTINDEX,
    new$KD,
    new$SUBKD,
    new$REGIONCLS,
    new$GOSNI,
    new$INCACCOUNT,
    new$PROGINDEX,
    new$RECORDINDEX,
    new$BUDGETREF,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$NOTE,
    new$RECORDINDEX2,
    new$ELNUM,
    new$NOTEEX,
    new$BUHPAYMENTCLS,
    new$ACCOUNTREF,
    new$ELPACKETNUM,
    new$FACIALACC_CLS,
    new$NDS,
    new$MEANSTYPE,
    new$RECORDDATE,
    new$TOTALREF,
    new$REQUESTSINDEX,
    new$KVSR,
    new$TAXNOTE,
    new$DOCNUM,
    new$REALPAYERORG_REF,
    new$DOCDATE,
    new$DOCBASE,
    new$FACT,
    new$RVERSION,
    new$KFSR,
    new$KESR,
    new$KVR,
    new$KCSR,
    new$SUMCOMPLETE,
    new$ELDOCREF,
    new$REQUESTSINDEX2,
    new$FEDERALFUNDSREF,
    new$BUHOPERATIONCLS,
    new$IFS,
    new$IFS_CORR,
    new$CLSTYPE,
    new$NDSNOTE,
    new$DOGNUM,
    new$SENDERID,
    new$SENDERRECORDID,
    new$OKATO,
    new$ADDOKATO,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$FUNDSSOURCE,
    new$DIRECTIONCLS,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$STIMATEID,
    new$TRANSFERTCLS,
    new$SUBSIDYCLS,
    new$FAORGTYPE,
    new$OKTMO,
    new$UINCODE,
    new$FINTYPE);

-- - - - - - - - - - - - -
-- AI_20 (T_INCOMES32_AI_20)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   -- Получить поля из заголовка ВД
   if (new$ProgIndex <> 42) then
     BEGIN
       SELECT ProgIndex, DocNumber, AcceptDate
        INTO CapProgIndex, CapDocNumber, CapAcceptDate
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
     EXCEPTION
       WHEN NO_DATA_FOUND THEN NULL;
     END;
   end if;

   -- если заголовок - ВД, то обрабатывать
   IF ((CapProgIndex = 145) or (new$ProgIndex=42)) THEN

      If ((new$ProgIndex=42) and (new$DocType between 1010 and 1019) and
         (new$Debit>0) and (new$DOCDATE is not null))
      then
        BEGIN
          select kd into Kd_Master
    From Incomes32 inc
          where inc.id = new$RecordIndex;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;

        if (Kd_Master = new$Kd) then
          CapAcceptDate := new$DOCDATE;
          CapProgIndex  := new$ProgIndex;
          CapDocNumber  := new$DocNum;
        end if;
      end if; -- нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)

      -- сумма может быть или по кредиту с минусом или по дебету с плюсом
      IF ((CapAcceptDate IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit > 0) OR (new$Credit < 0))) THEN
         -- Создать платежное поручение (Добавлено RealPayerOrg_Ref(PayDoc32)=new$RealPayerOrg_Ref(Incomes32))
         INSERT INTO PayDoc32
            (BudgetRef, AccountRef, PayerAttrRef, InputDate,
             Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref, FACIALACC_CLS)
         VALUES (new$BudgetRef, new$AccountRef, new$IncAccount, CapAcceptDate,
             (new$Debit - new$Credit), new$Note, new$ProgIndex, new$id, CapDocNumber, new$TaxNote,
             new$RealPayerOrg_Ref,new$FACIALACC_CLS);
      -- (new$Debit - new$Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
      -- что в сумму платежного поручения будут попадать или дебет или кредит по модулю
      END IF;

   END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_INCOMES32_AI_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 161) AND (RecordID = NEW$ID);

END;
/
-- CREATE TRIGGER TR_INCOMES32_BU
CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.2
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  IF (new$FinType IS NULL) THEN  
    new$FinType := 0;
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex1$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex1$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
-- CREATE TRIGGER TR_UNIONNOTIFYDETAIL_BI
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BI
  BEFORE INSERT
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_UNIONNOTIFYDETAIL_BI)
-- Version 10.00.00.2
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.kesr is null) then
    :new.kesr := 0;
  END IF;
  if (:new.kvsr is null) then
    :new.kvsr := 0;
  END IF;
  if (:new.kcsr is null) then
    :new.kcsr := 0;
  END IF;
  if (:new.kfsr is null) then
    :new.kfsr := 0;
  END IF;
  if (:new.kvr is null) then
    :new.kvr := 0;
  END IF;
  if (:new.ifs is null) then
    :new.ifs := 0;
  END IF;
  if (:new.ActivityKind is null) then
    :new.ActivityKind := 0;
  END IF;
  if (:new.Fact is null) then
    :new.Fact := 0;
  END IF;
  if (:new.MeansType is null) then
    :new.MeansType := 0;
  END IF;
  if (:new.DirectionCLS is null) then
    :new.DirectionCLS := 0;
  END IF;
  if (:new.RegionCLS is null) then
    :new.RegionCLS := 0;
  END IF;
  if (:new.SubKESR is null) then
    :new.SubKESR := 0;
  END IF;
  IF (:new.FinType IS NULL) THEN
    :new.FinType := 0;
  END IF;
  if (:new.summalimit is null) then
    :new.summalimit := 0;
  END IF;
  if (:new.summaassignment is null) then
    :new.summaassignment := 0;
  END IF;
  if (:new.summafin is null) then
    :new.summafin := 0;
  END IF;
  if (:new.SummaLimitYear is null) then
    :new.SummaLimitYear := 0;
  END IF;
  if (:new.SummaAssignmentYear is null) then
    :new.SummaAssignmentYear := 0;
  END IF;
  if (:new.SummaFinYear is null) then
    :new.SummaFinYear := 0;
  END IF;
  if (:new.SummaYear1 is null) then
    :new.SummaYear1 := 0;
  END IF;
  if (:new.SummaYear2 is null) then
    :new.SummaYear2 := 0;
  END IF;
  if (:new.SummaYear3 is null) then
    :new.SummaYear3 := 0;
  END IF;
  if (:new.BA_LBO_Flag is null) then
    :new.BA_LBO_Flag := 0;
  END IF;
  if (:new.BuhOperationCLS is null) then
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;
  if (:new.ClsType is null) then
    BEGIN
      select
      c.ClsType
      into :new.ClsType     from
      UnionNotifyCaption c
      where
      (c.id = :new.RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_120 (TR_UNIONNOTIFYDETAIL_BI_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -

  if (:new.ClsType is null) then
    if (:new.IFS <> 0) then
      :new.ClsType := 1;
    else
      :new.ClsType := 0;
    end if;  
  end if;
  if ((:new.ClsType = 0) and (:new.IFS <> 0)) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  
  if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
      (:new.KESR <> 0)or(:new.KFSR <> 0))) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BI_500 (TR_UNIONNOTIFYDETAIL_BI_500)
-- Create 15.02.2006
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;
  :NEW.CreaterUser := USER;
  :NEW.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_UNIONNOTIFYDETAIL_BU
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BU
  BEFORE UPDATE
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_UNIONNOTIFYDETAIL_BU)
-- Version 10.00.00.2
-- - - - - - - - - - - - -

  if (:new.kesr is null) then
    :new.kesr := 0;
  END IF;
  if (:new.kvsr is null) then
    :new.kvsr := 0;
  END IF;
  if (:new.kcsr is null) then
    :new.kcsr := 0;
  END IF;
  if (:new.kfsr is null) then
    :new.kfsr := 0;
  END IF;
  if (:new.kvr is null) then
    :new.kvr := 0;
  END IF;
  if (:new.ifs is null) then
    :new.ifs := 0;
  END IF;
  if (:new.ActivityKind is null) then
    :new.ActivityKind := 0;
  END IF;
  if (:new.Fact is null) then
    :new.Fact := 0;
  END IF;
  if (:new.MeansType is null) then
    :new.MeansType := 0;
  END IF;
  if (:new.DirectionCLS is null) then
    :new.DirectionCLS := 0;
  END IF;
  if (:new.RegionCLS is null) then
    :new.RegionCLS := 0;
  END IF;
  if (:new.SubKESR is null) then
    :new.SubKESR := 0;
  END IF;
  IF (:new.FinType IS NULL) THEN
    :new.FinType := 0;
  END IF;
  if (:new.summalimit is null) then
    :new.summalimit := 0;
  END IF;
  if (:new.summaassignment is null) then
    :new.summaassignment := 0;
  END IF;
  if (:new.summafin is null) then
    :new.summafin := 0;
  END IF;
  if (:new.SummaLimitYear is null) then
    :new.SummaLimitYear := 0;
  END IF;
  if (:new.SummaAssignmentYear is null) then
    :new.SummaAssignmentYear := 0;
  END IF;
  if (:new.SummaFinYear is null) then
    :new.SummaFinYear := 0;
  END IF;
  if (:new.SummaYear1 is null) then
    :new.SummaYear1 := 0;
  END IF;
  if (:new.SummaYear2 is null) then
    :new.SummaYear2 := 0;
  END IF;
  if (:new.SummaYear3 is null) then
    :new.SummaYear3 := 0;
  END IF;
  if (:new.BA_LBO_Flag is null) then
    :new.BA_LBO_Flag := 0;
  END IF;
  if (:new.BuhOperationCLS is null) then
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_UNIONNOTIFYDETAIL_BU_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -

  if (:new.ClsType is null) then
    if (:new.IFS <> 0) then
      :new.ClsType := 1;
    else
      :new.ClsType := 0;
    end if;  
  end if;
  if ((:new.ClsType = 0)and(:new.IFS <> 0)) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  
  if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
      (:new.KESR <> 0)or(:new.KFSR <> 0))) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BU_700 (TR_UNIONNOTIFYDETAIL_BU_700)
-- Create 15.02.2006
-- - - - - - - - - - - - -

  if (:New.RVersion is null) then
    :New.RVersion := 1;
  elsif ((:New.RVersion = -1) and (:Old.RVersion <> -1)) then
    :New.RVersion := :Old.RVersion;
  else
    :New.RVersion := :Old.RVersion + 1;
  end if;

END;
/
commit work
/
update permissions set
  name = 'Нормативно-правовые акты'
where
  name = 'Документ-основание'
/
update permissions set
  name = 'Добавление Нормативно-правовые акты'
where
  name = 'Добавление Документ-основание'
/
update permissions set
  name = 'Код дополнительной информации'
where
  name = 'Тип финансирования'
/
update permissions set
  name = 'Добавление Код дополнительной информации'
where
  name = 'Добавление Тип финансирования'
/
update FinType set
  name = 'Неуказанный код доп. информации'
where
  id = 0
/
commit work 
/
ALTER TABLE DirectionCls ADD (
  CONSTRAINT UQ_DirectionCls_VER_KEY UNIQUE (CODE, BUDGETREF) 
)
/
ALTER TABLE Fact ADD (
  CONSTRAINT UQ_Fact_VER_KEY UNIQUE (CODE, BUDGETREF) 
)
/
ALTER TABLE FinType ADD (
  CONSTRAINT UQ_FinType_VER_KEY UNIQUE (CODE, BUDGETREF) 
)
/
ALTER TABLE DocBase ADD (
  CONSTRAINT UQ_DocBase_VER_KEY UNIQUE (CODE, BUDGETREF) 
)
/
commit work 
/
ALTER TABLE DirectionCls MODIFY(Code NOT NULL)
/
ALTER TABLE DirectionCls MODIFY(BudgetRef NOT NULL)
/
ALTER TABLE Fact MODIFY(Code NOT NULL)
/
ALTER TABLE Fact MODIFY(BudgetRef NOT NULL)
/
ALTER TABLE FinType MODIFY(Code NOT NULL)
/
ALTER TABLE FinType MODIFY(BudgetRef NOT NULL)
/
ALTER TABLE DocBase MODIFY(Code NOT NULL)
/
ALTER TABLE DocBase MODIFY(BudgetRef NOT NULL)
/
ALTER TABLE DocBase MODIFY(KVSR NOT NULL)
/
ALTER TABLE TB_Incomes32 MODIFY(FinType NOT NULL)
/
ALTER TABLE UnionNotifyDetail MODIFY(FinType NOT NULL)
/

-- #########################################################
-- #########################################################
-- Add_ECP_Fields_to_Organizations.sql
-- #########################################################
-- #########################################################

/* Добавление в таблицу organizations полей для поддержки системы состояний и ЭЦП */
ALTER TABLE TB_organizations ADD (
  DOCSTATEREF NUMBER(10),
    CHECK((DOCSTATEREF<=2147483647)AND(DOCSTATEREF>-2147483648)),
  CRYPTOSTATUS NUMBER(10),
    CHECK((CRYPTOSTATUS<=2147483647)AND(CRYPTOSTATUS>-2147483648))
)
/

CREATE OR REPLACE VIEW organizations (
  ID,
  NAME,
  GOSNI,
  CITY,
  COUNTRY,
  PHONE,
  ADDRESS,
  ORG_CLS,
  INN20,
  SUBINN,
  FACIALACC,
  REGIONCLS,
  DIRNAME,
  BUGNAME,
  DIRPHONE,
  BUGPHONE,
  RCORG,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  INN,
  OKATO,
  EMAIL,
  WEBSITE,
  UFKCODE,
  ADDOKATO,
  SHORTNAME,
  RVERSION,
  SENDERID,
  KVSR,
  OKFS,
  OKOPF,
  OPENDATE,
  CLOSEDATE,
  CHANGEDATE,
  GENERALORG_REF,
  FEDERALREGIONCODE,
  ORG_TYPE,
  BUDGETREF,
  SUPPLIERSTATUS,
  COUNTRYCODE,
  DATECLOSE,
  ORGCODE,
  COSTAUTHORITY,
  INCOMEAUTHORITY,
  DEBTAUTHORITY,
  SVRAUTHORITY,
  CLIENTID,
  DATEOPEN,
  FUID,
  OKPO,
  OKTMO,
  DOCSTATEREF,
  CRYPTOSTATUS)
AS
  SELECT
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS
  FROM TB_organizations
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_ID
  INSTEAD OF DELETE
  ON ORGANIZATIONS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_ORGANIZATIONS_BD)
-- Last update 09.06.2008
-- - - - - - - - - - - - -

  if (:old.ID = 0) then
    RaiseException('ex_CantDelUnknownOrg');
  end if;

  delete from Org_Accounts where org_ref = :old.id;
  delete from Banks where id = :old.id;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_ORGANIZATIONS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_200 (TR_ORGANIZATIONS_AD_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

update Organizations set
    GeneralOrg_Ref = id
  where
    GeneralOrg_Ref = :old.id;

-- - - - - - - - - - - - -
-- AD_500 (TR_ORGANIZATIONS_AD_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(27, :old.ID ,SYSDATE);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_II
  INSTEAD OF INSERT
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
--
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_Organizations_bi)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$FUID is null) then 
    new$FUID := new$id;
  END IF;
  if (new$GOSNI is null) then 
    new$GOSNI := 0;
  END IF;
  if (new$Name is null) then 
    new$Name := 'Не указано наименование';
  END IF;
  if (new$City is null) then 
    GetVarcharConst(-1,7,new$City);
  END IF;
  if (new$COUNTRY is null) then 
    new$COUNTRY := 'Россия';
  END IF;
  if (new$CountryCode is null) then 
    new$CountryCode := 643;
  END IF;
  if (new$ORG_CLS is NULL) then 
    new$ORG_CLS:= 0;
  END IF;
  if (new$SubINN is null) then 
    new$SubINN:= 0;
  END IF;
  if (new$INN20 is null) then 
    new$INN20:= '';
  END IF;
  if (new$RCOrg is null) then 
    new$RCOrg := 0;
  END IF;
  if (new$RegionCls is null) then 
    new$RegionCls := 0;
  END IF;
  if (new$OKATO is null) then 
    new$OKATO := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$OKFS is null) then 
    new$OKFS := 0;
  END IF;
  if (new$OKOPF is null) then 
    new$OKOPF := 0;
  END IF;
  if (new$FederalRegionCode is null) then
    GetIntConst(-1, 27,new$FederalRegionCode);
  END IF;
  if (new$FederalRegionCode is null) then
    new$FederalRegionCode := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;
  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$INN > 9999999999.9) and (new$INN20 <> '') and (new$INN20 is not null)) then
    RaiseException('EX_WRONGKPP');
  END IF;
  check_unique_organization(new$inn,  new$inn20);
  if (new$CostAuthority is null) then 
    new$CostAuthority:= 0;
  END IF;
  if (new$IncomeAuthority is null) then 
    new$IncomeAuthority := 0;
  END IF;
  if (new$DebtAuthority is null) then 
    new$DebtAuthority := 0;
  END IF;
  if (new$SVRAuthority is null) then 
    new$SVRAuthority := 0;
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if (new$Org_Type is not null)
  then 
    if (new$Org_Type between 10100 and 10299) then
      new$CostAuthority:= 1;
    END IF;
    if (new$Org_Type between 10300 and 10399) then
      new$CostAuthority:= 2;
    END IF;
    if (new$Org_Type between 10400 and 10499) then
      new$CostAuthority:= 4;
    END IF;
    if (((new$Org_Type between 10500 and 10599) and (new$CostAuthority<>16)) or
    (((new$Org_Type between 10000 and 10099) or (new$Org_Type between 10600 and 10799))
    and (new$CostAuthority=0))) then
      new$CostAuthority:= 8;
        
    END IF;
  else 
    new$Org_Type := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_ORGANIZATIONS_BI_10)
-- Last update 19.10.2006
-- - - - - - - - - - - - -

  if (new$FacialAcc is not null) then
    select count(id) into cnt$ from Organizations where (FacialAcc = new$FacialAcc) AND (ROWNUM = 1);
    if (cnt$ <> 0) then RaiseException('ex_DublicateFacialAcc'); end if;
  end if;

-- - - - - - - - - - - - -
-- BI_200 (TR_ORGANIZATIONS_BI_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;

    /*  При вставке КВСР берем из распорядителя, если он уже не заполнен*/
    if (new$KVSR = 0) then
      select o.KVSR into new$KVSR
      from Organizations o
      where o.id = new$GeneralOrg_Ref;
    end if;
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORGANIZATIONS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORGANIZATIONS (
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS
  ) VALUES (
    new$ID,
    new$NAME,
    new$GOSNI,
    new$CITY,
    new$COUNTRY,
    new$PHONE,
    new$ADDRESS,
    new$ORG_CLS,
    new$INN20,
    new$SUBINN,
    new$FACIALACC,
    new$REGIONCLS,
    new$DIRNAME,
    new$BUGNAME,
    new$DIRPHONE,
    new$BUGPHONE,
    new$RCORG,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$INN,
    new$OKATO,
    new$EMAIL,
    new$WEBSITE,
    new$UFKCODE,
    new$ADDOKATO,
    new$SHORTNAME,
    new$RVERSION,
    new$SENDERID,
    new$KVSR,
    new$OKFS,
    new$OKOPF,
    new$OPENDATE,
    new$CLOSEDATE,
    new$CHANGEDATE,
    new$GENERALORG_REF,
    new$FEDERALREGIONCODE,
    new$ORG_TYPE,
    new$BUDGETREF,
    new$SUPPLIERSTATUS,
    new$COUNTRYCODE,
    new$DATECLOSE,
    new$ORGCODE,
    new$COSTAUTHORITY,
    new$INCOMEAUTHORITY,
    new$DEBTAUTHORITY,
    new$SVRAUTHORITY,
    new$CLIENTID,
    new$DATEOPEN,
    new$FUID,
    new$OKPO,
    new$OKTMO,
    new$DOCSTATEREF,
    new$CRYPTOSTATUS);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORGANIZATIONS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 27) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_IU
  INSTEAD OF UPDATE
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
--
  CNT$ NUMBER(10);
  c$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_organizations_bu)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$gosni is null) then 
    new$gosni := 0;
  END IF;
  if (new$city is null) then 
    getvarcharconst(-1,7,new$city);
  END IF;
  if (new$country is null) then 
    new$country := 'Россия';
  END IF;
  if (new$countrycode is null) then 
    new$countrycode := 643;
  END IF;
  if (new$org_cls is null) then 
    new$org_cls:= 0;
  END IF;
  if (new$inn20 is null) then 
    new$inn20:= '';
  END IF;
  if (new$rcorg is null) then 
    new$rcorg := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$okato is null) then 
    new$okato := 0;
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$okfs is null) then 
    new$okfs := 0;
  END IF;
  if (new$okopf is null) then 
    new$okopf := 0;
  END IF;
  if (new$federalregioncode is null) then
    getintconst(-1, 27,new$federalregioncode);
  END IF;
  if (new$federalregioncode is null) then
    new$federalregioncode := 0;
  END IF;
  if (new$budgetref is null) then 
    new$budgetref := 0;
  END IF;
  if (new$org_type is null) then 
    new$org_type := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;

  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null))) then 
    if ((new$inn > 9999999999.9) and (new$inn20 <> '')) then
      RaiseException('ex_wrongkpp');  
    END IF;
  END IF;
  if ( ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null)))
  or ( (new$inn20 <> :old.inn20) or ((:old.inn20 is null) and (new$inn20 is not null))) )
  then
    check_unique_organization(new$inn,  new$inn20);
  END IF;
   
  if (new$regioncls <> :old.regioncls) then
    update dfaccountsbuhtable set
    regioncls = new$regioncls
    where id = any (select id from org_accounts where org_ref = new$id);
  END IF;
  /* Запрет изменений в неуказанной организации */
  if (:old.id = 0) then
    RaiseException('ex_cantmodifyunknownorg');
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if ((new$org_type<>:old.org_type) or (new$costauthority<>:old.costauthority))
  then 
    c$ := new$costauthority;
    if (new$org_type between 10100 and 10299) then
      new$costauthority:= 1;
    END IF;
    if (new$org_type between 10300 and 10399) then
      new$costauthority:= 2;
    END IF;
    if (new$org_type between 10400 and 10499) then
      new$costauthority:= 4;
    END IF;
    if (((new$org_type between 10500 and 10599) and (new$costauthority<>16)) or
    (((new$org_type between 10000 and 10099) or (new$org_type between 10600 and 10799))
    and (new$costauthority=0))) then
      new$costauthority:= 8;
    END IF;
    if ((new$org_type=:old.org_type) and (c$<>new$costauthority)) then
      RaiseException('ex_wrongcostauthority');  
    END IF;
  END IF;
  /* если изменилось значение RegionCls у организации, то меняем
      и у подведомственных лс*/
  if (new$regioncls <> :old.regioncls) then
    update facialacc_cls fac set
    fac.regioncls = new$regioncls
    where
    new$id = fac.org_ref;
      
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_ORGANIZATIONS_BU_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$FacialAcc <> :old.FacialAcc) then
    select count(id) into CNT$ from Organizations
      where (FacialAcc = new$FacialAcc) and (id <> new$id) AND (ROWNUM = 1);
    if (CNT$ <> 0) then
      RaiseException('ex_DublicateFacialAcc');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORGANIZATIONS_BU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- COMMENT сноска в детали даты закрытия


    /*  закрытие организации */
    if ((new$DateClose is not null) and (:old.DateClose is null)) then
      /*  закрываем счета флажком и указываем причину закрытия */
      update Org_Accounts set
        CloseCode = CloseCode + 10
      where Org_Ref = new$Id;
    end if;

    /*  Для л/с надо еще учитывать изменение даты */
    if (((new$DateClose is not null) and (:old.DateClose is null)) or (new$DateClose <> :old.DateClose)) then
      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode + 10
      where Org_ref = new$Id;
    end if;

    /*  открытие организации */
    if ((new$DateClose is null) and (:old.DateClose is not null)) then
      update Org_Accounts set
        CloseCode = CloseCode - 10
      where Org_Ref = new$Id;

      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode - 10
      where Org_ref = new$Id;
    end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_ORGANIZATIONS_BU_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;
  end if;

  if (new$GeneralOrg_Ref <> :old.GeneralOrg_Ref) then
    update FacialAcc_CLS set
      GeneralOrg_Ref = new$GeneralOrg_Ref
    where
      Org_Ref = new$id;
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORGANIZATIONS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  IF (new$RVersion IS NULL) THEN
    new$RVersion := 1;
  ELSIF ( (new$RVersion = -1) AND (:OLD.RVersion <> -1) ) THEN
    new$RVersion := :OLD.RVersion;
  ELSE
    new$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORGANIZATIONS SET
    ID = new$ID,
    NAME = new$NAME,
    GOSNI = new$GOSNI,
    CITY = new$CITY,
    COUNTRY = new$COUNTRY,
    PHONE = new$PHONE,
    ADDRESS = new$ADDRESS,
    ORG_CLS = new$ORG_CLS,
    INN20 = new$INN20,
    SUBINN = new$SUBINN,
    FACIALACC = new$FACIALACC,
    REGIONCLS = new$REGIONCLS,
    DIRNAME = new$DIRNAME,
    BUGNAME = new$BUGNAME,
    DIRPHONE = new$DIRPHONE,
    BUGPHONE = new$BUGPHONE,
    RCORG = new$RCORG,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    INN = new$INN,
    OKATO = new$OKATO,
    EMAIL = new$EMAIL,
    WEBSITE = new$WEBSITE,
    UFKCODE = new$UFKCODE,
    ADDOKATO = new$ADDOKATO,
    SHORTNAME = new$SHORTNAME,
    RVERSION = new$RVERSION,
    SENDERID = new$SENDERID,
    KVSR = new$KVSR,
    OKFS = new$OKFS,
    OKOPF = new$OKOPF,
    OPENDATE = new$OPENDATE,
    CLOSEDATE = new$CLOSEDATE,
    CHANGEDATE = new$CHANGEDATE,
    GENERALORG_REF = new$GENERALORG_REF,
    FEDERALREGIONCODE = new$FEDERALREGIONCODE,
    ORG_TYPE = new$ORG_TYPE,
    BUDGETREF = new$BUDGETREF,
    SUPPLIERSTATUS = new$SUPPLIERSTATUS,
    COUNTRYCODE = new$COUNTRYCODE,
    DATECLOSE = new$DATECLOSE,
    ORGCODE = new$ORGCODE,
    COSTAUTHORITY = new$COSTAUTHORITY,
    INCOMEAUTHORITY = new$INCOMEAUTHORITY,
    DEBTAUTHORITY = new$DEBTAUTHORITY,
    SVRAUTHORITY = new$SVRAUTHORITY,
    CLIENTID = new$CLIENTID,
    DATEOPEN = new$DATEOPEN,
    FUID = new$FUID,
    OKPO = new$OKPO,
    OKTMO = new$OKTMO,
    DOCSTATEREF = new$DOCSTATEREF,
    CRYPTOSTATUS = new$CRYPTOSTATUS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_100 (TR_ORGANIZATIONS_AU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- Comment Триггер обработки открытия/закрытия организации


  /*  Закрытие организации */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
    update Banks set DateClose = new$DateClose where (id = new$ID) and (DateClose is null);
  end if;

  /*  открытие организации */
  if ((new$DateClose is null) and (:old.DateClose is not null)) then
    update Banks set DateClose = null where (id = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_200 (TR_ORGANIZATIONS_AU_200)
-- Create 26.07.2007
-- - - - - - - - - - - - -

  if (new$BudgetRef <> :old.BudgetRef) then
    update FacialAcc_CLS set
      BudgetRef = new$BudgetRef
    where
      (ORG_REF = new$id)and(BudgetRef = :old.BudgetRef);
  end if;

  /*  Сносим организацию в проставленный КВСР, только если это ГРБС*/
  if ((new$KVSR <> :old.KVSR)and(new$Org_Type >= 10100)and(new$Org_Type <= 10299)) then
    update KVSR set
      Org_Ref = new$id
    where
      id = new$KVSR;
  end if;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORGANIZATIONS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (27, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=27) and (RecordId=new$ID);
  end if;

END;
/
COMMIT WORK
/
ALTER TABLE TB_Organizations ADD (
  CONSTRAINT FK_ORG_DOCSTATEREF FOREIGN KEY (DOCSTATEREF) REFERENCES STATE_DOCSTATES (ID) 
)
/
CREATE INDEX FK_ORG_DOCSTATEREF ON TB_Organizations(DOCSTATEREF)
/
-- CREATE TRIGGER TR_ORGANIZATIONS_BU_210
CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_IU
  INSTEAD OF UPDATE
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
--
  CNT$ NUMBER(10);
  c$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_organizations_bu)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$gosni is null) then 
    new$gosni := 0;
  END IF;
  if (new$city is null) then 
    getvarcharconst(-1,7,new$city);
  END IF;
  if (new$country is null) then 
    new$country := 'Россия';
  END IF;
  if (new$countrycode is null) then 
    new$countrycode := 643;
  END IF;
  if (new$org_cls is null) then 
    new$org_cls:= 0;
  END IF;
  if (new$inn20 is null) then 
    new$inn20:= '';
  END IF;
  if (new$rcorg is null) then 
    new$rcorg := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$okato is null) then 
    new$okato := 0;
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$okfs is null) then 
    new$okfs := 0;
  END IF;
  if (new$okopf is null) then 
    new$okopf := 0;
  END IF;
  if (new$federalregioncode is null) then
    getintconst(-1, 27,new$federalregioncode);
  END IF;
  if (new$federalregioncode is null) then
    new$federalregioncode := 0;
  END IF;
  if (new$budgetref is null) then 
    new$budgetref := 0;
  END IF;
  if (new$org_type is null) then 
    new$org_type := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;

  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null))) then 
    if ((new$inn > 9999999999.9) and (new$inn20 <> '')) then
      RaiseException('ex_wrongkpp');  
    END IF;
  END IF;
  if ( ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null)))
  or ( (new$inn20 <> :old.inn20) or ((:old.inn20 is null) and (new$inn20 is not null))) )
  then
    check_unique_organization(new$inn,  new$inn20);
  END IF;
   
  if (new$regioncls <> :old.regioncls) then
    update dfaccountsbuhtable set
    regioncls = new$regioncls
    where id = any (select id from org_accounts where org_ref = new$id);
  END IF;
  /* Запрет изменений в неуказанной организации */
  if (:old.id = 0) then
    RaiseException('ex_cantmodifyunknownorg');
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if ((new$org_type<>:old.org_type) or (new$costauthority<>:old.costauthority))
  then 
    c$ := new$costauthority;
    if (new$org_type between 10100 and 10299) then
      new$costauthority:= 1;
    END IF;
    if (new$org_type between 10300 and 10399) then
      new$costauthority:= 2;
    END IF;
    if (new$org_type between 10400 and 10499) then
      new$costauthority:= 4;
    END IF;
    if (((new$org_type between 10500 and 10599) and (new$costauthority<>16)) or
    (((new$org_type between 10000 and 10099) or (new$org_type between 10600 and 10799))
    and (new$costauthority=0))) then
      new$costauthority:= 8;
    END IF;
    if ((new$org_type=:old.org_type) and (c$<>new$costauthority)) then
      RaiseException('ex_wrongcostauthority');  
    END IF;
  END IF;
  /* если изменилось значение RegionCls у организации, то меняем
      и у подведомственных лс*/
  if (new$regioncls <> :old.regioncls) then
    update facialacc_cls fac set
    fac.regioncls = new$regioncls
    where
    new$id = fac.org_ref;
      
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_ORGANIZATIONS_BU_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$FacialAcc <> :old.FacialAcc) then
    select count(id) into CNT$ from Organizations
      where (FacialAcc = new$FacialAcc) and (id <> new$id) AND (ROWNUM = 1);
    if (CNT$ <> 0) then
      RaiseException('ex_DublicateFacialAcc');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORGANIZATIONS_BU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- COMMENT сноска в детали даты закрытия


    /*  закрытие организации */
    if ((new$DateClose is not null) and (:old.DateClose is null)) then
      /*  закрываем счета флажком и указываем причину закрытия */
      update Org_Accounts set
        CloseCode = CloseCode + 10
      where Org_Ref = new$Id;
    end if;

    /*  Для л/с надо еще учитывать изменение даты */
    if (((new$DateClose is not null) and (:old.DateClose is null)) or (new$DateClose <> :old.DateClose)) then
      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode + 10
      where Org_ref = new$Id;
    end if;

    /*  открытие организации */
    if ((new$DateClose is null) and (:old.DateClose is not null)) then
      update Org_Accounts set
        CloseCode = CloseCode - 10
      where Org_Ref = new$Id;

      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode - 10
      where Org_ref = new$Id;
    end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_ORGANIZATIONS_BU_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;
  end if;

  if (new$GeneralOrg_Ref <> :old.GeneralOrg_Ref) then
    update FacialAcc_CLS set
      GeneralOrg_Ref = new$GeneralOrg_Ref
    where
      Org_Ref = new$id;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_ORGANIZATIONS_BU_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$DOCSTATEREF <> :old.DOCSTATEREF) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(new$id, :old.DOCSTATEREF, new$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORGANIZATIONS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  IF (new$RVersion IS NULL) THEN
    new$RVersion := 1;
  ELSIF ( (new$RVersion = -1) AND (:OLD.RVersion <> -1) ) THEN
    new$RVersion := :OLD.RVersion;
  ELSE
    new$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORGANIZATIONS SET
    ID = new$ID,
    NAME = new$NAME,
    GOSNI = new$GOSNI,
    CITY = new$CITY,
    COUNTRY = new$COUNTRY,
    PHONE = new$PHONE,
    ADDRESS = new$ADDRESS,
    ORG_CLS = new$ORG_CLS,
    INN20 = new$INN20,
    SUBINN = new$SUBINN,
    FACIALACC = new$FACIALACC,
    REGIONCLS = new$REGIONCLS,
    DIRNAME = new$DIRNAME,
    BUGNAME = new$BUGNAME,
    DIRPHONE = new$DIRPHONE,
    BUGPHONE = new$BUGPHONE,
    RCORG = new$RCORG,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    INN = new$INN,
    OKATO = new$OKATO,
    EMAIL = new$EMAIL,
    WEBSITE = new$WEBSITE,
    UFKCODE = new$UFKCODE,
    ADDOKATO = new$ADDOKATO,
    SHORTNAME = new$SHORTNAME,
    RVERSION = new$RVERSION,
    SENDERID = new$SENDERID,
    KVSR = new$KVSR,
    OKFS = new$OKFS,
    OKOPF = new$OKOPF,
    OPENDATE = new$OPENDATE,
    CLOSEDATE = new$CLOSEDATE,
    CHANGEDATE = new$CHANGEDATE,
    GENERALORG_REF = new$GENERALORG_REF,
    FEDERALREGIONCODE = new$FEDERALREGIONCODE,
    ORG_TYPE = new$ORG_TYPE,
    BUDGETREF = new$BUDGETREF,
    SUPPLIERSTATUS = new$SUPPLIERSTATUS,
    COUNTRYCODE = new$COUNTRYCODE,
    DATECLOSE = new$DATECLOSE,
    ORGCODE = new$ORGCODE,
    COSTAUTHORITY = new$COSTAUTHORITY,
    INCOMEAUTHORITY = new$INCOMEAUTHORITY,
    DEBTAUTHORITY = new$DEBTAUTHORITY,
    SVRAUTHORITY = new$SVRAUTHORITY,
    CLIENTID = new$CLIENTID,
    DATEOPEN = new$DATEOPEN,
    FUID = new$FUID,
    OKPO = new$OKPO,
    OKTMO = new$OKTMO,
    DOCSTATEREF = new$DOCSTATEREF,
    CRYPTOSTATUS = new$CRYPTOSTATUS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_100 (TR_ORGANIZATIONS_AU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- Comment Триггер обработки открытия/закрытия организации


  /*  Закрытие организации */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
    update Banks set DateClose = new$DateClose where (id = new$ID) and (DateClose is null);
  end if;

  /*  открытие организации */
  if ((new$DateClose is null) and (:old.DateClose is not null)) then
    update Banks set DateClose = null where (id = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_200 (TR_ORGANIZATIONS_AU_200)
-- Create 26.07.2007
-- - - - - - - - - - - - -

  if (new$BudgetRef <> :old.BudgetRef) then
    update FacialAcc_CLS set
      BudgetRef = new$BudgetRef
    where
      (ORG_REF = new$id)and(BudgetRef = :old.BudgetRef);
  end if;

  /*  Сносим организацию в проставленный КВСР, только если это ГРБС*/
  if ((new$KVSR <> :old.KVSR)and(new$Org_Type >= 10100)and(new$Org_Type <= 10299)) then
    update KVSR set
      Org_Ref = new$id
    where
      id = new$KVSR;
  end if;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORGANIZATIONS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (27, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=27) and (RecordId=new$ID);
  end if;

END;
/
COMMIT WORK
/
-- CREATE TRIGGER TR_ORGANIZATIONS_AD_210
CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_ID
  INSTEAD OF DELETE
  ON ORGANIZATIONS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_ORGANIZATIONS_BD)
-- Last update 09.06.2008
-- - - - - - - - - - - - -

  if (:old.ID = 0) then
    RaiseException('ex_CantDelUnknownOrg');
  end if;

  delete from Org_Accounts where org_ref = :old.id;
  delete from Banks where id = :old.id;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_ORGANIZATIONS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_200 (TR_ORGANIZATIONS_AD_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

update Organizations set
    GeneralOrg_Ref = id
  where
    GeneralOrg_Ref = :old.id;

-- - - - - - - - - - - - -
-- AD_210 (TR_ORGANIZATIONS_AD_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Удаление истории изменений состоний для удаленного документа*/
  delete 
  from 
  StateJumpHistory
  where 
  DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_500 (TR_ORGANIZATIONS_AD_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(27, :old.ID ,SYSDATE);

END;
/
COMMIT WORK
/


-- #########################################################
-- #########################################################
-- alter_Orgs_10.00.sql
-- #########################################################
-- #########################################################

/* >Alter_TR_ORG_ACCOUNTS_AU.sql*//* http://budget.krista.ru/technology/Sys_Development/Orgs/date_sync14.htm *//* Добавить в справочник лицевых счетов поле «Номер прежнего л/с», 9 разрядов *//* Добавление в заголовок справочника организаций поля ОГРН (символьное поле, допустимая маска 13 разрядов, только числа), ввод с клавиатуры, необязательное для заполнения, значение может быть неуникальным (для филиалов организации). *//* НЕ ПОЛНОСТЬЮ. В детализацию «Расчетные счета» справочника организаций добавить поля «Дата открытия», «Дата закрытия». Поля с маской ДД.ММ.ГГГГ 
Должны быть связаны с аналогичными полями в справочнике л/с для фиктивных р/с и прочими владельцами (банком, оганизацией, счетом обслуживающей).
*/
ALTER TABLE TB_FacialAcc_Cls ADD (
  PrevCls NUMBER(10)/* @ref FacialAcc_Cls Номер прежнего л/с */,
    CHECK((PrevCls<=2147483647)AND(PrevCls>-2147483648))
)
/

CREATE OR REPLACE VIEW FacialAcc_Cls (
  ID,
  CODE1,
  CODE2,
  CODE3,
  CODE4,
  KVSR,
  KCSR,
  KFSR,
  KVR,
  KESR,
  FINTYPE,
  ORG_REF,
  DATEOPEN,
  SERVICEACCOUNT,
  STATUSACCOUNT,
  HARACTERACCOUNT,
  REGIONCLS,
  CREATEDATE,
  UPDATEDATE,
  FACIALCODE,
  MEANSTYPE,
  GENERALORG_REF,
  DEPARTMENTCLS,
  RVERSION,
  CLOSEDOCNUMBER,
  HIGHERORG_REF,
  BUDGETREF,
  FCACCOUNT,
  CLOSECODE,
  DATECLOSE,
  CREATERUSER,
  UPDATERUSER,
  NOTE,
  NAME,
  FACIALCODEEX,
  ISRBS,
  ISPBS,
  ISBU,
  ISSEPARATEBU,
  ISPROXY,
  OPENDOCNUMBER,
  ISOMS,
  CHANGEDOCNUMBER,
  DATECHANGE,
  GENERALORGFACIALACC,
  GRANTEEORG_REF,
  PREVCLS)
AS
  SELECT
    ID,
    CODE1,
    CODE2,
    CODE3,
    CODE4,
    KVSR,
    KCSR,
    KFSR,
    KVR,
    KESR,
    FINTYPE,
    ORG_REF,
    DATEOPEN,
    SERVICEACCOUNT,
    STATUSACCOUNT,
    HARACTERACCOUNT,
    REGIONCLS,
    CREATEDATE,
    UPDATEDATE,
    FACIALCODE,
    MEANSTYPE,
    GENERALORG_REF,
    DEPARTMENTCLS,
    RVERSION,
    CLOSEDOCNUMBER,
    HIGHERORG_REF,
    BUDGETREF,
    FCACCOUNT,
    CLOSECODE,
    DATECLOSE,
    CREATERUSER,
    UPDATERUSER,
    NOTE,
    NAME,
    FACIALCODEEX,
    ISRBS,
    ISPBS,
    ISBU,
    ISSEPARATEBU,
    ISPROXY,
    OPENDOCNUMBER,
    ISOMS,
    CHANGEDOCNUMBER,
    DATECHANGE,
    GENERALORGFACIALACC,
    GRANTEEORG_REF,
    PREVCLS
  FROM TB_FacialAcc_Cls
/

CREATE OR REPLACE TRIGGER TR_FACIALACC_CLS_ID
  INSTEAD OF DELETE
  ON FACIALACC_CLS
  FOR EACH ROW
DECLARE
  CNT$1 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (facialacc_cls_bd0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  SELECT COUNT(CONSTVALUE ) INTO CNT$1
  from INTCONST where ((CONSTVALUE = :old.id)) AND (ROWNUM = 1);
  if ((CNT$1<> 0)) then
    RaiseException('EX_CANNOTDELETE_FACIAL_ACC');
  END IF;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_FACIALACC_CLS
  WHERE ID = :OLD.ID
       AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AD_500 (TR_FACIALACC_CLS_AD_500)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
     VALUES (19, :OLD.ID, SYSDATE);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALACC_CLS_II
  INSTEAD OF INSERT
  ON FACIALACC_CLS
  FOR EACH ROW
DECLARE
  new$ID FACIALACC_CLS.ID%TYPE := :NEW.ID;
  new$CODE1 FACIALACC_CLS.CODE1%TYPE := :NEW.CODE1;
  new$CODE2 FACIALACC_CLS.CODE2%TYPE := :NEW.CODE2;
  new$CODE3 FACIALACC_CLS.CODE3%TYPE := :NEW.CODE3;
  new$CODE4 FACIALACC_CLS.CODE4%TYPE := :NEW.CODE4;
  new$KVSR FACIALACC_CLS.KVSR%TYPE := :NEW.KVSR;
  new$KCSR FACIALACC_CLS.KCSR%TYPE := :NEW.KCSR;
  new$KFSR FACIALACC_CLS.KFSR%TYPE := :NEW.KFSR;
  new$KVR FACIALACC_CLS.KVR%TYPE := :NEW.KVR;
  new$KESR FACIALACC_CLS.KESR%TYPE := :NEW.KESR;
  new$FINTYPE FACIALACC_CLS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$ORG_REF FACIALACC_CLS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$DATEOPEN FACIALACC_CLS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$SERVICEACCOUNT FACIALACC_CLS.SERVICEACCOUNT%TYPE := :NEW.SERVICEACCOUNT;
  new$STATUSACCOUNT FACIALACC_CLS.STATUSACCOUNT%TYPE := :NEW.STATUSACCOUNT;
  new$HARACTERACCOUNT FACIALACC_CLS.HARACTERACCOUNT%TYPE := :NEW.HARACTERACCOUNT;
  new$REGIONCLS FACIALACC_CLS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$CREATEDATE FACIALACC_CLS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALACC_CLS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$FACIALCODE FACIALACC_CLS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$MEANSTYPE FACIALACC_CLS.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$GENERALORG_REF FACIALACC_CLS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$DEPARTMENTCLS FACIALACC_CLS.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$RVERSION FACIALACC_CLS.RVERSION%TYPE := :NEW.RVERSION;
  new$CLOSEDOCNUMBER FACIALACC_CLS.CLOSEDOCNUMBER%TYPE := :NEW.CLOSEDOCNUMBER;
  new$HIGHERORG_REF FACIALACC_CLS.HIGHERORG_REF%TYPE := :NEW.HIGHERORG_REF;
  new$BUDGETREF FACIALACC_CLS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$FCACCOUNT FACIALACC_CLS.FCACCOUNT%TYPE := :NEW.FCACCOUNT;
  new$CLOSECODE FACIALACC_CLS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$DATECLOSE FACIALACC_CLS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$CREATERUSER FACIALACC_CLS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER FACIALACC_CLS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE FACIALACC_CLS.NOTE%TYPE := :NEW.NOTE;
  new$NAME FACIALACC_CLS.NAME%TYPE := :NEW.NAME;
  new$FACIALCODEEX FACIALACC_CLS.FACIALCODEEX%TYPE := :NEW.FACIALCODEEX;
  new$ISRBS FACIALACC_CLS.ISRBS%TYPE := :NEW.ISRBS;
  new$ISPBS FACIALACC_CLS.ISPBS%TYPE := :NEW.ISPBS;
  new$ISBU FACIALACC_CLS.ISBU%TYPE := :NEW.ISBU;
  new$ISSEPARATEBU FACIALACC_CLS.ISSEPARATEBU%TYPE := :NEW.ISSEPARATEBU;
  new$ISPROXY FACIALACC_CLS.ISPROXY%TYPE := :NEW.ISPROXY;
  new$OPENDOCNUMBER FACIALACC_CLS.OPENDOCNUMBER%TYPE := :NEW.OPENDOCNUMBER;
  new$ISOMS FACIALACC_CLS.ISOMS%TYPE := :NEW.ISOMS;
  new$CHANGEDOCNUMBER FACIALACC_CLS.CHANGEDOCNUMBER%TYPE := :NEW.CHANGEDOCNUMBER;
  new$DATECHANGE FACIALACC_CLS.DATECHANGE%TYPE := :NEW.DATECHANGE;
  new$GENERALORGFACIALACC FACIALACC_CLS.GENERALORGFACIALACC%TYPE := :NEW.GENERALORGFACIALACC;
  new$GRANTEEORG_REF FACIALACC_CLS.GRANTEEORG_REF%TYPE := :NEW.GRANTEEORG_REF;
  new$PREVCLS FACIALACC_CLS.PREVCLS%TYPE := :NEW.PREVCLS;
--
  OrgDateClose$ Number;
  FCExEnable$ NUMBER(10);
  id_org$ NUMBER(10);
  id_reg$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FACIALACC_CLS_BI_0)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  facialacc_clsdiv(new$id,new$code1,new$code2,new$code3,new$code4);
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$kcsr is null) then 
    new$kcsr := 0;
  END IF;
  if (new$kfsr is null) then 
    new$kfsr := 0;
  END IF;
  if (new$kvr is null) then 
    new$kvr := 0;
  END IF;
  if (new$kesr is null) then 
    new$kesr := 0;
  END IF;
  if (new$fintype is null) then 
    new$fintype := 0;
  END IF;
  if (new$meanstype is null) then 
    new$meanstype := 0;
  END IF;
  if (new$haracteraccount is null) then 
    new$haracteraccount := 0;
  END IF;
  if (new$org_ref is null) then 
    new$org_ref := 0; -- поправил, был ранее select min (...)
  END IF;
  BEGIN

    -- Ставим ссылку на текущую организацию
    select o.generalorg_ref
    into id_org$     from organizations o
    where o.id = new$org_ref
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  if (id_org$  is null) then 
    id_org$ := new$org_ref;
  END IF;
  new$generalorg_ref := id_org$;
  BEGIN

    -- насильственная установка региона в лицевой счет
    -- согласно организации-владельца
    -- запрос региона --------------------------
    select o.RegionCLS
    into id_reg$     from Organizations o
    where o.ID = new$Org_Ref
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  new$regioncls := id_reg$;

-- - - - - - - - - - - - -
-- BI_100 (TR_FACIALACC_CLS_BI_100)
-- Create 01.12.2005
-- - - - - - - - - - - - -

/* Триггер перед вставкой - заполение ссылки на бюджет*/
   IF (    (   (new$ID = 0)
            OR (new$serviceaccount = 0)
            OR (new$serviceaccount IS NULL)
           )
       AND (new$budgetref IS NULL)
      ) THEN
      new$budgetRef := 0;
   END IF;

   IF (    (new$ID <> 0)
       AND (new$serviceaccount = 1)
       AND ((new$budgetref IS NULL) OR (new$budgetref = 0))
      ) THEN
      getintconst (-1, 3, new$budgetRef);
   END IF;

-- - - - - - - - - - - - -
-- BI_200 (TR_FACIALACC_CLS_BI_200)
-- Create 27.07.2007
-- - - - - - - - - - - - -

    if (new$Org_Ref is not null) then
      select DateClose into OrgDateClose$ from organizations where Id = new$Org_ref;
      if (OrgDateClose$ is not null) then
         if ((new$DateClose is null) or (new$DateClose > OrgDateClose$)) then
           new$DateClose := OrgDateClose$;
         end if;
         new$StatusAccount := 1;
         new$CloseCode := 10; /* Закрыт владельцем */
      end if;
    end if;
 
    if ((new$DateClose is not null) and (new$StatusAccount = 0)) then
      new$StatusAccount := 1;
      new$CloseCode := 1;
    end if;
 
    if (new$CloseCode is null) then new$CloseCode := 0; end if;

-- - - - - - - - - - - - -
-- BI_300 (TR_FACIALACC_CLS_BI_300)
-- Create 03.11.2010
-- - - - - - - - - - - - -

  GetIntConst(32, 42, FCExEnable$);
  if ((FCExEnable$ = 1) and (new$FacialCodeEx is null)) then
    RaiseException('EX_FacialCodeEx_Req');
  end if;  

-- - - - - - - - - - - - -
-- BI_400 (TR_FACIALACC_CLS_BI_400)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$IsRBS is null) then
    if (new$HaracterAccount in (1, 2)) then
      new$IsRBS := 1;
          
    else
      new$IsRBS := 0;
      
    END IF;
  END IF;
  if (new$IsPBS is null) then
    if (new$HaracterAccount in (0, 2)) then
      new$IsPBS := 1;
          
    else
      new$IsPBS := 0;
      
    END IF;
  END IF;
  if (new$IsBU is null) then
    new$IsBU := 0;
  END IF;
  if (new$IsOMS is null) then
    new$IsOMS := 0;
  END IF;
  if (new$IsSeparateBU is null) then
    new$IsSeparateBU := 0;
  END IF;
  if (new$IsProxy is null) then
    new$IsProxy := 0;
  END IF;
  if ((new$IsRBS + new$IsPBS + new$IsBU + new$IsOMS + new$IsSeparateBU + new$IsProxy) = 0) then
    new$HaracterAccount := 3;
      
  else
    if ((new$IsBU + new$IsOMS + new$IsSeparateBU + new$IsProxy) > 0) then
      new$HaracterAccount := 0;
          
    else
      if (new$IsRBS = 1) then
        new$HaracterAccount := new$IsRBS + new$IsPBS;
              
      else
        new$HaracterAccount := 0;
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_FACIALACC_CLS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_FACIALACC_CLS (
    ID,
    CODE1,
    CODE2,
    CODE3,
    CODE4,
    KVSR,
    KCSR,
    KFSR,
    KVR,
    KESR,
    FINTYPE,
    ORG_REF,
    DATEOPEN,
    SERVICEACCOUNT,
    STATUSACCOUNT,
    HARACTERACCOUNT,
    REGIONCLS,
    CREATEDATE,
    UPDATEDATE,
    FACIALCODE,
    MEANSTYPE,
    GENERALORG_REF,
    DEPARTMENTCLS,
    RVERSION,
    CLOSEDOCNUMBER,
    HIGHERORG_REF,
    BUDGETREF,
    FCACCOUNT,
    CLOSECODE,
    DATECLOSE,
    CREATERUSER,
    UPDATERUSER,
    NOTE,
    NAME,
    FACIALCODEEX,
    ISRBS,
    ISPBS,
    ISBU,
    ISSEPARATEBU,
    ISPROXY,
    OPENDOCNUMBER,
    ISOMS,
    CHANGEDOCNUMBER,
    DATECHANGE,
    GENERALORGFACIALACC,
    GRANTEEORG_REF,
    PREVCLS
  ) VALUES (
    new$ID,
    new$CODE1,
    new$CODE2,
    new$CODE3,
    new$CODE4,
    new$KVSR,
    new$KCSR,
    new$KFSR,
    new$KVR,
    new$KESR,
    new$FINTYPE,
    new$ORG_REF,
    new$DATEOPEN,
    new$SERVICEACCOUNT,
    new$STATUSACCOUNT,
    new$HARACTERACCOUNT,
    new$REGIONCLS,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$FACIALCODE,
    new$MEANSTYPE,
    new$GENERALORG_REF,
    new$DEPARTMENTCLS,
    new$RVERSION,
    new$CLOSEDOCNUMBER,
    new$HIGHERORG_REF,
    new$BUDGETREF,
    new$FCACCOUNT,
    new$CLOSECODE,
    new$DATECLOSE,
    new$CREATERUSER,
    new$UPDATERUSER,
    new$NOTE,
    new$NAME,
    new$FACIALCODEEX,
    new$ISRBS,
    new$ISPBS,
    new$ISBU,
    new$ISSEPARATEBU,
    new$ISPROXY,
    new$OPENDOCNUMBER,
    new$ISOMS,
    new$CHANGEDOCNUMBER,
    new$DATECHANGE,
    new$GENERALORGFACIALACC,
    new$GRANTEEORG_REF,
    new$PREVCLS);

-- - - - - - - - - - - - -
-- AI_500 (TR_FACIALACC_CLS_AI_500)
-- Last update 15.05.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 19) AND (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALACC_CLS_IU
  INSTEAD OF UPDATE
  ON FACIALACC_CLS
  FOR EACH ROW
DECLARE
  new$ID FACIALACC_CLS.ID%TYPE := :NEW.ID;
  new$CODE1 FACIALACC_CLS.CODE1%TYPE := :NEW.CODE1;
  new$CODE2 FACIALACC_CLS.CODE2%TYPE := :NEW.CODE2;
  new$CODE3 FACIALACC_CLS.CODE3%TYPE := :NEW.CODE3;
  new$CODE4 FACIALACC_CLS.CODE4%TYPE := :NEW.CODE4;
  new$KVSR FACIALACC_CLS.KVSR%TYPE := :NEW.KVSR;
  new$KCSR FACIALACC_CLS.KCSR%TYPE := :NEW.KCSR;
  new$KFSR FACIALACC_CLS.KFSR%TYPE := :NEW.KFSR;
  new$KVR FACIALACC_CLS.KVR%TYPE := :NEW.KVR;
  new$KESR FACIALACC_CLS.KESR%TYPE := :NEW.KESR;
  new$FINTYPE FACIALACC_CLS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$ORG_REF FACIALACC_CLS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$DATEOPEN FACIALACC_CLS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$SERVICEACCOUNT FACIALACC_CLS.SERVICEACCOUNT%TYPE := :NEW.SERVICEACCOUNT;
  new$STATUSACCOUNT FACIALACC_CLS.STATUSACCOUNT%TYPE := :NEW.STATUSACCOUNT;
  new$HARACTERACCOUNT FACIALACC_CLS.HARACTERACCOUNT%TYPE := :NEW.HARACTERACCOUNT;
  new$REGIONCLS FACIALACC_CLS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$CREATEDATE FACIALACC_CLS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALACC_CLS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$FACIALCODE FACIALACC_CLS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$MEANSTYPE FACIALACC_CLS.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$GENERALORG_REF FACIALACC_CLS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$DEPARTMENTCLS FACIALACC_CLS.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$RVERSION FACIALACC_CLS.RVERSION%TYPE := :NEW.RVERSION;
  new$CLOSEDOCNUMBER FACIALACC_CLS.CLOSEDOCNUMBER%TYPE := :NEW.CLOSEDOCNUMBER;
  new$HIGHERORG_REF FACIALACC_CLS.HIGHERORG_REF%TYPE := :NEW.HIGHERORG_REF;
  new$BUDGETREF FACIALACC_CLS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$FCACCOUNT FACIALACC_CLS.FCACCOUNT%TYPE := :NEW.FCACCOUNT;
  new$CLOSECODE FACIALACC_CLS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$DATECLOSE FACIALACC_CLS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$CREATERUSER FACIALACC_CLS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER FACIALACC_CLS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE FACIALACC_CLS.NOTE%TYPE := :NEW.NOTE;
  new$NAME FACIALACC_CLS.NAME%TYPE := :NEW.NAME;
  new$FACIALCODEEX FACIALACC_CLS.FACIALCODEEX%TYPE := :NEW.FACIALCODEEX;
  new$ISRBS FACIALACC_CLS.ISRBS%TYPE := :NEW.ISRBS;
  new$ISPBS FACIALACC_CLS.ISPBS%TYPE := :NEW.ISPBS;
  new$ISBU FACIALACC_CLS.ISBU%TYPE := :NEW.ISBU;
  new$ISSEPARATEBU FACIALACC_CLS.ISSEPARATEBU%TYPE := :NEW.ISSEPARATEBU;
  new$ISPROXY FACIALACC_CLS.ISPROXY%TYPE := :NEW.ISPROXY;
  new$OPENDOCNUMBER FACIALACC_CLS.OPENDOCNUMBER%TYPE := :NEW.OPENDOCNUMBER;
  new$ISOMS FACIALACC_CLS.ISOMS%TYPE := :NEW.ISOMS;
  new$CHANGEDOCNUMBER FACIALACC_CLS.CHANGEDOCNUMBER%TYPE := :NEW.CHANGEDOCNUMBER;
  new$DATECHANGE FACIALACC_CLS.DATECHANGE%TYPE := :NEW.DATECHANGE;
  new$GENERALORGFACIALACC FACIALACC_CLS.GENERALORGFACIALACC%TYPE := :NEW.GENERALORGFACIALACC;
  new$GRANTEEORG_REF FACIALACC_CLS.GRANTEEORG_REF%TYPE := :NEW.GRANTEEORG_REF;
  new$PREVCLS FACIALACC_CLS.PREVCLS%TYPE := :NEW.PREVCLS;
--
  id_org$ NUMBER(10);
  FCExEnable$ NUMBER(10);
  DiffCode1$ NUMBER(10);
  Code11$ NUMBER(10);
  Code21$ NUMBER(10);
  Code5$ NUMBER(10);
  CodeX1$ NUMBER(10);
  vOrgType$ NUMBER(10);
  id_org1$ NUMBER(10);
  id_reg1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_FACIALACC_CLS_BU_0)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$id <> :old.id) then 
    facialacc_clsdiv(new$id,new$code1,new$code2,new$code3,new$code4);
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$kcsr is null) then 
    new$kcsr := 0;
  END IF;
  if (new$kfsr is null) then 
    new$kfsr := 0;
  END IF;
  if (new$kvr is null) then 
    new$kvr := 0;
  END IF;
  if (new$kesr is null) then 
    new$kesr := 0;
  END IF;
  if (new$fintype is null) then 
    new$fintype := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$meanstype is null) then 
    new$meanstype := 0;
  END IF;
  if (new$haracteraccount is null) then 
    new$haracteraccount := 0;
  END IF;
  if (new$org_ref is null) then 
    new$org_ref := 0; -- поправил, был ранее select min (...)
  END IF;
  if ((new$org_ref <> :old.org_ref) and not(new$fcaccount is null)) then
    BEGIN
      select org_ref      into id_org1$ from org_accounts
      where id = new$fcaccount
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (id_org1$ <> new$org_ref) then 
      new$fcaccount := null;
     
    END IF;
  END IF;
  if (:old.Org_Ref <> new$Org_Ref) then 
    BEGIN
      -- запрос региона --------------------------
      select o.RegionCLS
      into id_reg1$        from Organizations o
      where o.ID = new$Org_Ref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    -- поместить регион -----------------
       
    new$regioncls := id_reg1$;
    BEGIN
      -- очистка связи с расчетным счетом для БУ/АУ----
      select o.Org_Type
      into vOrgType$      from Organizations o
      where o.ID = :old.Org_Ref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if ((vOrgType$  >= 10800)and(vOrgType$  <= 10900)) then
      update org_accounts
      set facialacc_cls = null
      where facialacc_cls = :old.id;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_FACIALACC_CLS_BU_100)
-- Create 01.12.2005
-- - - - - - - - - - - - -

   IF (    (   (new$ID = 0)
            OR (new$serviceaccount = 0)
            OR (new$serviceaccount IS NULL)
           )
       AND (new$budgetref IS NULL)
      ) THEN
      new$budgetRef := 0;
   END IF;

   IF (    (new$ID <> 0)
       AND (new$serviceaccount = 1)
       AND ((new$budgetref IS NULL) OR (new$budgetref = 0))
      ) THEN
      getintconst (-1, 3, new$budgetRef);
   END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_FACIALACC_CLS_BU_200)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* Закрытие/открытие пользователем */
  if ((((new$DateClose is not null) and (:old.DateClose is null)) or
  ((new$DateClose is null) and (:old.DateClose is not null)))
  and (new$CloseCode = :old.CloseCode))
  then 
    BEGIN
      /* При закрытии лицевого счета для БУ/АУ закрываем связанный расчетный счет.
           Аналогично при открытии ранее закрытого л/с
          */
      select o.Org_Type     into vOrgType$ from Organizations o where o.id = new$org_ref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if ((vOrgType$  >= 10800)and(vOrgType$  <= 10900)) then
      if (new$DateClose is not null or (new$statusaccount = 1 and :old.statusaccount=0))
      then
        update org_accounts
        set
        CloseCode = 10000
        where facialacc_cls = new$id;
              
      END IF;
      if (new$DateClose is null or (new$statusaccount = 0 and :old.statusaccount=1))
      then
        update org_accounts
        set
        CloseCode = 0
        where facialacc_cls = new$id;
          
      END IF;
    END IF;
    if (new$DateClose is not null) then 
      new$CloseCode := 1;
    END IF;
    if (new$DateClose is null) then 
      new$CloseCode := 0;
      
    END IF;
  END IF;
    
  /* Закрытие/открытие не пользователем (only по владельцу и лицевому расчетному счету) */
  if (new$CloseCode <> :old.CloseCode)
  then 
    DiffCode1$ := new$CloseCode - :old.CloseCode; /* >0 - счет закрывается, <0 - счет открывается*/
    CloseOrgCls_Div(:old.CloseCode,Code11$, Code21$, CodeX1$, CodeX1$, Code5$);
        
    /* Защита от "перезакрытия" */
    if (DiffCode1$ = 1) then 
      Code11$ := 1;
    END IF;
    if (DiffCode1$ = 10) then 
      Code21$ := 1;
    END IF;
    if (DiffCode1$ = 10000) then 
      Code5$ := 1;
    END IF;
    if (DiffCode1$ = -1) then 
      Code11$ := 0;
    END IF;
    if (DiffCode1$ = -10) then 
      Code21$ := 0;
    END IF;
    if (DiffCode1$ = -10000) then 
      Code5$ := 0;
    END IF;
    new$CloseCode := Code11$ + Code21$*10 + Code5$*10000;
        
    if (new$CloseCode <> 0) then 
      new$StatusAccount := 1;
    END IF;
        
    if (((new$CloseCode <> 0) and (new$DateClose is null)) or (new$DateClose >= :old.DateClose)) then
      new$DateClose := :old.DateClose;
          
    else 
      if (new$CloseCode = 0) then 
        new$DateClose := null;
        if (new$StatusAccount <> 0) then
          new$StatusAccount := 0;
                 
        END IF;
      END IF;  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_FACIALACC_CLS_BU_300)
-- Create 03.11.2010
-- - - - - - - - - - - - -

  GetIntConst(32, 42, FCExEnable$);
  if ((FCExEnable$ = 1) and (new$FacialCodeEx is null)) then
    RaiseException('EX_FacialCodeEx_Req');
  end if;       

-- - - - - - - - - - - - -
-- BU_400 (TR_FACIALACC_CLS_BU_400)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$IsRBS is null) then
    if (new$HaracterAccount in (1, 2)) then
      new$IsRBS := 1;
          
    else
      new$IsRBS := 0;
      
    END IF;
  END IF;
  if (new$IsPBS is null) then
    if (new$HaracterAccount in (0, 2)) then
      new$IsPBS := 1;
          
    else
      new$IsPBS := 0;
      
    END IF;
  END IF;
  if (new$IsBU is null) then
    new$IsBU := 0;
  END IF;
  if (new$IsOMS is null) then
    new$IsOMS := 0;
  END IF;
  if (new$IsSeparateBU is null) then
    new$IsSeparateBU := 0;
  END IF;
  if (new$IsProxy is null) then
    new$IsProxy := 0;
  END IF;
  if ((new$IsRBS + new$IsPBS + new$IsBU + new$IsOMS + new$IsSeparateBU + new$IsProxy) = 0) then
    new$HaracterAccount := 3;
      
  else
    if ((new$IsBU + new$IsOMS + new$IsSeparateBU + new$IsProxy) > 0) then
      new$HaracterAccount := 0;
          
    else
      if (new$IsRBS = 1) then
        new$HaracterAccount := new$IsRBS + new$IsPBS;
              
      else
        new$HaracterAccount := 0;
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_550 (TR_FACIALACC_CLS_BU_550)
-- Last update 15.05.2005
-- - - - - - - - - - - - -

   IF ((new$GeneralOrg_ref IS NULL)or(new$Org_Ref <> :old.Org_Ref)) THEN
     select
       o.GeneralOrg_Ref
     into
       id_org$
     from
       Organizations o
     where
       o.id = new$Org_Ref;
      /* Ставим ссылку на текущую организацию */
     if (id_org$ is Null)
       then id_org$ := new$Org_Ref;
     end if;  
     new$GeneralOrg_ref := id_org$;

   END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_FACIALACC_CLS_BU_700)
-- Create 19.09.2004
-- Last update 15.05.2005
-- - - - - - - - - - - - -

   IF (NEW$RVersion IS NULL) THEN
      NEW$RVersion := 1;
   ELSIF ((NEW$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      NEW$RVersion := :OLD.RVersion;
   ELSE
      NEW$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_FACIALACC_CLS SET
    ID = new$ID,
    CODE1 = new$CODE1,
    CODE2 = new$CODE2,
    CODE3 = new$CODE3,
    CODE4 = new$CODE4,
    KVSR = new$KVSR,
    KCSR = new$KCSR,
    KFSR = new$KFSR,
    KVR = new$KVR,
    KESR = new$KESR,
    FINTYPE = new$FINTYPE,
    ORG_REF = new$ORG_REF,
    DATEOPEN = new$DATEOPEN,
    SERVICEACCOUNT = new$SERVICEACCOUNT,
    STATUSACCOUNT = new$STATUSACCOUNT,
    HARACTERACCOUNT = new$HARACTERACCOUNT,
    REGIONCLS = new$REGIONCLS,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    FACIALCODE = new$FACIALCODE,
    MEANSTYPE = new$MEANSTYPE,
    GENERALORG_REF = new$GENERALORG_REF,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    RVERSION = new$RVERSION,
    CLOSEDOCNUMBER = new$CLOSEDOCNUMBER,
    HIGHERORG_REF = new$HIGHERORG_REF,
    BUDGETREF = new$BUDGETREF,
    FCACCOUNT = new$FCACCOUNT,
    CLOSECODE = new$CLOSECODE,
    DATECLOSE = new$DATECLOSE,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    NAME = new$NAME,
    FACIALCODEEX = new$FACIALCODEEX,
    ISRBS = new$ISRBS,
    ISPBS = new$ISPBS,
    ISBU = new$ISBU,
    ISSEPARATEBU = new$ISSEPARATEBU,
    ISPROXY = new$ISPROXY,
    OPENDOCNUMBER = new$OPENDOCNUMBER,
    ISOMS = new$ISOMS,
    CHANGEDOCNUMBER = new$CHANGEDOCNUMBER,
    DATECHANGE = new$DATECHANGE,
    GENERALORGFACIALACC = new$GENERALORGFACIALACC,
    GRANTEEORG_REF = new$GRANTEEORG_REF,
    PREVCLS = new$PREVCLS
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_FACIALACC_CLS_AU_500)
-- Create 28.04.2005
-- Last update 15.05.2005
-- - - - - - - - - - - - -

   IF (new$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (19, :OLD.ID, SYSDATE);

      DELETE FROM DelRecIndexes
            WHERE (TableID = 19) AND (RecordId = new$ID);
   END IF;

END;
/
commit work 
/
ALTER TABLE TB_Organizations ADD (
  OGRN VARCHAR2(20)/* ОГРН - основной государственный регистрационный номер записи о создании юридического лица */
)
/

CREATE OR REPLACE VIEW Organizations (
  ID,
  NAME,
  GOSNI,
  CITY,
  COUNTRY,
  PHONE,
  ADDRESS,
  ORG_CLS,
  INN20,
  SUBINN,
  FACIALACC,
  REGIONCLS,
  DIRNAME,
  BUGNAME,
  DIRPHONE,
  BUGPHONE,
  RCORG,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  INN,
  OKATO,
  EMAIL,
  WEBSITE,
  UFKCODE,
  ADDOKATO,
  SHORTNAME,
  RVERSION,
  SENDERID,
  KVSR,
  OKFS,
  OKOPF,
  OPENDATE,
  CLOSEDATE,
  CHANGEDATE,
  GENERALORG_REF,
  FEDERALREGIONCODE,
  ORG_TYPE,
  BUDGETREF,
  SUPPLIERSTATUS,
  COUNTRYCODE,
  DATECLOSE,
  ORGCODE,
  COSTAUTHORITY,
  INCOMEAUTHORITY,
  DEBTAUTHORITY,
  SVRAUTHORITY,
  CLIENTID,
  DATEOPEN,
  FUID,
  OKPO,
  OKTMO,
  DOCSTATEREF,
  CRYPTOSTATUS,
  OGRN)
AS
  SELECT
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS,
    OGRN
  FROM TB_Organizations
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_ID
  INSTEAD OF DELETE
  ON ORGANIZATIONS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_ORGANIZATIONS_BD)
-- Last update 09.06.2008
-- - - - - - - - - - - - -

  if (:old.ID = 0) then
    RaiseException('ex_CantDelUnknownOrg');
  end if;

  delete from Org_Accounts where org_ref = :old.id;
  delete from Banks where id = :old.id;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_ORGANIZATIONS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_200 (TR_ORGANIZATIONS_AD_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

update Organizations set
    GeneralOrg_Ref = id
  where
    GeneralOrg_Ref = :old.id;

-- - - - - - - - - - - - -
-- AD_210 (TR_ORGANIZATIONS_AD_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Удаление истории изменений состоний для удаленного документа*/
  delete 
  from 
  StateJumpHistory
  where 
  DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_500 (TR_ORGANIZATIONS_AD_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(27, :old.ID ,SYSDATE);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_II
  INSTEAD OF INSERT
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
--
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_Organizations_bi)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$FUID is null) then 
    new$FUID := new$id;
  END IF;
  if (new$GOSNI is null) then 
    new$GOSNI := 0;
  END IF;
  if (new$Name is null) then 
    new$Name := 'Не указано наименование';
  END IF;
  if (new$City is null) then 
    GetVarcharConst(-1,7,new$City);
  END IF;
  if (new$COUNTRY is null) then 
    new$COUNTRY := 'Россия';
  END IF;
  if (new$CountryCode is null) then 
    new$CountryCode := 643;
  END IF;
  if (new$ORG_CLS is NULL) then 
    new$ORG_CLS:= 0;
  END IF;
  if (new$SubINN is null) then 
    new$SubINN:= 0;
  END IF;
  if (new$INN20 is null) then 
    new$INN20:= '';
  END IF;
  if (new$RCOrg is null) then 
    new$RCOrg := 0;
  END IF;
  if (new$RegionCls is null) then 
    new$RegionCls := 0;
  END IF;
  if (new$OKATO is null) then 
    new$OKATO := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$OKFS is null) then 
    new$OKFS := 0;
  END IF;
  if (new$OKOPF is null) then 
    new$OKOPF := 0;
  END IF;
  if (new$FederalRegionCode is null) then
    GetIntConst(-1, 27,new$FederalRegionCode);
  END IF;
  if (new$FederalRegionCode is null) then
    new$FederalRegionCode := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;
  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$INN > 9999999999.9) and (new$INN20 <> '') and (new$INN20 is not null)) then
    RaiseException('EX_WRONGKPP');
  END IF;
  check_unique_organization(new$inn,  new$inn20);
  if (new$CostAuthority is null) then 
    new$CostAuthority:= 0;
  END IF;
  if (new$IncomeAuthority is null) then 
    new$IncomeAuthority := 0;
  END IF;
  if (new$DebtAuthority is null) then 
    new$DebtAuthority := 0;
  END IF;
  if (new$SVRAuthority is null) then 
    new$SVRAuthority := 0;
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if (new$Org_Type is not null)
  then 
    if (new$Org_Type between 10100 and 10299) then
      new$CostAuthority:= 1;
    END IF;
    if (new$Org_Type between 10300 and 10399) then
      new$CostAuthority:= 2;
    END IF;
    if (new$Org_Type between 10400 and 10499) then
      new$CostAuthority:= 4;
    END IF;
    if (((new$Org_Type between 10500 and 10599) and (new$CostAuthority<>16)) or
    (((new$Org_Type between 10000 and 10099) or (new$Org_Type between 10600 and 10799))
    and (new$CostAuthority=0))) then
      new$CostAuthority:= 8;
        
    END IF;
  else 
    new$Org_Type := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_ORGANIZATIONS_BI_10)
-- Last update 19.10.2006
-- - - - - - - - - - - - -

  if (new$FacialAcc is not null) then
    select count(id) into cnt$ from Organizations where (FacialAcc = new$FacialAcc) AND (ROWNUM = 1);
    if (cnt$ <> 0) then RaiseException('ex_DublicateFacialAcc'); end if;
  end if;

-- - - - - - - - - - - - -
-- BI_200 (TR_ORGANIZATIONS_BI_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;

    /*  При вставке КВСР берем из распорядителя, если он уже не заполнен*/
    if (new$KVSR = 0) then
      select o.KVSR into new$KVSR
      from Organizations o
      where o.id = new$GeneralOrg_Ref;
    end if;
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORGANIZATIONS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORGANIZATIONS (
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS,
    OGRN
  ) VALUES (
    new$ID,
    new$NAME,
    new$GOSNI,
    new$CITY,
    new$COUNTRY,
    new$PHONE,
    new$ADDRESS,
    new$ORG_CLS,
    new$INN20,
    new$SUBINN,
    new$FACIALACC,
    new$REGIONCLS,
    new$DIRNAME,
    new$BUGNAME,
    new$DIRPHONE,
    new$BUGPHONE,
    new$RCORG,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$INN,
    new$OKATO,
    new$EMAIL,
    new$WEBSITE,
    new$UFKCODE,
    new$ADDOKATO,
    new$SHORTNAME,
    new$RVERSION,
    new$SENDERID,
    new$KVSR,
    new$OKFS,
    new$OKOPF,
    new$OPENDATE,
    new$CLOSEDATE,
    new$CHANGEDATE,
    new$GENERALORG_REF,
    new$FEDERALREGIONCODE,
    new$ORG_TYPE,
    new$BUDGETREF,
    new$SUPPLIERSTATUS,
    new$COUNTRYCODE,
    new$DATECLOSE,
    new$ORGCODE,
    new$COSTAUTHORITY,
    new$INCOMEAUTHORITY,
    new$DEBTAUTHORITY,
    new$SVRAUTHORITY,
    new$CLIENTID,
    new$DATEOPEN,
    new$FUID,
    new$OKPO,
    new$OKTMO,
    new$DOCSTATEREF,
    new$CRYPTOSTATUS,
    new$OGRN);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORGANIZATIONS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 27) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_IU
  INSTEAD OF UPDATE
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
--
  CNT$ NUMBER(10);
  c$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_organizations_bu)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$gosni is null) then 
    new$gosni := 0;
  END IF;
  if (new$city is null) then 
    getvarcharconst(-1,7,new$city);
  END IF;
  if (new$country is null) then 
    new$country := 'Россия';
  END IF;
  if (new$countrycode is null) then 
    new$countrycode := 643;
  END IF;
  if (new$org_cls is null) then 
    new$org_cls:= 0;
  END IF;
  if (new$inn20 is null) then 
    new$inn20:= '';
  END IF;
  if (new$rcorg is null) then 
    new$rcorg := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$okato is null) then 
    new$okato := 0;
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$okfs is null) then 
    new$okfs := 0;
  END IF;
  if (new$okopf is null) then 
    new$okopf := 0;
  END IF;
  if (new$federalregioncode is null) then
    getintconst(-1, 27,new$federalregioncode);
  END IF;
  if (new$federalregioncode is null) then
    new$federalregioncode := 0;
  END IF;
  if (new$budgetref is null) then 
    new$budgetref := 0;
  END IF;
  if (new$org_type is null) then 
    new$org_type := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;

  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null))) then 
    if ((new$inn > 9999999999.9) and (new$inn20 <> '')) then
      RaiseException('ex_wrongkpp');  
    END IF;
  END IF;
  if ( ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null)))
  or ( (new$inn20 <> :old.inn20) or ((:old.inn20 is null) and (new$inn20 is not null))) )
  then
    check_unique_organization(new$inn,  new$inn20);
  END IF;
   
  if (new$regioncls <> :old.regioncls) then
    update dfaccountsbuhtable set
    regioncls = new$regioncls
    where id = any (select id from org_accounts where org_ref = new$id);
  END IF;
  /* Запрет изменений в неуказанной организации */
  if (:old.id = 0) then
    RaiseException('ex_cantmodifyunknownorg');
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if ((new$org_type<>:old.org_type) or (new$costauthority<>:old.costauthority))
  then 
    c$ := new$costauthority;
    if (new$org_type between 10100 and 10299) then
      new$costauthority:= 1;
    END IF;
    if (new$org_type between 10300 and 10399) then
      new$costauthority:= 2;
    END IF;
    if (new$org_type between 10400 and 10499) then
      new$costauthority:= 4;
    END IF;
    if (((new$org_type between 10500 and 10599) and (new$costauthority<>16)) or
    (((new$org_type between 10000 and 10099) or (new$org_type between 10600 and 10799))
    and (new$costauthority=0))) then
      new$costauthority:= 8;
    END IF;
    if ((new$org_type=:old.org_type) and (c$<>new$costauthority)) then
      RaiseException('ex_wrongcostauthority');  
    END IF;
  END IF;
  /* если изменилось значение RegionCls у организации, то меняем
      и у подведомственных лс*/
  if (new$regioncls <> :old.regioncls) then
    update facialacc_cls fac set
    fac.regioncls = new$regioncls
    where
    new$id = fac.org_ref;
      
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_ORGANIZATIONS_BU_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$FacialAcc <> :old.FacialAcc) then
    select count(id) into CNT$ from Organizations
      where (FacialAcc = new$FacialAcc) and (id <> new$id) AND (ROWNUM = 1);
    if (CNT$ <> 0) then
      RaiseException('ex_DublicateFacialAcc');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORGANIZATIONS_BU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- COMMENT сноска в детали даты закрытия


    /*  закрытие организации */
    if ((new$DateClose is not null) and (:old.DateClose is null)) then
      /*  закрываем счета флажком и указываем причину закрытия */
      update Org_Accounts set
        CloseCode = CloseCode + 10
      where Org_Ref = new$Id;
    end if;

    /*  Для л/с надо еще учитывать изменение даты */
    if (((new$DateClose is not null) and (:old.DateClose is null)) or (new$DateClose <> :old.DateClose)) then
      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode + 10
      where Org_ref = new$Id;
    end if;

    /*  открытие организации */
    if ((new$DateClose is null) and (:old.DateClose is not null)) then
      update Org_Accounts set
        CloseCode = CloseCode - 10
      where Org_Ref = new$Id;

      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode - 10
      where Org_ref = new$Id;
    end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_ORGANIZATIONS_BU_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;
  end if;

  if (new$GeneralOrg_Ref <> :old.GeneralOrg_Ref) then
    update FacialAcc_CLS set
      GeneralOrg_Ref = new$GeneralOrg_Ref
    where
      Org_Ref = new$id;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_ORGANIZATIONS_BU_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$DOCSTATEREF <> :old.DOCSTATEREF) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(new$id, :old.DOCSTATEREF, new$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORGANIZATIONS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  IF (new$RVersion IS NULL) THEN
    new$RVersion := 1;
  ELSIF ( (new$RVersion = -1) AND (:OLD.RVersion <> -1) ) THEN
    new$RVersion := :OLD.RVersion;
  ELSE
    new$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORGANIZATIONS SET
    ID = new$ID,
    NAME = new$NAME,
    GOSNI = new$GOSNI,
    CITY = new$CITY,
    COUNTRY = new$COUNTRY,
    PHONE = new$PHONE,
    ADDRESS = new$ADDRESS,
    ORG_CLS = new$ORG_CLS,
    INN20 = new$INN20,
    SUBINN = new$SUBINN,
    FACIALACC = new$FACIALACC,
    REGIONCLS = new$REGIONCLS,
    DIRNAME = new$DIRNAME,
    BUGNAME = new$BUGNAME,
    DIRPHONE = new$DIRPHONE,
    BUGPHONE = new$BUGPHONE,
    RCORG = new$RCORG,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    INN = new$INN,
    OKATO = new$OKATO,
    EMAIL = new$EMAIL,
    WEBSITE = new$WEBSITE,
    UFKCODE = new$UFKCODE,
    ADDOKATO = new$ADDOKATO,
    SHORTNAME = new$SHORTNAME,
    RVERSION = new$RVERSION,
    SENDERID = new$SENDERID,
    KVSR = new$KVSR,
    OKFS = new$OKFS,
    OKOPF = new$OKOPF,
    OPENDATE = new$OPENDATE,
    CLOSEDATE = new$CLOSEDATE,
    CHANGEDATE = new$CHANGEDATE,
    GENERALORG_REF = new$GENERALORG_REF,
    FEDERALREGIONCODE = new$FEDERALREGIONCODE,
    ORG_TYPE = new$ORG_TYPE,
    BUDGETREF = new$BUDGETREF,
    SUPPLIERSTATUS = new$SUPPLIERSTATUS,
    COUNTRYCODE = new$COUNTRYCODE,
    DATECLOSE = new$DATECLOSE,
    ORGCODE = new$ORGCODE,
    COSTAUTHORITY = new$COSTAUTHORITY,
    INCOMEAUTHORITY = new$INCOMEAUTHORITY,
    DEBTAUTHORITY = new$DEBTAUTHORITY,
    SVRAUTHORITY = new$SVRAUTHORITY,
    CLIENTID = new$CLIENTID,
    DATEOPEN = new$DATEOPEN,
    FUID = new$FUID,
    OKPO = new$OKPO,
    OKTMO = new$OKTMO,
    DOCSTATEREF = new$DOCSTATEREF,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    OGRN = new$OGRN
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_100 (TR_ORGANIZATIONS_AU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- Comment Триггер обработки открытия/закрытия организации


  /*  Закрытие организации */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
    update Banks set DateClose = new$DateClose where (id = new$ID) and (DateClose is null);
  end if;

  /*  открытие организации */
  if ((new$DateClose is null) and (:old.DateClose is not null)) then
    update Banks set DateClose = null where (id = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_200 (TR_ORGANIZATIONS_AU_200)
-- Create 26.07.2007
-- - - - - - - - - - - - -

  if (new$BudgetRef <> :old.BudgetRef) then
    update FacialAcc_CLS set
      BudgetRef = new$BudgetRef
    where
      (ORG_REF = new$id)and(BudgetRef = :old.BudgetRef);
  end if;

  /*  Сносим организацию в проставленный КВСР, только если это ГРБС*/
  if ((new$KVSR <> :old.KVSR)and(new$Org_Type >= 10100)and(new$Org_Type <= 10299)) then
    update KVSR set
      Org_Ref = new$id
    where
      id = new$KVSR;
  end if;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORGANIZATIONS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (27, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=27) and (RecordId=new$ID);
  end if;

END;
/
commit work 
/
ALTER TABLE TB_Org_Accounts ADD (
  DateOpen NUMBER,/* Дата открытия, включительно или Null */
  DateClose NUMBER/* Дата закрытия или Null */
)
/

CREATE OR REPLACE VIEW Org_Accounts (
  ID,
  ORG_REF,
  BANK_REF,
  ACC,
  ACC_CLS,
  FINTYPE,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  CLOSED,
  ACCDEFAULT,
  BANKDEPNUMBER,
  FACIALCODE,
  SERVICE_ORG_REF,
  ACOMMENT,
  ISDEFAULT,
  RVERSION,
  SERVICE_ACC_REF,
  CLOSECODE,
  SERVICEACC,
  FACIALACC_CLS,
  DATEOPEN,
  DATECLOSE)
AS
  SELECT
    ID,
    ORG_REF,
    BANK_REF,
    ACC,
    ACC_CLS,
    FINTYPE,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    CLOSED,
    ACCDEFAULT,
    BANKDEPNUMBER,
    FACIALCODE,
    SERVICE_ORG_REF,
    ACOMMENT,
    ISDEFAULT,
    RVERSION,
    SERVICE_ACC_REF,
    CLOSECODE,
    SERVICEACC,
    FACIALACC_CLS,
    DATEOPEN,
    DATECLOSE
  FROM TB_Org_Accounts
/

CREATE OR REPLACE TRIGGER TR_ORG_ACCOUNTS_ID
  INSTEAD OF DELETE
  ON ORG_ACCOUNTS
  FOR EACH ROW
DECLARE
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_ORG_ACCOUNTS_BD)
-- Create 05.06.2007
-- - - - - - - - - - - - -

  select count(*) into CNT$
  from Org_Accounts where Service_Acc_Ref = :old.ID;
  
  if (CNT$ > 0) then
    RaiseException('ex_CantDelServiceAcc');
  end if;  

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_ORG_ACCOUNTS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);
   
  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_500 (TR_ORG_ACCOUNTS_AD_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

   insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(21,:old.ID,SYSDATE);

END;
/

CREATE OR REPLACE TRIGGER TR_ORG_ACCOUNTS_II
  INSTEAD OF INSERT
  ON ORG_ACCOUNTS
  FOR EACH ROW
DECLARE
  new$ID ORG_ACCOUNTS.ID%TYPE := :NEW.ID;
  new$ORG_REF ORG_ACCOUNTS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$BANK_REF ORG_ACCOUNTS.BANK_REF%TYPE := :NEW.BANK_REF;
  new$ACC ORG_ACCOUNTS.ACC%TYPE := :NEW.ACC;
  new$ACC_CLS ORG_ACCOUNTS.ACC_CLS%TYPE := :NEW.ACC_CLS;
  new$FINTYPE ORG_ACCOUNTS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$CREATERUSER ORG_ACCOUNTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORG_ACCOUNTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORG_ACCOUNTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORG_ACCOUNTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$CLOSED ORG_ACCOUNTS.CLOSED%TYPE := :NEW.CLOSED;
  new$ACCDEFAULT ORG_ACCOUNTS.ACCDEFAULT%TYPE := :NEW.ACCDEFAULT;
  new$BANKDEPNUMBER ORG_ACCOUNTS.BANKDEPNUMBER%TYPE := :NEW.BANKDEPNUMBER;
  new$FACIALCODE ORG_ACCOUNTS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$SERVICE_ORG_REF ORG_ACCOUNTS.SERVICE_ORG_REF%TYPE := :NEW.SERVICE_ORG_REF;
  new$ACOMMENT ORG_ACCOUNTS.ACOMMENT%TYPE := :NEW.ACOMMENT;
  new$ISDEFAULT ORG_ACCOUNTS.ISDEFAULT%TYPE := :NEW.ISDEFAULT;
  new$RVERSION ORG_ACCOUNTS.RVERSION%TYPE := :NEW.RVERSION;
  new$SERVICE_ACC_REF ORG_ACCOUNTS.SERVICE_ACC_REF%TYPE := :NEW.SERVICE_ACC_REF;
  new$CLOSECODE ORG_ACCOUNTS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$SERVICEACC ORG_ACCOUNTS.SERVICEACC%TYPE := :NEW.SERVICEACC;
  new$FACIALACC_CLS ORG_ACCOUNTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$DATEOPEN ORG_ACCOUNTS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$DATECLOSE ORG_ACCOUNTS.DATECLOSE%TYPE := :NEW.DATECLOSE;
--
  OrgDateClose$ Number;
  AClosed$ Number(10);
  vOrgType$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_ORG_ACCOUNTS_BI)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$Org_Ref = 0) then 
    RaiseException('ex_CantAddUnknownOrgAcc');
  END IF;
  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$ACC_CLS is null) then 
    new$ACC_CLS:= 0;
  END IF;
  if (new$AccDefault is null) then 
    new$AccDefault:= 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType:= 0;
  END IF;
  if ((new$AComment is null) or (new$AComment  is null)) then 
    new$AComment := new$Acc;
  END IF;
  if ((new$IsDefault is not Null) and (new$IsDefault <> 0)) then
    update ORG_ACCOUNTS set
    IsDefault = 0
    where ORG_REF = new$ORG_REF
    and IsDefault is not Null
    and IsDefault <> 0;
  END IF;
  if ((new$SERVICE_ORG_REF is null)and(new$SERVICE_ACC_REF is not null)) then
    BEGIN
      select
      oa.Org_Ref
      into
      new$SERVICE_ORG_REF    from
      org_accounts oa
      where
      (oa.id = new$SERVICE_ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* При изменении типа счета сносить в вид обслуживания значение вида обслуживания из типа счета */
  if (new$ServiceAcc is null) then
    BEGIN
      select SERVICETYPE into new$ServiceAcc from ACC_CLS where (id = new$ACC_CLS) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если вид обслуживания из типа счета NULL, то писать 0(банк) */
  if (new$ServiceAcc is null) then
    new$ServiceAcc := 0;
    if (new$SERVICE_ORG_REF is not null) then
      BEGIN
        select
        o.Org_Type
        into vOrgType$      from
        Organizations o
        where
        (o.id = new$SERVICE_ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      if ((vOrgType$  > 10099)and(vOrgType$  < 10200)) then
        new$ServiceAcc := 3;
             
      else
        if ((vOrgType$  > 39999)and(vOrgType$  < 50000)) then
          new$ServiceAcc := 1;
        END IF;   
      END IF; 
    END IF;
  END IF;
  /* если у счета заполнен счет обсл. орг. и вид обсл. не банк, то проставим банк,
      такой же, как и у счета обсл. организации */
  if ((new$Service_Acc_Ref is not null) and (new$ServiceAcc <> 0)) then
    BEGIN
      select
      Bank_Ref, Acc
      into new$Bank_Ref, new$FacialCode    from
      Org_Accounts
      where
      new$Service_Acc_Ref = Id
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_ORG_ACCOUNTS_BI_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

  if (new$CloseCode is null) then new$CloseCode := 0; end if;

  if (new$Org_Ref is not null) then
    BEGIN
		select DateClose into OrgDateClose$ from organizations where Id = new$Org_ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (OrgDateClose$ is not null) then
      new$Closed := 1;
      new$CloseCode := 10; /* закрыт владельцем */
    end if;
  end if;

  if (new$Bank_Ref is not null) then
    BEGIN
		select DateClose into OrgDateClose$ from Banks where Id = new$Bank_ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END; 
    if (OrgDateClose$ is not null) then
      new$Closed := 1;
      new$CloseCode := new$CloseCode + 1000; /* закрыт банком */
    end if;
  end if;

  if (new$Service_Acc_Ref is not null) then
    BEGIN
		select Closed into AClosed$ from Org_Accounts where Id = new$Service_Acc_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END; 
    if (AClosed$ is not null) then
      new$Closed := 1;
      new$CloseCode := new$CloseCode + 100; /* закрыт обслуживающей организацией */
    end if;
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORG_ACCOUNTS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORG_ACCOUNTS (
    ID,
    ORG_REF,
    BANK_REF,
    ACC,
    ACC_CLS,
    FINTYPE,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    CLOSED,
    ACCDEFAULT,
    BANKDEPNUMBER,
    FACIALCODE,
    SERVICE_ORG_REF,
    ACOMMENT,
    ISDEFAULT,
    RVERSION,
    SERVICE_ACC_REF,
    CLOSECODE,
    SERVICEACC,
    FACIALACC_CLS,
    DATEOPEN,
    DATECLOSE
  ) VALUES (
    new$ID,
    new$ORG_REF,
    new$BANK_REF,
    new$ACC,
    new$ACC_CLS,
    new$FINTYPE,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$CLOSED,
    new$ACCDEFAULT,
    new$BANKDEPNUMBER,
    new$FACIALCODE,
    new$SERVICE_ORG_REF,
    new$ACOMMENT,
    new$ISDEFAULT,
    new$RVERSION,
    new$SERVICE_ACC_REF,
    new$CLOSECODE,
    new$SERVICEACC,
    new$FACIALACC_CLS,
    new$DATEOPEN,
    new$DATECLOSE);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORG_ACCOUNTS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 21) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_ORG_ACCOUNTS_IU
  INSTEAD OF UPDATE
  ON ORG_ACCOUNTS
  FOR EACH ROW
DECLARE
  new$ID ORG_ACCOUNTS.ID%TYPE := :NEW.ID;
  new$ORG_REF ORG_ACCOUNTS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$BANK_REF ORG_ACCOUNTS.BANK_REF%TYPE := :NEW.BANK_REF;
  new$ACC ORG_ACCOUNTS.ACC%TYPE := :NEW.ACC;
  new$ACC_CLS ORG_ACCOUNTS.ACC_CLS%TYPE := :NEW.ACC_CLS;
  new$FINTYPE ORG_ACCOUNTS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$CREATERUSER ORG_ACCOUNTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORG_ACCOUNTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORG_ACCOUNTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORG_ACCOUNTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$CLOSED ORG_ACCOUNTS.CLOSED%TYPE := :NEW.CLOSED;
  new$ACCDEFAULT ORG_ACCOUNTS.ACCDEFAULT%TYPE := :NEW.ACCDEFAULT;
  new$BANKDEPNUMBER ORG_ACCOUNTS.BANKDEPNUMBER%TYPE := :NEW.BANKDEPNUMBER;
  new$FACIALCODE ORG_ACCOUNTS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$SERVICE_ORG_REF ORG_ACCOUNTS.SERVICE_ORG_REF%TYPE := :NEW.SERVICE_ORG_REF;
  new$ACOMMENT ORG_ACCOUNTS.ACOMMENT%TYPE := :NEW.ACOMMENT;
  new$ISDEFAULT ORG_ACCOUNTS.ISDEFAULT%TYPE := :NEW.ISDEFAULT;
  new$RVERSION ORG_ACCOUNTS.RVERSION%TYPE := :NEW.RVERSION;
  new$SERVICE_ACC_REF ORG_ACCOUNTS.SERVICE_ACC_REF%TYPE := :NEW.SERVICE_ACC_REF;
  new$CLOSECODE ORG_ACCOUNTS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$SERVICEACC ORG_ACCOUNTS.SERVICEACC%TYPE := :NEW.SERVICEACC;
  new$FACIALACC_CLS ORG_ACCOUNTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$DATEOPEN ORG_ACCOUNTS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$DATECLOSE ORG_ACCOUNTS.DATECLOSE%TYPE := :NEW.DATECLOSE;
--
  DiffCode1$ NUMBER(10);
  Code11$ NUMBER(10);
  Code21$ NUMBER(10);
  Code31$ NUMBER(10);
  Code41$ NUMBER(10);
  Code5$ NUMBER(10);
  Temp1$ NUMBER(10);
  TempD$ NUMBER;
  vOrgType$ NUMBER(10);
  CurDate$ NUMBER;
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_ORG_ACCOUNTS_BU)
-- Version 7.02.00.3
-- - - - - - - - - - - - -

  if (new$ACC_CLS is null) then 
    new$ACC_CLS:= 0;
  END IF;
  if (new$AccDefault is null) then 
    new$AccDefault:= 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType:= 0;
  END IF;
  if ((new$AComment is null) or (new$AComment  is null) 
  or (new$AComment = :old.AComment) and (:old.AComment = :old.Acc)) then
    new$AComment := new$Acc;
  END IF;
  if ((new$IsDefault is not Null) and (new$IsDefault <> 0)
  and ((:old.IsDefault is Null) or (:old.IsDefault = 0))) then
    update ORG_ACCOUNTS set
    IsDefault = 0
    where ORG_REF = new$ORG_REF
    and IsDefault is not Null
    and IsDefault <> 0;
  END IF;
  if ((new$SERVICE_ORG_REF is null)and(new$SERVICE_ACC_REF is not null)) then
    BEGIN
      select
      oa.Org_Ref
      into
      new$SERVICE_ORG_REF    from
      org_accounts oa
      where
      (oa.id = new$SERVICE_ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* При изменении типа счета сносить в вид обслуживания значение вида обслуживания из типа счета */
  if (new$ACC_CLS <> :old.ACC_CLS) then
    BEGIN
      select SERVICETYPE into new$ServiceAcc from ACC_CLS where (id = new$ACC_CLS) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если изменяем вид обслуживания на банк, то надо очистить ссылки на обслуживающую организацию*/
  if (:old.ServiceAcc is not null and new$ServiceAcc = 0 and :old.ServiceAcc <> new$ServiceAcc) then
    new$service_acc_ref := null;
    new$service_org_ref := null;
     
  END IF;
  /* Если вид обслуживания из типа счета NULL, то писать 0(банк) */
  if (new$ServiceAcc is null) then
    new$ServiceAcc := 0;
    if (new$SERVICE_ORG_REF is not null) then
      BEGIN
        select
        o.Org_Type
        into vOrgType$      from
        Organizations o
        where
        (o.id = new$SERVICE_ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      if ((vOrgType$  > 10099)and(vOrgType$  < 10200)) then
        new$ServiceAcc := 3;
             
      else
        if ((vOrgType$  > 39999)and(vOrgType$  < 50000)) then
          new$ServiceAcc := 1;
        END IF;   
      END IF; 
    END IF;
  END IF;
  /* если изменился код в УФК надо снести его в лицевые счета */
  if (new$Acc <> :old.Acc) then
    update facialacc_cls set
    FACIALCODE = new$Acc
    where
    FCACCOUNT = new$id;
     
  END IF;
  /* если у счета заполнен счет обсл. орг. и вид обсл. не банк, то проставим банк,
      такой же, как и у счета обсл. организации */
  if ((new$Service_Acc_Ref is not null) and (new$ServiceAcc <> 0)
  and (new$Service_Acc_Ref <> :old.Service_Acc_Ref)) then
    BEGIN
      select
      Bank_Ref, Acc
      into new$Bank_Ref, new$FacialCode    from
      Org_Accounts
      where
      new$Service_Acc_Ref = Id
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Каскадное обновление */
  /* Если у счета поменялся банк, то нужно посмотреть где используется этот счет 
   в качестве счета Обслуживающей организации. Если да, то нужно поменять его там на новый */
  /* Если меняется имя счета, то смотрим где этот счет используется в качестве счета обслуж. организации */
  if (((new$Bank_Ref <> :old.Bank_Ref) or (new$Acc <> :old.Acc)) and (:old.id <> new$id)) then
    update Org_Accounts
    set Bank_Ref = new$Bank_Ref,
    FacialCode = new$Acc
    where Service_Acc_Ref = new$ID;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORG_ACCOUNTS_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  CloseOrgCls_Div(:old.CloseCode,Code11$, Code21$, Code31$, Code41$, Code5$);
    
  /* Если меняется банк, то нужно проверить не является ли он открытым, а счет закрытым по банку */
  if ((new$Bank_ref <> :old.Bank_ref) and (Code41$ = 1)) then 
    BEGIN
      select DateClose into TempD$ from Banks where ID = new$Bank_ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (TempD$ is null) then 
      Code41$ := 0; /* Так надо для случая, когда одновременно меняются и банк и обслуж. орг. */
      new$CloseCode := :old.CloseCode - 1000;
      
    END IF;
  END IF;
    
  /* Если меняется обслуживающая организация, она открыта и счет закрыт по обслуж. орг. - надо открыть */
  if ((new$Service_Acc_ref <> :old.Service_Acc_Ref) and (Code31$ = 1)) then 
    BEGIN
      select Closed into Temp1$ from Org_Accounts where ID = new$Service_Acc_Ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (Temp1$ is null) then 
      Code31$ := 0;
      new$CloseCode := :old.CloseCode - 100;
      
    END IF;
  END IF;
  /* случай закрытия/открытия пользователем */
  if (((new$Closed is null) and not(:old.Closed is null)) or
  (not(new$Closed is null) and (:old.Closed is null)))
  then 
    if (new$ORG_REF is not null and  new$facialacc_cls is not null)
    then
      BEGIN
        select o.Org_Type       into vOrgType$ from Organizations o where (o.id = new$ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* Синхронное закрытие лицевого счета для БУ/АУ*/
      if ((vOrgType$  >= 10800)and(vOrgType$  <= 10900))
      then
        if (new$Closed = 1)
        then
          /* закрываем лицевой счет */
          CurDateToDouble(CurDate$);

          update facialacc_cls
          set
          dateclose = CurDate$,
          CloseCode = 10000
          where id = new$facialacc_cls;
                  
        END IF;
        if (new$Closed is null)
        then
          /* открываем лицевой счет */
          update facialacc_cls
          set dateclose = null,
          CloseCode = 0
          where id = new$facialacc_cls;
              
        END IF;    
      END IF;
    END IF;
    if (new$Closed = 1) then 
      new$CloseCode := 1;
    END IF;
    if (new$Closed is null) then 
      new$CloseCode := 0;
      
    END IF;
  END IF;
    
  /* случаи закрытия/открытия не пользователем */
  if (new$CloseCode <> :old.CloseCode) then 
    DiffCode1$ := new$CloseCode - :old.CloseCode; /* >0 - счет закрывается, <0 - счет открывается*/
        
    /* Защита от "перезакрытия" */
    if (DiffCode1$ = 1) then 
      Code11$ := 1;
    END IF;
    if (DiffCode1$ = 10) then 
      Code21$ := 1;
    END IF;
    if (DiffCode1$ = 100) then 
      Code31$ := 1;
    END IF;
    if (DiffCode1$ = 1000) then 
      Code41$ := 1;
    END IF;
    if (DiffCode1$ = 10000) then 
      Code5$ := 1;
    END IF;
    if (DiffCode1$ = -1) then 
      Code11$ := 0;
    END IF;
    if (DiffCode1$ = -10) then 
      Code21$ := 0;
    END IF;
    if (DiffCode1$ = -100) then 
      Code31$ := 0;
    END IF;
    if (DiffCode1$ = -1000) then 
      Code41$ := 0;
    END IF;
    if (DiffCode1$ = -10000) then 
      Code5$ := 0;
    END IF;
    new$CloseCode := Code11$ + Code21$*10 + Code31$*100 + Code41$*1000 + Code5$*10000;
        
    if (new$CloseCode = 0) then 
      new$Closed := null; 
    else 
      new$Closed := 1;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORG_ACCOUNTS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (New$RVersion is null) then
    new$RVersion := 1;
  elsif ((new$RVersion = -1) and (:Old.RVersion <> -1)) then
    new$RVersion := :Old.RVersion;
  else
    new$RVersion := :Old.RVersion + 1;
  end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORG_ACCOUNTS SET
    ID = new$ID,
    ORG_REF = new$ORG_REF,
    BANK_REF = new$BANK_REF,
    ACC = new$ACC,
    ACC_CLS = new$ACC_CLS,
    FINTYPE = new$FINTYPE,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    CLOSED = new$CLOSED,
    ACCDEFAULT = new$ACCDEFAULT,
    BANKDEPNUMBER = new$BANKDEPNUMBER,
    FACIALCODE = new$FACIALCODE,
    SERVICE_ORG_REF = new$SERVICE_ORG_REF,
    ACOMMENT = new$ACOMMENT,
    ISDEFAULT = new$ISDEFAULT,
    RVERSION = new$RVERSION,
    SERVICE_ACC_REF = new$SERVICE_ACC_REF,
    CLOSECODE = new$CLOSECODE,
    SERVICEACC = new$SERVICEACC,
    FACIALACC_CLS = new$FACIALACC_CLS,
    DATEOPEN = new$DATEOPEN,
    DATECLOSE = new$DATECLOSE
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_0 (TR_ORG_ACCOUNTS_AU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* При закрытии счета закрываем счета, у которых он указан как "Счет обслуживающей организации". Аналогично при открытии */
  if (new$CloseCode <> :old.CloseCode)
  then 
    if ((new$Closed is null) or (new$CloseCode < :old.CloseCode)) then
      update Org_Accounts set
      CloseCode = CloseCode - 100,
      RVersion = -1
      where Service_Acc_Ref = :old.ID;
          
    else
      update Org_Accounts set
      CloseCode = CloseCode + 100,
      RVersion = -1
      where Service_Acc_Ref = :old.ID;
      
    END IF;
  END IF;
  if (new$acc <> :old.acc and new$acc is not null and :old.acc is not null)
  then
    update org_accounts t
    set t.facialcode = new$acc
    where t.id in(
    select oa1.id
    from org_accounts oa1
    where
    oa1.service_acc_ref = new$id
    and oa1.service_org_ref = new$org_ref
    and oa1.service_org_ref is not null
    and new$org_ref is not null
    );

  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORG_ACCOUNTS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (21, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=21) and (RecordId=new$ID);
  end if;

END;
/
commit work
/
-- CREATE TRIGGER TR_ORG_ACCOUNTS_BI_100
CREATE OR REPLACE TRIGGER TR_ORG_ACCOUNTS_II
  INSTEAD OF INSERT
  ON ORG_ACCOUNTS
  FOR EACH ROW
DECLARE
  new$ID ORG_ACCOUNTS.ID%TYPE := :NEW.ID;
  new$ORG_REF ORG_ACCOUNTS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$BANK_REF ORG_ACCOUNTS.BANK_REF%TYPE := :NEW.BANK_REF;
  new$ACC ORG_ACCOUNTS.ACC%TYPE := :NEW.ACC;
  new$ACC_CLS ORG_ACCOUNTS.ACC_CLS%TYPE := :NEW.ACC_CLS;
  new$FINTYPE ORG_ACCOUNTS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$CREATERUSER ORG_ACCOUNTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORG_ACCOUNTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORG_ACCOUNTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORG_ACCOUNTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$CLOSED ORG_ACCOUNTS.CLOSED%TYPE := :NEW.CLOSED;
  new$ACCDEFAULT ORG_ACCOUNTS.ACCDEFAULT%TYPE := :NEW.ACCDEFAULT;
  new$BANKDEPNUMBER ORG_ACCOUNTS.BANKDEPNUMBER%TYPE := :NEW.BANKDEPNUMBER;
  new$FACIALCODE ORG_ACCOUNTS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$SERVICE_ORG_REF ORG_ACCOUNTS.SERVICE_ORG_REF%TYPE := :NEW.SERVICE_ORG_REF;
  new$ACOMMENT ORG_ACCOUNTS.ACOMMENT%TYPE := :NEW.ACOMMENT;
  new$ISDEFAULT ORG_ACCOUNTS.ISDEFAULT%TYPE := :NEW.ISDEFAULT;
  new$RVERSION ORG_ACCOUNTS.RVERSION%TYPE := :NEW.RVERSION;
  new$SERVICE_ACC_REF ORG_ACCOUNTS.SERVICE_ACC_REF%TYPE := :NEW.SERVICE_ACC_REF;
  new$CLOSECODE ORG_ACCOUNTS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$SERVICEACC ORG_ACCOUNTS.SERVICEACC%TYPE := :NEW.SERVICEACC;
  new$FACIALACC_CLS ORG_ACCOUNTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$DATEOPEN ORG_ACCOUNTS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$DATECLOSE ORG_ACCOUNTS.DATECLOSE%TYPE := :NEW.DATECLOSE;
--
  vOrgType$ NUMBER(10);
  ADate$ NUMBER;
  AClosed1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_ORG_ACCOUNTS_BI)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$Org_Ref = 0) then 
    RaiseException('ex_CantAddUnknownOrgAcc');
  END IF;
  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$ACC_CLS is null) then 
    new$ACC_CLS:= 0;
  END IF;
  if (new$AccDefault is null) then 
    new$AccDefault:= 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType:= 0;
  END IF;
  if ((new$AComment is null) or (new$AComment  is null)) then 
    new$AComment := new$Acc;
  END IF;
  if ((new$IsDefault is not Null) and (new$IsDefault <> 0)) then
    update ORG_ACCOUNTS set
    IsDefault = 0
    where ORG_REF = new$ORG_REF
    and IsDefault is not Null
    and IsDefault <> 0;
  END IF;
  if ((new$SERVICE_ORG_REF is null)and(new$SERVICE_ACC_REF is not null)) then
    BEGIN
      select
      oa.Org_Ref
      into
      new$SERVICE_ORG_REF    from
      org_accounts oa
      where
      (oa.id = new$SERVICE_ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* При изменении типа счета сносить в вид обслуживания значение вида обслуживания из типа счета */
  if (new$ServiceAcc is null) then
    BEGIN
      select SERVICETYPE into new$ServiceAcc from ACC_CLS where (id = new$ACC_CLS) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если вид обслуживания из типа счета NULL, то писать 0(банк) */
  if (new$ServiceAcc is null) then
    new$ServiceAcc := 0;
    if (new$SERVICE_ORG_REF is not null) then
      BEGIN
        select
        o.Org_Type
        into vOrgType$      from
        Organizations o
        where
        (o.id = new$SERVICE_ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      if ((vOrgType$  > 10099)and(vOrgType$  < 10200)) then
        new$ServiceAcc := 3;
             
      else
        if ((vOrgType$  > 39999)and(vOrgType$  < 50000)) then
          new$ServiceAcc := 1;
        END IF;   
      END IF; 
    END IF;
  END IF;
  /* если у счета заполнен счет обсл. орг. и вид обсл. не банк, то проставим банк,
      такой же, как и у счета обсл. организации */
  if ((new$Service_Acc_Ref is not null) and (new$ServiceAcc <> 0)) then
    BEGIN
      select
      Bank_Ref, Acc
      into new$Bank_Ref, new$FacialCode    from
      Org_Accounts
      where
      new$Service_Acc_Ref = Id
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_ORG_ACCOUNTS_BI_100)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$CloseCode is null) then 
    new$CloseCode := 0;
  END IF;
  /* Сноска закрытости от владельцев р/с, по дате - кто последний тот и прав */
  if (new$Org_Ref is not null) then
    BEGIN
      select DateClose into ADate$ from organizations where Id = new$Org_ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (ADate$  is not null) then 
      new$Closed := 1;
      new$DateClose := ADate$;
      new$CloseCode := 10; /* закрыт владельцем */
      
    END IF;
  END IF;
  if (new$Bank_Ref is not null) then
    BEGIN
      select DateClose into ADate$ from Banks where Id = new$Bank_ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (ADate$  is not null) then 
      new$Closed := 1;
      new$DateClose := ADate$;
      new$CloseCode := new$CloseCode + 1000; /* закрыт банком */
      
    END IF;
  END IF;
  if (new$Service_Acc_Ref is not null) then
    BEGIN
      select Closed, DateClose into AClosed1$, ADate$ from Org_Accounts where Id = new$Service_Acc_Ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (AClosed1$  is not null) then 
      new$Closed := 1;
      new$DateClose := ADate$;
      new$CloseCode := new$CloseCode + 100; /* закрыт обслуживающей организацией */
      
    END IF;  /* по полю facialacc_cls не проверяем - считаем - вводить не дают по закрытым л/с */
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORG_ACCOUNTS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORG_ACCOUNTS (
    ID,
    ORG_REF,
    BANK_REF,
    ACC,
    ACC_CLS,
    FINTYPE,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    CLOSED,
    ACCDEFAULT,
    BANKDEPNUMBER,
    FACIALCODE,
    SERVICE_ORG_REF,
    ACOMMENT,
    ISDEFAULT,
    RVERSION,
    SERVICE_ACC_REF,
    CLOSECODE,
    SERVICEACC,
    FACIALACC_CLS,
    DATEOPEN,
    DATECLOSE
  ) VALUES (
    new$ID,
    new$ORG_REF,
    new$BANK_REF,
    new$ACC,
    new$ACC_CLS,
    new$FINTYPE,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$CLOSED,
    new$ACCDEFAULT,
    new$BANKDEPNUMBER,
    new$FACIALCODE,
    new$SERVICE_ORG_REF,
    new$ACOMMENT,
    new$ISDEFAULT,
    new$RVERSION,
    new$SERVICE_ACC_REF,
    new$CLOSECODE,
    new$SERVICEACC,
    new$FACIALACC_CLS,
    new$DATEOPEN,
    new$DATECLOSE);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORG_ACCOUNTS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 21) and (RecordID = new$ID);

END;
/
-- CREATE TRIGGER TR_ORG_ACCOUNTS_BU_100
CREATE OR REPLACE TRIGGER TR_ORG_ACCOUNTS_IU
  INSTEAD OF UPDATE
  ON ORG_ACCOUNTS
  FOR EACH ROW
DECLARE
  new$ID ORG_ACCOUNTS.ID%TYPE := :NEW.ID;
  new$ORG_REF ORG_ACCOUNTS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$BANK_REF ORG_ACCOUNTS.BANK_REF%TYPE := :NEW.BANK_REF;
  new$ACC ORG_ACCOUNTS.ACC%TYPE := :NEW.ACC;
  new$ACC_CLS ORG_ACCOUNTS.ACC_CLS%TYPE := :NEW.ACC_CLS;
  new$FINTYPE ORG_ACCOUNTS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$CREATERUSER ORG_ACCOUNTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORG_ACCOUNTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORG_ACCOUNTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORG_ACCOUNTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$CLOSED ORG_ACCOUNTS.CLOSED%TYPE := :NEW.CLOSED;
  new$ACCDEFAULT ORG_ACCOUNTS.ACCDEFAULT%TYPE := :NEW.ACCDEFAULT;
  new$BANKDEPNUMBER ORG_ACCOUNTS.BANKDEPNUMBER%TYPE := :NEW.BANKDEPNUMBER;
  new$FACIALCODE ORG_ACCOUNTS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$SERVICE_ORG_REF ORG_ACCOUNTS.SERVICE_ORG_REF%TYPE := :NEW.SERVICE_ORG_REF;
  new$ACOMMENT ORG_ACCOUNTS.ACOMMENT%TYPE := :NEW.ACOMMENT;
  new$ISDEFAULT ORG_ACCOUNTS.ISDEFAULT%TYPE := :NEW.ISDEFAULT;
  new$RVERSION ORG_ACCOUNTS.RVERSION%TYPE := :NEW.RVERSION;
  new$SERVICE_ACC_REF ORG_ACCOUNTS.SERVICE_ACC_REF%TYPE := :NEW.SERVICE_ACC_REF;
  new$CLOSECODE ORG_ACCOUNTS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$SERVICEACC ORG_ACCOUNTS.SERVICEACC%TYPE := :NEW.SERVICEACC;
  new$FACIALACC_CLS ORG_ACCOUNTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$DATEOPEN ORG_ACCOUNTS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$DATECLOSE ORG_ACCOUNTS.DATECLOSE%TYPE := :NEW.DATECLOSE;
--
  vOrgType$ NUMBER(10);
  DiffCode$ NUMBER(10);
  Code1$ NUMBER(10);
  Code2$ NUMBER(10);
  Code3$ NUMBER(10);
  Code4$ NUMBER(10);
  Code51$ NUMBER(10);
  AFlag$ NUMBER(10);
  ADate$ NUMBER;
  vOrgType1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_ORG_ACCOUNTS_BU)
-- Version 7.02.00.3
-- - - - - - - - - - - - -

  if (new$ACC_CLS is null) then 
    new$ACC_CLS:= 0;
  END IF;
  if (new$AccDefault is null) then 
    new$AccDefault:= 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType:= 0;
  END IF;
  if ((new$AComment is null) or (new$AComment  is null) 
  or (new$AComment = :old.AComment) and (:old.AComment = :old.Acc)) then
    new$AComment := new$Acc;
  END IF;
  if ((new$IsDefault is not Null) and (new$IsDefault <> 0)
  and ((:old.IsDefault is Null) or (:old.IsDefault = 0))) then
    update ORG_ACCOUNTS set
    IsDefault = 0
    where ORG_REF = new$ORG_REF
    and IsDefault is not Null
    and IsDefault <> 0;
  END IF;
  if ((new$SERVICE_ORG_REF is null)and(new$SERVICE_ACC_REF is not null)) then
    BEGIN
      select
      oa.Org_Ref
      into
      new$SERVICE_ORG_REF    from
      org_accounts oa
      where
      (oa.id = new$SERVICE_ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* При изменении типа счета сносить в вид обслуживания значение вида обслуживания из типа счета */
  if (new$ACC_CLS <> :old.ACC_CLS) then
    BEGIN
      select SERVICETYPE into new$ServiceAcc from ACC_CLS where (id = new$ACC_CLS) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если изменяем вид обслуживания на банк, то надо очистить ссылки на обслуживающую организацию*/
  if (:old.ServiceAcc is not null and new$ServiceAcc = 0 and :old.ServiceAcc <> new$ServiceAcc) then
    new$service_acc_ref := null;
    new$service_org_ref := null;
     
  END IF;
  /* Если вид обслуживания из типа счета NULL, то писать 0(банк) */
  if (new$ServiceAcc is null) then
    new$ServiceAcc := 0;
    if (new$SERVICE_ORG_REF is not null) then
      BEGIN
        select
        o.Org_Type
        into vOrgType$      from
        Organizations o
        where
        (o.id = new$SERVICE_ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      if ((vOrgType$  > 10099)and(vOrgType$  < 10200)) then
        new$ServiceAcc := 3;
             
      else
        if ((vOrgType$  > 39999)and(vOrgType$  < 50000)) then
          new$ServiceAcc := 1;
        END IF;   
      END IF; 
    END IF;
  END IF;
  /* если изменился код в УФК надо снести его в лицевые счета */
  if (new$Acc <> :old.Acc) then
    update facialacc_cls set
    FACIALCODE = new$Acc
    where
    FCACCOUNT = new$id;
     
  END IF;
  /* если у счета заполнен счет обсл. орг. и вид обсл. не банк, то проставим банк,
      такой же, как и у счета обсл. организации */
  if ((new$Service_Acc_Ref is not null) and (new$ServiceAcc <> 0)
  and (new$Service_Acc_Ref <> :old.Service_Acc_Ref)) then
    BEGIN
      select
      Bank_Ref, Acc
      into new$Bank_Ref, new$FacialCode    from
      Org_Accounts
      where
      new$Service_Acc_Ref = Id
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Каскадное обновление */
  /* Если у счета поменялся банк, то нужно посмотреть где используется этот счет 
   в качестве счета Обслуживающей организации. Если да, то нужно поменять его там на новый */
  /* Если меняется имя счета, то смотрим где этот счет используется в качестве счета обслуж. организации */
  if (((new$Bank_Ref <> :old.Bank_Ref) or (new$Acc <> :old.Acc)) and (:old.id <> new$id)) then
    update Org_Accounts
    set Bank_Ref = new$Bank_Ref,
    FacialCode = new$Acc
    where Service_Acc_Ref = new$ID;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORG_ACCOUNTS_BU_100)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$CloseCode is null) then 
    new$CloseCode := 0;
  END IF;
  CloseOrgCls_Div(:old.CloseCode,Code1$, Code2$, Code3$, Code4$, Code51$);
    
  /* ?? изменение с открытого владельца на закрытого видимо не предполагается*/
    
  /* Если меняется банк, то нужно проверить не является ли он открытым, а счет закрытым по банку */
  if ((new$Bank_ref <> :old.Bank_ref) and (Code4$ = 1)) then 
    BEGIN
      select DateClose into ADate$ from Banks where ID = new$Bank_ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (ADate$ is null) then 
      Code4$ := 0; /* Так надо для случая, когда одновременно меняются и банк и обслуж. орг. */
      new$CloseCode := :old.CloseCode - 1000;
          
    else 
      if (new$DateClose > ADate$) then
        new$DateClose := ADate$;
      END IF;  
    END IF;
  END IF;
    
  /* Если меняется обслуживающая организация, она открыта и счет закрыт по обслуж. орг. - надо открыть */
  if ((new$Service_Acc_ref <> :old.Service_Acc_Ref) and (Code3$ = 1)) then 
    BEGIN
      select Closed, DateClose into AFlag$, ADate$ from Org_Accounts where ID = new$Service_Acc_Ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (AFlag$ is null) then 
      Code3$ := 0;
      new$CloseCode := :old.CloseCode - 100;
          
    else 
      if (new$DateClose > ADate$) then
        new$DateClose := ADate$;
      END IF;  
    END IF;
  END IF;
  /* ?? а изменение facialacc_cls видимо не предполагается */

  /* случай закрытия/открытия пользователем ?? А почему только пользователем ?? может в AU сноску перенести */
  if (((new$Closed is null) and not(:old.Closed is null)) or
  (not(new$Closed is null) and (:old.Closed is null)))
  then 
    if (new$ORG_REF is not null and  new$facialacc_cls is not null)
    then
      BEGIN
        select o.Org_Type       into vOrgType1$ from Organizations o where (o.id = new$ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* Синхронное закрытие лицевого счета для БУ/АУ ?? почему просто ссылки мало*/
      if ((vOrgType1$  >= 10800)and(vOrgType1$  <= 10900))
      then
        if (new$Closed = 1)
        then
          /* закрываем лицевой счет */
          if (new$DateClose is null) then
            CurDateToDouble(new$DateClose);
          END IF;

          update facialacc_cls set
          dateclose = new$DateClose,
          CloseCode = CloseCode + 10000
          where id = new$facialacc_cls;
                  
        END IF;
        if (new$Closed is null)
        then
          /* открываем лицевой счет */
          update facialacc_cls set 
          dateclose = null,
          CloseCode = CloseCode - 10000
          where id = new$facialacc_cls;
              
        END IF;    
      END IF;
    END IF;
    if (new$Closed = 1) then 
      new$CloseCode := 1;
    END IF;
    if (new$Closed is null) then 
      new$CloseCode := 0;
      
    END IF;
  END IF;
    
  /* случаи закрытия/открытия не пользователем */
  if (new$CloseCode <> :old.CloseCode) then 
    DiffCode$ := new$CloseCode - :old.CloseCode; /* >0 - счет закрывается, <0 - счет открывается*/
        
    /* Защита от "перезакрытия" */
    if (DiffCode$ = 1) then 
      Code1$ := 1;
    END IF;
    if (DiffCode$ = 10) then 
      Code2$ := 1;
    END IF;
    if (DiffCode$ = 100) then 
      Code3$ := 1;
    END IF;
    if (DiffCode$ = 1000) then 
      Code4$ := 1;
    END IF;
    if (DiffCode$ = 10000) then 
      Code51$ := 1;
    END IF;
    if (DiffCode$ = -1) then 
      Code1$ := 0;
    END IF;
    if (DiffCode$ = -10) then 
      Code2$ := 0;
    END IF;
    if (DiffCode$ = -100) then 
      Code3$ := 0;
    END IF;
    if (DiffCode$ = -1000) then 
      Code4$ := 0;
    END IF;
    if (DiffCode$ = -10000) then 
      Code51$ := 0;
    END IF;
    new$CloseCode := Code1$ + Code2$*10 + Code3$*100 + Code4$*1000 + Code51$*10000;
        
    if (new$CloseCode = 0) then 
      new$Closed := null; 
      new$DateClose := null;
      	
    else 
      new$Closed := 1;
      if (new$DateClose is null) then
        CurDateToDouble(new$DateClose);
      	
      END IF;  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORG_ACCOUNTS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (New$RVersion is null) then
    new$RVersion := 1;
  elsif ((new$RVersion = -1) and (:Old.RVersion <> -1)) then
    new$RVersion := :Old.RVersion;
  else
    new$RVersion := :Old.RVersion + 1;
  end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORG_ACCOUNTS SET
    ID = new$ID,
    ORG_REF = new$ORG_REF,
    BANK_REF = new$BANK_REF,
    ACC = new$ACC,
    ACC_CLS = new$ACC_CLS,
    FINTYPE = new$FINTYPE,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    CLOSED = new$CLOSED,
    ACCDEFAULT = new$ACCDEFAULT,
    BANKDEPNUMBER = new$BANKDEPNUMBER,
    FACIALCODE = new$FACIALCODE,
    SERVICE_ORG_REF = new$SERVICE_ORG_REF,
    ACOMMENT = new$ACOMMENT,
    ISDEFAULT = new$ISDEFAULT,
    RVERSION = new$RVERSION,
    SERVICE_ACC_REF = new$SERVICE_ACC_REF,
    CLOSECODE = new$CLOSECODE,
    SERVICEACC = new$SERVICEACC,
    FACIALACC_CLS = new$FACIALACC_CLS,
    DATEOPEN = new$DATEOPEN,
    DATECLOSE = new$DATECLOSE
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_0 (TR_ORG_ACCOUNTS_AU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* При закрытии счета закрываем счета, у которых он указан как "Счет обслуживающей организации". Аналогично при открытии */
  if (new$CloseCode <> :old.CloseCode)
  then 
    if ((new$Closed is null) or (new$CloseCode < :old.CloseCode)) then
      update Org_Accounts set
      CloseCode = CloseCode - 100,
      RVersion = -1
      where Service_Acc_Ref = :old.ID;
          
    else
      update Org_Accounts set
      CloseCode = CloseCode + 100,
      RVersion = -1
      where Service_Acc_Ref = :old.ID;
      
    END IF;
  END IF;
  if (new$acc <> :old.acc and new$acc is not null and :old.acc is not null)
  then
    update org_accounts t
    set t.facialcode = new$acc
    where t.id in(
    select oa1.id
    from org_accounts oa1
    where
    oa1.service_acc_ref = new$id
    and oa1.service_org_ref = new$org_ref
    and oa1.service_org_ref is not null
    and new$org_ref is not null
    );

  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORG_ACCOUNTS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (21, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=21) and (RecordId=new$ID);
  end if;

END;
/
-- CREATE TRIGGER TR_ORG_ACCOUNTS_AU
CREATE OR REPLACE TRIGGER TR_ORG_ACCOUNTS_IU
  INSTEAD OF UPDATE
  ON ORG_ACCOUNTS
  FOR EACH ROW
DECLARE
  new$ID ORG_ACCOUNTS.ID%TYPE := :NEW.ID;
  new$ORG_REF ORG_ACCOUNTS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$BANK_REF ORG_ACCOUNTS.BANK_REF%TYPE := :NEW.BANK_REF;
  new$ACC ORG_ACCOUNTS.ACC%TYPE := :NEW.ACC;
  new$ACC_CLS ORG_ACCOUNTS.ACC_CLS%TYPE := :NEW.ACC_CLS;
  new$FINTYPE ORG_ACCOUNTS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$CREATERUSER ORG_ACCOUNTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORG_ACCOUNTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORG_ACCOUNTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORG_ACCOUNTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$CLOSED ORG_ACCOUNTS.CLOSED%TYPE := :NEW.CLOSED;
  new$ACCDEFAULT ORG_ACCOUNTS.ACCDEFAULT%TYPE := :NEW.ACCDEFAULT;
  new$BANKDEPNUMBER ORG_ACCOUNTS.BANKDEPNUMBER%TYPE := :NEW.BANKDEPNUMBER;
  new$FACIALCODE ORG_ACCOUNTS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$SERVICE_ORG_REF ORG_ACCOUNTS.SERVICE_ORG_REF%TYPE := :NEW.SERVICE_ORG_REF;
  new$ACOMMENT ORG_ACCOUNTS.ACOMMENT%TYPE := :NEW.ACOMMENT;
  new$ISDEFAULT ORG_ACCOUNTS.ISDEFAULT%TYPE := :NEW.ISDEFAULT;
  new$RVERSION ORG_ACCOUNTS.RVERSION%TYPE := :NEW.RVERSION;
  new$SERVICE_ACC_REF ORG_ACCOUNTS.SERVICE_ACC_REF%TYPE := :NEW.SERVICE_ACC_REF;
  new$CLOSECODE ORG_ACCOUNTS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$SERVICEACC ORG_ACCOUNTS.SERVICEACC%TYPE := :NEW.SERVICEACC;
  new$FACIALACC_CLS ORG_ACCOUNTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$DATEOPEN ORG_ACCOUNTS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$DATECLOSE ORG_ACCOUNTS.DATECLOSE%TYPE := :NEW.DATECLOSE;
--
  vOrgType$ NUMBER(10);
  DiffCode$ NUMBER(10);
  Code1$ NUMBER(10);
  Code2$ NUMBER(10);
  Code3$ NUMBER(10);
  Code4$ NUMBER(10);
  Code51$ NUMBER(10);
  AFlag$ NUMBER(10);
  ADate$ NUMBER;
  vOrgType1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_ORG_ACCOUNTS_BU)
-- Version 7.02.00.3
-- - - - - - - - - - - - -

  if (new$ACC_CLS is null) then 
    new$ACC_CLS:= 0;
  END IF;
  if (new$AccDefault is null) then 
    new$AccDefault:= 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType:= 0;
  END IF;
  if ((new$AComment is null) or (new$AComment  is null) 
  or (new$AComment = :old.AComment) and (:old.AComment = :old.Acc)) then
    new$AComment := new$Acc;
  END IF;
  if ((new$IsDefault is not Null) and (new$IsDefault <> 0)
  and ((:old.IsDefault is Null) or (:old.IsDefault = 0))) then
    update ORG_ACCOUNTS set
    IsDefault = 0
    where ORG_REF = new$ORG_REF
    and IsDefault is not Null
    and IsDefault <> 0;
  END IF;
  if ((new$SERVICE_ORG_REF is null)and(new$SERVICE_ACC_REF is not null)) then
    BEGIN
      select
      oa.Org_Ref
      into
      new$SERVICE_ORG_REF    from
      org_accounts oa
      where
      (oa.id = new$SERVICE_ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* При изменении типа счета сносить в вид обслуживания значение вида обслуживания из типа счета */
  if (new$ACC_CLS <> :old.ACC_CLS) then
    BEGIN
      select SERVICETYPE into new$ServiceAcc from ACC_CLS where (id = new$ACC_CLS) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если изменяем вид обслуживания на банк, то надо очистить ссылки на обслуживающую организацию*/
  if (:old.ServiceAcc is not null and new$ServiceAcc = 0 and :old.ServiceAcc <> new$ServiceAcc) then
    new$service_acc_ref := null;
    new$service_org_ref := null;
     
  END IF;
  /* Если вид обслуживания из типа счета NULL, то писать 0(банк) */
  if (new$ServiceAcc is null) then
    new$ServiceAcc := 0;
    if (new$SERVICE_ORG_REF is not null) then
      BEGIN
        select
        o.Org_Type
        into vOrgType$      from
        Organizations o
        where
        (o.id = new$SERVICE_ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      if ((vOrgType$  > 10099)and(vOrgType$  < 10200)) then
        new$ServiceAcc := 3;
             
      else
        if ((vOrgType$  > 39999)and(vOrgType$  < 50000)) then
          new$ServiceAcc := 1;
        END IF;   
      END IF; 
    END IF;
  END IF;
  /* если изменился код в УФК надо снести его в лицевые счета */
  if (new$Acc <> :old.Acc) then
    update facialacc_cls set
    FACIALCODE = new$Acc
    where
    FCACCOUNT = new$id;
     
  END IF;
  /* если у счета заполнен счет обсл. орг. и вид обсл. не банк, то проставим банк,
      такой же, как и у счета обсл. организации */
  if ((new$Service_Acc_Ref is not null) and (new$ServiceAcc <> 0)
  and (new$Service_Acc_Ref <> :old.Service_Acc_Ref)) then
    BEGIN
      select
      Bank_Ref, Acc
      into new$Bank_Ref, new$FacialCode    from
      Org_Accounts
      where
      new$Service_Acc_Ref = Id
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Каскадное обновление */
  /* Если у счета поменялся банк, то нужно посмотреть где используется этот счет 
   в качестве счета Обслуживающей организации. Если да, то нужно поменять его там на новый */
  /* Если меняется имя счета, то смотрим где этот счет используется в качестве счета обслуж. организации */
  if (((new$Bank_Ref <> :old.Bank_Ref) or (new$Acc <> :old.Acc)) and (:old.id <> new$id)) then
    update Org_Accounts
    set Bank_Ref = new$Bank_Ref,
    FacialCode = new$Acc
    where Service_Acc_Ref = new$ID;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORG_ACCOUNTS_BU_100)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$CloseCode is null) then 
    new$CloseCode := 0;
  END IF;
  CloseOrgCls_Div(:old.CloseCode,Code1$, Code2$, Code3$, Code4$, Code51$);
    
  /* ?? изменение с открытого владельца на закрытого видимо не предполагается*/
    
  /* Если меняется банк, то нужно проверить не является ли он открытым, а счет закрытым по банку */
  if ((new$Bank_ref <> :old.Bank_ref) and (Code4$ = 1)) then 
    BEGIN
      select DateClose into ADate$ from Banks where ID = new$Bank_ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (ADate$ is null) then 
      Code4$ := 0; /* Так надо для случая, когда одновременно меняются и банк и обслуж. орг. */
      new$CloseCode := :old.CloseCode - 1000;
          
    else 
      if (new$DateClose > ADate$) then
        new$DateClose := ADate$;
      END IF;  
    END IF;
  END IF;
    
  /* Если меняется обслуживающая организация, она открыта и счет закрыт по обслуж. орг. - надо открыть */
  if ((new$Service_Acc_ref <> :old.Service_Acc_Ref) and (Code3$ = 1)) then 
    BEGIN
      select Closed, DateClose into AFlag$, ADate$ from Org_Accounts where ID = new$Service_Acc_Ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (AFlag$ is null) then 
      Code3$ := 0;
      new$CloseCode := :old.CloseCode - 100;
          
    else 
      if (new$DateClose > ADate$) then
        new$DateClose := ADate$;
      END IF;  
    END IF;
  END IF;
  /* ?? а изменение facialacc_cls видимо не предполагается */

  /* случай закрытия/открытия пользователем ?? А почему только пользователем ?? может в AU сноску перенести */
  if (((new$Closed is null) and not(:old.Closed is null)) or
  (not(new$Closed is null) and (:old.Closed is null)))
  then 
    if (new$ORG_REF is not null and  new$facialacc_cls is not null)
    then
      BEGIN
        select o.Org_Type       into vOrgType1$ from Organizations o where (o.id = new$ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* Синхронное закрытие лицевого счета для БУ/АУ ?? почему просто ссылки мало*/
      if ((vOrgType1$  >= 10800)and(vOrgType1$  <= 10900))
      then
        if (new$Closed = 1)
        then
          /* закрываем лицевой счет */
          if (new$DateClose is null) then
            CurDateToDouble(new$DateClose);
          END IF;

          update facialacc_cls set
          dateclose = new$DateClose,
          CloseCode = CloseCode + 10000
          where id = new$facialacc_cls;
                  
        END IF;
        if (new$Closed is null)
        then
          /* открываем лицевой счет */
          update facialacc_cls set 
          dateclose = null,
          CloseCode = CloseCode - 10000
          where id = new$facialacc_cls;
              
        END IF;    
      END IF;
    END IF;
    if (new$Closed = 1) then 
      new$CloseCode := 1;
    END IF;
    if (new$Closed is null) then 
      new$CloseCode := 0;
      
    END IF;
  END IF;
    
  /* случаи закрытия/открытия не пользователем */
  if (new$CloseCode <> :old.CloseCode) then 
    DiffCode$ := new$CloseCode - :old.CloseCode; /* >0 - счет закрывается, <0 - счет открывается*/
        
    /* Защита от "перезакрытия" */
    if (DiffCode$ = 1) then 
      Code1$ := 1;
    END IF;
    if (DiffCode$ = 10) then 
      Code2$ := 1;
    END IF;
    if (DiffCode$ = 100) then 
      Code3$ := 1;
    END IF;
    if (DiffCode$ = 1000) then 
      Code4$ := 1;
    END IF;
    if (DiffCode$ = 10000) then 
      Code51$ := 1;
    END IF;
    if (DiffCode$ = -1) then 
      Code1$ := 0;
    END IF;
    if (DiffCode$ = -10) then 
      Code2$ := 0;
    END IF;
    if (DiffCode$ = -100) then 
      Code3$ := 0;
    END IF;
    if (DiffCode$ = -1000) then 
      Code4$ := 0;
    END IF;
    if (DiffCode$ = -10000) then 
      Code51$ := 0;
    END IF;
    new$CloseCode := Code1$ + Code2$*10 + Code3$*100 + Code4$*1000 + Code51$*10000;
        
    if (new$CloseCode = 0) then 
      new$Closed := null; 
      new$DateClose := null;
      	
    else 
      new$Closed := 1;
      if (new$DateClose is null) then
        CurDateToDouble(new$DateClose);
      	
      END IF;  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORG_ACCOUNTS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (New$RVersion is null) then
    new$RVersion := 1;
  elsif ((new$RVersion = -1) and (:Old.RVersion <> -1)) then
    new$RVersion := :Old.RVersion;
  else
    new$RVersion := :Old.RVersion + 1;
  end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORG_ACCOUNTS SET
    ID = new$ID,
    ORG_REF = new$ORG_REF,
    BANK_REF = new$BANK_REF,
    ACC = new$ACC,
    ACC_CLS = new$ACC_CLS,
    FINTYPE = new$FINTYPE,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    CLOSED = new$CLOSED,
    ACCDEFAULT = new$ACCDEFAULT,
    BANKDEPNUMBER = new$BANKDEPNUMBER,
    FACIALCODE = new$FACIALCODE,
    SERVICE_ORG_REF = new$SERVICE_ORG_REF,
    ACOMMENT = new$ACOMMENT,
    ISDEFAULT = new$ISDEFAULT,
    RVERSION = new$RVERSION,
    SERVICE_ACC_REF = new$SERVICE_ACC_REF,
    CLOSECODE = new$CLOSECODE,
    SERVICEACC = new$SERVICEACC,
    FACIALACC_CLS = new$FACIALACC_CLS,
    DATEOPEN = new$DATEOPEN,
    DATECLOSE = new$DATECLOSE
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_0 (TR_ORG_ACCOUNTS_AU)
-- Version 10.00.00.2
-- - - - - - - - - - - - -

  /* При закрытии счета закрываем счета, у которых он указан как "Счет обслуживающей организации". Аналогично при открытии */
  if (new$CloseCode <> :old.CloseCode)
  then 
    if (new$CloseCode = 0) then
      update Org_Accounts set
      CloseCode = CloseCode - 100,
      RVersion = -1
      where Service_Acc_Ref = :old.ID;
          
    else
      update Org_Accounts set
      CloseCode = CloseCode + 100,
      DateClose = new$DateClose,
      RVersion = -1
      where Service_Acc_Ref = :old.ID;
      
    END IF;
  END IF;
  /* Снос счета в FACIAL_CODE для обслуживаемых */  
  if (new$acc <> :old.acc) then
    update org_accounts t set 
    t.facialcode = new$acc
    where 
    t.service_acc_ref = new$id and t.service_org_ref = new$org_ref
    ;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORG_ACCOUNTS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (21, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=21) and (RecordId=new$ID);
  end if;

END;
/
-- CREATE TRIGGER TR_FACIALACC_CLS_BU_200
CREATE OR REPLACE TRIGGER TR_FACIALACC_CLS_IU
  INSTEAD OF UPDATE
  ON FACIALACC_CLS
  FOR EACH ROW
DECLARE
  new$ID FACIALACC_CLS.ID%TYPE := :NEW.ID;
  new$CODE1 FACIALACC_CLS.CODE1%TYPE := :NEW.CODE1;
  new$CODE2 FACIALACC_CLS.CODE2%TYPE := :NEW.CODE2;
  new$CODE3 FACIALACC_CLS.CODE3%TYPE := :NEW.CODE3;
  new$CODE4 FACIALACC_CLS.CODE4%TYPE := :NEW.CODE4;
  new$KVSR FACIALACC_CLS.KVSR%TYPE := :NEW.KVSR;
  new$KCSR FACIALACC_CLS.KCSR%TYPE := :NEW.KCSR;
  new$KFSR FACIALACC_CLS.KFSR%TYPE := :NEW.KFSR;
  new$KVR FACIALACC_CLS.KVR%TYPE := :NEW.KVR;
  new$KESR FACIALACC_CLS.KESR%TYPE := :NEW.KESR;
  new$FINTYPE FACIALACC_CLS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$ORG_REF FACIALACC_CLS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$DATEOPEN FACIALACC_CLS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$SERVICEACCOUNT FACIALACC_CLS.SERVICEACCOUNT%TYPE := :NEW.SERVICEACCOUNT;
  new$STATUSACCOUNT FACIALACC_CLS.STATUSACCOUNT%TYPE := :NEW.STATUSACCOUNT;
  new$HARACTERACCOUNT FACIALACC_CLS.HARACTERACCOUNT%TYPE := :NEW.HARACTERACCOUNT;
  new$REGIONCLS FACIALACC_CLS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$CREATEDATE FACIALACC_CLS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALACC_CLS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$FACIALCODE FACIALACC_CLS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$MEANSTYPE FACIALACC_CLS.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$GENERALORG_REF FACIALACC_CLS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$DEPARTMENTCLS FACIALACC_CLS.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$RVERSION FACIALACC_CLS.RVERSION%TYPE := :NEW.RVERSION;
  new$CLOSEDOCNUMBER FACIALACC_CLS.CLOSEDOCNUMBER%TYPE := :NEW.CLOSEDOCNUMBER;
  new$HIGHERORG_REF FACIALACC_CLS.HIGHERORG_REF%TYPE := :NEW.HIGHERORG_REF;
  new$BUDGETREF FACIALACC_CLS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$FCACCOUNT FACIALACC_CLS.FCACCOUNT%TYPE := :NEW.FCACCOUNT;
  new$CLOSECODE FACIALACC_CLS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$DATECLOSE FACIALACC_CLS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$CREATERUSER FACIALACC_CLS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER FACIALACC_CLS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE FACIALACC_CLS.NOTE%TYPE := :NEW.NOTE;
  new$NAME FACIALACC_CLS.NAME%TYPE := :NEW.NAME;
  new$FACIALCODEEX FACIALACC_CLS.FACIALCODEEX%TYPE := :NEW.FACIALCODEEX;
  new$ISRBS FACIALACC_CLS.ISRBS%TYPE := :NEW.ISRBS;
  new$ISPBS FACIALACC_CLS.ISPBS%TYPE := :NEW.ISPBS;
  new$ISBU FACIALACC_CLS.ISBU%TYPE := :NEW.ISBU;
  new$ISSEPARATEBU FACIALACC_CLS.ISSEPARATEBU%TYPE := :NEW.ISSEPARATEBU;
  new$ISPROXY FACIALACC_CLS.ISPROXY%TYPE := :NEW.ISPROXY;
  new$OPENDOCNUMBER FACIALACC_CLS.OPENDOCNUMBER%TYPE := :NEW.OPENDOCNUMBER;
  new$ISOMS FACIALACC_CLS.ISOMS%TYPE := :NEW.ISOMS;
  new$CHANGEDOCNUMBER FACIALACC_CLS.CHANGEDOCNUMBER%TYPE := :NEW.CHANGEDOCNUMBER;
  new$DATECHANGE FACIALACC_CLS.DATECHANGE%TYPE := :NEW.DATECHANGE;
  new$GENERALORGFACIALACC FACIALACC_CLS.GENERALORGFACIALACC%TYPE := :NEW.GENERALORGFACIALACC;
  new$GRANTEEORG_REF FACIALACC_CLS.GRANTEEORG_REF%TYPE := :NEW.GRANTEEORG_REF;
  new$PREVCLS FACIALACC_CLS.PREVCLS%TYPE := :NEW.PREVCLS;
--
  id_org$ NUMBER(10);
  FCExEnable$ NUMBER(10);
  vOrgType$ NUMBER(10);
  id_org1$ NUMBER(10);
  id_reg1$ NUMBER(10);
  DiffCode$ NUMBER(10);
  Code1$ NUMBER(10);
  Code2$ NUMBER(10);
  Code51$ NUMBER(10);
  CodeX$ NUMBER(10);
  vOrgType1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_FACIALACC_CLS_BU_0)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$id <> :old.id) then 
    facialacc_clsdiv(new$id,new$code1,new$code2,new$code3,new$code4);
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$kcsr is null) then 
    new$kcsr := 0;
  END IF;
  if (new$kfsr is null) then 
    new$kfsr := 0;
  END IF;
  if (new$kvr is null) then 
    new$kvr := 0;
  END IF;
  if (new$kesr is null) then 
    new$kesr := 0;
  END IF;
  if (new$fintype is null) then 
    new$fintype := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$meanstype is null) then 
    new$meanstype := 0;
  END IF;
  if (new$haracteraccount is null) then 
    new$haracteraccount := 0;
  END IF;
  if (new$org_ref is null) then 
    new$org_ref := 0; -- поправил, был ранее select min (...)
  END IF;
  if ((new$org_ref <> :old.org_ref) and not(new$fcaccount is null)) then
    BEGIN
      select org_ref      into id_org1$ from org_accounts
      where id = new$fcaccount
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (id_org1$ <> new$org_ref) then 
      new$fcaccount := null;
     
    END IF;
  END IF;
  if (:old.Org_Ref <> new$Org_Ref) then 
    BEGIN
      -- запрос региона --------------------------
      select o.RegionCLS
      into id_reg1$        from Organizations o
      where o.ID = new$Org_Ref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    -- поместить регион -----------------
       
    new$regioncls := id_reg1$;
    BEGIN
      -- очистка связи с расчетным счетом для БУ/АУ----
      select o.Org_Type
      into vOrgType$      from Organizations o
      where o.ID = :old.Org_Ref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if ((vOrgType$  >= 10800)and(vOrgType$  <= 10900)) then
      update org_accounts
      set facialacc_cls = null
      where facialacc_cls = :old.id;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_FACIALACC_CLS_BU_100)
-- Create 01.12.2005
-- - - - - - - - - - - - -

   IF (    (   (new$ID = 0)
            OR (new$serviceaccount = 0)
            OR (new$serviceaccount IS NULL)
           )
       AND (new$budgetref IS NULL)
      ) THEN
      new$budgetRef := 0;
   END IF;

   IF (    (new$ID <> 0)
       AND (new$serviceaccount = 1)
       AND ((new$budgetref IS NULL) OR (new$budgetref = 0))
      ) THEN
      getintconst (-1, 3, new$budgetRef);
   END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_FACIALACC_CLS_BU_200)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Закрытие/открытие пользователем ?? А почему только пользователем ?? может в AU сноску перенести */
  if ((((new$DateClose is not null) and (:old.DateClose is null)) or
  ((new$DateClose is null) and (:old.DateClose is not null)))
  and (new$CloseCode = :old.CloseCode))
  then 
    BEGIN
      /* При закрытии лицевого счета для БУ/АУ закрываем связанный расчетный счет.
           Аналогично при открытии ранее закрытого л/с ?? Почему просто ссылки мало?
          */
      select o.Org_Type     into vOrgType1$ from Organizations o where o.id = new$org_ref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if ((vOrgType1$  >= 10800)and(vOrgType1$  <= 10900)) then
      if (new$DateClose is not null or (new$statusaccount = 1 and :old.statusaccount=0))
      then
        update org_accounts set
        CloseCode = CloseCode + 10000,
        DateClose = new$DateClose
        where facialacc_cls = new$id;
              
      END IF;
      if (new$DateClose is null or (new$statusaccount = 0 and :old.statusaccount=1))
      then
        update org_accounts set
        CloseCode = CloseCode - 10000
        where facialacc_cls = new$id;
          
      END IF;
    END IF;
    if (new$DateClose is not null) then 
      new$CloseCode := 1;
    END IF;
    if (new$DateClose is null) then 
      new$CloseCode := 0;
      
    END IF;
  END IF;
    
  /* Закрытие/открытие не пользователем (only по владельцу и лицевому расчетному счету) */
  if (new$CloseCode <> :old.CloseCode)
  then 
    DiffCode$ := new$CloseCode - :old.CloseCode; /* >0 - счет закрывается, <0 - счет открывается*/
    CloseOrgCls_Div(:old.CloseCode,Code1$, Code2$, CodeX$, CodeX$, Code51$);
        
    /* Защита от "перезакрытия" */
    if (DiffCode$ = 1) then 
      Code1$ := 1;
    END IF;
    if (DiffCode$ = 10) then 
      Code2$ := 1;
    END IF;
    if (DiffCode$ = 10000) then 
      Code51$ := 1;
    END IF;
    if (DiffCode$ = -1) then 
      Code1$ := 0;
    END IF;
    if (DiffCode$ = -10) then 
      Code2$ := 0;
    END IF;
    if (DiffCode$ = -10000) then 
      Code51$ := 0;
    END IF;
    new$CloseCode := Code1$ + Code2$*10 + Code51$*10000;
        
    if (new$CloseCode <> 0) then 
      new$StatusAccount := 1;
    END IF;
        
    /* Препятствуем повышению даты закрытия ?? но только если нас закрыват - просто - можно!*/
    if (((new$CloseCode <> 0) and (new$DateClose is null)) or (new$DateClose >= :old.DateClose)) then
      new$DateClose := :old.DateClose;
          
    else 
      if (new$CloseCode = 0) then 
        new$DateClose := null;
        if (new$StatusAccount <> 0) then
          new$StatusAccount := 0;
            
        END IF;
      END IF;  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_FACIALACC_CLS_BU_300)
-- Create 03.11.2010
-- - - - - - - - - - - - -

  GetIntConst(32, 42, FCExEnable$);
  if ((FCExEnable$ = 1) and (new$FacialCodeEx is null)) then
    RaiseException('EX_FacialCodeEx_Req');
  end if;       

-- - - - - - - - - - - - -
-- BU_400 (TR_FACIALACC_CLS_BU_400)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$IsRBS is null) then
    if (new$HaracterAccount in (1, 2)) then
      new$IsRBS := 1;
          
    else
      new$IsRBS := 0;
      
    END IF;
  END IF;
  if (new$IsPBS is null) then
    if (new$HaracterAccount in (0, 2)) then
      new$IsPBS := 1;
          
    else
      new$IsPBS := 0;
      
    END IF;
  END IF;
  if (new$IsBU is null) then
    new$IsBU := 0;
  END IF;
  if (new$IsOMS is null) then
    new$IsOMS := 0;
  END IF;
  if (new$IsSeparateBU is null) then
    new$IsSeparateBU := 0;
  END IF;
  if (new$IsProxy is null) then
    new$IsProxy := 0;
  END IF;
  if ((new$IsRBS + new$IsPBS + new$IsBU + new$IsOMS + new$IsSeparateBU + new$IsProxy) = 0) then
    new$HaracterAccount := 3;
      
  else
    if ((new$IsBU + new$IsOMS + new$IsSeparateBU + new$IsProxy) > 0) then
      new$HaracterAccount := 0;
          
    else
      if (new$IsRBS = 1) then
        new$HaracterAccount := new$IsRBS + new$IsPBS;
              
      else
        new$HaracterAccount := 0;
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_550 (TR_FACIALACC_CLS_BU_550)
-- Last update 15.05.2005
-- - - - - - - - - - - - -

   IF ((new$GeneralOrg_ref IS NULL)or(new$Org_Ref <> :old.Org_Ref)) THEN
     select
       o.GeneralOrg_Ref
     into
       id_org$
     from
       Organizations o
     where
       o.id = new$Org_Ref;
      /* Ставим ссылку на текущую организацию */
     if (id_org$ is Null)
       then id_org$ := new$Org_Ref;
     end if;  
     new$GeneralOrg_ref := id_org$;

   END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_FACIALACC_CLS_BU_700)
-- Create 19.09.2004
-- Last update 15.05.2005
-- - - - - - - - - - - - -

   IF (NEW$RVersion IS NULL) THEN
      NEW$RVersion := 1;
   ELSIF ((NEW$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      NEW$RVersion := :OLD.RVersion;
   ELSE
      NEW$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_FACIALACC_CLS SET
    ID = new$ID,
    CODE1 = new$CODE1,
    CODE2 = new$CODE2,
    CODE3 = new$CODE3,
    CODE4 = new$CODE4,
    KVSR = new$KVSR,
    KCSR = new$KCSR,
    KFSR = new$KFSR,
    KVR = new$KVR,
    KESR = new$KESR,
    FINTYPE = new$FINTYPE,
    ORG_REF = new$ORG_REF,
    DATEOPEN = new$DATEOPEN,
    SERVICEACCOUNT = new$SERVICEACCOUNT,
    STATUSACCOUNT = new$STATUSACCOUNT,
    HARACTERACCOUNT = new$HARACTERACCOUNT,
    REGIONCLS = new$REGIONCLS,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    FACIALCODE = new$FACIALCODE,
    MEANSTYPE = new$MEANSTYPE,
    GENERALORG_REF = new$GENERALORG_REF,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    RVERSION = new$RVERSION,
    CLOSEDOCNUMBER = new$CLOSEDOCNUMBER,
    HIGHERORG_REF = new$HIGHERORG_REF,
    BUDGETREF = new$BUDGETREF,
    FCACCOUNT = new$FCACCOUNT,
    CLOSECODE = new$CLOSECODE,
    DATECLOSE = new$DATECLOSE,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    NAME = new$NAME,
    FACIALCODEEX = new$FACIALCODEEX,
    ISRBS = new$ISRBS,
    ISPBS = new$ISPBS,
    ISBU = new$ISBU,
    ISSEPARATEBU = new$ISSEPARATEBU,
    ISPROXY = new$ISPROXY,
    OPENDOCNUMBER = new$OPENDOCNUMBER,
    ISOMS = new$ISOMS,
    CHANGEDOCNUMBER = new$CHANGEDOCNUMBER,
    DATECHANGE = new$DATECHANGE,
    GENERALORGFACIALACC = new$GENERALORGFACIALACC,
    GRANTEEORG_REF = new$GRANTEEORG_REF,
    PREVCLS = new$PREVCLS
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_FACIALACC_CLS_AU_500)
-- Create 28.04.2005
-- Last update 15.05.2005
-- - - - - - - - - - - - -

   IF (new$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (19, :OLD.ID, SYSDATE);

      DELETE FROM DelRecIndexes
            WHERE (TableID = 19) AND (RecordId = new$ID);
   END IF;

END;
/
commit work
/

-- #########################################################
-- #########################################################
-- alter_orgs_tr_kvsr_bud.sql
-- #########################################################
-- #########################################################

-- ALTER TRIGGER tr_organizations_au_200
CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_IU
  INSTEAD OF UPDATE
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
--
  CNT$ NUMBER(10);
  c$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_organizations_bu)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$gosni is null) then 
    new$gosni := 0;
  END IF;
  if (new$city is null) then 
    getvarcharconst(-1,7,new$city);
  END IF;
  if (new$country is null) then 
    new$country := 'Россия';
  END IF;
  if (new$countrycode is null) then 
    new$countrycode := 643;
  END IF;
  if (new$org_cls is null) then 
    new$org_cls:= 0;
  END IF;
  if (new$inn20 is null) then 
    new$inn20:= '';
  END IF;
  if (new$rcorg is null) then 
    new$rcorg := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$okato is null) then 
    new$okato := 0;
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$okfs is null) then 
    new$okfs := 0;
  END IF;
  if (new$okopf is null) then 
    new$okopf := 0;
  END IF;
  if (new$federalregioncode is null) then
    getintconst(-1, 27,new$federalregioncode);
  END IF;
  if (new$federalregioncode is null) then
    new$federalregioncode := 0;
  END IF;
  if (new$budgetref is null) then 
    new$budgetref := 0;
  END IF;
  if (new$org_type is null) then 
    new$org_type := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;

  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null))) then 
    if ((new$inn > 9999999999.9) and (new$inn20 <> '')) then
      RaiseException('ex_wrongkpp');  
    END IF;
  END IF;
  if ( ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null)))
  or ( (new$inn20 <> :old.inn20) or ((:old.inn20 is null) and (new$inn20 is not null))) )
  then
    check_unique_organization(new$inn,  new$inn20);
  END IF;
   
  if (new$regioncls <> :old.regioncls) then
    update dfaccountsbuhtable set
    regioncls = new$regioncls
    where id = any (select id from org_accounts where org_ref = new$id);
  END IF;
  /* Запрет изменений в неуказанной организации */
  if (:old.id = 0) then
    RaiseException('ex_cantmodifyunknownorg');
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if ((new$org_type<>:old.org_type) or (new$costauthority<>:old.costauthority))
  then 
    c$ := new$costauthority;
    if (new$org_type between 10100 and 10299) then
      new$costauthority:= 1;
    END IF;
    if (new$org_type between 10300 and 10399) then
      new$costauthority:= 2;
    END IF;
    if (new$org_type between 10400 and 10499) then
      new$costauthority:= 4;
    END IF;
    if (((new$org_type between 10500 and 10599) and (new$costauthority<>16)) or
    (((new$org_type between 10000 and 10099) or (new$org_type between 10600 and 10799))
    and (new$costauthority=0))) then
      new$costauthority:= 8;
    END IF;
    if ((new$org_type=:old.org_type) and (c$<>new$costauthority)) then
      RaiseException('ex_wrongcostauthority');  
    END IF;
  END IF;
  /* если изменилось значение RegionCls у организации, то меняем
      и у подведомственных лс*/
  if (new$regioncls <> :old.regioncls) then
    update facialacc_cls fac set
    fac.regioncls = new$regioncls
    where
    new$id = fac.org_ref;
      
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_ORGANIZATIONS_BU_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$FacialAcc <> :old.FacialAcc) then
    select count(id) into CNT$ from Organizations
      where (FacialAcc = new$FacialAcc) and (id <> new$id) AND (ROWNUM = 1);
    if (CNT$ <> 0) then
      RaiseException('ex_DublicateFacialAcc');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORGANIZATIONS_BU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- COMMENT сноска в детали даты закрытия


    /*  закрытие организации */
    if ((new$DateClose is not null) and (:old.DateClose is null)) then
      /*  закрываем счета флажком и указываем причину закрытия */
      update Org_Accounts set
        CloseCode = CloseCode + 10
      where Org_Ref = new$Id;
    end if;

    /*  Для л/с надо еще учитывать изменение даты */
    if (((new$DateClose is not null) and (:old.DateClose is null)) or (new$DateClose <> :old.DateClose)) then
      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode + 10
      where Org_ref = new$Id;
    end if;

    /*  открытие организации */
    if ((new$DateClose is null) and (:old.DateClose is not null)) then
      update Org_Accounts set
        CloseCode = CloseCode - 10
      where Org_Ref = new$Id;

      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode - 10
      where Org_ref = new$Id;
    end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_ORGANIZATIONS_BU_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;
  end if;

  if (new$GeneralOrg_Ref <> :old.GeneralOrg_Ref) then
    update FacialAcc_CLS set
      GeneralOrg_Ref = new$GeneralOrg_Ref
    where
      Org_Ref = new$id;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_ORGANIZATIONS_BU_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$DOCSTATEREF <> :old.DOCSTATEREF) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(new$id, :old.DOCSTATEREF, new$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORGANIZATIONS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  IF (new$RVersion IS NULL) THEN
    new$RVersion := 1;
  ELSIF ( (new$RVersion = -1) AND (:OLD.RVersion <> -1) ) THEN
    new$RVersion := :OLD.RVersion;
  ELSE
    new$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORGANIZATIONS SET
    ID = new$ID,
    NAME = new$NAME,
    GOSNI = new$GOSNI,
    CITY = new$CITY,
    COUNTRY = new$COUNTRY,
    PHONE = new$PHONE,
    ADDRESS = new$ADDRESS,
    ORG_CLS = new$ORG_CLS,
    INN20 = new$INN20,
    SUBINN = new$SUBINN,
    FACIALACC = new$FACIALACC,
    REGIONCLS = new$REGIONCLS,
    DIRNAME = new$DIRNAME,
    BUGNAME = new$BUGNAME,
    DIRPHONE = new$DIRPHONE,
    BUGPHONE = new$BUGPHONE,
    RCORG = new$RCORG,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    INN = new$INN,
    OKATO = new$OKATO,
    EMAIL = new$EMAIL,
    WEBSITE = new$WEBSITE,
    UFKCODE = new$UFKCODE,
    ADDOKATO = new$ADDOKATO,
    SHORTNAME = new$SHORTNAME,
    RVERSION = new$RVERSION,
    SENDERID = new$SENDERID,
    KVSR = new$KVSR,
    OKFS = new$OKFS,
    OKOPF = new$OKOPF,
    OPENDATE = new$OPENDATE,
    CLOSEDATE = new$CLOSEDATE,
    CHANGEDATE = new$CHANGEDATE,
    GENERALORG_REF = new$GENERALORG_REF,
    FEDERALREGIONCODE = new$FEDERALREGIONCODE,
    ORG_TYPE = new$ORG_TYPE,
    BUDGETREF = new$BUDGETREF,
    SUPPLIERSTATUS = new$SUPPLIERSTATUS,
    COUNTRYCODE = new$COUNTRYCODE,
    DATECLOSE = new$DATECLOSE,
    ORGCODE = new$ORGCODE,
    COSTAUTHORITY = new$COSTAUTHORITY,
    INCOMEAUTHORITY = new$INCOMEAUTHORITY,
    DEBTAUTHORITY = new$DEBTAUTHORITY,
    SVRAUTHORITY = new$SVRAUTHORITY,
    CLIENTID = new$CLIENTID,
    DATEOPEN = new$DATEOPEN,
    FUID = new$FUID,
    OKPO = new$OKPO,
    OKTMO = new$OKTMO,
    DOCSTATEREF = new$DOCSTATEREF,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    OGRN = new$OGRN
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_100 (TR_ORGANIZATIONS_AU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- Comment Триггер обработки открытия/закрытия организации


  /*  Закрытие организации */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
    update Banks set DateClose = new$DateClose where (id = new$ID) and (DateClose is null);
  end if;

  /*  открытие организации */
  if ((new$DateClose is null) and (:old.DateClose is not null)) then
    update Banks set DateClose = null where (id = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_200 (TR_ORGANIZATIONS_AU_200)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$BudgetRef <> :old.BudgetRef) then
    update FacialAcc_CLS set
    BudgetRef = new$BudgetRef
    where
    (ORG_REF = new$id)and((BudgetRef = :old.BudgetRef)or(BudgetRef<>0));
  END IF;
  /* Сносим организацию в проставленный КВСР, только если это ГРБС*/
  if ((new$KVSR <> :old.KVSR)and(new$Org_Type >= 10100)and(new$Org_Type <= 10299)) then
    update KVSR set
    Org_Ref = new$id
    where
    id = new$KVSR;
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update FacialAcc_CLS set
    KVSR = new$KVSR
    where
    (ORG_REF = new$id) and (KVSR = :old.KVSR);
  END IF;
  if (new$BudgetRef <> :old.BudgetRef) then
    update organizations set
    BudgetRef = new$BudgetRef
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update organizations set
    KVSR = new$KVSR
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORGANIZATIONS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (27, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=27) and (RecordId=new$ID);
  end if;

END;
/
commit work
/


-- #########################################################
-- #########################################################
-- Convertation_IDField.sql
-- #########################################################
-- #########################################################

CREATE OR REPLACE PROCEDURE InsertField(  ID_$                NUMBER,  NAME_$              VARCHAR2,
      ITFFIELDNAME_$      VARCHAR2,  NOTE_$              VARCHAR2,  TEMPLATEFIELD_$     VARCHAR2,
      ISBUDGET_$          NUMBER,  DOCTYPEREF_$        NUMBER,  DETAILNUMBER_$      NUMBER,
      ONLYREAD_$          NUMBER,  ReportFieldName_$   VARCHAR2,  KIND_$          NUMBER,
      FIELDINFOREF_$      NUMBER)
AS
BEGIN
  INSERT INTO DocumentFields
  (ID, NAME, ITFFIELDNAME, NOTE, TEMPLATEFIELD,
  ISBUDGET, DOCTYPEREF, DETAILNUMBER, ONLYREAD,ReportFieldName, FIELDINFOREF
  )
  VALUES (ID_$, NAME_$, ITFFIELDNAME_$, NOTE_$, TEMPLATEFIELD_$,
  ISBUDGET_$, DOCTYPEREF_$, DETAILNUMBER_$, ONLYREAD_$, ReportFieldName_$, FIELDINFOREF_$

  );
END;
/
CREATE OR REPLACE PROCEDURE CopyRef(  OldId$ NUMBER,NewId$ NUMBER)
AS
BEGIN
  UPDATE State_OpenFields
  SET DOCFIELDREF = NewId$

  WHERE (DOCFIELDREF = OldId$);

  UPDATE DOCLOCKFIELDS
  SET FIELDREF = NewId$

  WHERE (FIELDREF = OldId$);

  UPDATE staticlinks
  SET PARENTFIELDREF = NewId$

  WHERE (PARENTFIELDREF = OldId$);

  UPDATE staticlinks
  SET CHILDFIELDREF = NewId$

  WHERE (CHILDFIELDREF = OldId$);
END;
/
CALL InsertField(250219001, 'Сумма БО в прошлом году', 'SummaPreviousYear', '', 'SummaPreviousYear', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219002, 'Сумма оплаты БО в прошлом году', 'SummaFinPreviousYear', '', 'SummaFinPreviousYear', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219003, 'Сумма', 'Summa', '', 'Summa', 2, 2502, 2, 0, '', 0, 20140) 
/
CALL InsertField(250219004, 'Суб КЭСР', 'SubKESR', '', 'SubKESR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219005, 'Район', 'Region', '', 'Region', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219006, 'Квартал IV', 'Quarter4', '', 'Quarter4', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219007, 'Квартал III', 'Quarter3', '', 'Quarter3', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219008, 'Квартал II', 'Quarter2', '', 'Quarter2', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219009, 'Квартал I', 'Quarter1', '', 'Quarter1', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219010, 'Тип обязательства', 'PromiseType', '', 'PromiseType', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219011, 'Номер уточняемого обязательства', 'ParentNumber', '', 'ParentNumber', 2, 2502, 2, 1, '', 0, null) 
/
CALL InsertField(250219012, 'Номер обязательства', 'ANumber', '', 'ANumber', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219013, 'Декабрь', 'Month12', '', 'Month12', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219014, 'Ноябрь', 'Month11', '', 'Month11', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219015, 'Октябрь', 'Month10', '', 'Month10', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219016, 'Сентябрь', 'Month09', '', 'Month09', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219017, 'Август', 'Month08', '', 'Month08', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219018, 'Июль', 'Month07', '', 'Month07', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219019, 'Июнь', 'Month06', '', 'Month06', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219020, 'Май', 'Month05', '', 'Month05', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219021, 'Апрель', 'Month04', '', 'Month04', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219022, 'Март', 'Month03', '', 'Month03', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219023, 'Февраль', 'Month02', '', 'Month02', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219024, 'Январь', 'Month01', '', 'Month01', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219025, 'Тип средств', 'MeansType', '', 'MeansType', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219026, 'КВСР', 'KVSR', '', 'KVSR', 2, 2502, 2, 1, '', 0, null) 
/
CALL InsertField(250219027, 'КВР', 'KVR', '', 'KVR', 2, 2502, 2, 1, '', 0, null) 
/
CALL InsertField(250219028, 'КФСР', 'KFSR', '', 'KFSR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219029, 'КЭСР', 'KESR', '', 'KESR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219030, 'КЦСР', 'KCSR', '', 'KCSR', 2, 2502, 2, 1, '', 0, null) 
/
CALL InsertField(250219031, 'Тип финансирования', 'FinType', '', 'FinType', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219032, 'Источник финансирования', 'FinSource', '', 'FinSource', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219033, 'Мероприятие', 'Fact', '', 'Fact', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219034, 'Л/с ФК', 'FacialCode', '', 'FacialCode', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219035, 'Лицевой счет', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219036, 'Направление', 'DirectionCls', '', 'DirectionCls', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219037, 'Операция', 'BuhOperationCls', 'Операция', 'BuhOperationCls', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219038, 'Классификация (+)', 'TreeOwner0', 'Классификация', 'BudTree', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219040, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsCode', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219041, 'КВСР', 'KVSRCode', '', 'KVSR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219042, 'КВР', 'KVRCode', '', 'KVR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219043, 'КЦСР', 'KCSRCode', '', 'KCSR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219044, 'Номер этапа', 'StepNumber', '', 'StepNumber', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219045, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219046, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219047, 'Сумма второго года', 'SummaYear2', '', 'SummaYear2', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219048, 'Сумма третьего года', 'SummaYear3', '', 'SummaYear3', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219049, 'Номер обязательства', 'PromiseNumber', '', 'PromiseNumber', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250219050, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250218001, 'Размер НДС', 'VATSumma', '', 'VATSumma', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250218002, 'Процент НДС', 'VATPercent', '', 'VATPercent', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250218003, 'Сумма с учетом НДС', 'Summa', '', 'Summa', 2, 2502, 3, 0, '', 0, 20242) 
/
CALL InsertField(250218004, 'Наименование предмета', 'ProductName', '', 'ProductName', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250218005, 'Предмет договора (+)', 'Product', '', 'Product', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250218006, 'Цена с НДС', 'PriceVAT', 'Цена с НДС', 'PriceVAT', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250218007, 'Цена за единицу', 'Price', '', 'Price', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250218008, 'Стоимость', 'Cost', '', 'Cost', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250218009, 'Количество', 'Amount', '', 'Amount', 2, 2502, 3, 1, '', 0, null) 
/
commit work 
/
/* Поле Accepted должно тоже быть во второй детали*/
UPDATE documentfields
SET DetailNumber = 2
WHERE id = 10266623
/
commit work 
/
CALL CopyRef(250213001, 250219001) 
/
CALL CopyRef(250213002, 250219002) 
/
CALL CopyRef(250213003, 250219003) 
/
CALL CopyRef(250213004, 250219004) 
/
CALL CopyRef(250213005, 250219005) 
/
CALL CopyRef(250213006, 250219006) 
/
CALL CopyRef(250213007, 250219007) 
/
CALL CopyRef(250213008, 250219008) 
/
CALL CopyRef(250213009, 250219009) 
/
CALL CopyRef(250213010, 250219010) 
/
CALL CopyRef(250213011, 250219011) 
/
CALL CopyRef(250213012, 250219012) 
/
CALL CopyRef(250213013, 250219013) 
/
CALL CopyRef(250213014, 250219014) 
/
CALL CopyRef(250213015, 250219015) 
/
CALL CopyRef(250213016, 250219016) 
/
CALL CopyRef(250213017, 250219017) 
/
CALL CopyRef(250213018, 250219018) 
/
CALL CopyRef(250213019, 250219019) 
/
CALL CopyRef(250213020, 250219020) 
/
CALL CopyRef(250213021, 250219021) 
/
CALL CopyRef(250213022, 250219022) 
/
CALL CopyRef(250213023, 250219023) 
/
CALL CopyRef(250213024, 250219024) 
/
CALL CopyRef(250213025, 250219025) 
/
CALL CopyRef(250213026, 250219026) 
/
CALL CopyRef(250213027, 250219027) 
/
CALL CopyRef(250213028, 250219028) 
/
CALL CopyRef(250213029, 250219029) 
/
CALL CopyRef(250213030, 250219030) 
/
CALL CopyRef(250213031, 250219031) 
/
CALL CopyRef(250213032, 250219032) 
/
CALL CopyRef(250213033, 250219033) 
/
CALL CopyRef(250213034, 250219034) 
/
CALL CopyRef(250213035, 250219035) 
/
CALL CopyRef(250213036, 250219036) 
/
CALL CopyRef(250213037, 250219037) 
/
CALL CopyRef(250213038, 250219038) 
/
CALL CopyRef(250213039, 250219039) 
/
CALL CopyRef(250213040, 250219040) 
/
CALL CopyRef(250213041, 250219041) 
/
CALL CopyRef(250213042, 250219042) 
/
CALL CopyRef(250213043, 250219043) 
/
CALL CopyRef(250213044, 250219044) 
/
CALL CopyRef(250213045, 250219045) 
/
CALL CopyRef(250213046, 250219046) 
/
CALL CopyRef(250213047, 250219047) 
/
CALL CopyRef(250213048, 250219048) 
/
CALL CopyRef(250213049, 250219049) 
/
CALL CopyRef(250213050, 250219050) 
/
CALL CopyRef(250212001, 250218001) 
/
CALL CopyRef(250212002, 250218002) 
/
CALL CopyRef(250212003, 250218003) 
/
CALL CopyRef(250212004, 250218004) 
/
CALL CopyRef(250212005, 250218005) 
/
CALL CopyRef(250212006, 250218006) 
/
CALL CopyRef(250212007, 250218007) 
/
CALL CopyRef(250212008, 250218008) 
/
CALL CopyRef(250212009, 250218009) 
/
commit work 
/
DELETE FROM documentfields
WHERE (id between 250212000 and 250212999) or (id between 250213000 and 250213999)
/
commit work 
/
/* Назначаем старые идишники*/
CALL InsertField(250212001, 'Сумма БО в прошлом году', 'SummaPreviousYear', '', 'SummaPreviousYear', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212002, 'Сумма оплаты БО в прошлом году', 'SummaFinPreviousYear', '', 'SummaFinPreviousYear', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212003, 'Сумма', 'Summa', '', 'Summa', 2, 2502, 2, 0, '', 0, 20140) 
/
CALL InsertField(250212004, 'Суб КЭСР', 'SubKESR', '', 'SubKESR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212005, 'Район', 'Region', '', 'Region', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212006, 'Квартал IV', 'Quarter4', '', 'Quarter4', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212007, 'Квартал III', 'Quarter3', '', 'Quarter3', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212008, 'Квартал II', 'Quarter2', '', 'Quarter2', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212009, 'Квартал I', 'Quarter1', '', 'Quarter1', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212010, 'Тип обязательства', 'PromiseType', '', 'PromiseType', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212011, 'Номер уточняемого обязательства', 'ParentNumber', '', 'ParentNumber', 2, 2502, 2, 1, '', 0, null) 
/
CALL InsertField(250212012, 'Номер обязательства', 'ANumber', '', 'ANumber', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212013, 'Декабрь', 'Month12', '', 'Month12', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212014, 'Ноябрь', 'Month11', '', 'Month11', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212015, 'Октябрь', 'Month10', '', 'Month10', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212016, 'Сентябрь', 'Month09', '', 'Month09', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212017, 'Август', 'Month08', '', 'Month08', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212018, 'Июль', 'Month07', '', 'Month07', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212019, 'Июнь', 'Month06', '', 'Month06', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212020, 'Май', 'Month05', '', 'Month05', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212021, 'Апрель', 'Month04', '', 'Month04', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212022, 'Март', 'Month03', '', 'Month03', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212023, 'Февраль', 'Month02', '', 'Month02', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212024, 'Январь', 'Month01', '', 'Month01', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212025, 'Тип средств', 'MeansType', '', 'MeansType', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212026, 'КВСР', 'KVSR', '', 'KVSR', 2, 2502, 2, 1, '', 0, null) 
/
CALL InsertField(250212027, 'КВР', 'KVR', '', 'KVR', 2, 2502, 2, 1, '', 0, null) 
/
CALL InsertField(250212028, 'КФСР', 'KFSR', '', 'KFSR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212029, 'КЭСР', 'KESR', '', 'KESR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212030, 'КЦСР', 'KCSR', '', 'KCSR', 2, 2502, 2, 1, '', 0, null) 
/
CALL InsertField(250212031, 'Тип финансирования', 'FinType', '', 'FinType', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212032, 'Источник финансирования', 'FinSource', '', 'FinSource', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212033, 'Мероприятие', 'Fact', '', 'Fact', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212034, 'Л/с ФК', 'FacialCode', '', 'FacialCode', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212035, 'Лицевой счет', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212036, 'Направление', 'DirectionCls', '', 'DirectionCls', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212037, 'Операция', 'BuhOperationCls', 'Операция', 'BuhOperationCls', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212038, 'Классификация (+)', 'TreeOwner0', 'Классификация', 'BudTree', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212040, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsCode', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212041, 'КВСР', 'KVSRCode', '', 'KVSR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212042, 'КВР', 'KVRCode', '', 'KVR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212043, 'КЦСР', 'KCSRCode', '', 'KCSR', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212044, 'Номер этапа', 'StepNumber', '', 'StepNumber', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212045, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212046, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212047, 'Сумма второго года', 'SummaYear2', '', 'SummaYear2', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212048, 'Сумма третьего года', 'SummaYear3', '', 'SummaYear3', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212049, 'Номер обязательства', 'PromiseNumber', '', 'PromiseNumber', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250212050, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250213001, 'Размер НДС', 'VATSumma', '', 'VATSumma', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250213002, 'Процент НДС', 'VATPercent', '', 'VATPercent', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250213003, 'Сумма с учетом НДС', 'Summa', '', 'Summa', 2, 2502, 3, 0, '', 0, 20242) 
/
CALL InsertField(250213004, 'Наименование предмета', 'ProductName', '', 'ProductName', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250213005, 'Предмет договора (+)', 'Product', '', 'Product', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250213006, 'Цена с НДС', 'PriceVAT', 'Цена с НДС', 'PriceVAT', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250213007, 'Цена за единицу', 'Price', '', 'Price', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250213008, 'Стоимость', 'Cost', '', 'Cost', 2, 2502, 3, 0, '', 0, null) 
/
CALL InsertField(250213009, 'Количество', 'Amount', '', 'Amount', 2, 2502, 3, 1, '', 0, null) 
/
commit work 
/
CALL CopyRef(250219001, 250212001) 
/
CALL CopyRef(250219002, 250212002) 
/
CALL CopyRef(250219003, 250212003) 
/
CALL CopyRef(250219004, 250212004) 
/
CALL CopyRef(250219005, 250212005) 
/
CALL CopyRef(250219006, 250212006) 
/
CALL CopyRef(250219007, 250212007) 
/
CALL CopyRef(250219008, 250212008) 
/
CALL CopyRef(250219009, 250212009) 
/
CALL CopyRef(250219010, 250212010) 
/
CALL CopyRef(250219011, 250212011) 
/
CALL CopyRef(250219012, 250212012) 
/
CALL CopyRef(250219013, 250212013) 
/
CALL CopyRef(250219014, 250212014) 
/
CALL CopyRef(250219015, 250212015) 
/
CALL CopyRef(250219016, 250212016) 
/
CALL CopyRef(250219017, 250212017) 
/
CALL CopyRef(250219018, 250212018) 
/
CALL CopyRef(250219019, 250212019) 
/
CALL CopyRef(250219020, 250212020) 
/
CALL CopyRef(250219021, 250212021) 
/
CALL CopyRef(250219022, 250212022) 
/
CALL CopyRef(250219023, 250212023) 
/
CALL CopyRef(250219024, 250212024) 
/
CALL CopyRef(250219025, 250212025) 
/
CALL CopyRef(250219026, 250212026) 
/
CALL CopyRef(250219027, 250212027) 
/
CALL CopyRef(250219028, 250212028) 
/
CALL CopyRef(250219029, 250212029) 
/
CALL CopyRef(250219030, 250212030) 
/
CALL CopyRef(250219031, 250212031) 
/
CALL CopyRef(250219032, 250212032) 
/
CALL CopyRef(250219033, 250212033) 
/
CALL CopyRef(250219034, 250212034) 
/
CALL CopyRef(250219035, 250212035) 
/
CALL CopyRef(250219036, 250212036) 
/
CALL CopyRef(250219037, 250212037) 
/
CALL CopyRef(250219038, 250212038) 
/
CALL CopyRef(250219039, 250212039) 
/
CALL CopyRef(250219040, 250212040) 
/
CALL CopyRef(250219041, 250212041) 
/
CALL CopyRef(250219042, 250212042) 
/
CALL CopyRef(250219043, 250212043) 
/
CALL CopyRef(250219044, 250212044) 
/
CALL CopyRef(250219045, 250212045) 
/
CALL CopyRef(250219046, 250212046) 
/
CALL CopyRef(250219047, 250212047) 
/
CALL CopyRef(250219048, 250212048) 
/
CALL CopyRef(250219049, 250212049) 
/
CALL CopyRef(250219050, 250212050) 
/
CALL CopyRef(250218001, 250213001) 
/
CALL CopyRef(250218002, 250213002) 
/
CALL CopyRef(250218003, 250213003) 
/
CALL CopyRef(250218004, 250213004) 
/
CALL CopyRef(250218005, 250213005) 
/
CALL CopyRef(250218006, 250213006) 
/
CALL CopyRef(250218007, 250213007) 
/
CALL CopyRef(250218008, 250213008) 
/
CALL CopyRef(250218009, 250213009) 
/
commit work 
/
DELETE FROM documentfields
WHERE (id between 250218000 and 250218999) or (id between 250219000 and 250219999)
/
commit work 
/
--тоже самое, только для 2504
CALL InsertField(250419001, 'Номер этапа', 'StepNumber', 'Номер этапа', 'StepNumber', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419002, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsCode', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419003, 'Классификация (+)', 'TreeOwner0', 'Классификация', 'BudTree', 2, 2504, 2, 0, '', 0, 20140) 
/
CALL InsertField(250419004, 'Сумма третьего года', 'summayear3', '', 'summayear3', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419005, 'Сумма второго года', 'summayear2', '', 'summayear2', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419006, 'Сумма БО в прошлом году', 'SummaPreviousYear', '', 'SummaPreviousYear', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419007, 'Сумма оплаты БО в прошлом году', 'SummaFinPreviousYear', '', 'SummaFinPreviousYear', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419008, 'Сумма', 'Summa', '', 'Summa', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419009, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419010, 'Суб КЭСР', 'SubKESR', '', 'SubKESR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419011, 'Район', 'Region', '', 'Region', 2, 2504, 2, 1, '', 0, null) 
/
CALL InsertField(250419012, 'Квартал IV', 'Quarter4', '', 'Quarter4', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419013, 'Квартал III', 'Quarter3', '', 'Quarter3', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419014, 'Квартал II', 'Quarter2', '', 'Quarter2', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419015, 'Квартал I', 'Quarter1', '', 'Quarter1', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419016, 'Тип обязательства', 'PromiseType', '', 'PromiseType', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419017, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419018, 'Декабрь', 'Month12', '', 'Month12', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419019, 'Ноябрь', 'Month11', '', 'Month11', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419020, 'Октябрь', 'Month10', '', 'Month10', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419021, 'Сентябрь', 'Month09', '', 'Month09', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419022, 'Август', 'Month08', '', 'Month08', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419023, 'Июль', 'Month07', '', 'Month07', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419024, 'Июнь', 'Month06', '', 'Month06', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419025, 'Май', 'Month05', '', 'Month05', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419026, 'Апрель', 'Month04', '', 'Month04', 2, 2504, 2, 1, '', 0, null) 
/
CALL InsertField(250419027, 'Март', 'Month03', '', 'Month03', 2, 2504, 2, 1, '', 0, null) 
/
CALL InsertField(250419028, 'Февраль', 'Month02', '', 'Month02', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419029, 'Январь', 'Month01', '', 'Month01', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419030, 'Тип средств', 'MeansType', '', 'MeansType', 2, 2504, 2, 1, '', 0, null) 
/
CALL InsertField(250419031, 'КВСР', 'KVSRCode', '', 'KVSR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419032, 'КВСР', 'KVSR', '', 'KVSR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419033, 'КВР', 'KVRCode', '', 'KVR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419034, 'КВР', 'KVR', '', 'KVR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419035, 'КФСР', 'KFSR', '', 'KFSR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419036, 'КЭСР', 'KESR', '', 'KESR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419037, 'КЦСР', 'KCSRCode', '', 'KCSR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419038, 'КЦСР', 'KCSR', '', 'KCSR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419039, 'Тип финансирования', 'FinTypeCode', '', 'FinType', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419040, 'Источник финансирования', 'FinSource', '', 'FinSource', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419041, 'Мероприятие', 'FactCode', '', 'Fact', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419042, 'Л/с ФК', 'FacialCode', '', 'FacialCode', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419043, 'Лицевой счет', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419044, 'Направление', 'DirectionClsCode', '', 'DirectionCls', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250419045, 'Операция', 'BuhOperationCls', '', 'BuhOperationCls', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419046, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419047, 'Номер обязательства', 'ANumber', '', 'ANumber', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419049, 'Номер обязательства', 'PromiseNumber', '', 'PromiseNumber', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419050, 'Направление (Ключ)', 'DirectionCls', '', 'DirectionClsKey', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419051, 'Мероприятие (Ключ)', 'Fact', '', 'FactKey', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250419052, 'Тип финансирования (Ключ)', 'FinType', '', 'FinTypeKey', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250418001, 'Размер НДС', 'VATSumma', '', 'VATSumma', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418002, 'Процент НДС', 'VATPercent', '', 'VATPercent', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418003, 'Сумма с учетом НДС', 'Summa', '', 'Summa', 2, 2504, 3, 0, '', 0, 20242) 
/
CALL InsertField(250418004, 'Наименование предмета', 'ProductName', '', 'ProductName', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418005, 'Предмет договора', 'Product', '', 'Product', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418006, 'Цена с НДС', 'PriceVAT', 'Цена с НДС', 'PriceVAT', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418007, 'Цена за единицу', 'Price', '', 'Price', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418008, 'Лицевой счет получателя', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418009, 'Стоимость', 'Cost', '', 'Cost', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418010, 'Наименование получателя', 'ClientName', '', 'ClientName', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418011, 'КПП получателя', 'ClientKPP', '', 'ClientKPP', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418012, 'ИНН получателя', 'ClientINN', '', 'ClientINN', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418013, 'Получатель (+)', 'ClientAll', '', 'ClientAll', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250418014, 'Количество', 'Amount', '', 'Amount', 2, 2504, 3, 1, '', 0, null) 
/
commit work 
/
CALL CopyRef(250413001, 250419001) 
/
CALL CopyRef(250413002, 250419002) 
/
CALL CopyRef(250413003, 250419003) 
/
CALL CopyRef(250413004, 250419004) 
/
CALL CopyRef(250413005, 250419005) 
/
CALL CopyRef(250413006, 250419006) 
/
CALL CopyRef(250413007, 250419007) 
/
CALL CopyRef(250413008, 250419008) 
/
CALL CopyRef(250413009, 250419009) 
/
CALL CopyRef(250413010, 250419010) 
/
CALL CopyRef(250413011, 250419011) 
/
CALL CopyRef(250413012, 250419012) 
/
CALL CopyRef(250413013, 250419013) 
/
CALL CopyRef(250413014, 250419014) 
/
CALL CopyRef(250413015, 250419015) 
/
CALL CopyRef(250413016, 250419016) 
/
CALL CopyRef(250413017, 250419017) 
/
CALL CopyRef(250413018, 250419018) 
/
CALL CopyRef(250413019, 250419019) 
/
CALL CopyRef(250413020, 250419020) 
/
CALL CopyRef(250413021, 250419021) 
/
CALL CopyRef(250413022, 250419022) 
/
CALL CopyRef(250413023, 250419023) 
/
CALL CopyRef(250413024, 250419024) 
/
CALL CopyRef(250413025, 250419025) 
/
CALL CopyRef(250413026, 250419026) 
/
CALL CopyRef(250413027, 250419027) 
/
CALL CopyRef(250413028, 250419028) 
/
CALL CopyRef(250413029, 250419029) 
/
CALL CopyRef(250413030, 250419030) 
/
CALL CopyRef(250413031, 250419031) 
/
CALL CopyRef(250413032, 250419032) 
/
CALL CopyRef(250413033, 250419033) 
/
CALL CopyRef(250413034, 250419034) 
/
CALL CopyRef(250413035, 250419035) 
/
CALL CopyRef(250413036, 250419036) 
/
CALL CopyRef(250413037, 250419037) 
/
CALL CopyRef(250413038, 250419038) 
/
CALL CopyRef(250413039, 250419039) 
/
CALL CopyRef(250413040, 250419040) 
/
CALL CopyRef(250413041, 250419041) 
/
CALL CopyRef(250413042, 250419042) 
/
CALL CopyRef(250413043, 250419043) 
/
CALL CopyRef(250413044, 250419044) 
/
CALL CopyRef(250413045, 250419045) 
/
CALL CopyRef(250413046, 250419046) 
/
CALL CopyRef(250413047, 250419047) 
/
CALL CopyRef(250413048, 250419048) 
/
CALL CopyRef(250413049, 250419049) 
/
CALL CopyRef(250413050, 250419050) 
/
CALL CopyRef(250413051, 250419051) 
/
CALL CopyRef(250413052, 250419052) 
/
CALL CopyRef(250412001, 250418001) 
/
CALL CopyRef(250412002, 250418002) 
/
CALL CopyRef(250412003, 250418003) 
/
CALL CopyRef(250412004, 250418004) 
/
CALL CopyRef(250412005, 250418005) 
/
CALL CopyRef(250412006, 250418006) 
/
CALL CopyRef(250412007, 250418007) 
/
CALL CopyRef(250412008, 250418008) 
/
CALL CopyRef(250412009, 250418009) 
/
CALL CopyRef(250412010, 250418010) 
/
CALL CopyRef(250412011, 250418011) 
/
CALL CopyRef(250412012, 250418012) 
/
CALL CopyRef(250412013, 250418013) 
/
CALL CopyRef(250412014, 250418014) 
/

commit work 
/
DELETE FROM documentfields
WHERE (id between 250412000 and 250412999) or (id between 250413000 and 250413999)
/
commit work 
/
CALL InsertField(250412001, 'Номер этапа', 'StepNumber', 'Номер этапа', 'StepNumber', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412002, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsCode', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412003, 'Классификация (+)', 'TreeOwner0', 'Классификация', 'BudTree', 2, 2504, 2, 0, '', 0, 20140) 
/
CALL InsertField(250412004, 'Сумма третьего года', 'summayear3', '', 'summayear3', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412005, 'Сумма второго года', 'summayear2', '', 'summayear2', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412006, 'Сумма БО в прошлом году', 'SummaPreviousYear', '', 'SummaPreviousYear', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412007, 'Сумма оплаты БО в прошлом году', 'SummaFinPreviousYear', '', 'SummaFinPreviousYear', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412008, 'Сумма', 'Summa', '', 'Summa', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412009, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412010, 'Суб КЭСР', 'SubKESR', '', 'SubKESR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412011, 'Район', 'Region', '', 'Region', 2, 2504, 2, 1, '', 0, null) 
/
CALL InsertField(250412012, 'Квартал IV', 'Quarter4', '', 'Quarter4', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412013, 'Квартал III', 'Quarter3', '', 'Quarter3', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412014, 'Квартал II', 'Quarter2', '', 'Quarter2', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412015, 'Квартал I', 'Quarter1', '', 'Quarter1', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412016, 'Тип обязательства', 'PromiseType', '', 'PromiseType', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412017, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412018, 'Декабрь', 'Month12', '', 'Month12', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412019, 'Ноябрь', 'Month11', '', 'Month11', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412020, 'Октябрь', 'Month10', '', 'Month10', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412021, 'Сентябрь', 'Month09', '', 'Month09', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412022, 'Август', 'Month08', '', 'Month08', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412023, 'Июль', 'Month07', '', 'Month07', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412024, 'Июнь', 'Month06', '', 'Month06', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412025, 'Май', 'Month05', '', 'Month05', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412026, 'Апрель', 'Month04', '', 'Month04', 2, 2504, 2, 1, '', 0, null) 
/
CALL InsertField(250412027, 'Март', 'Month03', '', 'Month03', 2, 2504, 2, 1, '', 0, null) 
/
CALL InsertField(250412028, 'Февраль', 'Month02', '', 'Month02', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412029, 'Январь', 'Month01', '', 'Month01', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412030, 'Тип средств', 'MeansType', '', 'MeansType', 2, 2504, 2, 1, '', 0, null) 
/
CALL InsertField(250412031, 'КВСР', 'KVSRCode', '', 'KVSR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412032, 'КВСР', 'KVSR', '', 'KVSR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412033, 'КВР', 'KVRCode', '', 'KVR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412034, 'КВР', 'KVR', '', 'KVR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412035, 'КФСР', 'KFSR', '', 'KFSR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412036, 'КЭСР', 'KESR', '', 'KESR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412037, 'КЦСР', 'KCSRCode', '', 'KCSR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412038, 'КЦСР', 'KCSR', '', 'KCSR', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412039, 'Тип финансирования', 'FinTypeCode', '', 'FinType', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412040, 'Источник финансирования', 'FinSource', '', 'FinSource', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412041, 'Мероприятие', 'FactCode', '', 'Fact', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412042, 'Л/с ФК', 'FacialCode', '', 'FacialCode', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412043, 'Лицевой счет', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412044, 'Направление', 'DirectionClsCode', '', 'DirectionCls', 2, 2502, 2, 0, '', 0, null) 
/
CALL InsertField(250412045, 'Операция', 'BuhOperationCls', '', 'BuhOperationCls', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412046, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412047, 'Номер обязательства', 'ANumber', '', 'ANumber', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412049, 'Номер обязательства', 'PromiseNumber', '', 'PromiseNumber', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412050, 'Направление (Ключ)', 'DirectionCls', '', 'DirectionClsKey', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412051, 'Мероприятие (Ключ)', 'Fact', '', 'FactKey', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250412052, 'Тип финансирования (Ключ)', 'FinType', '', 'FinTypeKey', 2, 2504, 2, 0, '', 0, null) 
/
CALL InsertField(250413001, 'Размер НДС', 'VATSumma', '', 'VATSumma', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413002, 'Процент НДС', 'VATPercent', '', 'VATPercent', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413003, 'Сумма с учетом НДС', 'Summa', '', 'Summa', 2, 2504, 3, 0, '', 0, 20242) 
/
CALL InsertField(250413004, 'Наименование предмета', 'ProductName', '', 'ProductName', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413005, 'Предмет договора', 'Product', '', 'Product', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413006, 'Цена с НДС', 'PriceVAT', 'Цена с НДС', 'PriceVAT', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413007, 'Цена за единицу', 'Price', '', 'Price', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413008, 'Лицевой счет получателя', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413009, 'Стоимость', 'Cost', '', 'Cost', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413010, 'Наименование получателя', 'ClientName', '', 'ClientName', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413011, 'КПП получателя', 'ClientKPP', '', 'ClientKPP', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413012, 'ИНН получателя', 'ClientINN', '', 'ClientINN', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413013, 'Получатель (+)', 'ClientAll', '', 'ClientAll', 2, 2504, 3, 0, '', 0, null) 
/
CALL InsertField(250413014, 'Количество', 'Amount', '', 'Amount', 2, 2504, 3, 1, '', 0, null) 
/
commit work 
/
CALL CopyRef(250419001, 250412001) 
/
CALL CopyRef(250419002, 250412002) 
/
CALL CopyRef(250419003, 250412003) 
/
CALL CopyRef(250419004, 250412004) 
/
CALL CopyRef(250419005, 250412005) 
/
CALL CopyRef(250419006, 250412006) 
/
CALL CopyRef(250419007, 250412007) 
/
CALL CopyRef(250419008, 250412008) 
/
CALL CopyRef(250419009, 250412009) 
/
CALL CopyRef(250419010, 250412010) 
/
CALL CopyRef(250419011, 250412011) 
/
CALL CopyRef(250419012, 250412012) 
/
CALL CopyRef(250419013, 250412013) 
/
CALL CopyRef(250419014, 250412014) 
/
CALL CopyRef(250419015, 250412015) 
/
CALL CopyRef(250419016, 250412016) 
/
CALL CopyRef(250419017, 250412017) 
/
CALL CopyRef(250419018, 250412018) 
/
CALL CopyRef(250419019, 250412019) 
/
CALL CopyRef(250419020, 250412020) 
/
CALL CopyRef(250419021, 250412021) 
/
CALL CopyRef(250419022, 250412022) 
/
CALL CopyRef(250419023, 250412023) 
/
CALL CopyRef(250419024, 250412024) 
/
CALL CopyRef(250419025, 250412025) 
/
CALL CopyRef(250419026, 250412026) 
/
CALL CopyRef(250419027, 250412027) 
/
CALL CopyRef(250419028, 250412028) 
/
CALL CopyRef(250419029, 250412029) 
/
CALL CopyRef(250419030, 250412030) 
/
CALL CopyRef(250419031, 250412031) 
/
CALL CopyRef(250419032, 250412032) 
/
CALL CopyRef(250419033, 250412033) 
/
CALL CopyRef(250419034, 250412034) 
/
CALL CopyRef(250419035, 250412035) 
/
CALL CopyRef(250419036, 250412036) 
/
CALL CopyRef(250419037, 250412037) 
/
CALL CopyRef(250419038, 250412038) 
/
CALL CopyRef(250419039, 250412039) 
/
CALL CopyRef(250419040, 250412040) 
/
CALL CopyRef(250419041, 250412041) 
/
CALL CopyRef(250419042, 250412042) 
/
CALL CopyRef(250419043, 250412043) 
/
CALL CopyRef(250419044, 250412044) 
/
CALL CopyRef(250419045, 250412045) 
/
CALL CopyRef(250419046, 250412046) 
/
CALL CopyRef(250419047, 250412047) 
/
CALL CopyRef(250419048, 250412048) 
/
CALL CopyRef(250419049, 250412049) 
/
CALL CopyRef(250419050, 250412050) 
/
CALL CopyRef(250419051, 250412051) 
/
CALL CopyRef(250419052, 250412052) 
/
CALL CopyRef(250418001, 250413001) 
/
CALL CopyRef(250418002, 250413002) 
/
CALL CopyRef(250418003, 250413003) 
/
CALL CopyRef(250418004, 250413004) 
/
CALL CopyRef(250418005, 250413005) 
/
CALL CopyRef(250418006, 250413006) 
/
CALL CopyRef(250418007, 250413007) 
/
CALL CopyRef(250418008, 250413008) 
/
CALL CopyRef(250418009, 250413009) 
/
CALL CopyRef(250418010, 250413010) 
/
CALL CopyRef(250418011, 250413011) 
/
CALL CopyRef(250418012, 250413012) 
/
CALL CopyRef(250418013, 250413013) 
/
CALL CopyRef(250418014, 250413014) 
/
commit work 
/
DELETE FROM documentfields
WHERE (id between 250418000 and 250418999) or (id between 250419000 and 250419999)
/
commit work 
/
DROP PROCEDURE InsertField 
/
DROP PROCEDURE CopyRef 
/
commit work 
/

-- #########################################################
-- #########################################################
-- alter_oos_contract_add_budget_code.sql
-- #########################################################
-- #########################################################

/* Добавления поля "Код бюджета" в таблицу oos_contract*/
ALTER TABLE OOS_CONTRACT ADD (
  BUDGET_CODE VARCHAR2(10)
)
/
commit work 
/

-- #########################################################
-- #########################################################
-- ADD_AbstractKind_InquirySession.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет поля AbstractKind (Тип выписки)
  InquirySession (Номер рейса) в таблицы
   bankexch_ko_saldo и bankexch_LS_KB */
ALTER TABLE bankexch_ko_saldo ADD (
  AbstractKind NUMBER(10),
    CHECK((AbstractKind<=2147483647)AND(AbstractKind>-2147483648)),
  InquirySession NUMBER(10),
    CHECK((InquirySession<=2147483647)AND(InquirySession>-2147483648))
)
/
ALTER TABLE bankexch_LS_KB ADD (
  AbstractKind NUMBER(10),
    CHECK((AbstractKind<=2147483647)AND(AbstractKind>-2147483648)),
  InquirySession NUMBER(10),
    CHECK((InquirySession<=2147483647)AND(InquirySession>-2147483648))
)
/
COMMIT WORK
/


-- #########################################################
-- #########################################################
-- add_rejectcls_to_Organizations.sql
-- #########################################################
-- #########################################################

/* Добавление в таблицу organizations полей для поддержки системы состояний и ЭЦП */
ALTER TABLE TB_organizations ADD (
  REJECT_CLS NUMBER(10),
    CHECK((REJECT_CLS<=2147483647)AND(REJECT_CLS>-2147483648)),
  REJECTCAUSE VARCHAR2(255)
)
/

CREATE OR REPLACE VIEW organizations (
  ID,
  NAME,
  GOSNI,
  CITY,
  COUNTRY,
  PHONE,
  ADDRESS,
  ORG_CLS,
  INN20,
  SUBINN,
  FACIALACC,
  REGIONCLS,
  DIRNAME,
  BUGNAME,
  DIRPHONE,
  BUGPHONE,
  RCORG,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  INN,
  OKATO,
  EMAIL,
  WEBSITE,
  UFKCODE,
  ADDOKATO,
  SHORTNAME,
  RVERSION,
  SENDERID,
  KVSR,
  OKFS,
  OKOPF,
  OPENDATE,
  CLOSEDATE,
  CHANGEDATE,
  GENERALORG_REF,
  FEDERALREGIONCODE,
  ORG_TYPE,
  BUDGETREF,
  SUPPLIERSTATUS,
  COUNTRYCODE,
  DATECLOSE,
  ORGCODE,
  COSTAUTHORITY,
  INCOMEAUTHORITY,
  DEBTAUTHORITY,
  SVRAUTHORITY,
  CLIENTID,
  DATEOPEN,
  FUID,
  OKPO,
  OKTMO,
  DOCSTATEREF,
  CRYPTOSTATUS,
  OGRN,
  REJECT_CLS,
  REJECTCAUSE)
AS
  SELECT
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS,
    OGRN,
    REJECT_CLS,
    REJECTCAUSE
  FROM TB_organizations
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_ID
  INSTEAD OF DELETE
  ON ORGANIZATIONS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_ORGANIZATIONS_BD)
-- Last update 09.06.2008
-- - - - - - - - - - - - -

  if (:old.ID = 0) then
    RaiseException('ex_CantDelUnknownOrg');
  end if;

  delete from Org_Accounts where org_ref = :old.id;
  delete from Banks where id = :old.id;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_ORGANIZATIONS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_200 (TR_ORGANIZATIONS_AD_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

update Organizations set
    GeneralOrg_Ref = id
  where
    GeneralOrg_Ref = :old.id;

-- - - - - - - - - - - - -
-- AD_210 (TR_ORGANIZATIONS_AD_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Удаление истории изменений состоний для удаленного документа*/
  delete 
  from 
  StateJumpHistory
  where 
  DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_500 (TR_ORGANIZATIONS_AD_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(27, :old.ID ,SYSDATE);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_II
  INSTEAD OF INSERT
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
--
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_Organizations_bi)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$FUID is null) then 
    new$FUID := new$id;
  END IF;
  if (new$GOSNI is null) then 
    new$GOSNI := 0;
  END IF;
  if (new$Name is null) then 
    new$Name := 'Не указано наименование';
  END IF;
  if (new$City is null) then 
    GetVarcharConst(-1,7,new$City);
  END IF;
  if (new$COUNTRY is null) then 
    new$COUNTRY := 'Россия';
  END IF;
  if (new$CountryCode is null) then 
    new$CountryCode := 643;
  END IF;
  if (new$ORG_CLS is NULL) then 
    new$ORG_CLS:= 0;
  END IF;
  if (new$SubINN is null) then 
    new$SubINN:= 0;
  END IF;
  if (new$INN20 is null) then 
    new$INN20:= '';
  END IF;
  if (new$RCOrg is null) then 
    new$RCOrg := 0;
  END IF;
  if (new$RegionCls is null) then 
    new$RegionCls := 0;
  END IF;
  if (new$OKATO is null) then 
    new$OKATO := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$OKFS is null) then 
    new$OKFS := 0;
  END IF;
  if (new$OKOPF is null) then 
    new$OKOPF := 0;
  END IF;
  if (new$FederalRegionCode is null) then
    GetIntConst(-1, 27,new$FederalRegionCode);
  END IF;
  if (new$FederalRegionCode is null) then
    new$FederalRegionCode := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;
  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$INN > 9999999999.9) and (new$INN20 <> '') and (new$INN20 is not null)) then
    RaiseException('EX_WRONGKPP');
  END IF;
  check_unique_organization(new$inn,  new$inn20);
  if (new$CostAuthority is null) then 
    new$CostAuthority:= 0;
  END IF;
  if (new$IncomeAuthority is null) then 
    new$IncomeAuthority := 0;
  END IF;
  if (new$DebtAuthority is null) then 
    new$DebtAuthority := 0;
  END IF;
  if (new$SVRAuthority is null) then 
    new$SVRAuthority := 0;
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if (new$Org_Type is not null)
  then 
    if (new$Org_Type between 10100 and 10299) then
      new$CostAuthority:= 1;
    END IF;
    if (new$Org_Type between 10300 and 10399) then
      new$CostAuthority:= 2;
    END IF;
    if (new$Org_Type between 10400 and 10499) then
      new$CostAuthority:= 4;
    END IF;
    if (((new$Org_Type between 10500 and 10599) and (new$CostAuthority<>16)) or
    (((new$Org_Type between 10000 and 10099) or (new$Org_Type between 10600 and 10799))
    and (new$CostAuthority=0))) then
      new$CostAuthority:= 8;
        
    END IF;
  else 
    new$Org_Type := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_ORGANIZATIONS_BI_10)
-- Last update 19.10.2006
-- - - - - - - - - - - - -

  if (new$FacialAcc is not null) then
    select count(id) into cnt$ from Organizations where (FacialAcc = new$FacialAcc) AND (ROWNUM = 1);
    if (cnt$ <> 0) then RaiseException('ex_DublicateFacialAcc'); end if;
  end if;

-- - - - - - - - - - - - -
-- BI_200 (TR_ORGANIZATIONS_BI_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;

    /*  При вставке КВСР берем из распорядителя, если он уже не заполнен*/
    if (new$KVSR = 0) then
      select o.KVSR into new$KVSR
      from Organizations o
      where o.id = new$GeneralOrg_Ref;
    end if;
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORGANIZATIONS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORGANIZATIONS (
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS,
    OGRN,
    REJECT_CLS,
    REJECTCAUSE
  ) VALUES (
    new$ID,
    new$NAME,
    new$GOSNI,
    new$CITY,
    new$COUNTRY,
    new$PHONE,
    new$ADDRESS,
    new$ORG_CLS,
    new$INN20,
    new$SUBINN,
    new$FACIALACC,
    new$REGIONCLS,
    new$DIRNAME,
    new$BUGNAME,
    new$DIRPHONE,
    new$BUGPHONE,
    new$RCORG,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$INN,
    new$OKATO,
    new$EMAIL,
    new$WEBSITE,
    new$UFKCODE,
    new$ADDOKATO,
    new$SHORTNAME,
    new$RVERSION,
    new$SENDERID,
    new$KVSR,
    new$OKFS,
    new$OKOPF,
    new$OPENDATE,
    new$CLOSEDATE,
    new$CHANGEDATE,
    new$GENERALORG_REF,
    new$FEDERALREGIONCODE,
    new$ORG_TYPE,
    new$BUDGETREF,
    new$SUPPLIERSTATUS,
    new$COUNTRYCODE,
    new$DATECLOSE,
    new$ORGCODE,
    new$COSTAUTHORITY,
    new$INCOMEAUTHORITY,
    new$DEBTAUTHORITY,
    new$SVRAUTHORITY,
    new$CLIENTID,
    new$DATEOPEN,
    new$FUID,
    new$OKPO,
    new$OKTMO,
    new$DOCSTATEREF,
    new$CRYPTOSTATUS,
    new$OGRN,
    new$REJECT_CLS,
    new$REJECTCAUSE);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORGANIZATIONS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 27) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_IU
  INSTEAD OF UPDATE
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
--
  CNT$ NUMBER(10);
  c$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_organizations_bu)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$gosni is null) then 
    new$gosni := 0;
  END IF;
  if (new$city is null) then 
    getvarcharconst(-1,7,new$city);
  END IF;
  if (new$country is null) then 
    new$country := 'Россия';
  END IF;
  if (new$countrycode is null) then 
    new$countrycode := 643;
  END IF;
  if (new$org_cls is null) then 
    new$org_cls:= 0;
  END IF;
  if (new$inn20 is null) then 
    new$inn20:= '';
  END IF;
  if (new$rcorg is null) then 
    new$rcorg := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$okato is null) then 
    new$okato := 0;
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$okfs is null) then 
    new$okfs := 0;
  END IF;
  if (new$okopf is null) then 
    new$okopf := 0;
  END IF;
  if (new$federalregioncode is null) then
    getintconst(-1, 27,new$federalregioncode);
  END IF;
  if (new$federalregioncode is null) then
    new$federalregioncode := 0;
  END IF;
  if (new$budgetref is null) then 
    new$budgetref := 0;
  END IF;
  if (new$org_type is null) then 
    new$org_type := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;

  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null))) then 
    if ((new$inn > 9999999999.9) and (new$inn20 <> '')) then
      RaiseException('ex_wrongkpp');  
    END IF;
  END IF;
  if ( ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null)))
  or ( (new$inn20 <> :old.inn20) or ((:old.inn20 is null) and (new$inn20 is not null))) )
  then
    check_unique_organization(new$inn,  new$inn20);
  END IF;
   
  if (new$regioncls <> :old.regioncls) then
    update dfaccountsbuhtable set
    regioncls = new$regioncls
    where id = any (select id from org_accounts where org_ref = new$id);
  END IF;
  /* Запрет изменений в неуказанной организации */
  if (:old.id = 0) then
    RaiseException('ex_cantmodifyunknownorg');
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if ((new$org_type<>:old.org_type) or (new$costauthority<>:old.costauthority))
  then 
    c$ := new$costauthority;
    if (new$org_type between 10100 and 10299) then
      new$costauthority:= 1;
    END IF;
    if (new$org_type between 10300 and 10399) then
      new$costauthority:= 2;
    END IF;
    if (new$org_type between 10400 and 10499) then
      new$costauthority:= 4;
    END IF;
    if (((new$org_type between 10500 and 10599) and (new$costauthority<>16)) or
    (((new$org_type between 10000 and 10099) or (new$org_type between 10600 and 10799))
    and (new$costauthority=0))) then
      new$costauthority:= 8;
    END IF;
    if ((new$org_type=:old.org_type) and (c$<>new$costauthority)) then
      RaiseException('ex_wrongcostauthority');  
    END IF;
  END IF;
  /* если изменилось значение RegionCls у организации, то меняем
      и у подведомственных лс*/
  if (new$regioncls <> :old.regioncls) then
    update facialacc_cls fac set
    fac.regioncls = new$regioncls
    where
    new$id = fac.org_ref;
      
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_ORGANIZATIONS_BU_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$FacialAcc <> :old.FacialAcc) then
    select count(id) into CNT$ from Organizations
      where (FacialAcc = new$FacialAcc) and (id <> new$id) AND (ROWNUM = 1);
    if (CNT$ <> 0) then
      RaiseException('ex_DublicateFacialAcc');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORGANIZATIONS_BU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- COMMENT сноска в детали даты закрытия


    /*  закрытие организации */
    if ((new$DateClose is not null) and (:old.DateClose is null)) then
      /*  закрываем счета флажком и указываем причину закрытия */
      update Org_Accounts set
        CloseCode = CloseCode + 10
      where Org_Ref = new$Id;
    end if;

    /*  Для л/с надо еще учитывать изменение даты */
    if (((new$DateClose is not null) and (:old.DateClose is null)) or (new$DateClose <> :old.DateClose)) then
      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode + 10
      where Org_ref = new$Id;
    end if;

    /*  открытие организации */
    if ((new$DateClose is null) and (:old.DateClose is not null)) then
      update Org_Accounts set
        CloseCode = CloseCode - 10
      where Org_Ref = new$Id;

      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode - 10
      where Org_ref = new$Id;
    end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_ORGANIZATIONS_BU_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;
  end if;

  if (new$GeneralOrg_Ref <> :old.GeneralOrg_Ref) then
    update FacialAcc_CLS set
      GeneralOrg_Ref = new$GeneralOrg_Ref
    where
      Org_Ref = new$id;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_ORGANIZATIONS_BU_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$DOCSTATEREF <> :old.DOCSTATEREF) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(new$id, :old.DOCSTATEREF, new$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORGANIZATIONS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  IF (new$RVersion IS NULL) THEN
    new$RVersion := 1;
  ELSIF ( (new$RVersion = -1) AND (:OLD.RVersion <> -1) ) THEN
    new$RVersion := :OLD.RVersion;
  ELSE
    new$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORGANIZATIONS SET
    ID = new$ID,
    NAME = new$NAME,
    GOSNI = new$GOSNI,
    CITY = new$CITY,
    COUNTRY = new$COUNTRY,
    PHONE = new$PHONE,
    ADDRESS = new$ADDRESS,
    ORG_CLS = new$ORG_CLS,
    INN20 = new$INN20,
    SUBINN = new$SUBINN,
    FACIALACC = new$FACIALACC,
    REGIONCLS = new$REGIONCLS,
    DIRNAME = new$DIRNAME,
    BUGNAME = new$BUGNAME,
    DIRPHONE = new$DIRPHONE,
    BUGPHONE = new$BUGPHONE,
    RCORG = new$RCORG,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    INN = new$INN,
    OKATO = new$OKATO,
    EMAIL = new$EMAIL,
    WEBSITE = new$WEBSITE,
    UFKCODE = new$UFKCODE,
    ADDOKATO = new$ADDOKATO,
    SHORTNAME = new$SHORTNAME,
    RVERSION = new$RVERSION,
    SENDERID = new$SENDERID,
    KVSR = new$KVSR,
    OKFS = new$OKFS,
    OKOPF = new$OKOPF,
    OPENDATE = new$OPENDATE,
    CLOSEDATE = new$CLOSEDATE,
    CHANGEDATE = new$CHANGEDATE,
    GENERALORG_REF = new$GENERALORG_REF,
    FEDERALREGIONCODE = new$FEDERALREGIONCODE,
    ORG_TYPE = new$ORG_TYPE,
    BUDGETREF = new$BUDGETREF,
    SUPPLIERSTATUS = new$SUPPLIERSTATUS,
    COUNTRYCODE = new$COUNTRYCODE,
    DATECLOSE = new$DATECLOSE,
    ORGCODE = new$ORGCODE,
    COSTAUTHORITY = new$COSTAUTHORITY,
    INCOMEAUTHORITY = new$INCOMEAUTHORITY,
    DEBTAUTHORITY = new$DEBTAUTHORITY,
    SVRAUTHORITY = new$SVRAUTHORITY,
    CLIENTID = new$CLIENTID,
    DATEOPEN = new$DATEOPEN,
    FUID = new$FUID,
    OKPO = new$OKPO,
    OKTMO = new$OKTMO,
    DOCSTATEREF = new$DOCSTATEREF,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    OGRN = new$OGRN,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_100 (TR_ORGANIZATIONS_AU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- Comment Триггер обработки открытия/закрытия организации


  /*  Закрытие организации */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
    update Banks set DateClose = new$DateClose where (id = new$ID) and (DateClose is null);
  end if;

  /*  открытие организации */
  if ((new$DateClose is null) and (:old.DateClose is not null)) then
    update Banks set DateClose = null where (id = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_200 (TR_ORGANIZATIONS_AU_200)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$BudgetRef <> :old.BudgetRef) then
    update FacialAcc_CLS set
    BudgetRef = new$BudgetRef
    where
    (ORG_REF = new$id)and((BudgetRef = :old.BudgetRef)or(BudgetRef<>0));
  END IF;
  /* Сносим организацию в проставленный КВСР, только если это ГРБС*/
  if ((new$KVSR <> :old.KVSR)and(new$Org_Type >= 10100)and(new$Org_Type <= 10299)) then
    update KVSR set
    Org_Ref = new$id
    where
    id = new$KVSR;
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update FacialAcc_CLS set
    KVSR = new$KVSR
    where
    (ORG_REF = new$id) and (KVSR = :old.KVSR);
  END IF;
  if (new$BudgetRef <> :old.BudgetRef) then
    update organizations set
    BudgetRef = new$BudgetRef
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update organizations set
    KVSR = new$KVSR
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORGANIZATIONS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (27, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=27) and (RecordId=new$ID);
  end if;

END;
/
COMMIT WORK
/
ALTER TABLE TB_Organizations ADD (
  CONSTRAINT FK_ORG_REJECT_CLS FOREIGN KEY (REJECT_CLS) REFERENCES REJECTCLS (ID) 
)
/
CREATE INDEX FK_ORG_REJECT_CLS ON TB_Organizations(REJECT_CLS)
/
COMMIT WORK
/




-- #########################################################
-- #########################################################
-- add_FacialFinCaption_DocOsn.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет поле DocOsn в таблицу платежек*/
ALTER TABLE TB_FacialFinCaption ADD (
  DocOsn VARCHAR2(4000)
)
/

CREATE OR REPLACE VIEW FacialFinCaption (
  ID,
  DOCNUMBER,
  SOURCEDOCNUM,
  PAYDATE,
  ACCEPTDATE,
  DOCUMENTDATE,
  REESTRDATE,
  CREDIT,
  SOURCEACCOUNT,
  SOURCEFACIALACC_CLS,
  DESTACCOUNT,
  DESTFACIALACC_CLS,
  PROGINDEX,
  ARHIVEDOC,
  PAYSYMBOLCLS,
  PAYTYPECLS,
  NOTE,
  PERIOD,
  PAYPRIORITY,
  TYPEOPERATIONCLS,
  BUHPAYMENTCLS,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  BUDGETREF,
  RECORDINDEX,
  SENDERID,
  SENDERRECORDID,
  REESTR_REF,
  REJECT_CLS,
  REJECTCAUSE,
  CLIENTBANKNUMBER,
  CRYPTOSTATUS,
  TRUSTNUMBER,
  LINKEDDOCUMENT,
  BNKRECORDID,
  SUBPROGINDEX,
  DOCUMENTSTATE,
  USERSVISA,
  TREASUARYDOCSTATECLS,
  DEPARTMENTCLS,
  NDS,
  TAXNOTE,
  MANAGERBID,
  BIDNUMBER,
  GROUPID,
  GROUPSUMMA,
  DOCSTATEREF,
  LASTEXTRCHANGE,
  FAXDOCCOUNT,
  STIMATEID,
  INTEGRATEDDOCREF,
  REQUESTNUMBER,
  REQUESTDATE,
  RVERSION,
  FEDERALFUNDSREF,
  ELDOCREF,
  BUHOPERATIONCLS,
  CLSTYPE,
  OPERATIONDIRECTION,
  SOURCETYPE,
  DESTTYPE,
  CARDNUMBER,
  ISBLOCKED,
  BLOCKEDCAUSE,
  UNBLOCKEDDATE,
  UNBLOCKEDCAUSE,
  CASHIERPERSONALINFO,
  BIDDATE,
  CARDREF,
  SOURCESTOREDPAYMENTPROPS,
  DESTSTOREDPAYMENTPROPS,
  STOREDPAYMENTNOTE,
  DOCCHANGEDATE,
  UINCODE,
  DOCOSN)
AS
  SELECT
    ID,
    DOCNUMBER,
    SOURCEDOCNUM,
    PAYDATE,
    ACCEPTDATE,
    DOCUMENTDATE,
    REESTRDATE,
    CREDIT,
    SOURCEACCOUNT,
    SOURCEFACIALACC_CLS,
    DESTACCOUNT,
    DESTFACIALACC_CLS,
    PROGINDEX,
    ARHIVEDOC,
    PAYSYMBOLCLS,
    PAYTYPECLS,
    NOTE,
    PERIOD,
    PAYPRIORITY,
    TYPEOPERATIONCLS,
    BUHPAYMENTCLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    RECORDINDEX,
    SENDERID,
    SENDERRECORDID,
    REESTR_REF,
    REJECT_CLS,
    REJECTCAUSE,
    CLIENTBANKNUMBER,
    CRYPTOSTATUS,
    TRUSTNUMBER,
    LINKEDDOCUMENT,
    BNKRECORDID,
    SUBPROGINDEX,
    DOCUMENTSTATE,
    USERSVISA,
    TREASUARYDOCSTATECLS,
    DEPARTMENTCLS,
    NDS,
    TAXNOTE,
    MANAGERBID,
    BIDNUMBER,
    GROUPID,
    GROUPSUMMA,
    DOCSTATEREF,
    LASTEXTRCHANGE,
    FAXDOCCOUNT,
    STIMATEID,
    INTEGRATEDDOCREF,
    REQUESTNUMBER,
    REQUESTDATE,
    RVERSION,
    FEDERALFUNDSREF,
    ELDOCREF,
    BUHOPERATIONCLS,
    CLSTYPE,
    OPERATIONDIRECTION,
    SOURCETYPE,
    DESTTYPE,
    CARDNUMBER,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO,
    BIDDATE,
    CARDREF,
    SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE,
    DOCCHANGEDATE,
    UINCODE,
    DOCOSN
  FROM TB_FacialFinCaption
/

CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_ID
  INSTEAD OF DELETE
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  reestrAccepted1$ NUMBER(10);
  CNT$1 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_FACIALFINCAPTION_BD)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

 /*  Удалить детализацию распоряжения на финансирование */
  DELETE FROM FacialFinDetail
        WHERE (RecordIndex = :OLD.ID);

-- - - - - - - - - - - - -
-- BD_5 (TR_FACIALFINCAPTION_BD_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (((:old.progIndex = 63) or (:old.progIndex = 64) or
  (:old.progIndex = 68) or (:old.progIndex = 70))
  and (:old.REESTR_REF is not null)) then
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id = :old.REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrDelete');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BD_6 (TR_FACIALFINCAPTION_BD_6)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  SELECT COUNT(id ) INTO CNT$1
  from paydocexchange where ((paydocref=:old.id)and(status<>0)and(CodeFormat<>50)) AND (ROWNUM = 1);
  if ((CNT$1<> 0)) then
    RaiseException('ex_CannotChangeSended');
  END IF;

-- - - - - - - - - - - - -
-- BD_430 (TR_FACIALFINCAPTION_BD_430)
-- Create 04.12.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  /* При удалении ПП зануляем ссылку на него в факсах*/
  UPDATE FaxDocs
     SET OwnerID = NULL
  WHERE OwnerID = :OLD.ID;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_FACIALFINCAPTION
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_70 (TR_FACIALFINCAPTION_AD_70)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

-- При удалении п/п очищаем ссылающиеся поля у гарантии
  IF (:OLD.SubProgIndex = 416) THEN
    UPDATE Guarantee
       SET SubRecordIndex = NULL,
           SubProgIndex = 0
     WHERE SubRecordIndex = :OLD.ID;
  END IF;

-- - - - - - - - - - - - -
-- AD_200 (TR_FACIALFINCAPTION_AD_200)
-- Create 27.08.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  /* Удаление истории изменений состоний для удаленного документа*/
  delete from StateJumpHistory
    where DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_300 (TR_FACIALFINCAPTION_AD_300)
-- Create 24.02.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  IF (:OLD.FaxDocCount > 0) THEN
--    :old.FaxDocCount := :old.FaxDocCount;
    NULL;
  ELSE
    UPDATE FaxDocs
       SET OwnerID = NULL
     WHERE OwnerID = :OLD.ID;
  END IF;

-- - - - - - - - - - - - -
-- AD_500 (TR_FACIALFINCAPTION_AD_500)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate, ProgIndex, Summa)
    VALUES (23, :OLD.ID, SYSDATE, :OLD.ProgIndex, :OLD.Credit);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_II
  INSTEAD OF INSERT
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  new$ID FACIALFINCAPTION.ID%TYPE := :NEW.ID;
  new$DOCNUMBER FACIALFINCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SOURCEDOCNUM FACIALFINCAPTION.SOURCEDOCNUM%TYPE := :NEW.SOURCEDOCNUM;
  new$PAYDATE FACIALFINCAPTION.PAYDATE%TYPE := :NEW.PAYDATE;
  new$ACCEPTDATE FACIALFINCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$DOCUMENTDATE FACIALFINCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$REESTRDATE FACIALFINCAPTION.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$CREDIT FACIALFINCAPTION.CREDIT%TYPE := :NEW.CREDIT;
  new$SOURCEACCOUNT FACIALFINCAPTION.SOURCEACCOUNT%TYPE := :NEW.SOURCEACCOUNT;
  new$SOURCEFACIALACC_CLS FACIALFINCAPTION.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$DESTACCOUNT FACIALFINCAPTION.DESTACCOUNT%TYPE := :NEW.DESTACCOUNT;
  new$DESTFACIALACC_CLS FACIALFINCAPTION.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$PROGINDEX FACIALFINCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$ARHIVEDOC FACIALFINCAPTION.ARHIVEDOC%TYPE := :NEW.ARHIVEDOC;
  new$PAYSYMBOLCLS FACIALFINCAPTION.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$PAYTYPECLS FACIALFINCAPTION.PAYTYPECLS%TYPE := :NEW.PAYTYPECLS;
  new$NOTE FACIALFINCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$PERIOD FACIALFINCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$PAYPRIORITY FACIALFINCAPTION.PAYPRIORITY%TYPE := :NEW.PAYPRIORITY;
  new$TYPEOPERATIONCLS FACIALFINCAPTION.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$BUHPAYMENTCLS FACIALFINCAPTION.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$CREATERUSER FACIALFINCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF FACIALFINCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$RECORDINDEX FACIALFINCAPTION.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SENDERID FACIALFINCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REESTR_REF FACIALFINCAPTION.REESTR_REF%TYPE := :NEW.REESTR_REF;
  new$REJECT_CLS FACIALFINCAPTION.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE FACIALFINCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CLIENTBANKNUMBER FACIALFINCAPTION.CLIENTBANKNUMBER%TYPE := :NEW.CLIENTBANKNUMBER;
  new$CRYPTOSTATUS FACIALFINCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$TRUSTNUMBER FACIALFINCAPTION.TRUSTNUMBER%TYPE := :NEW.TRUSTNUMBER;
  new$LINKEDDOCUMENT FACIALFINCAPTION.LINKEDDOCUMENT%TYPE := :NEW.LINKEDDOCUMENT;
  new$BNKRECORDID FACIALFINCAPTION.BNKRECORDID%TYPE := :NEW.BNKRECORDID;
  new$SUBPROGINDEX FACIALFINCAPTION.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$DOCUMENTSTATE FACIALFINCAPTION.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA FACIALFINCAPTION.USERSVISA%TYPE := :NEW.USERSVISA;
  new$TREASUARYDOCSTATECLS FACIALFINCAPTION.TREASUARYDOCSTATECLS%TYPE := :NEW.TREASUARYDOCSTATECLS;
  new$DEPARTMENTCLS FACIALFINCAPTION.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$NDS FACIALFINCAPTION.NDS%TYPE := :NEW.NDS;
  new$TAXNOTE FACIALFINCAPTION.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$MANAGERBID FACIALFINCAPTION.MANAGERBID%TYPE := :NEW.MANAGERBID;
  new$BIDNUMBER FACIALFINCAPTION.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$GROUPID FACIALFINCAPTION.GROUPID%TYPE := :NEW.GROUPID;
  new$GROUPSUMMA FACIALFINCAPTION.GROUPSUMMA%TYPE := :NEW.GROUPSUMMA;
  new$DOCSTATEREF FACIALFINCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$LASTEXTRCHANGE FACIALFINCAPTION.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$FAXDOCCOUNT FACIALFINCAPTION.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$STIMATEID FACIALFINCAPTION.STIMATEID%TYPE := :NEW.STIMATEID;
  new$INTEGRATEDDOCREF FACIALFINCAPTION.INTEGRATEDDOCREF%TYPE := :NEW.INTEGRATEDDOCREF;
  new$REQUESTNUMBER FACIALFINCAPTION.REQUESTNUMBER%TYPE := :NEW.REQUESTNUMBER;
  new$REQUESTDATE FACIALFINCAPTION.REQUESTDATE%TYPE := :NEW.REQUESTDATE;
  new$RVERSION FACIALFINCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$FEDERALFUNDSREF FACIALFINCAPTION.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$ELDOCREF FACIALFINCAPTION.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$BUHOPERATIONCLS FACIALFINCAPTION.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CLSTYPE FACIALFINCAPTION.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$OPERATIONDIRECTION FACIALFINCAPTION.OPERATIONDIRECTION%TYPE := :NEW.OPERATIONDIRECTION;
  new$SOURCETYPE FACIALFINCAPTION.SOURCETYPE%TYPE := :NEW.SOURCETYPE;
  new$DESTTYPE FACIALFINCAPTION.DESTTYPE%TYPE := :NEW.DESTTYPE;
  new$CARDNUMBER FACIALFINCAPTION.CARDNUMBER%TYPE := :NEW.CARDNUMBER;
  new$ISBLOCKED FACIALFINCAPTION.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINCAPTION.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINCAPTION.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINCAPTION.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$CASHIERPERSONALINFO FACIALFINCAPTION.CASHIERPERSONALINFO%TYPE := :NEW.CASHIERPERSONALINFO;
  new$BIDDATE FACIALFINCAPTION.BIDDATE%TYPE := :NEW.BIDDATE;
  new$CARDREF FACIALFINCAPTION.CARDREF%TYPE := :NEW.CARDREF;
  new$SOURCESTOREDPAYMENTPROPS FACIALFINCAPTION.SOURCESTOREDPAYMENTPROPS%TYPE := :NEW.SOURCESTOREDPAYMENTPROPS;
  new$DESTSTOREDPAYMENTPROPS FACIALFINCAPTION.DESTSTOREDPAYMENTPROPS%TYPE := :NEW.DESTSTOREDPAYMENTPROPS;
  new$STOREDPAYMENTNOTE FACIALFINCAPTION.STOREDPAYMENTNOTE%TYPE := :NEW.STOREDPAYMENTNOTE;
  new$DOCCHANGEDATE FACIALFINCAPTION.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
  new$UINCODE FACIALFINCAPTION.UINCODE%TYPE := :NEW.UINCODE;
  new$DOCOSN FACIALFINCAPTION.DOCOSN%TYPE := :NEW.DOCOSN;
--
  UseFax$ NUMBER(10);
  pdt$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CmpFacialAcc_Cls1$ NUMBER(10);
  PIndex$ NUMBER(10);
  reestrAccepted1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FACIALFINCAPTION_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$credit is null)then 
    new$credit:= 0;
  END IF;
  if (new$ArhiveDoc is null) then 
    new$ArhiveDoc:= 0;
  END IF;
  if (new$PayTypeCls is null) then 
    new$PayTypeCls:= 0;
  END IF;
  if (new$BuhPaymentCls is null) then 
    new$BuhPaymentCls:= 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 0;
  END IF;
  if (new$SourceFacialAcc_CLS is null) then 
    new$SourceFacialAcc_CLS:= 0;
  END IF;
  if (new$DestFacialAcc_CLS is null) then 
    new$DestFacialAcc_CLS:= 0;
  END IF;
  if (new$FaxDocCount is null) then 
    new$FaxDocCount := 0;
  END IF;
  if (new$OperationDirection is null) then 
    new$OperationDirection := 0;
  END IF;
  if (new$OperationDirection = 0) then
    new$SourceType := 1;
    new$DestType := 1;
     
  else
    if (new$OperationDirection = 1) then
      new$SourceType := 1;
      new$DestType := -1;
         
    else
      if (new$OperationDirection = 2) then
        new$SourceType := -1;
        new$DestType := 1;
             
      else
        new$SourceType := -1;
        new$DestType := -1;
             
      END IF;
    END IF;
  END IF;
  if (new$DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber1$); 
    if (DocNumber1$ is null) then 
      new$DepartmentCls:= 0;
           
    else 
      new$DepartmentCls:= DocNumber1$;
       
    END IF;
  END IF;
   
  /* Заполнение Бюджета. Если пустой или ноль, берем из лицевого счета */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    PIndex$ := new$ProgIndex;
    if (PIndex$=60) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Приход средств от фин.органа*/
    END IF;
    if (PIndex$=61) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Приход средств от прочих и восстановление расходов*/
    END IF;
    if (PIndex$=62) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Приход средств по объявлениям*/
    END IF;
    if (PIndex$=63) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Уход средств по платежным поручениям*/
    END IF;
    if (PIndex$=64) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Уход средств по чекам*/
    END IF;
    if (PIndex$=65) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Переброска средств, Разассигновка*/
    END IF;
    if (PIndex$=66) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Внутренняя переброска средств, один - многим*/
    END IF;
    if (PIndex$=67) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Уход средств в районы*/
    END IF;
    if (PIndex$=68) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Перечисление на р\с районов*/
    END IF;
    if (PIndex$=69) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Подтверждение перечисления на р\с районов*/
    END IF;
    if (PIndex$=70) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Возврат с р\с районов*/
    END IF;
    if (PIndex$=71) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Подтверждение возврата с р\с районов*/
    END IF;
    if (PIndex$=73) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Учет кассовых выбытий*/
    END IF;
    if (PIndex$=75) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Утверждение ОФ*/
    END IF;
    if (PIndex$=76) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Распределение ОФ*/
    END IF;
    BEGIN

      select fa.BudgetRef      into new$BudgetRef from FacialAcc_Cls fa
      where fa.Id = CmpFacialAcc_Cls1$

      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$AcceptDate is not null) and (new$Reject_CLS is not null )) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_1 (TR_FACIALFINCAPTION_BI_1)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- Инициализация значений по-умолчанию для добавляемых полей на вставку
   IF (new$GroupID IS NULL) THEN new$GroupID := new$ID; END IF;
   IF (new$GroupSumma IS NULL) THEN new$GroupSumma := 0; END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_FACIALFINCAPTION_BI_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (((new$progIndex = 63) or (new$progIndex = 64) or
  (new$progIndex = 68) or (new$progIndex = 70))
  and (new$REESTR_REF is not null)) then
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id = new$REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrInsert');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_16 (TR_FACIALFINCAPTION_BI_16)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /*  Вставляется запись по новой схеме. Делаем сноску в FacialFinCaption
     даты и номера реестра из таблицы реестров по ссылке*/
   IF (new$Reestr_ref IS NULL) THEN
      new$SourceDocNum := '';
      new$ReestrDate := NULL;
   ELSE
      BEGIN
         SELECT ffr.ReestrNumber, ffr.ReestrDate
           INTO new$SourceDocNum, new$ReestrDate
           FROM FacialFinReestr ffr
          WHERE ffr.ID = new$Reestr_ref;
      EXCEPTION
         WHEN NO_DATA_FOUND THEN
            new$SourceDocNum := NULL;
            new$ReestrDate := NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BI_430 (TR_FACIALFINCAPTION_BI_430)
-- Create 04.12.2004
-- Last update 11.10.2006
-- - - - - - - - - - - - -

  IF (NEW$SenderID IS NOT NULL) THEN
    pdt$ := NULL;
    IF (NEW$progindex = 63) THEN pdt$ := 302; END IF;
    IF (NEW$progindex = 66) THEN pdt$ := 301; END IF;
    IF (NEW$progindex = 64) THEN pdt$ := 304; END IF;

    /*  Платежное поручение получено из УРМ */
    GetIntConst(30, 19, UseFax$);
    IF ((new$BidNumber IS NULL) AND (UseFax$ = 1)) THEN
      new$BidNumber := new$DocNumber;
    END IF;
    SELECT COUNT(*) INTO new$FaxDocCount
    FROM FaxDocs
      WHERE (OwnerDocNumber=new$BidNumber)
        AND (ClientID=new$SenderID)
        AND (FacialAcc_Cls=new$SourceFacialAcc_CLS)
        AND (OwnerDate = new$DocumentDate)
        AND (PrimaryDocType = PDT$);
  ELSE
    new$FaxDocCount := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_FACIALFINCAPTION_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$DocChangeDate := new$UpdateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_FACIALFINCAPTION (
    ID,
    DOCNUMBER,
    SOURCEDOCNUM,
    PAYDATE,
    ACCEPTDATE,
    DOCUMENTDATE,
    REESTRDATE,
    CREDIT,
    SOURCEACCOUNT,
    SOURCEFACIALACC_CLS,
    DESTACCOUNT,
    DESTFACIALACC_CLS,
    PROGINDEX,
    ARHIVEDOC,
    PAYSYMBOLCLS,
    PAYTYPECLS,
    NOTE,
    PERIOD,
    PAYPRIORITY,
    TYPEOPERATIONCLS,
    BUHPAYMENTCLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    RECORDINDEX,
    SENDERID,
    SENDERRECORDID,
    REESTR_REF,
    REJECT_CLS,
    REJECTCAUSE,
    CLIENTBANKNUMBER,
    CRYPTOSTATUS,
    TRUSTNUMBER,
    LINKEDDOCUMENT,
    BNKRECORDID,
    SUBPROGINDEX,
    DOCUMENTSTATE,
    USERSVISA,
    TREASUARYDOCSTATECLS,
    DEPARTMENTCLS,
    NDS,
    TAXNOTE,
    MANAGERBID,
    BIDNUMBER,
    GROUPID,
    GROUPSUMMA,
    DOCSTATEREF,
    LASTEXTRCHANGE,
    FAXDOCCOUNT,
    STIMATEID,
    INTEGRATEDDOCREF,
    REQUESTNUMBER,
    REQUESTDATE,
    RVERSION,
    FEDERALFUNDSREF,
    ELDOCREF,
    BUHOPERATIONCLS,
    CLSTYPE,
    OPERATIONDIRECTION,
    SOURCETYPE,
    DESTTYPE,
    CARDNUMBER,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO,
    BIDDATE,
    CARDREF,
    SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE,
    DOCCHANGEDATE,
    UINCODE,
    DOCOSN
  ) VALUES (
    new$ID,
    new$DOCNUMBER,
    new$SOURCEDOCNUM,
    new$PAYDATE,
    new$ACCEPTDATE,
    new$DOCUMENTDATE,
    new$REESTRDATE,
    new$CREDIT,
    new$SOURCEACCOUNT,
    new$SOURCEFACIALACC_CLS,
    new$DESTACCOUNT,
    new$DESTFACIALACC_CLS,
    new$PROGINDEX,
    new$ARHIVEDOC,
    new$PAYSYMBOLCLS,
    new$PAYTYPECLS,
    new$NOTE,
    new$PERIOD,
    new$PAYPRIORITY,
    new$TYPEOPERATIONCLS,
    new$BUHPAYMENTCLS,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$RECORDINDEX,
    new$SENDERID,
    new$SENDERRECORDID,
    new$REESTR_REF,
    new$REJECT_CLS,
    new$REJECTCAUSE,
    new$CLIENTBANKNUMBER,
    new$CRYPTOSTATUS,
    new$TRUSTNUMBER,
    new$LINKEDDOCUMENT,
    new$BNKRECORDID,
    new$SUBPROGINDEX,
    new$DOCUMENTSTATE,
    new$USERSVISA,
    new$TREASUARYDOCSTATECLS,
    new$DEPARTMENTCLS,
    new$NDS,
    new$TAXNOTE,
    new$MANAGERBID,
    new$BIDNUMBER,
    new$GROUPID,
    new$GROUPSUMMA,
    new$DOCSTATEREF,
    new$LASTEXTRCHANGE,
    new$FAXDOCCOUNT,
    new$STIMATEID,
    new$INTEGRATEDDOCREF,
    new$REQUESTNUMBER,
    new$REQUESTDATE,
    new$RVERSION,
    new$FEDERALFUNDSREF,
    new$ELDOCREF,
    new$BUHOPERATIONCLS,
    new$CLSTYPE,
    new$OPERATIONDIRECTION,
    new$SOURCETYPE,
    new$DESTTYPE,
    new$CARDNUMBER,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$CASHIERPERSONALINFO,
    new$BIDDATE,
    new$CARDREF,
    new$SOURCESTOREDPAYMENTPROPS,
    new$DESTSTOREDPAYMENTPROPS,
    new$STOREDPAYMENTNOTE,
    new$DOCCHANGEDATE,
    new$UINCODE,
    new$DOCOSN);

-- - - - - - - - - - - - -
-- AI_430 (TR_FACIALFINCAPTION_AI_430)
-- Create 04.12.2004
-- Last update 11.10.2006
-- - - - - - - - - - - - -

  IF (new$SenderID IS NOT NULL) THEN
      /*  Платежное поручение получено из УРМ */
      pdt$ := NULL;
      IF (new$progindex = 63) THEN pdt$ := 302; END IF;
      IF (new$progindex = 66) THEN pdt$ := 301; END IF;
      IF (new$progindex = 64) THEN pdt$ := 304; END IF;

        UPDATE FaxDocs
            SET OwnerId=new$id
        WHERE
            (OwnerDocNumber=new$BidNumber)
            AND (ClientID=new$SenderID)
            AND (FacialAcc_Cls=new$SourceFacialAcc_CLS)
            AND (OwnerDate = new$DocumentDate)
            AND (primarydoctype = pdt$);
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_FACIALFINCAPTION_AI_500)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
     WHERE (TableID = 23) AND (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_IU
  INSTEAD OF UPDATE
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  new$ID FACIALFINCAPTION.ID%TYPE := :NEW.ID;
  new$DOCNUMBER FACIALFINCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SOURCEDOCNUM FACIALFINCAPTION.SOURCEDOCNUM%TYPE := :NEW.SOURCEDOCNUM;
  new$PAYDATE FACIALFINCAPTION.PAYDATE%TYPE := :NEW.PAYDATE;
  new$ACCEPTDATE FACIALFINCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$DOCUMENTDATE FACIALFINCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$REESTRDATE FACIALFINCAPTION.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$CREDIT FACIALFINCAPTION.CREDIT%TYPE := :NEW.CREDIT;
  new$SOURCEACCOUNT FACIALFINCAPTION.SOURCEACCOUNT%TYPE := :NEW.SOURCEACCOUNT;
  new$SOURCEFACIALACC_CLS FACIALFINCAPTION.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$DESTACCOUNT FACIALFINCAPTION.DESTACCOUNT%TYPE := :NEW.DESTACCOUNT;
  new$DESTFACIALACC_CLS FACIALFINCAPTION.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$PROGINDEX FACIALFINCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$ARHIVEDOC FACIALFINCAPTION.ARHIVEDOC%TYPE := :NEW.ARHIVEDOC;
  new$PAYSYMBOLCLS FACIALFINCAPTION.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$PAYTYPECLS FACIALFINCAPTION.PAYTYPECLS%TYPE := :NEW.PAYTYPECLS;
  new$NOTE FACIALFINCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$PERIOD FACIALFINCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$PAYPRIORITY FACIALFINCAPTION.PAYPRIORITY%TYPE := :NEW.PAYPRIORITY;
  new$TYPEOPERATIONCLS FACIALFINCAPTION.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$BUHPAYMENTCLS FACIALFINCAPTION.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$CREATERUSER FACIALFINCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF FACIALFINCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$RECORDINDEX FACIALFINCAPTION.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SENDERID FACIALFINCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REESTR_REF FACIALFINCAPTION.REESTR_REF%TYPE := :NEW.REESTR_REF;
  new$REJECT_CLS FACIALFINCAPTION.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE FACIALFINCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CLIENTBANKNUMBER FACIALFINCAPTION.CLIENTBANKNUMBER%TYPE := :NEW.CLIENTBANKNUMBER;
  new$CRYPTOSTATUS FACIALFINCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$TRUSTNUMBER FACIALFINCAPTION.TRUSTNUMBER%TYPE := :NEW.TRUSTNUMBER;
  new$LINKEDDOCUMENT FACIALFINCAPTION.LINKEDDOCUMENT%TYPE := :NEW.LINKEDDOCUMENT;
  new$BNKRECORDID FACIALFINCAPTION.BNKRECORDID%TYPE := :NEW.BNKRECORDID;
  new$SUBPROGINDEX FACIALFINCAPTION.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$DOCUMENTSTATE FACIALFINCAPTION.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA FACIALFINCAPTION.USERSVISA%TYPE := :NEW.USERSVISA;
  new$TREASUARYDOCSTATECLS FACIALFINCAPTION.TREASUARYDOCSTATECLS%TYPE := :NEW.TREASUARYDOCSTATECLS;
  new$DEPARTMENTCLS FACIALFINCAPTION.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$NDS FACIALFINCAPTION.NDS%TYPE := :NEW.NDS;
  new$TAXNOTE FACIALFINCAPTION.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$MANAGERBID FACIALFINCAPTION.MANAGERBID%TYPE := :NEW.MANAGERBID;
  new$BIDNUMBER FACIALFINCAPTION.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$GROUPID FACIALFINCAPTION.GROUPID%TYPE := :NEW.GROUPID;
  new$GROUPSUMMA FACIALFINCAPTION.GROUPSUMMA%TYPE := :NEW.GROUPSUMMA;
  new$DOCSTATEREF FACIALFINCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$LASTEXTRCHANGE FACIALFINCAPTION.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$FAXDOCCOUNT FACIALFINCAPTION.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$STIMATEID FACIALFINCAPTION.STIMATEID%TYPE := :NEW.STIMATEID;
  new$INTEGRATEDDOCREF FACIALFINCAPTION.INTEGRATEDDOCREF%TYPE := :NEW.INTEGRATEDDOCREF;
  new$REQUESTNUMBER FACIALFINCAPTION.REQUESTNUMBER%TYPE := :NEW.REQUESTNUMBER;
  new$REQUESTDATE FACIALFINCAPTION.REQUESTDATE%TYPE := :NEW.REQUESTDATE;
  new$RVERSION FACIALFINCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$FEDERALFUNDSREF FACIALFINCAPTION.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$ELDOCREF FACIALFINCAPTION.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$BUHOPERATIONCLS FACIALFINCAPTION.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CLSTYPE FACIALFINCAPTION.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$OPERATIONDIRECTION FACIALFINCAPTION.OPERATIONDIRECTION%TYPE := :NEW.OPERATIONDIRECTION;
  new$SOURCETYPE FACIALFINCAPTION.SOURCETYPE%TYPE := :NEW.SOURCETYPE;
  new$DESTTYPE FACIALFINCAPTION.DESTTYPE%TYPE := :NEW.DESTTYPE;
  new$CARDNUMBER FACIALFINCAPTION.CARDNUMBER%TYPE := :NEW.CARDNUMBER;
  new$ISBLOCKED FACIALFINCAPTION.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINCAPTION.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINCAPTION.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINCAPTION.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$CASHIERPERSONALINFO FACIALFINCAPTION.CASHIERPERSONALINFO%TYPE := :NEW.CASHIERPERSONALINFO;
  new$BIDDATE FACIALFINCAPTION.BIDDATE%TYPE := :NEW.BIDDATE;
  new$CARDREF FACIALFINCAPTION.CARDREF%TYPE := :NEW.CARDREF;
  new$SOURCESTOREDPAYMENTPROPS FACIALFINCAPTION.SOURCESTOREDPAYMENTPROPS%TYPE := :NEW.SOURCESTOREDPAYMENTPROPS;
  new$DESTSTOREDPAYMENTPROPS FACIALFINCAPTION.DESTSTOREDPAYMENTPROPS%TYPE := :NEW.DESTSTOREDPAYMENTPROPS;
  new$STOREDPAYMENTNOTE FACIALFINCAPTION.STOREDPAYMENTNOTE%TYPE := :NEW.STOREDPAYMENTNOTE;
  new$DOCCHANGEDATE FACIALFINCAPTION.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
  new$UINCODE FACIALFINCAPTION.UINCODE%TYPE := :NEW.UINCODE;
  new$DOCOSN FACIALFINCAPTION.DOCOSN%TYPE := :NEW.DOCOSN;
--
  SourceFacialAcc_CLS$ NUMBER(10);
  DestFacialAcc_CLS$ NUMBER(10);
  UseFax1$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  DetCount1$ NUMBER(10);
  CNT$1 NUMBER(10);
  reestrAccepted1$ NUMBER(10);
  IsReject1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_FACIALFINCAPTION_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$SenderID is not null) then 
    /* Платежное поручение получено из УРМ */
    GetIntConst(30, 19,UseFax1$);
    if ((new$BidNumber is null) and (UseFax1$ = 1)) then 
      new$BidNumber:= new$DocNumber;
      
    END IF;
  END IF;
  if (new$credit is null)then 
    new$credit:= 0;
  END IF;
  if (new$ArhiveDoc is null) then 
    new$ArhiveDoc:= 0;
  END IF;
  if (new$PayTypeCls is null) then 
    new$PayTypeCls:= 0;
  END IF;
  if (new$BuhPaymentCls is null) then 
    new$BuhPaymentCls:= 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 0;
  END IF;
  if (new$SourceFacialAcc_CLS is null) then 
    new$SourceFacialAcc_CLS:= 0;
  END IF;
  if (new$DestFacialAcc_CLS is null) then 
    new$DestFacialAcc_CLS:= 0;
  END IF;
  if (new$FaxDocCount is null) then 
    new$FaxDocCount := 0;
  END IF;
  if (new$OperationDirection is null) then 
    new$OperationDirection := 0;
  END IF;
  if (new$OperationDirection <> :old.OperationDirection) then
    if (new$OperationDirection = 0) then
      new$SourceType := 1;
      new$DestType := 1;
          
    else
      if (new$OperationDirection = 1) then
        new$SourceType := 1;
        new$DestType := -1;
              
      else
        if (new$OperationDirection = 2) then
          new$SourceType := -1;
          new$DestType := 1;
                  
        else
          new$SourceType := -1;
          new$DestType := -1;
                  
        END IF;
      END IF;  
    END IF;
  END IF;
  if (new$DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber1$); 
    if (DocNumber1$ is null) then 
      new$DepartmentCls:= 0;
          
    else 
      new$DepartmentCls:= DocNumber1$;
      
    END IF;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      select count(ID)       into DetCount1$ from FacialFinDetail where RecordIndex = :old.ID
      ;
      if (DetCount1$ > 0) then 
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$AcceptDate is not null) and (new$Reject_Cls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_FACIALFINCAPTION_BU_1)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- Инициализация значений по-умолчанию для добавляемых полей на изменение
   IF (new$GroupID IS NULL) THEN new$GroupID := new$ID; END IF;
   IF (new$GroupSumma IS NULL) THEN new$GroupSumma := 0; END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_FACIALFINCAPTION_BU_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (not (    ((new$progindex = 63) or (new$progindex = 64) or (new$progindex = 68) or (new$progindex = 70))
  and (   (((new$credit - :old.credit)>0.001)or((new$credit - :old.credit)<-0.001))
  or (new$sourcefacialacc_cls <> :old.sourcefacialacc_cls)
  or (
  ((new$sourceaccount is null) and (:old.sourceaccount is not null)) or
  ((new$sourceaccount is not null) and (:old.sourceaccount is null)) or
  ((new$sourceaccount <> :old.sourceaccount ) and (:old.sourceaccount is not null) and (new$sourceaccount is not null))                                             
  )
  or (
  ((new$destaccount is null) and (:old.destaccount is not null)) or
  ((new$destaccount is not null) and (:old.destaccount is null)) or
  ((new$destaccount <> :old.destaccount ) and (:old.destaccount is not null) and (new$destaccount is not null))
  )
  or (    (:old.reestr_ref is null)
  and (new$reestr_ref is not null)
  )
  or (    (:old.reestr_ref is not null)
  and (new$reestr_ref is null)
  )
  or (:old.reestr_ref <> new$reestr_ref)
  )
  )
  )
  then /* для корректной обработки неопределенности с NULL полями*/
    reestrAccepted1$ := 0;  /* заглушка для IB 4.2 */
      
  else 
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id=new$REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrUpdate');
    END IF;
    BEGIN

      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where
      id=:old.REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrUpdate');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_6 (TR_FACIALFINCAPTION_BU_6)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:old.ProgIndex in(63,68,70)) then /* только для исходящих платежек*/
    SELECT COUNT(id ) INTO CNT$1
    from paydocexchange where ((paydocref=:old.id)and(status<>0)and(CodeFormat<>50)) AND (ROWNUM = 1);
    if ((CNT$1<> 0)) then
      if(/* (new.DOCNUMBER<>old.DOCNUMBER) or ((new.DOCNUMBER is NULL)and(not old.DOCNUMBER is NULL)) or ((old.DOCNUMBER is NULL)and(not new.DOCNUMBER is NULL)) or*/
      (new$SOURCEDOCNUM<>:old.SOURCEDOCNUM) or ((new$SOURCEDOCNUM is NULL)and(not :old.SOURCEDOCNUM is NULL)) or ((:old.SOURCEDOCNUM is NULL)and(not new$SOURCEDOCNUM is NULL)) or
      (new$PAYDATE<>:old.PAYDATE) or ((new$PAYDATE is NULL)and(not :old.PAYDATE is NULL)) or ((:old.PAYDATE is NULL)and(not new$PAYDATE is NULL))or
      /* (new.DOCUMENTDATE<>old.DOCUMENTDATE) or ((new.DOCUMENTDATE is NULL)and(not old.DOCUMENTDATE is NULL)) or ((old.DOCUMENTDATE is NULL)and(not new.DOCUMENTDATE is NULL))or*/
      (new$REESTRDATE<>:old.REESTRDATE) or ((new$REESTRDATE is NULL)and(not :old.REESTRDATE is NULL)) or ((:old.REESTRDATE is NULL)and(not new$REESTRDATE is NULL))or
      (((new$credit - :old.credit)>0.001)or((new$credit - :old.credit)<-0.001)) or
      (new$SOURCEACCOUNT<>:old.SOURCEACCOUNT) or
      (new$DESTACCOUNT<>:old.DESTACCOUNT) or
      (new$PAYTYPECLS<>:old.PAYTYPECLS) or
      (new$NOTE<>:old.NOTE) or  ((new$NOTE is NULL)and(not :old.NOTE is NULL)) or ((:old.NOTE is NULL)and(not new$NOTE is NULL))or
      (new$PAYPRIORITY<>:old.PAYPRIORITY) or ((new$PAYPRIORITY is NULL)and(not :old.PAYPRIORITY is NULL)) or ((:old.PAYPRIORITY is NULL)and(not new$PAYPRIORITY is NULL))or
      (new$REESTR_REF<>:old.REESTR_REF) or ((new$REESTR_REF is NULL)and(not :old.REESTR_REF is NULL)) or ((:old.REESTR_REF is NULL)and(not new$REESTR_REF is NULL))or
      (new$NDS<>:old.NDS) or ((new$NDS is NULL)and(not :old.NDS is NULL)) or ((:old.NDS is NULL)and(not new$NDS is NULL))or
      (new$TAXNOTE<>:old.TAXNOTE) or ((new$TAXNOTE is NULL)and(not :old.TAXNOTE is NULL)) or ((:old.TAXNOTE is NULL)and(not new$TAXNOTE is NULL)) )then
        RaiseException('ex_CannotChangeSended');
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_FACIALFINCAPTION_BU_10)
-- Create 16.03.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$IntegratedDocRef IS NOT NULL) THEN
        /* Если документ входит в сводный и у него изменились ключевые аттрибуты, то нельзя их менять если они отличаются
      /* от атрибутов родительского документа*/
      IF (    (   (new$AcceptDate = :OLD.AcceptDate)
               OR ((new$AcceptDate IS NULL) AND (:OLD.AcceptDate IS NULL))
              )
          AND (   (new$Reject_CLS = :OLD.Reject_CLS)
               OR ((new$Reject_CLS IS NULL) AND (:OLD.Reject_CLS IS NULL))
              )
          AND (   (new$RejectCause = :OLD.RejectCause)
               OR ((new$RejectCause IS NULL) AND (:OLD.RejectCause IS NULL))
              )
          AND (   (new$TREASUARYDOCSTATECLS = :OLD.TREASUARYDOCSTATECLS)
               OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                   AND (:OLD.TREASUARYDOCSTATECLS IS NULL)
                  )
              )
          AND (   (new$DOCSTATEREF = :OLD.DOCSTATEREF)
               OR ((new$DOCSTATEREF IS NULL) AND (:OLD.DOCSTATEREF IS NULL))
              )
          AND (   (new$REESTR_REF = :OLD.REESTR_REF)
               OR ((new$REESTR_REF IS NULL) AND (:OLD.REESTR_REF IS NULL))
              )
          AND (new$SOURCEACCOUNT = :OLD.SOURCEACCOUNT)
          AND (new$DESTACCOUNT = :OLD.DESTACCOUNT)
         ) THEN
         new$AcceptDate := :OLD.AcceptDate;
      ELSE
         FOR R$ IN (SELECT fc.AcceptDate, fc.Reject_CLS, fc.RejectCause,
                           fc.TREASUARYDOCSTATECLS, fc.DOCSTATEREF,
                           fc.REESTR_REF, fc.SOURCEACCOUNT, fc.DESTACCOUNT
                      FROM FacialFinCaption fc
                     WHERE (fc.ID = :NEW.IntegratedDocRef)) LOOP
            IF (    (   (new$AcceptDate = R$.AcceptDate)
                     OR ((new$AcceptDate IS NULL) AND (R$.AcceptDate IS NULL)
                        )
                    )
                AND (   (new$Reject_CLS = R$.Reject_CLS)
                     OR ((new$Reject_CLS IS NULL) AND (R$.Reject_CLS IS NULL)
                        )
                    )
                AND (   (new$RejectCause = R$.RejectCause)
                     OR (    (new$RejectCause IS NULL)
                         AND (R$.RejectCause IS NULL)
                        )
                    )
                AND (   (new$TREASUARYDOCSTATECLS = R$.TREASUARYDOCSTATECLS)
                     OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                         AND (R$.TREASUARYDOCSTATECLS IS NULL)
                        )
                    )
                AND (   (new$DOCSTATEREF = R$.DOCSTATEREF)
                     OR (    (new$DOCSTATEREF IS NULL)
                         AND (R$.DOCSTATEREF IS NULL)
                        )
                    )
                AND (   (new$REESTR_REF = R$.REESTR_REF)
                     OR ((new$REESTR_REF IS NULL) AND (R$.REESTR_REF IS NULL)
                        )
                    )
                AND (new$SOURCEACCOUNT = R$.SOURCEACCOUNT)
                AND (new$DESTACCOUNT = R$.DESTACCOUNT)
               ) THEN
               new$AcceptDate := R$.AcceptDate;
            ELSE
               RaiseException ('EX_CANNOTUPDATECHILDDOC');
            END IF;
         END LOOP;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_32 (TR_FACIALFINCAPTION_BU_32)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$Reestr_ref IS NULL)    /* Чтобы не вызывать select чаще, чем нужно*/
                              THEN
      new$SourceDocNum := '';
      new$ReestrDate := NULL;
   ELSIF (    (new$Reestr_ref = :OLD.Reestr_ref)
          AND (new$SourceDocNum = :OLD.SourceDocNum)
          AND (new$ReestrDate = :OLD.ReestrDate)
         ) THEN
/* нужно для корректной обработки неопределенности со сравнением нуловых полей */
      NULL;
   ELSE
      BEGIN
         SELECT ffr.ReestrNumber, ffr.ReestrDate
           INTO new$SourceDocNum, new$ReestrDate
           FROM FacialFinReestr ffr
          WHERE ffr.ID = new$Reestr_ref;
      EXCEPTION
         WHEN NO_DATA_FOUND THEN
            new$SourceDocNum := NULL;
            new$ReestrDate := NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BU_60 (T_FACIALFINCAPTION_BU_60)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF ((new$progindex = 60) AND (new$Credit <> :OLD.Credit)) THEN
      UPDATE FacialFinDetail
         SET Credit = new$Credit
       WHERE (RecordIndex = new$ID);
   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_FACIALFINCAPTION_BU_70)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- При проведении реестра устанавливаем дату принятия у записи гарантии
   IF (new$SubProgIndex = 416) THEN
      UPDATE Guarantee
         SET AcceptDate = new$AcceptDate
       WHERE SubRecordIndex = new$ID;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (T_FACIALFINCAPTION_BU_100)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /* Триггер изменения данных, записи по финансированию */
   IF (    (   (:OLD.SourceFacialAcc_CLS <> new$SourceFacialAcc_CLS)
            OR (:OLD.DestFacialAcc_CLS <> new$DestFacialAcc_CLS)
           )
       AND ((new$SubProgIndex <> 1) OR (new$SubProgIndex IS NULL))
      ) THEN
      FOR R$ IN (SELECT ID, SourceFacialAcc_CLS, DestFacialAcc_CLS
                   FROM FacialFinDetail
                  WHERE RecordIndex = new$ID) LOOP
         IF (NOT (new$SourceFacialAcc_CLS = 0)) THEN
            SourceFacialAcc_CLS$ := new$SourceFacialAcc_CLS;
         ELSE
            SourceFacialAcc_CLS$ := R$.SourceFacialAcc_CLS;
         END IF;

         IF (NOT (new$DestFacialAcc_CLS = 0)) THEN
            DestFacialAcc_CLS$ := new$DestFacialAcc_CLS;
         ELSE
            DestFacialAcc_CLS$ := R$.DestFacialAcc_CLS;
         END IF;

         IF (:OLD.SourceFacialAcc_CLS <> new$SourceFacialAcc_CLS) THEN
            UPDATE FacialFinDetail
               SET SourceFacialAcc_CLS = SourceFacialAcc_CLS$,
                   RVersion = -1
             WHERE (ID = R$.ID);
         END IF;

         IF (:OLD.DestFacialAcc_CLS <> new$DestFacialAcc_CLS) THEN
            UPDATE FacialFinDetail
               SET DestFacialAcc_CLS = DestFacialAcc_CLS$,
                   RVersion = -1
             WHERE (ID = R$.ID);
         END IF;
      END LOOP;
   END IF;

   /* Если изменились поля блокировки/разблокировки средств, полученных
     от предпринимательской деятельности сносим их в деталь.*/
  IF (((NEW$IsBlocked <> :OLD.IsBlocked) OR
      ((NEW$IsBlocked IS NULL) AND (:OLD.IsBlocked IS NOT NULL)) OR
      ((NEW$IsBlocked IS NOT NULL) AND (:OLD.IsBlocked IS NULL))
     ) OR
     ((NEW$BlockedCause <> :OLD.BlockedCause) OR
      ((NEW$BlockedCause IS NULL) AND (:OLD.BlockedCause IS NOT NULL)) OR
      ((NEW$BlockedCause IS NOT NULL) AND (:OLD.BlockedCause IS NULL))
     ) OR
     ((NEW$UnBlockedDate <> :OLD.UnBlockedDate) OR
      ((NEW$UnBlockedDate IS NULL) AND (:OLD.UnBlockedDate IS NOT NULL)) OR
      ((NEW$UnBlockedDate IS NOT NULL) AND (:OLD.UnBlockedDate IS NULL))
     ) OR
     ((NEW$UnBlockedCause <> :OLD.UnBlockedCause) OR
      ((NEW$UnBlockedDate IS NULL) AND (:OLD.UnBlockedCause IS NOT NULL)) OR
      ((NEW$UnBlockedCause IS NOT NULL) AND (:OLD.UnBlockedCause IS NULL))
     )) THEN
     UPDATE FacialFinDetail ffd
     SET ffd.IsBlocked = NEW$IsBlocked, ffd.BlockedCause = NEW$BlockedCause,
         ffd.UnBlockedDate = NEW$UnBlockedDate, ffd.UnBlockedCause = NEW$UnBlockedCause
     WHERE ffd.recordindex = NEW$ID;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_FACIALFINCAPTION_BU_210)
-- Create 27.08.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /* Сохранение в базу истории изменений состояний*/
   IF (new$DOCSTATEREF <> :OLD.DOCSTATEREF) THEN
      INSERT INTO StateJumpHistory
                  (DocID, BeginStateRef, EndStateRef
                  )
           VALUES (new$ID, :OLD.DOCSTATEREF, new$DOCSTATEREF
                  );
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (T_FACIALFINCAPTION_BU_300)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IsReject1$ := -1;
  if ((:old.Reject_CLS is null)and(new$Reject_CLS is not null)) then
    IsReject1$ := 1;
      
  else
    if ((:old.Reject_CLS is not null)and(new$Reject_CLS is null)) then
      IsReject1$ := 0;
    END IF;
  END IF;
  if (IsReject1$  <> -1) then
    update LinkRecords set
    IsRejected = IsReject1$

    where
    ChildID = new$ID;
    update LinkRecords set
    IsRejected = IsReject1$

    where
    ChildID in (select d.id from FacialFinDetail d where d.RecordIndex = new$id);
      
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_FACIALFINCAPTION_BU_700)
-- Create 17.09.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_FACIALFINCAPTION SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    SOURCEDOCNUM = new$SOURCEDOCNUM,
    PAYDATE = new$PAYDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    DOCUMENTDATE = new$DOCUMENTDATE,
    REESTRDATE = new$REESTRDATE,
    CREDIT = new$CREDIT,
    SOURCEACCOUNT = new$SOURCEACCOUNT,
    SOURCEFACIALACC_CLS = new$SOURCEFACIALACC_CLS,
    DESTACCOUNT = new$DESTACCOUNT,
    DESTFACIALACC_CLS = new$DESTFACIALACC_CLS,
    PROGINDEX = new$PROGINDEX,
    ARHIVEDOC = new$ARHIVEDOC,
    PAYSYMBOLCLS = new$PAYSYMBOLCLS,
    PAYTYPECLS = new$PAYTYPECLS,
    NOTE = new$NOTE,
    PERIOD = new$PERIOD,
    PAYPRIORITY = new$PAYPRIORITY,
    TYPEOPERATIONCLS = new$TYPEOPERATIONCLS,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    RECORDINDEX = new$RECORDINDEX,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    REESTR_REF = new$REESTR_REF,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CLIENTBANKNUMBER = new$CLIENTBANKNUMBER,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    TRUSTNUMBER = new$TRUSTNUMBER,
    LINKEDDOCUMENT = new$LINKEDDOCUMENT,
    BNKRECORDID = new$BNKRECORDID,
    SUBPROGINDEX = new$SUBPROGINDEX,
    DOCUMENTSTATE = new$DOCUMENTSTATE,
    USERSVISA = new$USERSVISA,
    TREASUARYDOCSTATECLS = new$TREASUARYDOCSTATECLS,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    NDS = new$NDS,
    TAXNOTE = new$TAXNOTE,
    MANAGERBID = new$MANAGERBID,
    BIDNUMBER = new$BIDNUMBER,
    GROUPID = new$GROUPID,
    GROUPSUMMA = new$GROUPSUMMA,
    DOCSTATEREF = new$DOCSTATEREF,
    LASTEXTRCHANGE = new$LASTEXTRCHANGE,
    FAXDOCCOUNT = new$FAXDOCCOUNT,
    STIMATEID = new$STIMATEID,
    INTEGRATEDDOCREF = new$INTEGRATEDDOCREF,
    REQUESTNUMBER = new$REQUESTNUMBER,
    REQUESTDATE = new$REQUESTDATE,
    RVERSION = new$RVERSION,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    ELDOCREF = new$ELDOCREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    CLSTYPE = new$CLSTYPE,
    OPERATIONDIRECTION = new$OPERATIONDIRECTION,
    SOURCETYPE = new$SOURCETYPE,
    DESTTYPE = new$DESTTYPE,
    CARDNUMBER = new$CARDNUMBER,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO = new$CASHIERPERSONALINFO,
    BIDDATE = new$BIDDATE,
    CARDREF = new$CARDREF,
    SOURCESTOREDPAYMENTPROPS = new$SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS = new$DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE = new$STOREDPAYMENTNOTE,
    DOCCHANGEDATE = new$DOCCHANGEDATE,
    UINCODE = new$UINCODE,
    DOCOSN = new$DOCOSN
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_10 (TR_FACIALFINCAPTION_AU_10)
-- Create 05.03.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$ProgIndex = 72) THEN                       /* Для сводных платежек*/
      IF (    (   (new$AcceptDate = :OLD.AcceptDate)
               OR ((new$AcceptDate IS NULL) AND (:OLD.AcceptDate IS NULL))
              )
          AND (   (new$Reject_CLS = :OLD.Reject_CLS)
               OR ((new$Reject_CLS IS NULL) AND (:OLD.Reject_CLS IS NULL))
              )
          AND (   (new$RejectCause = :OLD.RejectCause)
               OR ((new$RejectCause IS NULL) AND (:OLD.RejectCause IS NULL))
              )
          AND (   (new$TREASUARYDOCSTATECLS = :OLD.TREASUARYDOCSTATECLS)
               OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                   AND (:OLD.TREASUARYDOCSTATECLS IS NULL)
                  )
              )
          AND (   (new$DOCSTATEREF = :OLD.DOCSTATEREF)
               OR ((new$DOCSTATEREF IS NULL) AND (:OLD.DOCSTATEREF IS NULL))
              )
          AND (   (new$REESTR_REF = :OLD.REESTR_REF)
               OR ((new$REESTR_REF IS NULL) AND (:OLD.REESTR_REF IS NULL))
              )
          AND (new$SOURCEACCOUNT = :OLD.SOURCEACCOUNT)
          AND (new$DESTACCOUNT = :OLD.DESTACCOUNT)
         ) THEN
         NULL;                /*      new$AcceptDate := :old.AcceptDate;   */
      ELSE
         /* Если изменились ключевые атрибуты, сносим их во входящие в нее*/
         UPDATE TB_FacialFinCaption
            SET AcceptDate = new$AcceptDate,
                Reject_CLS = new$Reject_CLS,
                RejectCause = new$RejectCause,
                TREASUARYDOCSTATECLS = new$TREASUARYDOCSTATECLS,
                DOCSTATEREF = new$DOCSTATEREF,
                REESTR_REF = new$REESTR_REF,
                SOURCEACCOUNT = new$SOURCEACCOUNT,
                DESTACCOUNT = new$DESTACCOUNT
          WHERE IntegratedDocRef = new$ID;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- AU_300 (TR_FACIALFINCAPTION_AU_300)
-- Create 20.02.2006
-- Last update 11.04.2007
-- - - - - - - - - - - - -

  /* если поменялась дата принятия или бух операция или тип классификации, то сносим это в деталь */
  if ((new$AcceptDate <> :old.AcceptDate)or((new$AcceptDate is not null)and(:old.AcceptDate is null))
      or((new$AcceptDate is null)and(:old.AcceptDate is not null)))
  then
    update facialfindetail set
      AcceptDate = new$AcceptDate,
      RVersion = -1
    where
      RecordIndex = new$id;
  end if;

  if (new$BuhOperationCLS <> :old.BuhOperationCLS)  then
    update facialfindetail set
      BuhOperationCLS = new$BuhOperationCLS,
      RVersion = -1
    where
      RecordIndex = new$id;
  end if;

  if (new$ClsType <> :old.ClsType) then
    if (new$ClsType = 0) then
      update facialfindetail set
        SourceKD = 0,
        DestKD = 0,
        SourceIFS = 0,
        DestIFS = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;

    if (new$ClsType = 1) then
      update facialfindetail set
        SourceKD = 0,
        DestKD = 0,
        SourceKVSR = 0,
        SourceKFSR = 0,
        SourceKCSR = 0,
        SourceKVR = 0,
        SourceKESR = 0,
        DestKVSR = 0,
        DestKFSR = 0,
        DestKCSR = 0,
        DestKVR = 0,
        DestKESR = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;
    
    if (new$ClsType = 2) then
      update facialfindetail set
        SourceIFS = 0,
        DestIFS = 0,
        SourceKVSR = 0,
        SourceKFSR = 0,
        SourceKCSR = 0,
        SourceKVR = 0,
        SourceKESR = 0,
        DestKVSR = 0,
        DestKFSR = 0,
        DestKCSR = 0,
        DestKVR = 0,
        DestKESR = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;
    
  end if;

-- - - - - - - - - - - - -
-- AU_500 (TR_FACIALFINCAPTION_AU_500)
-- Create 28.04.2005
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (:NEW.ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (23, :OLD.ID, SYSDATE);

      DELETE FROM DelRecIndexes
        WHERE (TableID = 23) AND (RecordId = :NEW.ID);
   END IF;

END;
/
commit work 
/

-- #########################################################
-- #########################################################
-- Add_Signers.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет поле Signers*/
ALTER TABLE TB_FacialFinCaption ADD (
  Signers VARCHAR2(1000)
)
/

CREATE OR REPLACE VIEW FacialFinCaption (
  ID,
  DOCNUMBER,
  SOURCEDOCNUM,
  PAYDATE,
  ACCEPTDATE,
  DOCUMENTDATE,
  REESTRDATE,
  CREDIT,
  SOURCEACCOUNT,
  SOURCEFACIALACC_CLS,
  DESTACCOUNT,
  DESTFACIALACC_CLS,
  PROGINDEX,
  ARHIVEDOC,
  PAYSYMBOLCLS,
  PAYTYPECLS,
  NOTE,
  PERIOD,
  PAYPRIORITY,
  TYPEOPERATIONCLS,
  BUHPAYMENTCLS,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  BUDGETREF,
  RECORDINDEX,
  SENDERID,
  SENDERRECORDID,
  REESTR_REF,
  REJECT_CLS,
  REJECTCAUSE,
  CLIENTBANKNUMBER,
  CRYPTOSTATUS,
  TRUSTNUMBER,
  LINKEDDOCUMENT,
  BNKRECORDID,
  SUBPROGINDEX,
  DOCUMENTSTATE,
  USERSVISA,
  TREASUARYDOCSTATECLS,
  DEPARTMENTCLS,
  NDS,
  TAXNOTE,
  MANAGERBID,
  BIDNUMBER,
  GROUPID,
  GROUPSUMMA,
  DOCSTATEREF,
  LASTEXTRCHANGE,
  FAXDOCCOUNT,
  STIMATEID,
  INTEGRATEDDOCREF,
  REQUESTNUMBER,
  REQUESTDATE,
  RVERSION,
  FEDERALFUNDSREF,
  ELDOCREF,
  BUHOPERATIONCLS,
  CLSTYPE,
  OPERATIONDIRECTION,
  SOURCETYPE,
  DESTTYPE,
  CARDNUMBER,
  ISBLOCKED,
  BLOCKEDCAUSE,
  UNBLOCKEDDATE,
  UNBLOCKEDCAUSE,
  CASHIERPERSONALINFO,
  BIDDATE,
  CARDREF,
  SOURCESTOREDPAYMENTPROPS,
  DESTSTOREDPAYMENTPROPS,
  STOREDPAYMENTNOTE,
  DOCCHANGEDATE,
  UINCODE,
  DOCOSN,
  SIGNERS)
AS
  SELECT
    ID,
    DOCNUMBER,
    SOURCEDOCNUM,
    PAYDATE,
    ACCEPTDATE,
    DOCUMENTDATE,
    REESTRDATE,
    CREDIT,
    SOURCEACCOUNT,
    SOURCEFACIALACC_CLS,
    DESTACCOUNT,
    DESTFACIALACC_CLS,
    PROGINDEX,
    ARHIVEDOC,
    PAYSYMBOLCLS,
    PAYTYPECLS,
    NOTE,
    PERIOD,
    PAYPRIORITY,
    TYPEOPERATIONCLS,
    BUHPAYMENTCLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    RECORDINDEX,
    SENDERID,
    SENDERRECORDID,
    REESTR_REF,
    REJECT_CLS,
    REJECTCAUSE,
    CLIENTBANKNUMBER,
    CRYPTOSTATUS,
    TRUSTNUMBER,
    LINKEDDOCUMENT,
    BNKRECORDID,
    SUBPROGINDEX,
    DOCUMENTSTATE,
    USERSVISA,
    TREASUARYDOCSTATECLS,
    DEPARTMENTCLS,
    NDS,
    TAXNOTE,
    MANAGERBID,
    BIDNUMBER,
    GROUPID,
    GROUPSUMMA,
    DOCSTATEREF,
    LASTEXTRCHANGE,
    FAXDOCCOUNT,
    STIMATEID,
    INTEGRATEDDOCREF,
    REQUESTNUMBER,
    REQUESTDATE,
    RVERSION,
    FEDERALFUNDSREF,
    ELDOCREF,
    BUHOPERATIONCLS,
    CLSTYPE,
    OPERATIONDIRECTION,
    SOURCETYPE,
    DESTTYPE,
    CARDNUMBER,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO,
    BIDDATE,
    CARDREF,
    SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE,
    DOCCHANGEDATE,
    UINCODE,
    DOCOSN,
    SIGNERS
  FROM TB_FacialFinCaption
/

CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_ID
  INSTEAD OF DELETE
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  reestrAccepted1$ NUMBER(10);
  CNT$1 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_FACIALFINCAPTION_BD)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

 /*  Удалить детализацию распоряжения на финансирование */
  DELETE FROM FacialFinDetail
        WHERE (RecordIndex = :OLD.ID);

-- - - - - - - - - - - - -
-- BD_5 (TR_FACIALFINCAPTION_BD_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (((:old.progIndex = 63) or (:old.progIndex = 64) or
  (:old.progIndex = 68) or (:old.progIndex = 70))
  and (:old.REESTR_REF is not null)) then
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id = :old.REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrDelete');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BD_6 (TR_FACIALFINCAPTION_BD_6)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  SELECT COUNT(id ) INTO CNT$1
  from paydocexchange where ((paydocref=:old.id)and(status<>0)and(CodeFormat<>50)) AND (ROWNUM = 1);
  if ((CNT$1<> 0)) then
    RaiseException('ex_CannotChangeSended');
  END IF;

-- - - - - - - - - - - - -
-- BD_430 (TR_FACIALFINCAPTION_BD_430)
-- Create 04.12.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  /* При удалении ПП зануляем ссылку на него в факсах*/
  UPDATE FaxDocs
     SET OwnerID = NULL
  WHERE OwnerID = :OLD.ID;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_FACIALFINCAPTION
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_70 (TR_FACIALFINCAPTION_AD_70)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

-- При удалении п/п очищаем ссылающиеся поля у гарантии
  IF (:OLD.SubProgIndex = 416) THEN
    UPDATE Guarantee
       SET SubRecordIndex = NULL,
           SubProgIndex = 0
     WHERE SubRecordIndex = :OLD.ID;
  END IF;

-- - - - - - - - - - - - -
-- AD_200 (TR_FACIALFINCAPTION_AD_200)
-- Create 27.08.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  /* Удаление истории изменений состоний для удаленного документа*/
  delete from StateJumpHistory
    where DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_300 (TR_FACIALFINCAPTION_AD_300)
-- Create 24.02.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  IF (:OLD.FaxDocCount > 0) THEN
--    :old.FaxDocCount := :old.FaxDocCount;
    NULL;
  ELSE
    UPDATE FaxDocs
       SET OwnerID = NULL
     WHERE OwnerID = :OLD.ID;
  END IF;

-- - - - - - - - - - - - -
-- AD_500 (TR_FACIALFINCAPTION_AD_500)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate, ProgIndex, Summa)
    VALUES (23, :OLD.ID, SYSDATE, :OLD.ProgIndex, :OLD.Credit);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_II
  INSTEAD OF INSERT
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  new$ID FACIALFINCAPTION.ID%TYPE := :NEW.ID;
  new$DOCNUMBER FACIALFINCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SOURCEDOCNUM FACIALFINCAPTION.SOURCEDOCNUM%TYPE := :NEW.SOURCEDOCNUM;
  new$PAYDATE FACIALFINCAPTION.PAYDATE%TYPE := :NEW.PAYDATE;
  new$ACCEPTDATE FACIALFINCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$DOCUMENTDATE FACIALFINCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$REESTRDATE FACIALFINCAPTION.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$CREDIT FACIALFINCAPTION.CREDIT%TYPE := :NEW.CREDIT;
  new$SOURCEACCOUNT FACIALFINCAPTION.SOURCEACCOUNT%TYPE := :NEW.SOURCEACCOUNT;
  new$SOURCEFACIALACC_CLS FACIALFINCAPTION.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$DESTACCOUNT FACIALFINCAPTION.DESTACCOUNT%TYPE := :NEW.DESTACCOUNT;
  new$DESTFACIALACC_CLS FACIALFINCAPTION.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$PROGINDEX FACIALFINCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$ARHIVEDOC FACIALFINCAPTION.ARHIVEDOC%TYPE := :NEW.ARHIVEDOC;
  new$PAYSYMBOLCLS FACIALFINCAPTION.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$PAYTYPECLS FACIALFINCAPTION.PAYTYPECLS%TYPE := :NEW.PAYTYPECLS;
  new$NOTE FACIALFINCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$PERIOD FACIALFINCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$PAYPRIORITY FACIALFINCAPTION.PAYPRIORITY%TYPE := :NEW.PAYPRIORITY;
  new$TYPEOPERATIONCLS FACIALFINCAPTION.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$BUHPAYMENTCLS FACIALFINCAPTION.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$CREATERUSER FACIALFINCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF FACIALFINCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$RECORDINDEX FACIALFINCAPTION.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SENDERID FACIALFINCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REESTR_REF FACIALFINCAPTION.REESTR_REF%TYPE := :NEW.REESTR_REF;
  new$REJECT_CLS FACIALFINCAPTION.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE FACIALFINCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CLIENTBANKNUMBER FACIALFINCAPTION.CLIENTBANKNUMBER%TYPE := :NEW.CLIENTBANKNUMBER;
  new$CRYPTOSTATUS FACIALFINCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$TRUSTNUMBER FACIALFINCAPTION.TRUSTNUMBER%TYPE := :NEW.TRUSTNUMBER;
  new$LINKEDDOCUMENT FACIALFINCAPTION.LINKEDDOCUMENT%TYPE := :NEW.LINKEDDOCUMENT;
  new$BNKRECORDID FACIALFINCAPTION.BNKRECORDID%TYPE := :NEW.BNKRECORDID;
  new$SUBPROGINDEX FACIALFINCAPTION.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$DOCUMENTSTATE FACIALFINCAPTION.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA FACIALFINCAPTION.USERSVISA%TYPE := :NEW.USERSVISA;
  new$TREASUARYDOCSTATECLS FACIALFINCAPTION.TREASUARYDOCSTATECLS%TYPE := :NEW.TREASUARYDOCSTATECLS;
  new$DEPARTMENTCLS FACIALFINCAPTION.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$NDS FACIALFINCAPTION.NDS%TYPE := :NEW.NDS;
  new$TAXNOTE FACIALFINCAPTION.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$MANAGERBID FACIALFINCAPTION.MANAGERBID%TYPE := :NEW.MANAGERBID;
  new$BIDNUMBER FACIALFINCAPTION.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$GROUPID FACIALFINCAPTION.GROUPID%TYPE := :NEW.GROUPID;
  new$GROUPSUMMA FACIALFINCAPTION.GROUPSUMMA%TYPE := :NEW.GROUPSUMMA;
  new$DOCSTATEREF FACIALFINCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$LASTEXTRCHANGE FACIALFINCAPTION.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$FAXDOCCOUNT FACIALFINCAPTION.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$STIMATEID FACIALFINCAPTION.STIMATEID%TYPE := :NEW.STIMATEID;
  new$INTEGRATEDDOCREF FACIALFINCAPTION.INTEGRATEDDOCREF%TYPE := :NEW.INTEGRATEDDOCREF;
  new$REQUESTNUMBER FACIALFINCAPTION.REQUESTNUMBER%TYPE := :NEW.REQUESTNUMBER;
  new$REQUESTDATE FACIALFINCAPTION.REQUESTDATE%TYPE := :NEW.REQUESTDATE;
  new$RVERSION FACIALFINCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$FEDERALFUNDSREF FACIALFINCAPTION.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$ELDOCREF FACIALFINCAPTION.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$BUHOPERATIONCLS FACIALFINCAPTION.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CLSTYPE FACIALFINCAPTION.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$OPERATIONDIRECTION FACIALFINCAPTION.OPERATIONDIRECTION%TYPE := :NEW.OPERATIONDIRECTION;
  new$SOURCETYPE FACIALFINCAPTION.SOURCETYPE%TYPE := :NEW.SOURCETYPE;
  new$DESTTYPE FACIALFINCAPTION.DESTTYPE%TYPE := :NEW.DESTTYPE;
  new$CARDNUMBER FACIALFINCAPTION.CARDNUMBER%TYPE := :NEW.CARDNUMBER;
  new$ISBLOCKED FACIALFINCAPTION.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINCAPTION.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINCAPTION.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINCAPTION.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$CASHIERPERSONALINFO FACIALFINCAPTION.CASHIERPERSONALINFO%TYPE := :NEW.CASHIERPERSONALINFO;
  new$BIDDATE FACIALFINCAPTION.BIDDATE%TYPE := :NEW.BIDDATE;
  new$CARDREF FACIALFINCAPTION.CARDREF%TYPE := :NEW.CARDREF;
  new$SOURCESTOREDPAYMENTPROPS FACIALFINCAPTION.SOURCESTOREDPAYMENTPROPS%TYPE := :NEW.SOURCESTOREDPAYMENTPROPS;
  new$DESTSTOREDPAYMENTPROPS FACIALFINCAPTION.DESTSTOREDPAYMENTPROPS%TYPE := :NEW.DESTSTOREDPAYMENTPROPS;
  new$STOREDPAYMENTNOTE FACIALFINCAPTION.STOREDPAYMENTNOTE%TYPE := :NEW.STOREDPAYMENTNOTE;
  new$DOCCHANGEDATE FACIALFINCAPTION.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
  new$UINCODE FACIALFINCAPTION.UINCODE%TYPE := :NEW.UINCODE;
  new$DOCOSN FACIALFINCAPTION.DOCOSN%TYPE := :NEW.DOCOSN;
  new$SIGNERS FACIALFINCAPTION.SIGNERS%TYPE := :NEW.SIGNERS;
--
  UseFax$ NUMBER(10);
  pdt$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CmpFacialAcc_Cls1$ NUMBER(10);
  PIndex$ NUMBER(10);
  reestrAccepted1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FACIALFINCAPTION_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$credit is null)then 
    new$credit:= 0;
  END IF;
  if (new$ArhiveDoc is null) then 
    new$ArhiveDoc:= 0;
  END IF;
  if (new$PayTypeCls is null) then 
    new$PayTypeCls:= 0;
  END IF;
  if (new$BuhPaymentCls is null) then 
    new$BuhPaymentCls:= 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 0;
  END IF;
  if (new$SourceFacialAcc_CLS is null) then 
    new$SourceFacialAcc_CLS:= 0;
  END IF;
  if (new$DestFacialAcc_CLS is null) then 
    new$DestFacialAcc_CLS:= 0;
  END IF;
  if (new$FaxDocCount is null) then 
    new$FaxDocCount := 0;
  END IF;
  if (new$OperationDirection is null) then 
    new$OperationDirection := 0;
  END IF;
  if (new$OperationDirection = 0) then
    new$SourceType := 1;
    new$DestType := 1;
     
  else
    if (new$OperationDirection = 1) then
      new$SourceType := 1;
      new$DestType := -1;
         
    else
      if (new$OperationDirection = 2) then
        new$SourceType := -1;
        new$DestType := 1;
             
      else
        new$SourceType := -1;
        new$DestType := -1;
             
      END IF;
    END IF;
  END IF;
  if (new$DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber1$); 
    if (DocNumber1$ is null) then 
      new$DepartmentCls:= 0;
           
    else 
      new$DepartmentCls:= DocNumber1$;
       
    END IF;
  END IF;
   
  /* Заполнение Бюджета. Если пустой или ноль, берем из лицевого счета */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    PIndex$ := new$ProgIndex;
    if (PIndex$=60) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Приход средств от фин.органа*/
    END IF;
    if (PIndex$=61) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Приход средств от прочих и восстановление расходов*/
    END IF;
    if (PIndex$=62) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Приход средств по объявлениям*/
    END IF;
    if (PIndex$=63) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Уход средств по платежным поручениям*/
    END IF;
    if (PIndex$=64) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Уход средств по чекам*/
    END IF;
    if (PIndex$=65) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Переброска средств, Разассигновка*/
    END IF;
    if (PIndex$=66) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Внутренняя переброска средств, один - многим*/
    END IF;
    if (PIndex$=67) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Уход средств в районы*/
    END IF;
    if (PIndex$=68) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Перечисление на р\с районов*/
    END IF;
    if (PIndex$=69) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Подтверждение перечисления на р\с районов*/
    END IF;
    if (PIndex$=70) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Возврат с р\с районов*/
    END IF;
    if (PIndex$=71) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Подтверждение возврата с р\с районов*/
    END IF;
    if (PIndex$=73) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Учет кассовых выбытий*/
    END IF;
    if (PIndex$=75) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Утверждение ОФ*/
    END IF;
    if (PIndex$=76) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Распределение ОФ*/
    END IF;
    BEGIN

      select fa.BudgetRef      into new$BudgetRef from FacialAcc_Cls fa
      where fa.Id = CmpFacialAcc_Cls1$

      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$AcceptDate is not null) and (new$Reject_CLS is not null )) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_1 (TR_FACIALFINCAPTION_BI_1)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- Инициализация значений по-умолчанию для добавляемых полей на вставку
   IF (new$GroupID IS NULL) THEN new$GroupID := new$ID; END IF;
   IF (new$GroupSumma IS NULL) THEN new$GroupSumma := 0; END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_FACIALFINCAPTION_BI_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (((new$progIndex = 63) or (new$progIndex = 64) or
  (new$progIndex = 68) or (new$progIndex = 70))
  and (new$REESTR_REF is not null)) then
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id = new$REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrInsert');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_16 (TR_FACIALFINCAPTION_BI_16)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /*  Вставляется запись по новой схеме. Делаем сноску в FacialFinCaption
     даты и номера реестра из таблицы реестров по ссылке*/
   IF (new$Reestr_ref IS NULL) THEN
      new$SourceDocNum := '';
      new$ReestrDate := NULL;
   ELSE
      BEGIN
         SELECT ffr.ReestrNumber, ffr.ReestrDate
           INTO new$SourceDocNum, new$ReestrDate
           FROM FacialFinReestr ffr
          WHERE ffr.ID = new$Reestr_ref;
      EXCEPTION
         WHEN NO_DATA_FOUND THEN
            new$SourceDocNum := NULL;
            new$ReestrDate := NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BI_430 (TR_FACIALFINCAPTION_BI_430)
-- Create 04.12.2004
-- Last update 11.10.2006
-- - - - - - - - - - - - -

  IF (NEW$SenderID IS NOT NULL) THEN
    pdt$ := NULL;
    IF (NEW$progindex = 63) THEN pdt$ := 302; END IF;
    IF (NEW$progindex = 66) THEN pdt$ := 301; END IF;
    IF (NEW$progindex = 64) THEN pdt$ := 304; END IF;

    /*  Платежное поручение получено из УРМ */
    GetIntConst(30, 19, UseFax$);
    IF ((new$BidNumber IS NULL) AND (UseFax$ = 1)) THEN
      new$BidNumber := new$DocNumber;
    END IF;
    SELECT COUNT(*) INTO new$FaxDocCount
    FROM FaxDocs
      WHERE (OwnerDocNumber=new$BidNumber)
        AND (ClientID=new$SenderID)
        AND (FacialAcc_Cls=new$SourceFacialAcc_CLS)
        AND (OwnerDate = new$DocumentDate)
        AND (PrimaryDocType = PDT$);
  ELSE
    new$FaxDocCount := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_FACIALFINCAPTION_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$DocChangeDate := new$UpdateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_FACIALFINCAPTION (
    ID,
    DOCNUMBER,
    SOURCEDOCNUM,
    PAYDATE,
    ACCEPTDATE,
    DOCUMENTDATE,
    REESTRDATE,
    CREDIT,
    SOURCEACCOUNT,
    SOURCEFACIALACC_CLS,
    DESTACCOUNT,
    DESTFACIALACC_CLS,
    PROGINDEX,
    ARHIVEDOC,
    PAYSYMBOLCLS,
    PAYTYPECLS,
    NOTE,
    PERIOD,
    PAYPRIORITY,
    TYPEOPERATIONCLS,
    BUHPAYMENTCLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    RECORDINDEX,
    SENDERID,
    SENDERRECORDID,
    REESTR_REF,
    REJECT_CLS,
    REJECTCAUSE,
    CLIENTBANKNUMBER,
    CRYPTOSTATUS,
    TRUSTNUMBER,
    LINKEDDOCUMENT,
    BNKRECORDID,
    SUBPROGINDEX,
    DOCUMENTSTATE,
    USERSVISA,
    TREASUARYDOCSTATECLS,
    DEPARTMENTCLS,
    NDS,
    TAXNOTE,
    MANAGERBID,
    BIDNUMBER,
    GROUPID,
    GROUPSUMMA,
    DOCSTATEREF,
    LASTEXTRCHANGE,
    FAXDOCCOUNT,
    STIMATEID,
    INTEGRATEDDOCREF,
    REQUESTNUMBER,
    REQUESTDATE,
    RVERSION,
    FEDERALFUNDSREF,
    ELDOCREF,
    BUHOPERATIONCLS,
    CLSTYPE,
    OPERATIONDIRECTION,
    SOURCETYPE,
    DESTTYPE,
    CARDNUMBER,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO,
    BIDDATE,
    CARDREF,
    SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE,
    DOCCHANGEDATE,
    UINCODE,
    DOCOSN,
    SIGNERS
  ) VALUES (
    new$ID,
    new$DOCNUMBER,
    new$SOURCEDOCNUM,
    new$PAYDATE,
    new$ACCEPTDATE,
    new$DOCUMENTDATE,
    new$REESTRDATE,
    new$CREDIT,
    new$SOURCEACCOUNT,
    new$SOURCEFACIALACC_CLS,
    new$DESTACCOUNT,
    new$DESTFACIALACC_CLS,
    new$PROGINDEX,
    new$ARHIVEDOC,
    new$PAYSYMBOLCLS,
    new$PAYTYPECLS,
    new$NOTE,
    new$PERIOD,
    new$PAYPRIORITY,
    new$TYPEOPERATIONCLS,
    new$BUHPAYMENTCLS,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$RECORDINDEX,
    new$SENDERID,
    new$SENDERRECORDID,
    new$REESTR_REF,
    new$REJECT_CLS,
    new$REJECTCAUSE,
    new$CLIENTBANKNUMBER,
    new$CRYPTOSTATUS,
    new$TRUSTNUMBER,
    new$LINKEDDOCUMENT,
    new$BNKRECORDID,
    new$SUBPROGINDEX,
    new$DOCUMENTSTATE,
    new$USERSVISA,
    new$TREASUARYDOCSTATECLS,
    new$DEPARTMENTCLS,
    new$NDS,
    new$TAXNOTE,
    new$MANAGERBID,
    new$BIDNUMBER,
    new$GROUPID,
    new$GROUPSUMMA,
    new$DOCSTATEREF,
    new$LASTEXTRCHANGE,
    new$FAXDOCCOUNT,
    new$STIMATEID,
    new$INTEGRATEDDOCREF,
    new$REQUESTNUMBER,
    new$REQUESTDATE,
    new$RVERSION,
    new$FEDERALFUNDSREF,
    new$ELDOCREF,
    new$BUHOPERATIONCLS,
    new$CLSTYPE,
    new$OPERATIONDIRECTION,
    new$SOURCETYPE,
    new$DESTTYPE,
    new$CARDNUMBER,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$CASHIERPERSONALINFO,
    new$BIDDATE,
    new$CARDREF,
    new$SOURCESTOREDPAYMENTPROPS,
    new$DESTSTOREDPAYMENTPROPS,
    new$STOREDPAYMENTNOTE,
    new$DOCCHANGEDATE,
    new$UINCODE,
    new$DOCOSN,
    new$SIGNERS);

-- - - - - - - - - - - - -
-- AI_430 (TR_FACIALFINCAPTION_AI_430)
-- Create 04.12.2004
-- Last update 11.10.2006
-- - - - - - - - - - - - -

  IF (new$SenderID IS NOT NULL) THEN
      /*  Платежное поручение получено из УРМ */
      pdt$ := NULL;
      IF (new$progindex = 63) THEN pdt$ := 302; END IF;
      IF (new$progindex = 66) THEN pdt$ := 301; END IF;
      IF (new$progindex = 64) THEN pdt$ := 304; END IF;

        UPDATE FaxDocs
            SET OwnerId=new$id
        WHERE
            (OwnerDocNumber=new$BidNumber)
            AND (ClientID=new$SenderID)
            AND (FacialAcc_Cls=new$SourceFacialAcc_CLS)
            AND (OwnerDate = new$DocumentDate)
            AND (primarydoctype = pdt$);
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_FACIALFINCAPTION_AI_500)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
     WHERE (TableID = 23) AND (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_IU
  INSTEAD OF UPDATE
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  new$ID FACIALFINCAPTION.ID%TYPE := :NEW.ID;
  new$DOCNUMBER FACIALFINCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SOURCEDOCNUM FACIALFINCAPTION.SOURCEDOCNUM%TYPE := :NEW.SOURCEDOCNUM;
  new$PAYDATE FACIALFINCAPTION.PAYDATE%TYPE := :NEW.PAYDATE;
  new$ACCEPTDATE FACIALFINCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$DOCUMENTDATE FACIALFINCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$REESTRDATE FACIALFINCAPTION.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$CREDIT FACIALFINCAPTION.CREDIT%TYPE := :NEW.CREDIT;
  new$SOURCEACCOUNT FACIALFINCAPTION.SOURCEACCOUNT%TYPE := :NEW.SOURCEACCOUNT;
  new$SOURCEFACIALACC_CLS FACIALFINCAPTION.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$DESTACCOUNT FACIALFINCAPTION.DESTACCOUNT%TYPE := :NEW.DESTACCOUNT;
  new$DESTFACIALACC_CLS FACIALFINCAPTION.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$PROGINDEX FACIALFINCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$ARHIVEDOC FACIALFINCAPTION.ARHIVEDOC%TYPE := :NEW.ARHIVEDOC;
  new$PAYSYMBOLCLS FACIALFINCAPTION.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$PAYTYPECLS FACIALFINCAPTION.PAYTYPECLS%TYPE := :NEW.PAYTYPECLS;
  new$NOTE FACIALFINCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$PERIOD FACIALFINCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$PAYPRIORITY FACIALFINCAPTION.PAYPRIORITY%TYPE := :NEW.PAYPRIORITY;
  new$TYPEOPERATIONCLS FACIALFINCAPTION.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$BUHPAYMENTCLS FACIALFINCAPTION.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$CREATERUSER FACIALFINCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF FACIALFINCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$RECORDINDEX FACIALFINCAPTION.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SENDERID FACIALFINCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REESTR_REF FACIALFINCAPTION.REESTR_REF%TYPE := :NEW.REESTR_REF;
  new$REJECT_CLS FACIALFINCAPTION.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE FACIALFINCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CLIENTBANKNUMBER FACIALFINCAPTION.CLIENTBANKNUMBER%TYPE := :NEW.CLIENTBANKNUMBER;
  new$CRYPTOSTATUS FACIALFINCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$TRUSTNUMBER FACIALFINCAPTION.TRUSTNUMBER%TYPE := :NEW.TRUSTNUMBER;
  new$LINKEDDOCUMENT FACIALFINCAPTION.LINKEDDOCUMENT%TYPE := :NEW.LINKEDDOCUMENT;
  new$BNKRECORDID FACIALFINCAPTION.BNKRECORDID%TYPE := :NEW.BNKRECORDID;
  new$SUBPROGINDEX FACIALFINCAPTION.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$DOCUMENTSTATE FACIALFINCAPTION.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA FACIALFINCAPTION.USERSVISA%TYPE := :NEW.USERSVISA;
  new$TREASUARYDOCSTATECLS FACIALFINCAPTION.TREASUARYDOCSTATECLS%TYPE := :NEW.TREASUARYDOCSTATECLS;
  new$DEPARTMENTCLS FACIALFINCAPTION.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$NDS FACIALFINCAPTION.NDS%TYPE := :NEW.NDS;
  new$TAXNOTE FACIALFINCAPTION.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$MANAGERBID FACIALFINCAPTION.MANAGERBID%TYPE := :NEW.MANAGERBID;
  new$BIDNUMBER FACIALFINCAPTION.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$GROUPID FACIALFINCAPTION.GROUPID%TYPE := :NEW.GROUPID;
  new$GROUPSUMMA FACIALFINCAPTION.GROUPSUMMA%TYPE := :NEW.GROUPSUMMA;
  new$DOCSTATEREF FACIALFINCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$LASTEXTRCHANGE FACIALFINCAPTION.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$FAXDOCCOUNT FACIALFINCAPTION.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$STIMATEID FACIALFINCAPTION.STIMATEID%TYPE := :NEW.STIMATEID;
  new$INTEGRATEDDOCREF FACIALFINCAPTION.INTEGRATEDDOCREF%TYPE := :NEW.INTEGRATEDDOCREF;
  new$REQUESTNUMBER FACIALFINCAPTION.REQUESTNUMBER%TYPE := :NEW.REQUESTNUMBER;
  new$REQUESTDATE FACIALFINCAPTION.REQUESTDATE%TYPE := :NEW.REQUESTDATE;
  new$RVERSION FACIALFINCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$FEDERALFUNDSREF FACIALFINCAPTION.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$ELDOCREF FACIALFINCAPTION.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$BUHOPERATIONCLS FACIALFINCAPTION.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CLSTYPE FACIALFINCAPTION.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$OPERATIONDIRECTION FACIALFINCAPTION.OPERATIONDIRECTION%TYPE := :NEW.OPERATIONDIRECTION;
  new$SOURCETYPE FACIALFINCAPTION.SOURCETYPE%TYPE := :NEW.SOURCETYPE;
  new$DESTTYPE FACIALFINCAPTION.DESTTYPE%TYPE := :NEW.DESTTYPE;
  new$CARDNUMBER FACIALFINCAPTION.CARDNUMBER%TYPE := :NEW.CARDNUMBER;
  new$ISBLOCKED FACIALFINCAPTION.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINCAPTION.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINCAPTION.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINCAPTION.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$CASHIERPERSONALINFO FACIALFINCAPTION.CASHIERPERSONALINFO%TYPE := :NEW.CASHIERPERSONALINFO;
  new$BIDDATE FACIALFINCAPTION.BIDDATE%TYPE := :NEW.BIDDATE;
  new$CARDREF FACIALFINCAPTION.CARDREF%TYPE := :NEW.CARDREF;
  new$SOURCESTOREDPAYMENTPROPS FACIALFINCAPTION.SOURCESTOREDPAYMENTPROPS%TYPE := :NEW.SOURCESTOREDPAYMENTPROPS;
  new$DESTSTOREDPAYMENTPROPS FACIALFINCAPTION.DESTSTOREDPAYMENTPROPS%TYPE := :NEW.DESTSTOREDPAYMENTPROPS;
  new$STOREDPAYMENTNOTE FACIALFINCAPTION.STOREDPAYMENTNOTE%TYPE := :NEW.STOREDPAYMENTNOTE;
  new$DOCCHANGEDATE FACIALFINCAPTION.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
  new$UINCODE FACIALFINCAPTION.UINCODE%TYPE := :NEW.UINCODE;
  new$DOCOSN FACIALFINCAPTION.DOCOSN%TYPE := :NEW.DOCOSN;
  new$SIGNERS FACIALFINCAPTION.SIGNERS%TYPE := :NEW.SIGNERS;
--
  SourceFacialAcc_CLS$ NUMBER(10);
  DestFacialAcc_CLS$ NUMBER(10);
  UseFax1$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  DetCount1$ NUMBER(10);
  CNT$1 NUMBER(10);
  reestrAccepted1$ NUMBER(10);
  IsReject1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_FACIALFINCAPTION_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$SenderID is not null) then 
    /* Платежное поручение получено из УРМ */
    GetIntConst(30, 19,UseFax1$);
    if ((new$BidNumber is null) and (UseFax1$ = 1)) then 
      new$BidNumber:= new$DocNumber;
      
    END IF;
  END IF;
  if (new$credit is null)then 
    new$credit:= 0;
  END IF;
  if (new$ArhiveDoc is null) then 
    new$ArhiveDoc:= 0;
  END IF;
  if (new$PayTypeCls is null) then 
    new$PayTypeCls:= 0;
  END IF;
  if (new$BuhPaymentCls is null) then 
    new$BuhPaymentCls:= 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 0;
  END IF;
  if (new$SourceFacialAcc_CLS is null) then 
    new$SourceFacialAcc_CLS:= 0;
  END IF;
  if (new$DestFacialAcc_CLS is null) then 
    new$DestFacialAcc_CLS:= 0;
  END IF;
  if (new$FaxDocCount is null) then 
    new$FaxDocCount := 0;
  END IF;
  if (new$OperationDirection is null) then 
    new$OperationDirection := 0;
  END IF;
  if (new$OperationDirection <> :old.OperationDirection) then
    if (new$OperationDirection = 0) then
      new$SourceType := 1;
      new$DestType := 1;
          
    else
      if (new$OperationDirection = 1) then
        new$SourceType := 1;
        new$DestType := -1;
              
      else
        if (new$OperationDirection = 2) then
          new$SourceType := -1;
          new$DestType := 1;
                  
        else
          new$SourceType := -1;
          new$DestType := -1;
                  
        END IF;
      END IF;  
    END IF;
  END IF;
  if (new$DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber1$); 
    if (DocNumber1$ is null) then 
      new$DepartmentCls:= 0;
          
    else 
      new$DepartmentCls:= DocNumber1$;
      
    END IF;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      select count(ID)       into DetCount1$ from FacialFinDetail where RecordIndex = :old.ID
      ;
      if (DetCount1$ > 0) then 
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$AcceptDate is not null) and (new$Reject_Cls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_FACIALFINCAPTION_BU_1)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- Инициализация значений по-умолчанию для добавляемых полей на изменение
   IF (new$GroupID IS NULL) THEN new$GroupID := new$ID; END IF;
   IF (new$GroupSumma IS NULL) THEN new$GroupSumma := 0; END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_FACIALFINCAPTION_BU_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (not (    ((new$progindex = 63) or (new$progindex = 64) or (new$progindex = 68) or (new$progindex = 70))
  and (   (((new$credit - :old.credit)>0.001)or((new$credit - :old.credit)<-0.001))
  or (new$sourcefacialacc_cls <> :old.sourcefacialacc_cls)
  or (
  ((new$sourceaccount is null) and (:old.sourceaccount is not null)) or
  ((new$sourceaccount is not null) and (:old.sourceaccount is null)) or
  ((new$sourceaccount <> :old.sourceaccount ) and (:old.sourceaccount is not null) and (new$sourceaccount is not null))                                             
  )
  or (
  ((new$destaccount is null) and (:old.destaccount is not null)) or
  ((new$destaccount is not null) and (:old.destaccount is null)) or
  ((new$destaccount <> :old.destaccount ) and (:old.destaccount is not null) and (new$destaccount is not null))
  )
  or (    (:old.reestr_ref is null)
  and (new$reestr_ref is not null)
  )
  or (    (:old.reestr_ref is not null)
  and (new$reestr_ref is null)
  )
  or (:old.reestr_ref <> new$reestr_ref)
  )
  )
  )
  then /* для корректной обработки неопределенности с NULL полями*/
    reestrAccepted1$ := 0;  /* заглушка для IB 4.2 */
      
  else 
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id=new$REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrUpdate');
    END IF;
    BEGIN

      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where
      id=:old.REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrUpdate');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_6 (TR_FACIALFINCAPTION_BU_6)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:old.ProgIndex in(63,68,70)) then /* только для исходящих платежек*/
    SELECT COUNT(id ) INTO CNT$1
    from paydocexchange where ((paydocref=:old.id)and(status<>0)and(CodeFormat<>50)) AND (ROWNUM = 1);
    if ((CNT$1<> 0)) then
      if(/* (new.DOCNUMBER<>old.DOCNUMBER) or ((new.DOCNUMBER is NULL)and(not old.DOCNUMBER is NULL)) or ((old.DOCNUMBER is NULL)and(not new.DOCNUMBER is NULL)) or*/
      (new$SOURCEDOCNUM<>:old.SOURCEDOCNUM) or ((new$SOURCEDOCNUM is NULL)and(not :old.SOURCEDOCNUM is NULL)) or ((:old.SOURCEDOCNUM is NULL)and(not new$SOURCEDOCNUM is NULL)) or
      (new$PAYDATE<>:old.PAYDATE) or ((new$PAYDATE is NULL)and(not :old.PAYDATE is NULL)) or ((:old.PAYDATE is NULL)and(not new$PAYDATE is NULL))or
      /* (new.DOCUMENTDATE<>old.DOCUMENTDATE) or ((new.DOCUMENTDATE is NULL)and(not old.DOCUMENTDATE is NULL)) or ((old.DOCUMENTDATE is NULL)and(not new.DOCUMENTDATE is NULL))or*/
      (new$REESTRDATE<>:old.REESTRDATE) or ((new$REESTRDATE is NULL)and(not :old.REESTRDATE is NULL)) or ((:old.REESTRDATE is NULL)and(not new$REESTRDATE is NULL))or
      (((new$credit - :old.credit)>0.001)or((new$credit - :old.credit)<-0.001)) or
      (new$SOURCEACCOUNT<>:old.SOURCEACCOUNT) or
      (new$DESTACCOUNT<>:old.DESTACCOUNT) or
      (new$PAYTYPECLS<>:old.PAYTYPECLS) or
      (new$NOTE<>:old.NOTE) or  ((new$NOTE is NULL)and(not :old.NOTE is NULL)) or ((:old.NOTE is NULL)and(not new$NOTE is NULL))or
      (new$PAYPRIORITY<>:old.PAYPRIORITY) or ((new$PAYPRIORITY is NULL)and(not :old.PAYPRIORITY is NULL)) or ((:old.PAYPRIORITY is NULL)and(not new$PAYPRIORITY is NULL))or
      (new$REESTR_REF<>:old.REESTR_REF) or ((new$REESTR_REF is NULL)and(not :old.REESTR_REF is NULL)) or ((:old.REESTR_REF is NULL)and(not new$REESTR_REF is NULL))or
      (new$NDS<>:old.NDS) or ((new$NDS is NULL)and(not :old.NDS is NULL)) or ((:old.NDS is NULL)and(not new$NDS is NULL))or
      (new$TAXNOTE<>:old.TAXNOTE) or ((new$TAXNOTE is NULL)and(not :old.TAXNOTE is NULL)) or ((:old.TAXNOTE is NULL)and(not new$TAXNOTE is NULL)) )then
        RaiseException('ex_CannotChangeSended');
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_FACIALFINCAPTION_BU_10)
-- Create 16.03.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$IntegratedDocRef IS NOT NULL) THEN
        /* Если документ входит в сводный и у него изменились ключевые аттрибуты, то нельзя их менять если они отличаются
      /* от атрибутов родительского документа*/
      IF (    (   (new$AcceptDate = :OLD.AcceptDate)
               OR ((new$AcceptDate IS NULL) AND (:OLD.AcceptDate IS NULL))
              )
          AND (   (new$Reject_CLS = :OLD.Reject_CLS)
               OR ((new$Reject_CLS IS NULL) AND (:OLD.Reject_CLS IS NULL))
              )
          AND (   (new$RejectCause = :OLD.RejectCause)
               OR ((new$RejectCause IS NULL) AND (:OLD.RejectCause IS NULL))
              )
          AND (   (new$TREASUARYDOCSTATECLS = :OLD.TREASUARYDOCSTATECLS)
               OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                   AND (:OLD.TREASUARYDOCSTATECLS IS NULL)
                  )
              )
          AND (   (new$DOCSTATEREF = :OLD.DOCSTATEREF)
               OR ((new$DOCSTATEREF IS NULL) AND (:OLD.DOCSTATEREF IS NULL))
              )
          AND (   (new$REESTR_REF = :OLD.REESTR_REF)
               OR ((new$REESTR_REF IS NULL) AND (:OLD.REESTR_REF IS NULL))
              )
          AND (new$SOURCEACCOUNT = :OLD.SOURCEACCOUNT)
          AND (new$DESTACCOUNT = :OLD.DESTACCOUNT)
         ) THEN
         new$AcceptDate := :OLD.AcceptDate;
      ELSE
         FOR R$ IN (SELECT fc.AcceptDate, fc.Reject_CLS, fc.RejectCause,
                           fc.TREASUARYDOCSTATECLS, fc.DOCSTATEREF,
                           fc.REESTR_REF, fc.SOURCEACCOUNT, fc.DESTACCOUNT
                      FROM FacialFinCaption fc
                     WHERE (fc.ID = :NEW.IntegratedDocRef)) LOOP
            IF (    (   (new$AcceptDate = R$.AcceptDate)
                     OR ((new$AcceptDate IS NULL) AND (R$.AcceptDate IS NULL)
                        )
                    )
                AND (   (new$Reject_CLS = R$.Reject_CLS)
                     OR ((new$Reject_CLS IS NULL) AND (R$.Reject_CLS IS NULL)
                        )
                    )
                AND (   (new$RejectCause = R$.RejectCause)
                     OR (    (new$RejectCause IS NULL)
                         AND (R$.RejectCause IS NULL)
                        )
                    )
                AND (   (new$TREASUARYDOCSTATECLS = R$.TREASUARYDOCSTATECLS)
                     OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                         AND (R$.TREASUARYDOCSTATECLS IS NULL)
                        )
                    )
                AND (   (new$DOCSTATEREF = R$.DOCSTATEREF)
                     OR (    (new$DOCSTATEREF IS NULL)
                         AND (R$.DOCSTATEREF IS NULL)
                        )
                    )
                AND (   (new$REESTR_REF = R$.REESTR_REF)
                     OR ((new$REESTR_REF IS NULL) AND (R$.REESTR_REF IS NULL)
                        )
                    )
                AND (new$SOURCEACCOUNT = R$.SOURCEACCOUNT)
                AND (new$DESTACCOUNT = R$.DESTACCOUNT)
               ) THEN
               new$AcceptDate := R$.AcceptDate;
            ELSE
               RaiseException ('EX_CANNOTUPDATECHILDDOC');
            END IF;
         END LOOP;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_32 (TR_FACIALFINCAPTION_BU_32)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$Reestr_ref IS NULL)    /* Чтобы не вызывать select чаще, чем нужно*/
                              THEN
      new$SourceDocNum := '';
      new$ReestrDate := NULL;
   ELSIF (    (new$Reestr_ref = :OLD.Reestr_ref)
          AND (new$SourceDocNum = :OLD.SourceDocNum)
          AND (new$ReestrDate = :OLD.ReestrDate)
         ) THEN
/* нужно для корректной обработки неопределенности со сравнением нуловых полей */
      NULL;
   ELSE
      BEGIN
         SELECT ffr.ReestrNumber, ffr.ReestrDate
           INTO new$SourceDocNum, new$ReestrDate
           FROM FacialFinReestr ffr
          WHERE ffr.ID = new$Reestr_ref;
      EXCEPTION
         WHEN NO_DATA_FOUND THEN
            new$SourceDocNum := NULL;
            new$ReestrDate := NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BU_60 (T_FACIALFINCAPTION_BU_60)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF ((new$progindex = 60) AND (new$Credit <> :OLD.Credit)) THEN
      UPDATE FacialFinDetail
         SET Credit = new$Credit
       WHERE (RecordIndex = new$ID);
   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_FACIALFINCAPTION_BU_70)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- При проведении реестра устанавливаем дату принятия у записи гарантии
   IF (new$SubProgIndex = 416) THEN
      UPDATE Guarantee
         SET AcceptDate = new$AcceptDate
       WHERE SubRecordIndex = new$ID;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (T_FACIALFINCAPTION_BU_100)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /* Триггер изменения данных, записи по финансированию */
   IF (    (   (:OLD.SourceFacialAcc_CLS <> new$SourceFacialAcc_CLS)
            OR (:OLD.DestFacialAcc_CLS <> new$DestFacialAcc_CLS)
           )
       AND ((new$SubProgIndex <> 1) OR (new$SubProgIndex IS NULL))
      ) THEN
      FOR R$ IN (SELECT ID, SourceFacialAcc_CLS, DestFacialAcc_CLS
                   FROM FacialFinDetail
                  WHERE RecordIndex = new$ID) LOOP
         IF (NOT (new$SourceFacialAcc_CLS = 0)) THEN
            SourceFacialAcc_CLS$ := new$SourceFacialAcc_CLS;
         ELSE
            SourceFacialAcc_CLS$ := R$.SourceFacialAcc_CLS;
         END IF;

         IF (NOT (new$DestFacialAcc_CLS = 0)) THEN
            DestFacialAcc_CLS$ := new$DestFacialAcc_CLS;
         ELSE
            DestFacialAcc_CLS$ := R$.DestFacialAcc_CLS;
         END IF;

         IF (:OLD.SourceFacialAcc_CLS <> new$SourceFacialAcc_CLS) THEN
            UPDATE FacialFinDetail
               SET SourceFacialAcc_CLS = SourceFacialAcc_CLS$,
                   RVersion = -1
             WHERE (ID = R$.ID);
         END IF;

         IF (:OLD.DestFacialAcc_CLS <> new$DestFacialAcc_CLS) THEN
            UPDATE FacialFinDetail
               SET DestFacialAcc_CLS = DestFacialAcc_CLS$,
                   RVersion = -1
             WHERE (ID = R$.ID);
         END IF;
      END LOOP;
   END IF;

   /* Если изменились поля блокировки/разблокировки средств, полученных
     от предпринимательской деятельности сносим их в деталь.*/
  IF (((NEW$IsBlocked <> :OLD.IsBlocked) OR
      ((NEW$IsBlocked IS NULL) AND (:OLD.IsBlocked IS NOT NULL)) OR
      ((NEW$IsBlocked IS NOT NULL) AND (:OLD.IsBlocked IS NULL))
     ) OR
     ((NEW$BlockedCause <> :OLD.BlockedCause) OR
      ((NEW$BlockedCause IS NULL) AND (:OLD.BlockedCause IS NOT NULL)) OR
      ((NEW$BlockedCause IS NOT NULL) AND (:OLD.BlockedCause IS NULL))
     ) OR
     ((NEW$UnBlockedDate <> :OLD.UnBlockedDate) OR
      ((NEW$UnBlockedDate IS NULL) AND (:OLD.UnBlockedDate IS NOT NULL)) OR
      ((NEW$UnBlockedDate IS NOT NULL) AND (:OLD.UnBlockedDate IS NULL))
     ) OR
     ((NEW$UnBlockedCause <> :OLD.UnBlockedCause) OR
      ((NEW$UnBlockedDate IS NULL) AND (:OLD.UnBlockedCause IS NOT NULL)) OR
      ((NEW$UnBlockedCause IS NOT NULL) AND (:OLD.UnBlockedCause IS NULL))
     )) THEN
     UPDATE FacialFinDetail ffd
     SET ffd.IsBlocked = NEW$IsBlocked, ffd.BlockedCause = NEW$BlockedCause,
         ffd.UnBlockedDate = NEW$UnBlockedDate, ffd.UnBlockedCause = NEW$UnBlockedCause
     WHERE ffd.recordindex = NEW$ID;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_FACIALFINCAPTION_BU_210)
-- Create 27.08.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /* Сохранение в базу истории изменений состояний*/
   IF (new$DOCSTATEREF <> :OLD.DOCSTATEREF) THEN
      INSERT INTO StateJumpHistory
                  (DocID, BeginStateRef, EndStateRef
                  )
           VALUES (new$ID, :OLD.DOCSTATEREF, new$DOCSTATEREF
                  );
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (T_FACIALFINCAPTION_BU_300)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IsReject1$ := -1;
  if ((:old.Reject_CLS is null)and(new$Reject_CLS is not null)) then
    IsReject1$ := 1;
      
  else
    if ((:old.Reject_CLS is not null)and(new$Reject_CLS is null)) then
      IsReject1$ := 0;
    END IF;
  END IF;
  if (IsReject1$  <> -1) then
    update LinkRecords set
    IsRejected = IsReject1$

    where
    ChildID = new$ID;
    update LinkRecords set
    IsRejected = IsReject1$

    where
    ChildID in (select d.id from FacialFinDetail d where d.RecordIndex = new$id);
      
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_FACIALFINCAPTION_BU_700)
-- Create 17.09.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_FACIALFINCAPTION SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    SOURCEDOCNUM = new$SOURCEDOCNUM,
    PAYDATE = new$PAYDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    DOCUMENTDATE = new$DOCUMENTDATE,
    REESTRDATE = new$REESTRDATE,
    CREDIT = new$CREDIT,
    SOURCEACCOUNT = new$SOURCEACCOUNT,
    SOURCEFACIALACC_CLS = new$SOURCEFACIALACC_CLS,
    DESTACCOUNT = new$DESTACCOUNT,
    DESTFACIALACC_CLS = new$DESTFACIALACC_CLS,
    PROGINDEX = new$PROGINDEX,
    ARHIVEDOC = new$ARHIVEDOC,
    PAYSYMBOLCLS = new$PAYSYMBOLCLS,
    PAYTYPECLS = new$PAYTYPECLS,
    NOTE = new$NOTE,
    PERIOD = new$PERIOD,
    PAYPRIORITY = new$PAYPRIORITY,
    TYPEOPERATIONCLS = new$TYPEOPERATIONCLS,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    RECORDINDEX = new$RECORDINDEX,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    REESTR_REF = new$REESTR_REF,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CLIENTBANKNUMBER = new$CLIENTBANKNUMBER,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    TRUSTNUMBER = new$TRUSTNUMBER,
    LINKEDDOCUMENT = new$LINKEDDOCUMENT,
    BNKRECORDID = new$BNKRECORDID,
    SUBPROGINDEX = new$SUBPROGINDEX,
    DOCUMENTSTATE = new$DOCUMENTSTATE,
    USERSVISA = new$USERSVISA,
    TREASUARYDOCSTATECLS = new$TREASUARYDOCSTATECLS,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    NDS = new$NDS,
    TAXNOTE = new$TAXNOTE,
    MANAGERBID = new$MANAGERBID,
    BIDNUMBER = new$BIDNUMBER,
    GROUPID = new$GROUPID,
    GROUPSUMMA = new$GROUPSUMMA,
    DOCSTATEREF = new$DOCSTATEREF,
    LASTEXTRCHANGE = new$LASTEXTRCHANGE,
    FAXDOCCOUNT = new$FAXDOCCOUNT,
    STIMATEID = new$STIMATEID,
    INTEGRATEDDOCREF = new$INTEGRATEDDOCREF,
    REQUESTNUMBER = new$REQUESTNUMBER,
    REQUESTDATE = new$REQUESTDATE,
    RVERSION = new$RVERSION,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    ELDOCREF = new$ELDOCREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    CLSTYPE = new$CLSTYPE,
    OPERATIONDIRECTION = new$OPERATIONDIRECTION,
    SOURCETYPE = new$SOURCETYPE,
    DESTTYPE = new$DESTTYPE,
    CARDNUMBER = new$CARDNUMBER,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO = new$CASHIERPERSONALINFO,
    BIDDATE = new$BIDDATE,
    CARDREF = new$CARDREF,
    SOURCESTOREDPAYMENTPROPS = new$SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS = new$DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE = new$STOREDPAYMENTNOTE,
    DOCCHANGEDATE = new$DOCCHANGEDATE,
    UINCODE = new$UINCODE,
    DOCOSN = new$DOCOSN,
    SIGNERS = new$SIGNERS
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_10 (TR_FACIALFINCAPTION_AU_10)
-- Create 05.03.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$ProgIndex = 72) THEN                       /* Для сводных платежек*/
      IF (    (   (new$AcceptDate = :OLD.AcceptDate)
               OR ((new$AcceptDate IS NULL) AND (:OLD.AcceptDate IS NULL))
              )
          AND (   (new$Reject_CLS = :OLD.Reject_CLS)
               OR ((new$Reject_CLS IS NULL) AND (:OLD.Reject_CLS IS NULL))
              )
          AND (   (new$RejectCause = :OLD.RejectCause)
               OR ((new$RejectCause IS NULL) AND (:OLD.RejectCause IS NULL))
              )
          AND (   (new$TREASUARYDOCSTATECLS = :OLD.TREASUARYDOCSTATECLS)
               OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                   AND (:OLD.TREASUARYDOCSTATECLS IS NULL)
                  )
              )
          AND (   (new$DOCSTATEREF = :OLD.DOCSTATEREF)
               OR ((new$DOCSTATEREF IS NULL) AND (:OLD.DOCSTATEREF IS NULL))
              )
          AND (   (new$REESTR_REF = :OLD.REESTR_REF)
               OR ((new$REESTR_REF IS NULL) AND (:OLD.REESTR_REF IS NULL))
              )
          AND (new$SOURCEACCOUNT = :OLD.SOURCEACCOUNT)
          AND (new$DESTACCOUNT = :OLD.DESTACCOUNT)
         ) THEN
         NULL;                /*      new$AcceptDate := :old.AcceptDate;   */
      ELSE
         /* Если изменились ключевые атрибуты, сносим их во входящие в нее*/
         UPDATE TB_FacialFinCaption
            SET AcceptDate = new$AcceptDate,
                Reject_CLS = new$Reject_CLS,
                RejectCause = new$RejectCause,
                TREASUARYDOCSTATECLS = new$TREASUARYDOCSTATECLS,
                DOCSTATEREF = new$DOCSTATEREF,
                REESTR_REF = new$REESTR_REF,
                SOURCEACCOUNT = new$SOURCEACCOUNT,
                DESTACCOUNT = new$DESTACCOUNT
          WHERE IntegratedDocRef = new$ID;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- AU_300 (TR_FACIALFINCAPTION_AU_300)
-- Create 20.02.2006
-- Last update 11.04.2007
-- - - - - - - - - - - - -

  /* если поменялась дата принятия или бух операция или тип классификации, то сносим это в деталь */
  if ((new$AcceptDate <> :old.AcceptDate)or((new$AcceptDate is not null)and(:old.AcceptDate is null))
      or((new$AcceptDate is null)and(:old.AcceptDate is not null)))
  then
    update facialfindetail set
      AcceptDate = new$AcceptDate,
      RVersion = -1
    where
      RecordIndex = new$id;
  end if;

  if (new$BuhOperationCLS <> :old.BuhOperationCLS)  then
    update facialfindetail set
      BuhOperationCLS = new$BuhOperationCLS,
      RVersion = -1
    where
      RecordIndex = new$id;
  end if;

  if (new$ClsType <> :old.ClsType) then
    if (new$ClsType = 0) then
      update facialfindetail set
        SourceKD = 0,
        DestKD = 0,
        SourceIFS = 0,
        DestIFS = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;

    if (new$ClsType = 1) then
      update facialfindetail set
        SourceKD = 0,
        DestKD = 0,
        SourceKVSR = 0,
        SourceKFSR = 0,
        SourceKCSR = 0,
        SourceKVR = 0,
        SourceKESR = 0,
        DestKVSR = 0,
        DestKFSR = 0,
        DestKCSR = 0,
        DestKVR = 0,
        DestKESR = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;
    
    if (new$ClsType = 2) then
      update facialfindetail set
        SourceIFS = 0,
        DestIFS = 0,
        SourceKVSR = 0,
        SourceKFSR = 0,
        SourceKCSR = 0,
        SourceKVR = 0,
        SourceKESR = 0,
        DestKVSR = 0,
        DestKFSR = 0,
        DestKCSR = 0,
        DestKVR = 0,
        DestKESR = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;
    
  end if;

-- - - - - - - - - - - - -
-- AU_500 (TR_FACIALFINCAPTION_AU_500)
-- Create 28.04.2005
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (:NEW.ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (23, :OLD.ID, SYSDATE);

      DELETE FROM DelRecIndexes
        WHERE (TableID = 23) AND (RecordId = :NEW.ID);
   END IF;

END;
/
ALTER TABLE TB_BudNotify ADD (
  Signers VARCHAR2(1000)
)
/

CREATE OR REPLACE VIEW BudNotify (
  ID,
  DAT,
  DOCDAT,
  NOTE1,
  NOTIFYTYPE,
  BUDGETREF,
  DOCBASE,
  VARIANT,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  SENDERID,
  SENDERRECORDID,
  ANUMBER,
  ATYPE,
  DOCUMENTSTATE,
  USERSVISA,
  DATEINPUT,
  ORGREF,
  REJECTCLS,
  REJECTNOTE,
  PLANDOCTYPE,
  RECORDINDEX,
  STIMATEID,
  CRYPTOSTATUS,
  RVERSION,
  DOCSTATEREF,
  DOCNUMBER,
  FACIALACCCLS,
  LASTEXTRCHANGE,
  BIDNUMBER,
  FAXDOCCOUNT,
  PLANKIND,
  ASSIGNMENTSOURCE,
  BA_LBO_FLAG,
  KPPERIOD,
  CLSTYPE,
  DATE_UTV_PP,
  PROGINDEX,
  NOTE,
  NOTE2,
  DOCCHANGEDATE,
  SIGNERS)
AS
  SELECT
    ID,
    DAT,
    DOCDAT,
    NOTE1,
    NOTIFYTYPE,
    BUDGETREF,
    DOCBASE,
    VARIANT,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    SENDERID,
    SENDERRECORDID,
    ANUMBER,
    ATYPE,
    DOCUMENTSTATE,
    USERSVISA,
    DATEINPUT,
    ORGREF,
    REJECTCLS,
    REJECTNOTE,
    PLANDOCTYPE,
    RECORDINDEX,
    STIMATEID,
    CRYPTOSTATUS,
    RVERSION,
    DOCSTATEREF,
    DOCNUMBER,
    FACIALACCCLS,
    LASTEXTRCHANGE,
    BIDNUMBER,
    FAXDOCCOUNT,
    PLANKIND,
    ASSIGNMENTSOURCE,
    BA_LBO_FLAG,
    KPPERIOD,
    CLSTYPE,
    DATE_UTV_PP,
    PROGINDEX,
    NOTE,
    NOTE2,
    DOCCHANGEDATE,
    SIGNERS
  FROM TB_BudNotify
/

CREATE OR REPLACE TRIGGER TR_BUDNOTIFY_ID
  INSTEAD OF DELETE
  ON BUDNOTIFY
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_BUDNOTIFY_BD)
-- - - - - - - - - - - - -

  delete from BudgetData where (RecordIndex = :old.id);

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_BUDNOTIFY
  WHERE id=:old.id;

-- - - - - - - - - - - - -
-- AD_500 (TR_BUDNOTIFY_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(tableid, recordid, deletedate, createruser, progindex) values(28, :old.id, SYSDATE, user, :old.progindex);

END;
/

CREATE OR REPLACE TRIGGER TR_BUDNOTIFY_II
  INSTEAD OF INSERT
  ON BUDNOTIFY
  FOR EACH ROW
DECLARE
  new$ID BUDNOTIFY.ID%TYPE := :NEW.ID;
  new$DAT BUDNOTIFY.DAT%TYPE := :NEW.DAT;
  new$DOCDAT BUDNOTIFY.DOCDAT%TYPE := :NEW.DOCDAT;
  new$NOTE1 BUDNOTIFY.NOTE1%TYPE := :NEW.NOTE1;
  new$NOTIFYTYPE BUDNOTIFY.NOTIFYTYPE%TYPE := :NEW.NOTIFYTYPE;
  new$BUDGETREF BUDNOTIFY.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DOCBASE BUDNOTIFY.DOCBASE%TYPE := :NEW.DOCBASE;
  new$VARIANT BUDNOTIFY.VARIANT%TYPE := :NEW.VARIANT;
  new$CREATERUSER BUDNOTIFY.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE BUDNOTIFY.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE BUDNOTIFY.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER BUDNOTIFY.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$SENDERID BUDNOTIFY.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID BUDNOTIFY.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$ANUMBER BUDNOTIFY.ANUMBER%TYPE := :NEW.ANUMBER;
  new$ATYPE BUDNOTIFY.ATYPE%TYPE := :NEW.ATYPE;
  new$DOCUMENTSTATE BUDNOTIFY.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA BUDNOTIFY.USERSVISA%TYPE := :NEW.USERSVISA;
  new$DATEINPUT BUDNOTIFY.DATEINPUT%TYPE := :NEW.DATEINPUT;
  new$ORGREF BUDNOTIFY.ORGREF%TYPE := :NEW.ORGREF;
  new$REJECTCLS BUDNOTIFY.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTNOTE BUDNOTIFY.REJECTNOTE%TYPE := :NEW.REJECTNOTE;
  new$PLANDOCTYPE BUDNOTIFY.PLANDOCTYPE%TYPE := :NEW.PLANDOCTYPE;
  new$RECORDINDEX BUDNOTIFY.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$STIMATEID BUDNOTIFY.STIMATEID%TYPE := :NEW.STIMATEID;
  new$CRYPTOSTATUS BUDNOTIFY.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$RVERSION BUDNOTIFY.RVERSION%TYPE := :NEW.RVERSION;
  new$DOCSTATEREF BUDNOTIFY.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$DOCNUMBER BUDNOTIFY.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$FACIALACCCLS BUDNOTIFY.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$LASTEXTRCHANGE BUDNOTIFY.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$BIDNUMBER BUDNOTIFY.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$FAXDOCCOUNT BUDNOTIFY.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$PLANKIND BUDNOTIFY.PLANKIND%TYPE := :NEW.PLANKIND;
  new$ASSIGNMENTSOURCE BUDNOTIFY.ASSIGNMENTSOURCE%TYPE := :NEW.ASSIGNMENTSOURCE;
  new$BA_LBO_FLAG BUDNOTIFY.BA_LBO_FLAG%TYPE := :NEW.BA_LBO_FLAG;
  new$KPPERIOD BUDNOTIFY.KPPERIOD%TYPE := :NEW.KPPERIOD;
  new$CLSTYPE BUDNOTIFY.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$DATE_UTV_PP BUDNOTIFY.DATE_UTV_PP%TYPE := :NEW.DATE_UTV_PP;
  new$PROGINDEX BUDNOTIFY.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$NOTE BUDNOTIFY.NOTE%TYPE := :NEW.NOTE;
  new$NOTE2 BUDNOTIFY.NOTE2%TYPE := :NEW.NOTE2;
  new$DOCCHANGEDATE BUDNOTIFY.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
  new$SIGNERS BUDNOTIFY.SIGNERS%TYPE := :NEW.SIGNERS;
--
  UseFax$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_BUDNOTIFY_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$NotifyType is null) then 
    new$NotifyType := 0;
  END IF;
  if (new$DocBase is null) then 
    new$DocBase := 0;
  END IF;
  if (new$PlanKind is null) then 
    new$PlanKind := 0;
  END IF;
  if (new$AssignmentSource is null) then
    new$AssignmentSource := 0;
  END IF;
  if ((new$PlanDocType is null) or (new$PlanDocType < 100)) then
    new$PlanDocType := 200;
  END IF;
  if ((new$PlanDocType > 99)and(new$PlanDocType < 200)) then
    new$AType := 0;
      
  else
    new$AType := 1;
  END IF;
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  if (new$FacialAccCls is null) then 
    new$FacialAccCls := 0;
  END IF;
  if (new$BA_LBO_Flag is null) then 
    new$BA_LBO_Flag := 0;
  END IF;
  if (new$KPPeriod is null) then 
    new$KPPeriod := 0;
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 3;
  END IF;
  if ((new$ProgIndex = 262)and(new$FacialAccCLS <> 0)and(new$OrgRef is null)) then
    BEGIN
      /* на вставку записи – при условии неуказанности организации автозаполнение
          организации заголовка по огранизации-владельцу л\с из заголовка*/
      select
      fac.ORG_REF
      into new$OrgRef     from
      FacialACC_CLS fac
      where
      (fac.ID = new$FacialAccCLS)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$Dat is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_430 (TR_BUDNOTIFY_BI_430)
-- Create 18.09.2006
-- - - - - - - - - - - - -

  IF (NEW$SenderID IS NOT NULL) THEN
    /* Заявка на бюджетные ассигнования получена из УРМ */
    GetIntConst(30, 19, UseFax$);
    IF ((NEW$BidNumber IS NULL) AND (UseFax$ = 1)) THEN
      NEW$BidNumber := NEW$ANumber;
    end if;
    NEW$FaxDocCount := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_BUDNOTIFY_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$DocChangeDate := new$UpdateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_BUDNOTIFY (
    ID,
    DAT,
    DOCDAT,
    NOTE1,
    NOTIFYTYPE,
    BUDGETREF,
    DOCBASE,
    VARIANT,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    SENDERID,
    SENDERRECORDID,
    ANUMBER,
    ATYPE,
    DOCUMENTSTATE,
    USERSVISA,
    DATEINPUT,
    ORGREF,
    REJECTCLS,
    REJECTNOTE,
    PLANDOCTYPE,
    RECORDINDEX,
    STIMATEID,
    CRYPTOSTATUS,
    RVERSION,
    DOCSTATEREF,
    DOCNUMBER,
    FACIALACCCLS,
    LASTEXTRCHANGE,
    BIDNUMBER,
    FAXDOCCOUNT,
    PLANKIND,
    ASSIGNMENTSOURCE,
    BA_LBO_FLAG,
    KPPERIOD,
    CLSTYPE,
    DATE_UTV_PP,
    PROGINDEX,
    NOTE,
    NOTE2,
    DOCCHANGEDATE,
    SIGNERS
  ) VALUES (
    new$ID,
    new$DAT,
    new$DOCDAT,
    new$NOTE1,
    new$NOTIFYTYPE,
    new$BUDGETREF,
    new$DOCBASE,
    new$VARIANT,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$SENDERID,
    new$SENDERRECORDID,
    new$ANUMBER,
    new$ATYPE,
    new$DOCUMENTSTATE,
    new$USERSVISA,
    new$DATEINPUT,
    new$ORGREF,
    new$REJECTCLS,
    new$REJECTNOTE,
    new$PLANDOCTYPE,
    new$RECORDINDEX,
    new$STIMATEID,
    new$CRYPTOSTATUS,
    new$RVERSION,
    new$DOCSTATEREF,
    new$DOCNUMBER,
    new$FACIALACCCLS,
    new$LASTEXTRCHANGE,
    new$BIDNUMBER,
    new$FAXDOCCOUNT,
    new$PLANKIND,
    new$ASSIGNMENTSOURCE,
    new$BA_LBO_FLAG,
    new$KPPERIOD,
    new$CLSTYPE,
    new$DATE_UTV_PP,
    new$PROGINDEX,
    new$NOTE,
    new$NOTE2,
    new$DOCCHANGEDATE,
    new$SIGNERS);

-- - - - - - - - - - - - -
-- AI_500 (TR_BUDNOTIFY_AI_500)
-- - - - - - - - - - - - -

        delete from DelRecIndexes where (TableID = 28) and (RecordID = NEW$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_BUDNOTIFY_IU
  INSTEAD OF UPDATE
  ON BUDNOTIFY
  FOR EACH ROW
DECLARE
  new$ID BUDNOTIFY.ID%TYPE := :NEW.ID;
  new$DAT BUDNOTIFY.DAT%TYPE := :NEW.DAT;
  new$DOCDAT BUDNOTIFY.DOCDAT%TYPE := :NEW.DOCDAT;
  new$NOTE1 BUDNOTIFY.NOTE1%TYPE := :NEW.NOTE1;
  new$NOTIFYTYPE BUDNOTIFY.NOTIFYTYPE%TYPE := :NEW.NOTIFYTYPE;
  new$BUDGETREF BUDNOTIFY.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DOCBASE BUDNOTIFY.DOCBASE%TYPE := :NEW.DOCBASE;
  new$VARIANT BUDNOTIFY.VARIANT%TYPE := :NEW.VARIANT;
  new$CREATERUSER BUDNOTIFY.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE BUDNOTIFY.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE BUDNOTIFY.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER BUDNOTIFY.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$SENDERID BUDNOTIFY.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID BUDNOTIFY.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$ANUMBER BUDNOTIFY.ANUMBER%TYPE := :NEW.ANUMBER;
  new$ATYPE BUDNOTIFY.ATYPE%TYPE := :NEW.ATYPE;
  new$DOCUMENTSTATE BUDNOTIFY.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA BUDNOTIFY.USERSVISA%TYPE := :NEW.USERSVISA;
  new$DATEINPUT BUDNOTIFY.DATEINPUT%TYPE := :NEW.DATEINPUT;
  new$ORGREF BUDNOTIFY.ORGREF%TYPE := :NEW.ORGREF;
  new$REJECTCLS BUDNOTIFY.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTNOTE BUDNOTIFY.REJECTNOTE%TYPE := :NEW.REJECTNOTE;
  new$PLANDOCTYPE BUDNOTIFY.PLANDOCTYPE%TYPE := :NEW.PLANDOCTYPE;
  new$RECORDINDEX BUDNOTIFY.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$STIMATEID BUDNOTIFY.STIMATEID%TYPE := :NEW.STIMATEID;
  new$CRYPTOSTATUS BUDNOTIFY.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$RVERSION BUDNOTIFY.RVERSION%TYPE := :NEW.RVERSION;
  new$DOCSTATEREF BUDNOTIFY.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$DOCNUMBER BUDNOTIFY.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$FACIALACCCLS BUDNOTIFY.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$LASTEXTRCHANGE BUDNOTIFY.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$BIDNUMBER BUDNOTIFY.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$FAXDOCCOUNT BUDNOTIFY.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$PLANKIND BUDNOTIFY.PLANKIND%TYPE := :NEW.PLANKIND;
  new$ASSIGNMENTSOURCE BUDNOTIFY.ASSIGNMENTSOURCE%TYPE := :NEW.ASSIGNMENTSOURCE;
  new$BA_LBO_FLAG BUDNOTIFY.BA_LBO_FLAG%TYPE := :NEW.BA_LBO_FLAG;
  new$KPPERIOD BUDNOTIFY.KPPERIOD%TYPE := :NEW.KPPERIOD;
  new$CLSTYPE BUDNOTIFY.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$DATE_UTV_PP BUDNOTIFY.DATE_UTV_PP%TYPE := :NEW.DATE_UTV_PP;
  new$PROGINDEX BUDNOTIFY.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$NOTE BUDNOTIFY.NOTE%TYPE := :NEW.NOTE;
  new$NOTE2 BUDNOTIFY.NOTE2%TYPE := :NEW.NOTE2;
  new$DOCCHANGEDATE BUDNOTIFY.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
  new$SIGNERS BUDNOTIFY.SIGNERS%TYPE := :NEW.SIGNERS;
--
  IsReject$ NUMBER(10);
  DetCount$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_BUDNOTIFY_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$NotifyType is null) then 
    new$NotifyType := 0;
  END IF;
  if (new$DocBase is null) then 
    new$DocBase := 0;
  END IF;
  if (new$PlanKind is null) then 
    new$PlanKind := 0;
  END IF;
  if (new$AssignmentSource is null) then 
    new$AssignmentSource := 0;
  END IF;
  if ((new$PlanDocType > 99)and(new$PlanDocType < 200)) then
    new$AType := 0;
      
  else
    if (new$PlanDocType > 199) then
      new$AType := 1;
    END IF;
  END IF;
  if (new$PlanDocType is null) then
    if (new$AType = 1) then
      new$PlanDocType := 200;
          
    else
      new$PlanDocType := 100;
      
    END IF;
  END IF;
  /* проверка на изменение Бюджета*/
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      select count(ID)              into DetCount$ from BudgetData where RecordIndex = :old.ID
      ;
      if (DetCount$ > 0) then 
        RaiseException('Ex_CantModufyBudget');        
      END IF;
    END IF;
  END IF;
  if (new$FacialAccCls is null) then 
    new$FacialAccCls := 0;
  END IF;
  if (new$BA_LBO_Flag is null) then 
    new$BA_LBO_Flag := 0;
  END IF;
  if (new$KPPeriod is null) then 
    new$KPPeriod := 0;
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 3;
  END IF;
  if ((new$ProgIndex = 262)and(new$FacialAccCLS <> :old.FacialAccCLS)
  and(new$FacialAccCLS <> 0)) then
    BEGIN
      /* на изменение записи  - при условии изменения л\с из заголовка автозаполнение
          организации заголовка по огранизации-владельцу л\с из заголовка,
          при условии, что новый л\с заголовка ненулевой*/
      select
      fac.ORG_REF
      into new$OrgRef     from
      FacialACC_CLS fac
      where
      (fac.ID = new$FacialAccCLS)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* документ не может быть одновременно принятым и отклоненным*/
  if ((new$Dat is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_BUDNOTIFY_BU_200)
-- Create 08.02.2005
-- - - - - - - - - - - - -

   --Сохранение в базу истории изменений состояний
  IF (:OLD.DOCSTATEREF <> NEW$DOCSTATEREF) THEN
    INSERT INTO StateJumpHistory(DocID, BeginStateRef, EndStateRef)
      VALUES (NEW$ID, :OLD.DOCSTATEREF, NEW$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_BUDNOTIFY_BU_300)
-- Create 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from BudgetData d where d.RecordIndex = :new.id));
  end if;    

-- - - - - - - - - - - - -
-- BU_700 (TR_BUDNOTIFY_BU_700)
-- Create 17.09.2004
-- - - - - - - - - - - - -

  IF (NEW$RVersion IS NULL) THEN
    NEW$RVersion := 1;
  ELSIF ((NEW$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
    NEW$RVersion := :OLD.RVersion;
  ELSE
    NEW$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_BUDNOTIFY SET
    ID = new$ID,
    DAT = new$DAT,
    DOCDAT = new$DOCDAT,
    NOTE1 = new$NOTE1,
    NOTIFYTYPE = new$NOTIFYTYPE,
    BUDGETREF = new$BUDGETREF,
    DOCBASE = new$DOCBASE,
    VARIANT = new$VARIANT,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    ANUMBER = new$ANUMBER,
    ATYPE = new$ATYPE,
    DOCUMENTSTATE = new$DOCUMENTSTATE,
    USERSVISA = new$USERSVISA,
    DATEINPUT = new$DATEINPUT,
    ORGREF = new$ORGREF,
    REJECTCLS = new$REJECTCLS,
    REJECTNOTE = new$REJECTNOTE,
    PLANDOCTYPE = new$PLANDOCTYPE,
    RECORDINDEX = new$RECORDINDEX,
    STIMATEID = new$STIMATEID,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    RVERSION = new$RVERSION,
    DOCSTATEREF = new$DOCSTATEREF,
    DOCNUMBER = new$DOCNUMBER,
    FACIALACCCLS = new$FACIALACCCLS,
    LASTEXTRCHANGE = new$LASTEXTRCHANGE,
    BIDNUMBER = new$BIDNUMBER,
    FAXDOCCOUNT = new$FAXDOCCOUNT,
    PLANKIND = new$PLANKIND,
    ASSIGNMENTSOURCE = new$ASSIGNMENTSOURCE,
    BA_LBO_FLAG = new$BA_LBO_FLAG,
    KPPERIOD = new$KPPERIOD,
    CLSTYPE = new$CLSTYPE,
    DATE_UTV_PP = new$DATE_UTV_PP,
    PROGINDEX = new$PROGINDEX,
    NOTE = new$NOTE,
    NOTE2 = new$NOTE2,
    DOCCHANGEDATE = new$DOCCHANGEDATE,
    SIGNERS = new$SIGNERS
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_300 (TR_BudNotify_AU_300)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$ClsType <> :old.ClsType)and(new$ClsType <> 3)
  and
  ((new$RVersion<>:old.RVersion)
  or
  ((:old.RVersion is null)and(new$RVersion is not null)))) then
    if (new$ClsType = 0) then
      update BudgetData set
      KD = 0,
      IFS = 0,
      ClsType = new$ClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(ClsType=:old.ClsType);
    END IF;
    if (new$ClsType = 1) then
      update BudgetData set
      KD = 0,
      KVSR = 0,
      KFSR = 0,
      KCSR = 0,
      KVR = 0,
      KESR = 0,
      ClsType = new$ClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(ClsType=:old.ClsType);
    END IF;
    if (new$ClsType = 2) then
      update BudgetData set
      IFS = 0,
      KVSR = 0,
      KFSR = 0,
      KCSR = 0,
      KVR = 0,
      KESR = 0,
      ClsType = new$ClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(ClsType=:old.ClsType);
      
    END IF;
  END IF;
  if ((new$ProgIndex in (252, 253))and(new$FacialAccCLS <> :old.FacialAccCLS)) then
    update BudgetData set
    facialacc_cls = new$FacialAccCLS
    where
    RecordIndex = new$id;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_BUDNOTIFY_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

  if (NEW$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (28, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=28) and (RecordId=NEW$ID);
  end if;

END;
/
ALTER TABLE CorrectionCaption ADD (
  Signers VARCHAR2(1000)
)
/
commit work 
/

-- #########################################################
-- #########################################################
-- Add_SignScheme_DataPacketType.sql
-- #########################################################
-- #########################################################

/* Добавление в типы пакетов обратной ЭЦП ссылки на схему подписания*/
ALTER TABLE datapackettypes ADD (
  SignScheme NUMBER(10),
    CHECK((SignScheme<=2147483647)AND(SignScheme>-2147483648))
)
/
commit work 
/
ALTER TABLE datapackettypes ADD (
  CONSTRAINT FK_DATAPACKETTYPE_SIGNSCHEME FOREIGN KEY (SIGNSCHEME) REFERENCES SIGNSCHEMECAPTION (ID)
)
/
CREATE INDEX FK_DATAPACKETTYPE_SIGNSCHEME ON datapackettypes(SIGNSCHEME)
/
commit work 
/


-- #########################################################
-- #########################################################
-- Insert_Rights_fImport.sql
-- #########################################################
-- #########################################################

/* 
  Гуппе ALL дается право "Доступ" для объекта "18.16 Модальная форма импорта"
  на все типы документов
*/
insert into GROUPSRIGHTS (GROUPREF, RIGHTREF, ISREJECT, OBJREF, OBJECTKINDREF)
select 0, id, 0, 1816, 16000000
from DBRights
where (RightKindRef = 4) and (ObjectKindRef = 16000000)
/
COMMIT WORK 
/

-- #########################################################
-- #########################################################
-- CascadDelPayDocEx_From_FacialFinCap.sql
-- #########################################################
-- #########################################################

/* Добавление каскадного удаления записей обмена при удалении еще не отосланных записей пп*/
-- ALTER TRIGGER TR_FACIALFINCAPTION_BD_6
CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_ID
  INSTEAD OF DELETE
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  reestrAccepted1$ NUMBER(10);
  CNT$1 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_FACIALFINCAPTION_BD)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

 /*  Удалить детализацию распоряжения на финансирование */
  DELETE FROM FacialFinDetail
        WHERE (RecordIndex = :OLD.ID);

-- - - - - - - - - - - - -
-- BD_5 (TR_FACIALFINCAPTION_BD_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (((:old.progIndex = 63) or (:old.progIndex = 64) or
  (:old.progIndex = 68) or (:old.progIndex = 70))
  and (:old.REESTR_REF is not null)) then
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id = :old.REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrDelete');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BD_6 (TR_FACIALFINCAPTION_BD_6)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  SELECT COUNT(id ) INTO CNT$1
  from paydocexchange where ((paydocref=:old.id)and(status<>0)and(CodeFormat<>50)) AND (ROWNUM = 1);
  if ((CNT$1<> 0)) then
    RaiseException('ex_CannotChangeSended');
  else
    delete from PayDocExchange where paydocref = :old.id;  
  END IF;

-- - - - - - - - - - - - -
-- BD_430 (TR_FACIALFINCAPTION_BD_430)
-- Create 04.12.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  /* При удалении ПП зануляем ссылку на него в факсах*/
  UPDATE FaxDocs
     SET OwnerID = NULL
  WHERE OwnerID = :OLD.ID;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_FACIALFINCAPTION
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_70 (TR_FACIALFINCAPTION_AD_70)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

-- При удалении п/п очищаем ссылающиеся поля у гарантии
  IF (:OLD.SubProgIndex = 416) THEN
    UPDATE Guarantee
       SET SubRecordIndex = NULL,
           SubProgIndex = 0
     WHERE SubRecordIndex = :OLD.ID;
  END IF;

-- - - - - - - - - - - - -
-- AD_200 (TR_FACIALFINCAPTION_AD_200)
-- Create 27.08.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  /* Удаление истории изменений состоний для удаленного документа*/
  delete from StateJumpHistory
    where DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_300 (TR_FACIALFINCAPTION_AD_300)
-- Create 24.02.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  IF (:OLD.FaxDocCount > 0) THEN
--    :old.FaxDocCount := :old.FaxDocCount;
    NULL;
  ELSE
    UPDATE FaxDocs
       SET OwnerID = NULL
     WHERE OwnerID = :OLD.ID;
  END IF;

-- - - - - - - - - - - - -
-- AD_500 (TR_FACIALFINCAPTION_AD_500)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate, ProgIndex, Summa)
    VALUES (23, :OLD.ID, SYSDATE, :OLD.ProgIndex, :OLD.Credit);

END;
/
commit work 
/


-- #########################################################
-- #########################################################
-- alter_field_ND_BANKEXCH_MERDOC.sql
-- #########################################################
-- #########################################################

/* Изменение типа поля "ND" с "note10" на "note20"*/
ALTER TABLE BANKEXCH_MERDOC MODIFY (ND VARCHAR2(20))
/
commit work 
/


-- #########################################################
-- #########################################################
-- Delete_DocBaseEdit.sql
-- #########################################################
-- #########################################################

/* Удаление отдельного редактора документа-основания */
delete from interfaces
where guid='{0DCCFC7C-54F6-45E5-8530-AE2A3B872540}'
/
commit work
/

-- #########################################################
-- #########################################################
-- alter_budstructrigths_strcodes.sql
-- #########################################################
-- #########################################################

/* > alter_Cls_AddFields.sql *//* Изменение типов полей "Мероприятие", "Направление", "Тип финансирования" в правах на БК на строку */
ALTER TABLE BUDSTRUCTRIGHTS DROP CONSTRAINT FK_BUDSTRRIGHTS_DIRECTIONCLS
/
DROP INDEX FK_BUDSTRRIGHTS_DIRECTIONCLS
/
ALTER TABLE BUDSTRUCTRIGHTS DROP CONSTRAINT UNIQUE_BUDSTRUCTRIGHTS DROP INDEX
/
-- drop trigger TR_BUDSTRUCTRIGHTS_BI_0
CREATE OR REPLACE TRIGGER TR_BUDSTRUCTRIGHTS_BI
  BEFORE INSERT
  ON BUDSTRUCTRIGHTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (TR_BUDSTRUCTRIGHTS_BI_500)
-- Create 26.08.2004
-- Last update 26.08.2004
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;

END;
/
-- drop trigger TR_BUDSTRUCTRIGHTS_BU_0
DROP TRIGGER TR_BUDSTRUCTRIGHTS_BU
/
ALTER TRIGGER TR_BUDSTRUCTRIGHTS_BU_500 DISABLE
/
ALTER TABLE BudStructRights ADD (
  TempDirectionCls VARCHAR2(20),
  TempDirectionClsUp VARCHAR2(20),
  TempFact VARCHAR2(20),
  TempFactUp VARCHAR2(20),
  TempFinType VARCHAR2(20),
  TempFinTypeUp VARCHAR2(20)
)
/
commit work 
/
update BudStructRights set
  TempDirectionCls = DirectionCls,
  TempDirectionClsUp = DirectionClsup,
  TempFact = Fact,
  TempFactUp = FactUp,
  TempFinType = FinType,
  TempFinTypeUp = FinTypeUp
/
  
commit work 
/
ALTER TABLE BudStructRights DROP (DirectionCls)
/
ALTER TABLE BudStructRights DROP (DirectionClsUp)
/
ALTER TABLE BudStructRights DROP (Fact)
/
ALTER TABLE BudStructRights DROP (FactUp)
/
ALTER TABLE BudStructRights DROP (FinType)
/
ALTER TABLE BudStructRights DROP (FinTypeUp)
/
commit work 
/
ALTER TABLE BudStructRights ADD (
  DirectionCls VARCHAR2(20),
  DirectionClsUp VARCHAR2(20),
  Fact VARCHAR2(20),
  FactUp VARCHAR2(20),
  FinType VARCHAR2(20),
  FinTypeUp VARCHAR2(20)
)
/
commit work 
/
update BudStructRights set
  DirectionCls = TempDirectionCls,
  DirectionClsUp = TempDirectionClsup,
  Fact = TempFact,
  FactUp = TempFactUp,
  FinType = TempFinType,
  FinTypeUp = TempFinTypeUp
/
  
commit work 
/
/* Направление */

update BudStructRights set
  DirectionCls='00' || DirectionCls
where
  DirectionCls like '_'
/
update BudStructRights set
  DirectionCls='0' || DirectionCls
where
  DirectionCls like '__'
/
update BudStructRights set
  DirectionClsUp='00' || DirectionClsUp
where
  DirectionClsUp like '_'
/
update BudStructRights set
  DirectionClsUp='0' || DirectionClsUp
where
  DirectionClsUp like '__'
/
update BudStructRights set
  DirectionClsUp='ЯЯЯ'
where
  DirectionClsUp='999'
/
/* Мероприятие */

update BudStructRights set
  Fact='00000' || Fact
where
  Fact like '_'
/
update BudStructRights set
  Fact='0000' || Fact
where
  Fact like '__'
/
update BudStructRights set
  Fact='000' || Fact
where
  Fact like '___'
/
update BudStructRights set
  Fact='00' || Fact
where
  Fact like '____'
/
update BudStructRights set
  Fact='0' || Fact
where
  Fact like '_____'
/
update BudStructRights set
  FactUp='00000' || FactUp
where
  FactUp like '_'
/
update BudStructRights set
  FactUp='0000' || FactUp
where
  FactUp like '__'
/
update BudStructRights set
  FactUp='000' || FactUp
where
  FactUp like '___'
/
update BudStructRights set
  FactUp='00' || FactUp
where
  FactUp like '____'
/
update BudStructRights set
  FactUp='0' || FactUp
where
  FactUp like '_____'
/
update BudStructRights set
  FactUp='ЯЯЯЯЯЯ'
where
  FactUp='999999'
/
/* Тип финансирование */

update BudStructRights set
  FinType='00' || FinType
where
  FinType like '_'
/
update BudStructRights set
  FinType='0' || FinType
where
  FinType like '__'
/
update BudStructRights set
  FinTypeUp='00' || FinTypeUp
where
  FinTypeUp like '_'
/
update BudStructRights set
  FinTypeUp='0' || FinTypeUp
where
  FinTypeUp like '__'
/
update BudStructRights set
  FinTypeUp='ЯЯЯ'
where
  FinTypeUp='999'
/
commit work 
/
-- CREATE TRIGGER tr_budstructrights_bi_0
CREATE OR REPLACE TRIGGER TR_BUDSTRUCTRIGHTS_BI
  BEFORE INSERT
  ON BUDSTRUCTRIGHTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_budstructrights_bi_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then 
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.RightRef is null) then 
    :new.RightRef := 4;
  END IF;
  if (:new.IsGroup is null) then 
    :new.IsGroup := 0;
  END IF;
  if (:new.KVSR is null) then 
    :new.KVSR := 0;
  END IF;
  if ((:new.KCSR is null) or (:new.KCSR  is null)) then 
    :new.KCSR := '0';
  END IF;
  if (:new.KFSR is null) then 
    :new.KFSR := 0;
  END IF;
  if ((:new.KVR is null) or (:new.KVR  is null)) then 
    :new.KVR := '0';
  END IF;
  if (:new.KESR is null) then 
    :new.KESR := 0;
  END IF;
  if (:new.SubKESR is null) then 
    :new.SubKESR := 0;
  END IF;
  if (:new.RegionCls is null) then 
    :new.RegionCls := 0;
  END IF;
  if ((:new.DirectionCls is null) or (:new.DirectionCls  is null)) then 
    :new.DirectionCls := '0';
  END IF;
  if ((:new.Fact is null) or (:new.Fact  is null)) then 
    :new.Fact := '0';
  END IF;
  if ((:new.FinType is null) or (:new.FinType  is null)) then 
    :new.FinType := '0';
  END IF;
  if (:new.MeansType is null) then 
    :new.MeansType := 0;
  END IF;
  if (:new.TransfertCls is null) then 
    :new.TransfertCls := 0;
  END IF;
  if ((:new.BudAllocationCls is null) or (:new.BudAllocationCls  is null)) then 
    :new.BudAllocationCls := '0';
  END IF;
  if ((:new.PayPromiseCls is null) or (:new.PayPromiseCls  is null)) then 
    :new.PayPromiseCls := '0';
  END IF;
  if ((:new.SubsidyCls is null) or (:new.SubsidyCls  is null)) then 
    :new.SubsidyCls := '0';
  END IF;
  if (:new.KfsrUP is null) then 
    :new.KFSRUp := :new.KFSR;
  END IF;
  if (:new.KVSRUP is null) then 
    :new.KVSRUP := :new.KVSR;
  END IF;
  if (:new.KCSRUP is null) then 
    :new.KCSRUP := :new.KCSR;
  END IF;
  if (:new.KVRUP is null) then 
    :new.KVRUP := :new.KVR;
  END IF;
  if (:new.KesrUP is null) then 
    :new.KesrUP := :new.Kesr;
  END IF;
  if (:new.SubKESRUP is null) then 
    :new.SubKESRUP := :new.SubKESR;
  END IF;
  if (:new.RegionClsUP is null) then 
    :new.RegionClsUP := :new.RegionCls;
  END IF;
  if ((:new.DirectionClsUp is null) or (:new.DirectionClsUp  is null)) then 
    :new.DirectionClsUp := :new.DirectionCls;
  END IF;
  if ((:new.FactUP is null) or (:new.FactUP is null)) then 
    :new.FactUP := :new.Fact;
  END IF;
  if ((:new.FinTypeUP is null) or (:new.FinTypeUP is null)) then 
    :new.FinTypeUP := :new.FinType;
  END IF;
  if (:new.MeansTypeUP is null) then 
    :new.MeansTypeUP := :new.MeansType;
  END IF;
  if (:new.TransfertClsUp is null) then 
    :new.TransfertClsUp := :new.TransfertCls;
  END IF;
  if ((:new.BudAllocationClsUp is null) or (:new.BudAllocationClsUp  is null)) then 
    :new.BudAllocationClsUp := :new.BudAllocationCls;
  END IF;
  if ((:new.PayPromiseClsUp is null) or (:new.PayPromiseClsUp  is null)) then 
    :new.PayPromiseClsUp := :new.PayPromiseCls;
  END IF;
  if ((:new.SubsidyClsUp is null) or (:new.SubsidyClsUp  is null)) then 
    :new.SubsidyClsUp := :new.SubsidyCls;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_BUDSTRUCTRIGHTS_BI_500)
-- Create 26.08.2004
-- Last update 26.08.2004
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;

END;
/
-- CREATE TRIGGER tr_budstructrights_bu_0
CREATE OR REPLACE TRIGGER TR_budstructrights_BU
  BEFORE UPDATE
  ON budstructrights
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_budstructrights_bu_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.RightRef is null) then 
    :new.RightRef := 4;
  END IF;
  if (:new.IsGroup is null) then 
    :new.IsGroup := 0;
  END IF;
  if (:new.KVSR is null) then 
    :new.KVSR := 0;
  END IF;
  if ((:new.KCSR is null) or (:new.KCSR  is null)) then 
    :new.KCSR := '0';
  END IF;
  if (:new.KFSR is null) then 
    :new.KFSR := 0;
  END IF;
  if ((:new.KVR is null) or (:new.KVR  is null)) then 
    :new.KVR := '0';
  END IF;
  if (:new.KESR is null) then 
    :new.KESR := 0;
  END IF;
  if (:new.SubKESR is null) then 
    :new.SubKESR := 0;
  END IF;
  if (:new.RegionCls is null) then 
    :new.RegionCls := 0;
  END IF;
  if ((:new.DirectionCls is null) or (:new.DirectionCls  is null)) then 
    :new.DirectionCls := '0';
  END IF;
  if ((:new.Fact is null) or (:new.Fact  is null)) then 
    :new.Fact := '0';
  END IF;
  if ((:new.FinType is null) or (:new.FinType  is null)) then 
    :new.FinType := '0';
  END IF;
  if (:new.MeansType is null) then 
    :new.MeansType := 0;
  END IF;
  if (:new.TransfertCls is null) then 
    :new.TransfertCls := 0;
  END IF;
  if ((:new.BudAllocationCls is null) or (:new.BudAllocationCls  is null)) then 
    :new.BudAllocationCls := '0';
  END IF;
  if ((:new.PayPromiseCls is null) or (:new.PayPromiseCls  is null)) then 
    :new.PayPromiseCls := '0';
  END IF;
  if ((:new.SubsidyCls is null) or (:new.SubsidyCls  is null)) then 
    :new.SubsidyCls := '0';
  END IF;
  if (:new.KfsrUP is null) then 
    :new.KFSRUp := :new.KFSR;
  END IF;
  if (:new.KVSRUP is null) then 
    :new.KVSRUP := :new.KVSR;
  END IF;
  if (:new.KCSRUP is null) then 
    :new.KCSRUP := :new.KCSR;
  END IF;
  if (:new.KVRUP is null) then 
    :new.KVRUP := :new.KVR;
  END IF;
  if (:new.KesrUP is null) then 
    :new.KesrUP := :new.Kesr;
  END IF;
  if (:new.SubKESRUP is null) then 
    :new.SubKESRUP := :new.SubKESR;
  END IF;
  if (:new.RegionClsUP is null) then 
    :new.RegionClsUP := :new.RegionCls;
  END IF;
  if ((:new.DirectionClsUp is null) or (:new.DirectionClsUp  is null)) then 
    :new.DirectionClsUp := :new.DirectionCls;
  END IF;
  if ((:new.FactUP is null) or (:new.FactUP is null)) then 
    :new.FactUP := :new.Fact;
  END IF;
  if ((:new.FinTypeUP is null) or (:new.FinTypeUP is null)) then 
    :new.FinTypeUP := :new.FinType;
  END IF;
  if (:new.MeansTypeUP is null) then 
    :new.MeansTypeUP := :new.MeansType;
  END IF;
  if (:new.TransfertClsUp is null) then 
    :new.TransfertClsUp := :new.TransfertCls;
  END IF;
  if ((:new.BudAllocationClsUp is null) or (:new.BudAllocationClsUp  is null)) then 
    :new.BudAllocationClsUp := :new.BudAllocationCls;
  END IF;
  if ((:new.PayPromiseClsUp is null) or (:new.PayPromiseClsUp  is null)) then 
    :new.PayPromiseClsUp := :new.PayPromiseCls;
  END IF;
  if ((:new.SubsidyClsUp is null) or (:new.SubsidyClsUp  is null)) then 
    :new.SubsidyClsUp := :new.SubsidyCls;
  END IF;

END;
/
commit work 
/
ALTER TABLE BudStructRights DROP (TempDirectionCls)
/
ALTER TABLE BudStructRights DROP (TempDirectionClsUp)
/
ALTER TABLE BudStructRights DROP (TempFact)
/
ALTER TABLE BudStructRights DROP (TempFactUp)
/
ALTER TABLE BudStructRights DROP (TempFinType)
/
ALTER TABLE BudStructRights DROP (TempFinTypeUp)
/
commit work 
/

ALTER TABLE BudStructRights MODIFY(DirectionCls NOT NULL)
/
ALTER TABLE BudStructRights MODIFY(Fact NOT NULL)
/
ALTER TABLE BudStructRights MODIFY(FinType NOT NULL)
/

-- #########################################################
-- #########################################################
-- alter_oos_contract_add_singularName.sql
-- #########################################################
-- #########################################################

/* Добавление поля "Организационно-правовая форма" в таблицу oos_contract*/
ALTER TABLE OOS_CONTRACT ADD (
  SUPPLIER_LF_SINGULARNAME VARCHAR2(2000)
)
/
commit work 
/

-- #########################################################
-- #########################################################
-- CreateTable_OOS_CONTRACTPROCEDURE.sql
-- #########################################################
-- #########################################################

/* Создание буферной таблицы для хранения импортируемой из ООС (Общероссийский официальный сайт) "информации об исполнении (о расторжении) контракта".*//* *****************************************************************************//* **                                 Tables                                 ***//* *****************************************************************************/
/* Буферная таблица "информации об исполнении (о расторжении) контракта" импортируемых из ООС*/
CREATE TABLE OOS_CONTRACTPROCEDURE (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  ARCHIVENAME VARCHAR2(150),
  PACKETNAME VARCHAR2(150),
  REGNUM VARCHAR2(50),
  VERSIONNUMBER NUMBER(10),
    CHECK((VERSIONNUMBER<=2147483647)AND(VERSIONNUMBER>-2147483648)),
  TERMINATION_PAID NUMBER(15,2) default 0,
  CURRENTCONTRACTSTAGE VARCHAR2(10),
  CREATERUSER VARCHAR2(30) NOT NULL,
  CREATEDATE DATE NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL,
  UPDATEDATE DATE NOT NULL
)
/
/* *****************************************************************************//* **                              Primary Keys                              ***//* *****************************************************************************/
ALTER TABLE OOS_CONTRACTPROCEDURE ADD (
  CONSTRAINT PK_OOS_CONTRACTPROCEDURE PRIMARY KEY (ID)
)
/
-- CREATE TRIGGER TR_OOS_CP_BI0
CREATE OR REPLACE TRIGGER TR_OOS_CONTRACTPROCEDURE_BI
  BEFORE INSERT
  ON OOS_CONTRACTPROCEDURE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_OOS_CP_BI0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then
    select g_shared.nextval into :new.id from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_OOS_CP_BI_500
CREATE OR REPLACE TRIGGER TR_OOS_CONTRACTPROCEDURE_BI
  BEFORE INSERT
  ON OOS_CONTRACTPROCEDURE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_OOS_CP_BI0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then
    select g_shared.nextval into :new.id from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_OOS_CP_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- CREATE TRIGGER TR_OOS_CP_BU_500
CREATE OR REPLACE TRIGGER TR_OOS_CP_BU_500
  BEFORE UPDATE
  ON OOS_CONTRACTPROCEDURE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_OOS_CP_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdaterUser := user;
  :new.UpdateDate := SYSDATE;

END;
/


/* *****************************************************************************/
/* **                               Privileges                               ***/
/* *****************************************************************************/


/* Privileges of users */
GRANT SELECT, INSERT, UPDATE, DELETE ON OOS_CONTRACTPROCEDURE TO BUDGET_USERS
/
commit work
/


-- #########################################################
-- #########################################################
-- alter_oos_contrproc_add_publishdate.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет поле "Дата публикации" в таблицу OOS_CONTRACTPROCEDURE*/
ALTER TABLE OOS_CONTRACTPROCEDURE ADD (
  PUBLISHDATE NUMBER
)
/
commit work 
/

-- #########################################################
-- #########################################################
-- alter_oos_contract_add_publishdate.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет поле "Дата публикации" в таблицу OOS_CONTRACT*/
ALTER TABLE OOS_CONTRACT ADD (
  PUBLISHDATE NUMBER
)
/
commit work 
/

-- #########################################################
-- #########################################################
-- Add_LayerTables.sql
-- #########################################################
-- #########################################################


/* Описание синхронизируемых метаданных слоевых таблиц*/

/* <TRANS_COMMAND>
CREATE TABLE LayerTables (
    ID               NUMBER(10,0) NOT NULL,
    SYNCID           NUMBER(10,0) NOT NULL,
    TABLENAME        VARCHAR2(50) NOT NULL,
    NAME             VARCHAR2(50) NOT NULL,
    DESCR            VARCHAR2(1024) NOT NULL,
    TBTYPE           NUMBER(10,0),
    SYNC             NUMBER(5,0) NOT NULL,
    SYSTABLE         NUMBER(5,0) NOT NULL,
    URM              NUMBER(5,0) NOT NULL,
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL,
    
    CONSTRAINT "PK_LAYERTABLES" PRIMARY KEY (ID),
    CHECK ((ID<=2147483647)AND(ID>-2147483648)),
    CHECK ((SYNCID<=2147483647)AND(SYNCID>-2147483648)),
    CHECK ((TBTYPE<=2147483647)AND(TBTYPE>-2147483648)),
    CHECK ((SYNC<=2147483647)AND(SYNC>-2147483648)),
    CHECK ((SYSTABLE<=2147483647)AND(SYSTABLE>-2147483648)),
    CHECK ((URM<=2147483647)AND(URM>-2147483648))
)
/
CREATE TABLE LAYERTABLESFIELDS (
    ID               NUMBER(10,0) NOT NULL,
    TABLEID          NUMBER(10,0) NOT NULL,
    DBNAME           VARCHAR2(255) NOT NULL,
    DESCR            VARCHAR2(1024),
    FIELDTYPE        NUMBER(10,0),
    FIELDSIZE        NUMBER(10,0),
    SYNC             NUMBER(5,0) NOT NULL,
    URM		           NUMBER(5,0) NOT NULL,
    REQUIRED         NUMBER(5,0) NOT NULL,
    DEFVALUE         VARCHAR2(255),
    SYNCVALUE        VARCHAR2(255),
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL,
    
    CONSTRAINT "PK_LAYERTABLESFIELDS" PRIMARY KEY (ID),
    CHECK ((ID<=2147483647)AND(ID>-2147483648)),
    CHECK ((TABLEID<=2147483647)AND(TABLEID>-2147483648)),
    CHECK ((FIELDTYPE<=2147483647)AND(FIELDTYPE>-2147483648)),
    CHECK ((FIELDSIZE<=2147483647)AND(FIELDSIZE>-2147483648)),
    CHECK ((SYNC<=2147483647)AND(SYNC>-2147483648)),
    CHECK ((URM<=2147483647)AND(URM>-2147483648)),
    CHECK ((REQUIRED<=2147483647)AND(REQUIRED>-2147483648))
)
/
CREATE INDEX IDX_LTFIELDS_TABLEID ON LAYERTABLESFIELDS (TableID)
/
CREATE TABLE LAYERTABLESTRIGGERS (
    ID               NUMBER(10,0) NOT NULL,
    TABLEID          NUMBER(10,0) NOT NULL,
    DBNAME           VARCHAR2(255) NOT NULL,
    DESCR            VARCHAR2(1024),
    TRTEXT           VARCHAR2(4000) NOT NULL,
    TRTYPE           NUMBER(10,0),
    TRPOSITION       NUMBER(10,0),
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL,
    
    CONSTRAINT "PK_LAYERTABLESTRIGGERS" PRIMARY KEY (ID),
    CHECK ((ID<=2147483647)AND(ID>-2147483648)),
    CHECK ((TABLEID<=2147483647)AND(TABLEID>-2147483648)),
    CHECK ((TRTYPE<=2147483647)AND(TRTYPE>-2147483648)),
    CHECK ((TRPOSITION<=2147483647)AND(TRPOSITION>-2147483648))
)
/
CREATE TABLE LAYERTABLESIDX (
    ID               NUMBER(10,0) NOT NULL,
    TABLEID          NUMBER(10,0) NOT NULL,
    DBNAME           VARCHAR2(255) NOT NULL,
    DESCR            VARCHAR2(1024),
    FIELDS           VARCHAR2(512) NOT NULL,
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL,
    
    CONSTRAINT "PK_LAYERTABLESIDX" PRIMARY KEY (ID),
    CHECK ((ID<=2147483647)AND(ID>-2147483648)),
    CHECK ((TABLEID<=2147483647)AND(TABLEID>-2147483648))
)
/
CREATE TABLE LAYERTABLESFK (
    ID               NUMBER(10,0) NOT NULL,
    TABLEID          NUMBER(10,0) NOT NULL,
    DBNAME           VARCHAR2(255) NOT NULL,
    DESCR            VARCHAR2(1024),
    FIELDS           VARCHAR2(512) NOT NULL,
    TABLENAME        VARCHAR2(150) NOT NULL,
    FIELDSREF        VARCHAR2(512) NOT NULL,
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL,
    
    CONSTRAINT "PK_LAYERTABLESFK" PRIMARY KEY (ID),
    CHECK ((ID<=2147483647)AND(ID>-2147483648)),
    CHECK ((TABLEID<=2147483647)AND(TABLEID>-2147483648))
)
/
GRANT ALL ON LAYERTABLES TO PUBLIC
/
GRANT ALL ON LAYERTABLESFIELDS TO PUBLIC
/
GRANT ALL ON LAYERTABLESTRIGGERS TO PUBLIC
/
GRANT ALL ON LAYERTABLESIDX TO PUBLIC
/
GRANT ALL ON LAYERTABLESFK TO PUBLIC
/
COMMIT WORK
/
*/
-- <TRANS_IGNORE>

DECLARE
  v_exists INTEGER;
BEGIN
 SELECT count(*) 
    INTO v_exists 
    FROM user_tables 
    WHERE UPPER(Table_Name)='LAYERTABLES';
 IF v_exists=0 THEN

/* Перечень таблиц*/
EXECUTE IMMEDIATE 'CREATE TABLE LayerTables (
    ID               NUMBER(10,0) NOT NULL,
    SYNCID           NUMBER(10,0) NOT NULL,
    TABLENAME        VARCHAR2(50) NOT NULL,
    NAME             VARCHAR2(50) NOT NULL,
    DESCR            VARCHAR2(1024) NOT NULL,
    TBTYPE           NUMBER(10,0),
    SYNC             NUMBER(5,0) NOT NULL,
    SYSTABLE         NUMBER(5,0) NOT NULL,
    URM              NUMBER(5,0) NOT NULL,
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL,
    
    CONSTRAINT "PK_LAYERTABLES" PRIMARY KEY (ID),
    CHECK ((ID<=2147483647)AND(ID>-2147483648)),
    CHECK ((SYNCID<=2147483647)AND(SYNCID>-2147483648)),
    CHECK ((TBTYPE<=2147483647)AND(TBTYPE>-2147483648)),
    CHECK ((SYNC<=2147483647)AND(SYNC>-2147483648)),
    CHECK ((SYSTABLE<=2147483647)AND(SYSTABLE>-2147483648)),
    CHECK ((URM<=2147483647)AND(URM>-2147483648))
)';


/* Поля таблиц*/
EXECUTE IMMEDIATE 'CREATE TABLE LAYERTABLESFIELDS (
    ID               NUMBER(10,0) NOT NULL,
    TABLEID          NUMBER(10,0) NOT NULL,
    DBNAME           VARCHAR2(255) NOT NULL,
    DESCR            VARCHAR2(1024),
    FIELDTYPE        NUMBER(10,0),
    FIELDSIZE        NUMBER(10,0),
    SYNC             NUMBER(5,0) NOT NULL,
    URM		           NUMBER(5,0) NOT NULL,
    REQUIRED         NUMBER(5,0) NOT NULL,
    DEFVALUE         VARCHAR2(255),
    SYNCVALUE        VARCHAR2(255),
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL,
    
    CONSTRAINT "PK_LAYERTABLESFIELDS" PRIMARY KEY (ID),
    CHECK ((ID<=2147483647)AND(ID>-2147483648)),
    CHECK ((TABLEID<=2147483647)AND(TABLEID>-2147483648)),
    CHECK ((FIELDTYPE<=2147483647)AND(FIELDTYPE>-2147483648)),
    CHECK ((FIELDSIZE<=2147483647)AND(FIELDSIZE>-2147483648)),
    CHECK ((SYNC<=2147483647)AND(SYNC>-2147483648)),
    CHECK ((URM<=2147483647)AND(URM>-2147483648)),
    CHECK ((REQUIRED<=2147483647)AND(REQUIRED>-2147483648))
)';

EXECUTE IMMEDIATE 'CREATE INDEX IDX_LTFIELDS_TABLEID ON LAYERTABLESFIELDS (TableID)';

/* Триггеры таблиц*/
EXECUTE IMMEDIATE 'CREATE TABLE LAYERTABLESTRIGGERS (
    ID               NUMBER(10,0) NOT NULL,
    TABLEID          NUMBER(10,0) NOT NULL,
    DBNAME           VARCHAR2(255) NOT NULL,
    DESCR            VARCHAR2(1024),
    TRTEXT           VARCHAR2(4000) NOT NULL,
    TRTYPE           NUMBER(10,0),
    TRPOSITION       NUMBER(10,0),
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL,
    
    CONSTRAINT "PK_LAYERTABLESTRIGGERS" PRIMARY KEY (ID),
    CHECK ((ID<=2147483647)AND(ID>-2147483648)),
    CHECK ((TABLEID<=2147483647)AND(TABLEID>-2147483648)),
    CHECK ((TRTYPE<=2147483647)AND(TRTYPE>-2147483648)),
    CHECK ((TRPOSITION<=2147483647)AND(TRPOSITION>-2147483648))
)';

/* Индексы*/
EXECUTE IMMEDIATE 'CREATE TABLE LAYERTABLESIDX (
    ID               NUMBER(10,0) NOT NULL,
    TABLEID          NUMBER(10,0) NOT NULL,
    DBNAME           VARCHAR2(255) NOT NULL,
    DESCR            VARCHAR2(1024),
    FIELDS           VARCHAR2(512) NOT NULL,
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL,
    
    CONSTRAINT "PK_LAYERTABLESIDX" PRIMARY KEY (ID),
    CHECK ((ID<=2147483647)AND(ID>-2147483648)),
    CHECK ((TABLEID<=2147483647)AND(TABLEID>-2147483648))
)';

/* Внешние ключи*/
EXECUTE IMMEDIATE 'CREATE TABLE LAYERTABLESFK (
    ID               NUMBER(10,0) NOT NULL,
    TABLEID          NUMBER(10,0) NOT NULL,
    DBNAME           VARCHAR2(255) NOT NULL,
    DESCR            VARCHAR2(1024),
    FIELDS           VARCHAR2(512) NOT NULL,
    TABLENAME        VARCHAR2(150) NOT NULL,
    FIELDSREF        VARCHAR2(512) NOT NULL,
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL,
    
    CONSTRAINT "PK_LAYERTABLESFK" PRIMARY KEY (ID),
    CHECK ((ID<=2147483647)AND(ID>-2147483648)),
    CHECK ((TABLEID<=2147483647)AND(TABLEID>-2147483648))
)';

EXECUTE IMMEDIATE 'GRANT ALL ON LAYERTABLES TO PUBLIC';

EXECUTE IMMEDIATE 'GRANT ALL ON LAYERTABLESFIELDS TO PUBLIC';

EXECUTE IMMEDIATE 'GRANT ALL ON LAYERTABLESTRIGGERS TO PUBLIC';

EXECUTE IMMEDIATE 'GRANT ALL ON LAYERTABLESIDX TO PUBLIC';

EXECUTE IMMEDIATE 'GRANT ALL ON LAYERTABLESFK TO PUBLIC';

EXECUTE IMMEDIATE 'COMMIT WORK';

END IF;

END;
/





-- #########################################################
-- #########################################################
-- Add_OKPD2_OKVED2.sql
-- #########################################################
-- #########################################################

/* Добавление классификаторов "ОКПД 2" и "ОКВЭД 2" */
/* Классификатор "ОКПД 2" */
create table OKPD2(
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  Name VARCHAR2(1024),
  CreateDate DATE NOT NULL,
  UpdateDate DATE NOT NULL,
  STARTDATE DATE,
  DELETEDATE DATE
)
/
/* Классификатор "ОКВЭД 2" */
create table OKVED2(
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  Name VARCHAR2(1024),
  CreateDate DATE NOT NULL,
  UpdateDate DATE NOT NULL,
  STARTDATE DATE,
  DELETEDATE DATE
)
/

insert into OKPD2 (ID, Name, CreateDate, UpdateDate)
values (000000000, 'Не указано', SYSDATE, SYSDATE)
/
insert into OKVED2 (ID, Name, CreateDate, UpdateDate)
values (000000, 'Не указано', SYSDATE, SYSDATE)
/
ALTER TABLE OKPD2 ADD (
  constraint pk_OKPD2_ID primary key(ID)
)
/
ALTER TABLE OKVED2 ADD (
  constraint pk_OKVED2_ID primary key(ID)
)
/
-- CREATE TRIGGER tr_OKPD2_bi_500
CREATE OR REPLACE TRIGGER TR_OKPD2_BI
  BEFORE INSERT
  ON OKPD2
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (tr_OKPD2_bi_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;

END;
/
-- CREATE TRIGGER tr_OKVED2_bi_500
CREATE OR REPLACE TRIGGER TR_OKVED2_BI
  BEFORE INSERT
  ON OKVED2
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (tr_OKVED2_bi_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;

END;
/
-- CREATE TRIGGER tr_OKPD2_bu_500
CREATE OR REPLACE TRIGGER tr_OKPD2_bu_500
  BEFORE UPDATE
  ON OKPD2
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (tr_OKPD2_bu_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdateDate := SYSDATE;

END;
/
-- CREATE TRIGGER tr_OKVED2_bu_500
CREATE OR REPLACE TRIGGER tr_OKVED2_bu_500
  BEFORE UPDATE
  ON OKVED2
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (tr_OKVED2_bu_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdateDate := SYSDATE;

END;
/
-- CREATE TRIGGER tr_OKPD2_ai_500
CREATE OR REPLACE TRIGGER TR_OKPD2_AI
  AFTER INSERT
  ON OKPD2
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (tr_OKPD2_ai_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 84) and (RecordID = :new.ID);

END;
/
-- CREATE TRIGGER tr_OKVED2_ai_500
CREATE OR REPLACE TRIGGER TR_OKVED2_AI
  AFTER INSERT
  ON OKVED2
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (tr_OKVED2_ai_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 85) and (RecordID = :new.ID);

END;
/
-- CREATE TRIGGER Tr_OKPD2_AU_500
CREATE OR REPLACE TRIGGER TR_OKPD2_AU
  AFTER UPDATE
  ON OKPD2
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (Tr_OKPD2_AU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (84, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=84) and (RecordId=:new.ID);
      
  END IF;

END;
/
-- CREATE TRIGGER Tr_OKVED2_AU_500
CREATE OR REPLACE TRIGGER TR_OKVED2_AU
  AFTER UPDATE
  ON OKVED2
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (Tr_OKVED2_AU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (85, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=85) and (RecordId=:new.ID);
      
  END IF;

END;
/
-- CREATE TRIGGER tr_OKPD2_ad_500
CREATE OR REPLACE TRIGGER TR_OKPD2_AD
  AFTER DELETE
  ON OKPD2
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (tr_OKPD2_ad_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordID,DeleteDate) values(84,:old.ID,SYSDATE);

END;
/
-- CREATE TRIGGER tr_OKVED2_ad_500
CREATE OR REPLACE TRIGGER TR_OKVED2_AD
  AFTER DELETE
  ON OKVED2
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (tr_OKVED2_ad_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordID,DeleteDate) values(85,:old.ID,SYSDATE);

END;
/
grant SELECT, INSERT, UPDATE, DELETE on OKPD2 to BUDGET_USERS
/
grant SELECT, INSERT, UPDATE, DELETE on OKVED2 to BUDGET_USERS
/
commit work
/

-- #########################################################
-- #########################################################
-- Alter_TenderObjects.sql
-- #########################################################
-- #########################################################

/* Добавление полей классифкаторов "ОКПД 2" и "ОКВЭД 2" в справочник продукции */
ALTER TABLE tenderobjects ADD (
  OKPD2 NUMBER(10),/* Код предмета заявки по ОКПД2*/
    CHECK((OKPD2<=2147483647)AND(OKPD2>-2147483648)),
  OKVED2 NUMBER(10),/* Код предмета заявки по ОКВЭД2*/
    CHECK((OKVED2<=2147483647)AND(OKVED2>-2147483648)),
  CONSTRAINT FK_TENDEROBJECTS_OKPD2 FOREIGN KEY (OKPD2) REFERENCES OKPD2 (ID),
  CONSTRAINT FK_TENDEROBJECTS_OKVED2 FOREIGN KEY (OKVED2) REFERENCES OKVED2 (ID)
)
/
CREATE INDEX FK_TENDEROBJECTS_OKPD2 ON tenderobjects(OKPD2)
/
CREATE INDEX FK_TENDEROBJECTS_OKVED2 ON tenderobjects(OKVED2)
/
-- CREATE TRIGGER TR_TENDEROBJECTS_BI
CREATE OR REPLACE TRIGGER TR_TENDEROBJECTS_BI
  BEFORE INSERT
  ON TENDEROBJECTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_TENDEROBJECTS_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then 
    select g_shared.nextval into :new.id from dual;
  END IF;
  if (:new.OKDP is null) then 
    :new.OKDP := 0;
  END IF;
  if (:new.OKPCLS is null) then 
    :new.OKPCLS := 0;
  END IF;
  if (:new.MEASUREMENTCLS is null) then 
    :new.MEASUREMENTCLS := 0;
  END IF;
  if (:new.KESR is null) then 
    :new.KESR := 0;
  END IF;
  if (:new.FacialAccCls is null) then 
    :new.FacialAccCls := 0;    
  END IF;
  if (:new.OKPD is null) then 
    :new.OKPD := 0;
  END IF;
  if (:new.OKVED is null) then 
    :new.OKVED := 0;
  END IF;
  if (:new.OKPD2 is null) then 
    :new.OKPD2 := 0;
  END IF;
  if (:new.OKVED2 is null) then 
    :new.OKVED2 := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (TR_TENDEROBJECTS_BI_40)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (:new.senderId is null) then 
    :new.senderIdKey := -1;
      
  else 
    :new.senderIdKey := :new.senderId;
  END IF;
  if (:new.SenderRecordID is null) then
    :new.SenderRecordIDKey := :new.ID;
      
  else 
    :new.SenderRecordIDKey := :new.SenderRecordID;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_TENDEROBJECTS_BI_500)
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;
  :NEW.CreaterUser := USER;
  :NEW.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_TENDEROBJECTS_BU_0
CREATE OR REPLACE TRIGGER TR_TENDEROBJECTS_BU
  BEFORE UPDATE
  ON TENDEROBJECTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_TENDEROBJECTS_BU_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.OKDP is null) then 
    :new.OKDP := 0;
  END IF;
  if (:new.OKPCLS is null) then 
    :new.OKPCLS := 0;
  END IF;
  if (:new.MEASUREMENTCLS is null) then 
    :new.MEASUREMENTCLS := 0;
  END IF;
  if (:new.KESR is null) then 
    :new.KESR := 0;
  END IF;
  if (:new.FacialAccCls is null) then 
    :new.FacialAccCls := 0;
  END IF;
  if (:new.OKPD is null) then 
    :new.OKPD := 0;
  END IF;
  if (:new.OKVED is null) then 
    :new.OKVED := 0;
  END IF;
  if (:new.OKPD2 is null) then 
    :new.OKPD2 := 0;
  END IF;
  if (:new.OKVED2 is null) then 
    :new.OKVED2 := 0;
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_TENDEROBJECTS_BU_200)
-- Create 01.11.2004
-- - - - - - - - - - - - -

  /*  Сохранение в базу истории изменений состояний */
  if (:new.DocStateRef <> :old.DocStateRef) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(:new.id, :old.DocStateRef, :new.DocStateRef);
  end if;  

-- - - - - - - - - - - - -
-- BU_700 (TR_TENDEROBJECTS_BU_700)
-- Create 14.10.2004
-- - - - - - - - - - - - -

  if (:New.RVersion is null) then
    :New.RVersion := 1;
  elsif ((:New.RVersion = -1) and (:Old.RVersion <> -1)) then
    :New.RVersion := :Old.RVersion;
  else
    :New.RVersion := :Old.RVersion + 1;
  end if;  

END;
/
ALTER TRIGGER TR_TENDEROBJECTS_BU_500 DISABLE
/
update TenderObjects set
  OKPD2 = 0,
  OKVED2 = 0
/
ALTER TRIGGER TR_TENDEROBJECTS_BU_500 ENABLE
/
commit work
/
ALTER TABLE tenderobjects MODIFY(OKPD2 NOT NULL)
/
ALTER TABLE tenderobjects MODIFY(OKVED2 NOT NULL)
/

-- #########################################################
-- #########################################################
-- Add_Tender_RealID_trig_Drop.sql
-- #########################################################
-- #########################################################


alter trigger TR_TENDERCAPTION_II DISABLE
/

alter trigger TR_AGREEMENTS_II DISABLE
/

alter trigger TR_TENDEROBJECTS_BI DISABLE
/


-- <TRANS_IGNORE>
BEGIN
   EXECUTE IMMEDIATE 'alter table TB_tendercaption DROP CONSTRAINT tendercaption_realid_unique';
EXCEPTION
   WHEN OTHERS THEN NULL;
END;
/


-- <TRANS_IGNORE>
BEGIN
   EXECUTE IMMEDIATE 'alter table TB_agreements DROP CONSTRAINT agreements_realid_unique';
EXCEPTION
   WHEN OTHERS THEN NULL;
END;
/

-- <TRANS_IGNORE>
BEGIN
   EXECUTE IMMEDIATE 'alter table tenderobjects DROP CONSTRAINT tenderobjects_realid_unique';
EXCEPTION
   WHEN OTHERS THEN NULL;
END;
/

alter trigger TR_TENDERCAPTION_II ENABLE
/

alter trigger TR_AGREEMENTS_II ENABLE
/

alter trigger TR_TENDEROBJECTS_BI ENABLE
/

commit work 
/



-- #########################################################
-- #########################################################
-- Add_Tender_RealID_trig.sql
-- #########################################################
-- #########################################################

create table temp_double_realid (
  id NUMBER(10),
    CHECK((id<=2147483647)AND(id>-2147483648))
)
/

insert into temp_double_realid
(id)
  select t1.id
  from agreements t1
  inner join (
      select min(ID) as minid, RealID as rid  from agreements
      group by RealID
      having Count(RealID) > 1
    ) t2 on t1.RealID = t2.rid
  where  t1.ID <> t2.minid
/
insert into temp_double_realid
(id)
  select t1.id
  from tendercaption t1
  inner join (
      select min(ID) as minid, RealID as rid  from tendercaption
      group by RealID
      having Count(RealID) > 1
    ) t2 on t1.RealID = t2.rid
  where  t1.ID <> t2.minid
/
insert into temp_double_realid
(id)
  select t1.id
  from tenderobjects t1
  inner join (
      select min(ID) as minid, RealID as rid  from tenderobjects
      group by RealID
      having Count(RealID) > 1
    ) t2 on t1.RealID = t2.rid
  where  t1.ID <> t2.minid
/
update agreements
set RealID = ID
where (RealID is null) or (ID in (
  select id
  from temp_double_realid
))
/

update tendercaption
set RealID = ID
where (RealID is null) or (ID in (
  select id
  from temp_double_realid
))
/

update tenderobjects
set RealID = ID
where (RealID is null) or (ID in (
  select id
  from temp_double_realid
))
/
drop table temp_double_realid
/
-- CREATE TRIGGER tendercaption_realid_bi_600
CREATE OR REPLACE TRIGGER TR_TENDERCAPTION_II
  INSTEAD OF INSERT
  ON TENDERCAPTION
  FOR EACH ROW
DECLARE
  new$ID TENDERCAPTION.ID%TYPE := :NEW.ID;
  new$BUDGETREF TENDERCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$FACIALACCCLS TENDERCAPTION.FACIALACCCLS%TYPE := :NEW.FACIALACCCLS;
  new$MULTIPURPOSE TENDERCAPTION.MULTIPURPOSE%TYPE := :NEW.MULTIPURPOSE;
  new$DOCUMENTDATE TENDERCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE TENDERCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$PERIOD TENDERCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$ACCEPTSUMMA TENDERCAPTION.ACCEPTSUMMA%TYPE := :NEW.ACCEPTSUMMA;
  new$SALETYPE TENDERCAPTION.SALETYPE%TYPE := :NEW.SALETYPE;
  new$REJECTCLS TENDERCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE TENDERCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS TENDERCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID TENDERCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID TENDERCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DOCSTATEREF TENDERCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CREATERUSER TENDERCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE TENDERCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE TENDERCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER TENDERCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$LASTADJUSTMENT TENDERCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$LASTACCEPTED TENDERCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$ADJUSTMENTREF TENDERCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ACCEPTED TENDERCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$EXPORTDATE TENDERCAPTION.EXPORTDATE%TYPE := :NEW.EXPORTDATE;
  new$YEARACCEPTSUMMA TENDERCAPTION.YEARACCEPTSUMMA%TYPE := :NEW.YEARACCEPTSUMMA;
  new$TENDEROPTION TENDERCAPTION.TENDEROPTION%TYPE := :NEW.TENDEROPTION;
  new$TENDERTARGET TENDERCAPTION.TENDERTARGET%TYPE := :NEW.TENDERTARGET;
  new$RVERSION TENDERCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$ALLOWANCE TENDERCAPTION.ALLOWANCE%TYPE := :NEW.ALLOWANCE;
  new$REFINEMENTCAUSE TENDERCAPTION.REFINEMENTCAUSE%TYPE := :NEW.REFINEMENTCAUSE;
  new$PREFERENCE TENDERCAPTION.PREFERENCE%TYPE := :NEW.PREFERENCE;
  new$PREFERENCESIZE TENDERCAPTION.PREFERENCESIZE%TYPE := :NEW.PREFERENCESIZE;
  new$SECURITY TENDERCAPTION.SECURITY%TYPE := :NEW.SECURITY;
  new$UNKNOWNAMOUNT TENDERCAPTION.UNKNOWNAMOUNT%TYPE := :NEW.UNKNOWNAMOUNT;
  new$PERIODYEAR TENDERCAPTION.PERIODYEAR%TYPE := :NEW.PERIODYEAR;
  new$SUPPORTUNDERTAKER TENDERCAPTION.SUPPORTUNDERTAKER%TYPE := :NEW.SUPPORTUNDERTAKER;
  new$AYEAR TENDERCAPTION.AYEAR%TYPE := :NEW.AYEAR;
  new$REWORKCAUSE TENDERCAPTION.REWORKCAUSE%TYPE := :NEW.REWORKCAUSE;
  new$NOTE TENDERCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$REALID TENDERCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER TENDERCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTNUMBER TENDERCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$SENDERIDKEY TENDERCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY TENDERCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$PROTOCOLREASON TENDERCAPTION.PROTOCOLREASON%TYPE := :NEW.PROTOCOLREASON;
  new$PROGINDEX TENDERCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$DOCNUMBER TENDERCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SECURITYTSIZE TENDERCAPTION.SECURITYTSIZE%TYPE := :NEW.SECURITYTSIZE;
  new$SECURITYASIZE TENDERCAPTION.SECURITYASIZE%TYPE := :NEW.SECURITYASIZE;
  new$AVANSSIZE TENDERCAPTION.AVANSSIZE%TYPE := :NEW.AVANSSIZE;
  new$PREFERENCECRIPPLE TENDERCAPTION.PREFERENCECRIPPLE%TYPE := :NEW.PREFERENCECRIPPLE;
  new$PREFERENCERUSPRODUCT TENDERCAPTION.PREFERENCERUSPRODUCT%TYPE := :NEW.PREFERENCERUSPRODUCT;
  new$PREFERENCEPRISON TENDERCAPTION.PREFERENCEPRISON%TYPE := :NEW.PREFERENCEPRISON;
  new$PURCHASESOCIALNKO TENDERCAPTION.PURCHASESOCIALNKO%TYPE := :NEW.PURCHASESOCIALNKO;
  new$AGREEMENTEXECUTIONDATE TENDERCAPTION.AGREEMENTEXECUTIONDATE%TYPE := :NEW.AGREEMENTEXECUTIONDATE;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  CurVal$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_TENDERCAPTION_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$FacialAccCls is null) then 
    new$FacialAccCls := 0;
  END IF;
  /* задействовано в качестве Основания по закону в планах (Новый Уренгой) */
  if (new$ProgIndex = 230 and new$Multipurpose is null) then 
    new$Multipurpose := 0;
  END IF;
  if (new$AcceptSumma is null) then 
    new$AcceptSumma := 0;
  END IF;
  if (new$YearAcceptSumma is null) then 
    new$YearAcceptSumma := 0;
  END IF;
  if (new$Allowance is null) then 
    new$Allowance := 0;
  END IF;
      
  /* Заполнение Бюджета. Если пустой или ноль, берем из лицевого счета */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    BEGIN
      select fa.BudgetRef       into new$BudgetRef from FacialAcc_Cls fa
      where fa.Id = new$FacialAccCls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    GetIntConst(-1,3,new$BudgetRef);
  END IF;
      
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$SaleType is null) then 
    new$SaleType := 0;
  END IF;
  if (new$TenderOption is null) then 
    new$TenderOption := 0;
  END IF;
  if (new$InnerNumber is Null) then 
    new$InnerNumber := GEN_ID('G_TenderInnerNumber',1);
  END IF;
  if (new$RefinementCause is Null) then 
    new$RefinementCause := 0;
  END IF;
  if (new$Preference is Null) then 
    new$Preference := 0;
  END IF;
  if (new$UnknownAmount is null) then 
    new$UnknownAmount := 0;
  END IF;
  if (new$SupportUndertaker is null) then 
    new$SupportUndertaker := 0;
  END IF;
  if (new$PurchaseSocialNKO is null) then 
    new$PurchaseSocialNKO := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_TENDERCAPTION_BI_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* только для работы без состояний, так как при работе по схеме причину отклонения могут заполнить еще в не отклоненном документе */
  if (new$DocStateRef is null) then
    if (new$AcceptDate is null or new$RejectCls is null) then
      new$Accepted := 1;
          
    else
      new$Accepted := 0;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_TENDERCAPTION_BI_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
      
  /* Проверка указания внутренних номеров.*/
  if (new$InnerNumber is null) then
    RaiseException('EX_Ten_InnerNumsIsNull');
  END IF;
      
  /* Получение внутреннего номера уточнения*/  
  select max(AdjustmentNumber)
  into Tmp$         from TenderCaption 
  where (InnerNumber = new$InnerNumber)
  ;
  /* Если это первая запись в цепочке, тогда устанавливаем 0*/   
  if (Tmp$ is null) then
    new$AdjustmentNumber := 0;
        
  else
    new$AdjustmentNumber := Tmp$ + 1;    
  END IF;
      
  /* Флаг последнего уточнения устанавливается в единицу при вставке, только если уточнение не отклонено*/
  if ((new$Accepted = 0) and (new$AcceptDate is not null)) then
    new$LastAdjustment := 0;
        
  else
    new$LastAdjustment := 1;
  END IF;
      
  /* Если документ принят, тогда устанавливаем флаг последнего принятого в цепочке*/
  if ((new$AcceptDate is not null) and (new$Accepted = 1)) then 
    new$LastAccepted := 1;
        
  else
    new$LastAccepted := 0;
  END IF;
          
  /* Если документ является уточнением*/
  if (new$AdjustmentNumber > 0) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID) 
    into Tmp$, AdjID$             from TenderCaption 
    where (InnerNumber = new$InnerNumber) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/    
    if (Tmp$ <> 1) then 
      RaiseException('EX_Ten_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID) 
    into Tmp$             from TenderCaption
    where (InnerNumber = new$InnerNumber) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then 
      RaiseException('EX_Ten_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/        
    new$AdjustmentRef := AdjID$;
        
  else /* Если договор не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/        
    new$AdjustmentRef := null;
        
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (TR_TENDERCAPTION_BI_40)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$senderId is null) then 
    new$senderIdKey := -1;
      
  else 
    new$senderIdKey := new$senderId;
  END IF;
  if (new$SenderRecordID is null) then
    new$SenderRecordIDKey := new$ID;
      
  else 
    new$SenderRecordIDKey := new$SenderRecordID;
  END IF;

-- - - - - - - - - - - - -
-- BI_50 (TR_TENDERCAPTION_BI_50)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  if (new$InnerNumber is not null) then
    CurVal$ := GEN_ID('G_TENDERINNERNUMBER',0);
    if (CurVal$ < new$InnerNumber) then
      CurVal$ := GEN_ID('G_TENDERINNERNUMBER',new$InnerNumber - CurVal$);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_TENDERCAPTION_BI_500)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- BI_600 (tendercaption_realid_bi_600)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$realid is null) then 
    new$realid := new$id;
  END IF;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_TENDERCAPTION (
    ID,
    BUDGETREF,
    FACIALACCCLS,
    MULTIPURPOSE,
    DOCUMENTDATE,
    ACCEPTDATE,
    PERIOD,
    ACCEPTSUMMA,
    SALETYPE,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    DOCSTATEREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    LASTADJUSTMENT,
    LASTACCEPTED,
    ADJUSTMENTREF,
    ACCEPTED,
    EXPORTDATE,
    YEARACCEPTSUMMA,
    TENDEROPTION,
    TENDERTARGET,
    RVERSION,
    ALLOWANCE,
    REFINEMENTCAUSE,
    PREFERENCE,
    PREFERENCESIZE,
    SECURITY,
    UNKNOWNAMOUNT,
    PERIODYEAR,
    SUPPORTUNDERTAKER,
    AYEAR,
    REWORKCAUSE,
    NOTE,
    REALID,
    INNERNUMBER,
    ADJUSTMENTNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    PROTOCOLREASON,
    PROGINDEX,
    DOCNUMBER,
    SECURITYTSIZE,
    SECURITYASIZE,
    AVANSSIZE,
    PREFERENCECRIPPLE,
    PREFERENCERUSPRODUCT,
    PREFERENCEPRISON,
    PURCHASESOCIALNKO,
    AGREEMENTEXECUTIONDATE
  ) VALUES (
    new$ID,
    new$BUDGETREF,
    new$FACIALACCCLS,
    new$MULTIPURPOSE,
    new$DOCUMENTDATE,
    new$ACCEPTDATE,
    new$PERIOD,
    new$ACCEPTSUMMA,
    new$SALETYPE,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$DOCSTATEREF,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$LASTADJUSTMENT,
    new$LASTACCEPTED,
    new$ADJUSTMENTREF,
    new$ACCEPTED,
    new$EXPORTDATE,
    new$YEARACCEPTSUMMA,
    new$TENDEROPTION,
    new$TENDERTARGET,
    new$RVERSION,
    new$ALLOWANCE,
    new$REFINEMENTCAUSE,
    new$PREFERENCE,
    new$PREFERENCESIZE,
    new$SECURITY,
    new$UNKNOWNAMOUNT,
    new$PERIODYEAR,
    new$SUPPORTUNDERTAKER,
    new$AYEAR,
    new$REWORKCAUSE,
    new$NOTE,
    new$REALID,
    new$INNERNUMBER,
    new$ADJUSTMENTNUMBER,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$PROTOCOLREASON,
    new$PROGINDEX,
    new$DOCNUMBER,
    new$SECURITYTSIZE,
    new$SECURITYASIZE,
    new$AVANSSIZE,
    new$PREFERENCECRIPPLE,
    new$PREFERENCERUSPRODUCT,
    new$PREFERENCEPRISON,
    new$PURCHASESOCIALNKO,
    new$AGREEMENTEXECUTIONDATE);

-- - - - - - - - - - - - -
-- AI_10 (TR_TENDERCAPTION_AI_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Коррекция вспомогательных флагов в уточняемой записи*/
  if ((new$AdjustmentNumber > 0) and (new$LastAdjustment = 1)) then
    update TenderCaption set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);            
    if (new$LastAccepted = 1) then
      update TenderCaption set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_TENDERCAPTION_AI_500)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

   DELETE FROM delrecindexes
         WHERE (tableid = 139) AND (recordid = new$ID);

END;
/
ALTER TABLE TB_tendercaption ADD (
  CONSTRAINT tendercaption_realid_unique UNIQUE (realid)
)
/
-- CREATE TRIGGER agreements_realid_bi_600
CREATE OR REPLACE TRIGGER TR_AGREEMENTS_II
  INSTEAD OF INSERT
  ON AGREEMENTS
  FOR EACH ROW
DECLARE
  new$ID AGREEMENTS.ID%TYPE := :NEW.ID;
  new$SUMMA AGREEMENTS.SUMMA%TYPE := :NEW.SUMMA;
  new$AGREEMENTDATE AGREEMENTS.AGREEMENTDATE%TYPE := :NEW.AGREEMENTDATE;
  new$AGREEMENTENDDATE AGREEMENTS.AGREEMENTENDDATE%TYPE := :NEW.AGREEMENTENDDATE;
  new$EXECUTER_REF AGREEMENTS.EXECUTER_REF%TYPE := :NEW.EXECUTER_REF;
  new$CLIENT_REF AGREEMENTS.CLIENT_REF%TYPE := :NEW.CLIENT_REF;
  new$FACIALACC_CLS AGREEMENTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$AGREEMENTTYPE AGREEMENTS.AGREEMENTTYPE%TYPE := :NEW.AGREEMENTTYPE;
  new$ACCEPTED AGREEMENTS.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$ACCEPTDATE AGREEMENTS.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$CARDADVANCEPERCENT AGREEMENTS.CARDADVANCEPERCENT%TYPE := :NEW.CARDADVANCEPERCENT;
  new$CARDADVANCE AGREEMENTS.CARDADVANCE%TYPE := :NEW.CARDADVANCE;
  new$CLOSEDOC AGREEMENTS.CLOSEDOC%TYPE := :NEW.CLOSEDOC;
  new$CREATERUSER AGREEMENTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE AGREEMENTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE AGREEMENTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER AGREEMENTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF AGREEMENTS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$LASTADJUSTMENT AGREEMENTS.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$LASTACCEPTED AGREEMENTS.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$FACT AGREEMENTS.FACT%TYPE := :NEW.FACT;
  new$REGION AGREEMENTS.REGION%TYPE := :NEW.REGION;
  new$CLOSEDATE AGREEMENTS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$DELIVERYRULES AGREEMENTS.DELIVERYRULES%TYPE := :NEW.DELIVERYRULES;
  new$AGREEMENTSUMMA AGREEMENTS.AGREEMENTSUMMA%TYPE := :NEW.AGREEMENTSUMMA;
  new$AGREEMENTFINSUMMA AGREEMENTS.AGREEMENTFINSUMMA%TYPE := :NEW.AGREEMENTFINSUMMA;
  new$ADJUSTMENTREF AGREEMENTS.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$REESTRNUMBER AGREEMENTS.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$PAYMENTDATE AGREEMENTS.PAYMENTDATE%TYPE := :NEW.PAYMENTDATE;
  new$AGREEMENTCARDADVANCE AGREEMENTS.AGREEMENTCARDADVANCE%TYPE := :NEW.AGREEMENTCARDADVANCE;
  new$FINCARDADVANCE AGREEMENTS.FINCARDADVANCE%TYPE := :NEW.FINCARDADVANCE;
  new$STATEORDERREF AGREEMENTS.STATEORDERREF%TYPE := :NEW.STATEORDERREF;
  new$REJECTCLS AGREEMENTS.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE AGREEMENTS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS AGREEMENTS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID AGREEMENTS.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID AGREEMENTS.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$AGREEMENTBEGINDATE AGREEMENTS.AGREEMENTBEGINDATE%TYPE := :NEW.AGREEMENTBEGINDATE;
  new$PROTOCOLNUMBER AGREEMENTS.PROTOCOLNUMBER%TYPE := :NEW.PROTOCOLNUMBER;
  new$PROTOCOLDATE AGREEMENTS.PROTOCOLDATE%TYPE := :NEW.PROTOCOLDATE;
  new$REVIEWNOTE AGREEMENTS.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF AGREEMENTS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION AGREEMENTS.RVERSION%TYPE := :NEW.RVERSION;
  new$EXPORTDATE AGREEMENTS.EXPORTDATE%TYPE := :NEW.EXPORTDATE;
  new$FSORGAN AGREEMENTS.FSORGAN%TYPE := :NEW.FSORGAN;
  new$FSBUDGETNAME AGREEMENTS.FSBUDGETNAME%TYPE := :NEW.FSBUDGETNAME;
  new$FSOFFBUDGET AGREEMENTS.FSOFFBUDGET%TYPE := :NEW.FSOFFBUDGET;
  new$RNYEAR AGREEMENTS.RNYEAR%TYPE := :NEW.RNYEAR;
  new$RNNUMBER AGREEMENTS.RNNUMBER%TYPE := :NEW.RNNUMBER;
  new$RNDATE AGREEMENTS.RNDATE%TYPE := :NEW.RNDATE;
  new$PROTOCOLNOTICE AGREEMENTS.PROTOCOLNOTICE%TYPE := :NEW.PROTOCOLNOTICE;
  new$PROTOCOLRESULTDATE AGREEMENTS.PROTOCOLRESULTDATE%TYPE := :NEW.PROTOCOLRESULTDATE;
  new$PROTOCOLDOCTYPE AGREEMENTS.PROTOCOLDOCTYPE%TYPE := :NEW.PROTOCOLDOCTYPE;
  new$PROTOCOLSALETYPE AGREEMENTS.PROTOCOLSALETYPE%TYPE := :NEW.PROTOCOLSALETYPE;
  new$NOTIFYDATE AGREEMENTS.NOTIFYDATE%TYPE := :NEW.NOTIFYDATE;
  new$EXECUTERACCREF AGREEMENTS.EXECUTERACCREF%TYPE := :NEW.EXECUTERACCREF;
  new$DOCBASEDATE AGREEMENTS.DOCBASEDATE%TYPE := :NEW.DOCBASEDATE;
  new$DOCBASENOTIFYDATE AGREEMENTS.DOCBASENOTIFYDATE%TYPE := :NEW.DOCBASENOTIFYDATE;
  new$DOCBASETEXT AGREEMENTS.DOCBASETEXT%TYPE := :NEW.DOCBASETEXT;
  new$DOCBASETYPE AGREEMENTS.DOCBASETYPE%TYPE := :NEW.DOCBASETYPE;
  new$DOCBASESUMMA AGREEMENTS.DOCBASESUMMA%TYPE := :NEW.DOCBASESUMMA;
  new$UNKNOWNAMOUNT AGREEMENTS.UNKNOWNAMOUNT%TYPE := :NEW.UNKNOWNAMOUNT;
  new$PROTOCOLREASON AGREEMENTS.PROTOCOLREASON%TYPE := :NEW.PROTOCOLREASON;
  new$DOCNUMBER AGREEMENTS.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$ADJUSTMENTDOCNUMBER AGREEMENTS.ADJUSTMENTDOCNUMBER%TYPE := :NEW.ADJUSTMENTDOCNUMBER;
  new$OLDDOCNUMBER AGREEMENTS.OLDDOCNUMBER%TYPE := :NEW.OLDDOCNUMBER;
  new$LOTMAXSUM AGREEMENTS.LOTMAXSUM%TYPE := :NEW.LOTMAXSUM;
  new$CLIENT_INN AGREEMENTS.CLIENT_INN%TYPE := :NEW.CLIENT_INN;
  new$CLIENT_INN20 AGREEMENTS.CLIENT_INN20%TYPE := :NEW.CLIENT_INN20;
  new$CLIENT_NAME AGREEMENTS.CLIENT_NAME%TYPE := :NEW.CLIENT_NAME;
  new$EXECUTER_INN AGREEMENTS.EXECUTER_INN%TYPE := :NEW.EXECUTER_INN;
  new$EXECUTER_INN20 AGREEMENTS.EXECUTER_INN20%TYPE := :NEW.EXECUTER_INN20;
  new$EXECUTER_NAME AGREEMENTS.EXECUTER_NAME%TYPE := :NEW.EXECUTER_NAME;
  new$EXECUTER_STATUS AGREEMENTS.EXECUTER_STATUS%TYPE := :NEW.EXECUTER_STATUS;
  new$EXECUTER_COUNTRY AGREEMENTS.EXECUTER_COUNTRY%TYPE := :NEW.EXECUTER_COUNTRY;
  new$EXECUTER_ADDRESS AGREEMENTS.EXECUTER_ADDRESS%TYPE := :NEW.EXECUTER_ADDRESS;
  new$EXECUTER_PHONE AGREEMENTS.EXECUTER_PHONE%TYPE := :NEW.EXECUTER_PHONE;
  new$REALID AGREEMENTS.REALID%TYPE := :NEW.REALID;
  new$ADJUSTMENTNUMBER AGREEMENTS.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$INNERNUMBER AGREEMENTS.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$SENDERIDKEY AGREEMENTS.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY AGREEMENTS.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REESTRVERSION AGREEMENTS.REESTRVERSION%TYPE := :NEW.REESTRVERSION;
  new$DOCTYPE AGREEMENTS.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$RNCLIENTID AGREEMENTS.RNCLIENTID%TYPE := :NEW.RNCLIENTID;
  new$INFONUMBER AGREEMENTS.INFONUMBER%TYPE := :NEW.INFONUMBER;
  new$STATEORDERINNERNUMBER AGREEMENTS.STATEORDERINNERNUMBER%TYPE := :NEW.STATEORDERINNERNUMBER;
  new$PROGINDEX AGREEMENTS.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$NOTE AGREEMENTS.NOTE%TYPE := :NEW.NOTE;
  new$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  new$REESTRRECORDNUMBER AGREEMENTS.REESTRRECORDNUMBER%TYPE := :NEW.REESTRRECORDNUMBER;
--
  tmp$ NUMBER (10);
  adjid$ NUMBER (10);
  adjdocnum$ tb_agreements.docnumber%TYPE;
  CurVal$ NUMBER (10);
  CountAcc$ NUMBER(10);
  rnClientID1$ VARCHAR2(15);
  rnYear1$ VARCHAR2(15);
  rnNumber1$ VARCHAR2(15);
  ReestrVersion1$ VARCHAR2(15);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_AGREEMENTS_BI)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 3.1.2*/
  /* установка значений полей по-умолчанию*/
  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$CardAdvancePercent is null) then 
    new$CardAdvancePercent := 0;
  END IF;
  if (new$CardAdvance is null) then 
    new$CardAdvance := 0;
  END IF;
  if (new$AgreementCardAdvance is null) then 
    new$AgreementCardAdvance := 0;
  END IF;
  if (new$FinCardAdvance is null) then 
    new$FinCardAdvance := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$AgreementSumma is null) then 
    new$AgreementSumma := 0;
  END IF;
  if (new$AgreementFinSumma is null) then 
    new$AgreementFinSumma := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$UnknownAmount is null) then 
    new$UnknownAmount := 0;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$client_ref is null) then 
    new$client_ref := 0;
  END IF;
    
  /* Заполнение Бюджета. Если пустой или ноль, берем из лицевого счета */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    BEGIN
      select fa.BudgetRef     into new$BudgetRef from FacialAcc_Cls fa
      where fa.Id = new$FacialAcc_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) 
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
    
  /* У ГосКонтракта своя нумерация 
     и если у договора как-то не заполнили InnerNumber*/
  if (((new$ProgIndex = 305) or (new$ProgIndex = 304) or (new$ProgIndex = 314)) and (new$InnerNumber is null)) then
    new$InnerNumber := GEN_ID('G_AgreementNumber',1);
  END IF;
  /* тип документа */
  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  /* заполнение номера цепочки гос. контракта */
    
  new$stateorderinnernumber := null;
  if (new$stateorderref is not null) then
    BEGIN
      select
      innernumber
      into new$stateorderinnernumber     from agreements
      where
      id = new$stateorderref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_AGREEMENTS_BI_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* только для работы без состояний, так как при работе по схеме причину отклонения могут заполнить еще в не отклоненном документе */
  if (new$DocStateRef is null) then
    if (new$AcceptDate is null or new$RejectCls is null) then
      new$Accepted := 1;
          
    else
      new$Accepted := 0;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_AGREEMENTS_BI_10)
-- Last update 08.02.2010
-- - - - - - - - - - - - -

/*Версия триггера 5.0*/

    /*Проверка указания внутренних номеров.*/
    if (new$InnerNumber is null) then
        RaiseException('EX_AGR_InnerNumsIsNull');
    end if;
    /*Получение внутреннего номера уточнения*/
    select max(AdjustmentNumber) into Tmp$
        from Agreements
        where (InnerNumber = new$InnerNumber);
        
    /*Если это первая запись в цепочке, тогда устанавливаем 0*/
    if (Tmp$ is null) then
        new$AdjustmentNumber := 0;
    else
        new$AdjustmentNumber := Tmp$ + 1;
    end if;    

    /*Проверка соответствия значения номера уточнения и типа соглашения*/
    if (((new$AgreementType = 0) and (new$AdjustmentNumber > 0)) or
        ((new$AgreementType = 1) and (new$AdjustmentNumber = 0))) then
        RaiseException('EX_AGR_AgrTypeViolation');
    end if;    

    /*Флаг последнего уточнения устанавливается в единицу при вставке, только если уточнение не отклонено*/
    if ((new$Accepted = 0) and (new$AcceptDate is not null)) then
        new$LastAdjustment := 0;
    else
        new$LastAdjustment := 1;
    end if;    

    /*Если договор принят, тогда устанавливаем флаг последнего принятого в цепочке*/
    if ((new$AcceptDate is not null) and (new$Accepted = 1)) then
        new$LastAccepted := 1;
    else
        new$LastAccepted := 0;
    end if;    



    /*Если договор является уточнением*/
    if (new$AdjustmentNumber > 0) then
        /*Получаем последний принятый в цепочке - он должен быть один*/
        select count(ID), max(ID), max(DocNumber)
            into Tmp$, AdjID$, AdjDocNum$
            from Agreements
            where (InnerNumber = new$InnerNumber) and (LastAccepted = 1);
            
        /*Если не один, тогда ругаемся*/
        if (Tmp$ <> 1) then
            RaiseException('EX_AGR_AdjustNotAccept');
        end if;    
        /*Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
        select count(ID) into Tmp$
            from Agreements
            where (InnerNumber = new$InnerNumber) and (AcceptDate is null) and ROWNUM = 1;
        if (Tmp$ > 0) then
           RaiseException('EX_AGR_AdjustDuplicate');
        end if;   
        /*Теперь, когда все в порядке, можно настроить все ссылочки*/
        new$AdjustmentRef := AdjID$;
        new$AdjustmentDocNumber := AdjDocNum$;
    else /*Если договор не является уточнением*/
        /*Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/
        new$AdjustmentRef := null;
        new$AdjustmentDocNumber := null;
    end if;

-- - - - - - - - - - - - -
-- BI_20 (TR_AGREEMENTS_BI_20)
-- Create 21.05.2009
-- - - - - - - - - - - - -

  /*Нужно подтянуть атрибуты организации-заказчика, если этого не было сделано*/
  if ((new$Client_INN   is null) and
      (new$Client_INN20 is null) and
      (new$Client_Name  is null))then
    BEGIN  
      select
        o.INN,
        o.INN20,
        o.Name
      into
        new$Client_INN,
        new$Client_INN20,
        new$Client_Name
      from Organizations o
      where o.Id=new$Client_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        new$Client_INN := NULL;
        new$Client_INN20 := NULL;
        new$Client_Name := NULL;
    END;
  END IF;
    
  /*Нужно подтянуть атрибуты организации-исполнителя, если этого не было сделано*/
  if ((new$Executer_INN     is null) and
      (new$Executer_INN20   is null) and
      (new$Executer_Name    is null) and
      (new$Executer_Status  is null) and
      (new$Executer_Country is null) and
      (new$Executer_Address is null) and
      (new$Executer_Phone   is null))then
    BEGIN    
      select
        o.INN,
        o.INN20,
        o.Name,
        o.SupplierStatus,
        o.Country,
        o.Address,
        o.Phone
      into
        new$Executer_INN,
        new$Executer_INN20,
        new$Executer_Name,
        new$Executer_Status,
        new$Executer_Country,
        new$Executer_Address,
        new$Executer_Phone
      from Organizations o
      where o.Id=new$Executer_Ref;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        new$Executer_INN := NULL;
        new$Executer_INN20 := NULL;
        new$Executer_Name := NULL;
        new$Executer_Status := NULL;
        new$Executer_Country := NULL;
        new$Executer_Address := NULL;
        new$Executer_Phone := NULL;
    END; 
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (TR_AGREEMENTS_BI_40)
-- Create 06.08.2010
-- - - - - - - - - - - - -

  /*автозаполнение полей информации о строке в УРМ*/
  if (new$senderId is null) then 
    new$senderIdKey := -1;
  else
    new$senderIdKey := new$senderId;
  end if;

  if (new$SenderRecordID is null)then
    new$SenderRecordIDKey := new$ID;
  else
    new$SenderRecordIDKey := new$SenderRecordID;
  end if;       

-- - - - - - - - - - - - -
-- BI_50 (TR_AGREEMENTS_BI_50)
-- Create 06.08.2010
-- - - - - - - - - - - - -

    if (new$InnerNumber is not null) then
        CurVal$ := gen_id('G_AgreementNumber', 0);
        if (CurVal$ < new$InnerNumber) then
          CurVal$ := gen_id('G_AgreementNumber', new$InnerNumber - CurVal$);
        end if;  
    end if;

-- - - - - - - - - - - - -
-- BI_300 (tr_agreements_bi_300)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$ExecuterAccRef is not null) then
    select count(ID)
    into CountAcc$     from org_accounts oa
    where oa.id = new$ExecuterAccRef and oa.Org_ref = new$Executer_Ref
    ;
    if (CountAcc$ = 0) then
      RaiseException('EX_AGR_ACCORGCHECK');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_400 (TR_AGREEMENTS_BI_400)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if ((new$rnClientID is not null) and (new$rnYear is not null) and (new$rnNumber is not null)) then

    rnClientID1$ := new$rnClientID;
    rnYear1$ := new$rnYear;
    rnNumber1$ := new$rnNumber;
    ReestrVersion1$ := new$ReestrVersion;
    while (LENGTH(rnClientID1$) < 11) LOOP
      rnClientID1$ := '0' || rnClientID1$;
    END LOOP;
    while (LENGTH(rnNumber1$) < 6) LOOP
      rnNumber1$ := '0' || rnNumber1$;
    END LOOP;
    if (LENGTH(ReestrVersion1$) < 2) then
      ReestrVersion1$ := '0' || ReestrVersion1$;
    END IF;
    /* Вычисление ReestrRecordNumber*/
    if (new$ReestrVersion is null) then
      new$ReestrRecordNumber := rnClientID1$ || rnYear1$ || rnNumber1$;
          
    else
      new$ReestrRecordNumber := rnClientID1$ || rnYear1$ || rnNumber1$ || ReestrVersion1$;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_AGREEMENTS_BI_500)
-- Last update 19.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- BI_600 (agreements_realid_bi_600)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$realid is null) then 
    new$realid := new$id;
  END IF;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_AGREEMENTS (
    ID,
    SUMMA,
    AGREEMENTDATE,
    AGREEMENTENDDATE,
    EXECUTER_REF,
    CLIENT_REF,
    FACIALACC_CLS,
    AGREEMENTTYPE,
    ACCEPTED,
    ACCEPTDATE,
    CARDADVANCEPERCENT,
    CARDADVANCE,
    CLOSEDOC,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    LASTADJUSTMENT,
    LASTACCEPTED,
    FACT,
    REGION,
    CLOSEDATE,
    DELIVERYRULES,
    AGREEMENTSUMMA,
    AGREEMENTFINSUMMA,
    ADJUSTMENTREF,
    REESTRNUMBER,
    PAYMENTDATE,
    AGREEMENTCARDADVANCE,
    FINCARDADVANCE,
    STATEORDERREF,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    AGREEMENTBEGINDATE,
    PROTOCOLNUMBER,
    PROTOCOLDATE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXPORTDATE,
    FSORGAN,
    FSBUDGETNAME,
    FSOFFBUDGET,
    RNYEAR,
    RNNUMBER,
    RNDATE,
    PROTOCOLNOTICE,
    PROTOCOLRESULTDATE,
    PROTOCOLDOCTYPE,
    PROTOCOLSALETYPE,
    NOTIFYDATE,
    EXECUTERACCREF,
    DOCBASEDATE,
    DOCBASENOTIFYDATE,
    DOCBASETEXT,
    DOCBASETYPE,
    DOCBASESUMMA,
    UNKNOWNAMOUNT,
    PROTOCOLREASON,
    DOCNUMBER,
    ADJUSTMENTDOCNUMBER,
    OLDDOCNUMBER,
    LOTMAXSUM,
    CLIENT_INN,
    CLIENT_INN20,
    CLIENT_NAME,
    EXECUTER_INN,
    EXECUTER_INN20,
    EXECUTER_NAME,
    EXECUTER_STATUS,
    EXECUTER_COUNTRY,
    EXECUTER_ADDRESS,
    EXECUTER_PHONE,
    REALID,
    ADJUSTMENTNUMBER,
    INNERNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REESTRVERSION,
    DOCTYPE,
    RNCLIENTID,
    INFONUMBER,
    STATEORDERINNERNUMBER,
    PROGINDEX,
    NOTE,
    PURPORTDOC,
    REESTRRECORDNUMBER
  ) VALUES (
    new$ID,
    new$SUMMA,
    new$AGREEMENTDATE,
    new$AGREEMENTENDDATE,
    new$EXECUTER_REF,
    new$CLIENT_REF,
    new$FACIALACC_CLS,
    new$AGREEMENTTYPE,
    new$ACCEPTED,
    new$ACCEPTDATE,
    new$CARDADVANCEPERCENT,
    new$CARDADVANCE,
    new$CLOSEDOC,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$LASTADJUSTMENT,
    new$LASTACCEPTED,
    new$FACT,
    new$REGION,
    new$CLOSEDATE,
    new$DELIVERYRULES,
    new$AGREEMENTSUMMA,
    new$AGREEMENTFINSUMMA,
    new$ADJUSTMENTREF,
    new$REESTRNUMBER,
    new$PAYMENTDATE,
    new$AGREEMENTCARDADVANCE,
    new$FINCARDADVANCE,
    new$STATEORDERREF,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$AGREEMENTBEGINDATE,
    new$PROTOCOLNUMBER,
    new$PROTOCOLDATE,
    new$REVIEWNOTE,
    new$DOCSTATEREF,
    new$RVERSION,
    new$EXPORTDATE,
    new$FSORGAN,
    new$FSBUDGETNAME,
    new$FSOFFBUDGET,
    new$RNYEAR,
    new$RNNUMBER,
    new$RNDATE,
    new$PROTOCOLNOTICE,
    new$PROTOCOLRESULTDATE,
    new$PROTOCOLDOCTYPE,
    new$PROTOCOLSALETYPE,
    new$NOTIFYDATE,
    new$EXECUTERACCREF,
    new$DOCBASEDATE,
    new$DOCBASENOTIFYDATE,
    new$DOCBASETEXT,
    new$DOCBASETYPE,
    new$DOCBASESUMMA,
    new$UNKNOWNAMOUNT,
    new$PROTOCOLREASON,
    new$DOCNUMBER,
    new$ADJUSTMENTDOCNUMBER,
    new$OLDDOCNUMBER,
    new$LOTMAXSUM,
    new$CLIENT_INN,
    new$CLIENT_INN20,
    new$CLIENT_NAME,
    new$EXECUTER_INN,
    new$EXECUTER_INN20,
    new$EXECUTER_NAME,
    new$EXECUTER_STATUS,
    new$EXECUTER_COUNTRY,
    new$EXECUTER_ADDRESS,
    new$EXECUTER_PHONE,
    new$REALID,
    new$ADJUSTMENTNUMBER,
    new$INNERNUMBER,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$REESTRVERSION,
    new$DOCTYPE,
    new$RNCLIENTID,
    new$INFONUMBER,
    new$STATEORDERINNERNUMBER,
    new$PROGINDEX,
    new$NOTE,
    new$PURPORTDOC,
    new$REESTRRECORDNUMBER);

-- - - - - - - - - - - - -
-- AI_10 (TR_AGREEMENTS_AI_10)
-- Last update 05.02.2010
-- - - - - - - - - - - - -

/*Версия триггера 5.0*/
    if ((new$AdjustmentNumber > 0) and (new$LastAdjustment = 1)) then
        update Agreements set
            LastAdjustment = 0,
            RVersion = -1
        where (ID = new$AdjustmentRef);        
        if (new$LastAccepted = 1) then
            update Agreements set
                LastAccepted = 0,
                RVersion = -1
            where (ID = new$AdjustmentRef);
        end if;    
    end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_AGREEMENTS_AI_500)
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 110) AND (RecordID = new$ID);

END;
/
ALTER TABLE TB_agreements ADD (
  CONSTRAINT agreements_realid_unique UNIQUE (realid)
)
/
-- CREATE TRIGGER tenderobjects_realid_bi_600
CREATE OR REPLACE TRIGGER TR_TENDEROBJECTS_BI
  BEFORE INSERT
  ON TENDEROBJECTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_TENDEROBJECTS_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then 
    select g_shared.nextval into :new.id from dual;
  END IF;
  if (:new.OKDP is null) then 
    :new.OKDP := 0;
  END IF;
  if (:new.OKPCLS is null) then 
    :new.OKPCLS := 0;
  END IF;
  if (:new.MEASUREMENTCLS is null) then 
    :new.MEASUREMENTCLS := 0;
  END IF;
  if (:new.KESR is null) then 
    :new.KESR := 0;
  END IF;
  if (:new.FacialAccCls is null) then 
    :new.FacialAccCls := 0;    
  END IF;
  if (:new.OKPD is null) then 
    :new.OKPD := 0;
  END IF;
  if (:new.OKVED is null) then 
    :new.OKVED := 0;
  END IF;
  if (:new.OKPD2 is null) then 
    :new.OKPD2 := 0;
  END IF;
  if (:new.OKVED2 is null) then 
    :new.OKVED2 := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (TR_TENDEROBJECTS_BI_40)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (:new.senderId is null) then 
    :new.senderIdKey := -1;
      
  else 
    :new.senderIdKey := :new.senderId;
  END IF;
  if (:new.SenderRecordID is null) then
    :new.SenderRecordIDKey := :new.ID;
      
  else 
    :new.SenderRecordIDKey := :new.SenderRecordID;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_TENDEROBJECTS_BI_500)
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;
  :NEW.CreaterUser := USER;
  :NEW.UpdaterUser := USER;

-- - - - - - - - - - - - -
-- BI_600 (tenderobjects_realid_bi_600)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.realid is null) then 
    :new.realid := :new.id;
  END IF;

END;
/
ALTER TABLE tenderobjects ADD (
  CONSTRAINT tenderobjects_realid_unique UNIQUE (realid)
)
/


commit work 
/

-- #########################################################
-- #########################################################
-- Add_Const_MaxCountDocs_Udkz.sql
-- #########################################################
-- #########################################################

CALL addintconst(50, 49, 10000, 'Учет договоров\Максимальное рекомендуемое число документов обрабатываемых на интерфейсе ввода')
/
CALL addintconst(50, 50, 10000, 'Консолидация заказов\Максимальное рекомендуемое число документов обрабатываемых на интерфейсе ввода')
/
commit work
/

-- #########################################################
-- #########################################################
-- Convertation_LinkType_Ora.sql
-- #########################################################
-- #########################################################


ALTER TRIGGER TR_LINKTYPE_IU DISABLE
/

update LINKTYPE l
set l.parentdoccls = 250202, l.childdoccls=250202
where l.id in (252500100, 252500200)
/

ALTER TRIGGER TR_LINKTYPE_IU enable
/

/* Меняем тип документа для Родительских записей*/
update RecordParams rp
set rp.DocCls = 250202
where rp.id in (
  select ParentID
  from linkrecords lr
  where lr.linktyperef in (252500200, 252500100)
  )
/

/* Меняем тип документа для дочерних записей*/
update RecordParams rp
set rp.DocCls = 250202
where rp.id in (
  select ChildID
  from linkrecords lr
  where lr.linktyperef in (252500200, 252500100)
  )
/

COMMIT WORK
/


-- #########################################################
-- #########################################################
-- Alter_table_WritExecutionCaption.sql
-- #########################################################
-- #########################################################

/* Добавление в таблицу WritExecutionCaption дополнительных полей */
ALTER TABLE WritExecutionCaption ADD (
  LevierName VARCHAR2(1024),/* Наименование взыскателя (чтобы в некоторых случаях можно было заполнять вручную, а не просто выбирать из справочника) */
  NumberDepartmentCB NUMBER(10)/* номер отделения ЦБ (взыскатель может делегировать получение средств по исполнительному листу другому юридическому лицу) */,
    CHECK((NumberDepartmentCB<=2147483647)AND(NumberDepartmentCB>-2147483648))
)
/
commit work
/


-- #########################################################
-- #########################################################
-- Create_InvestObject.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет справочник объектов, предназначенный для обеспечения учета плановых и кассовых показателей в разрезе объектов и мероприятий, включенных в адресную инвестиционную программу региона, муниципалитета. 
   Далее добавляет ссылку на справочник в предметных таблицах */
Create Table InvestObject (
  id NUMBER(10) NOT NULL,
    CHECK((id<=2147483647)AND(id>-2147483648)),
  Code VARCHAR2(20) NOT NULL,
  SubCode VARCHAR2(20),/* Субкод объекта, резервное поле, по умолчанию скрыто*/
  BudgetFinSourceObjectCode VARCHAR2(20),/* Код объекта финансирующего бюджета – предназначено для указания кода объекта, присвоенного финансирующим (софинансирующим бюджетом), указанным 
                                                              в поле «Уровень источника средств»*/
  Name VARCHAR2(2000) NOT NULL,/* Полное наименование объекта */
  ShortName VARCHAR2(1024),/* Краткое наименование объекта */
  OwnerLevel NUMBER(10) NOT NULL,/* Уровень собственника объекта: 
                                                              0 - не указан
                                                              1 - собственность РФ
                                                              2 - собственность субъекта РФ
                                                              3 - собственность городского округа
                                                              4 - собственность муниципального района
                                                              5 - собственность городского или сельского поселения
                                                              6 - собственность юридических лиц
                                                              7 - иная собственность */
    CHECK((OwnerLevel<=2147483647)AND(OwnerLevel>-2147483648)),
  BudgetRef NUMBER(10) NOT NULL,/* Бюджет */
    CHECK((BudgetRef<=2147483647)AND(BudgetRef>-2147483648)),
  RegionCls NUMBER(10) NOT NULL,/* Район */
    CHECK((RegionCls<=2147483647)AND(RegionCls>-2147483648)),
  BudgetFinSourceLevel NUMBER(10) NOT NULL,/* Уровень источника средств. Определяет уровень бюджета, финансирующего (софинансирующего) объект/инвестиционный проект : 
                                                              0 - не указан
                                                              1 - Федеральный бюджет
                                                              2 - Государственные внебюджетные фонды
                                                              3 - Субъект РФ
                                                              4 - Территориальные внебюджетные фонды
                                                              5 - Городской округ
                                                              6 - Муниципальный район
                                                              7 - Городские и сельские поселения
                                                              8 - иная собственность */
    CHECK((BudgetFinSourceLevel<=2147483647)AND(BudgetFinSourceLevel>-2147483648)),
  ParentRef NUMBER(10),/* Код родительского объекта. Предназначено для определения иерархии объектов/инвестиционных проектов.*/
    CHECK((ParentRef<=2147483647)AND(ParentRef>-2147483648)),
  StartDate DATE,/* Дата начала действия - поле с датой вступления кода объекта в действие */
  DeleteDate DATE,/* Дата окончания действия - поле с датой окончания действия кода объекта */
  KVSR NUMBER(10) NOT NULL,/* предназначено для указания кода КВСР ведомства, курирующего использование средств на осуществление инвестиций (капитальных вложений) в объект/инвестиционный проект */
    CHECK((KVSR<=2147483647)AND(KVSR>-2147483648)),
  KCSR NUMBER(10) NOT NULL,/* предназначено для указания соответствующей целевой программы/подпрограммы (непрограммного направления), в рамках которой предусмотрено
                                                              финансирование объекта/инвестиционного проекта. Должна быть предусмотрена возможность указания как полного, так и обобщенного до программы или 
                                                              подпрограммы кода КЦСР */
    CHECK((KCSR<=2147483647)AND(KCSR>-2147483648)),
  TARGETCLS NUMBER(10),/* Код цели. Вероятней всего, в случае софинансирования все таки один объект будет софинансироваться по одному коду цели, 
                                                              и в тоже время по одному коду цели может финансироваться несколько объектов. Если же вдруг один объект будет финансироваться по нескольким кодам цели,
                                                              то объект придется детализировать на несколько подобъектов с одинаковым источником финансирования = «федеральный бюджет» и разными кодами цели */
    CHECK((TARGETCLS<=2147483647)AND(TARGETCLS>-2147483648)),
  Note VARCHAR2(1024),/* Примечание */
  MeansType NUMBER(10) NOT NULL,/* тип средств */
    CHECK((MeansType<=2147483647)AND(MeansType>-2147483648)),
  TransfertCLS NUMBER(10),/* Код целевых средств */
    CHECK((TransfertCLS<=2147483647)AND(TransfertCLS>-2147483648)),
  Fact NUMBER(10) NOT NULL,/* Мероприятие */
    CHECK((Fact<=2147483647)AND(Fact>-2147483648)),
  OKTMO NUMBER(10),
    CHECK((OKTMO<=2147483647)AND(OKTMO>-2147483648)),
  NPAId NUMBER(10),/* Классификатор НПА */
    CHECK((NPAId<=2147483647)AND(NPAId>-2147483648)),
  NPADate NUMBER,/* Дата НПА */
  NPANumber VARCHAR2(20),/* Номер НПА */
  NPAGroup VARCHAR2(1024),/* Группа */
  NPAName VARCHAR2(1024),/* Наименование */
  Address VARCHAR2(1024),/* Адрес */
  CreateDate DATE NOT NULL,
  UpdateDate DATE NOT NULL,
  CreaterUser VARCHAR2(30) NOT NULL,
  UpdaterUser VARCHAR2(30) NOT NULL
)
/
ALTER TABLE InvestObject ADD (
  constraint InvestObject_PK_ID primary key (id),
  constraint unq_IO_ObjectCode_Budget unique (Code , BudgetRef)
)
/
ALTER TABLE InvestObject ADD (
  constraint FK_InvestObj_KCSR foreign key (KCSR) references KCSR(ID),
  constraint FK_InvestObj_KVSR foreign key (KVSR) references KVSR(ID),
  constraint FK_InvestObj_RegionCls foreign key (RegionCls) references RegionCls(ID),
  constraint FK_InvestObj_TARGETCLS foreign key (TARGETCLS) references TARGETCLS(ID),
  constraint FK_InvestObj_MeansType foreign key (MeansType) references MeansType(ID),
  constraint FK_InvestObj_TransfertCLS foreign key (TransfertCLS) references TB_TransfertCLS(ID),
  constraint FK_InvestObj_Fact foreign key (Fact) references Fact(ID),
  constraint FK_InvestObj_OKTMO FOREIGN KEY(OKTMO) REFERENCES OKTMO (ID),
  constraint FK_InvestObj_NPAId foreign key (NPAId) references DocBase(ID),
  constraint FK_InvestObj_BUDGETREF foreign key (BudgetRef) references TB_Budgets_s(ID),
  constraint FK_InvestObj_ParentRef foreign key (ParentRef) references InvestObject(ID) 
)
/
CREATE INDEX FK_InvestObj_KCSR ON InvestObject(KCSR)
/
CREATE INDEX FK_InvestObj_KVSR ON InvestObject(KVSR)
/
CREATE INDEX FK_InvestObj_RegionCls ON InvestObject(RegionCls)
/
CREATE INDEX FK_InvestObj_TARGETCLS ON InvestObject(TARGETCLS)
/
CREATE INDEX FK_InvestObj_MeansType ON InvestObject(MeansType)
/
CREATE INDEX FK_InvestObj_TransfertCLS ON InvestObject(TransfertCLS)
/
CREATE INDEX FK_InvestObj_Fact ON InvestObject(Fact)
/
CREATE INDEX FK_InvestObj_OKTMO ON InvestObject(OKTMO)
/
CREATE INDEX FK_InvestObj_NPAId ON InvestObject(NPAId)
/
CREATE INDEX FK_InvestObj_BUDGETREF ON InvestObject(BudgetRef)
/
CREATE INDEX FK_InvestObj_ParentRef ON InvestObject(ParentRef)
/
CREATE OR REPLACE procedure GetTargetClsOnMeansType(    IdMeansType$            NUMBER,
        TargetCls$ out            NUMBER)
AS
BEGIN
  BEGIN
    select
    TargetCls
    into
    TargetCls$     from
    MeansType
    where
    (id = IdMeansType$)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
END;
/
-- CREATE TRIGGER tr_InvestObject_bi_500
CREATE OR REPLACE TRIGGER TR_InvestObject_BI
  BEFORE INSERT
  ON InvestObject
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (tr_InvestObject_bi_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- CREATE TRIGGER tr_InvestObject_bu_500
CREATE OR REPLACE TRIGGER tr_InvestObject_bu_500
  BEFORE UPDATE
  ON INVESTOBJECT
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (tr_InvestObject_bu_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdateDate := SYSDATE;
  :new.UpdaterUser := user;

END;
/
-- CREATE TRIGGER tr_InvestObject_bi_0
CREATE OR REPLACE TRIGGER TR_InvestObject_BI
  BEFORE INSERT
  ON InvestObject
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_InvestObject_bi_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Генерация Id, установка значений по умолчанию */
  if (:new.id is null) then 
    select g_shared.nextval into :new.id from dual;
  END IF;
  if (:new.Code is null) then  
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.OwnerLevel is null) then 
    :new.OwnerLevel := 0;
  END IF;
  if (:new.RegionCls is null) then 
    :new.RegionCls := 0;
  END IF;
  if (:new.BudgetFinSourceLevel is null) then 
    :new.BudgetFinSourceLevel := 0;
  END IF;
  if (:new.KVSR is null) then 
    :new.KVSR := 0;
  END IF;
  if (:new.KCSR is null) then 
    :new.KCSR := 0;
  END IF;
  if (:new.MeansType is null) then 
    :new.MeansType := 0;
  END IF;
  if (:new.Fact is null) then 
    :new.Fact := 0;
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if ((not ((:new.MeansType) is null)) and (:new.TargetCls is null)) then 
    GetTargetClsOnMeansType(:new.MeansType,:new.TargetCls);
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (tr_InvestObject_bi_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

END;
/
-- CREATE TRIGGER tr_InvestObject_bu_0
CREATE OR REPLACE TRIGGER TR_InvestObject_BU
  BEFORE UPDATE
  ON InvestObject
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_InvestObject_bu_0)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Генерация Id, установка значений по умолчанию */
  if (:new.id is null) then 
    select g_shared.nextval into :new.id from dual;
  END IF;
  if (:new.Code is null) then  
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.OwnerLevel is null) then 
    :new.OwnerLevel := 0;
  END IF;
  if (:new.RegionCls is null) then 
    :new.RegionCls := 0;
  END IF;
  if (:new.BudgetFinSourceLevel is null) then 
    :new.BudgetFinSourceLevel := 0;
  END IF;
  if (:new.KVSR is null) then 
    :new.KVSR := 0;
  END IF;
  if (:new.KCSR is null) then 
    :new.KCSR := 0;
  END IF;
  if (:new.MeansType is null) then 
    :new.MeansType := 0;
  END IF;
  if (:new.Fact is null) then 
    :new.Fact := 0;
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if ((not ((:new.MeansType) is null)) and (:new.TargetCls is null)) then 
    GetTargetClsOnMeansType(:new.MeansType,:new.TargetCls);
  END IF;

END;
/
-- CREATE TRIGGER Tr_InvestObject_AU_500
CREATE OR REPLACE TRIGGER TR_InvestObject_AU
  AFTER UPDATE
  ON InvestObject
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (Tr_InvestObject_AU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (96, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=96) and (RecordId=:new.ID);
      
  END IF;

END;
/
-- CREATE TRIGGER tr_InvestObject_ai_500
CREATE OR REPLACE TRIGGER TR_InvestObject_AI
  AFTER INSERT
  ON InvestObject
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (tr_InvestObject_ai_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 96)  and (RecordID = :new.ID);

END;
/
-- CREATE TRIGGER tr_InvestObject_ad_500
CREATE OR REPLACE TRIGGER TR_InvestObject_AD
  AFTER DELETE
  ON InvestObject
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (tr_InvestObject_ad_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(96, :old.ID, SYSDATE);

END;
/
grant SELECT, INSERT, UPDATE, DELETE on InvestObject to BUDGET_USERS
/
grant execute on GETTARGETCLSONMEANSTYPE to BUDGET_USERS
/
/* Добавляем классификатор в предметные таблицы */
ALTER TABLE TB_FacialFinDetail ADD (
  SourceInvestObject NUMBER(10),
    CHECK((SourceInvestObject<=2147483647)AND(SourceInvestObject>-2147483648)),
  DestInvestObject NUMBER(10),
    CHECK((DestInvestObject<=2147483647)AND(DestInvestObject>-2147483648)),
  constraint FK_FFC_SourceIO foreign key (SourceInvestObject) references InvestObject(ID),
  constraint FK_FFC_DestIO foreign key (DestInvestObject) references InvestObject(ID)
)
/
CREATE INDEX FK_FFC_SourceIO ON TB_FacialFinDetail(SourceInvestObject)
/
CREATE INDEX FK_FFC_DestIO ON TB_FacialFinDetail(DestInvestObject)
/

CREATE OR REPLACE VIEW FacialFinDetail (
  ID,
  SOURCEFACIALACC_CLS,
  SOURCEKVR,
  SOURCEKESR,
  DESTFACIALACC_CLS,
  DESTKVR,
  DESTKESR,
  BUDGETREF,
  CREDIT,
  PAYSYMBOLCLS,
  MEMORDERNUM,
  NOTE,
  PROGINDEX,
  RECORDINDEX,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  SOURCEKVSR,
  SOURCEKCSR,
  SOURCEKFSR,
  SOURCESUBKESR,
  SOURCEFACT,
  SOURCEMEANSTYPE,
  SOURCEFINSOURCE,
  SOURCEFINTYPE,
  DESTKVSR,
  DESTKCSR,
  DESTKFSR,
  DESTSUBKESR,
  DESTFACT,
  DESTMEANSTYPE,
  DESTFINSOURCE,
  DESTFINTYPE,
  REQUESTSINDEX,
  SENDERID,
  SENDERRECORDID,
  PROMISE,
  SOURCEDOCTYPE,
  DESTDOCTYPE,
  SOURCEPROMISE,
  DESTPROMISE,
  RECORDINDEX2,
  SOURCEBUDGETPROMISE,
  DESTBUDGETPROMISE,
  SUBPROGINDEX,
  STIMATEID,
  RVERSION,
  SOURCEDIRECTIONCLS,
  DESTDIRECTIONCLS,
  SOURCEDOCBASE,
  DESTDOCBASE,
  SOURCEEXECDOC,
  DESTEXECDOC,
  BUHOPERATIONCLS,
  SOURCEIFS,
  DESTIFS,
  CLSTYPE,
  UNIONNOTIFYREF,
  ACCEPTDATE,
  SOURCEKD,
  DESTKD,
  SOURCEREGIONCLS,
  DESTREGIONCLS,
  DESTFUNDSSOURCE,
  SOURCEFUNDSSOURCE,
  ISBLOCKED,
  BLOCKEDCAUSE,
  UNBLOCKEDDATE,
  UNBLOCKEDCAUSE,
  SOURCETRANSFERTCLS,
  DESTTRANSFERTCLS,
  DESTCLSTYPE,
  SOURCEASSIGNMENTKIND,
  DESTASSIGNMENTKIND,
  SOURCEEXECINNERNUMBER,
  DESTEXECINNERNUMBER,
  SOURCESUBSIDYCLS,
  DESTSUBSIDYCLS,
  SOURCEFAORG_TYPE,
  DESTFAORG_TYPE,
  SOURCEBUDALLOCATIONCLS,
  SOURCEPAYPROMISECLS,
  DESTBUDALLOCATIONCLS,
  DESTPAYPROMISECLS,
  SOURCEINVESTOBJECT,
  DESTINVESTOBJECT)
AS
  SELECT
    ID,
    SOURCEFACIALACC_CLS,
    SOURCEKVR,
    SOURCEKESR,
    DESTFACIALACC_CLS,
    DESTKVR,
    DESTKESR,
    BUDGETREF,
    CREDIT,
    PAYSYMBOLCLS,
    MEMORDERNUM,
    NOTE,
    PROGINDEX,
    RECORDINDEX,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    SOURCEKVSR,
    SOURCEKCSR,
    SOURCEKFSR,
    SOURCESUBKESR,
    SOURCEFACT,
    SOURCEMEANSTYPE,
    SOURCEFINSOURCE,
    SOURCEFINTYPE,
    DESTKVSR,
    DESTKCSR,
    DESTKFSR,
    DESTSUBKESR,
    DESTFACT,
    DESTMEANSTYPE,
    DESTFINSOURCE,
    DESTFINTYPE,
    REQUESTSINDEX,
    SENDERID,
    SENDERRECORDID,
    PROMISE,
    SOURCEDOCTYPE,
    DESTDOCTYPE,
    SOURCEPROMISE,
    DESTPROMISE,
    RECORDINDEX2,
    SOURCEBUDGETPROMISE,
    DESTBUDGETPROMISE,
    SUBPROGINDEX,
    STIMATEID,
    RVERSION,
    SOURCEDIRECTIONCLS,
    DESTDIRECTIONCLS,
    SOURCEDOCBASE,
    DESTDOCBASE,
    SOURCEEXECDOC,
    DESTEXECDOC,
    BUHOPERATIONCLS,
    SOURCEIFS,
    DESTIFS,
    CLSTYPE,
    UNIONNOTIFYREF,
    ACCEPTDATE,
    SOURCEKD,
    DESTKD,
    SOURCEREGIONCLS,
    DESTREGIONCLS,
    DESTFUNDSSOURCE,
    SOURCEFUNDSSOURCE,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    SOURCETRANSFERTCLS,
    DESTTRANSFERTCLS,
    DESTCLSTYPE,
    SOURCEASSIGNMENTKIND,
    DESTASSIGNMENTKIND,
    SOURCEEXECINNERNUMBER,
    DESTEXECINNERNUMBER,
    SOURCESUBSIDYCLS,
    DESTSUBSIDYCLS,
    SOURCEFAORG_TYPE,
    DESTFAORG_TYPE,
    SOURCEBUDALLOCATIONCLS,
    SOURCEPAYPROMISECLS,
    DESTBUDALLOCATIONCLS,
    DESTPAYPROMISECLS,
    SOURCEINVESTOBJECT,
    DESTINVESTOBJECT
  FROM TB_FacialFinDetail
/

CREATE OR REPLACE TRIGGER TR_FACIALFINDETAIL_ID
  INSTEAD OF DELETE
  ON FACIALFINDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_500 (TR_FACIALFINDETAIL_BD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  Update facialfincaption set
  DocChangeDate = SYSDATE,
  RVersion=-1
  where id=:old.recordindex;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_FACIALFINDETAIL
  WHERE id = :old.id;

-- - - - - - - - - - - - -
-- AD_500 (TR_FACIALFINDETAIL_AD_500)
-- Last update 27.08.2004
-- - - - - - - - - - - - -

  INSERT INTO DelRecIndexes
              (TableID, RecordId, DeleteDate, ProgIndex, Summa)
       VALUES (22, :OLD.ID, SYSDATE, :OLD.ProgIndex, :OLD.Credit);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALFINDETAIL_II
  INSTEAD OF INSERT
  ON FACIALFINDETAIL
  FOR EACH ROW
DECLARE
  new$ID FACIALFINDETAIL.ID%TYPE := :NEW.ID;
  new$SOURCEFACIALACC_CLS FACIALFINDETAIL.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$SOURCEKVR FACIALFINDETAIL.SOURCEKVR%TYPE := :NEW.SOURCEKVR;
  new$SOURCEKESR FACIALFINDETAIL.SOURCEKESR%TYPE := :NEW.SOURCEKESR;
  new$DESTFACIALACC_CLS FACIALFINDETAIL.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$DESTKVR FACIALFINDETAIL.DESTKVR%TYPE := :NEW.DESTKVR;
  new$DESTKESR FACIALFINDETAIL.DESTKESR%TYPE := :NEW.DESTKESR;
  new$BUDGETREF FACIALFINDETAIL.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREDIT FACIALFINDETAIL.CREDIT%TYPE := :NEW.CREDIT;
  new$PAYSYMBOLCLS FACIALFINDETAIL.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$MEMORDERNUM FACIALFINDETAIL.MEMORDERNUM%TYPE := :NEW.MEMORDERNUM;
  new$NOTE FACIALFINDETAIL.NOTE%TYPE := :NEW.NOTE;
  new$PROGINDEX FACIALFINDETAIL.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX FACIALFINDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CREATERUSER FACIALFINDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$SOURCEKVSR FACIALFINDETAIL.SOURCEKVSR%TYPE := :NEW.SOURCEKVSR;
  new$SOURCEKCSR FACIALFINDETAIL.SOURCEKCSR%TYPE := :NEW.SOURCEKCSR;
  new$SOURCEKFSR FACIALFINDETAIL.SOURCEKFSR%TYPE := :NEW.SOURCEKFSR;
  new$SOURCESUBKESR FACIALFINDETAIL.SOURCESUBKESR%TYPE := :NEW.SOURCESUBKESR;
  new$SOURCEFACT FACIALFINDETAIL.SOURCEFACT%TYPE := :NEW.SOURCEFACT;
  new$SOURCEMEANSTYPE FACIALFINDETAIL.SOURCEMEANSTYPE%TYPE := :NEW.SOURCEMEANSTYPE;
  new$SOURCEFINSOURCE FACIALFINDETAIL.SOURCEFINSOURCE%TYPE := :NEW.SOURCEFINSOURCE;
  new$SOURCEFINTYPE FACIALFINDETAIL.SOURCEFINTYPE%TYPE := :NEW.SOURCEFINTYPE;
  new$DESTKVSR FACIALFINDETAIL.DESTKVSR%TYPE := :NEW.DESTKVSR;
  new$DESTKCSR FACIALFINDETAIL.DESTKCSR%TYPE := :NEW.DESTKCSR;
  new$DESTKFSR FACIALFINDETAIL.DESTKFSR%TYPE := :NEW.DESTKFSR;
  new$DESTSUBKESR FACIALFINDETAIL.DESTSUBKESR%TYPE := :NEW.DESTSUBKESR;
  new$DESTFACT FACIALFINDETAIL.DESTFACT%TYPE := :NEW.DESTFACT;
  new$DESTMEANSTYPE FACIALFINDETAIL.DESTMEANSTYPE%TYPE := :NEW.DESTMEANSTYPE;
  new$DESTFINSOURCE FACIALFINDETAIL.DESTFINSOURCE%TYPE := :NEW.DESTFINSOURCE;
  new$DESTFINTYPE FACIALFINDETAIL.DESTFINTYPE%TYPE := :NEW.DESTFINTYPE;
  new$REQUESTSINDEX FACIALFINDETAIL.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$SENDERID FACIALFINDETAIL.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINDETAIL.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$PROMISE FACIALFINDETAIL.PROMISE%TYPE := :NEW.PROMISE;
  new$SOURCEDOCTYPE FACIALFINDETAIL.SOURCEDOCTYPE%TYPE := :NEW.SOURCEDOCTYPE;
  new$DESTDOCTYPE FACIALFINDETAIL.DESTDOCTYPE%TYPE := :NEW.DESTDOCTYPE;
  new$SOURCEPROMISE FACIALFINDETAIL.SOURCEPROMISE%TYPE := :NEW.SOURCEPROMISE;
  new$DESTPROMISE FACIALFINDETAIL.DESTPROMISE%TYPE := :NEW.DESTPROMISE;
  new$RECORDINDEX2 FACIALFINDETAIL.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$SOURCEBUDGETPROMISE FACIALFINDETAIL.SOURCEBUDGETPROMISE%TYPE := :NEW.SOURCEBUDGETPROMISE;
  new$DESTBUDGETPROMISE FACIALFINDETAIL.DESTBUDGETPROMISE%TYPE := :NEW.DESTBUDGETPROMISE;
  new$SUBPROGINDEX FACIALFINDETAIL.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$STIMATEID FACIALFINDETAIL.STIMATEID%TYPE := :NEW.STIMATEID;
  new$RVERSION FACIALFINDETAIL.RVERSION%TYPE := :NEW.RVERSION;
  new$SOURCEDIRECTIONCLS FACIALFINDETAIL.SOURCEDIRECTIONCLS%TYPE := :NEW.SOURCEDIRECTIONCLS;
  new$DESTDIRECTIONCLS FACIALFINDETAIL.DESTDIRECTIONCLS%TYPE := :NEW.DESTDIRECTIONCLS;
  new$SOURCEDOCBASE FACIALFINDETAIL.SOURCEDOCBASE%TYPE := :NEW.SOURCEDOCBASE;
  new$DESTDOCBASE FACIALFINDETAIL.DESTDOCBASE%TYPE := :NEW.DESTDOCBASE;
  new$SOURCEEXECDOC FACIALFINDETAIL.SOURCEEXECDOC%TYPE := :NEW.SOURCEEXECDOC;
  new$DESTEXECDOC FACIALFINDETAIL.DESTEXECDOC%TYPE := :NEW.DESTEXECDOC;
  new$BUHOPERATIONCLS FACIALFINDETAIL.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$SOURCEIFS FACIALFINDETAIL.SOURCEIFS%TYPE := :NEW.SOURCEIFS;
  new$DESTIFS FACIALFINDETAIL.DESTIFS%TYPE := :NEW.DESTIFS;
  new$CLSTYPE FACIALFINDETAIL.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$UNIONNOTIFYREF FACIALFINDETAIL.UNIONNOTIFYREF%TYPE := :NEW.UNIONNOTIFYREF;
  new$ACCEPTDATE FACIALFINDETAIL.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SOURCEKD FACIALFINDETAIL.SOURCEKD%TYPE := :NEW.SOURCEKD;
  new$DESTKD FACIALFINDETAIL.DESTKD%TYPE := :NEW.DESTKD;
  new$SOURCEREGIONCLS FACIALFINDETAIL.SOURCEREGIONCLS%TYPE := :NEW.SOURCEREGIONCLS;
  new$DESTREGIONCLS FACIALFINDETAIL.DESTREGIONCLS%TYPE := :NEW.DESTREGIONCLS;
  new$DESTFUNDSSOURCE FACIALFINDETAIL.DESTFUNDSSOURCE%TYPE := :NEW.DESTFUNDSSOURCE;
  new$SOURCEFUNDSSOURCE FACIALFINDETAIL.SOURCEFUNDSSOURCE%TYPE := :NEW.SOURCEFUNDSSOURCE;
  new$ISBLOCKED FACIALFINDETAIL.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINDETAIL.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINDETAIL.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINDETAIL.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$SOURCETRANSFERTCLS FACIALFINDETAIL.SOURCETRANSFERTCLS%TYPE := :NEW.SOURCETRANSFERTCLS;
  new$DESTTRANSFERTCLS FACIALFINDETAIL.DESTTRANSFERTCLS%TYPE := :NEW.DESTTRANSFERTCLS;
  new$DESTCLSTYPE FACIALFINDETAIL.DESTCLSTYPE%TYPE := :NEW.DESTCLSTYPE;
  new$SOURCEASSIGNMENTKIND FACIALFINDETAIL.SOURCEASSIGNMENTKIND%TYPE := :NEW.SOURCEASSIGNMENTKIND;
  new$DESTASSIGNMENTKIND FACIALFINDETAIL.DESTASSIGNMENTKIND%TYPE := :NEW.DESTASSIGNMENTKIND;
  new$SOURCEEXECINNERNUMBER FACIALFINDETAIL.SOURCEEXECINNERNUMBER%TYPE := :NEW.SOURCEEXECINNERNUMBER;
  new$DESTEXECINNERNUMBER FACIALFINDETAIL.DESTEXECINNERNUMBER%TYPE := :NEW.DESTEXECINNERNUMBER;
  new$SOURCESUBSIDYCLS FACIALFINDETAIL.SOURCESUBSIDYCLS%TYPE := :NEW.SOURCESUBSIDYCLS;
  new$DESTSUBSIDYCLS FACIALFINDETAIL.DESTSUBSIDYCLS%TYPE := :NEW.DESTSUBSIDYCLS;
  new$SOURCEFAORG_TYPE FACIALFINDETAIL.SOURCEFAORG_TYPE%TYPE := :NEW.SOURCEFAORG_TYPE;
  new$DESTFAORG_TYPE FACIALFINDETAIL.DESTFAORG_TYPE%TYPE := :NEW.DESTFAORG_TYPE;
  new$SOURCEBUDALLOCATIONCLS FACIALFINDETAIL.SOURCEBUDALLOCATIONCLS%TYPE := :NEW.SOURCEBUDALLOCATIONCLS;
  new$SOURCEPAYPROMISECLS FACIALFINDETAIL.SOURCEPAYPROMISECLS%TYPE := :NEW.SOURCEPAYPROMISECLS;
  new$DESTBUDALLOCATIONCLS FACIALFINDETAIL.DESTBUDALLOCATIONCLS%TYPE := :NEW.DESTBUDALLOCATIONCLS;
  new$DESTPAYPROMISECLS FACIALFINDETAIL.DESTPAYPROMISECLS%TYPE := :NEW.DESTPAYPROMISECLS;
  new$SOURCEINVESTOBJECT FACIALFINDETAIL.SOURCEINVESTOBJECT%TYPE := :NEW.SOURCEINVESTOBJECT;
  new$DESTINVESTOBJECT FACIALFINDETAIL.DESTINVESTOBJECT%TYPE := :NEW.DESTINVESTOBJECT;
--
  SourceFacialAcc_CLS$ NUMBER(10);
  DestFacialAcc_CLS$ NUMBER(10);
  CapBuhOperationCLS$ NUMBER(10);
  CapClsType$ NUMBER(10);
  CapAcceptDate$ NUMBER(10);
  CaptionAcceptDate$ NUMBER;
  PromiseAcceptDate$ NUMBER;
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  BPInnerNum1$ NUMBER(10);
  PromiseMode1$ NUMBER(10);
  Promise_Count1$ NUMBER(10);
  CaptionRejectCls1$ NUMBER(10);
  PromiseAccepted1$ NUMBER(10);
  PromiseMode$ NUMBER(10);
  ProgIndex$ NUMBER(10);
  ExecID$ NUMBER(10);
  ExecInnerNumber$ NUMBER(10);
  ExecRegType$ NUMBER(10);
  ExecAgrInnerNum$ NUMBER(10);
  AgrInnerNumber$ NUMBER(10);
  CaptionRejectCls$ NUMBER(10);
  EDAccepted$ NUMBER(10);
  i_fintype$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FACIALFINDETAIL_BI_0)
-- Last update 15.12.2002
-- - - - - - - - - - - - -

   IF (new$ID IS NULL) THEN
      SELECT g_Shared.NEXTVAL INTO new$ID FROM DUAL;
   END IF;

   IF (new$Credit IS NULL) THEN new$Credit := 0; END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_FACIALFINDETAIL_BI_100)
-- Last update 12.01.2009
-- - - - - - - - - - - - -

 /* Заполнение Бюджета, берем из мастера */
   BEGIN

     select
       ffc.BudgetRef, ffc.BuhOperationCls, ffc.ClsType, ffc.AcceptDate,
       ffc.IsBlocked, ffc.BlockedCause, ffc.UnBlockedDate, ffc.UnBlockedCause
     into new$BudgetRef, CapBuhOperationCls$, CapClsType$, CapAcceptDate$,
       new$IsBlocked, new$BlockedCause, new$UnBlockedDate, new$UnBlockedCause
     from
       FacialFinCaption ffc
     where
       ffc.id = new$RecordIndex;
     
   EXCEPTION
     WHEN NO_DATA_FOUND THEN
       new$BudgetRef := NULL;
       CapBuhOperationCls$ := NULL;
       CapClsType$ := NULL;
       CapAcceptDate$ := NULL;
   END;

   /* Бух операцию заполняем из заголовка */
   if (new$BuhOperationCls is null) then new$BuhOperationCls := CapBuhOperationCls$; end if;

   /* Тип классификации заполняем из заголовка */
   if (new$ClsType is null) then new$ClsType := CapClsType$; end if;

   if (new$DestClsType is null) then new$DestClsType := new$ClsType; end if;
   
   /* Дату принятия заполняем из заголовка */
   if (new$AcceptDate is null) then new$AcceptDate := CapAcceptDate$; end if;

   /* Сносим Лицевые счета из заголовка */
   if ((new$SourceFacialAcc_CLS is null) or (new$DestFacialAcc_CLS is null)) then
     BEGIN
       select SourceFacialAcc_CLS, DestFacialAcc_CLS
         into SourceFacialAcc_CLS$, DestFacialAcc_CLS$
       from FacialFinCaption
       where new$RecordIndex = id;
     EXCEPTION
       WHEN NO_DATA_FOUND THEN
         SourceFacialAcc_CLS$ := NULL;
         DestFacialAcc_CLS$ := NULL;
     END;

     if (new$SourceFacialAcc_CLS is null) then new$SourceFacialAcc_CLS := SourceFacialAcc_CLS$; end if;
     if (new$DestFacialAcc_CLS is null) then new$DestFacialAcc_CLS := DestFacialAcc_CLS$; end if;
   end if;

-- - - - - - - - - - - - -
-- BI_110 (TR_FACIALFINDETAIL_BI_110)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  /* Если тип финансирования не задан, то берем его из констант казначейства*/ 
  i_fintype$ := -1 ;
  IF (new$SourceFintype IS NULL OR (new$Sourcefintype=0)) THEN 
    BEGIN
      SELECT constvalue INTO i_fintype$   FROM intconst
      WHERE (progindex=30) AND (constindex=10) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    new$SourceFintype := i_fintype$  ;
     
  END IF;
  IF (new$DestFintype IS NULL OR (new$Destfintype=0)) THEN 
    IF (i_fintype$ = -1) THEN
      BEGIN
        SELECT constvalue INTO i_fintype$   FROM intconst
        WHERE (progindex=30) AND (constindex=10) ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
    END IF;
    new$DestFintype := i_fintype$  ;
     
  END IF;
  IF (new$SourceFacialAcc_CLS IS NULL) THEN 
    new$SourceFacialAcc_CLS := 0;
  END IF;
  IF (new$SourceKVR IS NULL) THEN 
    new$SourceKVR := 0;
  END IF;
  IF (new$SourceKESR IS NULL) THEN 
    new$SourceKESR := 0;
  END IF;
  IF (new$SourceKVSR IS NULL) THEN 
    new$SourceKVSR := 0;
  END IF;
  IF (new$SourceKFSR IS NULL) THEN 
    new$SourceKFSR := 0;
  END IF;
  IF (new$SourceKCSR IS NULL) THEN 
    new$SourceKCSR := 0;
  END IF;
  IF (new$SourceSubKESR IS NULL) THEN 
    new$SourceSubKESR := 0;
  END IF;
  IF (new$SourceDirectionCls IS NULL) THEN 
    new$SourceDirectionCls := 0;
  END IF;
  IF (new$SourceFact IS NULL) THEN 
    new$SourceFact := 0;
  END IF;
  IF (new$SourceMeansType IS NULL) THEN 
    new$SourceMeansType := 0;
  END IF;
  IF (new$SourceFinSource IS NULL) THEN 
    new$SourceFinSource := 0;
  END IF;
  IF (new$SourceFinType IS NULL) THEN 
    new$SourceFinType := 0;
  END IF;
  IF (new$SourceDocType IS NULL) THEN 
    new$SourceDocType := 1000;
  END IF;
  IF (new$SourceIFS IS NULL) THEN 
    new$Sourceifs := 0;
  END IF;
  IF (new$SourceKD IS NULL) THEN 
    new$SourceKD := 0;
  END IF;
  IF (new$SourceFundsSource IS NULL) THEN 
    new$SourceFundsSource := 0;
  END IF;
  IF (new$SourceAssignmentKind IS NULL) THEN 
    new$SourceAssignmentKind := 0;
  END IF;
  IF (new$SourceRegionCLS IS NULL) THEN 
    new$SourceRegionCLS := 0;
  END IF;
  IF (new$DestFacialAcc_CLS IS NULL) THEN 
    new$DestFacialAcc_CLS := 0;
  END IF;
  IF (new$DestKVR IS NULL) THEN 
    new$DestKVR := 0;
  END IF;
  IF (new$DestKESR IS NULL) THEN 
    new$DestKESR := 0;
  END IF;
  IF (new$DestKVSR IS NULL) THEN 
    new$DestKVSR := 0;
  END IF;
  IF (new$DestKFSR IS NULL) THEN 
    new$DestKFSR := 0;
  END IF;
  IF (new$DestKCSR IS NULL) THEN 
    new$DestKCSR := 0;
  END IF;
  IF (new$DestSubKESR IS NULL) THEN 
    new$DestSubKESR := 0;
  END IF;
  IF (new$DestDirectionCls IS NULL) THEN 
    new$DestDirectionCls := 0;
  END IF;
  IF (new$DestFact IS NULL) THEN 
    new$DestFact := 0;
  END IF;
  IF (new$DestMeansType IS NULL) THEN 
    new$DestMeansType := 0;
  END IF;
  IF (new$DestFinSource IS NULL) THEN 
    new$DestFinSource := 0;
  END IF;
  IF (new$DestFinType IS NULL) THEN 
    new$DestFinType := 0;
  END IF;
  IF (new$DestDocType IS NULL) THEN 
    new$DestDocType := 1000;
  END IF;
  IF (new$DestIFS IS NULL) THEN 
    new$Destifs := 0;
  END IF;
  IF (new$DestKD IS NULL) THEN 
    new$DestKD := 0;
  END IF;
  IF (new$DestFundsSource IS NULL) THEN 
    new$DestFundsSource := 0;
  END IF;
  IF (new$DestAssignmentKind IS NULL) THEN 
    new$DestAssignmentKind := 0;
  END IF;
  IF (new$DestRegionCLS IS NULL) THEN 
    new$DestRegionCLS := 0;
  END IF;
  /* для Распределения ОФ: классификация плательщика не должна быть нулевой */
  if (new$progindex=76) then
    new$SourceKVR := new$DestKVR;
    new$SourceKESR := new$DestKESR;
    new$SourceKVSR := new$DestKVSR;
    new$SourceKFSR := new$DestKFSR;
    new$SourceKCSR := new$DestKCSR;
    new$SourceSubKESR := new$DestSubKESR;
    new$SourceDirectionCls := new$DestDirectionCls;
    new$SourceFact := new$DestFact;
    new$SourceMeansType := new$DestMeansType;
    new$SourceFinSource := new$DestFinSource;
    new$SourceFinType := new$DestFinType;
    new$SourceDocType := new$DestDocType;
    new$SourceIFS := new$DestIFS;
    new$SourceKD := new$DestKD;
    new$SourceRegionCls := new$DestRegionCls;
    new$SourceDocBase := new$DestDocBase;
    new$SourceAssignmentKind := new$DestAssignmentKind;
     
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  /* старое поле Promise null, а новые нет */
  IF ((new$Promise IS NULL) AND
  ((new$SourcePromise IS NOT NULL) OR
  (new$DestPromise IS NOT NULL))) THEN
    IF (new$progindex IN (63, 64, 73)) THEN
      new$Promise := new$SourcePromise;
         
    ELSE 
      IF (new$progindex IN (61, 62, 65, 75)) THEN
        new$Promise := new$DestPromise;
           
      ELSE 
        IF ((new$progindex in (66, 67, 76))AND(new$DestPromise IS NOT NULL)AND
        (new$SourcePromise=new$DestPromise)) THEN
          new$Promise := new$DestPromise;
        END IF;
      END IF; 
    END IF;/* если новые поля пустые,а старый нет, то старый ± преобразуем в новый */
  ELSE
    IF ((new$Promise IS NOT NULL) AND
    (new$SourcePromise IS NULL) AND
    (new$DestPromise IS NULL)) THEN
      IF (new$progindex IN (63, 64, 73)) THEN
        new$SourcePromise := new$Promise;
           
      ELSE 
        IF (new$progindex IN (61, 62, 65, 75)) THEN
          new$DestPromise := new$Promise;
             
        ELSE 
          IF (new$progindex in (66, 67, 76)) THEN
            new$SourcePromise := new$Promise;
            new$DestPromise := new$Promise;
               
          END IF;
        END IF; 
      END IF;
    END IF;
  END IF;
  BEGIN

    /* заполняем вид организации владельца л\с плательщика и получателя*/
    SELECT org.Org_Type  INTO new$SourceFAOrg_Type FROM Organizations org
    INNER JOIN FacialACC_Cls fac ON (org.ID = fac.Org_ref)
    WHERE fac.ID = new$SourceFacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  BEGIN

    SELECT org.Org_Type  INTO new$DestFAOrg_Type FROM Organizations org
    INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
    WHERE fac.ID = new$DestFacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BI_120 (TR_FACIALFINDETAIL_BI_120)
-- Create 28.04.2005
-- Last update 15.12.2008
-- - - - - - - - - - - - -

    /*  60 :  'Приход средств от фин.органа'; source
        61 :  'Приход средств от прочих и восстановление расходов'; dest
        62 :  'Приход средств по объявлениям';dest
        63 :  'Уход средств по платежным поручениям'; source
        64 :  'Уход средств по чекам'; source
        65 :  'Переброска средств, Разассигновка';dest
        66 :  'Внутренняя переброска средств, один - многим'; source dest
        67 :  'Уход средств в районы';source
        68 :  'Перечисление на р\с районов';dest
        69 :  'Подтверждение перечисления на р\с районов'; dest
        70 :  'Возврат с р\с районов';source
        71 :  'Подтверждение возврата с р\с районов'; dest */

  /*ClsType*/
  if ((New$ClsType is NULL) and 
        ( 
          ((New$SourceIFS <> 0) and (New$ProgIndex in (63,64,66,67,68,70))) or
          (New$ProgIndex = 60)
        )) then
    New$ClsType := 1; /* если это источник и забыли ввести ClsType */
  elsif ((New$ClsType is NULL) and (New$SourceKD <> 0) and
        (New$ProgIndex in (63,64,66,67,68,70))) then
    New$ClsType := 2; /* если это код дохода и забыли ввести ClsType */
  elsif (new$ClsType is null) then
    new$ClsType := 0; /* иначе - расходная */
  end if;  

  IF ((new$ClsType = 0) AND 
      (((new$SourceIFS <> 0) or (new$SourceKD <> 0)) and
      (new$ProgIndex in (63,64,66,67,68,70)))
     ) THEN /* классификация расходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;
  IF ((new$ClsType = 1) AND (
    (new$SourceKVSR <> 0) OR (new$SourceKFSR <> 0) OR
    (new$SourceKCSR <> 0) OR (new$SourceKVR <> 0) OR
    (new$SourceKESR <> 0) OR
    ((new$SourceKD <> 0) and (new$ProgIndex in (63,64,66,67,68,70)))
    )) THEN /* классификация источниковая */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;
  IF ((new$ClsType = 2) AND (
    (new$SourceKVSR <> 0) OR (new$SourceKFSR <> 0) OR
    (new$SourceKCSR <> 0) OR (new$SourceKVR <> 0) OR
    (new$SourceKESR <> 0) OR
    ((new$SourceIFS <> 0) and (new$ProgIndex in (63,64,66,67,68,70)))
    )) THEN /* классификация доходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  /*DestClsType*/
  if ((new$DestClsType is NULL) and
        ( 
          ((new$DestIFS <> 0) and (new$ProgIndex in (61,62,65,69,71))) or (new$ProgIndex = 60)
        )) then
    new$DestClsType := 1; /* если это источник и забыли ввести ClsType */
  elsif ((new$DestClsType is NULL) and
          ((new$DestKD <> 0) and (new$ProgIndex in (61,62,65,69,71)))
        ) then
    new$DestClsType := 2; /* если это код дохода и забыли ввести ClsType */
  elsif (new$DestClsType is null) then
    new$DestClsType := 0; /* иначе - расходная */
  end if;      

  IF ((new$DestClsType = 0) AND
      (((new$DestIFS <> 0) or (new$DestKD <> 0)) and
      (new$ProgIndex in (61,62,65,69,71)))
     ) THEN /* классификация расходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;
  IF ((new$DestClsType = 1) AND (
    (new$DestKVSR <> 0) OR (new$DestKFSR <> 0) OR
    (new$DestKCSR <> 0) OR (new$DestKVR <> 0) OR
    (new$DestKESR <> 0) or
    ((new$DestKD <> 0) and (new$ProgIndex in (61,62,65,69,71)))
    )) THEN /* классификация источниковая */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  IF ((new$DestClsType = 2) AND (
    (new$DestKVSR <> 0) OR (new$DestKFSR <> 0) OR
    (new$DestKCSR <> 0) OR (new$DestKVR <> 0) OR
    (new$DestKESR <> 0) or
    ((new$DestIFS <> 0) and (new$ProgIndex in (61,62,65,69,71)))
    )) THEN /* классификация доходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BI_200 (TR_FACIALFINDETAIL_BI_200)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* проставляем номера бюджетных обязательств по Учету договоров*/
  GetIntConst(30, 15,PromiseMode1$);
  /* ПРОВЕРКА ДЛЯ БЛОКА БО */
  if (((new$SourcePromise is not null) or (new$DestPromise is not null)) and (PromiseMode1$ <> 1)) then
    if (new$SourcePromise is not null) then
      /* Проверка сущствует ли такое БО на который ссылается документ*/
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count1$         from
      promise_detail pr
      where
      (pr.registrnumber = new$SOURCEPROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count1$ = 0) then
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    if (new$DestPromise is not null) then
      /* Проверка сущствует ли такое БО на который ссылается документ*/
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count1$         from
      promise_detail pr
      where
      (pr.registrnumber = new$DESTPROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count1$ = 0) then
        RaiseException('EX_BP_NotExist');      
      END IF;    
    END IF;
  END IF;
  if (PromiseMode1$ = 1) then
    /* source Подтяжка внутр. номера по номеру БО*/
    if ((new$SourcePromise is not null) and (new$SourceBudgetPromise is null)) then
      select max(InnerPromiseNum) 
      into BPInnerNum1$           from PaymentSchedule 
      where (ANumber = new$SourcePromise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum1$ <> 0) then
        new$SourceBudgetPromise := BPInnerNum1$;
                
      else
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    /* dest Подтяжка внутр. номера по номеру БО*/
    if ((new$DestPromise is not null) and (new$DestBudgetPromise is null)) then
      select max(InnerPromiseNum) 
      into BPInnerNum1$           from PaymentSchedule
      where (ANumber = new$DestPromise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum1$ <> 0) then
        new$DestBudgetPromise := BPInnerNum1$;
                
      else
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    /* source Если есть новый номер, но нет старого, тогда проставляем старый*/
    if ((new$SourceBudgetPromise is not null) and (new$SourcePromise is null)) then
      BEGIN
        select ANumber 
        into BPInnerNum1$           from PaymentSchedule
        where (InnerPromiseNum = new$SourceBudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      new$SourcePromise := BPInnerNum1$;
      new$Promise := BPInnerNum1$;
            
    END IF;
    /* dest */
    if ((new$DestBudgetPromise is not null) and (new$DestPromise is null)) then
      BEGIN
        select ANumber 
        into BPInnerNum1$           from PaymentSchedule
        where (InnerPromiseNum = new$DestBudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      new$DestPromise := BPInnerNum1$;
      new$Promise := BPInnerNum1$;
            
    END IF;
    /* проверка по двум полям */
    if (new$SourceBudgetPromise is not null and new$SourcePromise is not null) then
      SELECT COUNT(ANumber ) INTO CNT$1
      from PaymentSchedule where (ANumber = new$SourcePromise and InnerPromiseNum = new$SourceBudgetPromise) AND (ROWNUM = 1);
      if (not (CNT$1<> 0)) then
        RaiseException('Ex_BP_NotExist');
      END IF;
      BEGIN

        /* выбираем дату принятия и причину отклонения заголовка */
        select AcceptDate, Reject_Cls         into CaptionAcceptDate$, CaptionRejectCls1$ from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия БО для Source */
        select AcceptDate, Accepted         into PromiseAcceptDate$, PromiseAccepted1$ from PaymentSchedule
        where ANumber = new$SourcePromise and InnerPromiseNum = new$SourceBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls1$ is null and PromiseAccepted1$ <> 1) then
        RaiseException('Ex_BP_Rejected');
      END IF;
      /* если принятый документ ссылается на не принятое БО */
      if (CaptionAcceptDate$ is not null and (PromiseAcceptDate$ is null or PromiseAccepted1$ <> 1)) then
        RaiseException('Ex_BP_NotAccepted');      
      END IF;
    END IF;
    if (new$DestBudgetPromise is not null and new$DestPromise is not null) then
      SELECT COUNT(ANumber ) INTO CNT$2
      from PaymentSchedule where (ANumber = new$DestPromise and InnerPromiseNum = new$DestBudgetPromise) AND (ROWNUM = 1);
      if (not (CNT$2<> 0)) then
        RaiseException('Ex_BP_NotExist');
      END IF;
      BEGIN

        /* выбираем дату принятия и причину отклонения заголовка */
        select AcceptDate, Reject_Cls         into CaptionAcceptDate$, CaptionRejectCls1$ from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия БО для Dest */
        select AcceptDate, Accepted         into PromiseAcceptDate$, PromiseAccepted1$ from PaymentSchedule
        where ANumber = new$DestPromise and InnerPromiseNum = new$DestBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls1$ is null and PromiseAccepted1$ <> 1) then
        RaiseException('Ex_BP_Rejected');
      END IF;
      /* если принятый документ ссылается на не принятое БО */
      if (CaptionAcceptDate$ is not null and (PromiseAcceptDate$ is null or PromiseAccepted1$ <> 1)) then
        RaiseException('Ex_BP_NotAccepted');      
      END IF;    
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_210 (TR_FACIALFINDETAIL_BI_210)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* используем болк учета договоров?*/
  GetIntConst(30, 15,PromiseMode$);
  if (PromiseMode$ = 1) then
    /* при простановке БО плательщика или его изменении */
    if (new$SourcePromise is not null) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$SourcePromise and ps.InnerPromiseNum = new$SourceBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$SourceExecDoc := ExecID$;
        new$SourceExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$SourceExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$SourceExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$SourceExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано, а ДИ указано, то */
    else 
      if (new$SourceExecDoc is not null) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$SourceExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$SourceExecInnerNumber := ExecInnerNumber$;
            
      END IF;
    END IF;
    /* теперь тоже самое для Dest */

    /* при простановке БО получателя или его изменении */
    if (new$DestPromise is not null) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$DestPromise and ps.InnerPromiseNum = new$DestBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$DestExecDoc := ExecID$;
        new$DestExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$DestExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$DestExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$DestExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано, а ДИ указано, то */
    else 
      if (new$DestExecDoc is not null) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$DestExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$DestExecInnerNumber := ExecInnerNumber$;
            
      END IF;
    END IF;
    if (new$SourceExecDoc is not null) then
      BEGIN
        /* выбираем причину отклонения заголовка */
        select Reject_Cls
        into CaptionRejectCls$       from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия для Source */
        select Accepted
        into EDAccepted$       from ExecutionDocumentsCaption
        where id = new$SourceExecDoc
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls$ is null and EDAccepted$ <> 1) then
        RaiseException('Ex_ExecDoc_Rejected');    
      END IF;
    END IF;
    if (new$DestExecDoc is not null) then
      BEGIN
        /* выбираем причину отклонения заголовка */
        select Reject_Cls
        into CaptionRejectCls$       from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия для Dest */
        select Accepted
        into EDAccepted$       from ExecutionDocumentsCaption
        where ID = new$DestExecDoc
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное ДИ */
      if (CaptionRejectCls$ is null and EDAccepted$ <> 1) then
        RaiseException('Ex_ExecDoc_Rejected');    
      END IF;  
    END IF;/* использование блока "Учет договоров"*/
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_FACIALFINDETAIL_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

  Update facialfincaption set
  DocChangeDate = new$UpdateDate,
  RVersion=-1
  where id=new$recordindex;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_FACIALFINDETAIL (
    ID,
    SOURCEFACIALACC_CLS,
    SOURCEKVR,
    SOURCEKESR,
    DESTFACIALACC_CLS,
    DESTKVR,
    DESTKESR,
    BUDGETREF,
    CREDIT,
    PAYSYMBOLCLS,
    MEMORDERNUM,
    NOTE,
    PROGINDEX,
    RECORDINDEX,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    SOURCEKVSR,
    SOURCEKCSR,
    SOURCEKFSR,
    SOURCESUBKESR,
    SOURCEFACT,
    SOURCEMEANSTYPE,
    SOURCEFINSOURCE,
    SOURCEFINTYPE,
    DESTKVSR,
    DESTKCSR,
    DESTKFSR,
    DESTSUBKESR,
    DESTFACT,
    DESTMEANSTYPE,
    DESTFINSOURCE,
    DESTFINTYPE,
    REQUESTSINDEX,
    SENDERID,
    SENDERRECORDID,
    PROMISE,
    SOURCEDOCTYPE,
    DESTDOCTYPE,
    SOURCEPROMISE,
    DESTPROMISE,
    RECORDINDEX2,
    SOURCEBUDGETPROMISE,
    DESTBUDGETPROMISE,
    SUBPROGINDEX,
    STIMATEID,
    RVERSION,
    SOURCEDIRECTIONCLS,
    DESTDIRECTIONCLS,
    SOURCEDOCBASE,
    DESTDOCBASE,
    SOURCEEXECDOC,
    DESTEXECDOC,
    BUHOPERATIONCLS,
    SOURCEIFS,
    DESTIFS,
    CLSTYPE,
    UNIONNOTIFYREF,
    ACCEPTDATE,
    SOURCEKD,
    DESTKD,
    SOURCEREGIONCLS,
    DESTREGIONCLS,
    DESTFUNDSSOURCE,
    SOURCEFUNDSSOURCE,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    SOURCETRANSFERTCLS,
    DESTTRANSFERTCLS,
    DESTCLSTYPE,
    SOURCEASSIGNMENTKIND,
    DESTASSIGNMENTKIND,
    SOURCEEXECINNERNUMBER,
    DESTEXECINNERNUMBER,
    SOURCESUBSIDYCLS,
    DESTSUBSIDYCLS,
    SOURCEFAORG_TYPE,
    DESTFAORG_TYPE,
    SOURCEBUDALLOCATIONCLS,
    SOURCEPAYPROMISECLS,
    DESTBUDALLOCATIONCLS,
    DESTPAYPROMISECLS,
    SOURCEINVESTOBJECT,
    DESTINVESTOBJECT
  ) VALUES (
    new$ID,
    new$SOURCEFACIALACC_CLS,
    new$SOURCEKVR,
    new$SOURCEKESR,
    new$DESTFACIALACC_CLS,
    new$DESTKVR,
    new$DESTKESR,
    new$BUDGETREF,
    new$CREDIT,
    new$PAYSYMBOLCLS,
    new$MEMORDERNUM,
    new$NOTE,
    new$PROGINDEX,
    new$RECORDINDEX,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$SOURCEKVSR,
    new$SOURCEKCSR,
    new$SOURCEKFSR,
    new$SOURCESUBKESR,
    new$SOURCEFACT,
    new$SOURCEMEANSTYPE,
    new$SOURCEFINSOURCE,
    new$SOURCEFINTYPE,
    new$DESTKVSR,
    new$DESTKCSR,
    new$DESTKFSR,
    new$DESTSUBKESR,
    new$DESTFACT,
    new$DESTMEANSTYPE,
    new$DESTFINSOURCE,
    new$DESTFINTYPE,
    new$REQUESTSINDEX,
    new$SENDERID,
    new$SENDERRECORDID,
    new$PROMISE,
    new$SOURCEDOCTYPE,
    new$DESTDOCTYPE,
    new$SOURCEPROMISE,
    new$DESTPROMISE,
    new$RECORDINDEX2,
    new$SOURCEBUDGETPROMISE,
    new$DESTBUDGETPROMISE,
    new$SUBPROGINDEX,
    new$STIMATEID,
    new$RVERSION,
    new$SOURCEDIRECTIONCLS,
    new$DESTDIRECTIONCLS,
    new$SOURCEDOCBASE,
    new$DESTDOCBASE,
    new$SOURCEEXECDOC,
    new$DESTEXECDOC,
    new$BUHOPERATIONCLS,
    new$SOURCEIFS,
    new$DESTIFS,
    new$CLSTYPE,
    new$UNIONNOTIFYREF,
    new$ACCEPTDATE,
    new$SOURCEKD,
    new$DESTKD,
    new$SOURCEREGIONCLS,
    new$DESTREGIONCLS,
    new$DESTFUNDSSOURCE,
    new$SOURCEFUNDSSOURCE,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$SOURCETRANSFERTCLS,
    new$DESTTRANSFERTCLS,
    new$DESTCLSTYPE,
    new$SOURCEASSIGNMENTKIND,
    new$DESTASSIGNMENTKIND,
    new$SOURCEEXECINNERNUMBER,
    new$DESTEXECINNERNUMBER,
    new$SOURCESUBSIDYCLS,
    new$DESTSUBSIDYCLS,
    new$SOURCEFAORG_TYPE,
    new$DESTFAORG_TYPE,
    new$SOURCEBUDALLOCATIONCLS,
    new$SOURCEPAYPROMISECLS,
    new$DESTBUDALLOCATIONCLS,
    new$DESTPAYPROMISECLS,
    new$SOURCEINVESTOBJECT,
    new$DESTINVESTOBJECT);

-- - - - - - - - - - - - -
-- AI_100 (TR_FACIALFINDETAIL_AI_100)
-- Create 14.05.2007
-- - - - - - - - - - - - -

  update FacialFinCaption set
    ClsType = new$ClsType,
    RVersion = -1
  where
    (id = new$RecordIndex)and(ClsType <> new$ClsType);    

-- - - - - - - - - - - - -
-- AI_500 (TR_FACIALFINDETAIL_AI_500)
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID =22 ) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALFINDETAIL_IU
  INSTEAD OF UPDATE
  ON FACIALFINDETAIL
  FOR EACH ROW
DECLARE
  new$ID FACIALFINDETAIL.ID%TYPE := :NEW.ID;
  new$SOURCEFACIALACC_CLS FACIALFINDETAIL.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$SOURCEKVR FACIALFINDETAIL.SOURCEKVR%TYPE := :NEW.SOURCEKVR;
  new$SOURCEKESR FACIALFINDETAIL.SOURCEKESR%TYPE := :NEW.SOURCEKESR;
  new$DESTFACIALACC_CLS FACIALFINDETAIL.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$DESTKVR FACIALFINDETAIL.DESTKVR%TYPE := :NEW.DESTKVR;
  new$DESTKESR FACIALFINDETAIL.DESTKESR%TYPE := :NEW.DESTKESR;
  new$BUDGETREF FACIALFINDETAIL.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREDIT FACIALFINDETAIL.CREDIT%TYPE := :NEW.CREDIT;
  new$PAYSYMBOLCLS FACIALFINDETAIL.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$MEMORDERNUM FACIALFINDETAIL.MEMORDERNUM%TYPE := :NEW.MEMORDERNUM;
  new$NOTE FACIALFINDETAIL.NOTE%TYPE := :NEW.NOTE;
  new$PROGINDEX FACIALFINDETAIL.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX FACIALFINDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CREATERUSER FACIALFINDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$SOURCEKVSR FACIALFINDETAIL.SOURCEKVSR%TYPE := :NEW.SOURCEKVSR;
  new$SOURCEKCSR FACIALFINDETAIL.SOURCEKCSR%TYPE := :NEW.SOURCEKCSR;
  new$SOURCEKFSR FACIALFINDETAIL.SOURCEKFSR%TYPE := :NEW.SOURCEKFSR;
  new$SOURCESUBKESR FACIALFINDETAIL.SOURCESUBKESR%TYPE := :NEW.SOURCESUBKESR;
  new$SOURCEFACT FACIALFINDETAIL.SOURCEFACT%TYPE := :NEW.SOURCEFACT;
  new$SOURCEMEANSTYPE FACIALFINDETAIL.SOURCEMEANSTYPE%TYPE := :NEW.SOURCEMEANSTYPE;
  new$SOURCEFINSOURCE FACIALFINDETAIL.SOURCEFINSOURCE%TYPE := :NEW.SOURCEFINSOURCE;
  new$SOURCEFINTYPE FACIALFINDETAIL.SOURCEFINTYPE%TYPE := :NEW.SOURCEFINTYPE;
  new$DESTKVSR FACIALFINDETAIL.DESTKVSR%TYPE := :NEW.DESTKVSR;
  new$DESTKCSR FACIALFINDETAIL.DESTKCSR%TYPE := :NEW.DESTKCSR;
  new$DESTKFSR FACIALFINDETAIL.DESTKFSR%TYPE := :NEW.DESTKFSR;
  new$DESTSUBKESR FACIALFINDETAIL.DESTSUBKESR%TYPE := :NEW.DESTSUBKESR;
  new$DESTFACT FACIALFINDETAIL.DESTFACT%TYPE := :NEW.DESTFACT;
  new$DESTMEANSTYPE FACIALFINDETAIL.DESTMEANSTYPE%TYPE := :NEW.DESTMEANSTYPE;
  new$DESTFINSOURCE FACIALFINDETAIL.DESTFINSOURCE%TYPE := :NEW.DESTFINSOURCE;
  new$DESTFINTYPE FACIALFINDETAIL.DESTFINTYPE%TYPE := :NEW.DESTFINTYPE;
  new$REQUESTSINDEX FACIALFINDETAIL.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$SENDERID FACIALFINDETAIL.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINDETAIL.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$PROMISE FACIALFINDETAIL.PROMISE%TYPE := :NEW.PROMISE;
  new$SOURCEDOCTYPE FACIALFINDETAIL.SOURCEDOCTYPE%TYPE := :NEW.SOURCEDOCTYPE;
  new$DESTDOCTYPE FACIALFINDETAIL.DESTDOCTYPE%TYPE := :NEW.DESTDOCTYPE;
  new$SOURCEPROMISE FACIALFINDETAIL.SOURCEPROMISE%TYPE := :NEW.SOURCEPROMISE;
  new$DESTPROMISE FACIALFINDETAIL.DESTPROMISE%TYPE := :NEW.DESTPROMISE;
  new$RECORDINDEX2 FACIALFINDETAIL.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$SOURCEBUDGETPROMISE FACIALFINDETAIL.SOURCEBUDGETPROMISE%TYPE := :NEW.SOURCEBUDGETPROMISE;
  new$DESTBUDGETPROMISE FACIALFINDETAIL.DESTBUDGETPROMISE%TYPE := :NEW.DESTBUDGETPROMISE;
  new$SUBPROGINDEX FACIALFINDETAIL.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$STIMATEID FACIALFINDETAIL.STIMATEID%TYPE := :NEW.STIMATEID;
  new$RVERSION FACIALFINDETAIL.RVERSION%TYPE := :NEW.RVERSION;
  new$SOURCEDIRECTIONCLS FACIALFINDETAIL.SOURCEDIRECTIONCLS%TYPE := :NEW.SOURCEDIRECTIONCLS;
  new$DESTDIRECTIONCLS FACIALFINDETAIL.DESTDIRECTIONCLS%TYPE := :NEW.DESTDIRECTIONCLS;
  new$SOURCEDOCBASE FACIALFINDETAIL.SOURCEDOCBASE%TYPE := :NEW.SOURCEDOCBASE;
  new$DESTDOCBASE FACIALFINDETAIL.DESTDOCBASE%TYPE := :NEW.DESTDOCBASE;
  new$SOURCEEXECDOC FACIALFINDETAIL.SOURCEEXECDOC%TYPE := :NEW.SOURCEEXECDOC;
  new$DESTEXECDOC FACIALFINDETAIL.DESTEXECDOC%TYPE := :NEW.DESTEXECDOC;
  new$BUHOPERATIONCLS FACIALFINDETAIL.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$SOURCEIFS FACIALFINDETAIL.SOURCEIFS%TYPE := :NEW.SOURCEIFS;
  new$DESTIFS FACIALFINDETAIL.DESTIFS%TYPE := :NEW.DESTIFS;
  new$CLSTYPE FACIALFINDETAIL.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$UNIONNOTIFYREF FACIALFINDETAIL.UNIONNOTIFYREF%TYPE := :NEW.UNIONNOTIFYREF;
  new$ACCEPTDATE FACIALFINDETAIL.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SOURCEKD FACIALFINDETAIL.SOURCEKD%TYPE := :NEW.SOURCEKD;
  new$DESTKD FACIALFINDETAIL.DESTKD%TYPE := :NEW.DESTKD;
  new$SOURCEREGIONCLS FACIALFINDETAIL.SOURCEREGIONCLS%TYPE := :NEW.SOURCEREGIONCLS;
  new$DESTREGIONCLS FACIALFINDETAIL.DESTREGIONCLS%TYPE := :NEW.DESTREGIONCLS;
  new$DESTFUNDSSOURCE FACIALFINDETAIL.DESTFUNDSSOURCE%TYPE := :NEW.DESTFUNDSSOURCE;
  new$SOURCEFUNDSSOURCE FACIALFINDETAIL.SOURCEFUNDSSOURCE%TYPE := :NEW.SOURCEFUNDSSOURCE;
  new$ISBLOCKED FACIALFINDETAIL.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINDETAIL.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINDETAIL.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINDETAIL.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$SOURCETRANSFERTCLS FACIALFINDETAIL.SOURCETRANSFERTCLS%TYPE := :NEW.SOURCETRANSFERTCLS;
  new$DESTTRANSFERTCLS FACIALFINDETAIL.DESTTRANSFERTCLS%TYPE := :NEW.DESTTRANSFERTCLS;
  new$DESTCLSTYPE FACIALFINDETAIL.DESTCLSTYPE%TYPE := :NEW.DESTCLSTYPE;
  new$SOURCEASSIGNMENTKIND FACIALFINDETAIL.SOURCEASSIGNMENTKIND%TYPE := :NEW.SOURCEASSIGNMENTKIND;
  new$DESTASSIGNMENTKIND FACIALFINDETAIL.DESTASSIGNMENTKIND%TYPE := :NEW.DESTASSIGNMENTKIND;
  new$SOURCEEXECINNERNUMBER FACIALFINDETAIL.SOURCEEXECINNERNUMBER%TYPE := :NEW.SOURCEEXECINNERNUMBER;
  new$DESTEXECINNERNUMBER FACIALFINDETAIL.DESTEXECINNERNUMBER%TYPE := :NEW.DESTEXECINNERNUMBER;
  new$SOURCESUBSIDYCLS FACIALFINDETAIL.SOURCESUBSIDYCLS%TYPE := :NEW.SOURCESUBSIDYCLS;
  new$DESTSUBSIDYCLS FACIALFINDETAIL.DESTSUBSIDYCLS%TYPE := :NEW.DESTSUBSIDYCLS;
  new$SOURCEFAORG_TYPE FACIALFINDETAIL.SOURCEFAORG_TYPE%TYPE := :NEW.SOURCEFAORG_TYPE;
  new$DESTFAORG_TYPE FACIALFINDETAIL.DESTFAORG_TYPE%TYPE := :NEW.DESTFAORG_TYPE;
  new$SOURCEBUDALLOCATIONCLS FACIALFINDETAIL.SOURCEBUDALLOCATIONCLS%TYPE := :NEW.SOURCEBUDALLOCATIONCLS;
  new$SOURCEPAYPROMISECLS FACIALFINDETAIL.SOURCEPAYPROMISECLS%TYPE := :NEW.SOURCEPAYPROMISECLS;
  new$DESTBUDALLOCATIONCLS FACIALFINDETAIL.DESTBUDALLOCATIONCLS%TYPE := :NEW.DESTBUDALLOCATIONCLS;
  new$DESTPAYPROMISECLS FACIALFINDETAIL.DESTPAYPROMISECLS%TYPE := :NEW.DESTPAYPROMISECLS;
  new$SOURCEINVESTOBJECT FACIALFINDETAIL.SOURCEINVESTOBJECT%TYPE := :NEW.SOURCEINVESTOBJECT;
  new$DESTINVESTOBJECT FACIALFINDETAIL.DESTINVESTOBJECT%TYPE := :NEW.DESTINVESTOBJECT;
--
  CapAcceptDate$ NUMBER(10);
  BPInnerNum$ NUMBER(10);
  PromiseMode$ NUMBER(10);
  Promise_Count$ NUMBER(10);
  CaptionAcceptDate$ NUMBER;
  CaptionRejectCls$ NUMBER(10);
  PromiseAcceptDate$ NUMBER;
  PromiseAccepted$ NUMBER(10);
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  PromiseMode1$ NUMBER(10);
  ProgIndex$ NUMBER(10);
  ExecID$ NUMBER(10);
  ExecInnerNumber$ NUMBER(10);
  ExecRegType$ NUMBER(10);
  ExecAgrInnerNum$ NUMBER(10);
  AgrInnerNumber$ NUMBER(10);
  CaptionRejectCls1$ NUMBER(10);
  EDAccepted$ NUMBER(10);
  i_fintype$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_FACIALFINDETAIL_BU_0)
-- Last update 08.12.2005
-- - - - - - - - - - - - -

   IF (new$Credit IS NULL) THEN new$Credit := 0; END IF;

   /* проверка на изменение Бюджета */
   IF     (new$BudgetRef <> :OLD.BudgetRef)
      AND (NOT ((new$BudgetRef IS NULL) AND (:OLD.BudgetRef IS NULL))) THEN
      raiseException ('Ex_CantModufyBudget');
   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_FACIALFINDETAIL_BU_110)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  /* Если тип финансирования не задан, то берем его из констант казначейства*/ 
  i_fintype$ := -1 ;
  IF (new$SourceFintype IS NULL) THEN 
    BEGIN
      SELECT constvalue INTO i_fintype$   FROM intconst
      WHERE (progindex=30) AND (constindex=10) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    new$SourceFintype := i_fintype$  ;
     
  END IF;
  IF (new$DestFintype IS NULL) THEN 
    IF (i_fintype$ = -1) THEN
      BEGIN
        SELECT constvalue INTO i_fintype$   FROM intconst
        WHERE (progindex=30) AND (constindex=10) ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
    END IF;
    new$DestFintype := i_fintype$  ;
     
  END IF;
  IF (new$SourceFacialAcc_CLS IS NULL) THEN 
    new$SourceFacialAcc_CLS := 0;
  END IF;
  /* Бюджетная классификация */
  IF (new$SourceKVR IS NULL) THEN 
    new$SourceKVR := 0;
  END IF;
  IF (new$SourceKESR IS NULL) THEN 
    new$SourceKESR := 0;
  END IF;
  IF (new$SourceKVSR IS NULL) THEN 
    new$SourceKVSR := 0;
  END IF;
  IF (new$SourceKFSR IS NULL) THEN 
    new$SourceKFSR := 0;
  END IF;
  IF (new$SourceKCSR IS NULL) THEN 
    new$SourceKCSR := 0;
  END IF;
  IF (new$SourceSubKESR IS NULL) THEN 
    new$SourceSubKESR := 0;
  END IF;
  IF (new$SourceDirectionCls IS NULL) THEN 
    new$SourceDirectionCls := 0;
  END IF;
  IF (new$SourceFact IS NULL) THEN 
    new$SourceFact := 0;
  END IF;
  IF (new$SourceMeansType IS NULL) THEN 
    new$SourceMeansType := 0;
  END IF;
  IF (new$SourceFinSource IS NULL) THEN 
    new$SourceFinSource := 0;
  END IF;
  IF (new$SourceFinType IS NULL) THEN 
    new$SourceFinType := 0;
  END IF;
  IF (new$SourceDocType IS NULL) THEN 
    new$SourceDocType := 0;
  END IF;
  IF (new$Sourceifs IS NULL) THEN 
    new$Sourceifs := 0;
  END IF;
  IF (new$SourceKD IS NULL) THEN 
    new$SourceKD := 0;
  END IF;
  IF (new$SourceFundsSource IS NULL) THEN 
    new$SourceFundsSource := 0;
  END IF;
  IF (new$SourceAssignmentKind IS NULL) THEN 
    new$SourceAssignmentKind := 0;
  END IF;
  IF (new$SourceRegionCLS IS NULL) THEN 
    new$SourceRegionCLS := 0;
  END IF;
  IF (new$DestFacialAcc_CLS IS NULL) THEN 
    new$DestFacialAcc_CLS := 0;
  END IF;
  /* Бюджетная классификация */
  IF (new$DestKVR IS NULL) THEN 
    new$DestKVR := 0;
  END IF;
  IF (new$DestKESR IS NULL) THEN 
    new$DestKESR := 0;
  END IF;
  IF (new$DestKVSR IS NULL) THEN 
    new$DestKVSR := 0;
  END IF;
  IF (new$DestKFSR IS NULL) THEN 
    new$DestKFSR := 0;
  END IF;
  IF (new$DestKCSR IS NULL) THEN 
    new$DestKCSR := 0;
  END IF;
  IF (new$DestSubKESR IS NULL) THEN 
    new$DestSubKESR := 0;
  END IF;
  IF (new$DestDirectionCls IS NULL) THEN 
    new$DestDirectionCls := 0;
  END IF;
  IF (new$DestFact IS NULL) THEN 
    new$DestFact := 0;
  END IF;
  IF (new$DestMeansType IS NULL) THEN 
    new$DestMeansType := 0;
  END IF;
  IF (new$DestFinSource IS NULL) THEN 
    new$DestFinSource := 0;
  END IF;
  IF (new$DestFinType IS NULL) THEN 
    new$DestFinType := 0;
  END IF;
  IF (new$DestDocType IS NULL) THEN 
    new$DestDocType := 0;
  END IF;
  IF (new$Destifs IS NULL) THEN 
    new$Destifs := 0;
  END IF;
  IF (new$DestKD IS NULL) THEN 
    new$DestKD := 0;
  END IF;
  IF (new$DestFundsSource IS NULL) THEN 
    new$DestFundsSource := 0;
  END IF;
  IF (new$DestAssignmentKind IS NULL) THEN 
    new$DestAssignmentKind := 0;
  END IF;
  IF (new$DestRegionCLS IS NULL) THEN 
    new$DestRegionCLS := 0;
  END IF;
  /* для Распределения ОФ: классификация плательщика не должна быть нулевой */
  if (new$progindex=76) then
    new$SourceKVR := new$DestKVR;
    new$SourceKESR := new$DestKESR;
    new$SourceKVSR := new$DestKVSR;
    new$SourceKFSR := new$DestKFSR;
    new$SourceKCSR := new$DestKCSR;
    new$SourceSubKESR := new$DestSubKESR;
    new$SourceDirectionCls := new$DestDirectionCls;
    new$SourceFact := new$DestFact;
    new$SourceMeansType := new$DestMeansType;
    new$SourceFinSource := new$DestFinSource;
    new$SourceFinType := new$DestFinType;
    new$SourceDocType := new$DestDocType;
    new$SourceIFS := new$DestIFS;
    new$SourceKD := new$DestKD;
    new$SourceRegionCls := new$DestRegionCls;
    new$SourceDocBase := new$DestDocBase;
    new$SourceAssignmentKind := new$DestAssignmentKind;
     
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  /* новые поля изменились */
  IF ((new$SourcePromise IS NOT NULL) AND (:old.SourcePromise IS NOT NULL)
  AND (new$SourcePromise <> :old.SourcePromise)
  OR ((new$SourcePromise IS NULL) AND (:old.SourcePromise IS NOT NULL))
  OR ((new$SourcePromise IS NOT NULL) AND (:old.SourcePromise IS NULL))
  OR (new$DestPromise IS NOT NULL) AND (:old.DestPromise IS NOT NULL)
  AND (new$DestPromise <> :old.DestPromise)
  OR ((new$DestPromise IS NULL) AND (:old.DestPromise IS NOT NULL))
  OR ((new$DestPromise IS NOT NULL) AND (:old.DestPromise IS NULL))) THEN
    IF (new$progindex IN (63, 64, 73)) THEN
      new$Promise := new$SourcePromise;
         
    ELSE 
      IF (new$progindex IN (61, 62, 65, 75)) THEN
        new$Promise := new$DestPromise;
           
      ELSE 
        IF ((new$progindex in (66, 67, 76))AND((new$SourcePromise=new$DestPromise)OR
        ((new$SourcePromise IS NULL)AND(new$DestPromise IS NULL)))) THEN
          new$Promise := new$DestPromise;
        END IF;
      END IF; 
    END IF;/* если старое поле изменилось */
  ELSE
    IF ((new$Promise IS NOT NULL) AND (:old.Promise IS NOT NULL)
    AND (new$Promise <> :old.Promise)
    OR ((new$Promise IS NULL) AND (:old.Promise IS NOT NULL))
    OR ((new$Promise IS NOT NULL) AND (:old.Promise IS NULL))) THEN
      IF (new$progindex IN (63, 64, 73)) THEN
        new$SourcePromise := new$Promise;
           
      ELSE 
        IF (new$progindex IN (61, 62, 65, 75)) THEN
          new$DestPromise := new$Promise;
             
        ELSE 
          IF (new$progindex in (66, 67, 76)) THEN
            new$SourcePromise := new$Promise;
            new$DestPromise := new$Promise;
               
          END IF;
        END IF; 
      END IF;
    END IF;
  END IF;
  /* заполняем вид ораганиазации владельца л\с плательшика и получателя*/
  IF ( (new$SourceFacialACC_Cls <> :old.SourceFacialAcc_Cls) OR (new$SourceFAOrg_Type is null) OR
  ((new$AcceptDate is not null) AND ((:old.AcceptDate is null) OR (new$AcceptDate <> :old.AcceptDate))) ) THEN
    BEGIN
      SELECT org.Org_Type    INTO new$SourceFAOrg_Type FROM Organizations org
      INNER JOIN FacialACC_Cls fac ON (org.ID = fac.Org_Ref)
      WHERE (fac.ID = new$SourceFacialAcc_Cls)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  IF ( (new$DestFacialACC_Cls <> :old.DestFacialAcc_Cls) OR (new$DestFAOrg_Type is null) OR
  ((new$AcceptDate is not null) AND ((:old.AcceptDate is null) OR (new$AcceptDate <> :old.AcceptDate))) ) THEN
    BEGIN
      SELECT org.Org_Type    INTO new$DestFAOrg_Type FROM Organizations org
      INNER JOIN FacialACC_Cls fac ON (org.ID = fac.Org_Ref)
      WHERE (fac.ID = new$DestFacialAcc_Cls)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_FACIALFINDETAIL_BU_120)
-- Create 28.04.2005
-- Last update 12.01.2009
-- - - - - - - - - - - - -

    /*  60 :  'Приход средств от фин.органа'; source
        61 :  'Приход средств от прочих и восстановление расходов'; dest
        62 :  'Приход средств по объявлениям';dest
        63 :  'Уход средств по платежным поручениям'; source
        64 :  'Уход средств по чекам'; source
        65 :  'Переброска средств, Разассигновка';dest
        66 :  'Внутренняя переброска средств, один - многим'; source dest
        67 :  'Уход средств в районы';source
        68 :  'Перечисление на р\с районов';dest
        69 :  'Подтверждение перечисления на р\с районов'; dest
        70 :  'Возврат с р\с районов';source
        71 :  'Подтверждение возврата с р\с районов'; dest */

  /*ClsType*/
  if ((new$ClsType is NULL) and 
        ( 
          ((new$SourceIFS <> 0) and (new$ProgIndex in (63,64,66,67,68,70))) or
          (new$ProgIndex = 60)
        )) then
    new$ClsType := 1; /* если это источник и забыли ввести ClsType */
  elsif ((new$ClsType is NULL) and (new$SourceKD <> 0) and
        (new$ProgIndex in (63,64,66,67,68,70))) then
    new$ClsType := 2; /* если это код дохода и забыли ввести ClsType */
  elsif (new$ClsType is null) then
    new$ClsType := 0; /* иначе - расходная */
  end if;  

  IF ((new$ClsType = 0) AND 
      (((new$SourceIFS <> 0) or (new$SourceKD <> 0)) and
      (new$ProgIndex in (63,64,66,67,68,70)))
     ) THEN /* классификация расходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  IF ((new$ClsType = 1) AND (
    (new$SourceKVSR <> 0) OR (new$SourceKFSR <> 0) OR
    (new$SourceKCSR <> 0) OR (new$SourceKVR <> 0) OR
    (new$SourceKESR <> 0) OR
    ((new$SourceKD <> 0) and (new$ProgIndex in (63,64,66,67,68,70)))
    )) THEN /* классификация источниковая */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  IF ((new$ClsType = 2) AND (
    (new$SourceKVSR <> 0) OR (new$SourceKFSR <> 0) OR
    (new$SourceKCSR <> 0) OR (new$SourceKVR <> 0) OR
    (new$SourceKESR <> 0) OR
    ((new$SourceIFS <> 0) and (new$ProgIndex in (63,64,66,67,68,70)))
    )) THEN /* классификация доходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  /*DestClsType*/
  if (((new$ProgIndex <> 67)and(new$ClsType <> :old.ClsType))or(new$DestClsType is null)) then
    new$DestClsType := new$ClsType;
  end if;  

  IF ((new$DestClsType = 0) AND
      (((new$DestIFS <> 0) or (new$DestKD <> 0)) and
      (new$ProgIndex in (61,62,65,69,71)))
     ) THEN /* классификация расходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  IF ((new$DestClsType = 1) AND (
    (new$DestKVSR <> 0) OR (new$DestKFSR <> 0) OR
    (new$DestKCSR <> 0) OR (new$DestKVR <> 0) OR
    (new$DestKESR <> 0) or
    ((new$DestKD <> 0) and (new$ProgIndex in (61,62,65,69,71)))
    )) THEN /* классификация источниковая */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  IF ((new$DestClsType = 2) AND (
    (new$DestKVSR <> 0) OR (new$DestKFSR <> 0) OR
    (new$DestKCSR <> 0) OR (new$DestKVR <> 0) OR
    (new$DestKESR <> 0) or
    ((new$DestIFS <> 0) and (new$ProgIndex in (61,62,65,69,71)))
    )) THEN /* классификация доходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_FACIALFINDETAIL_BU_200)
-- Version 7.00.02.2
-- - - - - - - - - - - - -

  /* проставляем номера бюджетных обязательств по Учету договоров*/
  GetIntConst(30, 15,PromiseMode$);
  /* ПРОВЕРКА ДЛЯ БЛОКА БО */
  if (PromiseMode$ <> 1) then
    /* Проверка сущствует ли такой номер БО на который ссылается платежка*/
    if ((new$SourcePromise is not null) and (:old.SourcePromise <> new$SourcePromise )) then
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count$          from
      promise_detail pr
      where
      (pr.registrnumber = new$SOURCEPROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count$ = 0) then
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    /* Проверка сущствует ли такой номер БО на который ссылается платежка*/
    if ((new$DestPromise is not null) and (:old.DestPromise <> new$DestPromise )) then
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count$          from
      promise_detail pr
      where
      (pr.registrnumber = new$DestPromise)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count$ = 0) then
        RaiseException('EX_BP_NotExist');      
      END IF;
        
    END IF;/* end проверки PromiseMode <> 1*/
  END IF;
  /* ПРОВЕРКА ДЛЯ БЛОКА УД */
  if (PromiseMode$ = 1) then
    /* source подтяжка внутр. номера по номеру БО*/
    if ((new$SourcePromise is not null)and((:old.SourcePromise is null)or(:old.SourcePromise <> new$SourcePromise )) and 
    (new$SourceBudgetPromise is null) and (:old.SourceBudgetPromise is null)) then
      select max(InnerPromiseNum) 
      into BPInnerNum$           from PaymentSchedule 
      where (ANumber = new$SourcePromise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum$ <> 0) then
        new$SourceBudgetPromise := BPInnerNum$;
                
      else
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    /* dest подтяжка внутр. номера по номеру БО */
    if ((new$DestPromise is not null)and((:old.DestPromise is null)or(new$DestPromise <> :old.DestPromise)) and
    (new$DestBudgetPromise is null) and (:old.DestBudgetPromise is null)) then
      select max(InnerPromiseNum) 
      into BPInnerNum$           from PaymentSchedule
      where (ANumber = new$DestPromise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum$ <> 0) then
        new$DestBudgetPromise := BPInnerNum$;
                
      else
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
          
    /* Если изменился новый номер и при этом старый NULL, тогда устанавливаем старый */
    /* source */
    if (new$SourcePromise is null and ((new$SourceBudgetPromise is not null and :old.SourceBudgetPromise is null) or 
    (new$SourceBudgetPromise <> :old.SourceBudgetPromise))) then
      BEGIN
        select ANumber 
        into BPInnerNum$           from PaymentSchedule
        where (InnerPromiseNum = new$SourceBudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      new$SourcePromise := BPInnerNum$;
      new$Promise := BPInnerNum$;
            
    END IF;
    /* dest */
    if (new$DestPromise is null and ((new$DestBudgetPromise is not null and :old.DestBudgetPromise is null) or 
    (new$DestBudgetPromise <> :old.DestBudgetPromise))) then
      BEGIN
        select ANumber 
        into BPInnerNum$           from PaymentSchedule
        where (InnerPromiseNum = new$DestBudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      new$DestPromise := BPInnerNum$;
      new$Promise := BPInnerNum$;
            
    END IF;
    /* Если удалили новый номер, то нужно удалить и старый*/
    if ((new$SourceBudgetPromise is null) and (:old.SourceBudgetPromise is not null)) then
      new$SourcePromise := null;
      new$Promise := null;
            
    END IF;
    if ((new$DestBudgetPromise is null) and (:old.DestBudgetPromise is not null)) then
      new$DestPromise := null;
      new$Promise := null;
            
    END IF;
    if (new$SourceBudgetPromise is not null and new$SourcePromise is not null) then
      SELECT COUNT(ANumber
      ) INTO CNT$1
      from PaymentSchedule
      where (ANumber = new$SourcePromise and InnerPromiseNum = new$SourceBudgetPromise) AND (ROWNUM = 1);
      if (not (CNT$1<> 0)) then
        RaiseException('Ex_BP_NotExist');
      END IF;
      BEGIN

        /* выбираем дату принятия и причину отклонения заголовка */
        select AcceptDate, Reject_Cls         into CaptionAcceptDate$, CaptionRejectCls$ from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия БО для Source */
        select AcceptDate, Accepted         into PromiseAcceptDate$, PromiseAccepted$ from PaymentSchedule
        where ANumber = new$SourcePromise and InnerPromiseNum = new$SourceBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls$ is null and PromiseAccepted$ <> 1) then
        RaiseException('Ex_BP_Rejected');
      END IF;
      /* если принятый документ ссылается на не принятое БО */
      if (CaptionAcceptDate$ is not null and (PromiseAcceptDate$ is null or PromiseAccepted$ <> 1)) then
        RaiseException('Ex_BP_NotAccepted');      
      END IF;
    END IF;
    if (new$DestBudgetPromise is not null and new$DestPromise is not null) then
      SELECT COUNT(ANumber
      ) INTO CNT$2
      from PaymentSchedule
      where (ANumber = new$DestPromise and InnerPromiseNum = new$DestBudgetPromise) AND (ROWNUM = 1);
      if (not (CNT$2<> 0)) then
        RaiseException('Ex_BP_NotExist');
      END IF;
      BEGIN

        /* выбираем дату принятия и причину отклонения заголовка */
        select AcceptDate, Reject_Cls         into CaptionAcceptDate$, CaptionRejectCls$ from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия БО для Dest */
        select AcceptDate, Accepted         into PromiseAcceptDate$, PromiseAccepted$ from PaymentSchedule
        where ANumber = new$DestPromise and InnerPromiseNum = new$DestBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls$ is null and PromiseAccepted$ <> 1) then
        RaiseException('Ex_BP_Rejected');
      END IF;
      /* если принятый документ ссылается на не принятое БО */
      if (CaptionAcceptDate$ is not null and (PromiseAcceptDate$ is null or PromiseAccepted$ <> 1)) then
        RaiseException('Ex_BP_NotAccepted');      
      END IF;    
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_210 (TR_FACIALFINDETAIL_BU_210)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* используем болк учета договоров?*/
  GetIntConst(30, 15,PromiseMode1$);
  if (PromiseMode1$ = 1) then
    /* при изменении БО плательщика или изменили ДИ */
    if (new$SourcePromise is not null and (
    (:old.SourcePromise is null or :old.SourcePromise <> new$SourcePromise) or
    (:old.SourceExecDoc is null or new$SourceExecDoc is null or :old.SourceExecDoc <> new$SourceExecDoc)
    )) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$SourcePromise and ps.InnerPromiseNum = new$SourceBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$SourceExecDoc := ExecID$;
        new$SourceExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$SourceExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$SourceExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$SourceExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано или не изменилось, а ДИ поменяли, то */
    else 
      if (new$SourceExecDoc is null or :old.SourceExecDoc is null or new$SourceExecDoc <> :old.SourceExecDoc) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$SourceExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$SourceExecInnerNumber := ExecInnerNumber$;
            
      END IF;
    END IF;
    /* теперь тоже самое для Dest */

    /* при изменении БО плательщика или изменили ДИ */
    if (new$DestPromise is not null and (
    (:old.DestPromise is null or :old.DestPromise <> new$DestPromise) or
    (:old.DestExecDoc is null or new$DestExecDoc is null or :old.DestExecDoc <> new$DestExecDoc)
    )) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$DestPromise and ps.InnerPromiseNum = new$DestBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$DestExecDoc := ExecID$;
        new$DestExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$DestExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$DestExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$DestExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано или не изменилось, а ДИ поменяли, то */
    else 
      if (new$DestExecDoc is null or :old.DestExecDoc is null or new$DestExecDoc <> :old.DestExecDoc) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$DestExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$DestExecInnerNumber := ExecInnerNumber$;
            
      END IF;
    END IF;
    if (new$SourceExecDoc is not null) then
      BEGIN
        /* выбираем причину отклонения заголовка */
        select Reject_Cls
        into CaptionRejectCls1$       from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия для Source */
        select Accepted
        into EDAccepted$       from ExecutionDocumentsCaption
        where id = new$SourceExecDoc
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное ДИ */
      if (CaptionRejectCls1$ is null and EDAccepted$ <> 1) then
        RaiseException('Ex_ExecDoc_Rejected');    
      END IF;
    END IF;
    if (new$DestExecDoc is not null) then
      BEGIN
        /* выбираем причину отклонения заголовка */
        select Reject_Cls
        into CaptionRejectCls1$       from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия для Dest */
        select Accepted
        into EDAccepted$       from ExecutionDocumentsCaption
        where ID = new$DestExecDoc
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное ДИ */
      if (CaptionRejectCls1$ is null and EDAccepted$ <> 1) then
        RaiseException('Ex_ExecDoc_Rejected');    
      END IF;  
    END IF;/* использование блока "Учет договоров"*/
  END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_FACIALFINDETAIL_BU_300)
-- Create 20.02.2006
-- - - - - - - - - - - - -

  /* дата принятия детали должна совпадать с датой принятия заголовка (если она есть) */
  if ((:old.AcceptDate <> new$AcceptDate)or((:old.AcceptDate is not null)and(new$AcceptDate is null))) then
    BEGIN
      select c.AcceptDate into CapAcceptDate$
      from facialfincaption c
      where c.id = new$RecordIndex;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        CapAcceptDate$ := NULL;
    END;

    if ((new$AcceptDate = CapAcceptDate$) or (CapAcceptDate$ is null)) then
      new$AcceptDate := new$AcceptDate;
    else
      RaiseException('ex_wrongacceptdate');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_FACIALFINDETAIL_BU_700)
-- Create 17.09.2004
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_FACIALFINDETAIL SET
    ID = new$ID,
    SOURCEFACIALACC_CLS = new$SOURCEFACIALACC_CLS,
    SOURCEKVR = new$SOURCEKVR,
    SOURCEKESR = new$SOURCEKESR,
    DESTFACIALACC_CLS = new$DESTFACIALACC_CLS,
    DESTKVR = new$DESTKVR,
    DESTKESR = new$DESTKESR,
    BUDGETREF = new$BUDGETREF,
    CREDIT = new$CREDIT,
    PAYSYMBOLCLS = new$PAYSYMBOLCLS,
    MEMORDERNUM = new$MEMORDERNUM,
    NOTE = new$NOTE,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    SOURCEKVSR = new$SOURCEKVSR,
    SOURCEKCSR = new$SOURCEKCSR,
    SOURCEKFSR = new$SOURCEKFSR,
    SOURCESUBKESR = new$SOURCESUBKESR,
    SOURCEFACT = new$SOURCEFACT,
    SOURCEMEANSTYPE = new$SOURCEMEANSTYPE,
    SOURCEFINSOURCE = new$SOURCEFINSOURCE,
    SOURCEFINTYPE = new$SOURCEFINTYPE,
    DESTKVSR = new$DESTKVSR,
    DESTKCSR = new$DESTKCSR,
    DESTKFSR = new$DESTKFSR,
    DESTSUBKESR = new$DESTSUBKESR,
    DESTFACT = new$DESTFACT,
    DESTMEANSTYPE = new$DESTMEANSTYPE,
    DESTFINSOURCE = new$DESTFINSOURCE,
    DESTFINTYPE = new$DESTFINTYPE,
    REQUESTSINDEX = new$REQUESTSINDEX,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    PROMISE = new$PROMISE,
    SOURCEDOCTYPE = new$SOURCEDOCTYPE,
    DESTDOCTYPE = new$DESTDOCTYPE,
    SOURCEPROMISE = new$SOURCEPROMISE,
    DESTPROMISE = new$DESTPROMISE,
    RECORDINDEX2 = new$RECORDINDEX2,
    SOURCEBUDGETPROMISE = new$SOURCEBUDGETPROMISE,
    DESTBUDGETPROMISE = new$DESTBUDGETPROMISE,
    SUBPROGINDEX = new$SUBPROGINDEX,
    STIMATEID = new$STIMATEID,
    RVERSION = new$RVERSION,
    SOURCEDIRECTIONCLS = new$SOURCEDIRECTIONCLS,
    DESTDIRECTIONCLS = new$DESTDIRECTIONCLS,
    SOURCEDOCBASE = new$SOURCEDOCBASE,
    DESTDOCBASE = new$DESTDOCBASE,
    SOURCEEXECDOC = new$SOURCEEXECDOC,
    DESTEXECDOC = new$DESTEXECDOC,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    SOURCEIFS = new$SOURCEIFS,
    DESTIFS = new$DESTIFS,
    CLSTYPE = new$CLSTYPE,
    UNIONNOTIFYREF = new$UNIONNOTIFYREF,
    ACCEPTDATE = new$ACCEPTDATE,
    SOURCEKD = new$SOURCEKD,
    DESTKD = new$DESTKD,
    SOURCEREGIONCLS = new$SOURCEREGIONCLS,
    DESTREGIONCLS = new$DESTREGIONCLS,
    DESTFUNDSSOURCE = new$DESTFUNDSSOURCE,
    SOURCEFUNDSSOURCE = new$SOURCEFUNDSSOURCE,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    SOURCETRANSFERTCLS = new$SOURCETRANSFERTCLS,
    DESTTRANSFERTCLS = new$DESTTRANSFERTCLS,
    DESTCLSTYPE = new$DESTCLSTYPE,
    SOURCEASSIGNMENTKIND = new$SOURCEASSIGNMENTKIND,
    DESTASSIGNMENTKIND = new$DESTASSIGNMENTKIND,
    SOURCEEXECINNERNUMBER = new$SOURCEEXECINNERNUMBER,
    DESTEXECINNERNUMBER = new$DESTEXECINNERNUMBER,
    SOURCESUBSIDYCLS = new$SOURCESUBSIDYCLS,
    DESTSUBSIDYCLS = new$DESTSUBSIDYCLS,
    SOURCEFAORG_TYPE = new$SOURCEFAORG_TYPE,
    DESTFAORG_TYPE = new$DESTFAORG_TYPE,
    SOURCEBUDALLOCATIONCLS = new$SOURCEBUDALLOCATIONCLS,
    SOURCEPAYPROMISECLS = new$SOURCEPAYPROMISECLS,
    DESTBUDALLOCATIONCLS = new$DESTBUDALLOCATIONCLS,
    DESTPAYPROMISECLS = new$DESTPAYPROMISECLS,
    SOURCEINVESTOBJECT = new$SOURCEINVESTOBJECT,
    DESTINVESTOBJECT = new$DESTINVESTOBJECT
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_100 (TR_FACIALFINDETAIL_AU_100)
-- Create 14.05.2007
-- - - - - - - - - - - - -

  if (new$ClsType <> :old.ClsType) then
    update FacialFinCaption set
      ClsType = new$ClsType,
      RVersion = -1
    where
      (id = new$RecordIndex)and(ClsType <> new$ClsType);
  end if;    

-- - - - - - - - - - - - -
-- AU_500 (TR_FACIALFINDETAIL_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (22, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=22) and (RecordId=new$ID);
  end if;

END;
/
ALTER TABLE BudgetData ADD (
  InvestObject NUMBER(10),
    CHECK((InvestObject<=2147483647)AND(InvestObject>-2147483648)),
  constraint FK_BD_InvestObject foreign key (InvestObject) references InvestObject(ID)  
)
/
CREATE INDEX FK_BD_InvestObject ON BudgetData(InvestObject)
/
ALTER TABLE TB_Incomes32 ADD (
  InvestObject NUMBER(10),
    CHECK((InvestObject<=2147483647)AND(InvestObject>-2147483648)),
  constraint FK_Inc_InvestObject foreign key (InvestObject) references InvestObject(ID)    
)
/
CREATE INDEX FK_Inc_InvestObject ON TB_Incomes32(InvestObject)
/

CREATE OR REPLACE VIEW Incomes32 (
  ID,
  DOCNUMBER,
  DOCCOUNT,
  IDATE,
  DEBIT,
  CREDIT,
  DOCTYPE,
  INN,
  ORG_REF,
  ACCOUNTINDEX,
  KD,
  SUBKD,
  REGIONCLS,
  GOSNI,
  INCACCOUNT,
  PROGINDEX,
  RECORDINDEX,
  BUDGETREF,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  NOTE,
  RECORDINDEX2,
  ELNUM,
  NOTEEX,
  BUHPAYMENTCLS,
  ACCOUNTREF,
  ELPACKETNUM,
  FACIALACC_CLS,
  NDS,
  MEANSTYPE,
  RECORDDATE,
  TOTALREF,
  REQUESTSINDEX,
  KVSR,
  TAXNOTE,
  DOCNUM,
  REALPAYERORG_REF,
  DOCDATE,
  DOCBASE,
  FACT,
  RVERSION,
  KFSR,
  KESR,
  KVR,
  KCSR,
  SUMCOMPLETE,
  ELDOCREF,
  REQUESTSINDEX2,
  FEDERALFUNDSREF,
  BUHOPERATIONCLS,
  IFS,
  IFS_CORR,
  CLSTYPE,
  NDSNOTE,
  DOGNUM,
  SENDERID,
  SENDERRECORDID,
  OKATO,
  ADDOKATO,
  REJECTCLS,
  REJECTCAUSE,
  FUNDSSOURCE,
  DIRECTIONCLS,
  ISBLOCKED,
  BLOCKEDCAUSE,
  UNBLOCKEDDATE,
  UNBLOCKEDCAUSE,
  STIMATEID,
  TRANSFERTCLS,
  SUBSIDYCLS,
  FAORGTYPE,
  OKTMO,
  UINCODE,
  FINTYPE,
  INVESTOBJECT)
AS
  SELECT
    ID,
    DOCNUMBER,
    DOCCOUNT,
    IDATE,
    DEBIT,
    CREDIT,
    DOCTYPE,
    INN,
    ORG_REF,
    ACCOUNTINDEX,
    KD,
    SUBKD,
    REGIONCLS,
    GOSNI,
    INCACCOUNT,
    PROGINDEX,
    RECORDINDEX,
    BUDGETREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    NOTE,
    RECORDINDEX2,
    ELNUM,
    NOTEEX,
    BUHPAYMENTCLS,
    ACCOUNTREF,
    ELPACKETNUM,
    FACIALACC_CLS,
    NDS,
    MEANSTYPE,
    RECORDDATE,
    TOTALREF,
    REQUESTSINDEX,
    KVSR,
    TAXNOTE,
    DOCNUM,
    REALPAYERORG_REF,
    DOCDATE,
    DOCBASE,
    FACT,
    RVERSION,
    KFSR,
    KESR,
    KVR,
    KCSR,
    SUMCOMPLETE,
    ELDOCREF,
    REQUESTSINDEX2,
    FEDERALFUNDSREF,
    BUHOPERATIONCLS,
    IFS,
    IFS_CORR,
    CLSTYPE,
    NDSNOTE,
    DOGNUM,
    SENDERID,
    SENDERRECORDID,
    OKATO,
    ADDOKATO,
    REJECTCLS,
    REJECTCAUSE,
    FUNDSSOURCE,
    DIRECTIONCLS,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    STIMATEID,
    TRANSFERTCLS,
    SUBSIDYCLS,
    FAORGTYPE,
    OKTMO,
    UINCODE,
    FINTYPE,
    INVESTOBJECT
  FROM TB_Incomes32
/

CREATE OR REPLACE TRIGGER TR_INCOMES32_ID
  INSTEAD OF DELETE
  ON INCOMES32
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_10 (TR_INCOMES32_BD10)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

  delete
  from CurrencyIncomes
  where (id = :old.id);

-- - - - - - - - - - - - -
-- BD_20 (T_INCOMES32_BD_20)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

  /* Удалить платежные поручения */
  if (:old.DocType between 1010 and 1019) then
    delete from PayDoc32
    where 
      (ProgIndex = :old.ProgIndex) 
    and 
     (RecordIndex = :old.id);
  end if;

-- - - - - - - - - - - - -
-- BD_500 (TR_INCOMES32_BD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  Update QuotesTitle set
  DocChangeDate = SYSDATE,
  RVersion = -1
  where id = :old.recordindex;

-- - - - - - - - - - - - -
-- BD_600 (TR_INCOMES32_BD_600)
-- Last update 14.10.2009
-- - - - - - - - - - - - -

    --удаляем детализацию если удаляют заголовок
    if (:old.ProgIndex = 41) then
        delete
            from Incomes32
        where
           (ProgIndex=42)and
           (RecordIndex=:old.id);
    end if;

    --удаляем зеркальную запись(если она есть)
    if (:old.ProgIndex = 42) then
        delete
            from Incomes32
        where
            (ProgIndex=43)and
            (RecordIndex=:old.id);
    end if;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_INCOMES32
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);
   
  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_500 (TR_INCOMES32_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordID, DeleteDate, ProgIndex, SUMMA) values (161, :old.ID, SYSDATE, :old.ProgIndex, :old.DEBIT + :old.CREDIT);

END;
/

CREATE OR REPLACE TRIGGER TR_INCOMES32_II
  INSTEAD OF INSERT
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
  new$INVESTOBJECT INCOMES32.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
--
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  CapDocNumber VARCHAR2(20);
  unkKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  Kd_Master NUMBER(10);
  idKD$ NUMBER(10);
  unkVKD$ VARCHAR2(20);
  val_DocCount$ NUMBER(10);
  val_DocType$ NUMBER(10);
  val_Org_Ref$ NUMBER(10);
  val_AccountIndex$ NUMBER(10);
  val_SubKD$ NUMBER(10);
  val_RegionCLS$ NUMBER(10);
  val_GosNI$ NUMBER(10);
  val_IncAccount$ NUMBER(10);
  val_BudgetRef$ NUMBER(10);
  val_MEANSTYPE$ NUMBER(10);
  val_FACIALACC_CLS$ NUMBER(10);
  val_TransfertCls$ NUMBER(10);
  CapAcceptDate$ NUMBER;
  CapReestrNumber$ VARCHAR2(20);
  CapProgIndex$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_INCOMES32_BI)
-- Version 10.00.00.2
-- - - - - - - - - - - - -

  IF (new$id IS NULL) THEN 
    select g_shared.nextval into new$id from dual;
  END IF;
  /* Заполнение лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$KD IS NULL) THEN 
    new$KD := 0;
  END IF;
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3;
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0;
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  IF (new$FinType IS NULL) THEN  
    new$FinType := 0;
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS IS NULL) THEN 
    new$IFS := 0;
  END IF;
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
   
  /* Заполнение Бюджета, берем из мастера */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0)) THEN
    BEGIN
      SELECT qt.BudgetRef      INTO new$BudgetRef FROM QuotesTitle qt
      WHERE qt.Id = new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или 0, берем из лицевого счета */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0)) THEN
    BEGIN
      SELECT fa.BudgetRef      INTO new$BudgetRef FROM FacialAcc_Cls fa
      WHERE fa.Id = new$FacialAcc_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или 0, берем из константы */
  IF ((new$BudgetRef IS NULL) OR (new$BudgetRef = 0))
  THEN 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
   
  IF (new$ProgIndex = 45) 
  THEN 
    IF (new$IncAccount IS NULL) THEN
      GetDefDFAccRefForBudget(new$BudgetRef,new$IncAccount);
    END IF;
    BEGIN

      /* Получить поля из заголовка */
      SELECT qt.ProgIndex, qt.AcceptDate, qt.IncAccount, qt.ReestrNumber 
      INTO CapProgIndex$, CapAcceptDate$, new$IncAccount, CapReestrNumber$       FROM QuotesTitle qt
      WHERE 
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* ставим дату документа для тех записей по которым не будет п/п */
    /* для п/п отрабатывает скрипт after insert */
    IF (CapProgIndex$ <> 145) THEN 
      new$iDate := CapAcceptDate$;
    END IF;
    IF ((CapProgIndex$ = 145)AND (NOT ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0)OR (new$Credit<0)))) )
    THEN 
      new$Idate := CapAcceptDate$;      
    END IF;
    /* если заголовок - реестр федеральных средств (поступление) */
    IF ((CapProgIndex$ = 45) AND (CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя, *//* необходимо для идентификации ФС*/            
                  
      new$FederalFundsRef := new$ID;
      /* if-then */  
    END IF;/* if-then*/
  END IF;
  BEGIN
    /* заполняем вид организации владелца л\с*/
    SELECT org.Org_Type   INTO new$FAOrgType FROM Organizations org
    INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
    WHERE fac.ID = new$FacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BI_5 (TR_INCOMES_BI_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BI_9 (TR_INCOMES32_BI_VZ)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   IF (new$ProgIndex = 9) THEN
      /* Установить фиктивный РС*/
      GetIntConst (9, 1, new$IncAccount);

      BEGIN
        /* Выбрать даты из заголовка взаимозачета */
        SELECT ACCEPTDATE, BUDGETREF
          INTO new$IDate, new$BudgetRef
          FROM VZ_OFFSET
         WHERE ID = new$RecordIndex;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_INCOMES32_BI_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   BEGIN
      SELECT Inn
        INTO new$Inn
        FROM Organizations o
       WHERE (o.ID = new$Org_Ref);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

/* Заполнение Бюджета. Если пустой или ноль, берем из мастера */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      BEGIN
         SELECT c.BudgetRef
           INTO new$budgetref
           FROM QuotesTitle c
          WHERE c.ID = NEW$RecordIndex;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

   /* Заполнение Бюджета. Если пустой, берем из лицевого счета */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      BEGIN
         SELECT fa.BudgetRef
           INTO new$budgetref
           FROM FacialAcc_Cls fa
          WHERE fa.ID = NEW$FacialAcc_Cls;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
   END IF;

   /* Если пустой, берем из константы */
   IF ((new$budgetref IS NULL) OR (new$budgetref = 0)) THEN
      GetIntConst (-1, 3, new$budgetref);
   END IF;

-- - - - - - - - - - - - -
-- BI_30 (TR_INCOMES32_BI_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_70 (TR_INCOMES32_BI_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
            необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_INCOMES32_BI_100)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if ((not (newKD$  like unkKD$)) and
    (not (newKD$  like unkVKD$))) then
      /* если это налог(вообще здесь может быть сторнирование
         или дебитование невыясненных доходов) ,то создаем зеркальную
         запись,дебитующую код невыясненных доходов*/

      /* сумма в дебете должна быть равна нулю*/
      if (new$Debit <> 0) then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      BEGIN

        /* Почти всю запись подставляем из заголовка*/
        select KD,DocCount,DocType,
        Org_Ref,AccountIndex,SubKD,RegionCLS,GosNI,
        IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,
        TransfertCls
        into
        idKD$,
        val_DocCount$,
        val_DocType$,
        val_Org_Ref$,
        val_AccountIndex$,
        val_SubKD$,
        val_RegionCLS$,
        val_GosNI$,
        val_IncAccount$,
        val_BudgetRef$,
        val_MEANSTYPE$  ,
        val_FACIALACC_CLS$,
        val_TransfertCls$         from incomes32 where id=new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
         
      if (not idKD$ is null) then
        insert into
        /* KD=невыясненный код дохода (должен быть равен коду из мастер записи)
              Debit=0
              сredit=-new.credit
              ProgIndex=43
              RecordIndex=new.id
              id вставляется триггером на Incomes32*/
        Incomes32(CreaterUser, DocNum,DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS, TransfertCls)
        Values(new$CreaterUser, new$DocNum, val_DocCount$, new$iDate, new$DOCDATE, 0, -new$Credit, val_DocType$,
        val_Org_Ref$, val_AccountIndex$, idKD$, val_SubKD$, val_RegionCLS$, val_GosNI$,
        43,new$Id, val_IncAccount$, val_BudgetRef$, new$Note,val_MEANSTYPE$,val_FACIALACC_CLS$,val_TransfertCls$);
        
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_110 (TR_INCOMES32_BI_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       /* если это источник и забыли ввести ClsType */
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                /* иначе - доходная */
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      /* классификация источниковая */
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      /* классификация доходная */
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      /* неверный тип классификации*/
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_INCOMES32_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

  Update QuotesTitle set
  DocChangeDate = new$UpdateDate,
  RVersion = -1
  where id = new$recordindex;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_INCOMES32 (
    ID,
    DOCNUMBER,
    DOCCOUNT,
    IDATE,
    DEBIT,
    CREDIT,
    DOCTYPE,
    INN,
    ORG_REF,
    ACCOUNTINDEX,
    KD,
    SUBKD,
    REGIONCLS,
    GOSNI,
    INCACCOUNT,
    PROGINDEX,
    RECORDINDEX,
    BUDGETREF,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    NOTE,
    RECORDINDEX2,
    ELNUM,
    NOTEEX,
    BUHPAYMENTCLS,
    ACCOUNTREF,
    ELPACKETNUM,
    FACIALACC_CLS,
    NDS,
    MEANSTYPE,
    RECORDDATE,
    TOTALREF,
    REQUESTSINDEX,
    KVSR,
    TAXNOTE,
    DOCNUM,
    REALPAYERORG_REF,
    DOCDATE,
    DOCBASE,
    FACT,
    RVERSION,
    KFSR,
    KESR,
    KVR,
    KCSR,
    SUMCOMPLETE,
    ELDOCREF,
    REQUESTSINDEX2,
    FEDERALFUNDSREF,
    BUHOPERATIONCLS,
    IFS,
    IFS_CORR,
    CLSTYPE,
    NDSNOTE,
    DOGNUM,
    SENDERID,
    SENDERRECORDID,
    OKATO,
    ADDOKATO,
    REJECTCLS,
    REJECTCAUSE,
    FUNDSSOURCE,
    DIRECTIONCLS,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    STIMATEID,
    TRANSFERTCLS,
    SUBSIDYCLS,
    FAORGTYPE,
    OKTMO,
    UINCODE,
    FINTYPE,
    INVESTOBJECT
  ) VALUES (
    new$ID,
    new$DOCNUMBER,
    new$DOCCOUNT,
    new$IDATE,
    new$DEBIT,
    new$CREDIT,
    new$DOCTYPE,
    new$INN,
    new$ORG_REF,
    new$ACCOUNTINDEX,
    new$KD,
    new$SUBKD,
    new$REGIONCLS,
    new$GOSNI,
    new$INCACCOUNT,
    new$PROGINDEX,
    new$RECORDINDEX,
    new$BUDGETREF,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$NOTE,
    new$RECORDINDEX2,
    new$ELNUM,
    new$NOTEEX,
    new$BUHPAYMENTCLS,
    new$ACCOUNTREF,
    new$ELPACKETNUM,
    new$FACIALACC_CLS,
    new$NDS,
    new$MEANSTYPE,
    new$RECORDDATE,
    new$TOTALREF,
    new$REQUESTSINDEX,
    new$KVSR,
    new$TAXNOTE,
    new$DOCNUM,
    new$REALPAYERORG_REF,
    new$DOCDATE,
    new$DOCBASE,
    new$FACT,
    new$RVERSION,
    new$KFSR,
    new$KESR,
    new$KVR,
    new$KCSR,
    new$SUMCOMPLETE,
    new$ELDOCREF,
    new$REQUESTSINDEX2,
    new$FEDERALFUNDSREF,
    new$BUHOPERATIONCLS,
    new$IFS,
    new$IFS_CORR,
    new$CLSTYPE,
    new$NDSNOTE,
    new$DOGNUM,
    new$SENDERID,
    new$SENDERRECORDID,
    new$OKATO,
    new$ADDOKATO,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$FUNDSSOURCE,
    new$DIRECTIONCLS,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$STIMATEID,
    new$TRANSFERTCLS,
    new$SUBSIDYCLS,
    new$FAORGTYPE,
    new$OKTMO,
    new$UINCODE,
    new$FINTYPE,
    new$INVESTOBJECT);

-- - - - - - - - - - - - -
-- AI_20 (T_INCOMES32_AI_20)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   -- Получить поля из заголовка ВД
   if (new$ProgIndex <> 42) then
     BEGIN
       SELECT ProgIndex, DocNumber, AcceptDate
        INTO CapProgIndex, CapDocNumber, CapAcceptDate
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
     EXCEPTION
       WHEN NO_DATA_FOUND THEN NULL;
     END;
   end if;

   -- если заголовок - ВД, то обрабатывать
   IF ((CapProgIndex = 145) or (new$ProgIndex=42)) THEN

      If ((new$ProgIndex=42) and (new$DocType between 1010 and 1019) and
         (new$Debit>0) and (new$DOCDATE is not null))
      then
        BEGIN
          select kd into Kd_Master
    From Incomes32 inc
          where inc.id = new$RecordIndex;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;

        if (Kd_Master = new$Kd) then
          CapAcceptDate := new$DOCDATE;
          CapProgIndex  := new$ProgIndex;
          CapDocNumber  := new$DocNum;
        end if;
      end if; -- нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)

      -- сумма может быть или по кредиту с минусом или по дебету с плюсом
      IF ((CapAcceptDate IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit > 0) OR (new$Credit < 0))) THEN
         -- Создать платежное поручение (Добавлено RealPayerOrg_Ref(PayDoc32)=new$RealPayerOrg_Ref(Incomes32))
         INSERT INTO PayDoc32
            (BudgetRef, AccountRef, PayerAttrRef, InputDate,
             Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref, FACIALACC_CLS)
         VALUES (new$BudgetRef, new$AccountRef, new$IncAccount, CapAcceptDate,
             (new$Debit - new$Credit), new$Note, new$ProgIndex, new$id, CapDocNumber, new$TaxNote,
             new$RealPayerOrg_Ref,new$FACIALACC_CLS);
      -- (new$Debit - new$Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
      -- что в сумму платежного поручения будут попадать или дебет или кредит по модулю
      END IF;

   END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_INCOMES32_AI_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
         WHERE (TableID = 161) AND (RecordID = NEW$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_INCOMES32_IU
  INSTEAD OF UPDATE
  ON INCOMES32
  FOR EACH ROW
DECLARE
  new$ID INCOMES32.ID%TYPE := :NEW.ID;
  new$DOCNUMBER INCOMES32.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$DOCCOUNT INCOMES32.DOCCOUNT%TYPE := :NEW.DOCCOUNT;
  new$IDATE INCOMES32.IDATE%TYPE := :NEW.IDATE;
  new$DEBIT INCOMES32.DEBIT%TYPE := :NEW.DEBIT;
  new$CREDIT INCOMES32.CREDIT%TYPE := :NEW.CREDIT;
  new$DOCTYPE INCOMES32.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$INN INCOMES32.INN%TYPE := :NEW.INN;
  new$ORG_REF INCOMES32.ORG_REF%TYPE := :NEW.ORG_REF;
  new$ACCOUNTINDEX INCOMES32.ACCOUNTINDEX%TYPE := :NEW.ACCOUNTINDEX;
  new$KD INCOMES32.KD%TYPE := :NEW.KD;
  new$SUBKD INCOMES32.SUBKD%TYPE := :NEW.SUBKD;
  new$REGIONCLS INCOMES32.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$GOSNI INCOMES32.GOSNI%TYPE := :NEW.GOSNI;
  new$INCACCOUNT INCOMES32.INCACCOUNT%TYPE := :NEW.INCACCOUNT;
  new$PROGINDEX INCOMES32.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX INCOMES32.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$BUDGETREF INCOMES32.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER INCOMES32.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE INCOMES32.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INCOMES32.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER INCOMES32.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$NOTE INCOMES32.NOTE%TYPE := :NEW.NOTE;
  new$RECORDINDEX2 INCOMES32.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$ELNUM INCOMES32.ELNUM%TYPE := :NEW.ELNUM;
  new$NOTEEX INCOMES32.NOTEEX%TYPE := :NEW.NOTEEX;
  new$BUHPAYMENTCLS INCOMES32.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$ACCOUNTREF INCOMES32.ACCOUNTREF%TYPE := :NEW.ACCOUNTREF;
  new$ELPACKETNUM INCOMES32.ELPACKETNUM%TYPE := :NEW.ELPACKETNUM;
  new$FACIALACC_CLS INCOMES32.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$NDS INCOMES32.NDS%TYPE := :NEW.NDS;
  new$MEANSTYPE INCOMES32.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$RECORDDATE INCOMES32.RECORDDATE%TYPE := :NEW.RECORDDATE;
  new$TOTALREF INCOMES32.TOTALREF%TYPE := :NEW.TOTALREF;
  new$REQUESTSINDEX INCOMES32.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$KVSR INCOMES32.KVSR%TYPE := :NEW.KVSR;
  new$TAXNOTE INCOMES32.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$DOCNUM INCOMES32.DOCNUM%TYPE := :NEW.DOCNUM;
  new$REALPAYERORG_REF INCOMES32.REALPAYERORG_REF%TYPE := :NEW.REALPAYERORG_REF;
  new$DOCDATE INCOMES32.DOCDATE%TYPE := :NEW.DOCDATE;
  new$DOCBASE INCOMES32.DOCBASE%TYPE := :NEW.DOCBASE;
  new$FACT INCOMES32.FACT%TYPE := :NEW.FACT;
  new$RVERSION INCOMES32.RVERSION%TYPE := :NEW.RVERSION;
  new$KFSR INCOMES32.KFSR%TYPE := :NEW.KFSR;
  new$KESR INCOMES32.KESR%TYPE := :NEW.KESR;
  new$KVR INCOMES32.KVR%TYPE := :NEW.KVR;
  new$KCSR INCOMES32.KCSR%TYPE := :NEW.KCSR;
  new$SUMCOMPLETE INCOMES32.SUMCOMPLETE%TYPE := :NEW.SUMCOMPLETE;
  new$ELDOCREF INCOMES32.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$REQUESTSINDEX2 INCOMES32.REQUESTSINDEX2%TYPE := :NEW.REQUESTSINDEX2;
  new$FEDERALFUNDSREF INCOMES32.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$BUHOPERATIONCLS INCOMES32.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$IFS INCOMES32.IFS%TYPE := :NEW.IFS;
  new$IFS_CORR INCOMES32.IFS_CORR%TYPE := :NEW.IFS_CORR;
  new$CLSTYPE INCOMES32.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$NDSNOTE INCOMES32.NDSNOTE%TYPE := :NEW.NDSNOTE;
  new$DOGNUM INCOMES32.DOGNUM%TYPE := :NEW.DOGNUM;
  new$SENDERID INCOMES32.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID INCOMES32.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$OKATO INCOMES32.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO INCOMES32.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$REJECTCLS INCOMES32.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE INCOMES32.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$FUNDSSOURCE INCOMES32.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$DIRECTIONCLS INCOMES32.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$ISBLOCKED INCOMES32.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE INCOMES32.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE INCOMES32.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE INCOMES32.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$STIMATEID INCOMES32.STIMATEID%TYPE := :NEW.STIMATEID;
  new$TRANSFERTCLS INCOMES32.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SUBSIDYCLS INCOMES32.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$FAORGTYPE INCOMES32.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$OKTMO INCOMES32.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE INCOMES32.UINCODE%TYPE := :NEW.UINCODE;
  new$FINTYPE INCOMES32.FINTYPE%TYPE := :NEW.FINTYPE;
  new$INVESTOBJECT INCOMES32.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
--
  unkKD$ VARCHAR2(20);
  unkVKD$ VARCHAR2(20);
  newKD$ VARCHAR2(20);
  oldKD$ VARCHAR2(20);
  CapProgIndex NUMBER(10);
  CapAcceptDate NUMBER;
  CapReestrNumber VARCHAR2(20);
  IsReject$ NUMBER(10);
  CapProgIndex$ NUMBER(10);
  CapDocNumber$ VARCHAR2(20);
  CapAcceptDate$ NUMBER;
  PayDocCount$ NUMBER(10);
  ConstPayQueue$ NUMBER(10);
  ConstSendBy$ NUMBER(10);
  Divided$ NUMBER(10);
  Kd_Master$ NUMBER(10);
  Date_Pd$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CapReestrNumber$ VARCHAR2(20);
  CNT$1 NUMBER(10);
  idKD1$ NUMBER(10);
  val_DocCount1$ NUMBER(10);
  val_DocType1$ NUMBER(10);
  val_Org_Ref1$ NUMBER(10);
  val_AccountIndex1$ NUMBER(10);
  val_SubKD1$ NUMBER(10);
  val_RegionCLS1$ NUMBER(10);
  val_GosNI1$ NUMBER(10);
  val_IncAccount1$ NUMBER(10);
  val_BudgetRef1$ NUMBER(10);
  val_MEANSTYPE1$ NUMBER(10);
  val_FACIALACC_CLS1$ NUMBER(10);
  val_TransfertCls1$ NUMBER(10);
  val_ID431$ NUMBER(10);
  CapProgIndex1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INCOMES32_BU)
-- Version 10.00.00.2
-- - - - - - - - - - - - -

  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DocBase IS NULL) THEN 
    new$DocBase := 0;
  END IF;
  IF (new$Gosni IS NULL) THEN 
    new$Gosni := 0;
  END IF;
  /* 3 - Индекс программы доходов */
  IF (new$ProgIndex IS NULL) THEN 
    new$ProgIndex := 3; 
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0; 
  END IF;
  /* для лицевого счета*/
  IF (new$FACIALACC_CLS IS NULL) THEN 
    new$FACIALACC_CLS := 0; 
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Debit IS NULL) THEN 
    new$Debit := 0;
  END IF;
  IF (new$Credit IS NULL) THEN 
    new$Credit := 0;
  END IF;
  IF (new$Org_Ref IS NULL) THEN 
    new$Org_Ref := 0;
  END IF;
  IF (new$AccountIndex IS NULL) THEN 
    new$AccountIndex := 0; 
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKD IS NULL) THEN 
    new$SubKD := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$DocCount IS NULL) THEN 
    new$DocCount := 1;
  END IF;
  IF (new$BuhPaymentCLS IS NULL) THEN 
    new$BuhPaymentCLS := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$OKATO IS NULL) THEN 
    new$OKATO := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$DirectionCLS IS NULL) THEN 
    new$DirectionCLS := 0;
  END IF;
  IF (new$Debit * new$Credit <> 0) THEN
    RaiseException('ex_FailDebetCretitValue');
  END IF;
  IF (new$FinType IS NULL) THEN  
    new$FinType := 0;
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (new$IFS_CORR IS NULL) THEN 
    new$Ifs_Corr := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$Ifs := 0;
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  BEGIN

    /* Получить поля из заголовка */
    /* должно срабатывать after изменений в заголовке,*/ 
    /* чтобы получать реальные значения полей */
    SELECT ProgIndex, AcceptDate, ReestrNumber
    INTO CapProgIndex1$, CapAcceptDate$, CapReestrNumber$   FROM QuotesTitle qt
    WHERE
    (qt.ID = new$RecordIndex)
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* код не выполняется при изменении заголовка для избежания множественных апдейтов детали из заголовка 
      или создания излишне сложных условий (разделение на доходы, возвраты, ФС) */
  /* если заголовок - реестр федеральных средств (поступление) */
  IF (CapProgIndex1$ = 45)
  THEN 
    IF ((CapAcceptDate$ IS NOT NULL) AND (CapReestrNumber$ IS NOT NULL))
    THEN 
      /* для поступлений федеральных средств ссылка будет на себя,
                  необходимо для идентификации ФС*/            
      new$FederalFundsRef := new$ID;
      /* if-then*/
    ELSE 
      new$FederalFundsRef := NULL;
      /* if-else*/  
    END IF;/* if (CapProgIndex=45) */
  END IF;
  /* проверка на изменение Бюджета */
  IF (new$BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((new$BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN 
      IF ((new$Progindex = 45) OR (new$Progindex = 42)) THEN 
        RaiseException('Ex_CantModufyBudget');
      END IF;
      IF (new$Progindex = 41) THEN
        SELECT COUNT(inc.id ) INTO CNT$1
        FROM incomes32 inc WHERE (inc.recordindex = new$ID) AND (ROWNUM = 1);
        IF ((CNT$1<> 0)) THEN
          RaiseException('Ex_CantModufyBudget');
        END IF;   
      END IF;
    END IF;
  END IF;
  /* заполняем вид организации владельца л\с*/
  IF ( (new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType is null) OR
  ((new$IDate is not null) AND ((:old.IDate is null) OR (new$IDate <> :old.IDate))) ) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_INCOMES_BU_5)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$DocNum IS NULL) AND NOT (new$DocNumber IS NULL)) THEN
      new$DocNum := CAST (new$DocNumber AS VARCHAR2);
   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_INCOMES32_BU_0)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

  BEGIN
    SELECT Inn
     INTO new$Inn
     FROM Organizations o
    WHERE (o.ID = new$Org_Ref);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BU_20 (T_INCOMES32_BU_20)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Получить поля из заголовка ВД */
  IF (new$ProgIndex <> 42) THEN
    BEGIN
      SELECT ProgIndex, DocNumber, AcceptDate
      INTO CapProgIndex$, CapDocNumber$, CapAcceptDate$     FROM QuotesTitle qt
      WHERE
      (qt.ID = new$RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* если заголовок - Возврат доходов, то обрабатывать */
  IF ( (CapProgIndex$ = 145) OR (new$ProgIndex = 42 ) )
  THEN 
    IF ( (new$ProgIndex=42) AND (new$DocType BETWEEN 1010 AND 1019) AND
    (new$Debit>0) AND (new$DOCDATE IS NOT NULL))
    THEN 
      BEGIN
        SELECT kd            INTO Kd_Master$ FROM Incomes32 inc
        WHERE inc.id = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (Kd_Master$ = new$Kd) THEN 
        CapAcceptDate$ := new$DOCDATE;
        CapProgIndex$  := new$ProgIndex;
        CapDocNumber$  := new$DocNum;
        /*  */        
      END IF;/* нужно создавать платежку по возврату невыясненных (если код дохода в заголовке равен коду дохода из детализации)*/
    END IF;
    IF ((CapAcceptDate$ IS NOT NULL) AND (new$DocType BETWEEN 1010 AND 1019) AND ((new$Debit>0) OR (new$Credit<0)))
    THEN 

      /* Обновление или создание платежных поручений */
      /* П/П будет меняться на любое изменение Incomes32, т.к. при изменении заголовка происходит изменение детали, и инициатора изменений нельзя узнать*/

      /* Определяет создано ли уже п/п по записи */
      SELECT COUNT(ID), COUNT(IsDivide), MAX(ANumber), MAX(ACCEPTDATE) /* Берем количество, так как платежка может быть раздроблена*/
      INTO PayDocCount$, Divided$, DocNumber1$, Date_Pd$             FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex IN (45,42)) AND (pd.RecordIndex = new$ID)
      ;
      /* Если пытаемся изменить деталь невыясненных и на ПП уже проставлен номер платежки, то ругаемся.*/
      /* IF (((NEW.Progindex = 42) AND (DocNumber IS NOT NULL)) AND
                      ((OLD.IDATE = Date_PD) or (OLD.IDATE is null and Date_PD is null))
                     ) THEN
                    EXCEPTION EX_CANNOTUPDATENUMBER;*/
                 
                
      IF ((new$Progindex = 42) AND (DocNumber1$ IS NOT NULL))
      then
        if ((new$DocType <> :old.DocType )
        or (new$Debit <> :old.Debit )
        or (new$Credit <> :old.Credit)
        or (new$org_ref <> :old.org_ref)
        or ((new$note <> :old.note) or (new$note is not null and :old.note is null))
        or ((new$DOCDate <> :old.DOCDate) or (new$DOCDate is not null and :old.DOCDate is null))
        )
        then
          RaiseException('EX_CANNOTUPDATENUMBER');
        END IF;
      END IF;
                


      /* Если пользователь установил дату или поменял код документа на ПП */
      IF (PayDocCount$ = 0)
      THEN 
        /* Получить Очередность платежа из констант системы */
        GetIntConst(11, 2,ConstPayQueue$);
        /* Получить вид платежа из констант системы */
        GetIntConst(11, 1,ConstSendBy$);

        /* Создать платежное поручение */
        INSERT INTO PayDoc32
        (BudgetRef,AccountRef, PayerAttrRef, InputDate, SendBy, PayQueue,
        Credit, TextNote, ProgIndex, RecordIndex, SourceDocNumber, TaxNote, RealPayerOrg_Ref,FACIALACC_CLS)
        VALUES
        (new$BudgetRef,new$AccountRef, new$IncAccount, CapAcceptDate$, ConstSendBy$, ConstPayQueue$,
        new$Debit - new$Credit, new$Note, new$ProgIndex, new$id, CapDocNumber$, new$TaxNote, new$RealPayerOrg_Ref,new$FACIALACC_CLS);
        /* (new.Debit - new.Credit) --- т.к. одна из сумм будет обязательно нулём, то в итоге получится,
                        что в сумму платежного поручения будут попадать или дебет или кредит по модулю */

        /* if-then */
      ELSE 
        /* Сменить аттрибуты платежного поручения */
        IF (((new$AccountRef = :old.AccountRef) OR
        ((new$AccountRef IS NULL) AND (:old.AccountRef IS NULL)))
        AND (new$IncAccount = :old.IncAccount)
        AND (new$BudgetRef = :old.BudgetRef)
        AND ((new$Note = :old.Note) OR
        ((new$Note IS NULL) AND (:old.Note IS NULL)))
        AND ((new$RealPayerOrg_Ref = :old.RealPayerOrg_Ref) OR
        ((new$RealPayerOrg_Ref IS NULL) AND (:old.RealPayerOrg_Ref IS NULL)))
        AND ((new$TaxNote = :old.TaxNote) OR
        ((new$TaxNote IS NULL) AND (:old.TaxNote IS NULL)))
        )  THEN
          new$AccountRef := new$AccountRef;
                          
        ELSE

          UPDATE PayDoc32 pd
          SET
          pd.AccountRef = new$AccountRef,
          pd.PayerAttrRef = new$IncAccount,
          pd.AcceptorAttrRef = new$AccountRef,
          pd.TextNote = new$Note,
          pd.TaxNote = new$TaxNote,
          pd.BudgetRef = new$BudgetRef,
          pd.RealPayerOrg_Ref = new$RealPayerOrg_Ref,
          pd.InputDate = CapAcceptDate$,
          pd.SourceDocNumber = CapDocNumber$,
          pd.FACIALACC_CLS = new$FACIALACC_CLS
          WHERE
          (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
        END IF;
        IF (((new$Debit-:old.Debit)>0.001) OR ((new$Debit-:old.Debit)<-0.001)
        OR ((new$Credit-:old.Credit)>0.001) OR ((new$Credit-:old.Credit)<-0.001))
        THEN  
          IF (Divided$ > 0)
          THEN
            /* Платежка раздроблена, и сумму у нее менять нельзя*/
            RaiseException('EX_CANNOTUPDATEDIVIDEDPAYDOC');
          ELSE
            UPDATE PayDoc32 pd
            SET
            pd.Credit = new$Debit - new$Credit
            WHERE
            (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex);
                          
          END IF;/* if-then*/            
        END IF;/* if-else*/
      END IF;
      /* проставляем дату датой проведения п/п */
      /* есть один нюанс: непонятно какую дату проведения брать, если платежка была разбита */
      /* берем максимальную, чтобы не было исключения */
      SELECT MAX(pd.AcceptDate)
      INTO Date_Pd$           FROM PayDoc32 pd
      WHERE (pd.RecordIndex = :old.id) AND (pd.ProgIndex = :old.ProgIndex)
      ;
      new$Idate := Date_Pd$;
      /* if-then*/
    ELSE 
      /* Если вновь установленные значения даты принятия документа
                  и типа документа не удовлетворяют условию создания ПП -
                  удалить платежные поручения. */
      DELETE FROM PayDoc32 pd
      WHERE
      (pd.ProgIndex = new$ProgIndex)
      AND (pd.RecordIndex = new$id);
      /* if-else*/  
    END IF;/* if (CapProgIndex=145)or (new.ProgIndex=42) */
  END IF;

-- - - - - - - - - - - - -
-- BU_30 (TR_INCOMES32_BU_30)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$DocDate is null) and (new$ProgIndex=45)) then 
    BEGIN
      select q.BuildDate 
      into 
      new$DocDate        from QuotesTitle q 
      where q.id = new$RecordIndex 
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if ((new$DocDate is null) and (new$IDATE is not null)) then
    new$DocDate := new$IDATE;
  END IF;
  if ((new$DOCDATE is not null)) then
    new$RecordDate := new$DOCDATE;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$IDate is not null) and (new$RejectCls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_INCOMES32_BU_70)
-- Last update 29.11.2011
-- - - - - - - - - - - - -

   /* Получить поля из заголовка */
   BEGIN
      SELECT ProgIndex, AcceptDate, ReestrNumber
        INTO CapProgIndex, CapAcceptDate, CapReestrNumber
        FROM QuotesTitle qt
       WHERE (qt.ID = new$RecordIndex);
   EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
   END;

   /* если заголовок - реестр федеральных средств (поступление) */
   IF (CapProgIndex = 45) THEN
      IF ((CapAcceptDate IS NOT NULL) AND (CapReestrNumber IS NOT NULL)) THEN
         /* для поступлений федеральных средств ссылка будет на себя,
         необходимо для идентификации ФС*/
         new$FederalFundsRef := new$ID;
      ELSE
         new$FederalFundsRef := NULL;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_INCOMES32_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 42)
  then 
    /* найдем диапазон невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    BEGIN

      select KDValue   into newKD$ from kd where Id=new$kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN
      select KDValue   into oldKD$ from kd where Id=:old.kd
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    BEGIN

      /* Всю запись подставляем из заголовка*/
      select KD,DocCount,DocType, Org_Ref, AccountIndex, SubKD, RegionCLS, GosNI,
      IncAccount, BudgetRef, MEANSTYPE,FACIALACC_CLS,TransfertCls
      into
      idKD1$,
      val_DocCount1$,
      val_DocType1$,
      val_Org_Ref1$,
      val_AccountIndex1$,
      val_SubKD1$,
      val_RegionCLS1$,
      val_GosNI1$,
      val_IncAccount1$,
      val_BudgetRef1$,
      val_MEANSTYPE1$  , 
      val_FACIALACC_CLS1$,
      val_TransfertCls1$         from incomes32 where id=new$RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not idKD1$ is null) then
      if(((newKD$ like unkKD$)or(newKD$ like unkVKD$))and
      (not(oldKD$ like unkKD$))and(not(oldKD$ like unkVKD$)))then
        /* удаляем зеркальную запись,если ее не должно быть*/
        delete
        from Incomes32
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      (new$Debit<>0))
      /* сумма в дебете должна быть равна нулю*/
      then 
        RaiseException('ex_UnknownRedirect');
      END IF;
      if((not(newKD$ like unkKD$))and(not(newKD$ like unkVKD$))and
      ((oldKD$ like unkKD$)or(oldKD$ like unkVKD$)))then
        /* вставляем зеркальную запись,если ее не было,но должна быть */
        insert into
        Incomes32( CreaterUser, DocNum, DocCount, iDate, DOCDATE, Debit, Credit, DocType,
        Org_Ref, AccountIndex, KD, SubKD, RegionCLS, GosNI, ProgIndex,
        RecordIndex, IncAccount, BudgetRef, Note, MEANSTYPE, FACIALACC_CLS,TransfertCls)
        Values( new$CreaterUser, new$DocNum,val_DocCount1$, new$iDATE, new$DOCDATE, 0, -new$Credit,
        val_DocType1$, val_Org_Ref1$, val_AccountIndex1$, idKD1$, val_SubKD1$,
        val_RegionCLS1$, val_GosNI1$, 43, new$Id, val_IncAccount1$, val_BudgetRef1$, 
        new$Note, val_MEANSTYPE1$, val_FACIALACC_CLS1$, val_TransfertCls1$);
      END IF;
      if((not(newKD$ like unkKD$))and(not(oldKD$ like unkKD$))
      and(not(newKD$ like unkVKD$))and(not(oldKD$ like unkVKD$)))then
        /* если зеркальная запись была и остается, то изменяем ее*/
        update Incomes32
        set
        DocNum = new$DocNum,
        DocCount = val_DocCount1$,
        iDate = new$iDate,
        DOCDATE = new$DOCDATE,
        Debit = 0,
        Credit = -new$Credit,
        DocType = val_DocType1$,
        Org_Ref = val_Org_Ref1$,
        AccountIndex = val_AccountIndex1$,
        KD = idKD1$,
        SubKD = val_SubKD1$,
        RegionCLS = val_RegionCLS1$,
        GosNI = val_GosNI1$,
        ProgIndex = 43,
        RecordIndex = new$Id,
        IncAccount = val_IncAccount1$,
        BudgetRef = val_BudgetRef1$,
        Note = new$Note,
        MEANSTYPE = val_MEANSTYPE1$,
        FACIALACC_CLS = val_FACIALACC_CLS1$,
        TransfertCls = val_TransfertCls1$,
        RVersion = -1
        where
        (ProgIndex=43)and
        (RecordIndex=:old.id);
         
      END IF; 
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_105 (TR_INCOMES32_BU_105)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$ProgIndex = 41)    /* Невыясненные поступления (заголовок) */
  then 
    /* найдем маску невыясненных доходов*/
    GetVarCharConst(3,0,unkKD$);
    /* найдем маску внебюджетных невыясненных доходов*/
    GetVarCharConst(3,11,unkVKD$);  
    /* Найдем все соотнесенные доходы данного невыясненного поступления*/
    FOR REC$1 IN (SELECT inc.id
     AS val_ID42    FROM Incomes32 inc
    LEFT OUTER JOIN KD ON (kd.id =  inc.kd)
    WHERE (inc.ProgIndex =  42) and
    (inc.RecordIndex =  new$id) and
    (inc.debit = 0) and
    (not(kd.kdvalue like unkKD$)) and
    (not(kd.kdvalue like unkVKD$))
    )
    LOOP
      BEGIN
        /* Находим зеркальную запись для каждой соотнесенной */
        select inc.id
        into val_ID431$         FROM Incomes32 inc
        WHERE (inc.ProgIndex =  43) and
        (inc.RecordIndex =  REC$1.val_ID42)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;

      /* Всю запись подставляем из заголовка, не изменяя Credit, ProgIndex, RecordIndex */
      update Incomes32
      set
      DocNum = new$DocNum,
      DocCount = new$DocCount,       
      DOCDATE = new$DOCDATE,
      Debit = 0,
      DocType = new$DocType,
      Org_Ref = new$Org_Ref,
      AccountIndex = new$AccountIndex,
      KD = new$Kd,
      SubKD = new$SubKD,
      RegionCLS = new$RegionCLS,
      GosNI = new$GosNI,
      IncAccount = new$IncAccount,
      BudgetRef = new$BudgetRef,
      Note = new$Note,
      MEANSTYPE = new$MEANSTYPE,
      FACIALACC_CLS = new$FACIALACC_CLS,
      FACT = new$FACT,
      TransfertCls = new$TransfertCls,
      DirectionCls = new$DirectionCls,
      rversion = -1
      where id = val_ID431$;

        
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_INCOMES32_BU_110)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF ((new$ClsType IS NULL) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      new$ClsType := 1;       -- если это источник и забыли ввести ClsType
   ELSIF (new$ClsType IS NULL) THEN
      new$ClsType := 2;                                -- иначе - доходная
   END IF;

   IF ((new$ClsType = 1) AND (new$KD <> 0)) THEN
      -- классификация источниковая
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType = 2) AND (new$IFS <> 0) AND (new$ProgIndex <> 44)) THEN
      -- классификация доходная
      RaiseEXCEPTION ('EX_WRONGBUDCLS');
   END IF;

   IF ((new$ClsType <> 1) AND (new$ClsType <> 2)) THEN
      -- неверный тип классификации
      RaiseEXCEPTION ('EX_WRONGBUDCLSTYPE');
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_INCOMES32_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.RejectCLS is null)and(:new.RejectCLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.RejectCLS is not null)and(:new.RejectCLS is null)) then
    IsReject$ := 0;
  end if;  
  if (IsReject$ <> -1) then
    update LinkRecords set
      IsRejected = IsReject$
    where
      (ChildID = :new.ID)
      or(ChildID in (select d.id from incomes32 d where d.RecordIndex = :new.id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_INCOMES32_BU_700)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INCOMES32 SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    DOCCOUNT = new$DOCCOUNT,
    IDATE = new$IDATE,
    DEBIT = new$DEBIT,
    CREDIT = new$CREDIT,
    DOCTYPE = new$DOCTYPE,
    INN = new$INN,
    ORG_REF = new$ORG_REF,
    ACCOUNTINDEX = new$ACCOUNTINDEX,
    KD = new$KD,
    SUBKD = new$SUBKD,
    REGIONCLS = new$REGIONCLS,
    GOSNI = new$GOSNI,
    INCACCOUNT = new$INCACCOUNT,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    NOTE = new$NOTE,
    RECORDINDEX2 = new$RECORDINDEX2,
    ELNUM = new$ELNUM,
    NOTEEX = new$NOTEEX,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    ACCOUNTREF = new$ACCOUNTREF,
    ELPACKETNUM = new$ELPACKETNUM,
    FACIALACC_CLS = new$FACIALACC_CLS,
    NDS = new$NDS,
    MEANSTYPE = new$MEANSTYPE,
    RECORDDATE = new$RECORDDATE,
    TOTALREF = new$TOTALREF,
    REQUESTSINDEX = new$REQUESTSINDEX,
    KVSR = new$KVSR,
    TAXNOTE = new$TAXNOTE,
    DOCNUM = new$DOCNUM,
    REALPAYERORG_REF = new$REALPAYERORG_REF,
    DOCDATE = new$DOCDATE,
    DOCBASE = new$DOCBASE,
    FACT = new$FACT,
    RVERSION = new$RVERSION,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVR = new$KVR,
    KCSR = new$KCSR,
    SUMCOMPLETE = new$SUMCOMPLETE,
    ELDOCREF = new$ELDOCREF,
    REQUESTSINDEX2 = new$REQUESTSINDEX2,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    IFS = new$IFS,
    IFS_CORR = new$IFS_CORR,
    CLSTYPE = new$CLSTYPE,
    NDSNOTE = new$NDSNOTE,
    DOGNUM = new$DOGNUM,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    FUNDSSOURCE = new$FUNDSSOURCE,
    DIRECTIONCLS = new$DIRECTIONCLS,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    STIMATEID = new$STIMATEID,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SUBSIDYCLS = new$SUBSIDYCLS,
    FAORGTYPE = new$FAORGTYPE,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    FINTYPE = new$FINTYPE,
    INVESTOBJECT = new$INVESTOBJECT
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INCOMES32_AU_500)
-- Create 15.09.2005
-- - - - - - - - - - - - -

   IF (NEW$ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (161, :OLD.ID, SYSDATE);
      DELETE FROM DelRecIndexes
        WHERE (TableID = 161) AND (RecordId = NEW$ID);
   END IF;

END;
/
ALTER TABLE TB_PaymentSchedule ADD (
  InvestObject NUMBER(10),
    CHECK((InvestObject<=2147483647)AND(InvestObject>-2147483648)),
  constraint FK_PS_InvestObject foreign key (InvestObject) references InvestObject(ID)    
)
/
CREATE INDEX FK_PS_InvestObject ON TB_PaymentSchedule(InvestObject)
/

CREATE OR REPLACE VIEW PaymentSchedule (
  ID,
  ANUMBER,
  PARENTNUMBER,
  KFSR,
  KESR,
  KVSR,
  KCSR,
  KVR,
  MONTH01,
  MONTH02,
  MONTH03,
  MONTH04,
  MONTH05,
  MONTH06,
  MONTH07,
  MONTH08,
  MONTH09,
  MONTH10,
  MONTH11,
  MONTH12,
  SUMMA,
  REGION,
  SUBKESR,
  MEANSTYPE,
  FINSOURCE,
  FINTYPE,
  FACT,
  FACIALACC_CLS,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  BUDGETREF,
  ACCEPTDATE,
  LASTADJUSTMENT,
  ACCEPTED,
  LASTACCEPTED,
  PROMISETYPE,
  ADJUSTMENTREF,
  OLDNUMBER,
  SUMMAPREVIOUSYEAR,
  SUMMAFINPREVIOUSYEAR,
  QUARTER1,
  QUARTER2,
  QUARTER3,
  QUARTER4,
  RECORDINDEX,
  CRYPTOSTATUS,
  SENDERID,
  SENDERRECORDID,
  DIRECTIONCLS,
  RVERSION,
  BUHOPERATIONCLS,
  MONTH01DELTA,
  MONTH02DELTA,
  MONTH03DELTA,
  MONTH04DELTA,
  MONTH05DELTA,
  MONTH06DELTA,
  MONTH07DELTA,
  MONTH08DELTA,
  MONTH09DELTA,
  MONTH10DELTA,
  MONTH11DELTA,
  MONTH12DELTA,
  QUARTER1DELTA,
  QUARTER2DELTA,
  QUARTER3DELTA,
  QUARTER4DELTA,
  SUMMADELTA,
  NOTE,
  FINYEAR,
  SUMMAYEAR1,
  SUMMAYEAR2,
  SUMMAYEAR3,
  SUMMAYEAR1DELTA,
  SUMMAYEAR2DELTA,
  SUMMAYEAR3DELTA,
  ASSIGNMENTKIND,
  TRANSFERTCLS,
  SENDERIDKEY,
  SENDERRECORDIDKEY,
  EXECUTIONREF,
  INNERPROMISENUM,
  ADJUSTMENTNUMBER,
  PROMISENUMBER,
  SUBSIDYCLS,
  AGREEMENTREF,
  BUDALLOCATIONCLS,
  PAYPROMISECLS,
  PROGINDEX,
  INVESTOBJECT)
AS
  SELECT
    ID,
    ANUMBER,
    PARENTNUMBER,
    KFSR,
    KESR,
    KVSR,
    KCSR,
    KVR,
    MONTH01,
    MONTH02,
    MONTH03,
    MONTH04,
    MONTH05,
    MONTH06,
    MONTH07,
    MONTH08,
    MONTH09,
    MONTH10,
    MONTH11,
    MONTH12,
    SUMMA,
    REGION,
    SUBKESR,
    MEANSTYPE,
    FINSOURCE,
    FINTYPE,
    FACT,
    FACIALACC_CLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    ACCEPTDATE,
    LASTADJUSTMENT,
    ACCEPTED,
    LASTACCEPTED,
    PROMISETYPE,
    ADJUSTMENTREF,
    OLDNUMBER,
    SUMMAPREVIOUSYEAR,
    SUMMAFINPREVIOUSYEAR,
    QUARTER1,
    QUARTER2,
    QUARTER3,
    QUARTER4,
    RECORDINDEX,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    DIRECTIONCLS,
    RVERSION,
    BUHOPERATIONCLS,
    MONTH01DELTA,
    MONTH02DELTA,
    MONTH03DELTA,
    MONTH04DELTA,
    MONTH05DELTA,
    MONTH06DELTA,
    MONTH07DELTA,
    MONTH08DELTA,
    MONTH09DELTA,
    MONTH10DELTA,
    MONTH11DELTA,
    MONTH12DELTA,
    QUARTER1DELTA,
    QUARTER2DELTA,
    QUARTER3DELTA,
    QUARTER4DELTA,
    SUMMADELTA,
    NOTE,
    FINYEAR,
    SUMMAYEAR1,
    SUMMAYEAR2,
    SUMMAYEAR3,
    SUMMAYEAR1DELTA,
    SUMMAYEAR2DELTA,
    SUMMAYEAR3DELTA,
    ASSIGNMENTKIND,
    TRANSFERTCLS,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    EXECUTIONREF,
    INNERPROMISENUM,
    ADJUSTMENTNUMBER,
    PROMISENUMBER,
    SUBSIDYCLS,
    AGREEMENTREF,
    BUDALLOCATIONCLS,
    PAYPROMISECLS,
    PROGINDEX,
    INVESTOBJECT
  FROM TB_PaymentSchedule
/

CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_ID
  INSTEAD OF DELETE
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  SummInMonths$ NUMBER(15,2);
  cnt1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_PAYMENTSCHEDULE_BD)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 6.0*/
  select count(ID) into cnt1$ from PaymentSchedule where (AdjustmentRef = :old.ID) ;
  if (cnt1$ > 0) then
    RaiseException('EX_Agr_CantDelAdjustmented');
  END IF;

  select count(ID)
  into cnt1$   from FacialFinDetail
  where (SourceBudgetPromise = :old.InnerPromiseNum and SourcePromise=:old.ANumber)
  or (DestBudgetPromise = :old.InnerPromiseNum and DestPromise=:old.ANumber)
  ;
  if (cnt1$ > 0) then
    RaiseException('ex_CantDeleteAgreement');
  END IF;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_PAYMENTSCHEDULE
  WHERE Id = :old.id;

-- - - - - - - - - - - - -
-- AD_10 (TR_PAYMENTSCHEDULE_AD_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Восстановление флага LastAdjustment у предыдущей записи в цепочке*/
  if ((:old.AdjustmentNumber > 0) and (:old.LastAdjustment = 1)) then
    update PaymentSchedule set
    LastAdjustment = 1,
    RVersion = -1
    where (ID = :old.AdjustmentRef);
  END IF;
  /* Восстановление флага LastAccepted у предыдущей записи в цепочке*/    
  if ((:old.AdjustmentNumber > 0) and (:old.LastAccepted = 1)) then
    update PaymentSchedule set
    LastAccepted = 1,
    RVersion = -1
    where (ID = :old.AdjustmentRef);        
  END IF;

-- - - - - - - - - - - - -
-- AD_500 (TR_PAYMENTSCHEDULE_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  SummInMonths$ := :old.Month01+:old.Month02+:old.Month03+:old.Month04+:old.Month05+
  :old.Month06+:old.Month07+:old.Month08+:old.Month09+:old.Month10+:old.Month11+:old.Month12;
  if ((SummInMonths$  < 0.005) and (SummInMonths$  > -0.005)) then
    SummInMonths$ := :old.SummaYear1;
  END IF;
  insert into DelRecIndexes(TableID, RecordID, DeleteDate, ProgIndex, SUMMA) values (113, :old.ID, SYSDATE, :old.ProgIndex, SummInMonths$);

END;
/

CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_II
  INSTEAD OF INSERT
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  new$ID PAYMENTSCHEDULE.ID%TYPE := :NEW.ID;
  new$ANUMBER PAYMENTSCHEDULE.ANUMBER%TYPE := :NEW.ANUMBER;
  new$PARENTNUMBER PAYMENTSCHEDULE.PARENTNUMBER%TYPE := :NEW.PARENTNUMBER;
  new$KFSR PAYMENTSCHEDULE.KFSR%TYPE := :NEW.KFSR;
  new$KESR PAYMENTSCHEDULE.KESR%TYPE := :NEW.KESR;
  new$KVSR PAYMENTSCHEDULE.KVSR%TYPE := :NEW.KVSR;
  new$KCSR PAYMENTSCHEDULE.KCSR%TYPE := :NEW.KCSR;
  new$KVR PAYMENTSCHEDULE.KVR%TYPE := :NEW.KVR;
  new$MONTH01 PAYMENTSCHEDULE.MONTH01%TYPE := :NEW.MONTH01;
  new$MONTH02 PAYMENTSCHEDULE.MONTH02%TYPE := :NEW.MONTH02;
  new$MONTH03 PAYMENTSCHEDULE.MONTH03%TYPE := :NEW.MONTH03;
  new$MONTH04 PAYMENTSCHEDULE.MONTH04%TYPE := :NEW.MONTH04;
  new$MONTH05 PAYMENTSCHEDULE.MONTH05%TYPE := :NEW.MONTH05;
  new$MONTH06 PAYMENTSCHEDULE.MONTH06%TYPE := :NEW.MONTH06;
  new$MONTH07 PAYMENTSCHEDULE.MONTH07%TYPE := :NEW.MONTH07;
  new$MONTH08 PAYMENTSCHEDULE.MONTH08%TYPE := :NEW.MONTH08;
  new$MONTH09 PAYMENTSCHEDULE.MONTH09%TYPE := :NEW.MONTH09;
  new$MONTH10 PAYMENTSCHEDULE.MONTH10%TYPE := :NEW.MONTH10;
  new$MONTH11 PAYMENTSCHEDULE.MONTH11%TYPE := :NEW.MONTH11;
  new$MONTH12 PAYMENTSCHEDULE.MONTH12%TYPE := :NEW.MONTH12;
  new$SUMMA PAYMENTSCHEDULE.SUMMA%TYPE := :NEW.SUMMA;
  new$REGION PAYMENTSCHEDULE.REGION%TYPE := :NEW.REGION;
  new$SUBKESR PAYMENTSCHEDULE.SUBKESR%TYPE := :NEW.SUBKESR;
  new$MEANSTYPE PAYMENTSCHEDULE.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$FINSOURCE PAYMENTSCHEDULE.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$FINTYPE PAYMENTSCHEDULE.FINTYPE%TYPE := :NEW.FINTYPE;
  new$FACT PAYMENTSCHEDULE.FACT%TYPE := :NEW.FACT;
  new$FACIALACC_CLS PAYMENTSCHEDULE.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$CREATERUSER PAYMENTSCHEDULE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE PAYMENTSCHEDULE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE PAYMENTSCHEDULE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER PAYMENTSCHEDULE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF PAYMENTSCHEDULE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$ACCEPTDATE PAYMENTSCHEDULE.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$LASTADJUSTMENT PAYMENTSCHEDULE.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$ACCEPTED PAYMENTSCHEDULE.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED PAYMENTSCHEDULE.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$PROMISETYPE PAYMENTSCHEDULE.PROMISETYPE%TYPE := :NEW.PROMISETYPE;
  new$ADJUSTMENTREF PAYMENTSCHEDULE.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$OLDNUMBER PAYMENTSCHEDULE.OLDNUMBER%TYPE := :NEW.OLDNUMBER;
  new$SUMMAPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAPREVIOUSYEAR%TYPE := :NEW.SUMMAPREVIOUSYEAR;
  new$SUMMAFINPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAFINPREVIOUSYEAR%TYPE := :NEW.SUMMAFINPREVIOUSYEAR;
  new$QUARTER1 PAYMENTSCHEDULE.QUARTER1%TYPE := :NEW.QUARTER1;
  new$QUARTER2 PAYMENTSCHEDULE.QUARTER2%TYPE := :NEW.QUARTER2;
  new$QUARTER3 PAYMENTSCHEDULE.QUARTER3%TYPE := :NEW.QUARTER3;
  new$QUARTER4 PAYMENTSCHEDULE.QUARTER4%TYPE := :NEW.QUARTER4;
  new$RECORDINDEX PAYMENTSCHEDULE.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CRYPTOSTATUS PAYMENTSCHEDULE.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID PAYMENTSCHEDULE.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID PAYMENTSCHEDULE.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DIRECTIONCLS PAYMENTSCHEDULE.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$RVERSION PAYMENTSCHEDULE.RVERSION%TYPE := :NEW.RVERSION;
  new$BUHOPERATIONCLS PAYMENTSCHEDULE.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$MONTH01DELTA PAYMENTSCHEDULE.MONTH01DELTA%TYPE := :NEW.MONTH01DELTA;
  new$MONTH02DELTA PAYMENTSCHEDULE.MONTH02DELTA%TYPE := :NEW.MONTH02DELTA;
  new$MONTH03DELTA PAYMENTSCHEDULE.MONTH03DELTA%TYPE := :NEW.MONTH03DELTA;
  new$MONTH04DELTA PAYMENTSCHEDULE.MONTH04DELTA%TYPE := :NEW.MONTH04DELTA;
  new$MONTH05DELTA PAYMENTSCHEDULE.MONTH05DELTA%TYPE := :NEW.MONTH05DELTA;
  new$MONTH06DELTA PAYMENTSCHEDULE.MONTH06DELTA%TYPE := :NEW.MONTH06DELTA;
  new$MONTH07DELTA PAYMENTSCHEDULE.MONTH07DELTA%TYPE := :NEW.MONTH07DELTA;
  new$MONTH08DELTA PAYMENTSCHEDULE.MONTH08DELTA%TYPE := :NEW.MONTH08DELTA;
  new$MONTH09DELTA PAYMENTSCHEDULE.MONTH09DELTA%TYPE := :NEW.MONTH09DELTA;
  new$MONTH10DELTA PAYMENTSCHEDULE.MONTH10DELTA%TYPE := :NEW.MONTH10DELTA;
  new$MONTH11DELTA PAYMENTSCHEDULE.MONTH11DELTA%TYPE := :NEW.MONTH11DELTA;
  new$MONTH12DELTA PAYMENTSCHEDULE.MONTH12DELTA%TYPE := :NEW.MONTH12DELTA;
  new$QUARTER1DELTA PAYMENTSCHEDULE.QUARTER1DELTA%TYPE := :NEW.QUARTER1DELTA;
  new$QUARTER2DELTA PAYMENTSCHEDULE.QUARTER2DELTA%TYPE := :NEW.QUARTER2DELTA;
  new$QUARTER3DELTA PAYMENTSCHEDULE.QUARTER3DELTA%TYPE := :NEW.QUARTER3DELTA;
  new$QUARTER4DELTA PAYMENTSCHEDULE.QUARTER4DELTA%TYPE := :NEW.QUARTER4DELTA;
  new$SUMMADELTA PAYMENTSCHEDULE.SUMMADELTA%TYPE := :NEW.SUMMADELTA;
  new$NOTE PAYMENTSCHEDULE.NOTE%TYPE := :NEW.NOTE;
  new$FINYEAR PAYMENTSCHEDULE.FINYEAR%TYPE := :NEW.FINYEAR;
  new$SUMMAYEAR1 PAYMENTSCHEDULE.SUMMAYEAR1%TYPE := :NEW.SUMMAYEAR1;
  new$SUMMAYEAR2 PAYMENTSCHEDULE.SUMMAYEAR2%TYPE := :NEW.SUMMAYEAR2;
  new$SUMMAYEAR3 PAYMENTSCHEDULE.SUMMAYEAR3%TYPE := :NEW.SUMMAYEAR3;
  new$SUMMAYEAR1DELTA PAYMENTSCHEDULE.SUMMAYEAR1DELTA%TYPE := :NEW.SUMMAYEAR1DELTA;
  new$SUMMAYEAR2DELTA PAYMENTSCHEDULE.SUMMAYEAR2DELTA%TYPE := :NEW.SUMMAYEAR2DELTA;
  new$SUMMAYEAR3DELTA PAYMENTSCHEDULE.SUMMAYEAR3DELTA%TYPE := :NEW.SUMMAYEAR3DELTA;
  new$ASSIGNMENTKIND PAYMENTSCHEDULE.ASSIGNMENTKIND%TYPE := :NEW.ASSIGNMENTKIND;
  new$TRANSFERTCLS PAYMENTSCHEDULE.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SENDERIDKEY PAYMENTSCHEDULE.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY PAYMENTSCHEDULE.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$EXECUTIONREF PAYMENTSCHEDULE.EXECUTIONREF%TYPE := :NEW.EXECUTIONREF;
  new$INNERPROMISENUM PAYMENTSCHEDULE.INNERPROMISENUM%TYPE := :NEW.INNERPROMISENUM;
  new$ADJUSTMENTNUMBER PAYMENTSCHEDULE.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$PROMISENUMBER PAYMENTSCHEDULE.PROMISENUMBER%TYPE := :NEW.PROMISENUMBER;
  new$SUBSIDYCLS PAYMENTSCHEDULE.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$AGREEMENTREF PAYMENTSCHEDULE.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$BUDALLOCATIONCLS PAYMENTSCHEDULE.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS PAYMENTSCHEDULE.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
  new$PROGINDEX PAYMENTSCHEDULE.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$INVESTOBJECT PAYMENTSCHEDULE.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
--
  M01$ NUMBER;
  M02$ NUMBER;
  M03$ NUMBER;
  M04$ NUMBER;
  M05$ NUMBER;
  M06$ NUMBER;
  M07$ NUMBER;
  M08$ NUMBER;
  M09$ NUMBER;
  M10$ NUMBER;
  M11$ NUMBER;
  M12$ NUMBER;
  Q1$ NUMBER;
  Q2$ NUMBER;
  Q3$ NUMBER;
  Q4$ NUMBER;
  S$ NUMBER;
  S1$ NUMBER;
  S2$ NUMBER;
  S3$ NUMBER;
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  AdjDocNum$ NUMBER(10);
  InnerNumber_parent$ NUMBER(10);
  InnerNumber_child$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_PAYMENTSCHEDULE_BI)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$PromiseType is null) then 
    new$PromiseType := 0;
  END IF;
  if (new$KFSR is null) then 
    new$KFSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KCSR is null) then 
    new$KCSR := 0;
  END IF;
  if (new$KVR is null) then 
    new$KVR := 0;
  END IF;
  if (new$SubKESR is null) then 
    new$SubKESR := 0;
  END IF;
  if (new$AssignmentKind is null) then 
    new$AssignmentKind := 0;
  END IF;
  if (new$DirectionCls is null) then 
    new$DirectionCls := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$MeansType is null) then 
    new$MeansType := 0;
  END IF;
  if (new$FinSource is null) then 
    new$FinSource := 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$Month01 is null) then 
    new$Month01 := 0;
  END IF;
  if (new$Month02 is null) then 
    new$Month02 := 0;
  END IF;
  if (new$Month03 is null) then 
    new$Month03 := 0;
  END IF;
  if (new$Month04 is null) then 
    new$Month04 := 0;
  END IF;
  if (new$Month05 is null) then 
    new$Month05 := 0;
  END IF;
  if (new$Month06 is null) then 
    new$Month06 := 0;
  END IF;
  if (new$Month07 is null) then 
    new$Month07 := 0;
  END IF;
  if (new$Month08 is null) then 
    new$Month08 := 0;
  END IF;
  if (new$Month09 is null) then 
    new$Month09 := 0;
  END IF;
  if (new$Month10 is null) then 
    new$Month10 := 0;
  END IF;
  if (new$Month11 is null) then 
    new$Month11 := 0;
  END IF;
  if (new$Month12 is null) then 
    new$Month12 := 0;
  END IF;
  if (new$Quarter1 is null) then 
    new$Quarter1 := 0;
  END IF;
  if (new$Quarter2 is null) then 
    new$Quarter2 := 0;
  END IF;
  if (new$Quarter3 is null) then 
    new$Quarter3 := 0;
  END IF;
  if (new$Quarter4 is null) then 
    new$Quarter4 := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$Month01Delta is null) then 
    new$Month01Delta := 0;
  END IF;
  if (new$Month02Delta is null) then 
    new$Month02Delta := 0;
  END IF;
  if (new$Month03Delta is null) then 
    new$Month03Delta := 0;
  END IF;
  if (new$Month04Delta is null) then 
    new$Month04Delta := 0;
  END IF;
  if (new$Month05Delta is null) then 
    new$Month05Delta := 0;
  END IF;
  if (new$Month06Delta is null) then 
    new$Month06Delta := 0;
  END IF;
  if (new$Month07Delta is null) then 
    new$Month07Delta := 0;
  END IF;
  if (new$Month08Delta is null) then 
    new$Month08Delta := 0;
  END IF;
  if (new$Month09Delta is null) then 
    new$Month09Delta := 0;
  END IF;
  if (new$Month10Delta is null) then 
    new$Month10Delta := 0;
  END IF;
  if (new$Month11Delta is null) then 
    new$Month11Delta := 0;
  END IF;
  if (new$Month12Delta is null) then 
    new$Month12Delta := 0;
  END IF;
  if (new$Quarter1Delta is null) then 
    new$Quarter1Delta := 0;
  END IF;
  if (new$Quarter2Delta is null) then 
    new$Quarter2Delta := 0;
  END IF;
  if (new$Quarter3Delta is null) then 
    new$Quarter3Delta := 0;
  END IF;
  if (new$Quarter4Delta is null) then 
    new$Quarter4Delta := 0;
  END IF;
  if (new$SummaDelta is null) then 
    new$SummaDelta := 0;
  END IF;
  if (new$SummaPreviousYear is null) then 
    new$SummaPreviousYear := 0;
  END IF;
  if (new$SummaFinPreviousYear is null) then 
    new$SummaFinPreviousYear := 0;
  END IF;
  if (new$SummaYear1 is null) then 
    new$SummaYear1 := 0;
  END IF;
  if (new$SummaYear2 is null) then 
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then 
    new$SummaYear3 := 0;
  END IF;
  if (new$SummaYear1Delta is null) then 
    new$SummaYear1Delta := 0;
  END IF;
  if (new$SummaYear2Delta is null) then 
    new$SummaYear2Delta := 0;
  END IF;
  if (new$SummaYear3Delta is null) then 
    new$SummaYear3Delta := 0;
  END IF;
  if (new$SummaYear2 is null) then  
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then  
    new$SummaYear3 := 0;
  END IF;
  /* проверка на то, что ссылаемся на этап из этого договора */
  if (new$ProgIndex = 304 and new$RecordIndex is not null) then
    SELECT COUNT(*) INTO CNT$1
    from AgreementSteps s where (s.Id = new$RecordIndex and s.RecordIndex = new$AgreementRef) AND (ROWNUM = 1);
    if (not (CNT$1<> 0)) then
      RaiseException('Ex_WrongStep');
    END IF;
  END IF;
  /* Заполнение Бюджета из этапа или заголовка */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    if (new$ProgIndex in (304,314,317,318)) then
      BEGIN
        select a.BudgetRef       into new$BudgetRef from Agreements a
        where a.ID = new$AgreementRef
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
    else 
      if (new$ProgIndex = 308) then
        BEGIN
          select e.BudgetRef
          into new$BudgetRef       from ExecutionDocumentsCaption e
          where e.ID = new$ExecutionRef
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
      END IF;
    END IF;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  if (new$ANumber is not null) then
    SELECT COUNT(                    id
    ) INTO CNT$2
    from
    PaymentSchedule ps
    where
    (                    (ps.ANumber = new$ANumber)
    and
    (ps.BudgetRef = new$BudgetRef)) AND (ROWNUM = 1);
    if ((CNT$2<> 0)) then
      RaiseException('ex_Promise_NumUQ');
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_1 (TR_PAYMENTSCHEDULE_BI_1)
-- Create 05.03.2004
-- Last update 29.12.2007
-- - - - - - - - - - - - -

/* Версия триггера 1.0*/
    if (new$Quarter1 = 0) then new$Quarter1 := new$Month01 + new$Month02 + new$Month03; end if;
    if (new$Quarter2 = 0) then new$Quarter2 := new$Month04 + new$Month05 + new$Month06; end if;
    if (new$Quarter3 = 0) then new$Quarter3 := new$Month07 + new$Month08 + new$Month09; end if;
    if (new$Quarter4 = 0) then new$Quarter4 := new$Month10 + new$Month11 + new$Month12; end if;
    new$SummaYear1 := new$Quarter1 + new$Quarter2 + new$Quarter3 + new$Quarter4;

-- - - - - - - - - - - - -
-- BI_10 (TR_PAYMENTSCHEDULE_BI_10)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
     
  /* Проверка указания внутренних номеров.*/
  if (new$InnerPromiseNum is null) then
    RaiseException('EX_BP_InnerNumsIsNull');
  END IF;
      
  /* Получение внутреннего номера уточнения*/
  select max(AdjustmentNumber)
  into Tmp$         from PaymentSchedule 
  where (InnerPromiseNum = new$InnerPromiseNum)
  ;
  /* Если это первая запись в цепочке, тогда устанавливаем 0*/
  if (Tmp$ is null) then
    new$AdjustmentNumber := 0;
        
  else
    new$AdjustmentNumber := Tmp$ + 1;
  END IF;
      
  /* Флаг последнего уточнения устанавливается в единицу при вставке, только если уточнение не отклонено*/
  if ((new$Accepted = 0) and (new$AcceptDate is not null)) then
    new$LastAdjustment := 0;
        
  else
    new$LastAdjustment := 1;
  END IF;
      
  /* Если БО принято, тогда устанавливаем флаг постледнего принятого в цепочке*/
  if ((new$AcceptDate is not null) and (new$Accepted = 1)) then 
    new$LastAccepted := 1;
        
  else
    new$LastAccepted := 0;
  END IF;
  /* Если БО является уточнением*/
  if (new$AdjustmentNumber > 0) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID), max(ANumber)
    into Tmp$, AdjID$, AdjDocNum$             from PaymentSchedule
    where (InnerPromiseNum = new$InnerPromiseNum) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/
    if (Tmp$ <> 1) then 
      RaiseException('EX_BP_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID) 
    into Tmp$             from PaymentSchedule
    where (InnerPromiseNum = new$InnerPromiseNum) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then 
      RaiseException('EX_BP_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/        
    new$AdjustmentRef := AdjID$;
    new$ParentNumber := AdjDocNum$;
    /* если пытаемся что-то уточнить, то проверим, что заголовки одни и те же */
    if (new$ProgIndex in (304, 314)) then
      BEGIN
        /* получим номер цепочки заголовка */        
        select a.InnerNumber
        into InnerNumber_child$             from Agreements a
        where a.ID = new$AgreementRef
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN
        /* получим номер цепочки заголовка уточняемой детали */
        select a.InnerNumber
        into InnerNumber_parent$             from PaymentSchedule ps
        left join Agreements a on (a.Id = ps.AgreementRef)
        where (ps.Id = new$AdjustmentRef)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* номера цепочек заголовков обязаны совпадать */
      if (InnerNumber_parent$ <> InnerNumber_child$) then
        RaiseException('EX_PROMISE_ADJ_INCORRECT');        
      END IF;
    else 
      if (new$ProgIndex = 308) then
        BEGIN
          /* получим номер цепочки заголовка */        
          select edc.InnerNumber
          into InnerNumber_child$             from ExecutionDocumentsCaption edc
          where edc.ID = new$ExecutionRef
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        BEGIN
          /* получим номер цепочки заголовка уточняемой детали */
          select edc.InnerNumber
          into InnerNumber_parent$             from PaymentSchedule ps
          left join ExecutionDocumentsCaption edc on (edc.id=ps.ExecutionRef)
          where (ps.Id = new$AdjustmentRef)
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        /* номера цепочек заголовков обязаны совпадать */
        if (InnerNumber_parent$ <> InnerNumber_child$) then
          RaiseException('EX_PROMISE_ADJ_INCORRECT');        
        END IF;
      END IF;    
    END IF;
  else /* Если БО не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/        
    new$AdjustmentRef := null;
    new$ParentNumber := null;
        
  END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_PAYMENTSCHEDULE_BI_100)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Для уточнений дельту вычисляем как разницу текущего уточнения и предыдущего */
  if (new$AdjustmentNumber > 0) then
    BEGIN
      select 
      Month01, Month02, Month03, Month04, Month05, Month06,
      Month07, Month08, Month09, Month10, Month11, Month12,
      Quarter1, Quarter2, Quarter3, Quarter4, Summa, 
      SummaYear1, SummaYear2, SummaYear3
      into
      M01$, M02$, M03$, M04$, M05$, M06$, M07$, M08$, M09$, M10$, M11$, M12$, 
      Q1$, Q2$, Q3$, Q4$, S$, S1$, S2$, S3$         from 
      PaymentSchedule
      where
      ID = new$AdjustmentRef
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
          
    new$Month01Delta := new$Month01 - M01$;
    new$Month02Delta := new$Month02 - M02$;
    new$Month03Delta := new$Month03 - M03$;
    new$Month04Delta := new$Month04 - M04$;
    new$Month05Delta := new$Month05 - M05$;
    new$Month06Delta := new$Month06 - M06$;
    new$Month07Delta := new$Month07 - M07$;
    new$Month08Delta := new$Month08 - M08$;
    new$Month09Delta := new$Month09 - M09$;
    new$Month10Delta := new$Month10 - M10$;
    new$Month11Delta := new$Month11 - M11$;
    new$Month12Delta := new$Month12 - M12$;
    new$Quarter1Delta := new$Quarter1 - Q1$;
    new$Quarter2Delta := new$Quarter2 - Q2$;
    new$Quarter3Delta := new$Quarter3 - Q3$;
    new$Quarter4Delta := new$Quarter4 - Q4$;
    new$SummaDelta := new$Summa - S$;
    new$SummaYear1Delta := new$SummaYear1 - S1$;
    new$SummaYear2Delta := new$SummaYear2 - S2$;
    new$SummaYear3Delta := new$SummaYear3 - S3$;
        
  else    /* В первых версиях дельты равны суммам БО */  
    new$Month01Delta := new$Month01;
    new$Month02Delta := new$Month02;
    new$Month03Delta := new$Month03;
    new$Month04Delta := new$Month04;
    new$Month05Delta := new$Month05;
    new$Month06Delta := new$Month06;
    new$Month07Delta := new$Month07;
    new$Month08Delta := new$Month08;
    new$Month09Delta := new$Month09;
    new$Month10Delta := new$Month10;
    new$Month11Delta := new$Month11;
    new$Month12Delta := new$Month12;
    new$Quarter1Delta := new$Quarter1;
    new$Quarter2Delta := new$Quarter2;
    new$Quarter3Delta := new$Quarter3;
    new$Quarter4Delta := new$Quarter4;
    new$SummaDelta := new$Summa;
    new$SummaYear1Delta := new$SummaYear1;
    new$SummaYear2Delta := new$SummaYear2;
    new$SummaYear3Delta := new$SummaYear3;
        
  END IF;

-- - - - - - - - - - - - -
-- BI_200 (TR_PAYMENTSCHEDULE_BI_200)
-- Create 06.08.2010
-- - - - - - - - - - - - -

  /*автозаполнение полей информации о строке в УРМ*/
  if (new$senderId is null) then 
    new$senderIdKey := -1;
  else
    new$senderIdKey := new$senderId;
  end if;

  if (new$SenderRecordID is null)then
    new$SenderRecordIDKey := new$ID;
  else
    new$SenderRecordIDKey := new$SenderRecordID;
  end if;       

-- - - - - - - - - - - - -
-- BI_500 (TR_PAYMENTSCHEDULE_BI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_PAYMENTSCHEDULE (
    ID,
    ANUMBER,
    PARENTNUMBER,
    KFSR,
    KESR,
    KVSR,
    KCSR,
    KVR,
    MONTH01,
    MONTH02,
    MONTH03,
    MONTH04,
    MONTH05,
    MONTH06,
    MONTH07,
    MONTH08,
    MONTH09,
    MONTH10,
    MONTH11,
    MONTH12,
    SUMMA,
    REGION,
    SUBKESR,
    MEANSTYPE,
    FINSOURCE,
    FINTYPE,
    FACT,
    FACIALACC_CLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    ACCEPTDATE,
    LASTADJUSTMENT,
    ACCEPTED,
    LASTACCEPTED,
    PROMISETYPE,
    ADJUSTMENTREF,
    OLDNUMBER,
    SUMMAPREVIOUSYEAR,
    SUMMAFINPREVIOUSYEAR,
    QUARTER1,
    QUARTER2,
    QUARTER3,
    QUARTER4,
    RECORDINDEX,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    DIRECTIONCLS,
    RVERSION,
    BUHOPERATIONCLS,
    MONTH01DELTA,
    MONTH02DELTA,
    MONTH03DELTA,
    MONTH04DELTA,
    MONTH05DELTA,
    MONTH06DELTA,
    MONTH07DELTA,
    MONTH08DELTA,
    MONTH09DELTA,
    MONTH10DELTA,
    MONTH11DELTA,
    MONTH12DELTA,
    QUARTER1DELTA,
    QUARTER2DELTA,
    QUARTER3DELTA,
    QUARTER4DELTA,
    SUMMADELTA,
    NOTE,
    FINYEAR,
    SUMMAYEAR1,
    SUMMAYEAR2,
    SUMMAYEAR3,
    SUMMAYEAR1DELTA,
    SUMMAYEAR2DELTA,
    SUMMAYEAR3DELTA,
    ASSIGNMENTKIND,
    TRANSFERTCLS,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    EXECUTIONREF,
    INNERPROMISENUM,
    ADJUSTMENTNUMBER,
    PROMISENUMBER,
    SUBSIDYCLS,
    AGREEMENTREF,
    BUDALLOCATIONCLS,
    PAYPROMISECLS,
    PROGINDEX,
    INVESTOBJECT
  ) VALUES (
    new$ID,
    new$ANUMBER,
    new$PARENTNUMBER,
    new$KFSR,
    new$KESR,
    new$KVSR,
    new$KCSR,
    new$KVR,
    new$MONTH01,
    new$MONTH02,
    new$MONTH03,
    new$MONTH04,
    new$MONTH05,
    new$MONTH06,
    new$MONTH07,
    new$MONTH08,
    new$MONTH09,
    new$MONTH10,
    new$MONTH11,
    new$MONTH12,
    new$SUMMA,
    new$REGION,
    new$SUBKESR,
    new$MEANSTYPE,
    new$FINSOURCE,
    new$FINTYPE,
    new$FACT,
    new$FACIALACC_CLS,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$ACCEPTDATE,
    new$LASTADJUSTMENT,
    new$ACCEPTED,
    new$LASTACCEPTED,
    new$PROMISETYPE,
    new$ADJUSTMENTREF,
    new$OLDNUMBER,
    new$SUMMAPREVIOUSYEAR,
    new$SUMMAFINPREVIOUSYEAR,
    new$QUARTER1,
    new$QUARTER2,
    new$QUARTER3,
    new$QUARTER4,
    new$RECORDINDEX,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$DIRECTIONCLS,
    new$RVERSION,
    new$BUHOPERATIONCLS,
    new$MONTH01DELTA,
    new$MONTH02DELTA,
    new$MONTH03DELTA,
    new$MONTH04DELTA,
    new$MONTH05DELTA,
    new$MONTH06DELTA,
    new$MONTH07DELTA,
    new$MONTH08DELTA,
    new$MONTH09DELTA,
    new$MONTH10DELTA,
    new$MONTH11DELTA,
    new$MONTH12DELTA,
    new$QUARTER1DELTA,
    new$QUARTER2DELTA,
    new$QUARTER3DELTA,
    new$QUARTER4DELTA,
    new$SUMMADELTA,
    new$NOTE,
    new$FINYEAR,
    new$SUMMAYEAR1,
    new$SUMMAYEAR2,
    new$SUMMAYEAR3,
    new$SUMMAYEAR1DELTA,
    new$SUMMAYEAR2DELTA,
    new$SUMMAYEAR3DELTA,
    new$ASSIGNMENTKIND,
    new$TRANSFERTCLS,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$EXECUTIONREF,
    new$INNERPROMISENUM,
    new$ADJUSTMENTNUMBER,
    new$PROMISENUMBER,
    new$SUBSIDYCLS,
    new$AGREEMENTREF,
    new$BUDALLOCATIONCLS,
    new$PAYPROMISECLS,
    new$PROGINDEX,
    new$INVESTOBJECT);

-- - - - - - - - - - - - -
-- AI_10 (TR_PAYMENTSCHEDULE_AI_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Коррекция вспомогательных флагов в уточняемой записи*/
  if ((new$AdjustmentNumber > 0) and (new$LastAdjustment = 1)) then
    update PaymentSchedule set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);            
    if (new$LastAccepted = 1) then
      update PaymentSchedule set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_PAYMENTSCHEDULE_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 113) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_IU
  INSTEAD OF UPDATE
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  new$ID PAYMENTSCHEDULE.ID%TYPE := :NEW.ID;
  new$ANUMBER PAYMENTSCHEDULE.ANUMBER%TYPE := :NEW.ANUMBER;
  new$PARENTNUMBER PAYMENTSCHEDULE.PARENTNUMBER%TYPE := :NEW.PARENTNUMBER;
  new$KFSR PAYMENTSCHEDULE.KFSR%TYPE := :NEW.KFSR;
  new$KESR PAYMENTSCHEDULE.KESR%TYPE := :NEW.KESR;
  new$KVSR PAYMENTSCHEDULE.KVSR%TYPE := :NEW.KVSR;
  new$KCSR PAYMENTSCHEDULE.KCSR%TYPE := :NEW.KCSR;
  new$KVR PAYMENTSCHEDULE.KVR%TYPE := :NEW.KVR;
  new$MONTH01 PAYMENTSCHEDULE.MONTH01%TYPE := :NEW.MONTH01;
  new$MONTH02 PAYMENTSCHEDULE.MONTH02%TYPE := :NEW.MONTH02;
  new$MONTH03 PAYMENTSCHEDULE.MONTH03%TYPE := :NEW.MONTH03;
  new$MONTH04 PAYMENTSCHEDULE.MONTH04%TYPE := :NEW.MONTH04;
  new$MONTH05 PAYMENTSCHEDULE.MONTH05%TYPE := :NEW.MONTH05;
  new$MONTH06 PAYMENTSCHEDULE.MONTH06%TYPE := :NEW.MONTH06;
  new$MONTH07 PAYMENTSCHEDULE.MONTH07%TYPE := :NEW.MONTH07;
  new$MONTH08 PAYMENTSCHEDULE.MONTH08%TYPE := :NEW.MONTH08;
  new$MONTH09 PAYMENTSCHEDULE.MONTH09%TYPE := :NEW.MONTH09;
  new$MONTH10 PAYMENTSCHEDULE.MONTH10%TYPE := :NEW.MONTH10;
  new$MONTH11 PAYMENTSCHEDULE.MONTH11%TYPE := :NEW.MONTH11;
  new$MONTH12 PAYMENTSCHEDULE.MONTH12%TYPE := :NEW.MONTH12;
  new$SUMMA PAYMENTSCHEDULE.SUMMA%TYPE := :NEW.SUMMA;
  new$REGION PAYMENTSCHEDULE.REGION%TYPE := :NEW.REGION;
  new$SUBKESR PAYMENTSCHEDULE.SUBKESR%TYPE := :NEW.SUBKESR;
  new$MEANSTYPE PAYMENTSCHEDULE.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$FINSOURCE PAYMENTSCHEDULE.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$FINTYPE PAYMENTSCHEDULE.FINTYPE%TYPE := :NEW.FINTYPE;
  new$FACT PAYMENTSCHEDULE.FACT%TYPE := :NEW.FACT;
  new$FACIALACC_CLS PAYMENTSCHEDULE.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$CREATERUSER PAYMENTSCHEDULE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE PAYMENTSCHEDULE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE PAYMENTSCHEDULE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER PAYMENTSCHEDULE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF PAYMENTSCHEDULE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$ACCEPTDATE PAYMENTSCHEDULE.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$LASTADJUSTMENT PAYMENTSCHEDULE.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$ACCEPTED PAYMENTSCHEDULE.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED PAYMENTSCHEDULE.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$PROMISETYPE PAYMENTSCHEDULE.PROMISETYPE%TYPE := :NEW.PROMISETYPE;
  new$ADJUSTMENTREF PAYMENTSCHEDULE.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$OLDNUMBER PAYMENTSCHEDULE.OLDNUMBER%TYPE := :NEW.OLDNUMBER;
  new$SUMMAPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAPREVIOUSYEAR%TYPE := :NEW.SUMMAPREVIOUSYEAR;
  new$SUMMAFINPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAFINPREVIOUSYEAR%TYPE := :NEW.SUMMAFINPREVIOUSYEAR;
  new$QUARTER1 PAYMENTSCHEDULE.QUARTER1%TYPE := :NEW.QUARTER1;
  new$QUARTER2 PAYMENTSCHEDULE.QUARTER2%TYPE := :NEW.QUARTER2;
  new$QUARTER3 PAYMENTSCHEDULE.QUARTER3%TYPE := :NEW.QUARTER3;
  new$QUARTER4 PAYMENTSCHEDULE.QUARTER4%TYPE := :NEW.QUARTER4;
  new$RECORDINDEX PAYMENTSCHEDULE.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CRYPTOSTATUS PAYMENTSCHEDULE.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID PAYMENTSCHEDULE.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID PAYMENTSCHEDULE.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DIRECTIONCLS PAYMENTSCHEDULE.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$RVERSION PAYMENTSCHEDULE.RVERSION%TYPE := :NEW.RVERSION;
  new$BUHOPERATIONCLS PAYMENTSCHEDULE.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$MONTH01DELTA PAYMENTSCHEDULE.MONTH01DELTA%TYPE := :NEW.MONTH01DELTA;
  new$MONTH02DELTA PAYMENTSCHEDULE.MONTH02DELTA%TYPE := :NEW.MONTH02DELTA;
  new$MONTH03DELTA PAYMENTSCHEDULE.MONTH03DELTA%TYPE := :NEW.MONTH03DELTA;
  new$MONTH04DELTA PAYMENTSCHEDULE.MONTH04DELTA%TYPE := :NEW.MONTH04DELTA;
  new$MONTH05DELTA PAYMENTSCHEDULE.MONTH05DELTA%TYPE := :NEW.MONTH05DELTA;
  new$MONTH06DELTA PAYMENTSCHEDULE.MONTH06DELTA%TYPE := :NEW.MONTH06DELTA;
  new$MONTH07DELTA PAYMENTSCHEDULE.MONTH07DELTA%TYPE := :NEW.MONTH07DELTA;
  new$MONTH08DELTA PAYMENTSCHEDULE.MONTH08DELTA%TYPE := :NEW.MONTH08DELTA;
  new$MONTH09DELTA PAYMENTSCHEDULE.MONTH09DELTA%TYPE := :NEW.MONTH09DELTA;
  new$MONTH10DELTA PAYMENTSCHEDULE.MONTH10DELTA%TYPE := :NEW.MONTH10DELTA;
  new$MONTH11DELTA PAYMENTSCHEDULE.MONTH11DELTA%TYPE := :NEW.MONTH11DELTA;
  new$MONTH12DELTA PAYMENTSCHEDULE.MONTH12DELTA%TYPE := :NEW.MONTH12DELTA;
  new$QUARTER1DELTA PAYMENTSCHEDULE.QUARTER1DELTA%TYPE := :NEW.QUARTER1DELTA;
  new$QUARTER2DELTA PAYMENTSCHEDULE.QUARTER2DELTA%TYPE := :NEW.QUARTER2DELTA;
  new$QUARTER3DELTA PAYMENTSCHEDULE.QUARTER3DELTA%TYPE := :NEW.QUARTER3DELTA;
  new$QUARTER4DELTA PAYMENTSCHEDULE.QUARTER4DELTA%TYPE := :NEW.QUARTER4DELTA;
  new$SUMMADELTA PAYMENTSCHEDULE.SUMMADELTA%TYPE := :NEW.SUMMADELTA;
  new$NOTE PAYMENTSCHEDULE.NOTE%TYPE := :NEW.NOTE;
  new$FINYEAR PAYMENTSCHEDULE.FINYEAR%TYPE := :NEW.FINYEAR;
  new$SUMMAYEAR1 PAYMENTSCHEDULE.SUMMAYEAR1%TYPE := :NEW.SUMMAYEAR1;
  new$SUMMAYEAR2 PAYMENTSCHEDULE.SUMMAYEAR2%TYPE := :NEW.SUMMAYEAR2;
  new$SUMMAYEAR3 PAYMENTSCHEDULE.SUMMAYEAR3%TYPE := :NEW.SUMMAYEAR3;
  new$SUMMAYEAR1DELTA PAYMENTSCHEDULE.SUMMAYEAR1DELTA%TYPE := :NEW.SUMMAYEAR1DELTA;
  new$SUMMAYEAR2DELTA PAYMENTSCHEDULE.SUMMAYEAR2DELTA%TYPE := :NEW.SUMMAYEAR2DELTA;
  new$SUMMAYEAR3DELTA PAYMENTSCHEDULE.SUMMAYEAR3DELTA%TYPE := :NEW.SUMMAYEAR3DELTA;
  new$ASSIGNMENTKIND PAYMENTSCHEDULE.ASSIGNMENTKIND%TYPE := :NEW.ASSIGNMENTKIND;
  new$TRANSFERTCLS PAYMENTSCHEDULE.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SENDERIDKEY PAYMENTSCHEDULE.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY PAYMENTSCHEDULE.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$EXECUTIONREF PAYMENTSCHEDULE.EXECUTIONREF%TYPE := :NEW.EXECUTIONREF;
  new$INNERPROMISENUM PAYMENTSCHEDULE.INNERPROMISENUM%TYPE := :NEW.INNERPROMISENUM;
  new$ADJUSTMENTNUMBER PAYMENTSCHEDULE.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$PROMISENUMBER PAYMENTSCHEDULE.PROMISENUMBER%TYPE := :NEW.PROMISENUMBER;
  new$SUBSIDYCLS PAYMENTSCHEDULE.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$AGREEMENTREF PAYMENTSCHEDULE.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$BUDALLOCATIONCLS PAYMENTSCHEDULE.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS PAYMENTSCHEDULE.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
  new$PROGINDEX PAYMENTSCHEDULE.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$INVESTOBJECT PAYMENTSCHEDULE.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
--
  M01$ NUMBER;
  M02$ NUMBER;
  M03$ NUMBER;
  M04$ NUMBER;
  M05$ NUMBER;
  M06$ NUMBER;
  M07$ NUMBER;
  M08$ NUMBER;
  M09$ NUMBER;
  M10$ NUMBER;
  M11$ NUMBER;
  M12$ NUMBER;
  Q1$ NUMBER;
  Q2$ NUMBER;
  Q3$ NUMBER;
  Q4$ NUMBER;
  S$ NUMBER;
  S1$ NUMBER;
  S2$ NUMBER;
  S3$ NUMBER;
  MaxNumber1$ NUMBER(10);
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_PAYMENTSCHEDULE_BU)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 2.4*/
  /* установка значений полей по-умолчанию*/
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$PromiseType is null) then 
    new$PromiseType := 0;
  END IF;
  if (new$KFSR is null) then 
    new$KFSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KCSR is null) then 
    new$KCSR := 0;
  END IF;
  if (new$KVR is null) then 
    new$KVR := 0;
  END IF;
  if (new$SubKESR is null) then 
    new$SubKESR := 0;
  END IF;
  if (new$AssignmentKind is null) then 
    new$AssignmentKind := 0;
  END IF;
   
  if (new$DirectionCls is null) then 
    new$DirectionCls := 0;
  END IF;
   
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$MeansType is null) then 
    new$MeansType := 0;
  END IF;
  if (new$FinSource is null) then 
    new$FinSource := 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$BuhOperationCLS is null) then 
    GetIntConst(60, 15,new$BuhOperationCLS); 
  END IF;
  if (new$Month01 is null) then 
    new$Month01 := 0;
  END IF;
  if (new$Month02 is null) then 
    new$Month02 := 0;
  END IF;
  if (new$Month03 is null) then 
    new$Month03 := 0;
  END IF;
  if (new$Month04 is null) then 
    new$Month04 := 0;
  END IF;
  if (new$Month05 is null) then 
    new$Month05 := 0;
  END IF;
  if (new$Month06 is null) then 
    new$Month06 := 0;
  END IF;
  if (new$Month07 is null) then 
    new$Month07 := 0;
  END IF;
  if (new$Month08 is null) then 
    new$Month08 := 0;
  END IF;
  if (new$Month09 is null) then 
    new$Month09 := 0;
  END IF;
  if (new$Month10 is null) then 
    new$Month10 := 0;
  END IF;
  if (new$Month11 is null) then 
    new$Month11 := 0;
  END IF;
  if (new$Month12 is null) then 
    new$Month12 := 0;
  END IF;
  if (new$Quarter1 is null) then 
    new$Quarter1 := 0;
  END IF;
  if (new$Quarter2 is null) then 
    new$Quarter2 := 0;
  END IF;
  if (new$Quarter3 is null) then 
    new$Quarter3 := 0;
  END IF;
  if (new$Quarter4 is null) then 
    new$Quarter4 := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$Month01Delta is null) then 
    new$Month01Delta := 0;
  END IF;
  if (new$Month02Delta is null) then 
    new$Month02Delta := 0;
  END IF;
  if (new$Month03Delta is null) then 
    new$Month03Delta := 0;
  END IF;
  if (new$Month04Delta is null) then 
    new$Month04Delta := 0;
  END IF;
  if (new$Month05Delta is null) then 
    new$Month05Delta := 0;
  END IF;
  if (new$Month06Delta is null) then 
    new$Month06Delta := 0;
  END IF;
  if (new$Month07Delta is null) then 
    new$Month07Delta := 0;
  END IF;
  if (new$Month08Delta is null) then 
    new$Month08Delta := 0;
  END IF;
  if (new$Month09Delta is null) then 
    new$Month09Delta := 0;
  END IF;
  if (new$Month10Delta is null) then 
    new$Month10Delta := 0;
  END IF;
  if (new$Month11Delta is null) then 
    new$Month11Delta := 0;
  END IF;
  if (new$Month12Delta is null) then 
    new$Month12Delta := 0;
  END IF;
  if (new$Quarter1Delta is null) then 
    new$Quarter1Delta := 0;
  END IF;
  if (new$Quarter2Delta is null) then 
    new$Quarter2Delta := 0;
  END IF;
  if (new$Quarter3Delta is null) then 
    new$Quarter3Delta := 0;
  END IF;
  if (new$Quarter4Delta is null) then 
    new$Quarter4Delta := 0;
  END IF;
  if (new$SummaDelta is null) then 
    new$SummaDelta := 0; 
  END IF;
  if (new$SummaPreviousYear is null) then 
    new$SummaPreviousYear := 0;
  END IF;
  if (new$SummaFinPreviousYear is null) then 
    new$SummaFinPreviousYear := 0;
  END IF;
   
  if (new$SummaYear1 is null) then 
    new$SummaYear1 := 0;
  END IF;
  if (new$SummaYear2 is null) then 
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then 
    new$SummaYear3 := 0;
  END IF;
   
  if (new$SummaYear1Delta is null) then 
    new$SummaYear1Delta := 0;
  END IF;
  if (new$SummaYear2Delta is null) then 
    new$SummaYear2Delta := 0;
  END IF;
  if (new$SummaYear3Delta is null) then 
    new$SummaYear3Delta := 0;
  END IF;
   
  if (new$SummaYear2 is null) then  
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then  
    new$SummaYear3 := 0;
  END IF;
  /* проверка на то, что ссылаемся на этап из этого договора */
  if (new$ProgIndex = 304 and new$RecordIndex is not null and (:old.RecordIndex is null or :old.RecordIndex <> new$RecordIndex)) then
    SELECT COUNT(*) INTO CNT$1
    from AgreementSteps s where (s.Id = new$RecordIndex and s.RecordIndex = new$AgreementRef) AND (ROWNUM = 1);
    if (not (CNT$1<> 0)) then
      RaiseException('Ex_WrongStep');
    END IF;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      RaiseException('Ex_CantModufyBudget');
    END IF;
  END IF;
  if ((:old.ANumber is null) and (new$ANumber is not Null)) then
    SELECT COUNT(                    id
    ) INTO CNT$2
    from
    PaymentSchedule ps
    where
    (                    (ps.ANumber = new$ANumber)
    and
    (ps.BudgetRef = new$BudgetRef)) AND (ROWNUM = 1);
    if ((CNT$2<> 0)) then
      RaiseException('ex_Promise_NumUQ');
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_PAYMENTSCHEDULE_BU_1)
-- Create 05.03.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /* Версия триггера 1.0*/
    if (new$Quarter1 = 0) then new$Quarter1 := new$Month01 + new$Month02 + new$Month03; end if;
    if (new$Quarter2 = 0) then new$Quarter2 := new$Month04 + new$Month05 + new$Month06; end if;
    if (new$Quarter3 = 0) then new$Quarter3 := new$Month07 + new$Month08 + new$Month09; end if;
    if (new$Quarter4 = 0) then new$Quarter4 := new$Month10 + new$Month11 + new$Month12; end if;
    new$SummaYear1 := new$Quarter1 + new$Quarter2 + new$Quarter3 + new$Quarter4;

-- - - - - - - - - - - - -
-- BU_3 (TR_PAYMENTSCHEDULE_BU_3)
-- Create 03.12.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

    /* Это поле проставляется при вставке и никогда не может изменить значение */
    new$AdjustmentRef := :old.AdjustmentRef;

-- - - - - - - - - - - - -
-- BU_10 (TR_PAYMENTSCHEDULE_BU_10)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Следим, чтобы никто не поменял внутреннюю нумерацию, иначе все накернится*/
  if ((new$ANumber <> :old.ANumber) or
  (new$InnerPromiseNum <> :old.InnerPromiseNum) or
  (new$AdjustmentNumber <> :old.AdjustmentNumber)) then
    RaiseException('EX_AGR_ChangeInnerNums');
  END IF;
      
  /* Отменять отклонение нельзя!!!*/
  if (((:old.AcceptDate is not null) and (:old.Accepted = 0)) and 
  ((new$Accepted = 1) or (new$AcceptDate is null))) then
    RaiseException('EX_RollbackCancel');
  END IF;
  /* Если приняли ДИ, тогда необходимо установить флаг LastAccepted*/
  if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 1)) or 
  ((:old.Accepted = 0) and (new$Accepted = 1) and (new$AcceptDate is not null))) then
    /* Менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (new$LastAdjustment = 1) then
      new$LastAccepted := 1;
              
    else
      RaiseException('EX_BP_ChangeStateAdjust');    
    END IF;
  END IF;
      
  /* Если отменили принятие документа, тогда необходимо снять флаг LastAccepted*/
  if (((:old.AcceptDate is not null) and (:old.Accepted = 1)) and
  ((new$Accepted = 0) or (new$AcceptDate is null))) then
    /* Менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (new$LastAdjustment = 1) then
      new$LastAccepted := 0;
              
    else
      RaiseException('EX_BP_ChangeStateAdjust');    
    END IF;
  END IF;
      
  /* Если отклонили ДИ, тогда необходимо скинуть флаг LastAdjustment*/
  if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 0)) or 
  ((:old.Accepted = 1) and (new$Accepted = 0) and (new$AcceptDate is not null))) then
    if (new$LastAdjustment = 1) then
      new$LastAdjustment := 0;
      new$LastAccepted := 0;
              
    else
      RaiseException('EX_AGR_ChangeStateAdjust');
    END IF;

    select max(AdjustmentNumber) into MaxNumber1$ from PaymentSchedule 
    where (InnerPromiseNum = new$InnerPromiseNum) ;
    /* нельзя отклонять первоначальное БО, если к нему существуют уточнения*/
    if ((new$adjustmentNumber=0) and (MaxNumber1$<>0))
    then 
      RaiseException('EX_BP_PrimaryBPHasNotify');    
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_PAYMENTSCHEDULE_BU_100)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Для уточнений дельту вычисляем как разницу текущего уточнения и предыдущего */  
  if (new$AdjustmentNumber > 0) then
    BEGIN
      select 
      Month01, Month02, Month03, Month04, Month05, Month06,
      Month07, Month08, Month09, Month10, Month11, Month12,
      Quarter1, Quarter2, Quarter3, Quarter4, Summa,
      SummaYear1, SummaYear2, SummaYear3
      into
      M01$, M02$, M03$, M04$, M05$, M06$, M07$, M08$, M09$, M10$, M11$, M12$, 
      Q1$, Q2$, Q3$, Q4$, S$, S1$, S2$, S3$         from 
      PaymentSchedule
      where
      ID = new$AdjustmentRef
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
          
    new$Month01Delta := new$Month01 - M01$;
    new$Month02Delta := new$Month02 - M02$;
    new$Month03Delta := new$Month03 - M03$;
    new$Month04Delta := new$Month04 - M04$;
    new$Month05Delta := new$Month05 - M05$;
    new$Month06Delta := new$Month06 - M06$;
    new$Month07Delta := new$Month07 - M07$;
    new$Month08Delta := new$Month08 - M08$;
    new$Month09Delta := new$Month09 - M09$;
    new$Month10Delta := new$Month10 - M10$;
    new$Month11Delta := new$Month11 - M11$;
    new$Month12Delta := new$Month12 - M12$;
    new$Quarter1Delta := new$Quarter1 - Q1$;
    new$Quarter2Delta := new$Quarter2 - Q2$;
    new$Quarter3Delta := new$Quarter3 - Q3$;
    new$Quarter4Delta := new$Quarter4 - Q4$;
    new$SummaDelta := new$Summa - S$;
    new$SummaYear1Delta := new$SummaYear1 - S1$;
    new$SummaYear2Delta := new$SummaYear2 - S2$;
    new$SummaYear3Delta := new$SummaYear3 - S3$;
        
  else /* В первых версиях дельты равны суммам БО */  
    new$Month01Delta := new$Month01;
    new$Month02Delta := new$Month02;
    new$Month03Delta := new$Month03;
    new$Month04Delta := new$Month04;
    new$Month05Delta := new$Month05;
    new$Month06Delta := new$Month06;
    new$Month07Delta := new$Month07;
    new$Month08Delta := new$Month08;
    new$Month09Delta := new$Month09;
    new$Month10Delta := new$Month10;
    new$Month11Delta := new$Month11;
    new$Month12Delta := new$Month12;
    new$Quarter1Delta := new$Quarter1;
    new$Quarter2Delta := new$Quarter2;
    new$Quarter3Delta := new$Quarter3;
    new$Quarter4Delta := new$Quarter4;
    new$SummaDelta := new$Summa;
    new$SummaYear1Delta := new$SummaYear1;
    new$SummaYear2Delta := new$SummaYear2;
    new$SummaYear3Delta := new$SummaYear3;
        
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_PAYMENTSCHEDULE_BU_200)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* если отклоняем БО */
  if (new$Accepted = 0 and new$AcceptDate is not null and :old.Accepted = 1) then
    /* смотрим все документы, в которых указано данное БО
         * если документ не отклонен, то нельзя отклонить и БО */
    FOR REC$1 IN (      select ffc.Reject_Cls  AS DocumentRejectCls from FacialFinDetail ffd
    left join FacialFinCaption ffc on (ffc.ID = ffd.RecordIndex)
    where SourcePromise = new$ANumber and SourceBudgetPromise = new$InnerPromiseNum
    or DestPromise = new$ANumber and DestBudgetPromise = new$InnerPromiseNum
    )
    LOOP
      if (REC$1.DocumentRejectCls is null) then
        RaiseException('Ex_BP_CannotReject');    
      END IF;
    END LOOP;
    /* проверяем, что на БО не уточнено более поздним неотклоненным уточнением*/
    FOR REC$1 IN (      SELECT Count(ps_in.ID)  AS AdjCount FROM PaymentSchedule ps_in
    WHERE (ps_in.InnerPromiseNum = new$InnerPromiseNum)and(ps_in.AdjustmentNumber > new$AdjustmentNumber)
    and (ps_in.Accepted<>0) 
    )
    LOOP
      if (REC$1.AdjCount > 0) then
        RaiseException('EX_BP_AdjustmentedCANNOTREJECT');    
      END IF;
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_400 (tr_PaymentSchedule_BU_400)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$AgreementRef <> :old.AgreementRef or new$ExecutionRef <> :old.ExecutionRef) then
    RaiseException('EX_CANTCHANGECAPTIONREF');
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_PAYMENTSCHEDULE_BU_700)
-- Create 14.10.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$RVersion is null) then
    new$RVersion := 1;
  elsif ((new$RVersion = -1) and (:Old.RVersion <> -1)) then
    new$RVersion := :Old.RVersion;
  else
    new$RVersion := :Old.RVersion + 1;
  end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_PAYMENTSCHEDULE SET
    ID = new$ID,
    ANUMBER = new$ANUMBER,
    PARENTNUMBER = new$PARENTNUMBER,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVSR = new$KVSR,
    KCSR = new$KCSR,
    KVR = new$KVR,
    MONTH01 = new$MONTH01,
    MONTH02 = new$MONTH02,
    MONTH03 = new$MONTH03,
    MONTH04 = new$MONTH04,
    MONTH05 = new$MONTH05,
    MONTH06 = new$MONTH06,
    MONTH07 = new$MONTH07,
    MONTH08 = new$MONTH08,
    MONTH09 = new$MONTH09,
    MONTH10 = new$MONTH10,
    MONTH11 = new$MONTH11,
    MONTH12 = new$MONTH12,
    SUMMA = new$SUMMA,
    REGION = new$REGION,
    SUBKESR = new$SUBKESR,
    MEANSTYPE = new$MEANSTYPE,
    FINSOURCE = new$FINSOURCE,
    FINTYPE = new$FINTYPE,
    FACT = new$FACT,
    FACIALACC_CLS = new$FACIALACC_CLS,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    ACCEPTDATE = new$ACCEPTDATE,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    ACCEPTED = new$ACCEPTED,
    LASTACCEPTED = new$LASTACCEPTED,
    PROMISETYPE = new$PROMISETYPE,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    OLDNUMBER = new$OLDNUMBER,
    SUMMAPREVIOUSYEAR = new$SUMMAPREVIOUSYEAR,
    SUMMAFINPREVIOUSYEAR = new$SUMMAFINPREVIOUSYEAR,
    QUARTER1 = new$QUARTER1,
    QUARTER2 = new$QUARTER2,
    QUARTER3 = new$QUARTER3,
    QUARTER4 = new$QUARTER4,
    RECORDINDEX = new$RECORDINDEX,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    DIRECTIONCLS = new$DIRECTIONCLS,
    RVERSION = new$RVERSION,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    MONTH01DELTA = new$MONTH01DELTA,
    MONTH02DELTA = new$MONTH02DELTA,
    MONTH03DELTA = new$MONTH03DELTA,
    MONTH04DELTA = new$MONTH04DELTA,
    MONTH05DELTA = new$MONTH05DELTA,
    MONTH06DELTA = new$MONTH06DELTA,
    MONTH07DELTA = new$MONTH07DELTA,
    MONTH08DELTA = new$MONTH08DELTA,
    MONTH09DELTA = new$MONTH09DELTA,
    MONTH10DELTA = new$MONTH10DELTA,
    MONTH11DELTA = new$MONTH11DELTA,
    MONTH12DELTA = new$MONTH12DELTA,
    QUARTER1DELTA = new$QUARTER1DELTA,
    QUARTER2DELTA = new$QUARTER2DELTA,
    QUARTER3DELTA = new$QUARTER3DELTA,
    QUARTER4DELTA = new$QUARTER4DELTA,
    SUMMADELTA = new$SUMMADELTA,
    NOTE = new$NOTE,
    FINYEAR = new$FINYEAR,
    SUMMAYEAR1 = new$SUMMAYEAR1,
    SUMMAYEAR2 = new$SUMMAYEAR2,
    SUMMAYEAR3 = new$SUMMAYEAR3,
    SUMMAYEAR1DELTA = new$SUMMAYEAR1DELTA,
    SUMMAYEAR2DELTA = new$SUMMAYEAR2DELTA,
    SUMMAYEAR3DELTA = new$SUMMAYEAR3DELTA,
    ASSIGNMENTKIND = new$ASSIGNMENTKIND,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    EXECUTIONREF = new$EXECUTIONREF,
    INNERPROMISENUM = new$INNERPROMISENUM,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    PROMISENUMBER = new$PROMISENUMBER,
    SUBSIDYCLS = new$SUBSIDYCLS,
    AGREEMENTREF = new$AGREEMENTREF,
    BUDALLOCATIONCLS = new$BUDALLOCATIONCLS,
    PAYPROMISECLS = new$PAYPROMISECLS,
    PROGINDEX = new$PROGINDEX,
    INVESTOBJECT = new$INVESTOBJECT
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_10 (TR_PAYMENTSCHEDULE_AU_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/

  /* Коррекция вспомогательных флагов в уточняемой записи*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentNumber > 0) and (new$LastAccepted <> :old.LastAccepted) and (:old.LastAdjustment = 1)) then
    update PaymentSchedule set
    LastAccepted = :old.LastAccepted,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;
  /* После отклонения БО необходимо восстановить флаг LastAdjustment у последней принятой версии*/
  if ((new$AdjustmentNumber > 0) and (:old.LastAdjustment = 1) and (new$LastAdjustment = 0) and 
  (new$AcceptDate is not null) and (new$Accepted = 0)) then
    update PaymentSchedule set
    LastAdjustment = 1,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_PAYMENTSCHEDULE_AU_500)
-- Create 28.04.2005
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (113, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=113) and (RecordId=new$ID);
  end if;

END;
/
ALTER TABLE WritExecutionDetail ADD (
  InvestObject NUMBER(10),
    CHECK((InvestObject<=2147483647)AND(InvestObject>-2147483648)),
  constraint FK_WED_InvestObject foreign key (InvestObject) references InvestObject(ID)    
)
/
CREATE INDEX FK_WED_InvestObject ON WritExecutionDetail(InvestObject)
/
ALTER TABLE ReplacementClsDetailInfo ADD (
  InvestObject NUMBER(10),
    CHECK((InvestObject<=2147483647)AND(InvestObject>-2147483648)),
  constraint FK_RCDI_InvestObject foreign key (InvestObject) references InvestObject(ID)    
)
/
CREATE INDEX FK_RCDI_InvestObject ON ReplacementClsDetailInfo(InvestObject)
/
ALTER TABLE TB_CorrectionDetail ADD (
  InvestObject NUMBER(10),
    CHECK((InvestObject<=2147483647)AND(InvestObject>-2147483648)),
  constraint FK_CD_InvestObject foreign key (InvestObject) references InvestObject(ID)    
)
/
CREATE INDEX FK_CD_InvestObject ON TB_CorrectionDetail(InvestObject)
/

CREATE OR REPLACE VIEW CorrectionDetail (
  ID,
  PARENTID,
  BUDGETREF,
  SUMMA,
  CLSTYPE,
  FACIALACC_CLS,
  KVSR,
  KFSR,
  KCSR,
  KVR,
  KESR,
  DIRECTIONCLS,
  MEANSTYPE,
  FACT,
  REGIONCLS,
  FINSOURCE,
  FINTYPE,
  DOCTYPE,
  SUBKESR,
  FUNDSSOURCE,
  KD,
  IFS,
  BUHOPERATIONCLS,
  CHANGEACC_REF,
  CHANGEACC,
  CHANGEORGNAME,
  CHANGEORGINN,
  CHANGEORGINN20,
  PROGINDEX,
  RECORDINDEX,
  DOCUMENTPROGINDEX,
  DOCUMENTRECORDINDEX,
  ISBLOCKED,
  BLOCKEDCAUSE,
  UNBLOCKEDDATE,
  UNBLOCKEDCAUSE,
  SENDERID,
  SENDERRECORDID,
  RVERSION,
  CREATERUSER,
  CREATEDATE,
  UPDATERUSER,
  UPDATEDATE,
  NOTE,
  ISCLSCHANGED,
  PROMISE,
  BUDGETPROMISE,
  EXECDOC,
  OKATO,
  ADDOKATO,
  TRANSFERTCLS,
  ORIGINALCLSSUMMA,
  NOTECLS,
  OPERATIONTYPE,
  REVERSEFLAG,
  EXECINNERNUMBER,
  CLSFIELFCHANGED,
  FAORGTYPE,
  SUBSIDYCLS,
  BUDALLOCATIONCLS,
  PAYPROMISECLS,
  NOTEQUALEX,
  OKTMO,
  UINCODE,
  INVESTOBJECT)
AS
  SELECT
    ID,
    PARENTID,
    BUDGETREF,
    SUMMA,
    CLSTYPE,
    FACIALACC_CLS,
    KVSR,
    KFSR,
    KCSR,
    KVR,
    KESR,
    DIRECTIONCLS,
    MEANSTYPE,
    FACT,
    REGIONCLS,
    FINSOURCE,
    FINTYPE,
    DOCTYPE,
    SUBKESR,
    FUNDSSOURCE,
    KD,
    IFS,
    BUHOPERATIONCLS,
    CHANGEACC_REF,
    CHANGEACC,
    CHANGEORGNAME,
    CHANGEORGINN,
    CHANGEORGINN20,
    PROGINDEX,
    RECORDINDEX,
    DOCUMENTPROGINDEX,
    DOCUMENTRECORDINDEX,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    SENDERID,
    SENDERRECORDID,
    RVERSION,
    CREATERUSER,
    CREATEDATE,
    UPDATERUSER,
    UPDATEDATE,
    NOTE,
    ISCLSCHANGED,
    PROMISE,
    BUDGETPROMISE,
    EXECDOC,
    OKATO,
    ADDOKATO,
    TRANSFERTCLS,
    ORIGINALCLSSUMMA,
    NOTECLS,
    OPERATIONTYPE,
    REVERSEFLAG,
    EXECINNERNUMBER,
    CLSFIELFCHANGED,
    FAORGTYPE,
    SUBSIDYCLS,
    BUDALLOCATIONCLS,
    PAYPROMISECLS,
    NOTEQUALEX,
    OKTMO,
    UINCODE,
    INVESTOBJECT
  FROM TB_CorrectionDetail
/

CREATE OR REPLACE TRIGGER TR_CORRECTIONDETAIL_ID
  INSTEAD OF DELETE
  ON CORRECTIONDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_500 (TR_CORRECTIONDETAIL_BD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  Update CorrectionCaption set
  DocChangeDate = SYSDATE,
  RVersion = -1
  where id = :old.recordindex;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_CORRECTIONDETAIL
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AD_500 (TR_CORRECTIONDETAIL_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate, ProgIndex, SUMMA) values(5504,:old.ID,SYSDATE,:old.ProgIndex, :old.SUMMA);

END;
/

CREATE OR REPLACE TRIGGER TR_CORRECTIONDETAIL_II
  INSTEAD OF INSERT
  ON CORRECTIONDETAIL
  FOR EACH ROW
DECLARE
  new$ID CORRECTIONDETAIL.ID%TYPE := :NEW.ID;
  new$PARENTID CORRECTIONDETAIL.PARENTID%TYPE := :NEW.PARENTID;
  new$BUDGETREF CORRECTIONDETAIL.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUMMA CORRECTIONDETAIL.SUMMA%TYPE := :NEW.SUMMA;
  new$CLSTYPE CORRECTIONDETAIL.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$FACIALACC_CLS CORRECTIONDETAIL.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$KVSR CORRECTIONDETAIL.KVSR%TYPE := :NEW.KVSR;
  new$KFSR CORRECTIONDETAIL.KFSR%TYPE := :NEW.KFSR;
  new$KCSR CORRECTIONDETAIL.KCSR%TYPE := :NEW.KCSR;
  new$KVR CORRECTIONDETAIL.KVR%TYPE := :NEW.KVR;
  new$KESR CORRECTIONDETAIL.KESR%TYPE := :NEW.KESR;
  new$DIRECTIONCLS CORRECTIONDETAIL.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$MEANSTYPE CORRECTIONDETAIL.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$FACT CORRECTIONDETAIL.FACT%TYPE := :NEW.FACT;
  new$REGIONCLS CORRECTIONDETAIL.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$FINSOURCE CORRECTIONDETAIL.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$FINTYPE CORRECTIONDETAIL.FINTYPE%TYPE := :NEW.FINTYPE;
  new$DOCTYPE CORRECTIONDETAIL.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$SUBKESR CORRECTIONDETAIL.SUBKESR%TYPE := :NEW.SUBKESR;
  new$FUNDSSOURCE CORRECTIONDETAIL.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$KD CORRECTIONDETAIL.KD%TYPE := :NEW.KD;
  new$IFS CORRECTIONDETAIL.IFS%TYPE := :NEW.IFS;
  new$BUHOPERATIONCLS CORRECTIONDETAIL.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CHANGEACC_REF CORRECTIONDETAIL.CHANGEACC_REF%TYPE := :NEW.CHANGEACC_REF;
  new$CHANGEACC CORRECTIONDETAIL.CHANGEACC%TYPE := :NEW.CHANGEACC;
  new$CHANGEORGNAME CORRECTIONDETAIL.CHANGEORGNAME%TYPE := :NEW.CHANGEORGNAME;
  new$CHANGEORGINN CORRECTIONDETAIL.CHANGEORGINN%TYPE := :NEW.CHANGEORGINN;
  new$CHANGEORGINN20 CORRECTIONDETAIL.CHANGEORGINN20%TYPE := :NEW.CHANGEORGINN20;
  new$PROGINDEX CORRECTIONDETAIL.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX CORRECTIONDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$DOCUMENTPROGINDEX CORRECTIONDETAIL.DOCUMENTPROGINDEX%TYPE := :NEW.DOCUMENTPROGINDEX;
  new$DOCUMENTRECORDINDEX CORRECTIONDETAIL.DOCUMENTRECORDINDEX%TYPE := :NEW.DOCUMENTRECORDINDEX;
  new$ISBLOCKED CORRECTIONDETAIL.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE CORRECTIONDETAIL.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE CORRECTIONDETAIL.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE CORRECTIONDETAIL.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$SENDERID CORRECTIONDETAIL.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID CORRECTIONDETAIL.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$RVERSION CORRECTIONDETAIL.RVERSION%TYPE := :NEW.RVERSION;
  new$CREATERUSER CORRECTIONDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE CORRECTIONDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATERUSER CORRECTIONDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$UPDATEDATE CORRECTIONDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$NOTE CORRECTIONDETAIL.NOTE%TYPE := :NEW.NOTE;
  new$ISCLSCHANGED CORRECTIONDETAIL.ISCLSCHANGED%TYPE := :NEW.ISCLSCHANGED;
  new$PROMISE CORRECTIONDETAIL.PROMISE%TYPE := :NEW.PROMISE;
  new$BUDGETPROMISE CORRECTIONDETAIL.BUDGETPROMISE%TYPE := :NEW.BUDGETPROMISE;
  new$EXECDOC CORRECTIONDETAIL.EXECDOC%TYPE := :NEW.EXECDOC;
  new$OKATO CORRECTIONDETAIL.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO CORRECTIONDETAIL.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$TRANSFERTCLS CORRECTIONDETAIL.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$ORIGINALCLSSUMMA CORRECTIONDETAIL.ORIGINALCLSSUMMA%TYPE := :NEW.ORIGINALCLSSUMMA;
  new$NOTECLS CORRECTIONDETAIL.NOTECLS%TYPE := :NEW.NOTECLS;
  new$OPERATIONTYPE CORRECTIONDETAIL.OPERATIONTYPE%TYPE := :NEW.OPERATIONTYPE;
  new$REVERSEFLAG CORRECTIONDETAIL.REVERSEFLAG%TYPE := :NEW.REVERSEFLAG;
  new$EXECINNERNUMBER CORRECTIONDETAIL.EXECINNERNUMBER%TYPE := :NEW.EXECINNERNUMBER;
  new$CLSFIELFCHANGED CORRECTIONDETAIL.CLSFIELFCHANGED%TYPE := :NEW.CLSFIELFCHANGED;
  new$FAORGTYPE CORRECTIONDETAIL.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$SUBSIDYCLS CORRECTIONDETAIL.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$BUDALLOCATIONCLS CORRECTIONDETAIL.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS CORRECTIONDETAIL.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
  new$NOTEQUALEX CORRECTIONDETAIL.NOTEQUALEX%TYPE := :NEW.NOTEQUALEX;
  new$OKTMO CORRECTIONDETAIL.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE CORRECTIONDETAIL.UINCODE%TYPE := :NEW.UINCODE;
  new$INVESTOBJECT CORRECTIONDETAIL.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
--
  BPInnerNum$ NUMBER(10);
  PromiseMode$ NUMBER(10);
  Promise_Count$ NUMBER(10);
  ConstCheck$ NUMBER(10);
  vOperationTypeS1$ NUMBER(10);
  vOperationTypeD1$ NUMBER(10);
  vOperationType1$ NUMBER(10);
  PromiseMode1$ NUMBER(10);
  ProgIndex$ NUMBER(10);
  ExecID$ NUMBER(10);
  ExecInnerNumber$ NUMBER(10);
  ExecRegType$ NUMBER(10);
  ExecAgrInnerNum$ NUMBER(10);
  AgrInnerNumber$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_CORRECTIONDETAIL_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  IF (new$id IS NULL) THEN 
    select g_shared.nextval into new$id from dual;
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$IFS := 0;
  END IF;
  IF (new$FacialAcc_Cls IS NULL) THEN 
    new$FacialAcc_Cls := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DirectionCls IS NULL) THEN 
    new$DirectionCls := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$Finsource IS NULL) THEN 
    new$Finsource := 0;
  END IF;
  IF (new$FinType IS NULL) THEN 
    new$FinType := 0;
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;  
  END IF;
  IF (new$SubKesr IS NULL) THEN 
    new$SubKesr := 0;
  END IF;
  IF (new$buhoperationCls IS NULL) THEN 
    new$buhoperationCls := 0;
  END IF;
  IF (new$ReverseFlag IS NULL) THEN 
    new$ReverseFlag := 1;
  END IF;
  IF (new$OperationType IS NULL) THEN 
    BEGIN
      SELECT CorCap.SourceType, CorCap.DestType
      INTO
      vOperationTypeS1$, vOperationTypeD1$       FROM correctioncaption CorCap
      WHERE
      (CorCap.id = new$recordindex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    IF (new$ProgIndex = 315) THEN 
      vOperationType1$ := vOperationTypeS1$;
          
    ELSE 
      vOperationType1$ := vOperationTypeD1$;
    END IF;
    new$OperationType := vOperationType1$;
      
  END IF;
  BEGIN

    SELECT org.Org_Type   INTO new$FAOrgType FROM Organizations org
    INNER JOIN FacialAcc_Cls fac  ON (org.ID = fac.Org_ref)
    WHERE fac.ID = new$FacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BI_100 (tr_correctiondetail_bi_100)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$progindex = 316) then
    update correctiondetail set
    buhoperationcls = new$buhoperationcls
    where ID = new$parentid;
  END IF;

-- - - - - - - - - - - - -
-- BI_120 (TR_CORRECTIONDETAIL_BI_120)
-- Create 13.08.2007
-- - - - - - - - - - - - -

  if ((new$ClsType is NULL) and (new$IFS <> 0)) then
    new$ClsType := 1; /* если это источник и забыли ввести ClsType */
  else
    if ((new$ClsType is NULL) and (new$KD <> 0)) then
      new$ClsType := 2; /* если это код дохода и забыли ввести ClsType */
      else
        if (new$ClsType is null)
          then new$ClsType := 0; /* иначе - расходная */
        end if;
    end if;
  end if;
 
  IF ((new$ClsType = 0) AND ((new$IFS <> 0) or (new$KD <> 0)))THEN /* классификация расходная */
    RaiseException('EX_WRONGBUDCLS');
  end if;
 
  IF ( (new$ClsType = 1) AND (
       (new$KVSR <> 0) OR (new$KFSR <> 0) OR
       (new$KCSR <> 0) OR (new$KVR <> 0) OR
       (new$KESR <> 0) OR (new$KD <> 0)
     ))
  THEN /* классификация источниковая */
    RaiseException('EX_WRONGBUDCLS');
  end if;
 
  IF ((new$ClsType = 2) AND (
      (new$KVSR <> 0) OR (new$KFSR <> 0) OR
      (new$KCSR <> 0) OR (new$KVR <> 0) OR
      (new$KESR <> 0) OR
      (new$IFS <> 0)
    ))
  THEN /* классификация доходная */
    RaiseException('EX_WRONGBUDCLS');
  end if;

-- - - - - - - - - - - - -
-- BI_200 (TR_CORRECTIONDETAIL_BI_200)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* проставляем номера бюджетных обязательств по Учету договоров*/
  GetIntConst(30, 15,PromiseMode$);
  getintconst(30, 35,ConstCheck$);
  /* (старые БО) Проверка существует ли такой номер БО, на который ссылается уведомление*/
  if ((PromiseMode$ <> 1) and (ConstCheck$ = 1)) then
    if (new$Promise is not null) then
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count$        from
      promise_detail pr
      where
      (pr.registrnumber = new$PROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count$ = 0) then
        RaiseException('EX_BP_NotExist');    
      END IF;  
    END IF;/* end проверки PromiseMode <> 1*/
  END IF;
  /* (новые БО) Проверка существует ли такой номер БО, на который ссылается уведомление*/
  /* и простановка старого БО по новому номеру БО */
  if (PromiseMode$ = 1) then
    if ((new$Promise is not null) and (new$BudgetPromise is null)) then
      select 
      max(InnerPromiseNum) 
      into BPInnerNum$       from 
      PaymentSchedule 
      where 
      (ANumber = new$Promise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum$ <> 0) then
        new$BudgetPromise := BPInnerNum$;
              
      else
        RaiseException('EX_BP_NotExist');    
      END IF;
    END IF;
    /* Если есть новый номер, но нет старого, тогда проставляем старый*/
    if ((new$BudgetPromise is not null) and (new$Promise is null)) then
      BEGIN
        select 
        ANumber 
        into BPInnerNum$       from 
        PaymentSchedule
        where 
        (InnerPromiseNum = new$BudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
            
      new$Promise := BPInnerNum$;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_210 (TR_CORRECTIONDETAIL_BI_210)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* используем болк учета договоров?*/
  GetIntConst(30, 15,PromiseMode1$);
  if (PromiseMode1$ = 1) then
    /* при простановке БО плательщика или его изменении */
    if (new$Promise is not null) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$Promise and ps.InnerPromiseNum = new$BudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$ExecDoc := ExecID$;
        new$ExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$ExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$ExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$ExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано, а ДИ указано, то */
    else 
      if (new$ExecDoc is not null) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$ExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$ExecInnerNumber := ExecInnerNumber$;
            
      END IF;  
    END IF;/* использование блока "Учет договоров"*/
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_CORRECTIONDETAIL_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

  Update CorrectionCaption set
  DocChangeDate = new$UpdateDate,
  RVersion = -1
  where id = new$recordindex;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_CORRECTIONDETAIL (
    ID,
    PARENTID,
    BUDGETREF,
    SUMMA,
    CLSTYPE,
    FACIALACC_CLS,
    KVSR,
    KFSR,
    KCSR,
    KVR,
    KESR,
    DIRECTIONCLS,
    MEANSTYPE,
    FACT,
    REGIONCLS,
    FINSOURCE,
    FINTYPE,
    DOCTYPE,
    SUBKESR,
    FUNDSSOURCE,
    KD,
    IFS,
    BUHOPERATIONCLS,
    CHANGEACC_REF,
    CHANGEACC,
    CHANGEORGNAME,
    CHANGEORGINN,
    CHANGEORGINN20,
    PROGINDEX,
    RECORDINDEX,
    DOCUMENTPROGINDEX,
    DOCUMENTRECORDINDEX,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    SENDERID,
    SENDERRECORDID,
    RVERSION,
    CREATERUSER,
    CREATEDATE,
    UPDATERUSER,
    UPDATEDATE,
    NOTE,
    ISCLSCHANGED,
    PROMISE,
    BUDGETPROMISE,
    EXECDOC,
    OKATO,
    ADDOKATO,
    TRANSFERTCLS,
    ORIGINALCLSSUMMA,
    NOTECLS,
    OPERATIONTYPE,
    REVERSEFLAG,
    EXECINNERNUMBER,
    CLSFIELFCHANGED,
    FAORGTYPE,
    SUBSIDYCLS,
    BUDALLOCATIONCLS,
    PAYPROMISECLS,
    NOTEQUALEX,
    OKTMO,
    UINCODE,
    INVESTOBJECT
  ) VALUES (
    new$ID,
    new$PARENTID,
    new$BUDGETREF,
    new$SUMMA,
    new$CLSTYPE,
    new$FACIALACC_CLS,
    new$KVSR,
    new$KFSR,
    new$KCSR,
    new$KVR,
    new$KESR,
    new$DIRECTIONCLS,
    new$MEANSTYPE,
    new$FACT,
    new$REGIONCLS,
    new$FINSOURCE,
    new$FINTYPE,
    new$DOCTYPE,
    new$SUBKESR,
    new$FUNDSSOURCE,
    new$KD,
    new$IFS,
    new$BUHOPERATIONCLS,
    new$CHANGEACC_REF,
    new$CHANGEACC,
    new$CHANGEORGNAME,
    new$CHANGEORGINN,
    new$CHANGEORGINN20,
    new$PROGINDEX,
    new$RECORDINDEX,
    new$DOCUMENTPROGINDEX,
    new$DOCUMENTRECORDINDEX,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$SENDERID,
    new$SENDERRECORDID,
    new$RVERSION,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATERUSER,
    new$UPDATEDATE,
    new$NOTE,
    new$ISCLSCHANGED,
    new$PROMISE,
    new$BUDGETPROMISE,
    new$EXECDOC,
    new$OKATO,
    new$ADDOKATO,
    new$TRANSFERTCLS,
    new$ORIGINALCLSSUMMA,
    new$NOTECLS,
    new$OPERATIONTYPE,
    new$REVERSEFLAG,
    new$EXECINNERNUMBER,
    new$CLSFIELFCHANGED,
    new$FAORGTYPE,
    new$SUBSIDYCLS,
    new$BUDALLOCATIONCLS,
    new$PAYPROMISECLS,
    new$NOTEQUALEX,
    new$OKTMO,
    new$UINCODE,
    new$INVESTOBJECT);

-- - - - - - - - - - - - -
-- AI_500 (TR_CORRECTIONDETAIL_AI_500)
-- Create 29.12.2009
-- - - - - - - - - - - - -

 delete from DelRecIndexes where (TableID =5504 ) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_CORRECTIONDETAIL_IU
  INSTEAD OF UPDATE
  ON CORRECTIONDETAIL
  FOR EACH ROW
DECLARE
  new$ID CORRECTIONDETAIL.ID%TYPE := :NEW.ID;
  new$PARENTID CORRECTIONDETAIL.PARENTID%TYPE := :NEW.PARENTID;
  new$BUDGETREF CORRECTIONDETAIL.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUMMA CORRECTIONDETAIL.SUMMA%TYPE := :NEW.SUMMA;
  new$CLSTYPE CORRECTIONDETAIL.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$FACIALACC_CLS CORRECTIONDETAIL.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$KVSR CORRECTIONDETAIL.KVSR%TYPE := :NEW.KVSR;
  new$KFSR CORRECTIONDETAIL.KFSR%TYPE := :NEW.KFSR;
  new$KCSR CORRECTIONDETAIL.KCSR%TYPE := :NEW.KCSR;
  new$KVR CORRECTIONDETAIL.KVR%TYPE := :NEW.KVR;
  new$KESR CORRECTIONDETAIL.KESR%TYPE := :NEW.KESR;
  new$DIRECTIONCLS CORRECTIONDETAIL.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$MEANSTYPE CORRECTIONDETAIL.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$FACT CORRECTIONDETAIL.FACT%TYPE := :NEW.FACT;
  new$REGIONCLS CORRECTIONDETAIL.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$FINSOURCE CORRECTIONDETAIL.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$FINTYPE CORRECTIONDETAIL.FINTYPE%TYPE := :NEW.FINTYPE;
  new$DOCTYPE CORRECTIONDETAIL.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$SUBKESR CORRECTIONDETAIL.SUBKESR%TYPE := :NEW.SUBKESR;
  new$FUNDSSOURCE CORRECTIONDETAIL.FUNDSSOURCE%TYPE := :NEW.FUNDSSOURCE;
  new$KD CORRECTIONDETAIL.KD%TYPE := :NEW.KD;
  new$IFS CORRECTIONDETAIL.IFS%TYPE := :NEW.IFS;
  new$BUHOPERATIONCLS CORRECTIONDETAIL.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CHANGEACC_REF CORRECTIONDETAIL.CHANGEACC_REF%TYPE := :NEW.CHANGEACC_REF;
  new$CHANGEACC CORRECTIONDETAIL.CHANGEACC%TYPE := :NEW.CHANGEACC;
  new$CHANGEORGNAME CORRECTIONDETAIL.CHANGEORGNAME%TYPE := :NEW.CHANGEORGNAME;
  new$CHANGEORGINN CORRECTIONDETAIL.CHANGEORGINN%TYPE := :NEW.CHANGEORGINN;
  new$CHANGEORGINN20 CORRECTIONDETAIL.CHANGEORGINN20%TYPE := :NEW.CHANGEORGINN20;
  new$PROGINDEX CORRECTIONDETAIL.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX CORRECTIONDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$DOCUMENTPROGINDEX CORRECTIONDETAIL.DOCUMENTPROGINDEX%TYPE := :NEW.DOCUMENTPROGINDEX;
  new$DOCUMENTRECORDINDEX CORRECTIONDETAIL.DOCUMENTRECORDINDEX%TYPE := :NEW.DOCUMENTRECORDINDEX;
  new$ISBLOCKED CORRECTIONDETAIL.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE CORRECTIONDETAIL.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE CORRECTIONDETAIL.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE CORRECTIONDETAIL.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$SENDERID CORRECTIONDETAIL.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID CORRECTIONDETAIL.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$RVERSION CORRECTIONDETAIL.RVERSION%TYPE := :NEW.RVERSION;
  new$CREATERUSER CORRECTIONDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE CORRECTIONDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATERUSER CORRECTIONDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$UPDATEDATE CORRECTIONDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$NOTE CORRECTIONDETAIL.NOTE%TYPE := :NEW.NOTE;
  new$ISCLSCHANGED CORRECTIONDETAIL.ISCLSCHANGED%TYPE := :NEW.ISCLSCHANGED;
  new$PROMISE CORRECTIONDETAIL.PROMISE%TYPE := :NEW.PROMISE;
  new$BUDGETPROMISE CORRECTIONDETAIL.BUDGETPROMISE%TYPE := :NEW.BUDGETPROMISE;
  new$EXECDOC CORRECTIONDETAIL.EXECDOC%TYPE := :NEW.EXECDOC;
  new$OKATO CORRECTIONDETAIL.OKATO%TYPE := :NEW.OKATO;
  new$ADDOKATO CORRECTIONDETAIL.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$TRANSFERTCLS CORRECTIONDETAIL.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$ORIGINALCLSSUMMA CORRECTIONDETAIL.ORIGINALCLSSUMMA%TYPE := :NEW.ORIGINALCLSSUMMA;
  new$NOTECLS CORRECTIONDETAIL.NOTECLS%TYPE := :NEW.NOTECLS;
  new$OPERATIONTYPE CORRECTIONDETAIL.OPERATIONTYPE%TYPE := :NEW.OPERATIONTYPE;
  new$REVERSEFLAG CORRECTIONDETAIL.REVERSEFLAG%TYPE := :NEW.REVERSEFLAG;
  new$EXECINNERNUMBER CORRECTIONDETAIL.EXECINNERNUMBER%TYPE := :NEW.EXECINNERNUMBER;
  new$CLSFIELFCHANGED CORRECTIONDETAIL.CLSFIELFCHANGED%TYPE := :NEW.CLSFIELFCHANGED;
  new$FAORGTYPE CORRECTIONDETAIL.FAORGTYPE%TYPE := :NEW.FAORGTYPE;
  new$SUBSIDYCLS CORRECTIONDETAIL.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$BUDALLOCATIONCLS CORRECTIONDETAIL.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS CORRECTIONDETAIL.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
  new$NOTEQUALEX CORRECTIONDETAIL.NOTEQUALEX%TYPE := :NEW.NOTEQUALEX;
  new$OKTMO CORRECTIONDETAIL.OKTMO%TYPE := :NEW.OKTMO;
  new$UINCODE CORRECTIONDETAIL.UINCODE%TYPE := :NEW.UINCODE;
  new$INVESTOBJECT CORRECTIONDETAIL.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
--
  BPInnerNum$ NUMBER(10);
  PromiseMode$ NUMBER(10);
  Promise_Count$ NUMBER(10);
  ConstCheck$ NUMBER(10);
  AccRef_Caption$ NUMBER(10);
  vOperationTypeS$ NUMBER(10);
  vOperationTypeD$ NUMBER(10);
  vOperationType$ NUMBER(10);
  AccRef$ NUMBER(10);
  PromiseMode1$ NUMBER(10);
  ProgIndex$ NUMBER(10);
  ExecID$ NUMBER(10);
  ExecInnerNumber$ NUMBER(10);
  ExecRegType$ NUMBER(10);
  ExecAgrInnerNum$ NUMBER(10);
  AgrInnerNumber$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_CORRECTIONDETAIL_BU)
-- Version 7.01.00.2
-- - - - - - - - - - - - -

  IF (new$id IS NULL) THEN 
    select g_shared.nextval into new$id from dual;
  END IF;
  IF (new$KD IS NULL) THEN 
    new$KD := 0;
  END IF;
  IF (new$IFS IS NULL) THEN 
    new$IFS := 0;
  END IF;
  IF (new$FacialAcc_Cls IS NULL) THEN 
    new$FacialAcc_Cls := 0;
  END IF;
  IF (new$KVSR IS NULL) THEN 
    new$KVSR := 0;
  END IF;
  IF (new$KFSR IS NULL) THEN 
    new$KFSR := 0;
  END IF;
  IF (new$KESR IS NULL) THEN 
    new$KESR := 0;
  END IF;
  IF (new$KVR IS NULL) THEN 
    new$KVR := 0;
  END IF;
  IF (new$KCSR IS NULL) THEN 
    new$KCSR := 0;
  END IF;
  IF (new$MeansType IS NULL) THEN 
    new$MeansType := 0;
  END IF;
  IF (new$Fact IS NULL) THEN 
    new$Fact := 0;
  END IF;
  IF (new$DirectionCls IS NULL) THEN 
    new$DirectionCls := 0;
  END IF;
  IF (new$RegionCLS IS NULL) THEN 
    new$RegionCLS := 0;
  END IF;
  IF (new$Finsource IS NULL) THEN 
    new$Finsource := 0;
  END IF;
  IF (new$FinType IS NULL) THEN 
    new$FinType := 0;
  END IF;
  IF (new$DocType IS NULL) THEN 
    new$DocType := 0;
  END IF;
  IF (new$SubKesr IS NULL) THEN 
    new$SubKesr := 0;
  END IF;
  IF (new$FundsSource IS NULL) THEN 
    new$FundsSource := 0;
  END IF;
  IF (new$buhoperationCls IS NULL) THEN 
    new$buhoperationCls := 0;
  END IF;
  IF (new$ReverseFlag IS NULL) THEN 
    new$ReverseFlag := 1;
  END IF;
  IF (new$OperationType IS NULL) THEN 
    BEGIN
      SELECT CorCap.SourceType, CorCap.DestType
      INTO
      vOperationTypeS$, vOperationTypeD$       FROM correctioncaption CorCap
      WHERE
      (CorCap.id = new$recordindex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    IF (new$ProgIndex = 315) THEN 
      vOperationType$ := vOperationTypeS$;
          
    ELSE 
      vOperationType$ := vOperationTypeD$;
    END IF;
    new$OperationType := vOperationType$;
      
  END IF;
  /* проставляем ссылку на счет по наименованию счета новой организации, так как сам счет можно вводить руками */
  if (
  ((not new$changeacc is null) and (new$changeacc <> '')) 
  and 
  ((:old.changeacc <> new$changeacc) or (:old.changeacc is null))
  and 
  ((new$changeacc_ref = :old.changeacc_ref) or (new$changeacc_ref is null))
  )
  THEN
    BEGIN
      SELECT cor_c.OriginalAcceptorAcc_Ref
      INTO AccRef_Caption$     FROM correctioncaption cor_c
      LEFT JOIN CorrectionDetail cor_d ON ((cor_c.Id = cor_d.RecordIndex) AND (cor_d.ProgIndex = 316))
      WHERE cor_d.id = :old.id
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    IF (NOT AccRef_Caption$ IS NULL) THEN
      new$changeacc_ref := AccRef_Caption$;
          
    ELSE
      BEGIN
        SELECT dfat.id
        INTO AccRef$       FROM dfAccountsBuhTable dfat
        LEFT JOIN Org_Accounts oa ON (dfat.id =  oa.id)
        WHERE (oa.acc = new$changeacc) AND (dfat.iscommon = 1) AND (dfat.isforbudget = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      IF (NOT AccRef$ IS NULL) THEN
        new$changeacc_ref := AccRef$;
          
      END IF;  
    END IF;
  END IF;
  /* заполеняем вид организации владельца л\с*/
  IF ((new$FacialAcc_Cls <> :old.FacialAcc_CLS) OR (new$FAOrgType IS NULL)) THEN
    BEGIN
      SELECT org.Org_Type      INTO new$FAOrgType FROM Organizations org
      INNER JOIN facialacc_cls fac  ON (org.ID = fac.Org_ref)
      WHERE fac.ID = new$FacialACC_Cls
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (tr_correctiondetail_bu_100)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((new$buhoperationcls <> :old.buhoperationcls) and (new$progindex = 316)) then
    update correctiondetail set
    buhoperationcls = new$buhoperationcls
    where ID = new$parentid;
  END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_CORRECTIONDETAIL_BU_120)
-- Create 13.08.2007
-- - - - - - - - - - - - -

  if ((new$ClsType is NULL) and (new$IFS <> 0)) then
    new$ClsType := 1; /* если это источник и забыли ввести ClsType */
  else
    if ((new$ClsType is NULL) and (new$KD <> 0)) then
      new$ClsType := 2; /* если это код дохода и забыли ввести ClsType */
      else
        if (new$ClsType is null)
          then new$ClsType := 0; /* иначе - расходная */
        end if;
    end if;
  end if;
        
  IF ((new$ClsType = 0) AND ((new$IFS <> 0) or (new$KD <> 0)))THEN /* классификация расходная */
    RaiseException('EX_WRONGBUDCLS');
  end if;
  
  IF ( (new$ClsType = 1) AND (
       (new$KVSR <> 0) OR (new$KFSR <> 0) OR
       (new$KCSR <> 0) OR (new$KVR <> 0) OR
       (new$KESR <> 0) OR (new$KD <> 0)
     ))
  THEN /* классификация источниковая */
    RaiseException('EX_WRONGBUDCLS');
  end if;
  
  IF ((new$ClsType = 2) AND (
      (new$KVSR <> 0) OR (new$KFSR <> 0) OR
      (new$KCSR <> 0) OR (new$KVR <> 0) OR
      (new$KESR <> 0) OR
      (new$IFS <> 0)
    ))     
  THEN /* классификация доходная */
    Raiseexception('EX_WRONGBUDCLS');
  end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_CORRECTIONDETAIL_BU_200)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* проставляем номера бюджетных обязательств по Учету договоров*/
  GetIntConst(30, 15,PromiseMode$);
  getintconst(30, 35,ConstCheck$);
  /* (старые БО) Проверка существует ли такой номер БО, на который ссылается уведомление*/
  if ((PromiseMode$ <> 1) and (ConstCheck$ = 1)) then
    if ((new$Promise is not null)and((:old.Promise is null)or(:old.Promise <> new$Promise ))) then
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count$        from
      promise_detail pr
      where
      (pr.registrnumber = new$PROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count$ = 0) then
        RaiseException('EX_BP_NotExist');    
      END IF;  
    END IF;/* end проверки PromiseMode <> 1*/
  END IF;
  /* (новые БО) Проверка существует ли такой номер БО, на который ссылается уведомление*/
  /* и простановка старого БО по новому номеру БО */
  if (PromiseMode$ = 1) then
    if ((new$Promise is not null)and((:old.Promise is null)or(:old.Promise <> new$Promise )) and 
    (new$BudgetPromise is null) and (:old.BudgetPromise is null)) then
      select 
      max(InnerPromiseNum) 
      into BPInnerNum$       from 
      PaymentSchedule 
      where 
      (ANumber = new$Promise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum$ <> 0) then
        new$BudgetPromise := BPInnerNum$;
              
      else
        RaiseException('EX_BP_NotExist');    
      END IF;
    END IF;
        
    /* Если изменился новый номер, тогда устанавливаем старый*/
    if (((new$BudgetPromise is not null) and (:old.BudgetPromise is null)) or 
    (new$BudgetPromise <> :old.BudgetPromise)) then
      BEGIN
        select 
        ANumber 
        into BPInnerNum$       from 
        PaymentSchedule
        where 
        (InnerPromiseNum = new$BudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
            
      new$Promise := BPInnerNum$;
          
    END IF;
        
    /* Если удалили новый номер, то нужно удалить и старый*/
    if ((new$BudgetPromise is null) and (:old.BudgetPromise is not null)) then
      new$Promise := null;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_210 (TR_CORRECTIONDETAIL_BU_210)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* используем болк учета договоров?*/
  GetIntConst(30, 15,PromiseMode1$);
  if (PromiseMode1$ = 1) then
    /* при изменении БО плательщика или изменили ДИ */
    if (new$Promise is not null and (
    (:old.Promise is null or :old.Promise <> new$Promise) or
    (:old.ExecDoc is null or new$ExecDoc is null or :old.ExecDoc <> new$ExecDoc)
    )) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$Promise and ps.InnerPromiseNum = new$BudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$ExecDoc := ExecID$;
        new$ExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$ExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$ExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$ExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано или не изменилось, а ДИ поменяли, то */
    else 
      if (new$ExecDoc is null or :old.ExecDoc is null or new$ExecDoc <> :old.ExecDoc) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$ExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$ExecInnerNumber := ExecInnerNumber$;
            
      END IF;  
    END IF;/* использование блока "Учет договоров"*/
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_CORRECTIONDETAIL_BU_700)
-- Create 13.08.2007
-- - - - - - - - - - - - -

 if (new$RVersion is null) then
   new$RVersion:=1;
 else
   if ((new$RVersion = -1) and (:Old.RVersion <> -1)) then
     new$RVersion:=:Old.RVersion;
   else
     new$RVersion:=:Old.RVersion+1;
   end if;
 end if;  

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_CORRECTIONDETAIL SET
    ID = new$ID,
    PARENTID = new$PARENTID,
    BUDGETREF = new$BUDGETREF,
    SUMMA = new$SUMMA,
    CLSTYPE = new$CLSTYPE,
    FACIALACC_CLS = new$FACIALACC_CLS,
    KVSR = new$KVSR,
    KFSR = new$KFSR,
    KCSR = new$KCSR,
    KVR = new$KVR,
    KESR = new$KESR,
    DIRECTIONCLS = new$DIRECTIONCLS,
    MEANSTYPE = new$MEANSTYPE,
    FACT = new$FACT,
    REGIONCLS = new$REGIONCLS,
    FINSOURCE = new$FINSOURCE,
    FINTYPE = new$FINTYPE,
    DOCTYPE = new$DOCTYPE,
    SUBKESR = new$SUBKESR,
    FUNDSSOURCE = new$FUNDSSOURCE,
    KD = new$KD,
    IFS = new$IFS,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    CHANGEACC_REF = new$CHANGEACC_REF,
    CHANGEACC = new$CHANGEACC,
    CHANGEORGNAME = new$CHANGEORGNAME,
    CHANGEORGINN = new$CHANGEORGINN,
    CHANGEORGINN20 = new$CHANGEORGINN20,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    DOCUMENTPROGINDEX = new$DOCUMENTPROGINDEX,
    DOCUMENTRECORDINDEX = new$DOCUMENTRECORDINDEX,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    RVERSION = new$RVERSION,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    UPDATEDATE = new$UPDATEDATE,
    NOTE = new$NOTE,
    ISCLSCHANGED = new$ISCLSCHANGED,
    PROMISE = new$PROMISE,
    BUDGETPROMISE = new$BUDGETPROMISE,
    EXECDOC = new$EXECDOC,
    OKATO = new$OKATO,
    ADDOKATO = new$ADDOKATO,
    TRANSFERTCLS = new$TRANSFERTCLS,
    ORIGINALCLSSUMMA = new$ORIGINALCLSSUMMA,
    NOTECLS = new$NOTECLS,
    OPERATIONTYPE = new$OPERATIONTYPE,
    REVERSEFLAG = new$REVERSEFLAG,
    EXECINNERNUMBER = new$EXECINNERNUMBER,
    CLSFIELFCHANGED = new$CLSFIELFCHANGED,
    FAORGTYPE = new$FAORGTYPE,
    SUBSIDYCLS = new$SUBSIDYCLS,
    BUDALLOCATIONCLS = new$BUDALLOCATIONCLS,
    PAYPROMISECLS = new$PAYPROMISECLS,
    NOTEQUALEX = new$NOTEQUALEX,
    OKTMO = new$OKTMO,
    UINCODE = new$UINCODE,
    INVESTOBJECT = new$INVESTOBJECT
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_500 (TR_CORRECTIONDETAIL_AU_500)
-- Create 29.12.2009
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (5504, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=5504) and (RecordId=new$ID);
  end if;

END;
/
ALTER TABLE LimitFinDetail ADD (
  InvestObject NUMBER(10),
    CHECK((InvestObject<=2147483647)AND(InvestObject>-2147483648)),
  constraint FK_LFD_InvestObject foreign key (InvestObject) references InvestObject(ID)    
)
/
CREATE INDEX FK_LFD_InvestObject ON LimitFinDetail(InvestObject)
/
ALTER TABLE TENDERPRODUCT ADD (
  InvestObject NUMBER(10),
    CHECK((InvestObject<=2147483647)AND(InvestObject>-2147483648)),
  constraint FK_TP_InvestObject foreign key (InvestObject) references InvestObject(ID)    
)
/
CREATE INDEX FK_TP_InvestObject ON TENDERPRODUCT(InvestObject)
/
ALTER TABLE UNIONNOTIFYDETAIL ADD (
  InvestObject NUMBER(10),
    CHECK((InvestObject<=2147483647)AND(InvestObject>-2147483648)),
  constraint FK_UND_InvestObject foreign key (InvestObject) references InvestObject(ID)    
)
/
CREATE INDEX FK_UND_InvestObject ON UNIONNOTIFYDETAIL(InvestObject)
/
ALTER TABLE BANKEXCH_SUBSTITUTION ADD (
  SourceInvestObject NUMBER(10),
    CHECK((SourceInvestObject<=2147483647)AND(SourceInvestObject>-2147483648)),
  constraint FK_BankExchSubst_SIO foreign key (SourceInvestObject) references InvestObject(ID)    
)
/
CREATE INDEX FK_BankExchSubst_SIO ON BANKEXCH_SUBSTITUTION(SourceInvestObject)
/
ALTER TABLE BANKEXCH_SUBSTITUTION ADD (
  DestInvestObject NUMBER(10),
    CHECK((DestInvestObject<=2147483647)AND(DestInvestObject>-2147483648)),
  constraint FK_BankExchSubst_DIO foreign key (DestInvestObject) references InvestObject(ID)    
)
/
CREATE INDEX FK_BankExchSubst_DIO ON BANKEXCH_SUBSTITUTION(DestInvestObject)
/


COMMIT WORK
/

-- #########################################################
-- #########################################################
-- Alter_ElDocNumber_to_NOTE4000.sql
-- #########################################################
-- #########################################################

/* скрипт увеличивает размер поля ElDocNumber таблицы
  ed_outpaydoc до 4000 символов*/
ALTER TABLE ed_outpaydoc MODIFY (ELDOCNUMBER VARCHAR2(4000))
/
COMMIT WORK
/


-- #########################################################
-- #########################################################
-- alter_FacFinDetail_add_TransfertOrg_ref.sql
-- #########################################################
-- #########################################################

/* Добавление TransfertOrg_Ref в FacialFinDetail */
ALTER TABLE TB_FacialFinDetail ADD (
  TransfertOrg_Ref NUMBER(10),
    CHECK((TransfertOrg_Ref<=2147483647)AND(TransfertOrg_Ref>-2147483648))
)
/

CREATE OR REPLACE VIEW FacialFinDetail (
  ID,
  SOURCEFACIALACC_CLS,
  SOURCEKVR,
  SOURCEKESR,
  DESTFACIALACC_CLS,
  DESTKVR,
  DESTKESR,
  BUDGETREF,
  CREDIT,
  PAYSYMBOLCLS,
  MEMORDERNUM,
  NOTE,
  PROGINDEX,
  RECORDINDEX,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  SOURCEKVSR,
  SOURCEKCSR,
  SOURCEKFSR,
  SOURCESUBKESR,
  SOURCEFACT,
  SOURCEMEANSTYPE,
  SOURCEFINSOURCE,
  SOURCEFINTYPE,
  DESTKVSR,
  DESTKCSR,
  DESTKFSR,
  DESTSUBKESR,
  DESTFACT,
  DESTMEANSTYPE,
  DESTFINSOURCE,
  DESTFINTYPE,
  REQUESTSINDEX,
  SENDERID,
  SENDERRECORDID,
  PROMISE,
  SOURCEDOCTYPE,
  DESTDOCTYPE,
  SOURCEPROMISE,
  DESTPROMISE,
  RECORDINDEX2,
  SOURCEBUDGETPROMISE,
  DESTBUDGETPROMISE,
  SUBPROGINDEX,
  STIMATEID,
  RVERSION,
  SOURCEDIRECTIONCLS,
  DESTDIRECTIONCLS,
  SOURCEDOCBASE,
  DESTDOCBASE,
  SOURCEEXECDOC,
  DESTEXECDOC,
  BUHOPERATIONCLS,
  SOURCEIFS,
  DESTIFS,
  CLSTYPE,
  UNIONNOTIFYREF,
  ACCEPTDATE,
  SOURCEKD,
  DESTKD,
  SOURCEREGIONCLS,
  DESTREGIONCLS,
  DESTFUNDSSOURCE,
  SOURCEFUNDSSOURCE,
  ISBLOCKED,
  BLOCKEDCAUSE,
  UNBLOCKEDDATE,
  UNBLOCKEDCAUSE,
  SOURCETRANSFERTCLS,
  DESTTRANSFERTCLS,
  DESTCLSTYPE,
  SOURCEASSIGNMENTKIND,
  DESTASSIGNMENTKIND,
  SOURCEEXECINNERNUMBER,
  DESTEXECINNERNUMBER,
  SOURCESUBSIDYCLS,
  DESTSUBSIDYCLS,
  SOURCEFAORG_TYPE,
  DESTFAORG_TYPE,
  SOURCEBUDALLOCATIONCLS,
  SOURCEPAYPROMISECLS,
  DESTBUDALLOCATIONCLS,
  DESTPAYPROMISECLS,
  SOURCEINVESTOBJECT,
  DESTINVESTOBJECT,
  TRANSFERTORG_REF)
AS
  SELECT
    ID,
    SOURCEFACIALACC_CLS,
    SOURCEKVR,
    SOURCEKESR,
    DESTFACIALACC_CLS,
    DESTKVR,
    DESTKESR,
    BUDGETREF,
    CREDIT,
    PAYSYMBOLCLS,
    MEMORDERNUM,
    NOTE,
    PROGINDEX,
    RECORDINDEX,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    SOURCEKVSR,
    SOURCEKCSR,
    SOURCEKFSR,
    SOURCESUBKESR,
    SOURCEFACT,
    SOURCEMEANSTYPE,
    SOURCEFINSOURCE,
    SOURCEFINTYPE,
    DESTKVSR,
    DESTKCSR,
    DESTKFSR,
    DESTSUBKESR,
    DESTFACT,
    DESTMEANSTYPE,
    DESTFINSOURCE,
    DESTFINTYPE,
    REQUESTSINDEX,
    SENDERID,
    SENDERRECORDID,
    PROMISE,
    SOURCEDOCTYPE,
    DESTDOCTYPE,
    SOURCEPROMISE,
    DESTPROMISE,
    RECORDINDEX2,
    SOURCEBUDGETPROMISE,
    DESTBUDGETPROMISE,
    SUBPROGINDEX,
    STIMATEID,
    RVERSION,
    SOURCEDIRECTIONCLS,
    DESTDIRECTIONCLS,
    SOURCEDOCBASE,
    DESTDOCBASE,
    SOURCEEXECDOC,
    DESTEXECDOC,
    BUHOPERATIONCLS,
    SOURCEIFS,
    DESTIFS,
    CLSTYPE,
    UNIONNOTIFYREF,
    ACCEPTDATE,
    SOURCEKD,
    DESTKD,
    SOURCEREGIONCLS,
    DESTREGIONCLS,
    DESTFUNDSSOURCE,
    SOURCEFUNDSSOURCE,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    SOURCETRANSFERTCLS,
    DESTTRANSFERTCLS,
    DESTCLSTYPE,
    SOURCEASSIGNMENTKIND,
    DESTASSIGNMENTKIND,
    SOURCEEXECINNERNUMBER,
    DESTEXECINNERNUMBER,
    SOURCESUBSIDYCLS,
    DESTSUBSIDYCLS,
    SOURCEFAORG_TYPE,
    DESTFAORG_TYPE,
    SOURCEBUDALLOCATIONCLS,
    SOURCEPAYPROMISECLS,
    DESTBUDALLOCATIONCLS,
    DESTPAYPROMISECLS,
    SOURCEINVESTOBJECT,
    DESTINVESTOBJECT,
    TRANSFERTORG_REF
  FROM TB_FacialFinDetail
/

CREATE OR REPLACE TRIGGER TR_FACIALFINDETAIL_ID
  INSTEAD OF DELETE
  ON FACIALFINDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_500 (TR_FACIALFINDETAIL_BD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  Update facialfincaption set
  DocChangeDate = SYSDATE,
  RVersion=-1
  where id=:old.recordindex;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_FACIALFINDETAIL
  WHERE id = :old.id;

-- - - - - - - - - - - - -
-- AD_500 (TR_FACIALFINDETAIL_AD_500)
-- Last update 27.08.2004
-- - - - - - - - - - - - -

  INSERT INTO DelRecIndexes
              (TableID, RecordId, DeleteDate, ProgIndex, Summa)
       VALUES (22, :OLD.ID, SYSDATE, :OLD.ProgIndex, :OLD.Credit);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALFINDETAIL_II
  INSTEAD OF INSERT
  ON FACIALFINDETAIL
  FOR EACH ROW
DECLARE
  new$ID FACIALFINDETAIL.ID%TYPE := :NEW.ID;
  new$SOURCEFACIALACC_CLS FACIALFINDETAIL.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$SOURCEKVR FACIALFINDETAIL.SOURCEKVR%TYPE := :NEW.SOURCEKVR;
  new$SOURCEKESR FACIALFINDETAIL.SOURCEKESR%TYPE := :NEW.SOURCEKESR;
  new$DESTFACIALACC_CLS FACIALFINDETAIL.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$DESTKVR FACIALFINDETAIL.DESTKVR%TYPE := :NEW.DESTKVR;
  new$DESTKESR FACIALFINDETAIL.DESTKESR%TYPE := :NEW.DESTKESR;
  new$BUDGETREF FACIALFINDETAIL.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREDIT FACIALFINDETAIL.CREDIT%TYPE := :NEW.CREDIT;
  new$PAYSYMBOLCLS FACIALFINDETAIL.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$MEMORDERNUM FACIALFINDETAIL.MEMORDERNUM%TYPE := :NEW.MEMORDERNUM;
  new$NOTE FACIALFINDETAIL.NOTE%TYPE := :NEW.NOTE;
  new$PROGINDEX FACIALFINDETAIL.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX FACIALFINDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CREATERUSER FACIALFINDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$SOURCEKVSR FACIALFINDETAIL.SOURCEKVSR%TYPE := :NEW.SOURCEKVSR;
  new$SOURCEKCSR FACIALFINDETAIL.SOURCEKCSR%TYPE := :NEW.SOURCEKCSR;
  new$SOURCEKFSR FACIALFINDETAIL.SOURCEKFSR%TYPE := :NEW.SOURCEKFSR;
  new$SOURCESUBKESR FACIALFINDETAIL.SOURCESUBKESR%TYPE := :NEW.SOURCESUBKESR;
  new$SOURCEFACT FACIALFINDETAIL.SOURCEFACT%TYPE := :NEW.SOURCEFACT;
  new$SOURCEMEANSTYPE FACIALFINDETAIL.SOURCEMEANSTYPE%TYPE := :NEW.SOURCEMEANSTYPE;
  new$SOURCEFINSOURCE FACIALFINDETAIL.SOURCEFINSOURCE%TYPE := :NEW.SOURCEFINSOURCE;
  new$SOURCEFINTYPE FACIALFINDETAIL.SOURCEFINTYPE%TYPE := :NEW.SOURCEFINTYPE;
  new$DESTKVSR FACIALFINDETAIL.DESTKVSR%TYPE := :NEW.DESTKVSR;
  new$DESTKCSR FACIALFINDETAIL.DESTKCSR%TYPE := :NEW.DESTKCSR;
  new$DESTKFSR FACIALFINDETAIL.DESTKFSR%TYPE := :NEW.DESTKFSR;
  new$DESTSUBKESR FACIALFINDETAIL.DESTSUBKESR%TYPE := :NEW.DESTSUBKESR;
  new$DESTFACT FACIALFINDETAIL.DESTFACT%TYPE := :NEW.DESTFACT;
  new$DESTMEANSTYPE FACIALFINDETAIL.DESTMEANSTYPE%TYPE := :NEW.DESTMEANSTYPE;
  new$DESTFINSOURCE FACIALFINDETAIL.DESTFINSOURCE%TYPE := :NEW.DESTFINSOURCE;
  new$DESTFINTYPE FACIALFINDETAIL.DESTFINTYPE%TYPE := :NEW.DESTFINTYPE;
  new$REQUESTSINDEX FACIALFINDETAIL.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$SENDERID FACIALFINDETAIL.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINDETAIL.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$PROMISE FACIALFINDETAIL.PROMISE%TYPE := :NEW.PROMISE;
  new$SOURCEDOCTYPE FACIALFINDETAIL.SOURCEDOCTYPE%TYPE := :NEW.SOURCEDOCTYPE;
  new$DESTDOCTYPE FACIALFINDETAIL.DESTDOCTYPE%TYPE := :NEW.DESTDOCTYPE;
  new$SOURCEPROMISE FACIALFINDETAIL.SOURCEPROMISE%TYPE := :NEW.SOURCEPROMISE;
  new$DESTPROMISE FACIALFINDETAIL.DESTPROMISE%TYPE := :NEW.DESTPROMISE;
  new$RECORDINDEX2 FACIALFINDETAIL.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$SOURCEBUDGETPROMISE FACIALFINDETAIL.SOURCEBUDGETPROMISE%TYPE := :NEW.SOURCEBUDGETPROMISE;
  new$DESTBUDGETPROMISE FACIALFINDETAIL.DESTBUDGETPROMISE%TYPE := :NEW.DESTBUDGETPROMISE;
  new$SUBPROGINDEX FACIALFINDETAIL.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$STIMATEID FACIALFINDETAIL.STIMATEID%TYPE := :NEW.STIMATEID;
  new$RVERSION FACIALFINDETAIL.RVERSION%TYPE := :NEW.RVERSION;
  new$SOURCEDIRECTIONCLS FACIALFINDETAIL.SOURCEDIRECTIONCLS%TYPE := :NEW.SOURCEDIRECTIONCLS;
  new$DESTDIRECTIONCLS FACIALFINDETAIL.DESTDIRECTIONCLS%TYPE := :NEW.DESTDIRECTIONCLS;
  new$SOURCEDOCBASE FACIALFINDETAIL.SOURCEDOCBASE%TYPE := :NEW.SOURCEDOCBASE;
  new$DESTDOCBASE FACIALFINDETAIL.DESTDOCBASE%TYPE := :NEW.DESTDOCBASE;
  new$SOURCEEXECDOC FACIALFINDETAIL.SOURCEEXECDOC%TYPE := :NEW.SOURCEEXECDOC;
  new$DESTEXECDOC FACIALFINDETAIL.DESTEXECDOC%TYPE := :NEW.DESTEXECDOC;
  new$BUHOPERATIONCLS FACIALFINDETAIL.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$SOURCEIFS FACIALFINDETAIL.SOURCEIFS%TYPE := :NEW.SOURCEIFS;
  new$DESTIFS FACIALFINDETAIL.DESTIFS%TYPE := :NEW.DESTIFS;
  new$CLSTYPE FACIALFINDETAIL.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$UNIONNOTIFYREF FACIALFINDETAIL.UNIONNOTIFYREF%TYPE := :NEW.UNIONNOTIFYREF;
  new$ACCEPTDATE FACIALFINDETAIL.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SOURCEKD FACIALFINDETAIL.SOURCEKD%TYPE := :NEW.SOURCEKD;
  new$DESTKD FACIALFINDETAIL.DESTKD%TYPE := :NEW.DESTKD;
  new$SOURCEREGIONCLS FACIALFINDETAIL.SOURCEREGIONCLS%TYPE := :NEW.SOURCEREGIONCLS;
  new$DESTREGIONCLS FACIALFINDETAIL.DESTREGIONCLS%TYPE := :NEW.DESTREGIONCLS;
  new$DESTFUNDSSOURCE FACIALFINDETAIL.DESTFUNDSSOURCE%TYPE := :NEW.DESTFUNDSSOURCE;
  new$SOURCEFUNDSSOURCE FACIALFINDETAIL.SOURCEFUNDSSOURCE%TYPE := :NEW.SOURCEFUNDSSOURCE;
  new$ISBLOCKED FACIALFINDETAIL.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINDETAIL.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINDETAIL.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINDETAIL.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$SOURCETRANSFERTCLS FACIALFINDETAIL.SOURCETRANSFERTCLS%TYPE := :NEW.SOURCETRANSFERTCLS;
  new$DESTTRANSFERTCLS FACIALFINDETAIL.DESTTRANSFERTCLS%TYPE := :NEW.DESTTRANSFERTCLS;
  new$DESTCLSTYPE FACIALFINDETAIL.DESTCLSTYPE%TYPE := :NEW.DESTCLSTYPE;
  new$SOURCEASSIGNMENTKIND FACIALFINDETAIL.SOURCEASSIGNMENTKIND%TYPE := :NEW.SOURCEASSIGNMENTKIND;
  new$DESTASSIGNMENTKIND FACIALFINDETAIL.DESTASSIGNMENTKIND%TYPE := :NEW.DESTASSIGNMENTKIND;
  new$SOURCEEXECINNERNUMBER FACIALFINDETAIL.SOURCEEXECINNERNUMBER%TYPE := :NEW.SOURCEEXECINNERNUMBER;
  new$DESTEXECINNERNUMBER FACIALFINDETAIL.DESTEXECINNERNUMBER%TYPE := :NEW.DESTEXECINNERNUMBER;
  new$SOURCESUBSIDYCLS FACIALFINDETAIL.SOURCESUBSIDYCLS%TYPE := :NEW.SOURCESUBSIDYCLS;
  new$DESTSUBSIDYCLS FACIALFINDETAIL.DESTSUBSIDYCLS%TYPE := :NEW.DESTSUBSIDYCLS;
  new$SOURCEFAORG_TYPE FACIALFINDETAIL.SOURCEFAORG_TYPE%TYPE := :NEW.SOURCEFAORG_TYPE;
  new$DESTFAORG_TYPE FACIALFINDETAIL.DESTFAORG_TYPE%TYPE := :NEW.DESTFAORG_TYPE;
  new$SOURCEBUDALLOCATIONCLS FACIALFINDETAIL.SOURCEBUDALLOCATIONCLS%TYPE := :NEW.SOURCEBUDALLOCATIONCLS;
  new$SOURCEPAYPROMISECLS FACIALFINDETAIL.SOURCEPAYPROMISECLS%TYPE := :NEW.SOURCEPAYPROMISECLS;
  new$DESTBUDALLOCATIONCLS FACIALFINDETAIL.DESTBUDALLOCATIONCLS%TYPE := :NEW.DESTBUDALLOCATIONCLS;
  new$DESTPAYPROMISECLS FACIALFINDETAIL.DESTPAYPROMISECLS%TYPE := :NEW.DESTPAYPROMISECLS;
  new$SOURCEINVESTOBJECT FACIALFINDETAIL.SOURCEINVESTOBJECT%TYPE := :NEW.SOURCEINVESTOBJECT;
  new$DESTINVESTOBJECT FACIALFINDETAIL.DESTINVESTOBJECT%TYPE := :NEW.DESTINVESTOBJECT;
  new$TRANSFERTORG_REF FACIALFINDETAIL.TRANSFERTORG_REF%TYPE := :NEW.TRANSFERTORG_REF;
--
  SourceFacialAcc_CLS$ NUMBER(10);
  DestFacialAcc_CLS$ NUMBER(10);
  CapBuhOperationCLS$ NUMBER(10);
  CapClsType$ NUMBER(10);
  CapAcceptDate$ NUMBER(10);
  CaptionAcceptDate$ NUMBER;
  PromiseAcceptDate$ NUMBER;
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  BPInnerNum1$ NUMBER(10);
  PromiseMode1$ NUMBER(10);
  Promise_Count1$ NUMBER(10);
  CaptionRejectCls1$ NUMBER(10);
  PromiseAccepted1$ NUMBER(10);
  PromiseMode$ NUMBER(10);
  ProgIndex$ NUMBER(10);
  ExecID$ NUMBER(10);
  ExecInnerNumber$ NUMBER(10);
  ExecRegType$ NUMBER(10);
  ExecAgrInnerNum$ NUMBER(10);
  AgrInnerNumber$ NUMBER(10);
  CaptionRejectCls$ NUMBER(10);
  EDAccepted$ NUMBER(10);
  i_fintype$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FACIALFINDETAIL_BI_0)
-- Last update 15.12.2002
-- - - - - - - - - - - - -

   IF (new$ID IS NULL) THEN
      SELECT g_Shared.NEXTVAL INTO new$ID FROM DUAL;
   END IF;

   IF (new$Credit IS NULL) THEN new$Credit := 0; END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_FACIALFINDETAIL_BI_100)
-- Last update 12.01.2009
-- - - - - - - - - - - - -

 /* Заполнение Бюджета, берем из мастера */
   BEGIN

     select
       ffc.BudgetRef, ffc.BuhOperationCls, ffc.ClsType, ffc.AcceptDate,
       ffc.IsBlocked, ffc.BlockedCause, ffc.UnBlockedDate, ffc.UnBlockedCause
     into new$BudgetRef, CapBuhOperationCls$, CapClsType$, CapAcceptDate$,
       new$IsBlocked, new$BlockedCause, new$UnBlockedDate, new$UnBlockedCause
     from
       FacialFinCaption ffc
     where
       ffc.id = new$RecordIndex;
     
   EXCEPTION
     WHEN NO_DATA_FOUND THEN
       new$BudgetRef := NULL;
       CapBuhOperationCls$ := NULL;
       CapClsType$ := NULL;
       CapAcceptDate$ := NULL;
   END;

   /* Бух операцию заполняем из заголовка */
   if (new$BuhOperationCls is null) then new$BuhOperationCls := CapBuhOperationCls$; end if;

   /* Тип классификации заполняем из заголовка */
   if (new$ClsType is null) then new$ClsType := CapClsType$; end if;

   if (new$DestClsType is null) then new$DestClsType := new$ClsType; end if;
   
   /* Дату принятия заполняем из заголовка */
   if (new$AcceptDate is null) then new$AcceptDate := CapAcceptDate$; end if;

   /* Сносим Лицевые счета из заголовка */
   if ((new$SourceFacialAcc_CLS is null) or (new$DestFacialAcc_CLS is null)) then
     BEGIN
       select SourceFacialAcc_CLS, DestFacialAcc_CLS
         into SourceFacialAcc_CLS$, DestFacialAcc_CLS$
       from FacialFinCaption
       where new$RecordIndex = id;
     EXCEPTION
       WHEN NO_DATA_FOUND THEN
         SourceFacialAcc_CLS$ := NULL;
         DestFacialAcc_CLS$ := NULL;
     END;

     if (new$SourceFacialAcc_CLS is null) then new$SourceFacialAcc_CLS := SourceFacialAcc_CLS$; end if;
     if (new$DestFacialAcc_CLS is null) then new$DestFacialAcc_CLS := DestFacialAcc_CLS$; end if;
   end if;

-- - - - - - - - - - - - -
-- BI_110 (TR_FACIALFINDETAIL_BI_110)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  /* Если тип финансирования не задан, то берем его из констант казначейства*/ 
  i_fintype$ := -1 ;
  IF (new$SourceFintype IS NULL OR (new$Sourcefintype=0)) THEN 
    BEGIN
      SELECT constvalue INTO i_fintype$   FROM intconst
      WHERE (progindex=30) AND (constindex=10) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    new$SourceFintype := i_fintype$  ;
     
  END IF;
  IF (new$DestFintype IS NULL OR (new$Destfintype=0)) THEN 
    IF (i_fintype$ = -1) THEN
      BEGIN
        SELECT constvalue INTO i_fintype$   FROM intconst
        WHERE (progindex=30) AND (constindex=10) ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
    END IF;
    new$DestFintype := i_fintype$  ;
     
  END IF;
  IF (new$SourceFacialAcc_CLS IS NULL) THEN 
    new$SourceFacialAcc_CLS := 0;
  END IF;
  IF (new$SourceKVR IS NULL) THEN 
    new$SourceKVR := 0;
  END IF;
  IF (new$SourceKESR IS NULL) THEN 
    new$SourceKESR := 0;
  END IF;
  IF (new$SourceKVSR IS NULL) THEN 
    new$SourceKVSR := 0;
  END IF;
  IF (new$SourceKFSR IS NULL) THEN 
    new$SourceKFSR := 0;
  END IF;
  IF (new$SourceKCSR IS NULL) THEN 
    new$SourceKCSR := 0;
  END IF;
  IF (new$SourceSubKESR IS NULL) THEN 
    new$SourceSubKESR := 0;
  END IF;
  IF (new$SourceDirectionCls IS NULL) THEN 
    new$SourceDirectionCls := 0;
  END IF;
  IF (new$SourceFact IS NULL) THEN 
    new$SourceFact := 0;
  END IF;
  IF (new$SourceMeansType IS NULL) THEN 
    new$SourceMeansType := 0;
  END IF;
  IF (new$SourceFinSource IS NULL) THEN 
    new$SourceFinSource := 0;
  END IF;
  IF (new$SourceFinType IS NULL) THEN 
    new$SourceFinType := 0;
  END IF;
  IF (new$SourceDocType IS NULL) THEN 
    new$SourceDocType := 1000;
  END IF;
  IF (new$SourceIFS IS NULL) THEN 
    new$Sourceifs := 0;
  END IF;
  IF (new$SourceKD IS NULL) THEN 
    new$SourceKD := 0;
  END IF;
  IF (new$SourceFundsSource IS NULL) THEN 
    new$SourceFundsSource := 0;
  END IF;
  IF (new$SourceAssignmentKind IS NULL) THEN 
    new$SourceAssignmentKind := 0;
  END IF;
  IF (new$SourceRegionCLS IS NULL) THEN 
    new$SourceRegionCLS := 0;
  END IF;
  IF (new$DestFacialAcc_CLS IS NULL) THEN 
    new$DestFacialAcc_CLS := 0;
  END IF;
  IF (new$DestKVR IS NULL) THEN 
    new$DestKVR := 0;
  END IF;
  IF (new$DestKESR IS NULL) THEN 
    new$DestKESR := 0;
  END IF;
  IF (new$DestKVSR IS NULL) THEN 
    new$DestKVSR := 0;
  END IF;
  IF (new$DestKFSR IS NULL) THEN 
    new$DestKFSR := 0;
  END IF;
  IF (new$DestKCSR IS NULL) THEN 
    new$DestKCSR := 0;
  END IF;
  IF (new$DestSubKESR IS NULL) THEN 
    new$DestSubKESR := 0;
  END IF;
  IF (new$DestDirectionCls IS NULL) THEN 
    new$DestDirectionCls := 0;
  END IF;
  IF (new$DestFact IS NULL) THEN 
    new$DestFact := 0;
  END IF;
  IF (new$DestMeansType IS NULL) THEN 
    new$DestMeansType := 0;
  END IF;
  IF (new$DestFinSource IS NULL) THEN 
    new$DestFinSource := 0;
  END IF;
  IF (new$DestFinType IS NULL) THEN 
    new$DestFinType := 0;
  END IF;
  IF (new$DestDocType IS NULL) THEN 
    new$DestDocType := 1000;
  END IF;
  IF (new$DestIFS IS NULL) THEN 
    new$Destifs := 0;
  END IF;
  IF (new$DestKD IS NULL) THEN 
    new$DestKD := 0;
  END IF;
  IF (new$DestFundsSource IS NULL) THEN 
    new$DestFundsSource := 0;
  END IF;
  IF (new$DestAssignmentKind IS NULL) THEN 
    new$DestAssignmentKind := 0;
  END IF;
  IF (new$DestRegionCLS IS NULL) THEN 
    new$DestRegionCLS := 0;
  END IF;
  /* для Распределения ОФ: классификация плательщика не должна быть нулевой */
  if (new$progindex=76) then
    new$SourceKVR := new$DestKVR;
    new$SourceKESR := new$DestKESR;
    new$SourceKVSR := new$DestKVSR;
    new$SourceKFSR := new$DestKFSR;
    new$SourceKCSR := new$DestKCSR;
    new$SourceSubKESR := new$DestSubKESR;
    new$SourceDirectionCls := new$DestDirectionCls;
    new$SourceFact := new$DestFact;
    new$SourceMeansType := new$DestMeansType;
    new$SourceFinSource := new$DestFinSource;
    new$SourceFinType := new$DestFinType;
    new$SourceDocType := new$DestDocType;
    new$SourceIFS := new$DestIFS;
    new$SourceKD := new$DestKD;
    new$SourceRegionCls := new$DestRegionCls;
    new$SourceDocBase := new$DestDocBase;
    new$SourceAssignmentKind := new$DestAssignmentKind;
     
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  /* старое поле Promise null, а новые нет */
  IF ((new$Promise IS NULL) AND
  ((new$SourcePromise IS NOT NULL) OR
  (new$DestPromise IS NOT NULL))) THEN
    IF (new$progindex IN (63, 64, 73)) THEN
      new$Promise := new$SourcePromise;
         
    ELSE 
      IF (new$progindex IN (61, 62, 65, 75)) THEN
        new$Promise := new$DestPromise;
           
      ELSE 
        IF ((new$progindex in (66, 67, 76))AND(new$DestPromise IS NOT NULL)AND
        (new$SourcePromise=new$DestPromise)) THEN
          new$Promise := new$DestPromise;
        END IF;
      END IF; 
    END IF;/* если новые поля пустые,а старый нет, то старый ± преобразуем в новый */
  ELSE
    IF ((new$Promise IS NOT NULL) AND
    (new$SourcePromise IS NULL) AND
    (new$DestPromise IS NULL)) THEN
      IF (new$progindex IN (63, 64, 73)) THEN
        new$SourcePromise := new$Promise;
           
      ELSE 
        IF (new$progindex IN (61, 62, 65, 75)) THEN
          new$DestPromise := new$Promise;
             
        ELSE 
          IF (new$progindex in (66, 67, 76)) THEN
            new$SourcePromise := new$Promise;
            new$DestPromise := new$Promise;
               
          END IF;
        END IF; 
      END IF;
    END IF;
  END IF;
  BEGIN

    /* заполняем вид организации владельца л\с плательщика и получателя*/
    SELECT org.Org_Type  INTO new$SourceFAOrg_Type FROM Organizations org
    INNER JOIN FacialACC_Cls fac ON (org.ID = fac.Org_ref)
    WHERE fac.ID = new$SourceFacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  BEGIN

    SELECT org.Org_Type  INTO new$DestFAOrg_Type FROM Organizations org
    INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
    WHERE fac.ID = new$DestFacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BI_120 (TR_FACIALFINDETAIL_BI_120)
-- Create 28.04.2005
-- Last update 15.12.2008
-- - - - - - - - - - - - -

    /*  60 :  'Приход средств от фин.органа'; source
        61 :  'Приход средств от прочих и восстановление расходов'; dest
        62 :  'Приход средств по объявлениям';dest
        63 :  'Уход средств по платежным поручениям'; source
        64 :  'Уход средств по чекам'; source
        65 :  'Переброска средств, Разассигновка';dest
        66 :  'Внутренняя переброска средств, один - многим'; source dest
        67 :  'Уход средств в районы';source
        68 :  'Перечисление на р\с районов';dest
        69 :  'Подтверждение перечисления на р\с районов'; dest
        70 :  'Возврат с р\с районов';source
        71 :  'Подтверждение возврата с р\с районов'; dest */

  /*ClsType*/
  if ((New$ClsType is NULL) and 
        ( 
          ((New$SourceIFS <> 0) and (New$ProgIndex in (63,64,66,67,68,70))) or
          (New$ProgIndex = 60)
        )) then
    New$ClsType := 1; /* если это источник и забыли ввести ClsType */
  elsif ((New$ClsType is NULL) and (New$SourceKD <> 0) and
        (New$ProgIndex in (63,64,66,67,68,70))) then
    New$ClsType := 2; /* если это код дохода и забыли ввести ClsType */
  elsif (new$ClsType is null) then
    new$ClsType := 0; /* иначе - расходная */
  end if;  

  IF ((new$ClsType = 0) AND 
      (((new$SourceIFS <> 0) or (new$SourceKD <> 0)) and
      (new$ProgIndex in (63,64,66,67,68,70)))
     ) THEN /* классификация расходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;
  IF ((new$ClsType = 1) AND (
    (new$SourceKVSR <> 0) OR (new$SourceKFSR <> 0) OR
    (new$SourceKCSR <> 0) OR (new$SourceKVR <> 0) OR
    (new$SourceKESR <> 0) OR
    ((new$SourceKD <> 0) and (new$ProgIndex in (63,64,66,67,68,70)))
    )) THEN /* классификация источниковая */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;
  IF ((new$ClsType = 2) AND (
    (new$SourceKVSR <> 0) OR (new$SourceKFSR <> 0) OR
    (new$SourceKCSR <> 0) OR (new$SourceKVR <> 0) OR
    (new$SourceKESR <> 0) OR
    ((new$SourceIFS <> 0) and (new$ProgIndex in (63,64,66,67,68,70)))
    )) THEN /* классификация доходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  /*DestClsType*/
  if ((new$DestClsType is NULL) and
        ( 
          ((new$DestIFS <> 0) and (new$ProgIndex in (61,62,65,69,71))) or (new$ProgIndex = 60)
        )) then
    new$DestClsType := 1; /* если это источник и забыли ввести ClsType */
  elsif ((new$DestClsType is NULL) and
          ((new$DestKD <> 0) and (new$ProgIndex in (61,62,65,69,71)))
        ) then
    new$DestClsType := 2; /* если это код дохода и забыли ввести ClsType */
  elsif (new$DestClsType is null) then
    new$DestClsType := 0; /* иначе - расходная */
  end if;      

  IF ((new$DestClsType = 0) AND
      (((new$DestIFS <> 0) or (new$DestKD <> 0)) and
      (new$ProgIndex in (61,62,65,69,71)))
     ) THEN /* классификация расходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;
  IF ((new$DestClsType = 1) AND (
    (new$DestKVSR <> 0) OR (new$DestKFSR <> 0) OR
    (new$DestKCSR <> 0) OR (new$DestKVR <> 0) OR
    (new$DestKESR <> 0) or
    ((new$DestKD <> 0) and (new$ProgIndex in (61,62,65,69,71)))
    )) THEN /* классификация источниковая */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  IF ((new$DestClsType = 2) AND (
    (new$DestKVSR <> 0) OR (new$DestKFSR <> 0) OR
    (new$DestKCSR <> 0) OR (new$DestKVR <> 0) OR
    (new$DestKESR <> 0) or
    ((new$DestIFS <> 0) and (new$ProgIndex in (61,62,65,69,71)))
    )) THEN /* классификация доходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BI_200 (TR_FACIALFINDETAIL_BI_200)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* проставляем номера бюджетных обязательств по Учету договоров*/
  GetIntConst(30, 15,PromiseMode1$);
  /* ПРОВЕРКА ДЛЯ БЛОКА БО */
  if (((new$SourcePromise is not null) or (new$DestPromise is not null)) and (PromiseMode1$ <> 1)) then
    if (new$SourcePromise is not null) then
      /* Проверка сущствует ли такое БО на который ссылается документ*/
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count1$         from
      promise_detail pr
      where
      (pr.registrnumber = new$SOURCEPROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count1$ = 0) then
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    if (new$DestPromise is not null) then
      /* Проверка сущствует ли такое БО на который ссылается документ*/
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count1$         from
      promise_detail pr
      where
      (pr.registrnumber = new$DESTPROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count1$ = 0) then
        RaiseException('EX_BP_NotExist');      
      END IF;    
    END IF;
  END IF;
  if (PromiseMode1$ = 1) then
    /* source Подтяжка внутр. номера по номеру БО*/
    if ((new$SourcePromise is not null) and (new$SourceBudgetPromise is null)) then
      select max(InnerPromiseNum) 
      into BPInnerNum1$           from PaymentSchedule 
      where (ANumber = new$SourcePromise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum1$ <> 0) then
        new$SourceBudgetPromise := BPInnerNum1$;
                
      else
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    /* dest Подтяжка внутр. номера по номеру БО*/
    if ((new$DestPromise is not null) and (new$DestBudgetPromise is null)) then
      select max(InnerPromiseNum) 
      into BPInnerNum1$           from PaymentSchedule
      where (ANumber = new$DestPromise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum1$ <> 0) then
        new$DestBudgetPromise := BPInnerNum1$;
                
      else
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    /* source Если есть новый номер, но нет старого, тогда проставляем старый*/
    if ((new$SourceBudgetPromise is not null) and (new$SourcePromise is null)) then
      BEGIN
        select ANumber 
        into BPInnerNum1$           from PaymentSchedule
        where (InnerPromiseNum = new$SourceBudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      new$SourcePromise := BPInnerNum1$;
      new$Promise := BPInnerNum1$;
            
    END IF;
    /* dest */
    if ((new$DestBudgetPromise is not null) and (new$DestPromise is null)) then
      BEGIN
        select ANumber 
        into BPInnerNum1$           from PaymentSchedule
        where (InnerPromiseNum = new$DestBudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      new$DestPromise := BPInnerNum1$;
      new$Promise := BPInnerNum1$;
            
    END IF;
    /* проверка по двум полям */
    if (new$SourceBudgetPromise is not null and new$SourcePromise is not null) then
      SELECT COUNT(ANumber ) INTO CNT$1
      from PaymentSchedule where (ANumber = new$SourcePromise and InnerPromiseNum = new$SourceBudgetPromise) AND (ROWNUM = 1);
      if (not (CNT$1<> 0)) then
        RaiseException('Ex_BP_NotExist');
      END IF;
      BEGIN

        /* выбираем дату принятия и причину отклонения заголовка */
        select AcceptDate, Reject_Cls         into CaptionAcceptDate$, CaptionRejectCls1$ from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия БО для Source */
        select AcceptDate, Accepted         into PromiseAcceptDate$, PromiseAccepted1$ from PaymentSchedule
        where ANumber = new$SourcePromise and InnerPromiseNum = new$SourceBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls1$ is null and PromiseAccepted1$ <> 1) then
        RaiseException('Ex_BP_Rejected');
      END IF;
      /* если принятый документ ссылается на не принятое БО */
      if (CaptionAcceptDate$ is not null and (PromiseAcceptDate$ is null or PromiseAccepted1$ <> 1)) then
        RaiseException('Ex_BP_NotAccepted');      
      END IF;
    END IF;
    if (new$DestBudgetPromise is not null and new$DestPromise is not null) then
      SELECT COUNT(ANumber ) INTO CNT$2
      from PaymentSchedule where (ANumber = new$DestPromise and InnerPromiseNum = new$DestBudgetPromise) AND (ROWNUM = 1);
      if (not (CNT$2<> 0)) then
        RaiseException('Ex_BP_NotExist');
      END IF;
      BEGIN

        /* выбираем дату принятия и причину отклонения заголовка */
        select AcceptDate, Reject_Cls         into CaptionAcceptDate$, CaptionRejectCls1$ from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия БО для Dest */
        select AcceptDate, Accepted         into PromiseAcceptDate$, PromiseAccepted1$ from PaymentSchedule
        where ANumber = new$DestPromise and InnerPromiseNum = new$DestBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls1$ is null and PromiseAccepted1$ <> 1) then
        RaiseException('Ex_BP_Rejected');
      END IF;
      /* если принятый документ ссылается на не принятое БО */
      if (CaptionAcceptDate$ is not null and (PromiseAcceptDate$ is null or PromiseAccepted1$ <> 1)) then
        RaiseException('Ex_BP_NotAccepted');      
      END IF;    
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_210 (TR_FACIALFINDETAIL_BI_210)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* используем болк учета договоров?*/
  GetIntConst(30, 15,PromiseMode$);
  if (PromiseMode$ = 1) then
    /* при простановке БО плательщика или его изменении */
    if (new$SourcePromise is not null) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$SourcePromise and ps.InnerPromiseNum = new$SourceBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$SourceExecDoc := ExecID$;
        new$SourceExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$SourceExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$SourceExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$SourceExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано, а ДИ указано, то */
    else 
      if (new$SourceExecDoc is not null) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$SourceExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$SourceExecInnerNumber := ExecInnerNumber$;
            
      END IF;
    END IF;
    /* теперь тоже самое для Dest */

    /* при простановке БО получателя или его изменении */
    if (new$DestPromise is not null) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$DestPromise and ps.InnerPromiseNum = new$DestBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$DestExecDoc := ExecID$;
        new$DestExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$DestExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$DestExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$DestExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано, а ДИ указано, то */
    else 
      if (new$DestExecDoc is not null) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$DestExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$DestExecInnerNumber := ExecInnerNumber$;
            
      END IF;
    END IF;
    if (new$SourceExecDoc is not null) then
      BEGIN
        /* выбираем причину отклонения заголовка */
        select Reject_Cls
        into CaptionRejectCls$       from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия для Source */
        select Accepted
        into EDAccepted$       from ExecutionDocumentsCaption
        where id = new$SourceExecDoc
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls$ is null and EDAccepted$ <> 1) then
        RaiseException('Ex_ExecDoc_Rejected');    
      END IF;
    END IF;
    if (new$DestExecDoc is not null) then
      BEGIN
        /* выбираем причину отклонения заголовка */
        select Reject_Cls
        into CaptionRejectCls$       from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия для Dest */
        select Accepted
        into EDAccepted$       from ExecutionDocumentsCaption
        where ID = new$DestExecDoc
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное ДИ */
      if (CaptionRejectCls$ is null and EDAccepted$ <> 1) then
        RaiseException('Ex_ExecDoc_Rejected');    
      END IF;  
    END IF;/* использование блока "Учет договоров"*/
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_FACIALFINDETAIL_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

  Update facialfincaption set
  DocChangeDate = new$UpdateDate,
  RVersion=-1
  where id=new$recordindex;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_FACIALFINDETAIL (
    ID,
    SOURCEFACIALACC_CLS,
    SOURCEKVR,
    SOURCEKESR,
    DESTFACIALACC_CLS,
    DESTKVR,
    DESTKESR,
    BUDGETREF,
    CREDIT,
    PAYSYMBOLCLS,
    MEMORDERNUM,
    NOTE,
    PROGINDEX,
    RECORDINDEX,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    SOURCEKVSR,
    SOURCEKCSR,
    SOURCEKFSR,
    SOURCESUBKESR,
    SOURCEFACT,
    SOURCEMEANSTYPE,
    SOURCEFINSOURCE,
    SOURCEFINTYPE,
    DESTKVSR,
    DESTKCSR,
    DESTKFSR,
    DESTSUBKESR,
    DESTFACT,
    DESTMEANSTYPE,
    DESTFINSOURCE,
    DESTFINTYPE,
    REQUESTSINDEX,
    SENDERID,
    SENDERRECORDID,
    PROMISE,
    SOURCEDOCTYPE,
    DESTDOCTYPE,
    SOURCEPROMISE,
    DESTPROMISE,
    RECORDINDEX2,
    SOURCEBUDGETPROMISE,
    DESTBUDGETPROMISE,
    SUBPROGINDEX,
    STIMATEID,
    RVERSION,
    SOURCEDIRECTIONCLS,
    DESTDIRECTIONCLS,
    SOURCEDOCBASE,
    DESTDOCBASE,
    SOURCEEXECDOC,
    DESTEXECDOC,
    BUHOPERATIONCLS,
    SOURCEIFS,
    DESTIFS,
    CLSTYPE,
    UNIONNOTIFYREF,
    ACCEPTDATE,
    SOURCEKD,
    DESTKD,
    SOURCEREGIONCLS,
    DESTREGIONCLS,
    DESTFUNDSSOURCE,
    SOURCEFUNDSSOURCE,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    SOURCETRANSFERTCLS,
    DESTTRANSFERTCLS,
    DESTCLSTYPE,
    SOURCEASSIGNMENTKIND,
    DESTASSIGNMENTKIND,
    SOURCEEXECINNERNUMBER,
    DESTEXECINNERNUMBER,
    SOURCESUBSIDYCLS,
    DESTSUBSIDYCLS,
    SOURCEFAORG_TYPE,
    DESTFAORG_TYPE,
    SOURCEBUDALLOCATIONCLS,
    SOURCEPAYPROMISECLS,
    DESTBUDALLOCATIONCLS,
    DESTPAYPROMISECLS,
    SOURCEINVESTOBJECT,
    DESTINVESTOBJECT,
    TRANSFERTORG_REF
  ) VALUES (
    new$ID,
    new$SOURCEFACIALACC_CLS,
    new$SOURCEKVR,
    new$SOURCEKESR,
    new$DESTFACIALACC_CLS,
    new$DESTKVR,
    new$DESTKESR,
    new$BUDGETREF,
    new$CREDIT,
    new$PAYSYMBOLCLS,
    new$MEMORDERNUM,
    new$NOTE,
    new$PROGINDEX,
    new$RECORDINDEX,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$SOURCEKVSR,
    new$SOURCEKCSR,
    new$SOURCEKFSR,
    new$SOURCESUBKESR,
    new$SOURCEFACT,
    new$SOURCEMEANSTYPE,
    new$SOURCEFINSOURCE,
    new$SOURCEFINTYPE,
    new$DESTKVSR,
    new$DESTKCSR,
    new$DESTKFSR,
    new$DESTSUBKESR,
    new$DESTFACT,
    new$DESTMEANSTYPE,
    new$DESTFINSOURCE,
    new$DESTFINTYPE,
    new$REQUESTSINDEX,
    new$SENDERID,
    new$SENDERRECORDID,
    new$PROMISE,
    new$SOURCEDOCTYPE,
    new$DESTDOCTYPE,
    new$SOURCEPROMISE,
    new$DESTPROMISE,
    new$RECORDINDEX2,
    new$SOURCEBUDGETPROMISE,
    new$DESTBUDGETPROMISE,
    new$SUBPROGINDEX,
    new$STIMATEID,
    new$RVERSION,
    new$SOURCEDIRECTIONCLS,
    new$DESTDIRECTIONCLS,
    new$SOURCEDOCBASE,
    new$DESTDOCBASE,
    new$SOURCEEXECDOC,
    new$DESTEXECDOC,
    new$BUHOPERATIONCLS,
    new$SOURCEIFS,
    new$DESTIFS,
    new$CLSTYPE,
    new$UNIONNOTIFYREF,
    new$ACCEPTDATE,
    new$SOURCEKD,
    new$DESTKD,
    new$SOURCEREGIONCLS,
    new$DESTREGIONCLS,
    new$DESTFUNDSSOURCE,
    new$SOURCEFUNDSSOURCE,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$SOURCETRANSFERTCLS,
    new$DESTTRANSFERTCLS,
    new$DESTCLSTYPE,
    new$SOURCEASSIGNMENTKIND,
    new$DESTASSIGNMENTKIND,
    new$SOURCEEXECINNERNUMBER,
    new$DESTEXECINNERNUMBER,
    new$SOURCESUBSIDYCLS,
    new$DESTSUBSIDYCLS,
    new$SOURCEFAORG_TYPE,
    new$DESTFAORG_TYPE,
    new$SOURCEBUDALLOCATIONCLS,
    new$SOURCEPAYPROMISECLS,
    new$DESTBUDALLOCATIONCLS,
    new$DESTPAYPROMISECLS,
    new$SOURCEINVESTOBJECT,
    new$DESTINVESTOBJECT,
    new$TRANSFERTORG_REF);

-- - - - - - - - - - - - -
-- AI_100 (TR_FACIALFINDETAIL_AI_100)
-- Create 14.05.2007
-- - - - - - - - - - - - -

  update FacialFinCaption set
    ClsType = new$ClsType,
    RVersion = -1
  where
    (id = new$RecordIndex)and(ClsType <> new$ClsType);    

-- - - - - - - - - - - - -
-- AI_500 (TR_FACIALFINDETAIL_AI_500)
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID =22 ) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALFINDETAIL_IU
  INSTEAD OF UPDATE
  ON FACIALFINDETAIL
  FOR EACH ROW
DECLARE
  new$ID FACIALFINDETAIL.ID%TYPE := :NEW.ID;
  new$SOURCEFACIALACC_CLS FACIALFINDETAIL.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$SOURCEKVR FACIALFINDETAIL.SOURCEKVR%TYPE := :NEW.SOURCEKVR;
  new$SOURCEKESR FACIALFINDETAIL.SOURCEKESR%TYPE := :NEW.SOURCEKESR;
  new$DESTFACIALACC_CLS FACIALFINDETAIL.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$DESTKVR FACIALFINDETAIL.DESTKVR%TYPE := :NEW.DESTKVR;
  new$DESTKESR FACIALFINDETAIL.DESTKESR%TYPE := :NEW.DESTKESR;
  new$BUDGETREF FACIALFINDETAIL.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREDIT FACIALFINDETAIL.CREDIT%TYPE := :NEW.CREDIT;
  new$PAYSYMBOLCLS FACIALFINDETAIL.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$MEMORDERNUM FACIALFINDETAIL.MEMORDERNUM%TYPE := :NEW.MEMORDERNUM;
  new$NOTE FACIALFINDETAIL.NOTE%TYPE := :NEW.NOTE;
  new$PROGINDEX FACIALFINDETAIL.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX FACIALFINDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CREATERUSER FACIALFINDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$SOURCEKVSR FACIALFINDETAIL.SOURCEKVSR%TYPE := :NEW.SOURCEKVSR;
  new$SOURCEKCSR FACIALFINDETAIL.SOURCEKCSR%TYPE := :NEW.SOURCEKCSR;
  new$SOURCEKFSR FACIALFINDETAIL.SOURCEKFSR%TYPE := :NEW.SOURCEKFSR;
  new$SOURCESUBKESR FACIALFINDETAIL.SOURCESUBKESR%TYPE := :NEW.SOURCESUBKESR;
  new$SOURCEFACT FACIALFINDETAIL.SOURCEFACT%TYPE := :NEW.SOURCEFACT;
  new$SOURCEMEANSTYPE FACIALFINDETAIL.SOURCEMEANSTYPE%TYPE := :NEW.SOURCEMEANSTYPE;
  new$SOURCEFINSOURCE FACIALFINDETAIL.SOURCEFINSOURCE%TYPE := :NEW.SOURCEFINSOURCE;
  new$SOURCEFINTYPE FACIALFINDETAIL.SOURCEFINTYPE%TYPE := :NEW.SOURCEFINTYPE;
  new$DESTKVSR FACIALFINDETAIL.DESTKVSR%TYPE := :NEW.DESTKVSR;
  new$DESTKCSR FACIALFINDETAIL.DESTKCSR%TYPE := :NEW.DESTKCSR;
  new$DESTKFSR FACIALFINDETAIL.DESTKFSR%TYPE := :NEW.DESTKFSR;
  new$DESTSUBKESR FACIALFINDETAIL.DESTSUBKESR%TYPE := :NEW.DESTSUBKESR;
  new$DESTFACT FACIALFINDETAIL.DESTFACT%TYPE := :NEW.DESTFACT;
  new$DESTMEANSTYPE FACIALFINDETAIL.DESTMEANSTYPE%TYPE := :NEW.DESTMEANSTYPE;
  new$DESTFINSOURCE FACIALFINDETAIL.DESTFINSOURCE%TYPE := :NEW.DESTFINSOURCE;
  new$DESTFINTYPE FACIALFINDETAIL.DESTFINTYPE%TYPE := :NEW.DESTFINTYPE;
  new$REQUESTSINDEX FACIALFINDETAIL.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$SENDERID FACIALFINDETAIL.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINDETAIL.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$PROMISE FACIALFINDETAIL.PROMISE%TYPE := :NEW.PROMISE;
  new$SOURCEDOCTYPE FACIALFINDETAIL.SOURCEDOCTYPE%TYPE := :NEW.SOURCEDOCTYPE;
  new$DESTDOCTYPE FACIALFINDETAIL.DESTDOCTYPE%TYPE := :NEW.DESTDOCTYPE;
  new$SOURCEPROMISE FACIALFINDETAIL.SOURCEPROMISE%TYPE := :NEW.SOURCEPROMISE;
  new$DESTPROMISE FACIALFINDETAIL.DESTPROMISE%TYPE := :NEW.DESTPROMISE;
  new$RECORDINDEX2 FACIALFINDETAIL.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$SOURCEBUDGETPROMISE FACIALFINDETAIL.SOURCEBUDGETPROMISE%TYPE := :NEW.SOURCEBUDGETPROMISE;
  new$DESTBUDGETPROMISE FACIALFINDETAIL.DESTBUDGETPROMISE%TYPE := :NEW.DESTBUDGETPROMISE;
  new$SUBPROGINDEX FACIALFINDETAIL.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$STIMATEID FACIALFINDETAIL.STIMATEID%TYPE := :NEW.STIMATEID;
  new$RVERSION FACIALFINDETAIL.RVERSION%TYPE := :NEW.RVERSION;
  new$SOURCEDIRECTIONCLS FACIALFINDETAIL.SOURCEDIRECTIONCLS%TYPE := :NEW.SOURCEDIRECTIONCLS;
  new$DESTDIRECTIONCLS FACIALFINDETAIL.DESTDIRECTIONCLS%TYPE := :NEW.DESTDIRECTIONCLS;
  new$SOURCEDOCBASE FACIALFINDETAIL.SOURCEDOCBASE%TYPE := :NEW.SOURCEDOCBASE;
  new$DESTDOCBASE FACIALFINDETAIL.DESTDOCBASE%TYPE := :NEW.DESTDOCBASE;
  new$SOURCEEXECDOC FACIALFINDETAIL.SOURCEEXECDOC%TYPE := :NEW.SOURCEEXECDOC;
  new$DESTEXECDOC FACIALFINDETAIL.DESTEXECDOC%TYPE := :NEW.DESTEXECDOC;
  new$BUHOPERATIONCLS FACIALFINDETAIL.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$SOURCEIFS FACIALFINDETAIL.SOURCEIFS%TYPE := :NEW.SOURCEIFS;
  new$DESTIFS FACIALFINDETAIL.DESTIFS%TYPE := :NEW.DESTIFS;
  new$CLSTYPE FACIALFINDETAIL.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$UNIONNOTIFYREF FACIALFINDETAIL.UNIONNOTIFYREF%TYPE := :NEW.UNIONNOTIFYREF;
  new$ACCEPTDATE FACIALFINDETAIL.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SOURCEKD FACIALFINDETAIL.SOURCEKD%TYPE := :NEW.SOURCEKD;
  new$DESTKD FACIALFINDETAIL.DESTKD%TYPE := :NEW.DESTKD;
  new$SOURCEREGIONCLS FACIALFINDETAIL.SOURCEREGIONCLS%TYPE := :NEW.SOURCEREGIONCLS;
  new$DESTREGIONCLS FACIALFINDETAIL.DESTREGIONCLS%TYPE := :NEW.DESTREGIONCLS;
  new$DESTFUNDSSOURCE FACIALFINDETAIL.DESTFUNDSSOURCE%TYPE := :NEW.DESTFUNDSSOURCE;
  new$SOURCEFUNDSSOURCE FACIALFINDETAIL.SOURCEFUNDSSOURCE%TYPE := :NEW.SOURCEFUNDSSOURCE;
  new$ISBLOCKED FACIALFINDETAIL.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINDETAIL.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINDETAIL.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINDETAIL.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$SOURCETRANSFERTCLS FACIALFINDETAIL.SOURCETRANSFERTCLS%TYPE := :NEW.SOURCETRANSFERTCLS;
  new$DESTTRANSFERTCLS FACIALFINDETAIL.DESTTRANSFERTCLS%TYPE := :NEW.DESTTRANSFERTCLS;
  new$DESTCLSTYPE FACIALFINDETAIL.DESTCLSTYPE%TYPE := :NEW.DESTCLSTYPE;
  new$SOURCEASSIGNMENTKIND FACIALFINDETAIL.SOURCEASSIGNMENTKIND%TYPE := :NEW.SOURCEASSIGNMENTKIND;
  new$DESTASSIGNMENTKIND FACIALFINDETAIL.DESTASSIGNMENTKIND%TYPE := :NEW.DESTASSIGNMENTKIND;
  new$SOURCEEXECINNERNUMBER FACIALFINDETAIL.SOURCEEXECINNERNUMBER%TYPE := :NEW.SOURCEEXECINNERNUMBER;
  new$DESTEXECINNERNUMBER FACIALFINDETAIL.DESTEXECINNERNUMBER%TYPE := :NEW.DESTEXECINNERNUMBER;
  new$SOURCESUBSIDYCLS FACIALFINDETAIL.SOURCESUBSIDYCLS%TYPE := :NEW.SOURCESUBSIDYCLS;
  new$DESTSUBSIDYCLS FACIALFINDETAIL.DESTSUBSIDYCLS%TYPE := :NEW.DESTSUBSIDYCLS;
  new$SOURCEFAORG_TYPE FACIALFINDETAIL.SOURCEFAORG_TYPE%TYPE := :NEW.SOURCEFAORG_TYPE;
  new$DESTFAORG_TYPE FACIALFINDETAIL.DESTFAORG_TYPE%TYPE := :NEW.DESTFAORG_TYPE;
  new$SOURCEBUDALLOCATIONCLS FACIALFINDETAIL.SOURCEBUDALLOCATIONCLS%TYPE := :NEW.SOURCEBUDALLOCATIONCLS;
  new$SOURCEPAYPROMISECLS FACIALFINDETAIL.SOURCEPAYPROMISECLS%TYPE := :NEW.SOURCEPAYPROMISECLS;
  new$DESTBUDALLOCATIONCLS FACIALFINDETAIL.DESTBUDALLOCATIONCLS%TYPE := :NEW.DESTBUDALLOCATIONCLS;
  new$DESTPAYPROMISECLS FACIALFINDETAIL.DESTPAYPROMISECLS%TYPE := :NEW.DESTPAYPROMISECLS;
  new$SOURCEINVESTOBJECT FACIALFINDETAIL.SOURCEINVESTOBJECT%TYPE := :NEW.SOURCEINVESTOBJECT;
  new$DESTINVESTOBJECT FACIALFINDETAIL.DESTINVESTOBJECT%TYPE := :NEW.DESTINVESTOBJECT;
  new$TRANSFERTORG_REF FACIALFINDETAIL.TRANSFERTORG_REF%TYPE := :NEW.TRANSFERTORG_REF;
--
  CapAcceptDate$ NUMBER(10);
  BPInnerNum$ NUMBER(10);
  PromiseMode$ NUMBER(10);
  Promise_Count$ NUMBER(10);
  CaptionAcceptDate$ NUMBER;
  CaptionRejectCls$ NUMBER(10);
  PromiseAcceptDate$ NUMBER;
  PromiseAccepted$ NUMBER(10);
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  PromiseMode1$ NUMBER(10);
  ProgIndex$ NUMBER(10);
  ExecID$ NUMBER(10);
  ExecInnerNumber$ NUMBER(10);
  ExecRegType$ NUMBER(10);
  ExecAgrInnerNum$ NUMBER(10);
  AgrInnerNumber$ NUMBER(10);
  CaptionRejectCls1$ NUMBER(10);
  EDAccepted$ NUMBER(10);
  i_fintype$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_FACIALFINDETAIL_BU_0)
-- Last update 08.12.2005
-- - - - - - - - - - - - -

   IF (new$Credit IS NULL) THEN new$Credit := 0; END IF;

   /* проверка на изменение Бюджета */
   IF     (new$BudgetRef <> :OLD.BudgetRef)
      AND (NOT ((new$BudgetRef IS NULL) AND (:OLD.BudgetRef IS NULL))) THEN
      raiseException ('Ex_CantModufyBudget');
   END IF;

-- - - - - - - - - - - - -
-- BU_110 (TR_FACIALFINDETAIL_BU_110)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  /* Если тип финансирования не задан, то берем его из констант казначейства*/ 
  i_fintype$ := -1 ;
  IF (new$SourceFintype IS NULL) THEN 
    BEGIN
      SELECT constvalue INTO i_fintype$   FROM intconst
      WHERE (progindex=30) AND (constindex=10) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    new$SourceFintype := i_fintype$  ;
     
  END IF;
  IF (new$DestFintype IS NULL) THEN 
    IF (i_fintype$ = -1) THEN
      BEGIN
        SELECT constvalue INTO i_fintype$   FROM intconst
        WHERE (progindex=30) AND (constindex=10) ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
    END IF;
    new$DestFintype := i_fintype$  ;
     
  END IF;
  IF (new$SourceFacialAcc_CLS IS NULL) THEN 
    new$SourceFacialAcc_CLS := 0;
  END IF;
  /* Бюджетная классификация */
  IF (new$SourceKVR IS NULL) THEN 
    new$SourceKVR := 0;
  END IF;
  IF (new$SourceKESR IS NULL) THEN 
    new$SourceKESR := 0;
  END IF;
  IF (new$SourceKVSR IS NULL) THEN 
    new$SourceKVSR := 0;
  END IF;
  IF (new$SourceKFSR IS NULL) THEN 
    new$SourceKFSR := 0;
  END IF;
  IF (new$SourceKCSR IS NULL) THEN 
    new$SourceKCSR := 0;
  END IF;
  IF (new$SourceSubKESR IS NULL) THEN 
    new$SourceSubKESR := 0;
  END IF;
  IF (new$SourceDirectionCls IS NULL) THEN 
    new$SourceDirectionCls := 0;
  END IF;
  IF (new$SourceFact IS NULL) THEN 
    new$SourceFact := 0;
  END IF;
  IF (new$SourceMeansType IS NULL) THEN 
    new$SourceMeansType := 0;
  END IF;
  IF (new$SourceFinSource IS NULL) THEN 
    new$SourceFinSource := 0;
  END IF;
  IF (new$SourceFinType IS NULL) THEN 
    new$SourceFinType := 0;
  END IF;
  IF (new$SourceDocType IS NULL) THEN 
    new$SourceDocType := 0;
  END IF;
  IF (new$Sourceifs IS NULL) THEN 
    new$Sourceifs := 0;
  END IF;
  IF (new$SourceKD IS NULL) THEN 
    new$SourceKD := 0;
  END IF;
  IF (new$SourceFundsSource IS NULL) THEN 
    new$SourceFundsSource := 0;
  END IF;
  IF (new$SourceAssignmentKind IS NULL) THEN 
    new$SourceAssignmentKind := 0;
  END IF;
  IF (new$SourceRegionCLS IS NULL) THEN 
    new$SourceRegionCLS := 0;
  END IF;
  IF (new$DestFacialAcc_CLS IS NULL) THEN 
    new$DestFacialAcc_CLS := 0;
  END IF;
  /* Бюджетная классификация */
  IF (new$DestKVR IS NULL) THEN 
    new$DestKVR := 0;
  END IF;
  IF (new$DestKESR IS NULL) THEN 
    new$DestKESR := 0;
  END IF;
  IF (new$DestKVSR IS NULL) THEN 
    new$DestKVSR := 0;
  END IF;
  IF (new$DestKFSR IS NULL) THEN 
    new$DestKFSR := 0;
  END IF;
  IF (new$DestKCSR IS NULL) THEN 
    new$DestKCSR := 0;
  END IF;
  IF (new$DestSubKESR IS NULL) THEN 
    new$DestSubKESR := 0;
  END IF;
  IF (new$DestDirectionCls IS NULL) THEN 
    new$DestDirectionCls := 0;
  END IF;
  IF (new$DestFact IS NULL) THEN 
    new$DestFact := 0;
  END IF;
  IF (new$DestMeansType IS NULL) THEN 
    new$DestMeansType := 0;
  END IF;
  IF (new$DestFinSource IS NULL) THEN 
    new$DestFinSource := 0;
  END IF;
  IF (new$DestFinType IS NULL) THEN 
    new$DestFinType := 0;
  END IF;
  IF (new$DestDocType IS NULL) THEN 
    new$DestDocType := 0;
  END IF;
  IF (new$Destifs IS NULL) THEN 
    new$Destifs := 0;
  END IF;
  IF (new$DestKD IS NULL) THEN 
    new$DestKD := 0;
  END IF;
  IF (new$DestFundsSource IS NULL) THEN 
    new$DestFundsSource := 0;
  END IF;
  IF (new$DestAssignmentKind IS NULL) THEN 
    new$DestAssignmentKind := 0;
  END IF;
  IF (new$DestRegionCLS IS NULL) THEN 
    new$DestRegionCLS := 0;
  END IF;
  /* для Распределения ОФ: классификация плательщика не должна быть нулевой */
  if (new$progindex=76) then
    new$SourceKVR := new$DestKVR;
    new$SourceKESR := new$DestKESR;
    new$SourceKVSR := new$DestKVSR;
    new$SourceKFSR := new$DestKFSR;
    new$SourceKCSR := new$DestKCSR;
    new$SourceSubKESR := new$DestSubKESR;
    new$SourceDirectionCls := new$DestDirectionCls;
    new$SourceFact := new$DestFact;
    new$SourceMeansType := new$DestMeansType;
    new$SourceFinSource := new$DestFinSource;
    new$SourceFinType := new$DestFinType;
    new$SourceDocType := new$DestDocType;
    new$SourceIFS := new$DestIFS;
    new$SourceKD := new$DestKD;
    new$SourceRegionCls := new$DestRegionCls;
    new$SourceDocBase := new$DestDocBase;
    new$SourceAssignmentKind := new$DestAssignmentKind;
     
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  /* новые поля изменились */
  IF ((new$SourcePromise IS NOT NULL) AND (:old.SourcePromise IS NOT NULL)
  AND (new$SourcePromise <> :old.SourcePromise)
  OR ((new$SourcePromise IS NULL) AND (:old.SourcePromise IS NOT NULL))
  OR ((new$SourcePromise IS NOT NULL) AND (:old.SourcePromise IS NULL))
  OR (new$DestPromise IS NOT NULL) AND (:old.DestPromise IS NOT NULL)
  AND (new$DestPromise <> :old.DestPromise)
  OR ((new$DestPromise IS NULL) AND (:old.DestPromise IS NOT NULL))
  OR ((new$DestPromise IS NOT NULL) AND (:old.DestPromise IS NULL))) THEN
    IF (new$progindex IN (63, 64, 73)) THEN
      new$Promise := new$SourcePromise;
         
    ELSE 
      IF (new$progindex IN (61, 62, 65, 75)) THEN
        new$Promise := new$DestPromise;
           
      ELSE 
        IF ((new$progindex in (66, 67, 76))AND((new$SourcePromise=new$DestPromise)OR
        ((new$SourcePromise IS NULL)AND(new$DestPromise IS NULL)))) THEN
          new$Promise := new$DestPromise;
        END IF;
      END IF; 
    END IF;/* если старое поле изменилось */
  ELSE
    IF ((new$Promise IS NOT NULL) AND (:old.Promise IS NOT NULL)
    AND (new$Promise <> :old.Promise)
    OR ((new$Promise IS NULL) AND (:old.Promise IS NOT NULL))
    OR ((new$Promise IS NOT NULL) AND (:old.Promise IS NULL))) THEN
      IF (new$progindex IN (63, 64, 73)) THEN
        new$SourcePromise := new$Promise;
           
      ELSE 
        IF (new$progindex IN (61, 62, 65, 75)) THEN
          new$DestPromise := new$Promise;
             
        ELSE 
          IF (new$progindex in (66, 67, 76)) THEN
            new$SourcePromise := new$Promise;
            new$DestPromise := new$Promise;
               
          END IF;
        END IF; 
      END IF;
    END IF;
  END IF;
  /* заполняем вид ораганиазации владельца л\с плательшика и получателя*/
  IF ( (new$SourceFacialACC_Cls <> :old.SourceFacialAcc_Cls) OR (new$SourceFAOrg_Type is null) OR
  ((new$AcceptDate is not null) AND ((:old.AcceptDate is null) OR (new$AcceptDate <> :old.AcceptDate))) ) THEN
    BEGIN
      SELECT org.Org_Type    INTO new$SourceFAOrg_Type FROM Organizations org
      INNER JOIN FacialACC_Cls fac ON (org.ID = fac.Org_Ref)
      WHERE (fac.ID = new$SourceFacialAcc_Cls)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  IF ( (new$DestFacialACC_Cls <> :old.DestFacialAcc_Cls) OR (new$DestFAOrg_Type is null) OR
  ((new$AcceptDate is not null) AND ((:old.AcceptDate is null) OR (new$AcceptDate <> :old.AcceptDate))) ) THEN
    BEGIN
      SELECT org.Org_Type    INTO new$DestFAOrg_Type FROM Organizations org
      INNER JOIN FacialACC_Cls fac ON (org.ID = fac.Org_Ref)
      WHERE (fac.ID = new$DestFacialAcc_Cls)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_FACIALFINDETAIL_BU_120)
-- Create 28.04.2005
-- Last update 12.01.2009
-- - - - - - - - - - - - -

    /*  60 :  'Приход средств от фин.органа'; source
        61 :  'Приход средств от прочих и восстановление расходов'; dest
        62 :  'Приход средств по объявлениям';dest
        63 :  'Уход средств по платежным поручениям'; source
        64 :  'Уход средств по чекам'; source
        65 :  'Переброска средств, Разассигновка';dest
        66 :  'Внутренняя переброска средств, один - многим'; source dest
        67 :  'Уход средств в районы';source
        68 :  'Перечисление на р\с районов';dest
        69 :  'Подтверждение перечисления на р\с районов'; dest
        70 :  'Возврат с р\с районов';source
        71 :  'Подтверждение возврата с р\с районов'; dest */

  /*ClsType*/
  if ((new$ClsType is NULL) and 
        ( 
          ((new$SourceIFS <> 0) and (new$ProgIndex in (63,64,66,67,68,70))) or
          (new$ProgIndex = 60)
        )) then
    new$ClsType := 1; /* если это источник и забыли ввести ClsType */
  elsif ((new$ClsType is NULL) and (new$SourceKD <> 0) and
        (new$ProgIndex in (63,64,66,67,68,70))) then
    new$ClsType := 2; /* если это код дохода и забыли ввести ClsType */
  elsif (new$ClsType is null) then
    new$ClsType := 0; /* иначе - расходная */
  end if;  

  IF ((new$ClsType = 0) AND 
      (((new$SourceIFS <> 0) or (new$SourceKD <> 0)) and
      (new$ProgIndex in (63,64,66,67,68,70)))
     ) THEN /* классификация расходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  IF ((new$ClsType = 1) AND (
    (new$SourceKVSR <> 0) OR (new$SourceKFSR <> 0) OR
    (new$SourceKCSR <> 0) OR (new$SourceKVR <> 0) OR
    (new$SourceKESR <> 0) OR
    ((new$SourceKD <> 0) and (new$ProgIndex in (63,64,66,67,68,70)))
    )) THEN /* классификация источниковая */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  IF ((new$ClsType = 2) AND (
    (new$SourceKVSR <> 0) OR (new$SourceKFSR <> 0) OR
    (new$SourceKCSR <> 0) OR (new$SourceKVR <> 0) OR
    (new$SourceKESR <> 0) OR
    ((new$SourceIFS <> 0) and (new$ProgIndex in (63,64,66,67,68,70)))
    )) THEN /* классификация доходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  /*DestClsType*/
  if (((new$ProgIndex <> 67)and(new$ClsType <> :old.ClsType))or(new$DestClsType is null)) then
    new$DestClsType := new$ClsType;
  end if;  

  IF ((new$DestClsType = 0) AND
      (((new$DestIFS <> 0) or (new$DestKD <> 0)) and
      (new$ProgIndex in (61,62,65,69,71)))
     ) THEN /* классификация расходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  IF ((new$DestClsType = 1) AND (
    (new$DestKVSR <> 0) OR (new$DestKFSR <> 0) OR
    (new$DestKCSR <> 0) OR (new$DestKVR <> 0) OR
    (new$DestKESR <> 0) or
    ((new$DestKD <> 0) and (new$ProgIndex in (61,62,65,69,71)))
    )) THEN /* классификация источниковая */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  IF ((new$DestClsType = 2) AND (
    (new$DestKVSR <> 0) OR (new$DestKFSR <> 0) OR
    (new$DestKCSR <> 0) OR (new$DestKVR <> 0) OR
    (new$DestKESR <> 0) or
    ((new$DestIFS <> 0) and (new$ProgIndex in (61,62,65,69,71)))
    )) THEN /* классификация доходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_FACIALFINDETAIL_BU_200)
-- Version 7.00.02.2
-- - - - - - - - - - - - -

  /* проставляем номера бюджетных обязательств по Учету договоров*/
  GetIntConst(30, 15,PromiseMode$);
  /* ПРОВЕРКА ДЛЯ БЛОКА БО */
  if (PromiseMode$ <> 1) then
    /* Проверка сущствует ли такой номер БО на который ссылается платежка*/
    if ((new$SourcePromise is not null) and (:old.SourcePromise <> new$SourcePromise )) then
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count$          from
      promise_detail pr
      where
      (pr.registrnumber = new$SOURCEPROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count$ = 0) then
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    /* Проверка сущствует ли такой номер БО на который ссылается платежка*/
    if ((new$DestPromise is not null) and (:old.DestPromise <> new$DestPromise )) then
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count$          from
      promise_detail pr
      where
      (pr.registrnumber = new$DestPromise)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count$ = 0) then
        RaiseException('EX_BP_NotExist');      
      END IF;
        
    END IF;/* end проверки PromiseMode <> 1*/
  END IF;
  /* ПРОВЕРКА ДЛЯ БЛОКА УД */
  if (PromiseMode$ = 1) then
    /* source подтяжка внутр. номера по номеру БО*/
    if ((new$SourcePromise is not null)and((:old.SourcePromise is null)or(:old.SourcePromise <> new$SourcePromise )) and 
    (new$SourceBudgetPromise is null) and (:old.SourceBudgetPromise is null)) then
      select max(InnerPromiseNum) 
      into BPInnerNum$           from PaymentSchedule 
      where (ANumber = new$SourcePromise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum$ <> 0) then
        new$SourceBudgetPromise := BPInnerNum$;
                
      else
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    /* dest подтяжка внутр. номера по номеру БО */
    if ((new$DestPromise is not null)and((:old.DestPromise is null)or(new$DestPromise <> :old.DestPromise)) and
    (new$DestBudgetPromise is null) and (:old.DestBudgetPromise is null)) then
      select max(InnerPromiseNum) 
      into BPInnerNum$           from PaymentSchedule
      where (ANumber = new$DestPromise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum$ <> 0) then
        new$DestBudgetPromise := BPInnerNum$;
                
      else
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
          
    /* Если изменился новый номер и при этом старый NULL, тогда устанавливаем старый */
    /* source */
    if (new$SourcePromise is null and ((new$SourceBudgetPromise is not null and :old.SourceBudgetPromise is null) or 
    (new$SourceBudgetPromise <> :old.SourceBudgetPromise))) then
      BEGIN
        select ANumber 
        into BPInnerNum$           from PaymentSchedule
        where (InnerPromiseNum = new$SourceBudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      new$SourcePromise := BPInnerNum$;
      new$Promise := BPInnerNum$;
            
    END IF;
    /* dest */
    if (new$DestPromise is null and ((new$DestBudgetPromise is not null and :old.DestBudgetPromise is null) or 
    (new$DestBudgetPromise <> :old.DestBudgetPromise))) then
      BEGIN
        select ANumber 
        into BPInnerNum$           from PaymentSchedule
        where (InnerPromiseNum = new$DestBudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      new$DestPromise := BPInnerNum$;
      new$Promise := BPInnerNum$;
            
    END IF;
    /* Если удалили новый номер, то нужно удалить и старый*/
    if ((new$SourceBudgetPromise is null) and (:old.SourceBudgetPromise is not null)) then
      new$SourcePromise := null;
      new$Promise := null;
            
    END IF;
    if ((new$DestBudgetPromise is null) and (:old.DestBudgetPromise is not null)) then
      new$DestPromise := null;
      new$Promise := null;
            
    END IF;
    if (new$SourceBudgetPromise is not null and new$SourcePromise is not null) then
      SELECT COUNT(ANumber
      ) INTO CNT$1
      from PaymentSchedule
      where (ANumber = new$SourcePromise and InnerPromiseNum = new$SourceBudgetPromise) AND (ROWNUM = 1);
      if (not (CNT$1<> 0)) then
        RaiseException('Ex_BP_NotExist');
      END IF;
      BEGIN

        /* выбираем дату принятия и причину отклонения заголовка */
        select AcceptDate, Reject_Cls         into CaptionAcceptDate$, CaptionRejectCls$ from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия БО для Source */
        select AcceptDate, Accepted         into PromiseAcceptDate$, PromiseAccepted$ from PaymentSchedule
        where ANumber = new$SourcePromise and InnerPromiseNum = new$SourceBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls$ is null and PromiseAccepted$ <> 1) then
        RaiseException('Ex_BP_Rejected');
      END IF;
      /* если принятый документ ссылается на не принятое БО */
      if (CaptionAcceptDate$ is not null and (PromiseAcceptDate$ is null or PromiseAccepted$ <> 1)) then
        RaiseException('Ex_BP_NotAccepted');      
      END IF;
    END IF;
    if (new$DestBudgetPromise is not null and new$DestPromise is not null) then
      SELECT COUNT(ANumber
      ) INTO CNT$2
      from PaymentSchedule
      where (ANumber = new$DestPromise and InnerPromiseNum = new$DestBudgetPromise) AND (ROWNUM = 1);
      if (not (CNT$2<> 0)) then
        RaiseException('Ex_BP_NotExist');
      END IF;
      BEGIN

        /* выбираем дату принятия и причину отклонения заголовка */
        select AcceptDate, Reject_Cls         into CaptionAcceptDate$, CaptionRejectCls$ from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия БО для Dest */
        select AcceptDate, Accepted         into PromiseAcceptDate$, PromiseAccepted$ from PaymentSchedule
        where ANumber = new$DestPromise and InnerPromiseNum = new$DestBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls$ is null and PromiseAccepted$ <> 1) then
        RaiseException('Ex_BP_Rejected');
      END IF;
      /* если принятый документ ссылается на не принятое БО */
      if (CaptionAcceptDate$ is not null and (PromiseAcceptDate$ is null or PromiseAccepted$ <> 1)) then
        RaiseException('Ex_BP_NotAccepted');      
      END IF;    
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_210 (TR_FACIALFINDETAIL_BU_210)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* используем болк учета договоров?*/
  GetIntConst(30, 15,PromiseMode1$);
  if (PromiseMode1$ = 1) then
    /* при изменении БО плательщика или изменили ДИ */
    if (new$SourcePromise is not null and (
    (:old.SourcePromise is null or :old.SourcePromise <> new$SourcePromise) or
    (:old.SourceExecDoc is null or new$SourceExecDoc is null or :old.SourceExecDoc <> new$SourceExecDoc)
    )) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$SourcePromise and ps.InnerPromiseNum = new$SourceBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$SourceExecDoc := ExecID$;
        new$SourceExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$SourceExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$SourceExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$SourceExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано или не изменилось, а ДИ поменяли, то */
    else 
      if (new$SourceExecDoc is null or :old.SourceExecDoc is null or new$SourceExecDoc <> :old.SourceExecDoc) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$SourceExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$SourceExecInnerNumber := ExecInnerNumber$;
            
      END IF;
    END IF;
    /* теперь тоже самое для Dest */

    /* при изменении БО плательщика или изменили ДИ */
    if (new$DestPromise is not null and (
    (:old.DestPromise is null or :old.DestPromise <> new$DestPromise) or
    (:old.DestExecDoc is null or new$DestExecDoc is null or :old.DestExecDoc <> new$DestExecDoc)
    )) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$DestPromise and ps.InnerPromiseNum = new$DestBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$DestExecDoc := ExecID$;
        new$DestExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$DestExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$DestExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$DestExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано или не изменилось, а ДИ поменяли, то */
    else 
      if (new$DestExecDoc is null or :old.DestExecDoc is null or new$DestExecDoc <> :old.DestExecDoc) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$DestExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$DestExecInnerNumber := ExecInnerNumber$;
            
      END IF;
    END IF;
    if (new$SourceExecDoc is not null) then
      BEGIN
        /* выбираем причину отклонения заголовка */
        select Reject_Cls
        into CaptionRejectCls1$       from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия для Source */
        select Accepted
        into EDAccepted$       from ExecutionDocumentsCaption
        where id = new$SourceExecDoc
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное ДИ */
      if (CaptionRejectCls1$ is null and EDAccepted$ <> 1) then
        RaiseException('Ex_ExecDoc_Rejected');    
      END IF;
    END IF;
    if (new$DestExecDoc is not null) then
      BEGIN
        /* выбираем причину отклонения заголовка */
        select Reject_Cls
        into CaptionRejectCls1$       from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия для Dest */
        select Accepted
        into EDAccepted$       from ExecutionDocumentsCaption
        where ID = new$DestExecDoc
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное ДИ */
      if (CaptionRejectCls1$ is null and EDAccepted$ <> 1) then
        RaiseException('Ex_ExecDoc_Rejected');    
      END IF;  
    END IF;/* использование блока "Учет договоров"*/
  END IF;

-- - - - - - - - - - - - -
-- BU_300 (TR_FACIALFINDETAIL_BU_300)
-- Create 20.02.2006
-- - - - - - - - - - - - -

  /* дата принятия детали должна совпадать с датой принятия заголовка (если она есть) */
  if ((:old.AcceptDate <> new$AcceptDate)or((:old.AcceptDate is not null)and(new$AcceptDate is null))) then
    BEGIN
      select c.AcceptDate into CapAcceptDate$
      from facialfincaption c
      where c.id = new$RecordIndex;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
        CapAcceptDate$ := NULL;
    END;

    if ((new$AcceptDate = CapAcceptDate$) or (CapAcceptDate$ is null)) then
      new$AcceptDate := new$AcceptDate;
    else
      RaiseException('ex_wrongacceptdate');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_FACIALFINDETAIL_BU_700)
-- Create 17.09.2004
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_FACIALFINDETAIL SET
    ID = new$ID,
    SOURCEFACIALACC_CLS = new$SOURCEFACIALACC_CLS,
    SOURCEKVR = new$SOURCEKVR,
    SOURCEKESR = new$SOURCEKESR,
    DESTFACIALACC_CLS = new$DESTFACIALACC_CLS,
    DESTKVR = new$DESTKVR,
    DESTKESR = new$DESTKESR,
    BUDGETREF = new$BUDGETREF,
    CREDIT = new$CREDIT,
    PAYSYMBOLCLS = new$PAYSYMBOLCLS,
    MEMORDERNUM = new$MEMORDERNUM,
    NOTE = new$NOTE,
    PROGINDEX = new$PROGINDEX,
    RECORDINDEX = new$RECORDINDEX,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    SOURCEKVSR = new$SOURCEKVSR,
    SOURCEKCSR = new$SOURCEKCSR,
    SOURCEKFSR = new$SOURCEKFSR,
    SOURCESUBKESR = new$SOURCESUBKESR,
    SOURCEFACT = new$SOURCEFACT,
    SOURCEMEANSTYPE = new$SOURCEMEANSTYPE,
    SOURCEFINSOURCE = new$SOURCEFINSOURCE,
    SOURCEFINTYPE = new$SOURCEFINTYPE,
    DESTKVSR = new$DESTKVSR,
    DESTKCSR = new$DESTKCSR,
    DESTKFSR = new$DESTKFSR,
    DESTSUBKESR = new$DESTSUBKESR,
    DESTFACT = new$DESTFACT,
    DESTMEANSTYPE = new$DESTMEANSTYPE,
    DESTFINSOURCE = new$DESTFINSOURCE,
    DESTFINTYPE = new$DESTFINTYPE,
    REQUESTSINDEX = new$REQUESTSINDEX,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    PROMISE = new$PROMISE,
    SOURCEDOCTYPE = new$SOURCEDOCTYPE,
    DESTDOCTYPE = new$DESTDOCTYPE,
    SOURCEPROMISE = new$SOURCEPROMISE,
    DESTPROMISE = new$DESTPROMISE,
    RECORDINDEX2 = new$RECORDINDEX2,
    SOURCEBUDGETPROMISE = new$SOURCEBUDGETPROMISE,
    DESTBUDGETPROMISE = new$DESTBUDGETPROMISE,
    SUBPROGINDEX = new$SUBPROGINDEX,
    STIMATEID = new$STIMATEID,
    RVERSION = new$RVERSION,
    SOURCEDIRECTIONCLS = new$SOURCEDIRECTIONCLS,
    DESTDIRECTIONCLS = new$DESTDIRECTIONCLS,
    SOURCEDOCBASE = new$SOURCEDOCBASE,
    DESTDOCBASE = new$DESTDOCBASE,
    SOURCEEXECDOC = new$SOURCEEXECDOC,
    DESTEXECDOC = new$DESTEXECDOC,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    SOURCEIFS = new$SOURCEIFS,
    DESTIFS = new$DESTIFS,
    CLSTYPE = new$CLSTYPE,
    UNIONNOTIFYREF = new$UNIONNOTIFYREF,
    ACCEPTDATE = new$ACCEPTDATE,
    SOURCEKD = new$SOURCEKD,
    DESTKD = new$DESTKD,
    SOURCEREGIONCLS = new$SOURCEREGIONCLS,
    DESTREGIONCLS = new$DESTREGIONCLS,
    DESTFUNDSSOURCE = new$DESTFUNDSSOURCE,
    SOURCEFUNDSSOURCE = new$SOURCEFUNDSSOURCE,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    SOURCETRANSFERTCLS = new$SOURCETRANSFERTCLS,
    DESTTRANSFERTCLS = new$DESTTRANSFERTCLS,
    DESTCLSTYPE = new$DESTCLSTYPE,
    SOURCEASSIGNMENTKIND = new$SOURCEASSIGNMENTKIND,
    DESTASSIGNMENTKIND = new$DESTASSIGNMENTKIND,
    SOURCEEXECINNERNUMBER = new$SOURCEEXECINNERNUMBER,
    DESTEXECINNERNUMBER = new$DESTEXECINNERNUMBER,
    SOURCESUBSIDYCLS = new$SOURCESUBSIDYCLS,
    DESTSUBSIDYCLS = new$DESTSUBSIDYCLS,
    SOURCEFAORG_TYPE = new$SOURCEFAORG_TYPE,
    DESTFAORG_TYPE = new$DESTFAORG_TYPE,
    SOURCEBUDALLOCATIONCLS = new$SOURCEBUDALLOCATIONCLS,
    SOURCEPAYPROMISECLS = new$SOURCEPAYPROMISECLS,
    DESTBUDALLOCATIONCLS = new$DESTBUDALLOCATIONCLS,
    DESTPAYPROMISECLS = new$DESTPAYPROMISECLS,
    SOURCEINVESTOBJECT = new$SOURCEINVESTOBJECT,
    DESTINVESTOBJECT = new$DESTINVESTOBJECT,
    TRANSFERTORG_REF = new$TRANSFERTORG_REF
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_100 (TR_FACIALFINDETAIL_AU_100)
-- Create 14.05.2007
-- - - - - - - - - - - - -

  if (new$ClsType <> :old.ClsType) then
    update FacialFinCaption set
      ClsType = new$ClsType,
      RVersion = -1
    where
      (id = new$RecordIndex)and(ClsType <> new$ClsType);
  end if;    

-- - - - - - - - - - - - -
-- AU_500 (TR_FACIALFINDETAIL_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (22, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=22) and (RecordId=new$ID);
  end if;

END;
/
commit work 
/
ALTER TABLE TB_FacialFinDetail ADD (
  CONSTRAINT FK_FACFINDET_TRANSFORG_REF FOREIGN KEY (TransfertOrg_Ref) REFERENCES TB_organizations (ID)
)
/
CREATE INDEX FK_FACFINDET_TRANSFORG_REF ON TB_FacialFinDetail(TransfertOrg_Ref)
/
commit work 
/

-- #########################################################
-- #########################################################
-- Alter_All_ExtId.sql
-- #########################################################
-- #########################################################

/* Добавляет поля ExtID, ExtOwner, ExtSyncDate в ряд справочников для синхронизации с внешними системами */
ALTER TABLE TB_organizations ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/

CREATE OR REPLACE VIEW organizations (
  ID,
  NAME,
  GOSNI,
  CITY,
  COUNTRY,
  PHONE,
  ADDRESS,
  ORG_CLS,
  INN20,
  SUBINN,
  FACIALACC,
  REGIONCLS,
  DIRNAME,
  BUGNAME,
  DIRPHONE,
  BUGPHONE,
  RCORG,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  INN,
  OKATO,
  EMAIL,
  WEBSITE,
  UFKCODE,
  ADDOKATO,
  SHORTNAME,
  RVERSION,
  SENDERID,
  KVSR,
  OKFS,
  OKOPF,
  OPENDATE,
  CLOSEDATE,
  CHANGEDATE,
  GENERALORG_REF,
  FEDERALREGIONCODE,
  ORG_TYPE,
  BUDGETREF,
  SUPPLIERSTATUS,
  COUNTRYCODE,
  DATECLOSE,
  ORGCODE,
  COSTAUTHORITY,
  INCOMEAUTHORITY,
  DEBTAUTHORITY,
  SVRAUTHORITY,
  CLIENTID,
  DATEOPEN,
  FUID,
  OKPO,
  OKTMO,
  DOCSTATEREF,
  CRYPTOSTATUS,
  OGRN,
  REJECT_CLS,
  REJECTCAUSE,
  EXTID,
  EXTOWNER,
  EXTSYNCDATE)
AS
  SELECT
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS,
    OGRN,
    REJECT_CLS,
    REJECTCAUSE,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE
  FROM TB_organizations
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_ID
  INSTEAD OF DELETE
  ON ORGANIZATIONS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_ORGANIZATIONS_BD)
-- Last update 09.06.2008
-- - - - - - - - - - - - -

  if (:old.ID = 0) then
    RaiseException('ex_CantDelUnknownOrg');
  end if;

  delete from Org_Accounts where org_ref = :old.id;
  delete from Banks where id = :old.id;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_ORGANIZATIONS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_200 (TR_ORGANIZATIONS_AD_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

update Organizations set
    GeneralOrg_Ref = id
  where
    GeneralOrg_Ref = :old.id;

-- - - - - - - - - - - - -
-- AD_210 (TR_ORGANIZATIONS_AD_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Удаление истории изменений состоний для удаленного документа*/
  delete 
  from 
  StateJumpHistory
  where 
  DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_500 (TR_ORGANIZATIONS_AD_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(27, :old.ID ,SYSDATE);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_II
  INSTEAD OF INSERT
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$EXTID ORGANIZATIONS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORGANIZATIONS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORGANIZATIONS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
--
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_Organizations_bi)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$FUID is null) then 
    new$FUID := new$id;
  END IF;
  if (new$GOSNI is null) then 
    new$GOSNI := 0;
  END IF;
  if (new$Name is null) then 
    new$Name := 'Не указано наименование';
  END IF;
  if (new$City is null) then 
    GetVarcharConst(-1,7,new$City);
  END IF;
  if (new$COUNTRY is null) then 
    new$COUNTRY := 'Россия';
  END IF;
  if (new$CountryCode is null) then 
    new$CountryCode := 643;
  END IF;
  if (new$ORG_CLS is NULL) then 
    new$ORG_CLS:= 0;
  END IF;
  if (new$SubINN is null) then 
    new$SubINN:= 0;
  END IF;
  if (new$INN20 is null) then 
    new$INN20:= '';
  END IF;
  if (new$RCOrg is null) then 
    new$RCOrg := 0;
  END IF;
  if (new$RegionCls is null) then 
    new$RegionCls := 0;
  END IF;
  if (new$OKATO is null) then 
    new$OKATO := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$OKFS is null) then 
    new$OKFS := 0;
  END IF;
  if (new$OKOPF is null) then 
    new$OKOPF := 0;
  END IF;
  if (new$FederalRegionCode is null) then
    GetIntConst(-1, 27,new$FederalRegionCode);
  END IF;
  if (new$FederalRegionCode is null) then
    new$FederalRegionCode := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;
  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$INN > 9999999999.9) and (new$INN20 <> '') and (new$INN20 is not null)) then
    RaiseException('EX_WRONGKPP');
  END IF;
  check_unique_organization(new$inn,  new$inn20);
  if (new$CostAuthority is null) then 
    new$CostAuthority:= 0;
  END IF;
  if (new$IncomeAuthority is null) then 
    new$IncomeAuthority := 0;
  END IF;
  if (new$DebtAuthority is null) then 
    new$DebtAuthority := 0;
  END IF;
  if (new$SVRAuthority is null) then 
    new$SVRAuthority := 0;
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if (new$Org_Type is not null)
  then 
    if (new$Org_Type between 10100 and 10299) then
      new$CostAuthority:= 1;
    END IF;
    if (new$Org_Type between 10300 and 10399) then
      new$CostAuthority:= 2;
    END IF;
    if (new$Org_Type between 10400 and 10499) then
      new$CostAuthority:= 4;
    END IF;
    if (((new$Org_Type between 10500 and 10599) and (new$CostAuthority<>16)) or
    (((new$Org_Type between 10000 and 10099) or (new$Org_Type between 10600 and 10799))
    and (new$CostAuthority=0))) then
      new$CostAuthority:= 8;
        
    END IF;
  else 
    new$Org_Type := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_ORGANIZATIONS_BI_10)
-- Last update 19.10.2006
-- - - - - - - - - - - - -

  if (new$FacialAcc is not null) then
    select count(id) into cnt$ from Organizations where (FacialAcc = new$FacialAcc) AND (ROWNUM = 1);
    if (cnt$ <> 0) then RaiseException('ex_DublicateFacialAcc'); end if;
  end if;

-- - - - - - - - - - - - -
-- BI_200 (TR_ORGANIZATIONS_BI_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;

    /*  При вставке КВСР берем из распорядителя, если он уже не заполнен*/
    if (new$KVSR = 0) then
      select o.KVSR into new$KVSR
      from Organizations o
      where o.id = new$GeneralOrg_Ref;
    end if;
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORGANIZATIONS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORGANIZATIONS (
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS,
    OGRN,
    REJECT_CLS,
    REJECTCAUSE,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE
  ) VALUES (
    new$ID,
    new$NAME,
    new$GOSNI,
    new$CITY,
    new$COUNTRY,
    new$PHONE,
    new$ADDRESS,
    new$ORG_CLS,
    new$INN20,
    new$SUBINN,
    new$FACIALACC,
    new$REGIONCLS,
    new$DIRNAME,
    new$BUGNAME,
    new$DIRPHONE,
    new$BUGPHONE,
    new$RCORG,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$INN,
    new$OKATO,
    new$EMAIL,
    new$WEBSITE,
    new$UFKCODE,
    new$ADDOKATO,
    new$SHORTNAME,
    new$RVERSION,
    new$SENDERID,
    new$KVSR,
    new$OKFS,
    new$OKOPF,
    new$OPENDATE,
    new$CLOSEDATE,
    new$CHANGEDATE,
    new$GENERALORG_REF,
    new$FEDERALREGIONCODE,
    new$ORG_TYPE,
    new$BUDGETREF,
    new$SUPPLIERSTATUS,
    new$COUNTRYCODE,
    new$DATECLOSE,
    new$ORGCODE,
    new$COSTAUTHORITY,
    new$INCOMEAUTHORITY,
    new$DEBTAUTHORITY,
    new$SVRAUTHORITY,
    new$CLIENTID,
    new$DATEOPEN,
    new$FUID,
    new$OKPO,
    new$OKTMO,
    new$DOCSTATEREF,
    new$CRYPTOSTATUS,
    new$OGRN,
    new$REJECT_CLS,
    new$REJECTCAUSE,
    new$EXTID,
    new$EXTOWNER,
    new$EXTSYNCDATE);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORGANIZATIONS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 27) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_IU
  INSTEAD OF UPDATE
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$EXTID ORGANIZATIONS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORGANIZATIONS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORGANIZATIONS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
--
  CNT$ NUMBER(10);
  c$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_organizations_bu)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$gosni is null) then 
    new$gosni := 0;
  END IF;
  if (new$city is null) then 
    getvarcharconst(-1,7,new$city);
  END IF;
  if (new$country is null) then 
    new$country := 'Россия';
  END IF;
  if (new$countrycode is null) then 
    new$countrycode := 643;
  END IF;
  if (new$org_cls is null) then 
    new$org_cls:= 0;
  END IF;
  if (new$inn20 is null) then 
    new$inn20:= '';
  END IF;
  if (new$rcorg is null) then 
    new$rcorg := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$okato is null) then 
    new$okato := 0;
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$okfs is null) then 
    new$okfs := 0;
  END IF;
  if (new$okopf is null) then 
    new$okopf := 0;
  END IF;
  if (new$federalregioncode is null) then
    getintconst(-1, 27,new$federalregioncode);
  END IF;
  if (new$federalregioncode is null) then
    new$federalregioncode := 0;
  END IF;
  if (new$budgetref is null) then 
    new$budgetref := 0;
  END IF;
  if (new$org_type is null) then 
    new$org_type := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;

  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null))) then 
    if ((new$inn > 9999999999.9) and (new$inn20 <> '')) then
      RaiseException('ex_wrongkpp');  
    END IF;
  END IF;
  if ( ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null)))
  or ( (new$inn20 <> :old.inn20) or ((:old.inn20 is null) and (new$inn20 is not null))) )
  then
    check_unique_organization(new$inn,  new$inn20);
  END IF;
   
  if (new$regioncls <> :old.regioncls) then
    update dfaccountsbuhtable set
    regioncls = new$regioncls
    where id = any (select id from org_accounts where org_ref = new$id);
  END IF;
  /* Запрет изменений в неуказанной организации */
  if (:old.id = 0) then
    RaiseException('ex_cantmodifyunknownorg');
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if ((new$org_type<>:old.org_type) or (new$costauthority<>:old.costauthority))
  then 
    c$ := new$costauthority;
    if (new$org_type between 10100 and 10299) then
      new$costauthority:= 1;
    END IF;
    if (new$org_type between 10300 and 10399) then
      new$costauthority:= 2;
    END IF;
    if (new$org_type between 10400 and 10499) then
      new$costauthority:= 4;
    END IF;
    if (((new$org_type between 10500 and 10599) and (new$costauthority<>16)) or
    (((new$org_type between 10000 and 10099) or (new$org_type between 10600 and 10799))
    and (new$costauthority=0))) then
      new$costauthority:= 8;
    END IF;
    if ((new$org_type=:old.org_type) and (c$<>new$costauthority)) then
      RaiseException('ex_wrongcostauthority');  
    END IF;
  END IF;
  /* если изменилось значение RegionCls у организации, то меняем
      и у подведомственных лс*/
  if (new$regioncls <> :old.regioncls) then
    update facialacc_cls fac set
    fac.regioncls = new$regioncls
    where
    new$id = fac.org_ref;
      
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_ORGANIZATIONS_BU_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$FacialAcc <> :old.FacialAcc) then
    select count(id) into CNT$ from Organizations
      where (FacialAcc = new$FacialAcc) and (id <> new$id) AND (ROWNUM = 1);
    if (CNT$ <> 0) then
      RaiseException('ex_DublicateFacialAcc');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORGANIZATIONS_BU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- COMMENT сноска в детали даты закрытия


    /*  закрытие организации */
    if ((new$DateClose is not null) and (:old.DateClose is null)) then
      /*  закрываем счета флажком и указываем причину закрытия */
      update Org_Accounts set
        CloseCode = CloseCode + 10
      where Org_Ref = new$Id;
    end if;

    /*  Для л/с надо еще учитывать изменение даты */
    if (((new$DateClose is not null) and (:old.DateClose is null)) or (new$DateClose <> :old.DateClose)) then
      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode + 10
      where Org_ref = new$Id;
    end if;

    /*  открытие организации */
    if ((new$DateClose is null) and (:old.DateClose is not null)) then
      update Org_Accounts set
        CloseCode = CloseCode - 10
      where Org_Ref = new$Id;

      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode - 10
      where Org_ref = new$Id;
    end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_ORGANIZATIONS_BU_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;
  end if;

  if (new$GeneralOrg_Ref <> :old.GeneralOrg_Ref) then
    update FacialAcc_CLS set
      GeneralOrg_Ref = new$GeneralOrg_Ref
    where
      Org_Ref = new$id;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_ORGANIZATIONS_BU_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$DOCSTATEREF <> :old.DOCSTATEREF) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(new$id, :old.DOCSTATEREF, new$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORGANIZATIONS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  IF (new$RVersion IS NULL) THEN
    new$RVersion := 1;
  ELSIF ( (new$RVersion = -1) AND (:OLD.RVersion <> -1) ) THEN
    new$RVersion := :OLD.RVersion;
  ELSE
    new$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORGANIZATIONS SET
    ID = new$ID,
    NAME = new$NAME,
    GOSNI = new$GOSNI,
    CITY = new$CITY,
    COUNTRY = new$COUNTRY,
    PHONE = new$PHONE,
    ADDRESS = new$ADDRESS,
    ORG_CLS = new$ORG_CLS,
    INN20 = new$INN20,
    SUBINN = new$SUBINN,
    FACIALACC = new$FACIALACC,
    REGIONCLS = new$REGIONCLS,
    DIRNAME = new$DIRNAME,
    BUGNAME = new$BUGNAME,
    DIRPHONE = new$DIRPHONE,
    BUGPHONE = new$BUGPHONE,
    RCORG = new$RCORG,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    INN = new$INN,
    OKATO = new$OKATO,
    EMAIL = new$EMAIL,
    WEBSITE = new$WEBSITE,
    UFKCODE = new$UFKCODE,
    ADDOKATO = new$ADDOKATO,
    SHORTNAME = new$SHORTNAME,
    RVERSION = new$RVERSION,
    SENDERID = new$SENDERID,
    KVSR = new$KVSR,
    OKFS = new$OKFS,
    OKOPF = new$OKOPF,
    OPENDATE = new$OPENDATE,
    CLOSEDATE = new$CLOSEDATE,
    CHANGEDATE = new$CHANGEDATE,
    GENERALORG_REF = new$GENERALORG_REF,
    FEDERALREGIONCODE = new$FEDERALREGIONCODE,
    ORG_TYPE = new$ORG_TYPE,
    BUDGETREF = new$BUDGETREF,
    SUPPLIERSTATUS = new$SUPPLIERSTATUS,
    COUNTRYCODE = new$COUNTRYCODE,
    DATECLOSE = new$DATECLOSE,
    ORGCODE = new$ORGCODE,
    COSTAUTHORITY = new$COSTAUTHORITY,
    INCOMEAUTHORITY = new$INCOMEAUTHORITY,
    DEBTAUTHORITY = new$DEBTAUTHORITY,
    SVRAUTHORITY = new$SVRAUTHORITY,
    CLIENTID = new$CLIENTID,
    DATEOPEN = new$DATEOPEN,
    FUID = new$FUID,
    OKPO = new$OKPO,
    OKTMO = new$OKTMO,
    DOCSTATEREF = new$DOCSTATEREF,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    OGRN = new$OGRN,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    EXTID = new$EXTID,
    EXTOWNER = new$EXTOWNER,
    EXTSYNCDATE = new$EXTSYNCDATE
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_100 (TR_ORGANIZATIONS_AU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- Comment Триггер обработки открытия/закрытия организации


  /*  Закрытие организации */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
    update Banks set DateClose = new$DateClose where (id = new$ID) and (DateClose is null);
  end if;

  /*  открытие организации */
  if ((new$DateClose is null) and (:old.DateClose is not null)) then
    update Banks set DateClose = null where (id = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_200 (TR_ORGANIZATIONS_AU_200)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$BudgetRef <> :old.BudgetRef) then
    update FacialAcc_CLS set
    BudgetRef = new$BudgetRef
    where
    (ORG_REF = new$id)and((BudgetRef = :old.BudgetRef)or(BudgetRef<>0));
  END IF;
  /* Сносим организацию в проставленный КВСР, только если это ГРБС*/
  if ((new$KVSR <> :old.KVSR)and(new$Org_Type >= 10100)and(new$Org_Type <= 10299)) then
    update KVSR set
    Org_Ref = new$id
    where
    id = new$KVSR;
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update FacialAcc_CLS set
    KVSR = new$KVSR
    where
    (ORG_REF = new$id) and (KVSR = :old.KVSR);
  END IF;
  if (new$BudgetRef <> :old.BudgetRef) then
    update organizations set
    BudgetRef = new$BudgetRef
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update organizations set
    KVSR = new$KVSR
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORGANIZATIONS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (27, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=27) and (RecordId=new$ID);
  end if;

END;
/
ALTER TABLE TB_Org_Accounts ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/

CREATE OR REPLACE VIEW Org_Accounts (
  ID,
  ORG_REF,
  BANK_REF,
  ACC,
  ACC_CLS,
  FINTYPE,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  CLOSED,
  ACCDEFAULT,
  BANKDEPNUMBER,
  FACIALCODE,
  SERVICE_ORG_REF,
  ACOMMENT,
  ISDEFAULT,
  RVERSION,
  SERVICE_ACC_REF,
  CLOSECODE,
  SERVICEACC,
  FACIALACC_CLS,
  DATEOPEN,
  DATECLOSE,
  EXTID,
  EXTOWNER,
  EXTSYNCDATE)
AS
  SELECT
    ID,
    ORG_REF,
    BANK_REF,
    ACC,
    ACC_CLS,
    FINTYPE,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    CLOSED,
    ACCDEFAULT,
    BANKDEPNUMBER,
    FACIALCODE,
    SERVICE_ORG_REF,
    ACOMMENT,
    ISDEFAULT,
    RVERSION,
    SERVICE_ACC_REF,
    CLOSECODE,
    SERVICEACC,
    FACIALACC_CLS,
    DATEOPEN,
    DATECLOSE,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE
  FROM TB_Org_Accounts
/

CREATE OR REPLACE TRIGGER TR_ORG_ACCOUNTS_ID
  INSTEAD OF DELETE
  ON ORG_ACCOUNTS
  FOR EACH ROW
DECLARE
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_ORG_ACCOUNTS_BD)
-- Create 05.06.2007
-- - - - - - - - - - - - -

  select count(*) into CNT$
  from Org_Accounts where Service_Acc_Ref = :old.ID;
  
  if (CNT$ > 0) then
    RaiseException('ex_CantDelServiceAcc');
  end if;  

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_ORG_ACCOUNTS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);
   
  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_500 (TR_ORG_ACCOUNTS_AD_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

   insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(21,:old.ID,SYSDATE);

END;
/

CREATE OR REPLACE TRIGGER TR_ORG_ACCOUNTS_II
  INSTEAD OF INSERT
  ON ORG_ACCOUNTS
  FOR EACH ROW
DECLARE
  new$ID ORG_ACCOUNTS.ID%TYPE := :NEW.ID;
  new$ORG_REF ORG_ACCOUNTS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$BANK_REF ORG_ACCOUNTS.BANK_REF%TYPE := :NEW.BANK_REF;
  new$ACC ORG_ACCOUNTS.ACC%TYPE := :NEW.ACC;
  new$ACC_CLS ORG_ACCOUNTS.ACC_CLS%TYPE := :NEW.ACC_CLS;
  new$FINTYPE ORG_ACCOUNTS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$CREATERUSER ORG_ACCOUNTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORG_ACCOUNTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORG_ACCOUNTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORG_ACCOUNTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$CLOSED ORG_ACCOUNTS.CLOSED%TYPE := :NEW.CLOSED;
  new$ACCDEFAULT ORG_ACCOUNTS.ACCDEFAULT%TYPE := :NEW.ACCDEFAULT;
  new$BANKDEPNUMBER ORG_ACCOUNTS.BANKDEPNUMBER%TYPE := :NEW.BANKDEPNUMBER;
  new$FACIALCODE ORG_ACCOUNTS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$SERVICE_ORG_REF ORG_ACCOUNTS.SERVICE_ORG_REF%TYPE := :NEW.SERVICE_ORG_REF;
  new$ACOMMENT ORG_ACCOUNTS.ACOMMENT%TYPE := :NEW.ACOMMENT;
  new$ISDEFAULT ORG_ACCOUNTS.ISDEFAULT%TYPE := :NEW.ISDEFAULT;
  new$RVERSION ORG_ACCOUNTS.RVERSION%TYPE := :NEW.RVERSION;
  new$SERVICE_ACC_REF ORG_ACCOUNTS.SERVICE_ACC_REF%TYPE := :NEW.SERVICE_ACC_REF;
  new$CLOSECODE ORG_ACCOUNTS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$SERVICEACC ORG_ACCOUNTS.SERVICEACC%TYPE := :NEW.SERVICEACC;
  new$FACIALACC_CLS ORG_ACCOUNTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$DATEOPEN ORG_ACCOUNTS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$DATECLOSE ORG_ACCOUNTS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$EXTID ORG_ACCOUNTS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORG_ACCOUNTS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORG_ACCOUNTS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
--
  vOrgType$ NUMBER(10);
  ADate$ NUMBER;
  AClosed1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_ORG_ACCOUNTS_BI)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$Org_Ref = 0) then 
    RaiseException('ex_CantAddUnknownOrgAcc');
  END IF;
  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$ACC_CLS is null) then 
    new$ACC_CLS:= 0;
  END IF;
  if (new$AccDefault is null) then 
    new$AccDefault:= 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType:= 0;
  END IF;
  if ((new$AComment is null) or (new$AComment  is null)) then 
    new$AComment := new$Acc;
  END IF;
  if ((new$IsDefault is not Null) and (new$IsDefault <> 0)) then
    update ORG_ACCOUNTS set
    IsDefault = 0
    where ORG_REF = new$ORG_REF
    and IsDefault is not Null
    and IsDefault <> 0;
  END IF;
  if ((new$SERVICE_ORG_REF is null)and(new$SERVICE_ACC_REF is not null)) then
    BEGIN
      select
      oa.Org_Ref
      into
      new$SERVICE_ORG_REF    from
      org_accounts oa
      where
      (oa.id = new$SERVICE_ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* При изменении типа счета сносить в вид обслуживания значение вида обслуживания из типа счета */
  if (new$ServiceAcc is null) then
    BEGIN
      select SERVICETYPE into new$ServiceAcc from ACC_CLS where (id = new$ACC_CLS) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если вид обслуживания из типа счета NULL, то писать 0(банк) */
  if (new$ServiceAcc is null) then
    new$ServiceAcc := 0;
    if (new$SERVICE_ORG_REF is not null) then
      BEGIN
        select
        o.Org_Type
        into vOrgType$      from
        Organizations o
        where
        (o.id = new$SERVICE_ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      if ((vOrgType$  > 10099)and(vOrgType$  < 10200)) then
        new$ServiceAcc := 3;
             
      else
        if ((vOrgType$  > 39999)and(vOrgType$  < 50000)) then
          new$ServiceAcc := 1;
        END IF;   
      END IF; 
    END IF;
  END IF;
  /* если у счета заполнен счет обсл. орг. и вид обсл. не банк, то проставим банк,
      такой же, как и у счета обсл. организации */
  if ((new$Service_Acc_Ref is not null) and (new$ServiceAcc <> 0)) then
    BEGIN
      select
      Bank_Ref, Acc
      into new$Bank_Ref, new$FacialCode    from
      Org_Accounts
      where
      new$Service_Acc_Ref = Id
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_ORG_ACCOUNTS_BI_100)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$CloseCode is null) then 
    new$CloseCode := 0;
  END IF;
  /* Сноска закрытости от владельцев р/с, по дате - кто последний тот и прав */
  if (new$Org_Ref is not null) then
    BEGIN
      select DateClose into ADate$ from organizations where Id = new$Org_ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (ADate$  is not null) then 
      new$Closed := 1;
      new$DateClose := ADate$;
      new$CloseCode := 10; /* закрыт владельцем */
      
    END IF;
  END IF;
  if (new$Bank_Ref is not null) then
    BEGIN
      select DateClose into ADate$ from Banks where Id = new$Bank_ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (ADate$  is not null) then 
      new$Closed := 1;
      new$DateClose := ADate$;
      new$CloseCode := new$CloseCode + 1000; /* закрыт банком */
      
    END IF;
  END IF;
  if (new$Service_Acc_Ref is not null) then
    BEGIN
      select Closed, DateClose into AClosed1$, ADate$ from Org_Accounts where Id = new$Service_Acc_Ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (AClosed1$  is not null) then 
      new$Closed := 1;
      new$DateClose := ADate$;
      new$CloseCode := new$CloseCode + 100; /* закрыт обслуживающей организацией */
      
    END IF;  /* по полю facialacc_cls не проверяем - считаем - вводить не дают по закрытым л/с */
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORG_ACCOUNTS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORG_ACCOUNTS (
    ID,
    ORG_REF,
    BANK_REF,
    ACC,
    ACC_CLS,
    FINTYPE,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    CLOSED,
    ACCDEFAULT,
    BANKDEPNUMBER,
    FACIALCODE,
    SERVICE_ORG_REF,
    ACOMMENT,
    ISDEFAULT,
    RVERSION,
    SERVICE_ACC_REF,
    CLOSECODE,
    SERVICEACC,
    FACIALACC_CLS,
    DATEOPEN,
    DATECLOSE,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE
  ) VALUES (
    new$ID,
    new$ORG_REF,
    new$BANK_REF,
    new$ACC,
    new$ACC_CLS,
    new$FINTYPE,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$CLOSED,
    new$ACCDEFAULT,
    new$BANKDEPNUMBER,
    new$FACIALCODE,
    new$SERVICE_ORG_REF,
    new$ACOMMENT,
    new$ISDEFAULT,
    new$RVERSION,
    new$SERVICE_ACC_REF,
    new$CLOSECODE,
    new$SERVICEACC,
    new$FACIALACC_CLS,
    new$DATEOPEN,
    new$DATECLOSE,
    new$EXTID,
    new$EXTOWNER,
    new$EXTSYNCDATE);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORG_ACCOUNTS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 21) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_ORG_ACCOUNTS_IU
  INSTEAD OF UPDATE
  ON ORG_ACCOUNTS
  FOR EACH ROW
DECLARE
  new$ID ORG_ACCOUNTS.ID%TYPE := :NEW.ID;
  new$ORG_REF ORG_ACCOUNTS.ORG_REF%TYPE := :NEW.ORG_REF;
  new$BANK_REF ORG_ACCOUNTS.BANK_REF%TYPE := :NEW.BANK_REF;
  new$ACC ORG_ACCOUNTS.ACC%TYPE := :NEW.ACC;
  new$ACC_CLS ORG_ACCOUNTS.ACC_CLS%TYPE := :NEW.ACC_CLS;
  new$FINTYPE ORG_ACCOUNTS.FINTYPE%TYPE := :NEW.FINTYPE;
  new$CREATERUSER ORG_ACCOUNTS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORG_ACCOUNTS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORG_ACCOUNTS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORG_ACCOUNTS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$CLOSED ORG_ACCOUNTS.CLOSED%TYPE := :NEW.CLOSED;
  new$ACCDEFAULT ORG_ACCOUNTS.ACCDEFAULT%TYPE := :NEW.ACCDEFAULT;
  new$BANKDEPNUMBER ORG_ACCOUNTS.BANKDEPNUMBER%TYPE := :NEW.BANKDEPNUMBER;
  new$FACIALCODE ORG_ACCOUNTS.FACIALCODE%TYPE := :NEW.FACIALCODE;
  new$SERVICE_ORG_REF ORG_ACCOUNTS.SERVICE_ORG_REF%TYPE := :NEW.SERVICE_ORG_REF;
  new$ACOMMENT ORG_ACCOUNTS.ACOMMENT%TYPE := :NEW.ACOMMENT;
  new$ISDEFAULT ORG_ACCOUNTS.ISDEFAULT%TYPE := :NEW.ISDEFAULT;
  new$RVERSION ORG_ACCOUNTS.RVERSION%TYPE := :NEW.RVERSION;
  new$SERVICE_ACC_REF ORG_ACCOUNTS.SERVICE_ACC_REF%TYPE := :NEW.SERVICE_ACC_REF;
  new$CLOSECODE ORG_ACCOUNTS.CLOSECODE%TYPE := :NEW.CLOSECODE;
  new$SERVICEACC ORG_ACCOUNTS.SERVICEACC%TYPE := :NEW.SERVICEACC;
  new$FACIALACC_CLS ORG_ACCOUNTS.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$DATEOPEN ORG_ACCOUNTS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$DATECLOSE ORG_ACCOUNTS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$EXTID ORG_ACCOUNTS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORG_ACCOUNTS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORG_ACCOUNTS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
--
  vOrgType$ NUMBER(10);
  DiffCode$ NUMBER(10);
  Code1$ NUMBER(10);
  Code2$ NUMBER(10);
  Code3$ NUMBER(10);
  Code4$ NUMBER(10);
  Code51$ NUMBER(10);
  AFlag$ NUMBER(10);
  ADate$ NUMBER;
  vOrgType1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_ORG_ACCOUNTS_BU)
-- Version 7.02.00.3
-- - - - - - - - - - - - -

  if (new$ACC_CLS is null) then 
    new$ACC_CLS:= 0;
  END IF;
  if (new$AccDefault is null) then 
    new$AccDefault:= 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType:= 0;
  END IF;
  if ((new$AComment is null) or (new$AComment  is null) 
  or (new$AComment = :old.AComment) and (:old.AComment = :old.Acc)) then
    new$AComment := new$Acc;
  END IF;
  if ((new$IsDefault is not Null) and (new$IsDefault <> 0)
  and ((:old.IsDefault is Null) or (:old.IsDefault = 0))) then
    update ORG_ACCOUNTS set
    IsDefault = 0
    where ORG_REF = new$ORG_REF
    and IsDefault is not Null
    and IsDefault <> 0;
  END IF;
  if ((new$SERVICE_ORG_REF is null)and(new$SERVICE_ACC_REF is not null)) then
    BEGIN
      select
      oa.Org_Ref
      into
      new$SERVICE_ORG_REF    from
      org_accounts oa
      where
      (oa.id = new$SERVICE_ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* При изменении типа счета сносить в вид обслуживания значение вида обслуживания из типа счета */
  if (new$ACC_CLS <> :old.ACC_CLS) then
    BEGIN
      select SERVICETYPE into new$ServiceAcc from ACC_CLS where (id = new$ACC_CLS) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если изменяем вид обслуживания на банк, то надо очистить ссылки на обслуживающую организацию*/
  if (:old.ServiceAcc is not null and new$ServiceAcc = 0 and :old.ServiceAcc <> new$ServiceAcc) then
    new$service_acc_ref := null;
    new$service_org_ref := null;
     
  END IF;
  /* Если вид обслуживания из типа счета NULL, то писать 0(банк) */
  if (new$ServiceAcc is null) then
    new$ServiceAcc := 0;
    if (new$SERVICE_ORG_REF is not null) then
      BEGIN
        select
        o.Org_Type
        into vOrgType$      from
        Organizations o
        where
        (o.id = new$SERVICE_ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      if ((vOrgType$  > 10099)and(vOrgType$  < 10200)) then
        new$ServiceAcc := 3;
             
      else
        if ((vOrgType$  > 39999)and(vOrgType$  < 50000)) then
          new$ServiceAcc := 1;
        END IF;   
      END IF; 
    END IF;
  END IF;
  /* если изменился код в УФК надо снести его в лицевые счета */
  if (new$Acc <> :old.Acc) then
    update facialacc_cls set
    FACIALCODE = new$Acc
    where
    FCACCOUNT = new$id;
     
  END IF;
  /* если у счета заполнен счет обсл. орг. и вид обсл. не банк, то проставим банк,
      такой же, как и у счета обсл. организации */
  if ((new$Service_Acc_Ref is not null) and (new$ServiceAcc <> 0)
  and (new$Service_Acc_Ref <> :old.Service_Acc_Ref)) then
    BEGIN
      select
      Bank_Ref, Acc
      into new$Bank_Ref, new$FacialCode    from
      Org_Accounts
      where
      new$Service_Acc_Ref = Id
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Каскадное обновление */
  /* Если у счета поменялся банк, то нужно посмотреть где используется этот счет 
   в качестве счета Обслуживающей организации. Если да, то нужно поменять его там на новый */
  /* Если меняется имя счета, то смотрим где этот счет используется в качестве счета обслуж. организации */
  if (((new$Bank_Ref <> :old.Bank_Ref) or (new$Acc <> :old.Acc)) and (:old.id <> new$id)) then
    update Org_Accounts
    set Bank_Ref = new$Bank_Ref,
    FacialCode = new$Acc
    where Service_Acc_Ref = new$ID;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORG_ACCOUNTS_BU_100)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$CloseCode is null) then 
    new$CloseCode := 0;
  END IF;
  CloseOrgCls_Div(:old.CloseCode,Code1$, Code2$, Code3$, Code4$, Code51$);
    
  /* ?? изменение с открытого владельца на закрытого видимо не предполагается*/
    
  /* Если меняется банк, то нужно проверить не является ли он открытым, а счет закрытым по банку */
  if ((new$Bank_ref <> :old.Bank_ref) and (Code4$ = 1)) then 
    BEGIN
      select DateClose into ADate$ from Banks where ID = new$Bank_ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (ADate$ is null) then 
      Code4$ := 0; /* Так надо для случая, когда одновременно меняются и банк и обслуж. орг. */
      new$CloseCode := :old.CloseCode - 1000;
          
    else 
      if (new$DateClose > ADate$) then
        new$DateClose := ADate$;
      END IF;  
    END IF;
  END IF;
    
  /* Если меняется обслуживающая организация, она открыта и счет закрыт по обслуж. орг. - надо открыть */
  if ((new$Service_Acc_ref <> :old.Service_Acc_Ref) and (Code3$ = 1)) then 
    BEGIN
      select Closed, DateClose into AFlag$, ADate$ from Org_Accounts where ID = new$Service_Acc_Ref ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (AFlag$ is null) then 
      Code3$ := 0;
      new$CloseCode := :old.CloseCode - 100;
          
    else 
      if (new$DateClose > ADate$) then
        new$DateClose := ADate$;
      END IF;  
    END IF;
  END IF;
  /* ?? а изменение facialacc_cls видимо не предполагается */

  /* случай закрытия/открытия пользователем ?? А почему только пользователем ?? может в AU сноску перенести */
  if (((new$Closed is null) and not(:old.Closed is null)) or
  (not(new$Closed is null) and (:old.Closed is null)))
  then 
    if (new$ORG_REF is not null and  new$facialacc_cls is not null)
    then
      BEGIN
        select o.Org_Type       into vOrgType1$ from Organizations o where (o.id = new$ORG_REF)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* Синхронное закрытие лицевого счета для БУ/АУ ?? почему просто ссылки мало*/
      if ((vOrgType1$  >= 10800)and(vOrgType1$  <= 10900))
      then
        if (new$Closed = 1)
        then
          /* закрываем лицевой счет */
          if (new$DateClose is null) then
            CurDateToDouble(new$DateClose);
          END IF;

          update facialacc_cls set
          dateclose = new$DateClose,
          CloseCode = CloseCode + 10000
          where id = new$facialacc_cls;
                  
        END IF;
        if (new$Closed is null)
        then
          /* открываем лицевой счет */
          update facialacc_cls set 
          dateclose = null,
          CloseCode = CloseCode - 10000
          where id = new$facialacc_cls;
              
        END IF;    
      END IF;
    END IF;
    if (new$Closed = 1) then 
      new$CloseCode := 1;
    END IF;
    if (new$Closed is null) then 
      new$CloseCode := 0;
      
    END IF;
  END IF;
    
  /* случаи закрытия/открытия не пользователем */
  if (new$CloseCode <> :old.CloseCode) then 
    DiffCode$ := new$CloseCode - :old.CloseCode; /* >0 - счет закрывается, <0 - счет открывается*/
        
    /* Защита от "перезакрытия" */
    if (DiffCode$ = 1) then 
      Code1$ := 1;
    END IF;
    if (DiffCode$ = 10) then 
      Code2$ := 1;
    END IF;
    if (DiffCode$ = 100) then 
      Code3$ := 1;
    END IF;
    if (DiffCode$ = 1000) then 
      Code4$ := 1;
    END IF;
    if (DiffCode$ = 10000) then 
      Code51$ := 1;
    END IF;
    if (DiffCode$ = -1) then 
      Code1$ := 0;
    END IF;
    if (DiffCode$ = -10) then 
      Code2$ := 0;
    END IF;
    if (DiffCode$ = -100) then 
      Code3$ := 0;
    END IF;
    if (DiffCode$ = -1000) then 
      Code4$ := 0;
    END IF;
    if (DiffCode$ = -10000) then 
      Code51$ := 0;
    END IF;
    new$CloseCode := Code1$ + Code2$*10 + Code3$*100 + Code4$*1000 + Code51$*10000;
        
    if (new$CloseCode = 0) then 
      new$Closed := null; 
      new$DateClose := null;
      	
    else 
      new$Closed := 1;
      if (new$DateClose is null) then
        CurDateToDouble(new$DateClose);
      	
      END IF;  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORG_ACCOUNTS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (New$RVersion is null) then
    new$RVersion := 1;
  elsif ((new$RVersion = -1) and (:Old.RVersion <> -1)) then
    new$RVersion := :Old.RVersion;
  else
    new$RVersion := :Old.RVersion + 1;
  end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORG_ACCOUNTS SET
    ID = new$ID,
    ORG_REF = new$ORG_REF,
    BANK_REF = new$BANK_REF,
    ACC = new$ACC,
    ACC_CLS = new$ACC_CLS,
    FINTYPE = new$FINTYPE,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    CLOSED = new$CLOSED,
    ACCDEFAULT = new$ACCDEFAULT,
    BANKDEPNUMBER = new$BANKDEPNUMBER,
    FACIALCODE = new$FACIALCODE,
    SERVICE_ORG_REF = new$SERVICE_ORG_REF,
    ACOMMENT = new$ACOMMENT,
    ISDEFAULT = new$ISDEFAULT,
    RVERSION = new$RVERSION,
    SERVICE_ACC_REF = new$SERVICE_ACC_REF,
    CLOSECODE = new$CLOSECODE,
    SERVICEACC = new$SERVICEACC,
    FACIALACC_CLS = new$FACIALACC_CLS,
    DATEOPEN = new$DATEOPEN,
    DATECLOSE = new$DATECLOSE,
    EXTID = new$EXTID,
    EXTOWNER = new$EXTOWNER,
    EXTSYNCDATE = new$EXTSYNCDATE
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_0 (TR_ORG_ACCOUNTS_AU)
-- Version 10.00.00.2
-- - - - - - - - - - - - -

  /* При закрытии счета закрываем счета, у которых он указан как "Счет обслуживающей организации". Аналогично при открытии */
  if (new$CloseCode <> :old.CloseCode)
  then 
    if (new$CloseCode = 0) then
      update Org_Accounts set
      CloseCode = CloseCode - 100,
      RVersion = -1
      where Service_Acc_Ref = :old.ID;
          
    else
      update Org_Accounts set
      CloseCode = CloseCode + 100,
      DateClose = new$DateClose,
      RVersion = -1
      where Service_Acc_Ref = :old.ID;
      
    END IF;
  END IF;
  /* Снос счета в FACIAL_CODE для обслуживаемых */  
  if (new$acc <> :old.acc) then
    update org_accounts t set 
    t.facialcode = new$acc
    where 
    t.service_acc_ref = new$id and t.service_org_ref = new$org_ref
    ;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORG_ACCOUNTS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (21, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=21) and (RecordId=new$ID);
  end if;

END;
/
ALTER TABLE KVSR ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE KFSR ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE KCSR ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE KESR ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE KESRSubCode ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE Fact ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE MeansType ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE DirectionCls ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE SubsidyCls ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE TB_TransfertCls ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/

CREATE OR REPLACE VIEW TransfertCls (
  ID,
  REGIONCLS,
  CREATERUSER,
  CREATEDATE,
  UPDATERUSER,
  UPDATEDATE,
  CODE,
  RECEIVEKVSR,
  RECEIVEKFSR,
  RECEIVEKVR,
  RECEIVEKESR,
  RECEIVEKD,
  TRANSFERKVSR,
  TRANSFERKFSR,
  TRANSFERKCSR,
  TRANSFERKVR,
  TRANSFERKESR,
  TRANSFERKDVALUE,
  TARGETMEANSSIGN,
  TARGETCLS,
  STARTDATE,
  DELETEDATE,
  NOTE,
  NAME,
  BUDGETREF,
  RECEIVEKCSR,
  SOURCELEVEL,
  DESTLEVEL,
  TRANSFERTKIND,
  GRANTKIND,
  TRANSFERTYEAR,
  EXTID,
  EXTOWNER,
  EXTSYNCDATE)
AS
  SELECT
    ID,
    REGIONCLS,
    CREATERUSER,
    CREATEDATE,
    UPDATERUSER,
    UPDATEDATE,
    CODE,
    RECEIVEKVSR,
    RECEIVEKFSR,
    RECEIVEKVR,
    RECEIVEKESR,
    RECEIVEKD,
    TRANSFERKVSR,
    TRANSFERKFSR,
    TRANSFERKCSR,
    TRANSFERKVR,
    TRANSFERKESR,
    TRANSFERKDVALUE,
    TARGETMEANSSIGN,
    TARGETCLS,
    STARTDATE,
    DELETEDATE,
    NOTE,
    NAME,
    BUDGETREF,
    RECEIVEKCSR,
    SOURCELEVEL,
    DESTLEVEL,
    TRANSFERTKIND,
    GRANTKIND,
    TRANSFERTYEAR,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE
  FROM TB_TransfertCls
/

CREATE OR REPLACE TRIGGER TR_TRANSFERTCLS_ID
  INSTEAD OF DELETE
  ON TRANSFERTCLS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_TRANSFERTCLS
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AD_500 (TR_TRANSFERTCLS_AD_500)
-- Create 04.10.2007
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate)
  values(203,:old.ID,SYSDATE);

END;
/

CREATE OR REPLACE TRIGGER TR_TRANSFERTCLS_II
  INSTEAD OF INSERT
  ON TRANSFERTCLS
  FOR EACH ROW
DECLARE
  new$ID TRANSFERTCLS.ID%TYPE := :NEW.ID;
  new$REGIONCLS TRANSFERTCLS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$CREATERUSER TRANSFERTCLS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE TRANSFERTCLS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATERUSER TRANSFERTCLS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$UPDATEDATE TRANSFERTCLS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CODE TRANSFERTCLS.CODE%TYPE := :NEW.CODE;
  new$RECEIVEKVSR TRANSFERTCLS.RECEIVEKVSR%TYPE := :NEW.RECEIVEKVSR;
  new$RECEIVEKFSR TRANSFERTCLS.RECEIVEKFSR%TYPE := :NEW.RECEIVEKFSR;
  new$RECEIVEKVR TRANSFERTCLS.RECEIVEKVR%TYPE := :NEW.RECEIVEKVR;
  new$RECEIVEKESR TRANSFERTCLS.RECEIVEKESR%TYPE := :NEW.RECEIVEKESR;
  new$RECEIVEKD TRANSFERTCLS.RECEIVEKD%TYPE := :NEW.RECEIVEKD;
  new$TRANSFERKVSR TRANSFERTCLS.TRANSFERKVSR%TYPE := :NEW.TRANSFERKVSR;
  new$TRANSFERKFSR TRANSFERTCLS.TRANSFERKFSR%TYPE := :NEW.TRANSFERKFSR;
  new$TRANSFERKCSR TRANSFERTCLS.TRANSFERKCSR%TYPE := :NEW.TRANSFERKCSR;
  new$TRANSFERKVR TRANSFERTCLS.TRANSFERKVR%TYPE := :NEW.TRANSFERKVR;
  new$TRANSFERKESR TRANSFERTCLS.TRANSFERKESR%TYPE := :NEW.TRANSFERKESR;
  new$TRANSFERKDVALUE TRANSFERTCLS.TRANSFERKDVALUE%TYPE := :NEW.TRANSFERKDVALUE;
  new$TARGETMEANSSIGN TRANSFERTCLS.TARGETMEANSSIGN%TYPE := :NEW.TARGETMEANSSIGN;
  new$TARGETCLS TRANSFERTCLS.TARGETCLS%TYPE := :NEW.TARGETCLS;
  new$STARTDATE TRANSFERTCLS.STARTDATE%TYPE := :NEW.STARTDATE;
  new$DELETEDATE TRANSFERTCLS.DELETEDATE%TYPE := :NEW.DELETEDATE;
  new$NOTE TRANSFERTCLS.NOTE%TYPE := :NEW.NOTE;
  new$NAME TRANSFERTCLS.NAME%TYPE := :NEW.NAME;
  new$BUDGETREF TRANSFERTCLS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$RECEIVEKCSR TRANSFERTCLS.RECEIVEKCSR%TYPE := :NEW.RECEIVEKCSR;
  new$SOURCELEVEL TRANSFERTCLS.SOURCELEVEL%TYPE := :NEW.SOURCELEVEL;
  new$DESTLEVEL TRANSFERTCLS.DESTLEVEL%TYPE := :NEW.DESTLEVEL;
  new$TRANSFERTKIND TRANSFERTCLS.TRANSFERTKIND%TYPE := :NEW.TRANSFERTKIND;
  new$GRANTKIND TRANSFERTCLS.GRANTKIND%TYPE := :NEW.GRANTKIND;
  new$TRANSFERTYEAR TRANSFERTCLS.TRANSFERTYEAR%TYPE := :NEW.TRANSFERTYEAR;
  new$EXTID TRANSFERTCLS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER TRANSFERTCLS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE TRANSFERTCLS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
--
  CurrentDate$ NUMBER;
  CNT$1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_TRANSFERTCLS_BI)
-- Version 8.00.00.3
-- - - - - - - - - - - - -

  select g_shared.nextval into new$ID from dual;
   
  if (new$BUDGETREF is null) then 
    new$BUDGETREF := 0;
  END IF;
  if (new$RECEIVEKVSR is null) then 
    new$RECEIVEKVSR := 0;
  END IF;
  if (new$RECEIVEKCSR is null) then 
    new$RECEIVEKCSR := 0;
  END IF;
  if (new$RECEIVEKFSR is null) then 
    new$RECEIVEKFSR := 0;
  END IF;
  if (new$RECEIVEKESR is null) then 
    new$RECEIVEKESR := 0;
  END IF;
  if (new$RECEIVEKD is null) then 
    new$RECEIVEKD := 0;
  END IF;
  if ((new$RECEIVEKVR is null) or (new$RECEIVEKVR  is null)) then 
    new$RECEIVEKVR := '000';
  END IF;
  if (new$TRANSFERKVSR is null) then 
    new$TRANSFERKVSR := 0;
  END IF;
  if (new$TRANSFERKCSR is null) then 
    new$TRANSFERKCSR := 0;
  END IF;
  if (new$TRANSFERKFSR is null) then 
    new$TRANSFERKFSR := 0;
  END IF;
  if (new$TRANSFERKVR is null) then 
    new$TRANSFERKVR := 0;
  END IF;
  if (new$TRANSFERKESR is null) then 
    new$TRANSFERKESR := 0;
  END IF;
  if ((new$TRANSFERKDVALUE is null) or (new$TRANSFERKDVALUE  is null)) then 
    new$TRANSFERKDVALUE := '00000000000000000000';
  END IF;
  if (new$TARGETMEANSSIGN is null) then 
    new$TARGETMEANSSIGN := 1;
  END IF;
  if (new$REGIONCLS is null) then 
    new$REGIONCLS := 0;
  END IF;
  if (new$SourceLevel is null) then 
    new$SourceLevel := 0;
  END IF;
  if (new$GrantKind is null) then 
    new$GrantKind := 0;
  END IF;
  if (new$GrantKind = 2) then /* если это "Передача" */
    new$DestLevel := 1; /* Расходы других бюджетов */
     
  else
    /* если это "Получение" или "Получетель средств" не заполнен */
    if ((new$GrantKind = 1) or (new$DestLevel is null)) then
      new$DestLevel := 0; /* Собственные расходы */
    END IF;
  END IF;
  if (new$TransfertKind is null) then 
    new$TransfertKind  := 0; 
  END IF;
  if (new$TransfertYear is null) then
    CurDateToDouble(CurrentDate$);
    new$TransfertYear := CurrentDate$ / 10000;
     
  END IF;

-- - - - - - - - - - - - -
-- BI_200 (TR_TRANSFERTCLS_BI_200)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  SELECT COUNT(*) INTO CNT$1$
  from TransfertCls t where
  (        (t.ID <> new$ID) and
  (t.CODE=new$CODE) and
  (t.RECEIVEKVSR=new$RECEIVEKVSR) and
  (t.RECEIVEKFSR=new$RECEIVEKFSR) and
  (t.RECEIVEKCSR=new$RECEIVEKCSR) and
  (t.RECEIVEKVR=new$RECEIVEKVR) and
  (t.RECEIVEKESR=new$RECEIVEKESR) and
  (t.RECEIVEKD=new$RECEIVEKD) and
  (t.TRANSFERKVSR=new$TRANSFERKVSR) and
  (t.TRANSFERKFSR=new$TRANSFERKFSR) and
  (t.TRANSFERKCSR=new$TRANSFERKCSR) and
  (t.TRANSFERKVR=new$TRANSFERKVR) and
  (t.TRANSFERKESR=new$TRANSFERKESR) and
  (t.TRANSFERKDVALUE=new$TRANSFERKDVALUE) and
  (t.TARGETMEANSSIGN=new$TARGETMEANSSIGN) and
  (t.REGIONCLS=new$REGIONCLS) and
  (t.DESTLEVEL=new$DESTLEVEL) and
  (t.BUDGETREF=new$BUDGETREF)) AND (ROWNUM = 1);
  if ((CNT$1$<> 0)) then
    RaiseException('EX_DUPLICATE_TRANSFERT');
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_TRANSFERTCLS_BI_500)
-- Create 24.09.2007
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_TRANSFERTCLS (
    ID,
    REGIONCLS,
    CREATERUSER,
    CREATEDATE,
    UPDATERUSER,
    UPDATEDATE,
    CODE,
    RECEIVEKVSR,
    RECEIVEKFSR,
    RECEIVEKVR,
    RECEIVEKESR,
    RECEIVEKD,
    TRANSFERKVSR,
    TRANSFERKFSR,
    TRANSFERKCSR,
    TRANSFERKVR,
    TRANSFERKESR,
    TRANSFERKDVALUE,
    TARGETMEANSSIGN,
    TARGETCLS,
    STARTDATE,
    DELETEDATE,
    NOTE,
    NAME,
    BUDGETREF,
    RECEIVEKCSR,
    SOURCELEVEL,
    DESTLEVEL,
    TRANSFERTKIND,
    GRANTKIND,
    TRANSFERTYEAR,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE
  ) VALUES (
    new$ID,
    new$REGIONCLS,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATERUSER,
    new$UPDATEDATE,
    new$CODE,
    new$RECEIVEKVSR,
    new$RECEIVEKFSR,
    new$RECEIVEKVR,
    new$RECEIVEKESR,
    new$RECEIVEKD,
    new$TRANSFERKVSR,
    new$TRANSFERKFSR,
    new$TRANSFERKCSR,
    new$TRANSFERKVR,
    new$TRANSFERKESR,
    new$TRANSFERKDVALUE,
    new$TARGETMEANSSIGN,
    new$TARGETCLS,
    new$STARTDATE,
    new$DELETEDATE,
    new$NOTE,
    new$NAME,
    new$BUDGETREF,
    new$RECEIVEKCSR,
    new$SOURCELEVEL,
    new$DESTLEVEL,
    new$TRANSFERTKIND,
    new$GRANTKIND,
    new$TRANSFERTYEAR,
    new$EXTID,
    new$EXTOWNER,
    new$EXTSYNCDATE);

-- - - - - - - - - - - - -
-- AI_500 (TR_TRANSFERTCLS_AI_500)
-- Create 04.10.2007
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 203) and (RecordId = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_TRANSFERTCLS_IU
  INSTEAD OF UPDATE
  ON TRANSFERTCLS
  FOR EACH ROW
DECLARE
  new$ID TRANSFERTCLS.ID%TYPE := :NEW.ID;
  new$REGIONCLS TRANSFERTCLS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$CREATERUSER TRANSFERTCLS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE TRANSFERTCLS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATERUSER TRANSFERTCLS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$UPDATEDATE TRANSFERTCLS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CODE TRANSFERTCLS.CODE%TYPE := :NEW.CODE;
  new$RECEIVEKVSR TRANSFERTCLS.RECEIVEKVSR%TYPE := :NEW.RECEIVEKVSR;
  new$RECEIVEKFSR TRANSFERTCLS.RECEIVEKFSR%TYPE := :NEW.RECEIVEKFSR;
  new$RECEIVEKVR TRANSFERTCLS.RECEIVEKVR%TYPE := :NEW.RECEIVEKVR;
  new$RECEIVEKESR TRANSFERTCLS.RECEIVEKESR%TYPE := :NEW.RECEIVEKESR;
  new$RECEIVEKD TRANSFERTCLS.RECEIVEKD%TYPE := :NEW.RECEIVEKD;
  new$TRANSFERKVSR TRANSFERTCLS.TRANSFERKVSR%TYPE := :NEW.TRANSFERKVSR;
  new$TRANSFERKFSR TRANSFERTCLS.TRANSFERKFSR%TYPE := :NEW.TRANSFERKFSR;
  new$TRANSFERKCSR TRANSFERTCLS.TRANSFERKCSR%TYPE := :NEW.TRANSFERKCSR;
  new$TRANSFERKVR TRANSFERTCLS.TRANSFERKVR%TYPE := :NEW.TRANSFERKVR;
  new$TRANSFERKESR TRANSFERTCLS.TRANSFERKESR%TYPE := :NEW.TRANSFERKESR;
  new$TRANSFERKDVALUE TRANSFERTCLS.TRANSFERKDVALUE%TYPE := :NEW.TRANSFERKDVALUE;
  new$TARGETMEANSSIGN TRANSFERTCLS.TARGETMEANSSIGN%TYPE := :NEW.TARGETMEANSSIGN;
  new$TARGETCLS TRANSFERTCLS.TARGETCLS%TYPE := :NEW.TARGETCLS;
  new$STARTDATE TRANSFERTCLS.STARTDATE%TYPE := :NEW.STARTDATE;
  new$DELETEDATE TRANSFERTCLS.DELETEDATE%TYPE := :NEW.DELETEDATE;
  new$NOTE TRANSFERTCLS.NOTE%TYPE := :NEW.NOTE;
  new$NAME TRANSFERTCLS.NAME%TYPE := :NEW.NAME;
  new$BUDGETREF TRANSFERTCLS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$RECEIVEKCSR TRANSFERTCLS.RECEIVEKCSR%TYPE := :NEW.RECEIVEKCSR;
  new$SOURCELEVEL TRANSFERTCLS.SOURCELEVEL%TYPE := :NEW.SOURCELEVEL;
  new$DESTLEVEL TRANSFERTCLS.DESTLEVEL%TYPE := :NEW.DESTLEVEL;
  new$TRANSFERTKIND TRANSFERTCLS.TRANSFERTKIND%TYPE := :NEW.TRANSFERTKIND;
  new$GRANTKIND TRANSFERTCLS.GRANTKIND%TYPE := :NEW.GRANTKIND;
  new$TRANSFERTYEAR TRANSFERTCLS.TRANSFERTYEAR%TYPE := :NEW.TRANSFERTYEAR;
  new$EXTID TRANSFERTCLS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER TRANSFERTCLS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE TRANSFERTCLS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
--
  CurrentDate$ NUMBER;
  CNT$1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_TRANSFERTCLS_BU)
-- Version 8.00.00.3
-- - - - - - - - - - - - -

  if (new$BUDGETREF is null) then 
    new$BUDGETREF := 0;
  END IF;
  if (new$RECEIVEKVSR is null) then 
    new$RECEIVEKVSR := 0;
  END IF;
  if (new$RECEIVEKCSR is null) then 
    new$RECEIVEKCSR := 0;
  END IF;
  if (new$RECEIVEKFSR is null) then 
    new$RECEIVEKFSR := 0;
  END IF;
  if (new$RECEIVEKESR is null) then 
    new$RECEIVEKESR := 0;
  END IF;
  if (new$RECEIVEKD is null) then 
    new$RECEIVEKD := 0;
  END IF;
  if ((new$RECEIVEKVR is null) or (new$RECEIVEKVR  is null)) then 
    new$RECEIVEKVR := '000';
  END IF;
  if (new$TRANSFERKVSR is null) then 
    new$TRANSFERKVSR := 0;
  END IF;
  if (new$TRANSFERKCSR is null) then 
    new$TRANSFERKCSR := 0;
  END IF;
  if (new$TRANSFERKFSR is null) then 
    new$TRANSFERKFSR := 0;
  END IF;
  if (new$TRANSFERKVR is null) then 
    new$TRANSFERKVR := 0;
  END IF;
  if (new$TRANSFERKESR is null) then 
    new$TRANSFERKESR := 0;
  END IF;
  if ((new$TRANSFERKDVALUE is null) or (new$TRANSFERKDVALUE  is null)) then 
    new$TRANSFERKDVALUE := '00000000000000000000';
  END IF;
  if (new$TARGETMEANSSIGN is null) then 
    new$TARGETMEANSSIGN := 1;
  END IF;
  if (new$REGIONCLS is null) then 
    new$REGIONCLS := 0;
  END IF;
  if (new$SourceLevel is null) then 
    new$SourceLevel := 0;
  END IF;
  if (new$GrantKind is null) then 
    new$GrantKind := 0;
  END IF;
  if (new$GrantKind = 2) then /* если это "Передача" */
    new$DestLevel := 1; /* Расходы других бюджетов */
     
  else
    /* если это "Получение" или "Получетель средств" не заполнен */
    if ((new$GrantKind = 1) or (new$DestLevel is null)) then
      new$DestLevel := 0; /* Собственные расходы */
    END IF;
  END IF;
  if (new$TransfertKind is null) then 
    new$TransfertKind  := 0;
  END IF;
  if (new$TransfertYear is null) then
    CurDateToDouble(CurrentDate$);
    new$TransfertYear := CurrentDate$ / 10000;
     
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_TRANSFERTCLS_BU_100)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if ((new$id = 0) and (new$Code <> :old.Code)) then
    RaiseException('EX_CANTMODIFY_ZEROTRANFERTSCLS');
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_TRANSFERTCLS_BU_200)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  SELECT COUNT(*) INTO CNT$1$
  from TransfertCls t where
  (        (t.ID <> new$ID) and
  (t.CODE=new$CODE) and
  (t.RECEIVEKVSR=new$RECEIVEKVSR) and
  (t.RECEIVEKFSR=new$RECEIVEKFSR) and
  (t.RECEIVEKCSR=new$RECEIVEKCSR) and
  (t.RECEIVEKVR=new$RECEIVEKVR) and
  (t.RECEIVEKESR=new$RECEIVEKESR) and
  (t.RECEIVEKD=new$RECEIVEKD) and
  (t.TRANSFERKVSR=new$TRANSFERKVSR) and
  (t.TRANSFERKFSR=new$TRANSFERKFSR) and
  (t.TRANSFERKCSR=new$TRANSFERKCSR) and
  (t.TRANSFERKVR=new$TRANSFERKVR) and
  (t.TRANSFERKESR=new$TRANSFERKESR) and
  (t.TRANSFERKDVALUE=new$TRANSFERKDVALUE) and
  (t.TARGETMEANSSIGN=new$TARGETMEANSSIGN) and
  (t.REGIONCLS=new$REGIONCLS) and
  (t.DESTLEVEL=new$DESTLEVEL) and
  (t.BUDGETREF=new$BUDGETREF)) AND (ROWNUM = 1);
  if ((CNT$1$<> 0)) then
    RaiseException('EX_DUPLICATE_TRANSFERT');
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_TRANSFERTCLS SET
    ID = new$ID,
    REGIONCLS = new$REGIONCLS,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    UPDATEDATE = new$UPDATEDATE,
    CODE = new$CODE,
    RECEIVEKVSR = new$RECEIVEKVSR,
    RECEIVEKFSR = new$RECEIVEKFSR,
    RECEIVEKVR = new$RECEIVEKVR,
    RECEIVEKESR = new$RECEIVEKESR,
    RECEIVEKD = new$RECEIVEKD,
    TRANSFERKVSR = new$TRANSFERKVSR,
    TRANSFERKFSR = new$TRANSFERKFSR,
    TRANSFERKCSR = new$TRANSFERKCSR,
    TRANSFERKVR = new$TRANSFERKVR,
    TRANSFERKESR = new$TRANSFERKESR,
    TRANSFERKDVALUE = new$TRANSFERKDVALUE,
    TARGETMEANSSIGN = new$TARGETMEANSSIGN,
    TARGETCLS = new$TARGETCLS,
    STARTDATE = new$STARTDATE,
    DELETEDATE = new$DELETEDATE,
    NOTE = new$NOTE,
    NAME = new$NAME,
    BUDGETREF = new$BUDGETREF,
    RECEIVEKCSR = new$RECEIVEKCSR,
    SOURCELEVEL = new$SOURCELEVEL,
    DESTLEVEL = new$DESTLEVEL,
    TRANSFERTKIND = new$TRANSFERTKIND,
    GRANTKIND = new$GRANTKIND,
    TRANSFERTYEAR = new$TRANSFERTYEAR,
    EXTID = new$EXTID,
    EXTOWNER = new$EXTOWNER,
    EXTSYNCDATE = new$EXTSYNCDATE
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_500 (TR_TRANSFERTCLS_AU_500)
-- Create 04.10.2007
-- - - - - - - - - - - - -

  if (new$Id <> :old.Id) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (203, :Old.Id, SYSDATE);
    delete from DelRecIndexes where (TableID = 203) and (RecordId = new$ID);
  end if;

END;
/
ALTER TABLE FinType ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE NotifyTypes ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE TB_KD ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/

CREATE OR REPLACE VIEW KD (
  ID,
  REPCODE,
  CREATEDATE,
  UPDATEDATE,
  KVSR,
  DESCRIPTIONCODE,
  MAINDESCRIPTIONCODE,
  ITEMCODE,
  PROGRAMCODE,
  KESR,
  KDVALUE,
  REMOTEFLAG,
  UNIONFLAG,
  BUDGETREF,
  DELETEDATE,
  NAME,
  KD_LEVEL,
  STARTDATE,
  SHORTNAME,
  CREATERUSER,
  UPDATERUSER,
  EXTID,
  EXTOWNER,
  EXTSYNCDATE)
AS
  SELECT
    ID,
    REPCODE,
    CREATEDATE,
    UPDATEDATE,
    KVSR,
    DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE,
    ITEMCODE,
    PROGRAMCODE,
    KESR,
    KDVALUE,
    REMOTEFLAG,
    UNIONFLAG,
    BUDGETREF,
    DELETEDATE,
    NAME,
    KD_LEVEL,
    STARTDATE,
    SHORTNAME,
    CREATERUSER,
    UPDATERUSER,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE
  FROM TB_KD
/

CREATE OR REPLACE TRIGGER TR_KD_ID
  INSTEAD OF DELETE
  ON KD
  FOR EACH ROW
DECLARE
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_KD_BD_0)
-- Create 02.04.2010
-- Last update 02.04.2010
-- - - - - - - - - - - - -

  -- нельзя удалять базовый КД, если есть сопоставленные ему КД
  if (:old.kvsr = 0) then
    select count(*) into CNT$
                 from kd kd1
                 where ((kd1.kvsr <> 0) and
                       ((kd1.descriptioncode-:old.descriptioncode>-1) and (kd1.descriptioncode-:old.descriptioncode<1)) and
                       (kd1.programcode = :old.programcode) and
                       (kd1.kesr = :old.kesr)) AND (ROWNUM = 1);
    if (CNT$ > 0) then
      RaiseException('EX_CANTDELBASECODE');
	end if;  
  end if;	

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_KD
  WHERE id = :old.id;

-- - - - - - - - - - - - -
-- AD_500 (TR_KD_AD_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(80, :old.ID, sysdate);

END;
/

CREATE OR REPLACE TRIGGER TR_KD_II
  INSTEAD OF INSERT
  ON KD
  FOR EACH ROW
DECLARE
  new$ID KD.ID%TYPE := :NEW.ID;
  new$REPCODE KD.REPCODE%TYPE := :NEW.REPCODE;
  new$CREATEDATE KD.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE KD.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$KVSR KD.KVSR%TYPE := :NEW.KVSR;
  new$DESCRIPTIONCODE KD.DESCRIPTIONCODE%TYPE := :NEW.DESCRIPTIONCODE;
  new$MAINDESCRIPTIONCODE KD.MAINDESCRIPTIONCODE%TYPE := :NEW.MAINDESCRIPTIONCODE;
  new$ITEMCODE KD.ITEMCODE%TYPE := :NEW.ITEMCODE;
  new$PROGRAMCODE KD.PROGRAMCODE%TYPE := :NEW.PROGRAMCODE;
  new$KESR KD.KESR%TYPE := :NEW.KESR;
  new$KDVALUE KD.KDVALUE%TYPE := :NEW.KDVALUE;
  new$REMOTEFLAG KD.REMOTEFLAG%TYPE := :NEW.REMOTEFLAG;
  new$UNIONFLAG KD.UNIONFLAG%TYPE := :NEW.UNIONFLAG;
  new$BUDGETREF KD.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DELETEDATE KD.DELETEDATE%TYPE := :NEW.DELETEDATE;
  new$NAME KD.NAME%TYPE := :NEW.NAME;
  new$KD_LEVEL KD.KD_LEVEL%TYPE := :NEW.KD_LEVEL;
  new$STARTDATE KD.STARTDATE%TYPE := :NEW.STARTDATE;
  new$SHORTNAME KD.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$CREATERUSER KD.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER KD.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$EXTID KD.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER KD.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE KD.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
--
  CNT$ NUMBER(10);
  tmp$ NUMBER(15,0);
  tmp_Double$ NUMBER;
  DescrCode1$ NUMBER(10);
  DescrCode2$ NUMBER(10);
  KVSRCode1$ NUMBER(10);
  sKVSR$ VARCHAR2(3);
  sDescrCode1$ VARCHAR2(5);
  sDescrCode2$ VARCHAR2(5);
  sProgCode$ VARCHAR2(4);
  sKESR$ VARCHAR2(3);
  sKDLevel$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_KD_BI_0)
-- Version 7.00.00.1
-- - - - - - - - - - - - -

  /* Генерация Id, установка значений по умолчанию */
  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$ProgramCode is null) then 
    new$ProgramCode := 0;
  END IF;
  if (new$RemoteFlag is null) then 
    new$RemoteFlag := 0;
  END IF;
  if (new$UnionFlag is null) then 
    new$UnionFlag := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  if (new$KVSR <> 0) then
    BEGIN
      select kd_level into sKDLevel$ from KD where ((KESR = new$KESR) and (ProgramCode=new$ProgramCode)and (BudgetRef=new$BudgetRef)
      and (DESCRIPTIONCODE = new$DESCRIPTIONCODE) and (KVSR = 0))  ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (sKDLevel$ is not null) then
    new$kd_Level := sKDLevel$;
  END IF;
  /* Разделение вида дохода на значимый вид дохода и элемент */
    
  tmp$ := new$DescriptionCode;
  tmp_Double$ := tmp$ / 100;
  new$MainDescriptionCode := tmp_Double$;
  if (new$MainDescriptionCode > tmp_Double$) then 
    new$MainDescriptionCode := new$MainDescriptionCode - 1;
  END IF;
  tmp_Double$ := new$MainDescriptionCode;
  tmp_Double$ := tmp_Double$ * 100;
  new$ItemCode := tmp$ - tmp_Double$; 
  BEGIN

    /* Выбираем код КВСР по ключу */ 
    select Code into KVSRCode1$ from KVSR where (ID = new$KVSR) ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* Вычисление 20-разрядного строкового КД */
  /* Вычисление КВСР с лидирующими нулями */
  if (KVSRCode1$ = 0) then
    sKVSR$ := '000';
        
  else
    if (KVSRCode1$ < 10) then
      sKVSR$ := '00' || KVSRCode1$;
          
    else
      if (KVSRCode1$ < 100) then
        sKVSR$ := '0' || KVSRCode1$;
            
      else
        sKVSR$ := KVSRCode1$;
      END IF;
    END IF;
  END IF;
  /* Вычисление Вида дохода с лидирующими нулями */    
      
  tmp$ := new$DescriptionCode;
  tmp_Double$ := tmp$ / 100000;
  DescrCode1$ := tmp_Double$;
  if (DescrCode1$ > tmp_Double$) then 
    DescrCode1$ := DescrCode1$ - 1;
  END IF;
  tmp_Double$ := DescrCode1$;
  tmp_Double$ := tmp$ - tmp_Double$ * 100000;
  DescrCode2$ := tmp_Double$;
      
  if (DescrCode1$ = 0) then
    sDescrCode1$ := '00000';
        
  else
    if (DescrCode1$ < 10) then
      sDescrCode1$ := '0000' || DescrCode1$;
          
    else
      if (DescrCode1$ < 100) then
        sDescrCode1$ := '000' || DescrCode1$;
            
      else
        if (DescrCode1$ < 1000) then
          sDescrCode1$ := '00' || DescrCode1$;
              
        else
          if (DescrCode1$ < 10000) then
            sDescrCode1$ := '0' || DescrCode1$;
                
          else
            sDescrCode1$ := DescrCode1$;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
      
  if (DescrCode2$ = 0) then
    sDescrCode2$ := '00000';
        
  else
    if (DescrCode2$ < 10) then
      sDescrCode2$ := '0000' || DescrCode2$;
          
    else
      if (DescrCode2$ < 100) then
        sDescrCode2$ := '000' || DescrCode2$;
            
      else
        if (DescrCode2$ < 1000) then
          sDescrCode2$ := '00' || DescrCode2$;
              
        else
          if (DescrCode2$ < 10000) then
            sDescrCode2$ := '0' || DescrCode2$;
                
          else
            sDescrCode2$ := DescrCode2$;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
      
  /* Вычисление Программы с лидирующими нулями */
  if (new$programcode = 0) then
    sProgCode$ := '0000';
        
  else
    if (new$programcode < 10) then
      sProgCode$ := '000' || new$programcode;
          
    else
      if (new$programcode < 100) then
        sProgCode$ := '00' || new$programcode;
            
      else
        if (new$programcode < 1000) then
          sProgCode$ := '0' || new$programcode;
              
        else
          sProgCode$ := new$programcode;
        END IF;
      END IF;
    END IF;
  END IF;
      
  /* Вычисление КЭСР с лидирующими нулями */
  if (new$kesr = 0) then
    sKESR$ := '000';
        
  else
    if (new$kesr < 10) then
      sKESR$ := '00' || new$kesr;
          
    else
      if (new$kesr < 100) then
        sKESR$ := '0' || new$kesr;
            
      else
        sKESR$ := new$kesr;
      END IF;
    END IF;
  END IF;
  /* Объединение всех строк в одну */    
      
  new$kdvalue := sKVSR$ || sDescrCode1$ || sDescrCode2$ || sProgCode$ || sKESR$;
      
  if ((new$ID = 0) and (new$kdvalue <> '00000000000000000000') and (new$BudgetRef <> 0)) then
    RaiseException('ex_CantModify_ZeroKD');
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_KD_BI_500)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_KD (
    ID,
    REPCODE,
    CREATEDATE,
    UPDATEDATE,
    KVSR,
    DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE,
    ITEMCODE,
    PROGRAMCODE,
    KESR,
    KDVALUE,
    REMOTEFLAG,
    UNIONFLAG,
    BUDGETREF,
    DELETEDATE,
    NAME,
    KD_LEVEL,
    STARTDATE,
    SHORTNAME,
    CREATERUSER,
    UPDATERUSER,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE
  ) VALUES (
    new$ID,
    new$REPCODE,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$KVSR,
    new$DESCRIPTIONCODE,
    new$MAINDESCRIPTIONCODE,
    new$ITEMCODE,
    new$PROGRAMCODE,
    new$KESR,
    new$KDVALUE,
    new$REMOTEFLAG,
    new$UNIONFLAG,
    new$BUDGETREF,
    new$DELETEDATE,
    new$NAME,
    new$KD_LEVEL,
    new$STARTDATE,
    new$SHORTNAME,
    new$CREATERUSER,
    new$UPDATERUSER,
    new$EXTID,
    new$EXTOWNER,
    new$EXTSYNCDATE);

-- - - - - - - - - - - - -
-- AI_100 (TR_KD_AI_100)
-- Create 03.05.2005
-- Last update 02.04.2010
-- - - - - - - - - - - - -

  if (new$kvsr <> 0) then
    select count(*) into CNT$
                     from kd kd1
                     where ((kd1.kvsr = 0) and
                           ((kd1.descriptioncode-new$descriptioncode>-1) and (kd1.descriptioncode-new$descriptioncode<1)) and
                           (kd1.programcode = new$programcode) and
                           (kd1.kesr = new$kesr)) and (ROWNUM = 1);
    if (CNT$ = 0) then  
        insert into KD (KVSR, DescriptionCode, ProgramCode, KESR, Name, ShortName, RemoteFlag, kd_level)
        values (0, new$DescriptionCode, new$ProgramCode, new$KESR, new$Name, new$ShortName, new$RemoteFlag, new$kd_level);
    end if;  
  end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_KD_AI_500)
-- Last update 14.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 80)  and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_KD_IU
  INSTEAD OF UPDATE
  ON KD
  FOR EACH ROW
DECLARE
  new$ID KD.ID%TYPE := :NEW.ID;
  new$REPCODE KD.REPCODE%TYPE := :NEW.REPCODE;
  new$CREATEDATE KD.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE KD.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$KVSR KD.KVSR%TYPE := :NEW.KVSR;
  new$DESCRIPTIONCODE KD.DESCRIPTIONCODE%TYPE := :NEW.DESCRIPTIONCODE;
  new$MAINDESCRIPTIONCODE KD.MAINDESCRIPTIONCODE%TYPE := :NEW.MAINDESCRIPTIONCODE;
  new$ITEMCODE KD.ITEMCODE%TYPE := :NEW.ITEMCODE;
  new$PROGRAMCODE KD.PROGRAMCODE%TYPE := :NEW.PROGRAMCODE;
  new$KESR KD.KESR%TYPE := :NEW.KESR;
  new$KDVALUE KD.KDVALUE%TYPE := :NEW.KDVALUE;
  new$REMOTEFLAG KD.REMOTEFLAG%TYPE := :NEW.REMOTEFLAG;
  new$UNIONFLAG KD.UNIONFLAG%TYPE := :NEW.UNIONFLAG;
  new$BUDGETREF KD.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DELETEDATE KD.DELETEDATE%TYPE := :NEW.DELETEDATE;
  new$NAME KD.NAME%TYPE := :NEW.NAME;
  new$KD_LEVEL KD.KD_LEVEL%TYPE := :NEW.KD_LEVEL;
  new$STARTDATE KD.STARTDATE%TYPE := :NEW.STARTDATE;
  new$SHORTNAME KD.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$CREATERUSER KD.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER KD.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$EXTID KD.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER KD.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE KD.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
--
  tmp$ NUMBER(15,0);
  CNT$1 NUMBER(10);
  tmp_Double$ NUMBER;
  DescrCode1$ NUMBER(10);
  DescrCode2$ NUMBER(10);
  KVSRCode1$ NUMBER(10);
  sKVSR$ VARCHAR2(3);
  sDescrCode1$ VARCHAR2(5);
  sDescrCode2$ VARCHAR2(5);
  sProgCode$ VARCHAR2(4);
  sKESR$ VARCHAR2(3);
  sKDLevel$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_KD_BU_0)
-- Version 7.00.00.1
-- - - - - - - - - - - - -

  /* Установка значений по умолчанию */
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$ProgramCode is null) then 
    new$ProgramCode := 0;
  END IF;
  if (new$RemoteFlag is null) then 
    new$RemoteFlag := 0;
  END IF;
  if (new$UnionFlag is null) then 
    new$UnionFlag := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  /* Разделение вида дохода на значимый вид дохода и элемент */
    
  tmp$ := new$DescriptionCode;
  tmp_Double$ := tmp$ / 100;
  new$MainDescriptionCode := tmp_Double$;
  if (new$MainDescriptionCode > tmp_Double$) then 
    new$MainDescriptionCode := new$MainDescriptionCode - 1;
  END IF;
  tmp_Double$ := new$MainDescriptionCode;
  tmp_Double$ := tmp_Double$ * 100;
  new$ItemCode := tmp$ - tmp_Double$; 
  if (new$KVSR <> 0) then
    BEGIN
      select kd_level into sKDLevel$ from KD where ((KESR = new$KESR) and (ProgramCode=new$ProgramCode)and (BudgetRef=new$BudgetRef)
      and (DESCRIPTIONCODE = new$DESCRIPTIONCODE) and (KVSR = 0)) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (sKDLevel$ is not null) then
    new$kd_Level := sKDLevel$;
  END IF;
  BEGIN

    /* Выбираем код КВСР по ключу */ 
    select Code into KVSRCode1$ from KVSR where (ID = new$KVSR) ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* Вычисление 20-разрядного строкового КД */
  /* Вычисление КВСР с лидирующими нулями */
  if (KVSRCode1$ = 0) then
    sKVSR$ := '000';
        
  else
    if (KVSRCode1$ < 10) then
      sKVSR$ := '00' || KVSRCode1$;
          
    else
      if (KVSRCode1$ < 100) then
        sKVSR$ := '0' || KVSRCode1$;
            
      else
        sKVSR$ := KVSRCode1$;
      END IF;
    END IF;
  END IF;
  /* Вычисление Вида дохода с лидирующими нулями */
      
  tmp$ := new$DescriptionCode;
  tmp_Double$ := tmp$ / 100000;
  DescrCode1$ := tmp_Double$;
  if (DescrCode1$ > tmp_Double$) then 
    DescrCode1$ := DescrCode1$ - 1;
  END IF;
  tmp_Double$ := DescrCode1$;
  tmp_Double$ := tmp$ - tmp_Double$ * 100000;
  DescrCode2$ := tmp_Double$;

  if (DescrCode1$ = 0) then
    sDescrCode1$ := '00000';
        
  else
    if (DescrCode1$ < 10) then
      sDescrCode1$ := '0000' || DescrCode1$;
          
    else
      if (DescrCode1$ < 100) then
        sDescrCode1$ := '000' || DescrCode1$;
            
      else
        if (DescrCode1$ < 1000) then
          sDescrCode1$ := '00' || DescrCode1$;
              
        else
          if (DescrCode1$ < 10000) then
            sDescrCode1$ := '0' || DescrCode1$;
                
          else
            sDescrCode1$ := DescrCode1$;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
  if (DescrCode2$ = 0) then
    sDescrCode2$ := '00000';
        
  else
    if (DescrCode2$ < 10) then
      sDescrCode2$ := '0000' || DescrCode2$;
          
    else
      if (DescrCode2$ < 100) then
        sDescrCode2$ := '000' || DescrCode2$;
            
      else
        if (DescrCode2$ < 1000) then
          sDescrCode2$ := '00' || DescrCode2$;
              
        else
          if (DescrCode2$ < 10000) then
            sDescrCode2$ := '0' || DescrCode2$;
                
          else
            sDescrCode2$ := DescrCode2$;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
  /* Вычисление Программы с лидирующими нулями */
  if (new$programcode = 0) then
    sProgCode$ := '0000';
        
  else
    if (new$programcode < 10) then
      sProgCode$ := '000' || new$programcode;
          
    else
      if (new$programcode < 100) then
        sProgCode$ := '00' || new$programcode;
            
      else
        if (new$programcode < 1000) then
          sProgCode$ := '0' || new$programcode;
              
        else
          sProgCode$ := new$programcode;
        END IF;
      END IF;
    END IF;
  END IF;
  /* Вычисление КЭСР с лидирующими нулями */
  if (new$kesr = 0) then
    sKESR$ := '000';
        
  else
    if (new$kesr < 10) then
      sKESR$ := '00' || new$kesr;
          
    else
      if (new$kesr < 100) then
        sKESR$ := '0' || new$kesr;
            
      else
        sKESR$ := new$kesr;
      END IF;
    END IF;
  END IF;
  /* Объединение всех строк в одну */    
      
  new$kdvalue := sKVSR$ || sDescrCode1$ || sDescrCode2$ || sProgCode$ || sKESR$;
      
  if ((new$ID = 0) and (new$kdvalue <> '00000000000000000000') and (new$BudgetRef <> 0)) then
    RaiseException('ex_CantModify_ZeroKD');
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_KD SET
    ID = new$ID,
    REPCODE = new$REPCODE,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    KVSR = new$KVSR,
    DESCRIPTIONCODE = new$DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE = new$MAINDESCRIPTIONCODE,
    ITEMCODE = new$ITEMCODE,
    PROGRAMCODE = new$PROGRAMCODE,
    KESR = new$KESR,
    KDVALUE = new$KDVALUE,
    REMOTEFLAG = new$REMOTEFLAG,
    UNIONFLAG = new$UNIONFLAG,
    BUDGETREF = new$BUDGETREF,
    DELETEDATE = new$DELETEDATE,
    NAME = new$NAME,
    KD_LEVEL = new$KD_LEVEL,
    STARTDATE = new$STARTDATE,
    SHORTNAME = new$SHORTNAME,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER,
    EXTID = new$EXTID,
    EXTOWNER = new$EXTOWNER,
    EXTSYNCDATE = new$EXTSYNCDATE
  WHERE id = :old.id;

-- - - - - - - - - - - - -
-- AU_100 (TR_KD_AU_100)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (new$kvsr <> 0) then
    SELECT COUNT(*) INTO CNT$1
    from kd kd1
    where ((kd1.kvsr = 0) and
    ((kd1.descriptioncode-new$descriptioncode>-1) and (kd1.descriptioncode-new$descriptioncode<1)) and
    (kd1.programcode = new$programcode) and
    (kd1.kesr = new$kesr)
    ) AND (ROWNUM = 1)                     ;
    /* Если КВСР не 0, то нужно такую же вставить запись с КВСР=0 */
    if (not (CNT$1<> 0))
    then
      insert into KD (KVSR, DescriptionCode, ProgramCode, KESR, Name, ShortName, RemoteFlag, kd_level)
      values (0, new$DescriptionCode, new$ProgramCode, new$KESR, new$Name, new$ShortName, new$RemoteFlag, new$kd_level);
        
    END IF;
  else
    /* Если КВСР = 0, то нужно обновить связанные записи с таким же кодом, но не нулевым КВСР */
    update kd kd1 set
    name = new$name,
    ShortName = new$ShortName, 
    kd_level = new$kd_level
    where
    (kd1.kvsr <> 0) and
    ((kd1.descriptioncode-new$descriptioncode>-1) and (kd1.descriptioncode-new$descriptioncode<1)) and
    (kd1.programcode = new$programcode) and
    (kd1.kesr = new$kesr);
    /* При закрытии базового кода закрываются все связанные */
    if (new$deletedate is not null) then
      update kd kd1 set
      deletedate = new$deletedate
      where
      (kd1.kvsr <> 0) and
      ((kd1.descriptioncode-new$descriptioncode>-1) and (kd1.descriptioncode-new$descriptioncode<1)) and
      (kd1.programcode = new$programcode) and
      (kd1.kesr = new$kesr) and
      (kd1.DeleteDate is null);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_KD_AU_500)
-- Create 28.04.2005
-- Last update 14.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (80, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=80) and (RecordId=new$ID);
  end if;

END;
/
ALTER TABLE TB_InnerFinSource ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/

CREATE OR REPLACE VIEW InnerFinSource (
  ID,
  CREATEDATE,
  UPDATEDATE,
  DIRECTION,
  KVSR,
  DESCRIPTIONCODE,
  MAINDESCRIPTIONCODE,
  ITEMCODE,
  PROGRAMCODE,
  KESR,
  FINSOURCEVALUE,
  UNIONFLAG,
  REMOTEFLAG,
  BUDGETREF,
  DELETEDATE,
  NAME,
  STARTDATE,
  SHORTNAME,
  CLSASPECT,
  CREATERUSER,
  UPDATERUSER,
  IFS_LEVEL,
  EXTID,
  EXTOWNER,
  EXTSYNCDATE)
AS
  SELECT
    ID,
    CREATEDATE,
    UPDATEDATE,
    DIRECTION,
    KVSR,
    DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE,
    ITEMCODE,
    PROGRAMCODE,
    KESR,
    FINSOURCEVALUE,
    UNIONFLAG,
    REMOTEFLAG,
    BUDGETREF,
    DELETEDATE,
    NAME,
    STARTDATE,
    SHORTNAME,
    CLSASPECT,
    CREATERUSER,
    UPDATERUSER,
    IFS_LEVEL,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE
  FROM TB_InnerFinSource
/

CREATE OR REPLACE TRIGGER TR_INNERFINSOURCE_ID
  INSTEAD OF DELETE
  ON INNERFINSOURCE
  FOR EACH ROW
DECLARE
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_INNERFINSOURCE_BD_0)
-- Create 02.04.2010
-- Last update 02.04.2010
-- - - - - - - - - - - - -

  -- нельзя удалять базовый код, если есть сопоставленные ему коды
  if (:old.kvsr = 0) then
    select count(*) into CNT$
                 from InnerFinSource ifs1
                 where ((ifs1.kvsr <> 0) and
                       ((ifs1.descriptioncode-:old.descriptioncode>-1) and (ifs1.descriptioncode-:old.descriptioncode<1)) and
                       (ifs1.kesr = :old.kesr)) AND (ROWNUM = 1);
    if (CNT$ > 0) then
      RaiseException('EX_CANTDELBASECODE');
    end if;
  end if;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_INNERFINSOURCE
  WHERE id = :old.id;

-- - - - - - - - - - - - -
-- AD_500 (TR_INNERFINSOURCE_AD_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(145,:old.ID,SYSDATE);

END;
/

CREATE OR REPLACE TRIGGER TR_INNERFINSOURCE_II
  INSTEAD OF INSERT
  ON INNERFINSOURCE
  FOR EACH ROW
DECLARE
  new$ID INNERFINSOURCE.ID%TYPE := :NEW.ID;
  new$CREATEDATE INNERFINSOURCE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INNERFINSOURCE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$DIRECTION INNERFINSOURCE.DIRECTION%TYPE := :NEW.DIRECTION;
  new$KVSR INNERFINSOURCE.KVSR%TYPE := :NEW.KVSR;
  new$DESCRIPTIONCODE INNERFINSOURCE.DESCRIPTIONCODE%TYPE := :NEW.DESCRIPTIONCODE;
  new$MAINDESCRIPTIONCODE INNERFINSOURCE.MAINDESCRIPTIONCODE%TYPE := :NEW.MAINDESCRIPTIONCODE;
  new$ITEMCODE INNERFINSOURCE.ITEMCODE%TYPE := :NEW.ITEMCODE;
  new$PROGRAMCODE INNERFINSOURCE.PROGRAMCODE%TYPE := :NEW.PROGRAMCODE;
  new$KESR INNERFINSOURCE.KESR%TYPE := :NEW.KESR;
  new$FINSOURCEVALUE INNERFINSOURCE.FINSOURCEVALUE%TYPE := :NEW.FINSOURCEVALUE;
  new$UNIONFLAG INNERFINSOURCE.UNIONFLAG%TYPE := :NEW.UNIONFLAG;
  new$REMOTEFLAG INNERFINSOURCE.REMOTEFLAG%TYPE := :NEW.REMOTEFLAG;
  new$BUDGETREF INNERFINSOURCE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DELETEDATE INNERFINSOURCE.DELETEDATE%TYPE := :NEW.DELETEDATE;
  new$NAME INNERFINSOURCE.NAME%TYPE := :NEW.NAME;
  new$STARTDATE INNERFINSOURCE.STARTDATE%TYPE := :NEW.STARTDATE;
  new$SHORTNAME INNERFINSOURCE.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$CLSASPECT INNERFINSOURCE.CLSASPECT%TYPE := :NEW.CLSASPECT;
  new$CREATERUSER INNERFINSOURCE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER INNERFINSOURCE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$IFS_LEVEL INNERFINSOURCE.IFS_LEVEL%TYPE := :NEW.IFS_LEVEL;
  new$EXTID INNERFINSOURCE.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER INNERFINSOURCE.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE INNERFINSOURCE.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
--
  CNT$ NUMBER(10);
  tmp$ NUMBER(15,0);
  DescrCode1 NUMBER(10);
  DescrCode2 NUMBER(10);
  KVSRCode$ NUMBER(10);
  sKVSR VARCHAR2(3);
  sDescrCode1 VARCHAR2(7);
  sDescrCode2 VARCHAR2(7);
  sKESR VARCHAR2(3);
  sIFSLevel$ NUMBER(10);
  sDirection$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_INNERFINSOURCE_BI_0)
-- Last update 27.10.2009
-- - - - - - - - - - - - -

  -- Генерация Id, установка значений по умолчанию
  IF (new$ID IS NULL) THEN SELECT g_Shared.NEXTVAL INTO new$ID FROM DUAL; END IF;
  IF (new$KVSR IS NULL) THEN new$KVSR := 0; END IF;
  IF (new$KESR IS NULL) THEN new$KESR := 0; END IF;
  IF (new$ClsAspect IS NULL) THEN new$ClsAspect := 0; END IF;
  if (new$UnionFlag is null) then new$UnionFlag := 0; END IF;
  if (new$RemoteFlag is null) then new$RemoteFlag := 0; END IF;
  if (new$BudgetRef is null) then new$BudgetRef := 0; end if;

  /* Для подведомственных берем уровень базового*/
  if (new$KVSR <> 0) then
    BEGIN
      select IFS_Level, Direction into sIFSLevel$, sDirection$ from innerfinsource where ((KESR = new$KESR) and (BudgetRef=new$BudgetRef)
      and (DESCRIPTIONCODE = new$DESCRIPTIONCODE) and (KVSR = 0))  ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (sIFSLevel$ is not null) then
    new$IFS_Level := sIFSLevel$;
  END IF;
  if (sDirection$ is not null) then
    new$Direction := sDirection$;
  END IF;

  -- Для внутренних источников направление определяется по коду операции ГС
  --   6xx, 8xx - погашение
  IF (new$Direction IS NULL) THEN
    if ((new$KESR between 300 and 399) or (new$KESR between 500 and 599)or (new$KESR between 800 and 899))
    THEN
      new$Direction := -1;
    ELSE
      new$Direction := 1;
    END IF;
  END IF;

  /*  Выбираем код КВСР по ключу */ 
  BEGIN
    select Code into KVSRCode$ from KVSR where (ID = new$KVSR);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      KVSRCode$ := NULL;
  END;    

  -- Вычисление 20-разрядного строкового кода источника
  -- Вычисление КВСР с лидирующими нулями
  if (KVSRCode$ = 0) then
      sKVSR := '000';
  elsif (KVSRCode$ < 10) then
      sKVSR := '00' || KVSRCode$;
  elsif (KVSRCode$ < 100) then
      sKVSR := '0' || KVSRCode$;
  else
      sKVSR := KVSRCode$;
  END IF;

  -- Заполнение Значимого вида источника, элемента, программы
  tmp$ := new$DescriptionCode;
  DescrCode1 := TRUNC (tmp$ / 1000000);

  IF (DescrCode1 * 1000000 > tmp$) THEN
    DescrCode1 := DescrCode1 - 1;
  END IF;

  new$MainDescriptionCode := DescrCode1;          -- Значимый вид источников
  DescrCode2 := tmp$ - DescrCode1 * 1000000;
  DescrCode1 := TRUNC (DescrCode2 / 10000);

  IF (DescrCode1 * 10000 > DescrCode2) THEN
    DescrCode1 := DescrCode1 - 1;
  END IF;

  new$ItemCode := DescrCode1;                                     --Элемент
  new$ProgramCode := DescrCode2 - DescrCode1 * 10000;             --Программа
  -- Вычисление Вида источника с лидирующими нулями
  DescrCode1 := TRUNC (tmp$ / 10000000);

  IF (DescrCode1 * 10000000 > tmp$) THEN
    DescrCode1 := DescrCode1 - 1;
  END IF;

  DescrCode2 := tmp$ - DescrCode1 * 10000000;

  IF (DescrCode1 = 0) THEN
    sDescrCode1 := '0000000';
  ELSIF (DescrCode1 < 10) THEN
    sDescrCode1 := '000000' || DescrCode1;
  ELSIF (DescrCode1 < 100) THEN
    sDescrCode1 := '00000' || DescrCode1;
  ELSIF (DescrCode1 < 1000) THEN
    sDescrCode1 := '0000' || DescrCode1;
  ELSIF (DescrCode1 < 10000) THEN
    sDescrCode1 := '000' || DescrCode1;
  ELSIF (DescrCode1 < 100000) THEN
    sDescrCode1 := '00' || DescrCode1;
  ELSIF (DescrCode1 < 1000000) THEN
    sDescrCode1 := '0' || DescrCode1;
  ELSE
    sDescrCode1 := DescrCode1;
  END IF;

  IF (DescrCode2 = 0) THEN
    sDescrCode2 := '0000000';
  ELSIF (DescrCode2 < 10) THEN
    sDescrCode2 := '000000' || DescrCode2;
  ELSIF (DescrCode2 < 100) THEN
    sDescrCode2 := '00000' || DescrCode2;
  ELSIF (DescrCode2 < 1000) THEN
    sDescrCode2 := '0000' || DescrCode2;
  ELSIF (DescrCode2 < 10000) THEN
    sDescrCode2 := '000' || DescrCode2;
  ELSIF (DescrCode2 < 100000) THEN
    sDescrCode2 := '00' || DescrCode2;
  ELSIF (DescrCode2 < 1000000) THEN
    sDescrCode2 := '0' || DescrCode2;
  ELSE
    sDescrCode2 := DescrCode2;
  END IF;

  -- Вычисление КЭСР с лидирующими нулями
  IF (new$kesr = 0) THEN
    sKESR := '000';
  ELSIF (new$kesr < 10) THEN
    sKESR := '00' || new$kesr;
  ELSIF (new$kesr < 100) THEN
    sKESR := '0' || new$kesr;
  ELSE
    sKESR := new$kesr;
  END IF;

  -- Объединение всех строк в одну
  new$FinSourceValue := sKVSR || sDescrCode1 || sDescrCode2 || sKESR;

  if ((new$ID = 0) and (new$FinSourceValue <> '00000000000000000000')) then
    RaiseException('ex_CantModify_ZeroIFS');
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_INNERFINSOURCE_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_INNERFINSOURCE (
    ID,
    CREATEDATE,
    UPDATEDATE,
    DIRECTION,
    KVSR,
    DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE,
    ITEMCODE,
    PROGRAMCODE,
    KESR,
    FINSOURCEVALUE,
    UNIONFLAG,
    REMOTEFLAG,
    BUDGETREF,
    DELETEDATE,
    NAME,
    STARTDATE,
    SHORTNAME,
    CLSASPECT,
    CREATERUSER,
    UPDATERUSER,
    IFS_LEVEL,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE
  ) VALUES (
    new$ID,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$DIRECTION,
    new$KVSR,
    new$DESCRIPTIONCODE,
    new$MAINDESCRIPTIONCODE,
    new$ITEMCODE,
    new$PROGRAMCODE,
    new$KESR,
    new$FINSOURCEVALUE,
    new$UNIONFLAG,
    new$REMOTEFLAG,
    new$BUDGETREF,
    new$DELETEDATE,
    new$NAME,
    new$STARTDATE,
    new$SHORTNAME,
    new$CLSASPECT,
    new$CREATERUSER,
    new$UPDATERUSER,
    new$IFS_LEVEL,
    new$EXTID,
    new$EXTOWNER,
    new$EXTSYNCDATE);

-- - - - - - - - - - - - -
-- AI_100 (TR_INNERFINSOURCE_AI_100)
-- Last update 02.04.2010
-- - - - - - - - - - - - -

  if (new$kvsr <> 0) then
    select count(*) into CNT$
                     from InnerFinSource ifs1
                     where ((ifs1.kvsr = 0) and
                           ((ifs1.descriptioncode-new$descriptioncode>-1) and (ifs1.descriptioncode-new$descriptioncode<1)) and
                           (ifs1.kesr = new$kesr)) AND (ROWNUM = 1);
    if (CNT$ = 0) then
        insert into InnerFinSource (KVSR, DescriptionCode, KESR, Name, ShortName, CLSAspect, RemoteFlag, Direction, IFS_Level)
        values (0, new$DescriptionCode, new$KESR, new$Name, new$ShortName, new$CLSAspect, new$RemoteFlag, new$direction, new$IFS_Level);
    end if; 
  end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_INNERFINSOURCE_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 145) and (RecordId = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_INNERFINSOURCE_IU
  INSTEAD OF UPDATE
  ON INNERFINSOURCE
  FOR EACH ROW
DECLARE
  new$ID INNERFINSOURCE.ID%TYPE := :NEW.ID;
  new$CREATEDATE INNERFINSOURCE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE INNERFINSOURCE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$DIRECTION INNERFINSOURCE.DIRECTION%TYPE := :NEW.DIRECTION;
  new$KVSR INNERFINSOURCE.KVSR%TYPE := :NEW.KVSR;
  new$DESCRIPTIONCODE INNERFINSOURCE.DESCRIPTIONCODE%TYPE := :NEW.DESCRIPTIONCODE;
  new$MAINDESCRIPTIONCODE INNERFINSOURCE.MAINDESCRIPTIONCODE%TYPE := :NEW.MAINDESCRIPTIONCODE;
  new$ITEMCODE INNERFINSOURCE.ITEMCODE%TYPE := :NEW.ITEMCODE;
  new$PROGRAMCODE INNERFINSOURCE.PROGRAMCODE%TYPE := :NEW.PROGRAMCODE;
  new$KESR INNERFINSOURCE.KESR%TYPE := :NEW.KESR;
  new$FINSOURCEVALUE INNERFINSOURCE.FINSOURCEVALUE%TYPE := :NEW.FINSOURCEVALUE;
  new$UNIONFLAG INNERFINSOURCE.UNIONFLAG%TYPE := :NEW.UNIONFLAG;
  new$REMOTEFLAG INNERFINSOURCE.REMOTEFLAG%TYPE := :NEW.REMOTEFLAG;
  new$BUDGETREF INNERFINSOURCE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$DELETEDATE INNERFINSOURCE.DELETEDATE%TYPE := :NEW.DELETEDATE;
  new$NAME INNERFINSOURCE.NAME%TYPE := :NEW.NAME;
  new$STARTDATE INNERFINSOURCE.STARTDATE%TYPE := :NEW.STARTDATE;
  new$SHORTNAME INNERFINSOURCE.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$CLSASPECT INNERFINSOURCE.CLSASPECT%TYPE := :NEW.CLSASPECT;
  new$CREATERUSER INNERFINSOURCE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER INNERFINSOURCE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$IFS_LEVEL INNERFINSOURCE.IFS_LEVEL%TYPE := :NEW.IFS_LEVEL;
  new$EXTID INNERFINSOURCE.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER INNERFINSOURCE.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE INNERFINSOURCE.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
--
  tmp$ NUMBER(15,0);
  tmp_Double$ NUMBER;
  DescrCode1$ NUMBER(10);
  DescrCode2$ NUMBER(10);
  KVSRCode1$ NUMBER(10);
  sKVSR$ VARCHAR2(3);
  sDescrCode1$ VARCHAR2(7);
  sDescrCode2$ VARCHAR2(7);
  sKESR$ VARCHAR2(3);
  CNT$1 NUMBER(10);
  sIFSLevel$ NUMBER(10);
  sDirection$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INNERFINSOURCE_BU_0)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Установка значений по умолчанию */
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$ClsAspect is null) then 
    new$ClsAspect := 0;
  END IF;
  if (new$RemoteFlag is null) then 
    new$RemoteFlag := 0;
  END IF;
  if (new$UnionFlag is null) then 
    new$UnionFlag := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  
  /* Для подведомственных берем уровень базового*/
  if (new$KVSR <> 0) then
    BEGIN
      select IFS_Level, Direction into sIFSLevel$, sDirection$ from innerfinsource where ((KESR = new$KESR) and (BudgetRef=new$BudgetRef)
      and (DESCRIPTIONCODE = new$DESCRIPTIONCODE) and (KVSR = 0))  ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (sIFSLevel$ is not null) then
    new$IFS_Level := sIFSLevel$;
  END IF;
  if (sDirection$ is not null) then
    new$Direction := sDirection$;
  END IF;  
  
  /* Для внутренних источников направление определяется по коду операции ГС
       Погашение – это кода с косгу=3хх,5хх,8хх */
  if ((new$Direction is null)or(new$kesr <> :old.kesr)) then
    if ((new$KESR between 300 and 399) or (new$KESR between 500 and 599)or (new$KESR between 800 and 899))
    then
      new$Direction := -1;
          
    else
      new$Direction := 1;
      
    END IF;
  END IF;
  BEGIN

    /* Выбираем код КВСР по ключу */ 
    select Code into KVSRCode1$ from KVSR where (ID = new$KVSR) ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
    
  /* Вычисление 20-разрядного строкового кода источника */
  /* Вычисление КВСР с лидирующими нулями */
  if (KVSRCode1$ = 0) then
    sKVSR$ := '000';
        
  else
    if (KVSRCode1$ < 10) then
      sKVSR$ := '00' || KVSRCode1$;
          
    else
      if (KVSRCode1$ < 100) then
        sKVSR$ := '0' || KVSRCode1$;
            
      else
        sKVSR$ := KVSRCode1$;
      END IF;
    END IF;
  END IF;
  /* Заполнение Значимого вида источника, элемента, программы */
      
  tmp$ := new$DescriptionCode;
  tmp_Double$ := tmp$ / 1000000;
  DescrCode1$ := tmp_Double$;
  /* надо чтобы округлилось отбрасыванием дробной части,
      если после округления число увеличилось, то надо вычесть 1 */
  if (DescrCode1$  > tmp_Double$) then 
    DescrCode1$ := DescrCode1$ - 1;
  END IF;
  new$MainDescriptionCode := DescrCode1$; /* Значимый вид источников */
  /* сначала присваиваем дробному для совместимости типов */    
  tmp_Double$ := DescrCode1$;
  tmp_Double$ := tmp$ - tmp_Double$ * 1000000;
  DescrCode2$ := tmp_Double$;
  tmp_Double$ := DescrCode2$ / 10000;
  DescrCode1$ := tmp_Double$;
  /* такой же приём с округлением */
  if (DescrCode1$ > tmp_Double$) then 
    DescrCode1$ := DescrCode1$ - 1;
  END IF;
  new$ItemCode := DescrCode1$; /* Элемент*/
  tmp_Double$ := DescrCode2$ - DescrCode1$ * 10000;
  new$ProgramCode := tmp_Double$; /* Программа*/
  /* Вычисление Вида источника с лидирующими нулями */
      
  tmp_Double$ := tmp$ / 10000000;
  DescrCode1$ := tmp_Double$;
  if (DescrCode1$ > tmp_Double$) then 
    DescrCode1$ := DescrCode1$ - 1;
  END IF;
  tmp_Double$ := DescrCode1$;
  tmp_Double$ := tmp$ - tmp_Double$ * 10000000;
  DescrCode2$ := tmp_Double$;
  if (DescrCode1$ = 0) then
    sDescrCode1$ := '0000000';
        
  else
    if (DescrCode1$ < 10) then
      sDescrCode1$ := '000000' || DescrCode1$;
          
    else
      if (DescrCode1$ < 100) then
        sDescrCode1$ := '00000' || DescrCode1$;
            
      else
        if (DescrCode1$ < 1000) then
          sDescrCode1$ := '0000' || DescrCode1$;
              
        else
          if (DescrCode1$ < 10000) then
            sDescrCode1$ := '000' || DescrCode1$;
                
          else
            if (DescrCode1$ < 100000) then
              sDescrCode1$ := '00' || DescrCode1$;
                  
            else
              if (DescrCode1$ < 1000000) then
                sDescrCode1$ := '0' || DescrCode1$;
                    
              else
                sDescrCode1$ := DescrCode1$;
              END IF;
            END IF;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
  if (DescrCode2$ = 0) then
    sDescrCode2$ := '0000000';
        
  else
    if (DescrCode2$ < 10) then
      sDescrCode2$ := '000000' || DescrCode2$;
          
    else
      if (DescrCode2$ < 100) then
        sDescrCode2$ := '00000' || DescrCode2$;
            
      else
        if (DescrCode2$ < 1000) then
          sDescrCode2$ := '0000' || DescrCode2$;
              
        else
          if (DescrCode2$ < 10000) then
            sDescrCode2$ := '000' || DescrCode2$;
                
          else
            if (DescrCode2$ < 100000) then
              sDescrCode2$ := '00' || DescrCode2$;
                  
            else
              if (DescrCode2$ < 1000000) then
                sDescrCode2$ := '0' || DescrCode2$;
                    
              else
                sDescrCode2$ := DescrCode2$;
              END IF;
            END IF;
          END IF;
        END IF;
      END IF;
    END IF;
  END IF;
  /* Вычисление КЭСР с лидирующими нулями */
  if (new$kesr = 0) then
    sKESR$ := '000';
        
  else
    if (new$kesr < 10) then
      sKESR$ := '00' || new$kesr;
          
    else
      if (new$kesr < 100) then
        sKESR$ := '0' || new$kesr;
            
      else
        sKESR$ := new$kesr;
      END IF;
    END IF;
  END IF;
  /* Объединение всех строк в одну */
      
  new$FinSourceValue := sKVSR$ || sDescrCode1$ || sDescrCode2$ || sKESR$;
      
  if ((new$ID = 0) and (new$FinSourceValue <> '00000000000000000000') and (new$BudgetRef <> 0)) then
    RaiseException('ex_CantModify_ZeroIFS');
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INNERFINSOURCE SET
    ID = new$ID,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    DIRECTION = new$DIRECTION,
    KVSR = new$KVSR,
    DESCRIPTIONCODE = new$DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE = new$MAINDESCRIPTIONCODE,
    ITEMCODE = new$ITEMCODE,
    PROGRAMCODE = new$PROGRAMCODE,
    KESR = new$KESR,
    FINSOURCEVALUE = new$FINSOURCEVALUE,
    UNIONFLAG = new$UNIONFLAG,
    REMOTEFLAG = new$REMOTEFLAG,
    BUDGETREF = new$BUDGETREF,
    DELETEDATE = new$DELETEDATE,
    NAME = new$NAME,
    STARTDATE = new$STARTDATE,
    SHORTNAME = new$SHORTNAME,
    CLSASPECT = new$CLSASPECT,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER,
    IFS_LEVEL = new$IFS_LEVEL,
    EXTID = new$EXTID,
    EXTOWNER = new$EXTOWNER,
    EXTSYNCDATE = new$EXTSYNCDATE
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_100 (TR_INNERFINSOURCE_AU_100)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (new$kvsr <> 0) then
    SELECT COUNT(*) INTO CNT$1
    from InnerFinSource ifs1
    where ((ifs1.kvsr = 0) and
    ((ifs1.descriptioncode-new$descriptioncode>-1) and (ifs1.descriptioncode-new$descriptioncode<1)) and
    (ifs1.kesr = new$kesr)
    ) AND (ROWNUM = 1)                   ;
    if (not (CNT$1<> 0))
    then  
      insert into InnerFinSource (KVSR, DescriptionCode, KESR, Name, ShortName, CLSAspect, RemoteFlag, IFS_Level)
      values (0, new$DescriptionCode, new$KESR, new$Name, new$ShortName, new$CLSAspect, new$RemoteFlag, new$IFS_Level);
      
    END IF;
  else
    /* Если КВСР = 0, то нужно обновить связанные записи с таким же кодом, но не нулевым КВСР */
    update InnerFinSource ifs1 set
    name = new$name,
    ShortName = new$ShortName,
    ifs_level = new$ifs_level,
    Direction = new$Direction
    where
    (ifs1.kvsr <> 0) and
    ((ifs1.descriptioncode-new$descriptioncode>-1) and (ifs1.descriptioncode-new$descriptioncode<1)) and
    (ifs1.kesr = new$kesr);
    /* При закрытии базового кода закрываются все связанные */
    if (new$deletedate is not null) then
      update InnerFinSource ifs1 set
      deletedate = new$deletedate
      where
      (ifs1.kvsr <> 0) and
      ((ifs1.descriptioncode-new$descriptioncode>-1) and (ifs1.descriptioncode-new$descriptioncode<1)) and
      (ifs1.kesr = new$kesr) and
      (ifs1.DeleteDate is null);
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_INNERFINSOURCE_AU_500)
-- Create 28.04.2005
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (145, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=145) and (RecordId=new$ID);
  end if;

END;
/
ALTER TABLE BudAllocationCls ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE AssignmentKind ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
ALTER TABLE InvestObject ADD (
  ExtID VARCHAR2(50),/* UID для обмена с внешними системами, обычно GUID */
  ExtOwner VARCHAR2(50),/* Название внешней системы */
  ExtSyncDate DATE/* дата, время получения, последнего обновления */
)
/
commit work
/

-- #########################################################
-- #########################################################
-- Add_Signers_to_ED_OUTPAYDOC.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет поле Signers*/
ALTER TABLE ed_outpaydoc ADD (
  Signers VARCHAR2(1000)
)
/
commit work 
/

-- #########################################################
-- #########################################################
-- Add_Environment_Rights.sql
-- #########################################################
-- #########################################################

/* Вставка права на выполнение контролей, выдача прав на все эелементы окружения группе ALL*/
insert into ObjectKind(id, Name) values (31000000, 'Импорт')
/
insert into ObjectKind(id, Name) values (32000000, 'Экспорт')
/
insert into DBRights(RightKindRef, ObjectKindRef) values (4, 28000000)
/
insert into DBRights(RightKindRef, ObjectKindRef) values (4, 31000000)
/
insert into DBRights(RightKindRef, ObjectKindRef) values (4, 32000000)
/
insert into GROUPSRIGHTS (GROUPREF, RIGHTREF, ISREJECT, OBJREF, OBJECTKINDREF)
select 0, id, 0, 0, 28000000
from DBRights
where (RightKindRef = 4) and (ObjectKindRef = 28000000)
/
insert into GROUPSRIGHTS (GROUPREF, RIGHTREF, ISREJECT, OBJREF, OBJECTKINDREF)
select 0, id, 0, 0, 31000000
from DBRights
where (RightKindRef = 4) and (ObjectKindRef = 31000000)
/
insert into GROUPSRIGHTS (GROUPREF, RIGHTREF, ISREJECT, OBJREF, OBJECTKINDREF)
select 0, id, 0, 0, 32000000
from DBRights
where (RightKindRef = 4) and (ObjectKindRef = 32000000)
/
commit work 
/


-- #########################################################
-- #########################################################
-- Update_WritNotifyCLSPart.sql
-- #########################################################
-- #########################################################

Update writnotifyclspart set handbookid=49 where ID=18
/
Commit work 
/

-- #########################################################
-- #########################################################
-- alter_10.00_Year4.sql
-- #########################################################
-- #########################################################

/* >alter_Cls_AddFields.sql, Create_InvestObject.sql
Поля сумм Четвертый плановый год, Остальные плановые года в таблицы BudgetData, UNIONNOTIFYDETAIL, PAYMENTSCHEDULE
InvestObject.SubsidyCls
*/
ALTER TABLE BudgetData ADD (
  SummaYear4 NUMBER(15,2) default 0,/* Четвертый плановый год */
  SummaOtherYears NUMBER(15,2) default 0/* Остальные плановые года */
)
/
commit work
/
update BudgetData set
  SummaYear4 = 0,
  SummaOtherYears = 0
/
commit work
/
-- CREATE TRIGGER tr_BudgetData_bi
CREATE OR REPLACE TRIGGER TR_BUDGETDATA_BI
  BEFORE INSERT
  ON BUDGETDATA
  FOR EACH ROW
DECLARE
  OrgRefByAcc$ NUMBER(10);
  CapClsType$ NUMBER(10);
  AutoKesrCorr$ NUMBER(10);
  doubleUse1$ NUMBER(10);
  BALBOFlag1$ NUMBER(10);
  AllowDivideBA1$ NUMBER(10);
  StimateKind1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_BUDGETDATA_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;
  IF (:new.KFSR IS NULL) THEN  
    :new.KFSR := 0;
  END IF;
  IF (:new.KVSR IS NULL) THEN  
    :new.KVSR := 0;
  END IF;
  IF (:new.KVR IS NULL) THEN  
    :new.KVR := 0;
  END IF;
  IF (:new.KCSR IS NULL) THEN  
    :new.KCSR := 0;
  END IF;
  IF (:new.KESR IS NULL) THEN  
    :new.KESR := 0;
  END IF;
  IF (:new.SubKESR IS NULL) THEN  
    :new.SubKESR := 0;
  END IF;
  IF (:new.RegionCLS IS NULL) THEN  
    :new.RegionCLS := 0;
  END IF;
  IF (:new.DirectionCls IS NULL) THEN 
    :new.DirectionCls := 0;
  END IF;
  IF (:new.FundsSource IS NULL) THEN 
    :new.FundsSource := 0;
  END IF;
  IF (:new.KD IS NULL) THEN 
    :new.KD := 0;
  END IF;
  IF (:new.subkd IS NULL) THEN 
    :new.subkd := 0;
  END IF;
  IF (:new.Fact IS NULL) THEN  
    :new.Fact := 0;
  END IF;
  IF (:new.FacialAcc_Cls IS NULL) THEN 
    :new.FacialAcc_Cls := 0;
  END IF;
  IF (:new.KESRCorr IS NULL) THEN 
    :new.KESRCorr := 0;
  END IF;
  IF (:new.AssignmentKind IS NULL) THEN 
    :new.AssignmentKind := 0;
  END IF;
  IF (:new.Quarter1 IS NULL) THEN  
    :new.Quarter1 := 0;
  END IF;
  IF (:new.Quarter2 IS NULL) THEN  
    :new.Quarter2 := 0;
  END IF;
  IF (:new.Quarter3 IS NULL) THEN  
    :new.Quarter3 := 0;
  END IF;
  IF (:new.Quarter4 IS NULL) THEN  
    :new.Quarter4 := 0;
  END IF;
  IF (:new.DayPlanSumma IS NULL) THEN 
    :new.DayPlanSumma := 0;
  END IF;
  IF (:new.FinType IS NULL) THEN  
    :new.FinType := 0;
  END IF;
  IF (:new.MeansType IS NULL) THEN 
    :new.MeansType := 0;
  END IF;
  IF (:new.DepartmentCls IS NULL) THEN 
    :new.DepartmentCls := 0;
  END IF;
  /* заполнение поля бух. операции и классификации по умолчанию */
  IF (:new.IFS IS NULL) THEN 
    :new.IFS := 0;
  END IF;
  IF (:new.BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;
  BEGIN

    /* Заполнение Бюджета. Безусловно по мастеру*/
    SELECT bn.BudgetRef      INTO :new.BudgetRef FROM BudNotify bn
    WHERE bn.id = :new.RecordIndex
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  IF (:new.Month01 IS NULL) THEN  
    :new.Month01 := 0;
  END IF;
  IF (:new.Month02 IS NULL) THEN  
    :new.Month02 := 0;
  END IF;
  IF (:new.Month03 IS NULL) THEN  
    :new.Month03 := 0;
  END IF;
  IF (:new.Month04 IS NULL) THEN  
    :new.Month04 := 0;
  END IF;
  IF (:new.Month05 IS NULL) THEN  
    :new.Month05 := 0;
  END IF;
  IF (:new.Month06 IS NULL) THEN  
    :new.Month06 := 0;
  END IF;
  IF (:new.Month07 IS NULL) THEN  
    :new.Month07 := 0;
  END IF;
  IF (:new.Month08 IS NULL) THEN  
    :new.Month08 := 0;
  END IF;
  IF (:new.Month09 IS NULL) THEN  
    :new.Month09 := 0;
  END IF;
  IF (:new.Month10 IS NULL) THEN  
    :new.Month10 := 0;
  END IF;
  IF (:new.Month11 IS NULL) THEN  
    :new.Month11 := 0;
  END IF;
  IF (:new.Month12 IS NULL) THEN  
    :new.Month12 := 0;
  END IF;
  IF (:new.SummaYear1 IS NULL) THEN  
    :new.SummaYear1 := 0;
  END IF;
  IF (:new.SummaYear2 IS NULL) THEN  
    :new.SummaYear2 := 0;
  END IF;
  IF (:new.SummaYear3 IS NULL) THEN  
    :new.SummaYear3 := 0;
  END IF;
  IF (:new.SummaYear4 IS NULL) THEN  
    :new.SummaYear4 := 0;
  END IF;
  IF (:new.SummaOtherYears IS NULL) THEN  
    :new.SummaOtherYears := 0; 
  END IF;
  BEGIN

    SELECT
    c.BA_LBO_FLAG
    INTO
    BALBOFlag1$  FROM
    BudNotify c
    WHERE
    c.id = :new.RecordIndex
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* Смета по ПД*/
  IF (:new.ProgIndex = 262) THEN
    GetIntConst(32, 43,StimateKind1$);
    IF ((StimateKind1$  = 0) OR (StimateKind1$  IS NULL)) THEN
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
         
    ELSE
      IF (StimateKind1$  = 1) THEN
        :new.Quarter1 := :new.SummaYear1;
             
      ELSE
        :new.Quarter1 := :new.Month01 + :new.Month02 +:new.Month03;
        :new.Quarter2 := :new.Month04 + :new.Month05 +:new.Month06;
        :new.Quarter3 := :new.Month07 + :new.Month08 +:new.Month09;
        :new.Quarter4 := :new.Month10 + :new.Month11 +:new.Month12;
        :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
             
      END IF; 
    END IF;
  END IF;
  /* СБР(расходы)*/
  IF (:new.ProgIndex = 260) THEN
    GetIntConst(32, 30,doubleUse1$);
    GetIntConst(32, 40,AllowDivideBA1$);
    IF ((doubleUse1$=1) AND ((BALBOFlag1$  <> 1) OR (AllowDivideBA1$ = 1))) THEN  /* если используется совмещенное ведение КП и СБР, то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;
  END IF;
  /* СБР(источники)*/
  IF (:new.ProgIndex = 264) THEN
    GetIntConst(32, 34,doubleUse1$);
    GetIntConst(32, 40,AllowDivideBA1$);
    IF ((doubleUse1$=1) AND ((BALBOFlag1$  <> 1) OR (AllowDivideBA1$ = 1))) THEN  /* если используется совмещенное ведение КП и СБР, то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;
  END IF;
  /* БР ГРБС(расходы)*/
  IF (:new.ProgIndex = 32) THEN
    GetIntConst(32, 31,doubleUse1$);
    GetIntConst(32, 40,AllowDivideBA1$);
    IF ((doubleUse1$=1) AND ((BALBOFlag1$  <> 1) OR (AllowDivideBA1$ = 1))) THEN  /* если используется совмещенное ведение КП по ПБС и БР , то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;
  END IF;
  /* БР ГРБС(источники)*/
  IF (:new.ProgIndex = 215) THEN
    GetIntConst(32, 35,doubleUse1$);
    GetIntConst(32, 40,AllowDivideBA1$);
    IF ((doubleUse1$=1) AND ((BALBOFlag1$  <> 1) OR (AllowDivideBA1$ = 1))) THEN  /* если используется совмещенное ведение КП по АИФ и БР, то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;/* 
   IF ((NEW.TransfertOrg_Ref IS NULL) AND (NEW.REGIONCLS <> 0)) THEN
      SELECT Organizations FROM REGIONCLS
        WHERE NEW.REGIONCLS = ID
      INTO NEW.TransfertOrg_Ref;
  */
  END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_BUDGETDATA_BI_100)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (:new.ClsType is NULL) then
    BEGIN
      select
      bn.ClsType
      into
      CapClsType$     from
      BudNotify bn
      where
      bn.id = :new.RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (CapClsType$  = 3) then
      if (:new.IFS <> 0) then
        :new.ClsType := 1; /* если это источник и забыли ввести ClsType */
            
      else
        if (:new.KD <> 0) then
          :new.ClsType := 2; /* доходная*/
                
        else
          :new.ClsType := 0; /* расходная*/
        END IF;    
      END IF;
    else
      :new.ClsType := CapClsType$;
      
    END IF;
  END IF;
  IF ((:new.ClsType = 0) AND ((:new.IFS <> 0)or(:new.KD <> 0))) THEN  /* классификация расходная */
    RaiseException('EX_WRONGBUDCLS');
  END IF;
  IF ((:new.ClsType <> 0) AND (
  (:new.KVSR <> 0) OR (:new.KFSR <> 0) OR
  (:new.KCSR <> 0) OR (:new.KVR <> 0) OR
  (:new.KESR <> 0)
  )) THEN
    RaiseException('EX_WRONGBUDCLS');
  END IF;
  if (((:new.ClsType = 1)and(:new.KD <> 0))or((:new.ClsType = 2)and(:new.IFS <> 0))) then
    RaiseException('EX_WRONGBUDCLS');
  END IF;
  IF ((:new.ClsType <> 0) AND (:new.ClsType <> 1) AND (:new.ClsType <> 2)) THEN /* неверный тип классификации*/
    RaiseException('EX_WRONGBUDCLSTYPE');
  END IF;
  IF (:new.ACC_REF IS NOT NULL) THEN /* Определяем организацию по р/с */
    BEGIN
      SELECT oa.ORG_REF
      INTO OrgRefByAcc$     FROM ORG_ACCOUNTS oa
      WHERE (oa.ID = :new.ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (:new.FacialAcc_CLS = 0) then 
      :new.Org_Ref := OrgRefByAcc$;
      
    END IF;
  END IF;
  /* если л\с указан, то организация в детали и организация р\с должна соответствовать организации л\с, иначе р\с очищаем*/
  if (:new.FacialAcc_CLS <> 0) then
    BEGIN
      SELECT
      fac.ORG_REF
      INTO :new.Org_Ref     FROM
      FacialACC_CLS fac
      WHERE
      (fac.ID = :new.FacialAcc_CLS)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (OrgRefByAcc$<>:new.Org_Ref) then 
      :new.ACC_REF := null;
      
    END IF;
  END IF;
  if ((:new.ProgIndex in (252, 253))and(:new.FacialAcc_CLS = 0)) then
    BEGIN
      SELECT
      bn.FacialAccCLS
      INTO :new.FacialAcc_CLS     FROM
      BudNotify bn
      WHERE
      (bn.ID = :new.RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_200 (TR_BUDGETDATA_BI_200)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* Для всех прогиндексов с расходной классификацией 32-БР, 260-СБР, 261-КП, 262-Сметы по ПД, 263-Бюджет, 268-КП по ПБС */
  if (:new.ProgIndex in (32, 260, 261, 262, 263, 268)) then
    /* для прогиднекса бюджетной росписи расходов(32 БР ГРБС(расходы)) 
         анализируем константу использования детализации ЭКР(расходы):
         при значении =0 сносим ЭКР в корреспондирующий ЭКР,
         при значении =1 не заполняем,
         при значении =2 заполняем в 0 корреспондирующий ЭКР.*//* для прогиндекса СБР расходов 260 СБР(расходы)
         анализируем константу использования детализации ЭКР:
         при значении =2 заполняем в 0 ЭКР и корреспондирующий ЭКР.*/
    GetIntConst(32, 25,AutoKesrCorr$);
    if (:new.ProgIndex = 32) then /* БР ГРБС(расходы)*/
      if (AutoKesrCorr$  = 0) then
        :new.KesrCorr := :new.Kesr;
              
      else
        if (AutoKesrCorr$  = 2) then
          :new.KesrCorr := 0;
        END IF;    
      END IF;
    else 
      if ((:new.ProgIndex = 260)and (AutoKesrCorr$  = 2)) then  /* СБР(расходы)*/
        :new.KesrCorr := 0;
        :new.Kesr := 0;     
              
      else 
        :new.KesrCorr := :new.Kesr; /* Для остальных прогиндексов всегда сносим ЭКР в корреспондирующий ЭКР*/
      END IF;  
    END IF;
  else
    /* Для всех прогиндексов с источниковой классификацией 215-БР, 264-СБР, 265-КП, 267-Бюджет, 271-КП по ПБС */
    if (:new.ProgIndex in (215, 264, 265, 267, 271)) then
      /* для прогиднекса бюджетной росписи источников(215 БР ГАИФ (источники))
         анализируем константу использования детализации ЭКР(источники):
         при значении =0 сносим ЭКР в корреспондирующий ЭКР,
         при значении =1 не заполняем. значение 2 для источников отсутствует.
         Для остальных прогиндексов всегда сносим ЭКР в корреспондирующий ЭКР*/
      GetIntConst(32, 26,AutoKesrCorr$);
      if (((AutoKesrCorr$  = 0)and(:new.ProgIndex=215))or(:new.ProgIndex<>215)) then
        BEGIN
          select
          ifs.KESR
          into
          :new.KesrCorr       from
          InnerFinSource ifs
          where
          ifs.id = :new.ifs
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;  
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_BUDGETDATA_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := user;
  :new.UpdaterUser := user;

  Update BudNotify set
  DocChangeDate = :new.UpdateDate,
  RVersion = -1
  where id = :new.recordindex;

END;
/
-- CREATE TRIGGER tr_BudgetData_bu
CREATE OR REPLACE TRIGGER TR_BUDGETDATA_BU
  BEFORE UPDATE
  ON BUDGETDATA
  FOR EACH ROW
DECLARE
  OrgRefByAcc$ NUMBER(10);
  CapClsType$ NUMBER(10);
  AutoKesrCorr$ NUMBER(10);
  doubleUse1$ NUMBER(10);
  BALBOFlag1$ NUMBER(10);
  AllowDivideBA1$ NUMBER(10);
  StimateKind1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_BUDGETDATA_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.KFSR IS NULL) THEN  
    :new.KFSR := 0;
  END IF;
  IF (:new.KVSR IS NULL) THEN  
    :new.KVSR := 0;
  END IF;
  IF (:new.KVR IS NULL) THEN  
    :new.KVR := 0;
  END IF;
  IF (:new.KCSR IS NULL) THEN  
    :new.KCSR := 0;
  END IF;
  IF (:new.KESR IS NULL) THEN  
    :new.KESR := 0;
  END IF;
  IF (:new.SubKESR IS NULL) THEN  
    :new.SubKESR := 0;
  END IF;
  IF (:new.RegionCLS IS NULL) THEN  
    :new.RegionCLS := 0;
  END IF;
  IF (:new.DirectionCls IS NULL) THEN 
    :new.DirectionCls := 0;
  END IF;
  IF (:new.FundsSource IS NULL) THEN 
    :new.FundsSource := 0;
  END IF;
  IF (:new.KD IS NULL) THEN 
    :new.KD := 0;
  END IF;
  IF (:new.subkd IS NULL) THEN 
    :new.subkd := 0;
  END IF;
  IF (:new.Fact IS NULL) THEN  
    :new.Fact := 0;
  END IF;
  IF (:new.FacialAcc_Cls IS NULL) THEN 
    :new.FacialAcc_Cls := 0;
  END IF;
  IF (:new.KESRCorr IS NULL) THEN 
    :new.KESRCorr := :new.KESR;
  END IF;
  IF (:new.AssignmentKind IS NULL) THEN 
    :new.AssignmentKind := 0;
  END IF;
  IF (:new.Quarter1 IS NULL) THEN  
    :new.Quarter1 := 0;
  END IF;
  IF (:new.Quarter2 IS NULL) THEN  
    :new.Quarter2 := 0;
  END IF;
  IF (:new.Quarter3 IS NULL) THEN  
    :new.Quarter3 := 0;
  END IF;
  IF (:new.Quarter4 IS NULL) THEN  
    :new.Quarter4 := 0;
  END IF;
  IF (:new.FinType IS NULL) THEN  
    :new.FinType := 0;
  END IF;
  IF (:new.MeansType IS NULL) THEN  
    :new.MeansType := 0;
  END IF;
  IF (:new.DepartmentCls IS NULL) THEN 
    :new.DepartmentCls := 0;
  END IF;
  /* заполнение поля бух. операции и классификации остатков средств по умолчанию */
  IF (:new.IFS IS NULL) THEN 
    :new.IFS := 0;
  END IF;
  IF (:new.BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;
  IF (:new.Month01 IS NULL) THEN  
    :new.Month01 := 0;
  END IF;
  IF (:new.Month02 IS NULL) THEN  
    :new.Month02 := 0;
  END IF;
  IF (:new.Month03 IS NULL) THEN  
    :new.Month03 := 0;
  END IF;
  IF (:new.Month04 IS NULL) THEN  
    :new.Month04 := 0;
  END IF;
  IF (:new.Month05 IS NULL) THEN  
    :new.Month05 := 0;
  END IF;
  IF (:new.Month06 IS NULL) THEN  
    :new.Month06 := 0;
  END IF;
  IF (:new.Month07 IS NULL) THEN  
    :new.Month07 := 0;
  END IF;
  IF (:new.Month08 IS NULL) THEN  
    :new.Month08 := 0;
  END IF;
  IF (:new.Month09 IS NULL) THEN  
    :new.Month09 := 0;
  END IF;
  IF (:new.Month10 IS NULL) THEN  
    :new.Month10 := 0;
  END IF;
  IF (:new.Month11 IS NULL) THEN  
    :new.Month11 := 0;
  END IF;
  IF (:new.Month12 IS NULL) THEN  
    :new.Month12 := 0;
  END IF;
  IF (:new.SummaYear1 IS NULL) THEN  
    :new.SummaYear1 := 0;
  END IF;
  IF (:new.SummaYear2 IS NULL) THEN  
    :new.SummaYear2 := 0;
  END IF;
  IF (:new.SummaYear3 IS NULL) THEN  
    :new.SummaYear3 := 0;
  END IF;
  IF (:new.SummaYear4 IS NULL) THEN  
    :new.SummaYear4 := 0;
  END IF;
  IF (:new.SummaOtherYears IS NULL) THEN  
    :new.SummaOtherYears := 0; 
  END IF;
  IF (:new.DayPlanSumma IS NULL) THEN 
    :new.DayPlanSumma := 0;
  END IF;
  /* проверка на изменение Бюджета */
  IF (:new.BudgetRef <> :old.BudgetRef) THEN
    IF ( NOT((:new.BudgetRef IS NULL) AND (:old.BudgetRef IS NULL)) ) THEN
      RaiseException('Ex_CantModufyBudget');
    END IF;
  END IF;
  BEGIN

    SELECT
    c.BA_LBO_FLAG
    INTO
    BALBOFlag1$  FROM
    BudNotify c
    WHERE
    c.id = :new.RecordIndex
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  /* Смета по ПД*/
  IF (:new.ProgIndex = 262) THEN
    GetIntConst(32, 43,StimateKind1$);
    IF ((StimateKind1$  = 0) OR (StimateKind1$  IS NULL)) THEN
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
         
    ELSE
      IF (StimateKind1$  = 1) THEN
        :new.Quarter1 := :new.SummaYear1;
             
      ELSE
        :new.Quarter1 := :new.Month01 + :new.Month02 +:new.Month03;
        :new.Quarter2 := :new.Month04 + :new.Month05 +:new.Month06;
        :new.Quarter3 := :new.Month07 + :new.Month08 +:new.Month09;
        :new.Quarter4 := :new.Month10 + :new.Month11 +:new.Month12;
        :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
             
      END IF; 
    END IF;
  END IF;
  /* СБР(расходы)*/
  IF (:new.ProgIndex = 260) THEN
    GetIntConst(32, 30,doubleUse1$);
    GetIntConst(32, 40,AllowDivideBA1$);
    IF ((doubleUse1$=1) AND ((BALBOFlag1$  <> 1) OR (AllowDivideBA1$ = 1))) THEN  /* если используется совмещенное ведение КП и СБР, то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;
  END IF;
  /* СБР(источники)*/
  IF (:new.ProgIndex = 264) THEN
    GetIntConst(32, 34,doubleUse1$);
    GetIntConst(32, 40,AllowDivideBA1$);
    IF ((doubleUse1$=1) AND ((BALBOFlag1$  <> 1) OR (AllowDivideBA1$ = 1))) THEN  /* если используется совмещенное ведение КП и СБР, то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;
  END IF;
  /* БР ГРБС(расходы)*/
  IF (:new.ProgIndex = 32) THEN
    GetIntConst(32, 31,doubleUse1$);
    GetIntConst(32, 40,AllowDivideBA1$);
    IF ((doubleUse1$=1) AND ((BALBOFlag1$  <> 1) OR (AllowDivideBA1$ = 1))) THEN  /* если используется совмещенное ведение КП по ПБС и БР , то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;
  END IF;
  /* БР ГРБС(источники)*/
  IF (:new.ProgIndex = 215) THEN
    GetIntConst(32, 35,doubleUse1$);
    GetIntConst(32, 40,AllowDivideBA1$);
    IF ((doubleUse1$=1) AND ((BALBOFlag1$  <> 1) OR (AllowDivideBA1$ = 1))) THEN  /* если используется совмещенное ведение КП по АИФ и БР, то автозаполняем сумму первого года*/
      :new.SummaYear1 := :new.Quarter1 + :new.Quarter2 + :new.Quarter3 + :new.Quarter4;
     
    END IF;/* 
   IF ((NEW.TransfertOrg_Ref IS NULL) AND (NEW.REGIONCLS <> 0)) THEN
       SELECT Organizations FROM REGIONCLS
         WHERE NEW.REGIONCLS = ID
       INTO NEW.TransfertOrg_Ref;
  */
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_BUDGETDATA_BU_100)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (:new.ClsType is NULL) then
    BEGIN
      select
      bn.ClsType
      into
      CapClsType$     from
      BudNotify bn
      where
      bn.id = :new.RecordIndex
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (CapClsType$  = 3) then
      if (:new.IFS <> 0) then
        :new.ClsType := 1; /* если это источник и забыли ввести ClsType */
            
      else
        if (:new.KD <> 0) then
          :new.ClsType := 2; /* доходная*/
                
        else
          :new.ClsType := 0; /* расходная*/
        END IF;    
      END IF;
    else
      :new.ClsType := CapClsType$;
      
    END IF;
  END IF;
  IF ((:new.ClsType = 0) AND ((:new.IFS <> 0)or(:new.KD <> 0))) THEN  /* классификация расходная */
    RaiseException('EX_WRONGBUDCLS');
  END IF;
  IF ((:new.ClsType <> 0) AND (
  (:new.KVSR <> 0) OR (:new.KFSR <> 0) OR
  (:new.KCSR <> 0) OR (:new.KVR <> 0) OR
  (:new.KESR <> 0)
  )) THEN
    RaiseException('EX_WRONGBUDCLS');
  END IF;
  if (((:new.ClsType = 1)and(:new.KD <> 0))or((:new.ClsType = 2)and(:new.IFS <> 0))) then
    RaiseException('EX_WRONGBUDCLS');
  END IF;
  IF ((:new.ClsType <> 0) AND (:new.ClsType <> 1) AND (:new.ClsType <> 2)) THEN /* неверный тип классификации*/
    RaiseException('EX_WRONGBUDCLSTYPE');
  END IF;
  IF (:new.ACC_REF IS NOT NULL) THEN /* Определяем организацию по р/с */
    BEGIN
      SELECT oa.ORG_REF
      INTO OrgRefByAcc$     FROM ORG_ACCOUNTS oa
      WHERE (oa.ID = :new.ACC_REF)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (:new.FacialAcc_CLS = 0) then 
      :new.Org_Ref := OrgRefByAcc$;
      
    END IF;
  END IF;
  /* если л\с указан, то организация в детали и организация р\с должна соответствовать организации л\с, иначе р\с очищаем*/
  if (:new.FacialAcc_CLS <> 0) then
    BEGIN
      SELECT
      fac.ORG_REF
      INTO :new.Org_Ref     FROM
      FacialACC_CLS fac
      WHERE
      (fac.ID = :new.FacialAcc_CLS)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (OrgRefByAcc$<>:new.Org_Ref) then 
      :new.ACC_REF := null;
      
    END IF;
  END IF;
  if ((:new.ProgIndex in (252, 253))and(:new.FacialAcc_CLS = 0)) then
    BEGIN
      SELECT
      bn.FacialAccCLS
      INTO :new.FacialAcc_CLS     FROM
      BudNotify bn
      WHERE
      (bn.ID = :new.RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_BUDGETDATA_BU_200)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* Для всех прогиндексов с расходной классификацией 32-БР, 260-СБР, 261-КП, 262-Сметы по ПД, 263-Бюджет, 268-КП по ПБС */
  if (:new.ProgIndex in (32, 260, 261, 262, 263, 268)) then
    /* для прогиднекса бюджетной росписи расходов(32 БР ГРБС(расходы)) 
         анализируем константу использования детализации ЭКР(расходы):
         при значении =0 сносим ЭКР в корреспондирующий ЭКР,
         при значении =1 не заполняем,
         при значении =2 заполняем в 0 корреспондирующий ЭКР.*//* для прогиндекса СБР расходов 260 СБР(расходы)
         анализируем константу использования детализации ЭКР:
         при значении =2 заполняем в 0 ЭКР и корреспондирующий ЭКР.*/
    GetIntConst(32, 25,AutoKesrCorr$);
    if (:new.ProgIndex = 32) then /* БР ГРБС(расходы)*/
      if (AutoKesrCorr$  = 0) then
        :new.KesrCorr := :new.Kesr;
              
      else
        if (AutoKesrCorr$  = 2) then
          :new.KesrCorr := 0;
        END IF;    
      END IF;
    else 
      if ((:new.ProgIndex = 260)and (AutoKesrCorr$  = 2)) then  /* СБР(расходы)*/
        :new.KesrCorr := 0;
        :new.Kesr := 0;     
              
      else 
        :new.KesrCorr := :new.Kesr; /* Для остальных прогиндексов всегда сносим ЭКР в корреспондирующий ЭКР*/
      END IF;  
    END IF;
  else
    /* Для всех прогиндексов с источниковой классификацией 215-БР, 264-СБР, 265-КП, 267-Бюджет, 271-КП по ПБС */
    if (:new.ProgIndex in (215, 264, 265, 267, 271)) then
      /* для прогиднекса бюджетной росписи источников(215 БР ГАИФ (источники))
         анализируем константу использования детализации ЭКР(источники):
         при значении =0 сносим ЭКР в корреспондирующий ЭКР,
         при значении =1 не заполняем. значение 2 для источников отсутствует.
         Для остальных прогиндексов всегда сносим ЭКР в корреспондирующий ЭКР*/
      GetIntConst(32, 26,AutoKesrCorr$);
      if (((AutoKesrCorr$  = 0)and(:new.ProgIndex=215))or(:new.ProgIndex<>215)) then
        BEGIN
          select
          ifs.KESR
          into
          :new.KesrCorr       from
          InnerFinSource ifs
          where
          ifs.id = :new.ifs
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;  
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_BUDGETDATA_BU_700)
-- Create 17.09.2004
-- - - - - - - - - - - - -

  IF (:NEW.RVersion IS NULL) THEN
     :NEW.RVersion := 1;
  ELSIF ((:NEW.RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
     :NEW.RVersion := :OLD.RVersion;
  ELSE
     :NEW.RVersion := :OLD.RVersion + 1;
  END IF;

END;
/
commit work
/
ALTER TABLE UNIONNOTIFYDETAIL ADD (
  SummaYear4 NUMBER(15,2) default 0,/* Четвертый плановый год */
  SummaOtherYears NUMBER(15,2) default 0/* Остальные плановые года */
)
/
commit work
/
update UNIONNOTIFYDETAIL set
  SummaYear4 = 0,
  SummaOtherYears = 0
/
commit work
/
-- CREATE TRIGGER TR_UNIONNOTIFYDETAIL_BI
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BI
  BEFORE INSERT
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_UNIONNOTIFYDETAIL_BI)
-- Version 10.00.00.3
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.kesr is null) then
    :new.kesr := 0;
  END IF;
  if (:new.kvsr is null) then
    :new.kvsr := 0;
  END IF;
  if (:new.kcsr is null) then
    :new.kcsr := 0;
  END IF;
  if (:new.kfsr is null) then
    :new.kfsr := 0;
  END IF;
  if (:new.kvr is null) then
    :new.kvr := 0;
  END IF;
  if (:new.ifs is null) then
    :new.ifs := 0;
  END IF;
  if (:new.ActivityKind is null) then
    :new.ActivityKind := 0;
  END IF;
  if (:new.Fact is null) then
    :new.Fact := 0;
  END IF;
  if (:new.MeansType is null) then
    :new.MeansType := 0;
  END IF;
  if (:new.DirectionCLS is null) then
    :new.DirectionCLS := 0;
  END IF;
  if (:new.RegionCLS is null) then
    :new.RegionCLS := 0;
  END IF;
  if (:new.SubKESR is null) then
    :new.SubKESR := 0;
  END IF;
  IF (:new.FinType IS NULL) THEN
    :new.FinType := 0;
  END IF;
  if (:new.summalimit is null) then
    :new.summalimit := 0;
  END IF;
  if (:new.summaassignment is null) then
    :new.summaassignment := 0;
  END IF;
  if (:new.summafin is null) then
    :new.summafin := 0;
  END IF;
  if (:new.SummaLimitYear is null) then
    :new.SummaLimitYear := 0;
  END IF;
  if (:new.SummaAssignmentYear is null) then
    :new.SummaAssignmentYear := 0;
  END IF;
  if (:new.SummaFinYear is null) then
    :new.SummaFinYear := 0;
  END IF;
  if (:new.SummaYear1 is null) then
    :new.SummaYear1 := 0;
  END IF;
  if (:new.SummaYear2 is null) then
    :new.SummaYear2 := 0;
  END IF;
  if (:new.SummaYear3 is null) then
    :new.SummaYear3 := 0;
  END IF;
  IF (:new.SummaYear4 IS NULL) THEN  
    :new.SummaYear4 := 0;
  END IF;
  IF (:new.SummaOtherYears IS NULL) THEN  
    :new.SummaOtherYears := 0;
  END IF;
  if (:new.BA_LBO_Flag is null) then
    :new.BA_LBO_Flag := 0;
  END IF;
  if (:new.BuhOperationCLS is null) then
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;
  if (:new.ClsType is null) then
    BEGIN
      select
      c.ClsType
      into :new.ClsType     from
      UnionNotifyCaption c
      where
      (c.id = :new.RecordIndex)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_120 (TR_UNIONNOTIFYDETAIL_BI_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -

  if (:new.ClsType is null) then
    if (:new.IFS <> 0) then
      :new.ClsType := 1;
    else
      :new.ClsType := 0;
    end if;  
  end if;
  if ((:new.ClsType = 0) and (:new.IFS <> 0)) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  
  if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
      (:new.KESR <> 0)or(:new.KFSR <> 0))) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BI_500 (TR_UNIONNOTIFYDETAIL_BI_500)
-- Create 15.02.2006
-- - - - - - - - - - - - -

  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;
  :NEW.CreaterUser := USER;
  :NEW.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_UNIONNOTIFYDETAIL_BU
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_BU
  BEFORE UPDATE
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_UNIONNOTIFYDETAIL_BU)
-- Version 10.00.00.3
-- - - - - - - - - - - - -

  if (:new.kesr is null) then
    :new.kesr := 0;
  END IF;
  if (:new.kvsr is null) then
    :new.kvsr := 0;
  END IF;
  if (:new.kcsr is null) then
    :new.kcsr := 0;
  END IF;
  if (:new.kfsr is null) then
    :new.kfsr := 0;
  END IF;
  if (:new.kvr is null) then
    :new.kvr := 0;
  END IF;
  if (:new.ifs is null) then
    :new.ifs := 0;
  END IF;
  if (:new.ActivityKind is null) then
    :new.ActivityKind := 0;
  END IF;
  if (:new.Fact is null) then
    :new.Fact := 0;
  END IF;
  if (:new.MeansType is null) then
    :new.MeansType := 0;
  END IF;
  if (:new.DirectionCLS is null) then
    :new.DirectionCLS := 0;
  END IF;
  if (:new.RegionCLS is null) then
    :new.RegionCLS := 0;
  END IF;
  if (:new.SubKESR is null) then
    :new.SubKESR := 0;
  END IF;
  IF (:new.FinType IS NULL) THEN
    :new.FinType := 0;
  END IF;
  if (:new.summalimit is null) then
    :new.summalimit := 0;
  END IF;
  if (:new.summaassignment is null) then
    :new.summaassignment := 0;
  END IF;
  if (:new.summafin is null) then
    :new.summafin := 0;
  END IF;
  if (:new.SummaLimitYear is null) then
    :new.SummaLimitYear := 0;
  END IF;
  if (:new.SummaAssignmentYear is null) then
    :new.SummaAssignmentYear := 0;
  END IF;
  if (:new.SummaFinYear is null) then
    :new.SummaFinYear := 0;
  END IF;
  if (:new.SummaYear1 is null) then
    :new.SummaYear1 := 0;
  END IF;
  if (:new.SummaYear2 is null) then
    :new.SummaYear2 := 0;
  END IF;
  if (:new.SummaYear3 is null) then
    :new.SummaYear3 := 0;
  END IF;
  IF (:new.SummaYear4 IS NULL) THEN  
    :new.SummaYear4 := 0;
  END IF;
  IF (:new.SummaOtherYears IS NULL) THEN  
    :new.SummaOtherYears := 0;
  END IF;
  if (:new.BA_LBO_Flag is null) then
    :new.BA_LBO_Flag := 0;
  END IF;
  if (:new.BuhOperationCLS is null) then
    GetIntConst(60, 15,:new.BuhOperationCLS);
  END IF;

-- - - - - - - - - - - - -
-- BU_120 (TR_UNIONNOTIFYDETAIL_BU_120)
-- Create 15.12.2008
-- - - - - - - - - - - - -

  if (:new.ClsType is null) then
    if (:new.IFS <> 0) then
      :new.ClsType := 1;
    else
      :new.ClsType := 0;
    end if;  
  end if;
  if ((:new.ClsType = 0)and(:new.IFS <> 0)) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  
  if ((:new.ClsType = 1)and((:new.KVSR <> 0)or(:new.KCSR <> 0)or(:new.KVR <> 0)or
      (:new.KESR <> 0)or(:new.KFSR <> 0))) then
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BU_700 (TR_UNIONNOTIFYDETAIL_BU_700)
-- Create 15.02.2006
-- - - - - - - - - - - - -

  if (:New.RVersion is null) then
    :New.RVersion := 1;
  elsif ((:New.RVersion = -1) and (:Old.RVersion <> -1)) then
    :New.RVersion := :Old.RVersion;
  else
    :New.RVersion := :Old.RVersion + 1;
  end if;

END;
/
commit work
/
ALTER TABLE TB_PAYMENTSCHEDULE ADD (
  SummaYear4 NUMBER(15,2) default 0,/* Четвертый плановый год */
  SummaOtherYears NUMBER(15,2) default 0,/* Остальные плановые года */
  SummaYear4Delta NUMBER(15,2) default 0,
  SummaOtherYearsDelta NUMBER(15,2) default 0
)
/

CREATE OR REPLACE VIEW PAYMENTSCHEDULE (
  ID,
  ANUMBER,
  PARENTNUMBER,
  KFSR,
  KESR,
  KVSR,
  KCSR,
  KVR,
  MONTH01,
  MONTH02,
  MONTH03,
  MONTH04,
  MONTH05,
  MONTH06,
  MONTH07,
  MONTH08,
  MONTH09,
  MONTH10,
  MONTH11,
  MONTH12,
  SUMMA,
  REGION,
  SUBKESR,
  MEANSTYPE,
  FINSOURCE,
  FINTYPE,
  FACT,
  FACIALACC_CLS,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  BUDGETREF,
  ACCEPTDATE,
  LASTADJUSTMENT,
  ACCEPTED,
  LASTACCEPTED,
  PROMISETYPE,
  ADJUSTMENTREF,
  OLDNUMBER,
  SUMMAPREVIOUSYEAR,
  SUMMAFINPREVIOUSYEAR,
  QUARTER1,
  QUARTER2,
  QUARTER3,
  QUARTER4,
  RECORDINDEX,
  CRYPTOSTATUS,
  SENDERID,
  SENDERRECORDID,
  DIRECTIONCLS,
  RVERSION,
  BUHOPERATIONCLS,
  MONTH01DELTA,
  MONTH02DELTA,
  MONTH03DELTA,
  MONTH04DELTA,
  MONTH05DELTA,
  MONTH06DELTA,
  MONTH07DELTA,
  MONTH08DELTA,
  MONTH09DELTA,
  MONTH10DELTA,
  MONTH11DELTA,
  MONTH12DELTA,
  QUARTER1DELTA,
  QUARTER2DELTA,
  QUARTER3DELTA,
  QUARTER4DELTA,
  SUMMADELTA,
  NOTE,
  FINYEAR,
  SUMMAYEAR1,
  SUMMAYEAR2,
  SUMMAYEAR3,
  SUMMAYEAR1DELTA,
  SUMMAYEAR2DELTA,
  SUMMAYEAR3DELTA,
  ASSIGNMENTKIND,
  TRANSFERTCLS,
  SENDERIDKEY,
  SENDERRECORDIDKEY,
  EXECUTIONREF,
  INNERPROMISENUM,
  ADJUSTMENTNUMBER,
  PROMISENUMBER,
  SUBSIDYCLS,
  AGREEMENTREF,
  BUDALLOCATIONCLS,
  PAYPROMISECLS,
  PROGINDEX,
  INVESTOBJECT,
  SUMMAYEAR4,
  SUMMAOTHERYEARS,
  SUMMAYEAR4DELTA,
  SUMMAOTHERYEARSDELTA)
AS
  SELECT
    ID,
    ANUMBER,
    PARENTNUMBER,
    KFSR,
    KESR,
    KVSR,
    KCSR,
    KVR,
    MONTH01,
    MONTH02,
    MONTH03,
    MONTH04,
    MONTH05,
    MONTH06,
    MONTH07,
    MONTH08,
    MONTH09,
    MONTH10,
    MONTH11,
    MONTH12,
    SUMMA,
    REGION,
    SUBKESR,
    MEANSTYPE,
    FINSOURCE,
    FINTYPE,
    FACT,
    FACIALACC_CLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    ACCEPTDATE,
    LASTADJUSTMENT,
    ACCEPTED,
    LASTACCEPTED,
    PROMISETYPE,
    ADJUSTMENTREF,
    OLDNUMBER,
    SUMMAPREVIOUSYEAR,
    SUMMAFINPREVIOUSYEAR,
    QUARTER1,
    QUARTER2,
    QUARTER3,
    QUARTER4,
    RECORDINDEX,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    DIRECTIONCLS,
    RVERSION,
    BUHOPERATIONCLS,
    MONTH01DELTA,
    MONTH02DELTA,
    MONTH03DELTA,
    MONTH04DELTA,
    MONTH05DELTA,
    MONTH06DELTA,
    MONTH07DELTA,
    MONTH08DELTA,
    MONTH09DELTA,
    MONTH10DELTA,
    MONTH11DELTA,
    MONTH12DELTA,
    QUARTER1DELTA,
    QUARTER2DELTA,
    QUARTER3DELTA,
    QUARTER4DELTA,
    SUMMADELTA,
    NOTE,
    FINYEAR,
    SUMMAYEAR1,
    SUMMAYEAR2,
    SUMMAYEAR3,
    SUMMAYEAR1DELTA,
    SUMMAYEAR2DELTA,
    SUMMAYEAR3DELTA,
    ASSIGNMENTKIND,
    TRANSFERTCLS,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    EXECUTIONREF,
    INNERPROMISENUM,
    ADJUSTMENTNUMBER,
    PROMISENUMBER,
    SUBSIDYCLS,
    AGREEMENTREF,
    BUDALLOCATIONCLS,
    PAYPROMISECLS,
    PROGINDEX,
    INVESTOBJECT,
    SUMMAYEAR4,
    SUMMAOTHERYEARS,
    SUMMAYEAR4DELTA,
    SUMMAOTHERYEARSDELTA
  FROM TB_PAYMENTSCHEDULE
/

CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_ID
  INSTEAD OF DELETE
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  SummInMonths$ NUMBER(15,2);
  cnt1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_PAYMENTSCHEDULE_BD)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 6.0*/
  select count(ID) into cnt1$ from PaymentSchedule where (AdjustmentRef = :old.ID) ;
  if (cnt1$ > 0) then
    RaiseException('EX_Agr_CantDelAdjustmented');
  END IF;

  select count(ID)
  into cnt1$   from FacialFinDetail
  where (SourceBudgetPromise = :old.InnerPromiseNum and SourcePromise=:old.ANumber)
  or (DestBudgetPromise = :old.InnerPromiseNum and DestPromise=:old.ANumber)
  ;
  if (cnt1$ > 0) then
    RaiseException('ex_CantDeleteAgreement');
  END IF;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_PAYMENTSCHEDULE
  WHERE Id = :old.id;

-- - - - - - - - - - - - -
-- AD_10 (TR_PAYMENTSCHEDULE_AD_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Восстановление флага LastAdjustment у предыдущей записи в цепочке*/
  if ((:old.AdjustmentNumber > 0) and (:old.LastAdjustment = 1)) then
    update PaymentSchedule set
    LastAdjustment = 1,
    RVersion = -1
    where (ID = :old.AdjustmentRef);
  END IF;
  /* Восстановление флага LastAccepted у предыдущей записи в цепочке*/    
  if ((:old.AdjustmentNumber > 0) and (:old.LastAccepted = 1)) then
    update PaymentSchedule set
    LastAccepted = 1,
    RVersion = -1
    where (ID = :old.AdjustmentRef);        
  END IF;

-- - - - - - - - - - - - -
-- AD_500 (TR_PAYMENTSCHEDULE_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  SummInMonths$ := :old.Month01+:old.Month02+:old.Month03+:old.Month04+:old.Month05+
  :old.Month06+:old.Month07+:old.Month08+:old.Month09+:old.Month10+:old.Month11+:old.Month12;
  if ((SummInMonths$  < 0.005) and (SummInMonths$  > -0.005)) then
    SummInMonths$ := :old.SummaYear1;
  END IF;
  insert into DelRecIndexes(TableID, RecordID, DeleteDate, ProgIndex, SUMMA) values (113, :old.ID, SYSDATE, :old.ProgIndex, SummInMonths$);

END;
/

CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_II
  INSTEAD OF INSERT
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  new$ID PAYMENTSCHEDULE.ID%TYPE := :NEW.ID;
  new$ANUMBER PAYMENTSCHEDULE.ANUMBER%TYPE := :NEW.ANUMBER;
  new$PARENTNUMBER PAYMENTSCHEDULE.PARENTNUMBER%TYPE := :NEW.PARENTNUMBER;
  new$KFSR PAYMENTSCHEDULE.KFSR%TYPE := :NEW.KFSR;
  new$KESR PAYMENTSCHEDULE.KESR%TYPE := :NEW.KESR;
  new$KVSR PAYMENTSCHEDULE.KVSR%TYPE := :NEW.KVSR;
  new$KCSR PAYMENTSCHEDULE.KCSR%TYPE := :NEW.KCSR;
  new$KVR PAYMENTSCHEDULE.KVR%TYPE := :NEW.KVR;
  new$MONTH01 PAYMENTSCHEDULE.MONTH01%TYPE := :NEW.MONTH01;
  new$MONTH02 PAYMENTSCHEDULE.MONTH02%TYPE := :NEW.MONTH02;
  new$MONTH03 PAYMENTSCHEDULE.MONTH03%TYPE := :NEW.MONTH03;
  new$MONTH04 PAYMENTSCHEDULE.MONTH04%TYPE := :NEW.MONTH04;
  new$MONTH05 PAYMENTSCHEDULE.MONTH05%TYPE := :NEW.MONTH05;
  new$MONTH06 PAYMENTSCHEDULE.MONTH06%TYPE := :NEW.MONTH06;
  new$MONTH07 PAYMENTSCHEDULE.MONTH07%TYPE := :NEW.MONTH07;
  new$MONTH08 PAYMENTSCHEDULE.MONTH08%TYPE := :NEW.MONTH08;
  new$MONTH09 PAYMENTSCHEDULE.MONTH09%TYPE := :NEW.MONTH09;
  new$MONTH10 PAYMENTSCHEDULE.MONTH10%TYPE := :NEW.MONTH10;
  new$MONTH11 PAYMENTSCHEDULE.MONTH11%TYPE := :NEW.MONTH11;
  new$MONTH12 PAYMENTSCHEDULE.MONTH12%TYPE := :NEW.MONTH12;
  new$SUMMA PAYMENTSCHEDULE.SUMMA%TYPE := :NEW.SUMMA;
  new$REGION PAYMENTSCHEDULE.REGION%TYPE := :NEW.REGION;
  new$SUBKESR PAYMENTSCHEDULE.SUBKESR%TYPE := :NEW.SUBKESR;
  new$MEANSTYPE PAYMENTSCHEDULE.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$FINSOURCE PAYMENTSCHEDULE.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$FINTYPE PAYMENTSCHEDULE.FINTYPE%TYPE := :NEW.FINTYPE;
  new$FACT PAYMENTSCHEDULE.FACT%TYPE := :NEW.FACT;
  new$FACIALACC_CLS PAYMENTSCHEDULE.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$CREATERUSER PAYMENTSCHEDULE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE PAYMENTSCHEDULE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE PAYMENTSCHEDULE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER PAYMENTSCHEDULE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF PAYMENTSCHEDULE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$ACCEPTDATE PAYMENTSCHEDULE.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$LASTADJUSTMENT PAYMENTSCHEDULE.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$ACCEPTED PAYMENTSCHEDULE.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED PAYMENTSCHEDULE.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$PROMISETYPE PAYMENTSCHEDULE.PROMISETYPE%TYPE := :NEW.PROMISETYPE;
  new$ADJUSTMENTREF PAYMENTSCHEDULE.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$OLDNUMBER PAYMENTSCHEDULE.OLDNUMBER%TYPE := :NEW.OLDNUMBER;
  new$SUMMAPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAPREVIOUSYEAR%TYPE := :NEW.SUMMAPREVIOUSYEAR;
  new$SUMMAFINPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAFINPREVIOUSYEAR%TYPE := :NEW.SUMMAFINPREVIOUSYEAR;
  new$QUARTER1 PAYMENTSCHEDULE.QUARTER1%TYPE := :NEW.QUARTER1;
  new$QUARTER2 PAYMENTSCHEDULE.QUARTER2%TYPE := :NEW.QUARTER2;
  new$QUARTER3 PAYMENTSCHEDULE.QUARTER3%TYPE := :NEW.QUARTER3;
  new$QUARTER4 PAYMENTSCHEDULE.QUARTER4%TYPE := :NEW.QUARTER4;
  new$RECORDINDEX PAYMENTSCHEDULE.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CRYPTOSTATUS PAYMENTSCHEDULE.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID PAYMENTSCHEDULE.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID PAYMENTSCHEDULE.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DIRECTIONCLS PAYMENTSCHEDULE.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$RVERSION PAYMENTSCHEDULE.RVERSION%TYPE := :NEW.RVERSION;
  new$BUHOPERATIONCLS PAYMENTSCHEDULE.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$MONTH01DELTA PAYMENTSCHEDULE.MONTH01DELTA%TYPE := :NEW.MONTH01DELTA;
  new$MONTH02DELTA PAYMENTSCHEDULE.MONTH02DELTA%TYPE := :NEW.MONTH02DELTA;
  new$MONTH03DELTA PAYMENTSCHEDULE.MONTH03DELTA%TYPE := :NEW.MONTH03DELTA;
  new$MONTH04DELTA PAYMENTSCHEDULE.MONTH04DELTA%TYPE := :NEW.MONTH04DELTA;
  new$MONTH05DELTA PAYMENTSCHEDULE.MONTH05DELTA%TYPE := :NEW.MONTH05DELTA;
  new$MONTH06DELTA PAYMENTSCHEDULE.MONTH06DELTA%TYPE := :NEW.MONTH06DELTA;
  new$MONTH07DELTA PAYMENTSCHEDULE.MONTH07DELTA%TYPE := :NEW.MONTH07DELTA;
  new$MONTH08DELTA PAYMENTSCHEDULE.MONTH08DELTA%TYPE := :NEW.MONTH08DELTA;
  new$MONTH09DELTA PAYMENTSCHEDULE.MONTH09DELTA%TYPE := :NEW.MONTH09DELTA;
  new$MONTH10DELTA PAYMENTSCHEDULE.MONTH10DELTA%TYPE := :NEW.MONTH10DELTA;
  new$MONTH11DELTA PAYMENTSCHEDULE.MONTH11DELTA%TYPE := :NEW.MONTH11DELTA;
  new$MONTH12DELTA PAYMENTSCHEDULE.MONTH12DELTA%TYPE := :NEW.MONTH12DELTA;
  new$QUARTER1DELTA PAYMENTSCHEDULE.QUARTER1DELTA%TYPE := :NEW.QUARTER1DELTA;
  new$QUARTER2DELTA PAYMENTSCHEDULE.QUARTER2DELTA%TYPE := :NEW.QUARTER2DELTA;
  new$QUARTER3DELTA PAYMENTSCHEDULE.QUARTER3DELTA%TYPE := :NEW.QUARTER3DELTA;
  new$QUARTER4DELTA PAYMENTSCHEDULE.QUARTER4DELTA%TYPE := :NEW.QUARTER4DELTA;
  new$SUMMADELTA PAYMENTSCHEDULE.SUMMADELTA%TYPE := :NEW.SUMMADELTA;
  new$NOTE PAYMENTSCHEDULE.NOTE%TYPE := :NEW.NOTE;
  new$FINYEAR PAYMENTSCHEDULE.FINYEAR%TYPE := :NEW.FINYEAR;
  new$SUMMAYEAR1 PAYMENTSCHEDULE.SUMMAYEAR1%TYPE := :NEW.SUMMAYEAR1;
  new$SUMMAYEAR2 PAYMENTSCHEDULE.SUMMAYEAR2%TYPE := :NEW.SUMMAYEAR2;
  new$SUMMAYEAR3 PAYMENTSCHEDULE.SUMMAYEAR3%TYPE := :NEW.SUMMAYEAR3;
  new$SUMMAYEAR1DELTA PAYMENTSCHEDULE.SUMMAYEAR1DELTA%TYPE := :NEW.SUMMAYEAR1DELTA;
  new$SUMMAYEAR2DELTA PAYMENTSCHEDULE.SUMMAYEAR2DELTA%TYPE := :NEW.SUMMAYEAR2DELTA;
  new$SUMMAYEAR3DELTA PAYMENTSCHEDULE.SUMMAYEAR3DELTA%TYPE := :NEW.SUMMAYEAR3DELTA;
  new$ASSIGNMENTKIND PAYMENTSCHEDULE.ASSIGNMENTKIND%TYPE := :NEW.ASSIGNMENTKIND;
  new$TRANSFERTCLS PAYMENTSCHEDULE.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SENDERIDKEY PAYMENTSCHEDULE.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY PAYMENTSCHEDULE.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$EXECUTIONREF PAYMENTSCHEDULE.EXECUTIONREF%TYPE := :NEW.EXECUTIONREF;
  new$INNERPROMISENUM PAYMENTSCHEDULE.INNERPROMISENUM%TYPE := :NEW.INNERPROMISENUM;
  new$ADJUSTMENTNUMBER PAYMENTSCHEDULE.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$PROMISENUMBER PAYMENTSCHEDULE.PROMISENUMBER%TYPE := :NEW.PROMISENUMBER;
  new$SUBSIDYCLS PAYMENTSCHEDULE.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$AGREEMENTREF PAYMENTSCHEDULE.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$BUDALLOCATIONCLS PAYMENTSCHEDULE.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS PAYMENTSCHEDULE.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
  new$PROGINDEX PAYMENTSCHEDULE.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$INVESTOBJECT PAYMENTSCHEDULE.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
  new$SUMMAYEAR4 PAYMENTSCHEDULE.SUMMAYEAR4%TYPE := :NEW.SUMMAYEAR4;
  new$SUMMAOTHERYEARS PAYMENTSCHEDULE.SUMMAOTHERYEARS%TYPE := :NEW.SUMMAOTHERYEARS;
  new$SUMMAYEAR4DELTA PAYMENTSCHEDULE.SUMMAYEAR4DELTA%TYPE := :NEW.SUMMAYEAR4DELTA;
  new$SUMMAOTHERYEARSDELTA PAYMENTSCHEDULE.SUMMAOTHERYEARSDELTA%TYPE := :NEW.SUMMAOTHERYEARSDELTA;
--
  M01$ NUMBER;
  M02$ NUMBER;
  M03$ NUMBER;
  M04$ NUMBER;
  M05$ NUMBER;
  M06$ NUMBER;
  M07$ NUMBER;
  M08$ NUMBER;
  M09$ NUMBER;
  M10$ NUMBER;
  M11$ NUMBER;
  M12$ NUMBER;
  Q1$ NUMBER;
  Q2$ NUMBER;
  Q3$ NUMBER;
  Q4$ NUMBER;
  S$ NUMBER;
  S1$ NUMBER;
  S2$ NUMBER;
  S3$ NUMBER;
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  AdjDocNum$ NUMBER(10);
  InnerNumber_parent$ NUMBER(10);
  InnerNumber_child$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_PAYMENTSCHEDULE_BI)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$PromiseType is null) then 
    new$PromiseType := 0;
  END IF;
  if (new$KFSR is null) then 
    new$KFSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KCSR is null) then 
    new$KCSR := 0;
  END IF;
  if (new$KVR is null) then 
    new$KVR := 0;
  END IF;
  if (new$SubKESR is null) then 
    new$SubKESR := 0;
  END IF;
  if (new$AssignmentKind is null) then 
    new$AssignmentKind := 0;
  END IF;
  if (new$DirectionCls is null) then 
    new$DirectionCls := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$MeansType is null) then 
    new$MeansType := 0;
  END IF;
  if (new$FinSource is null) then 
    new$FinSource := 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$Month01 is null) then 
    new$Month01 := 0;
  END IF;
  if (new$Month02 is null) then 
    new$Month02 := 0;
  END IF;
  if (new$Month03 is null) then 
    new$Month03 := 0;
  END IF;
  if (new$Month04 is null) then 
    new$Month04 := 0;
  END IF;
  if (new$Month05 is null) then 
    new$Month05 := 0;
  END IF;
  if (new$Month06 is null) then 
    new$Month06 := 0;
  END IF;
  if (new$Month07 is null) then 
    new$Month07 := 0;
  END IF;
  if (new$Month08 is null) then 
    new$Month08 := 0;
  END IF;
  if (new$Month09 is null) then 
    new$Month09 := 0;
  END IF;
  if (new$Month10 is null) then 
    new$Month10 := 0;
  END IF;
  if (new$Month11 is null) then 
    new$Month11 := 0;
  END IF;
  if (new$Month12 is null) then 
    new$Month12 := 0;
  END IF;
  if (new$Quarter1 is null) then 
    new$Quarter1 := 0;
  END IF;
  if (new$Quarter2 is null) then 
    new$Quarter2 := 0;
  END IF;
  if (new$Quarter3 is null) then 
    new$Quarter3 := 0;
  END IF;
  if (new$Quarter4 is null) then 
    new$Quarter4 := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$Month01Delta is null) then 
    new$Month01Delta := 0;
  END IF;
  if (new$Month02Delta is null) then 
    new$Month02Delta := 0;
  END IF;
  if (new$Month03Delta is null) then 
    new$Month03Delta := 0;
  END IF;
  if (new$Month04Delta is null) then 
    new$Month04Delta := 0;
  END IF;
  if (new$Month05Delta is null) then 
    new$Month05Delta := 0;
  END IF;
  if (new$Month06Delta is null) then 
    new$Month06Delta := 0;
  END IF;
  if (new$Month07Delta is null) then 
    new$Month07Delta := 0;
  END IF;
  if (new$Month08Delta is null) then 
    new$Month08Delta := 0;
  END IF;
  if (new$Month09Delta is null) then 
    new$Month09Delta := 0;
  END IF;
  if (new$Month10Delta is null) then 
    new$Month10Delta := 0;
  END IF;
  if (new$Month11Delta is null) then 
    new$Month11Delta := 0;
  END IF;
  if (new$Month12Delta is null) then 
    new$Month12Delta := 0;
  END IF;
  if (new$Quarter1Delta is null) then 
    new$Quarter1Delta := 0;
  END IF;
  if (new$Quarter2Delta is null) then 
    new$Quarter2Delta := 0;
  END IF;
  if (new$Quarter3Delta is null) then 
    new$Quarter3Delta := 0;
  END IF;
  if (new$Quarter4Delta is null) then 
    new$Quarter4Delta := 0;
  END IF;
  if (new$SummaDelta is null) then 
    new$SummaDelta := 0;
  END IF;
  if (new$SummaPreviousYear is null) then 
    new$SummaPreviousYear := 0;
  END IF;
  if (new$SummaFinPreviousYear is null) then 
    new$SummaFinPreviousYear := 0;
  END IF;
  if (new$SummaYear1 is null) then 
    new$SummaYear1 := 0;
  END IF;
  if (new$SummaYear2 is null) then 
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then 
    new$SummaYear3 := 0;
  END IF;
  if (new$SummaYear1Delta is null) then 
    new$SummaYear1Delta := 0;
  END IF;
  if (new$SummaYear2Delta is null) then 
    new$SummaYear2Delta := 0;
  END IF;
  if (new$SummaYear3Delta is null) then 
    new$SummaYear3Delta := 0;
  END IF;
  if (new$SummaYear2 is null) then  
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then  
    new$SummaYear3 := 0;
  END IF;
  /* проверка на то, что ссылаемся на этап из этого договора */
  if (new$ProgIndex = 304 and new$RecordIndex is not null) then
    SELECT COUNT(*) INTO CNT$1
    from AgreementSteps s where (s.Id = new$RecordIndex and s.RecordIndex = new$AgreementRef) AND (ROWNUM = 1);
    if (not (CNT$1<> 0)) then
      RaiseException('Ex_WrongStep');
    END IF;
  END IF;
  /* Заполнение Бюджета из этапа или заголовка */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    if (new$ProgIndex in (304,314,317,318)) then
      BEGIN
        select a.BudgetRef       into new$BudgetRef from Agreements a
        where a.ID = new$AgreementRef
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
    else 
      if (new$ProgIndex = 308) then
        BEGIN
          select e.BudgetRef
          into new$BudgetRef       from ExecutionDocumentsCaption e
          where e.ID = new$ExecutionRef
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
      END IF;
    END IF;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  if (new$ANumber is not null) then
    SELECT COUNT(                    id
    ) INTO CNT$2
    from
    PaymentSchedule ps
    where
    (                    (ps.ANumber = new$ANumber)
    and
    (ps.BudgetRef = new$BudgetRef)) AND (ROWNUM = 1);
    if ((CNT$2<> 0)) then
      RaiseException('ex_Promise_NumUQ');
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_1 (TR_PAYMENTSCHEDULE_BI_1)
-- Create 05.03.2004
-- Last update 29.12.2007
-- - - - - - - - - - - - -

/* Версия триггера 1.0*/
    if (new$Quarter1 = 0) then new$Quarter1 := new$Month01 + new$Month02 + new$Month03; end if;
    if (new$Quarter2 = 0) then new$Quarter2 := new$Month04 + new$Month05 + new$Month06; end if;
    if (new$Quarter3 = 0) then new$Quarter3 := new$Month07 + new$Month08 + new$Month09; end if;
    if (new$Quarter4 = 0) then new$Quarter4 := new$Month10 + new$Month11 + new$Month12; end if;
    new$SummaYear1 := new$Quarter1 + new$Quarter2 + new$Quarter3 + new$Quarter4;

-- - - - - - - - - - - - -
-- BI_10 (TR_PAYMENTSCHEDULE_BI_10)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
     
  /* Проверка указания внутренних номеров.*/
  if (new$InnerPromiseNum is null) then
    RaiseException('EX_BP_InnerNumsIsNull');
  END IF;
      
  /* Получение внутреннего номера уточнения*/
  select max(AdjustmentNumber)
  into Tmp$         from PaymentSchedule 
  where (InnerPromiseNum = new$InnerPromiseNum)
  ;
  /* Если это первая запись в цепочке, тогда устанавливаем 0*/
  if (Tmp$ is null) then
    new$AdjustmentNumber := 0;
        
  else
    new$AdjustmentNumber := Tmp$ + 1;
  END IF;
      
  /* Флаг последнего уточнения устанавливается в единицу при вставке, только если уточнение не отклонено*/
  if ((new$Accepted = 0) and (new$AcceptDate is not null)) then
    new$LastAdjustment := 0;
        
  else
    new$LastAdjustment := 1;
  END IF;
      
  /* Если БО принято, тогда устанавливаем флаг постледнего принятого в цепочке*/
  if ((new$AcceptDate is not null) and (new$Accepted = 1)) then 
    new$LastAccepted := 1;
        
  else
    new$LastAccepted := 0;
  END IF;
  /* Если БО является уточнением*/
  if (new$AdjustmentNumber > 0) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID), max(ANumber)
    into Tmp$, AdjID$, AdjDocNum$             from PaymentSchedule
    where (InnerPromiseNum = new$InnerPromiseNum) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/
    if (Tmp$ <> 1) then 
      RaiseException('EX_BP_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID) 
    into Tmp$             from PaymentSchedule
    where (InnerPromiseNum = new$InnerPromiseNum) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then 
      RaiseException('EX_BP_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/        
    new$AdjustmentRef := AdjID$;
    new$ParentNumber := AdjDocNum$;
    /* если пытаемся что-то уточнить, то проверим, что заголовки одни и те же */
    if (new$ProgIndex in (304, 314)) then
      BEGIN
        /* получим номер цепочки заголовка */        
        select a.InnerNumber
        into InnerNumber_child$             from Agreements a
        where a.ID = new$AgreementRef
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN
        /* получим номер цепочки заголовка уточняемой детали */
        select a.InnerNumber
        into InnerNumber_parent$             from PaymentSchedule ps
        left join Agreements a on (a.Id = ps.AgreementRef)
        where (ps.Id = new$AdjustmentRef)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* номера цепочек заголовков обязаны совпадать */
      if (InnerNumber_parent$ <> InnerNumber_child$) then
        RaiseException('EX_PROMISE_ADJ_INCORRECT');        
      END IF;
    else 
      if (new$ProgIndex = 308) then
        BEGIN
          /* получим номер цепочки заголовка */        
          select edc.InnerNumber
          into InnerNumber_child$             from ExecutionDocumentsCaption edc
          where edc.ID = new$ExecutionRef
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        BEGIN
          /* получим номер цепочки заголовка уточняемой детали */
          select edc.InnerNumber
          into InnerNumber_parent$             from PaymentSchedule ps
          left join ExecutionDocumentsCaption edc on (edc.id=ps.ExecutionRef)
          where (ps.Id = new$AdjustmentRef)
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        /* номера цепочек заголовков обязаны совпадать */
        if (InnerNumber_parent$ <> InnerNumber_child$) then
          RaiseException('EX_PROMISE_ADJ_INCORRECT');        
        END IF;
      END IF;    
    END IF;
  else /* Если БО не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/        
    new$AdjustmentRef := null;
    new$ParentNumber := null;
        
  END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_PAYMENTSCHEDULE_BI_100)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Для уточнений дельту вычисляем как разницу текущего уточнения и предыдущего */
  if (new$AdjustmentNumber > 0) then
    BEGIN
      select 
      Month01, Month02, Month03, Month04, Month05, Month06,
      Month07, Month08, Month09, Month10, Month11, Month12,
      Quarter1, Quarter2, Quarter3, Quarter4, Summa, 
      SummaYear1, SummaYear2, SummaYear3
      into
      M01$, M02$, M03$, M04$, M05$, M06$, M07$, M08$, M09$, M10$, M11$, M12$, 
      Q1$, Q2$, Q3$, Q4$, S$, S1$, S2$, S3$         from 
      PaymentSchedule
      where
      ID = new$AdjustmentRef
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
          
    new$Month01Delta := new$Month01 - M01$;
    new$Month02Delta := new$Month02 - M02$;
    new$Month03Delta := new$Month03 - M03$;
    new$Month04Delta := new$Month04 - M04$;
    new$Month05Delta := new$Month05 - M05$;
    new$Month06Delta := new$Month06 - M06$;
    new$Month07Delta := new$Month07 - M07$;
    new$Month08Delta := new$Month08 - M08$;
    new$Month09Delta := new$Month09 - M09$;
    new$Month10Delta := new$Month10 - M10$;
    new$Month11Delta := new$Month11 - M11$;
    new$Month12Delta := new$Month12 - M12$;
    new$Quarter1Delta := new$Quarter1 - Q1$;
    new$Quarter2Delta := new$Quarter2 - Q2$;
    new$Quarter3Delta := new$Quarter3 - Q3$;
    new$Quarter4Delta := new$Quarter4 - Q4$;
    new$SummaDelta := new$Summa - S$;
    new$SummaYear1Delta := new$SummaYear1 - S1$;
    new$SummaYear2Delta := new$SummaYear2 - S2$;
    new$SummaYear3Delta := new$SummaYear3 - S3$;
        
  else    /* В первых версиях дельты равны суммам БО */  
    new$Month01Delta := new$Month01;
    new$Month02Delta := new$Month02;
    new$Month03Delta := new$Month03;
    new$Month04Delta := new$Month04;
    new$Month05Delta := new$Month05;
    new$Month06Delta := new$Month06;
    new$Month07Delta := new$Month07;
    new$Month08Delta := new$Month08;
    new$Month09Delta := new$Month09;
    new$Month10Delta := new$Month10;
    new$Month11Delta := new$Month11;
    new$Month12Delta := new$Month12;
    new$Quarter1Delta := new$Quarter1;
    new$Quarter2Delta := new$Quarter2;
    new$Quarter3Delta := new$Quarter3;
    new$Quarter4Delta := new$Quarter4;
    new$SummaDelta := new$Summa;
    new$SummaYear1Delta := new$SummaYear1;
    new$SummaYear2Delta := new$SummaYear2;
    new$SummaYear3Delta := new$SummaYear3;
        
  END IF;

-- - - - - - - - - - - - -
-- BI_200 (TR_PAYMENTSCHEDULE_BI_200)
-- Create 06.08.2010
-- - - - - - - - - - - - -

  /*автозаполнение полей информации о строке в УРМ*/
  if (new$senderId is null) then 
    new$senderIdKey := -1;
  else
    new$senderIdKey := new$senderId;
  end if;

  if (new$SenderRecordID is null)then
    new$SenderRecordIDKey := new$ID;
  else
    new$SenderRecordIDKey := new$SenderRecordID;
  end if;       

-- - - - - - - - - - - - -
-- BI_500 (TR_PAYMENTSCHEDULE_BI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_PAYMENTSCHEDULE (
    ID,
    ANUMBER,
    PARENTNUMBER,
    KFSR,
    KESR,
    KVSR,
    KCSR,
    KVR,
    MONTH01,
    MONTH02,
    MONTH03,
    MONTH04,
    MONTH05,
    MONTH06,
    MONTH07,
    MONTH08,
    MONTH09,
    MONTH10,
    MONTH11,
    MONTH12,
    SUMMA,
    REGION,
    SUBKESR,
    MEANSTYPE,
    FINSOURCE,
    FINTYPE,
    FACT,
    FACIALACC_CLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    ACCEPTDATE,
    LASTADJUSTMENT,
    ACCEPTED,
    LASTACCEPTED,
    PROMISETYPE,
    ADJUSTMENTREF,
    OLDNUMBER,
    SUMMAPREVIOUSYEAR,
    SUMMAFINPREVIOUSYEAR,
    QUARTER1,
    QUARTER2,
    QUARTER3,
    QUARTER4,
    RECORDINDEX,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    DIRECTIONCLS,
    RVERSION,
    BUHOPERATIONCLS,
    MONTH01DELTA,
    MONTH02DELTA,
    MONTH03DELTA,
    MONTH04DELTA,
    MONTH05DELTA,
    MONTH06DELTA,
    MONTH07DELTA,
    MONTH08DELTA,
    MONTH09DELTA,
    MONTH10DELTA,
    MONTH11DELTA,
    MONTH12DELTA,
    QUARTER1DELTA,
    QUARTER2DELTA,
    QUARTER3DELTA,
    QUARTER4DELTA,
    SUMMADELTA,
    NOTE,
    FINYEAR,
    SUMMAYEAR1,
    SUMMAYEAR2,
    SUMMAYEAR3,
    SUMMAYEAR1DELTA,
    SUMMAYEAR2DELTA,
    SUMMAYEAR3DELTA,
    ASSIGNMENTKIND,
    TRANSFERTCLS,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    EXECUTIONREF,
    INNERPROMISENUM,
    ADJUSTMENTNUMBER,
    PROMISENUMBER,
    SUBSIDYCLS,
    AGREEMENTREF,
    BUDALLOCATIONCLS,
    PAYPROMISECLS,
    PROGINDEX,
    INVESTOBJECT,
    SUMMAYEAR4,
    SUMMAOTHERYEARS,
    SUMMAYEAR4DELTA,
    SUMMAOTHERYEARSDELTA
  ) VALUES (
    new$ID,
    new$ANUMBER,
    new$PARENTNUMBER,
    new$KFSR,
    new$KESR,
    new$KVSR,
    new$KCSR,
    new$KVR,
    new$MONTH01,
    new$MONTH02,
    new$MONTH03,
    new$MONTH04,
    new$MONTH05,
    new$MONTH06,
    new$MONTH07,
    new$MONTH08,
    new$MONTH09,
    new$MONTH10,
    new$MONTH11,
    new$MONTH12,
    new$SUMMA,
    new$REGION,
    new$SUBKESR,
    new$MEANSTYPE,
    new$FINSOURCE,
    new$FINTYPE,
    new$FACT,
    new$FACIALACC_CLS,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$ACCEPTDATE,
    new$LASTADJUSTMENT,
    new$ACCEPTED,
    new$LASTACCEPTED,
    new$PROMISETYPE,
    new$ADJUSTMENTREF,
    new$OLDNUMBER,
    new$SUMMAPREVIOUSYEAR,
    new$SUMMAFINPREVIOUSYEAR,
    new$QUARTER1,
    new$QUARTER2,
    new$QUARTER3,
    new$QUARTER4,
    new$RECORDINDEX,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$DIRECTIONCLS,
    new$RVERSION,
    new$BUHOPERATIONCLS,
    new$MONTH01DELTA,
    new$MONTH02DELTA,
    new$MONTH03DELTA,
    new$MONTH04DELTA,
    new$MONTH05DELTA,
    new$MONTH06DELTA,
    new$MONTH07DELTA,
    new$MONTH08DELTA,
    new$MONTH09DELTA,
    new$MONTH10DELTA,
    new$MONTH11DELTA,
    new$MONTH12DELTA,
    new$QUARTER1DELTA,
    new$QUARTER2DELTA,
    new$QUARTER3DELTA,
    new$QUARTER4DELTA,
    new$SUMMADELTA,
    new$NOTE,
    new$FINYEAR,
    new$SUMMAYEAR1,
    new$SUMMAYEAR2,
    new$SUMMAYEAR3,
    new$SUMMAYEAR1DELTA,
    new$SUMMAYEAR2DELTA,
    new$SUMMAYEAR3DELTA,
    new$ASSIGNMENTKIND,
    new$TRANSFERTCLS,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$EXECUTIONREF,
    new$INNERPROMISENUM,
    new$ADJUSTMENTNUMBER,
    new$PROMISENUMBER,
    new$SUBSIDYCLS,
    new$AGREEMENTREF,
    new$BUDALLOCATIONCLS,
    new$PAYPROMISECLS,
    new$PROGINDEX,
    new$INVESTOBJECT,
    new$SUMMAYEAR4,
    new$SUMMAOTHERYEARS,
    new$SUMMAYEAR4DELTA,
    new$SUMMAOTHERYEARSDELTA);

-- - - - - - - - - - - - -
-- AI_10 (TR_PAYMENTSCHEDULE_AI_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Коррекция вспомогательных флагов в уточняемой записи*/
  if ((new$AdjustmentNumber > 0) and (new$LastAdjustment = 1)) then
    update PaymentSchedule set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);            
    if (new$LastAccepted = 1) then
      update PaymentSchedule set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_PAYMENTSCHEDULE_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 113) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_IU
  INSTEAD OF UPDATE
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  new$ID PAYMENTSCHEDULE.ID%TYPE := :NEW.ID;
  new$ANUMBER PAYMENTSCHEDULE.ANUMBER%TYPE := :NEW.ANUMBER;
  new$PARENTNUMBER PAYMENTSCHEDULE.PARENTNUMBER%TYPE := :NEW.PARENTNUMBER;
  new$KFSR PAYMENTSCHEDULE.KFSR%TYPE := :NEW.KFSR;
  new$KESR PAYMENTSCHEDULE.KESR%TYPE := :NEW.KESR;
  new$KVSR PAYMENTSCHEDULE.KVSR%TYPE := :NEW.KVSR;
  new$KCSR PAYMENTSCHEDULE.KCSR%TYPE := :NEW.KCSR;
  new$KVR PAYMENTSCHEDULE.KVR%TYPE := :NEW.KVR;
  new$MONTH01 PAYMENTSCHEDULE.MONTH01%TYPE := :NEW.MONTH01;
  new$MONTH02 PAYMENTSCHEDULE.MONTH02%TYPE := :NEW.MONTH02;
  new$MONTH03 PAYMENTSCHEDULE.MONTH03%TYPE := :NEW.MONTH03;
  new$MONTH04 PAYMENTSCHEDULE.MONTH04%TYPE := :NEW.MONTH04;
  new$MONTH05 PAYMENTSCHEDULE.MONTH05%TYPE := :NEW.MONTH05;
  new$MONTH06 PAYMENTSCHEDULE.MONTH06%TYPE := :NEW.MONTH06;
  new$MONTH07 PAYMENTSCHEDULE.MONTH07%TYPE := :NEW.MONTH07;
  new$MONTH08 PAYMENTSCHEDULE.MONTH08%TYPE := :NEW.MONTH08;
  new$MONTH09 PAYMENTSCHEDULE.MONTH09%TYPE := :NEW.MONTH09;
  new$MONTH10 PAYMENTSCHEDULE.MONTH10%TYPE := :NEW.MONTH10;
  new$MONTH11 PAYMENTSCHEDULE.MONTH11%TYPE := :NEW.MONTH11;
  new$MONTH12 PAYMENTSCHEDULE.MONTH12%TYPE := :NEW.MONTH12;
  new$SUMMA PAYMENTSCHEDULE.SUMMA%TYPE := :NEW.SUMMA;
  new$REGION PAYMENTSCHEDULE.REGION%TYPE := :NEW.REGION;
  new$SUBKESR PAYMENTSCHEDULE.SUBKESR%TYPE := :NEW.SUBKESR;
  new$MEANSTYPE PAYMENTSCHEDULE.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$FINSOURCE PAYMENTSCHEDULE.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$FINTYPE PAYMENTSCHEDULE.FINTYPE%TYPE := :NEW.FINTYPE;
  new$FACT PAYMENTSCHEDULE.FACT%TYPE := :NEW.FACT;
  new$FACIALACC_CLS PAYMENTSCHEDULE.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$CREATERUSER PAYMENTSCHEDULE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE PAYMENTSCHEDULE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE PAYMENTSCHEDULE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER PAYMENTSCHEDULE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF PAYMENTSCHEDULE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$ACCEPTDATE PAYMENTSCHEDULE.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$LASTADJUSTMENT PAYMENTSCHEDULE.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$ACCEPTED PAYMENTSCHEDULE.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED PAYMENTSCHEDULE.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$PROMISETYPE PAYMENTSCHEDULE.PROMISETYPE%TYPE := :NEW.PROMISETYPE;
  new$ADJUSTMENTREF PAYMENTSCHEDULE.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$OLDNUMBER PAYMENTSCHEDULE.OLDNUMBER%TYPE := :NEW.OLDNUMBER;
  new$SUMMAPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAPREVIOUSYEAR%TYPE := :NEW.SUMMAPREVIOUSYEAR;
  new$SUMMAFINPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAFINPREVIOUSYEAR%TYPE := :NEW.SUMMAFINPREVIOUSYEAR;
  new$QUARTER1 PAYMENTSCHEDULE.QUARTER1%TYPE := :NEW.QUARTER1;
  new$QUARTER2 PAYMENTSCHEDULE.QUARTER2%TYPE := :NEW.QUARTER2;
  new$QUARTER3 PAYMENTSCHEDULE.QUARTER3%TYPE := :NEW.QUARTER3;
  new$QUARTER4 PAYMENTSCHEDULE.QUARTER4%TYPE := :NEW.QUARTER4;
  new$RECORDINDEX PAYMENTSCHEDULE.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CRYPTOSTATUS PAYMENTSCHEDULE.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID PAYMENTSCHEDULE.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID PAYMENTSCHEDULE.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DIRECTIONCLS PAYMENTSCHEDULE.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$RVERSION PAYMENTSCHEDULE.RVERSION%TYPE := :NEW.RVERSION;
  new$BUHOPERATIONCLS PAYMENTSCHEDULE.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$MONTH01DELTA PAYMENTSCHEDULE.MONTH01DELTA%TYPE := :NEW.MONTH01DELTA;
  new$MONTH02DELTA PAYMENTSCHEDULE.MONTH02DELTA%TYPE := :NEW.MONTH02DELTA;
  new$MONTH03DELTA PAYMENTSCHEDULE.MONTH03DELTA%TYPE := :NEW.MONTH03DELTA;
  new$MONTH04DELTA PAYMENTSCHEDULE.MONTH04DELTA%TYPE := :NEW.MONTH04DELTA;
  new$MONTH05DELTA PAYMENTSCHEDULE.MONTH05DELTA%TYPE := :NEW.MONTH05DELTA;
  new$MONTH06DELTA PAYMENTSCHEDULE.MONTH06DELTA%TYPE := :NEW.MONTH06DELTA;
  new$MONTH07DELTA PAYMENTSCHEDULE.MONTH07DELTA%TYPE := :NEW.MONTH07DELTA;
  new$MONTH08DELTA PAYMENTSCHEDULE.MONTH08DELTA%TYPE := :NEW.MONTH08DELTA;
  new$MONTH09DELTA PAYMENTSCHEDULE.MONTH09DELTA%TYPE := :NEW.MONTH09DELTA;
  new$MONTH10DELTA PAYMENTSCHEDULE.MONTH10DELTA%TYPE := :NEW.MONTH10DELTA;
  new$MONTH11DELTA PAYMENTSCHEDULE.MONTH11DELTA%TYPE := :NEW.MONTH11DELTA;
  new$MONTH12DELTA PAYMENTSCHEDULE.MONTH12DELTA%TYPE := :NEW.MONTH12DELTA;
  new$QUARTER1DELTA PAYMENTSCHEDULE.QUARTER1DELTA%TYPE := :NEW.QUARTER1DELTA;
  new$QUARTER2DELTA PAYMENTSCHEDULE.QUARTER2DELTA%TYPE := :NEW.QUARTER2DELTA;
  new$QUARTER3DELTA PAYMENTSCHEDULE.QUARTER3DELTA%TYPE := :NEW.QUARTER3DELTA;
  new$QUARTER4DELTA PAYMENTSCHEDULE.QUARTER4DELTA%TYPE := :NEW.QUARTER4DELTA;
  new$SUMMADELTA PAYMENTSCHEDULE.SUMMADELTA%TYPE := :NEW.SUMMADELTA;
  new$NOTE PAYMENTSCHEDULE.NOTE%TYPE := :NEW.NOTE;
  new$FINYEAR PAYMENTSCHEDULE.FINYEAR%TYPE := :NEW.FINYEAR;
  new$SUMMAYEAR1 PAYMENTSCHEDULE.SUMMAYEAR1%TYPE := :NEW.SUMMAYEAR1;
  new$SUMMAYEAR2 PAYMENTSCHEDULE.SUMMAYEAR2%TYPE := :NEW.SUMMAYEAR2;
  new$SUMMAYEAR3 PAYMENTSCHEDULE.SUMMAYEAR3%TYPE := :NEW.SUMMAYEAR3;
  new$SUMMAYEAR1DELTA PAYMENTSCHEDULE.SUMMAYEAR1DELTA%TYPE := :NEW.SUMMAYEAR1DELTA;
  new$SUMMAYEAR2DELTA PAYMENTSCHEDULE.SUMMAYEAR2DELTA%TYPE := :NEW.SUMMAYEAR2DELTA;
  new$SUMMAYEAR3DELTA PAYMENTSCHEDULE.SUMMAYEAR3DELTA%TYPE := :NEW.SUMMAYEAR3DELTA;
  new$ASSIGNMENTKIND PAYMENTSCHEDULE.ASSIGNMENTKIND%TYPE := :NEW.ASSIGNMENTKIND;
  new$TRANSFERTCLS PAYMENTSCHEDULE.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SENDERIDKEY PAYMENTSCHEDULE.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY PAYMENTSCHEDULE.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$EXECUTIONREF PAYMENTSCHEDULE.EXECUTIONREF%TYPE := :NEW.EXECUTIONREF;
  new$INNERPROMISENUM PAYMENTSCHEDULE.INNERPROMISENUM%TYPE := :NEW.INNERPROMISENUM;
  new$ADJUSTMENTNUMBER PAYMENTSCHEDULE.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$PROMISENUMBER PAYMENTSCHEDULE.PROMISENUMBER%TYPE := :NEW.PROMISENUMBER;
  new$SUBSIDYCLS PAYMENTSCHEDULE.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$AGREEMENTREF PAYMENTSCHEDULE.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$BUDALLOCATIONCLS PAYMENTSCHEDULE.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS PAYMENTSCHEDULE.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
  new$PROGINDEX PAYMENTSCHEDULE.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$INVESTOBJECT PAYMENTSCHEDULE.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
  new$SUMMAYEAR4 PAYMENTSCHEDULE.SUMMAYEAR4%TYPE := :NEW.SUMMAYEAR4;
  new$SUMMAOTHERYEARS PAYMENTSCHEDULE.SUMMAOTHERYEARS%TYPE := :NEW.SUMMAOTHERYEARS;
  new$SUMMAYEAR4DELTA PAYMENTSCHEDULE.SUMMAYEAR4DELTA%TYPE := :NEW.SUMMAYEAR4DELTA;
  new$SUMMAOTHERYEARSDELTA PAYMENTSCHEDULE.SUMMAOTHERYEARSDELTA%TYPE := :NEW.SUMMAOTHERYEARSDELTA;
--
  M01$ NUMBER;
  M02$ NUMBER;
  M03$ NUMBER;
  M04$ NUMBER;
  M05$ NUMBER;
  M06$ NUMBER;
  M07$ NUMBER;
  M08$ NUMBER;
  M09$ NUMBER;
  M10$ NUMBER;
  M11$ NUMBER;
  M12$ NUMBER;
  Q1$ NUMBER;
  Q2$ NUMBER;
  Q3$ NUMBER;
  Q4$ NUMBER;
  S$ NUMBER;
  S1$ NUMBER;
  S2$ NUMBER;
  S3$ NUMBER;
  MaxNumber1$ NUMBER(10);
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_PAYMENTSCHEDULE_BU)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 2.4*/
  /* установка значений полей по-умолчанию*/
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$PromiseType is null) then 
    new$PromiseType := 0;
  END IF;
  if (new$KFSR is null) then 
    new$KFSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KCSR is null) then 
    new$KCSR := 0;
  END IF;
  if (new$KVR is null) then 
    new$KVR := 0;
  END IF;
  if (new$SubKESR is null) then 
    new$SubKESR := 0;
  END IF;
  if (new$AssignmentKind is null) then 
    new$AssignmentKind := 0;
  END IF;
   
  if (new$DirectionCls is null) then 
    new$DirectionCls := 0;
  END IF;
   
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$MeansType is null) then 
    new$MeansType := 0;
  END IF;
  if (new$FinSource is null) then 
    new$FinSource := 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$BuhOperationCLS is null) then 
    GetIntConst(60, 15,new$BuhOperationCLS); 
  END IF;
  if (new$Month01 is null) then 
    new$Month01 := 0;
  END IF;
  if (new$Month02 is null) then 
    new$Month02 := 0;
  END IF;
  if (new$Month03 is null) then 
    new$Month03 := 0;
  END IF;
  if (new$Month04 is null) then 
    new$Month04 := 0;
  END IF;
  if (new$Month05 is null) then 
    new$Month05 := 0;
  END IF;
  if (new$Month06 is null) then 
    new$Month06 := 0;
  END IF;
  if (new$Month07 is null) then 
    new$Month07 := 0;
  END IF;
  if (new$Month08 is null) then 
    new$Month08 := 0;
  END IF;
  if (new$Month09 is null) then 
    new$Month09 := 0;
  END IF;
  if (new$Month10 is null) then 
    new$Month10 := 0;
  END IF;
  if (new$Month11 is null) then 
    new$Month11 := 0;
  END IF;
  if (new$Month12 is null) then 
    new$Month12 := 0;
  END IF;
  if (new$Quarter1 is null) then 
    new$Quarter1 := 0;
  END IF;
  if (new$Quarter2 is null) then 
    new$Quarter2 := 0;
  END IF;
  if (new$Quarter3 is null) then 
    new$Quarter3 := 0;
  END IF;
  if (new$Quarter4 is null) then 
    new$Quarter4 := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$Month01Delta is null) then 
    new$Month01Delta := 0;
  END IF;
  if (new$Month02Delta is null) then 
    new$Month02Delta := 0;
  END IF;
  if (new$Month03Delta is null) then 
    new$Month03Delta := 0;
  END IF;
  if (new$Month04Delta is null) then 
    new$Month04Delta := 0;
  END IF;
  if (new$Month05Delta is null) then 
    new$Month05Delta := 0;
  END IF;
  if (new$Month06Delta is null) then 
    new$Month06Delta := 0;
  END IF;
  if (new$Month07Delta is null) then 
    new$Month07Delta := 0;
  END IF;
  if (new$Month08Delta is null) then 
    new$Month08Delta := 0;
  END IF;
  if (new$Month09Delta is null) then 
    new$Month09Delta := 0;
  END IF;
  if (new$Month10Delta is null) then 
    new$Month10Delta := 0;
  END IF;
  if (new$Month11Delta is null) then 
    new$Month11Delta := 0;
  END IF;
  if (new$Month12Delta is null) then 
    new$Month12Delta := 0;
  END IF;
  if (new$Quarter1Delta is null) then 
    new$Quarter1Delta := 0;
  END IF;
  if (new$Quarter2Delta is null) then 
    new$Quarter2Delta := 0;
  END IF;
  if (new$Quarter3Delta is null) then 
    new$Quarter3Delta := 0;
  END IF;
  if (new$Quarter4Delta is null) then 
    new$Quarter4Delta := 0;
  END IF;
  if (new$SummaDelta is null) then 
    new$SummaDelta := 0; 
  END IF;
  if (new$SummaPreviousYear is null) then 
    new$SummaPreviousYear := 0;
  END IF;
  if (new$SummaFinPreviousYear is null) then 
    new$SummaFinPreviousYear := 0;
  END IF;
   
  if (new$SummaYear1 is null) then 
    new$SummaYear1 := 0;
  END IF;
  if (new$SummaYear2 is null) then 
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then 
    new$SummaYear3 := 0;
  END IF;
   
  if (new$SummaYear1Delta is null) then 
    new$SummaYear1Delta := 0;
  END IF;
  if (new$SummaYear2Delta is null) then 
    new$SummaYear2Delta := 0;
  END IF;
  if (new$SummaYear3Delta is null) then 
    new$SummaYear3Delta := 0;
  END IF;
   
  if (new$SummaYear2 is null) then  
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then  
    new$SummaYear3 := 0;
  END IF;
  /* проверка на то, что ссылаемся на этап из этого договора */
  if (new$ProgIndex = 304 and new$RecordIndex is not null and (:old.RecordIndex is null or :old.RecordIndex <> new$RecordIndex)) then
    SELECT COUNT(*) INTO CNT$1
    from AgreementSteps s where (s.Id = new$RecordIndex and s.RecordIndex = new$AgreementRef) AND (ROWNUM = 1);
    if (not (CNT$1<> 0)) then
      RaiseException('Ex_WrongStep');
    END IF;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      RaiseException('Ex_CantModufyBudget');
    END IF;
  END IF;
  if ((:old.ANumber is null) and (new$ANumber is not Null)) then
    SELECT COUNT(                    id
    ) INTO CNT$2
    from
    PaymentSchedule ps
    where
    (                    (ps.ANumber = new$ANumber)
    and
    (ps.BudgetRef = new$BudgetRef)) AND (ROWNUM = 1);
    if ((CNT$2<> 0)) then
      RaiseException('ex_Promise_NumUQ');
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_PAYMENTSCHEDULE_BU_1)
-- Create 05.03.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /* Версия триггера 1.0*/
    if (new$Quarter1 = 0) then new$Quarter1 := new$Month01 + new$Month02 + new$Month03; end if;
    if (new$Quarter2 = 0) then new$Quarter2 := new$Month04 + new$Month05 + new$Month06; end if;
    if (new$Quarter3 = 0) then new$Quarter3 := new$Month07 + new$Month08 + new$Month09; end if;
    if (new$Quarter4 = 0) then new$Quarter4 := new$Month10 + new$Month11 + new$Month12; end if;
    new$SummaYear1 := new$Quarter1 + new$Quarter2 + new$Quarter3 + new$Quarter4;

-- - - - - - - - - - - - -
-- BU_3 (TR_PAYMENTSCHEDULE_BU_3)
-- Create 03.12.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

    /* Это поле проставляется при вставке и никогда не может изменить значение */
    new$AdjustmentRef := :old.AdjustmentRef;

-- - - - - - - - - - - - -
-- BU_10 (TR_PAYMENTSCHEDULE_BU_10)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Следим, чтобы никто не поменял внутреннюю нумерацию, иначе все накернится*/
  if ((new$ANumber <> :old.ANumber) or
  (new$InnerPromiseNum <> :old.InnerPromiseNum) or
  (new$AdjustmentNumber <> :old.AdjustmentNumber)) then
    RaiseException('EX_AGR_ChangeInnerNums');
  END IF;
      
  /* Отменять отклонение нельзя!!!*/
  if (((:old.AcceptDate is not null) and (:old.Accepted = 0)) and 
  ((new$Accepted = 1) or (new$AcceptDate is null))) then
    RaiseException('EX_RollbackCancel');
  END IF;
  /* Если приняли ДИ, тогда необходимо установить флаг LastAccepted*/
  if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 1)) or 
  ((:old.Accepted = 0) and (new$Accepted = 1) and (new$AcceptDate is not null))) then
    /* Менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (new$LastAdjustment = 1) then
      new$LastAccepted := 1;
              
    else
      RaiseException('EX_BP_ChangeStateAdjust');    
    END IF;
  END IF;
      
  /* Если отменили принятие документа, тогда необходимо снять флаг LastAccepted*/
  if (((:old.AcceptDate is not null) and (:old.Accepted = 1)) and
  ((new$Accepted = 0) or (new$AcceptDate is null))) then
    /* Менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (new$LastAdjustment = 1) then
      new$LastAccepted := 0;
              
    else
      RaiseException('EX_BP_ChangeStateAdjust');    
    END IF;
  END IF;
      
  /* Если отклонили ДИ, тогда необходимо скинуть флаг LastAdjustment*/
  if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 0)) or 
  ((:old.Accepted = 1) and (new$Accepted = 0) and (new$AcceptDate is not null))) then
    if (new$LastAdjustment = 1) then
      new$LastAdjustment := 0;
      new$LastAccepted := 0;
              
    else
      RaiseException('EX_AGR_ChangeStateAdjust');
    END IF;

    select max(AdjustmentNumber) into MaxNumber1$ from PaymentSchedule 
    where (InnerPromiseNum = new$InnerPromiseNum) ;
    /* нельзя отклонять первоначальное БО, если к нему существуют уточнения*/
    if ((new$adjustmentNumber=0) and (MaxNumber1$<>0))
    then 
      RaiseException('EX_BP_PrimaryBPHasNotify');    
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_PAYMENTSCHEDULE_BU_100)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Для уточнений дельту вычисляем как разницу текущего уточнения и предыдущего */  
  if (new$AdjustmentNumber > 0) then
    BEGIN
      select 
      Month01, Month02, Month03, Month04, Month05, Month06,
      Month07, Month08, Month09, Month10, Month11, Month12,
      Quarter1, Quarter2, Quarter3, Quarter4, Summa,
      SummaYear1, SummaYear2, SummaYear3
      into
      M01$, M02$, M03$, M04$, M05$, M06$, M07$, M08$, M09$, M10$, M11$, M12$, 
      Q1$, Q2$, Q3$, Q4$, S$, S1$, S2$, S3$         from 
      PaymentSchedule
      where
      ID = new$AdjustmentRef
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
          
    new$Month01Delta := new$Month01 - M01$;
    new$Month02Delta := new$Month02 - M02$;
    new$Month03Delta := new$Month03 - M03$;
    new$Month04Delta := new$Month04 - M04$;
    new$Month05Delta := new$Month05 - M05$;
    new$Month06Delta := new$Month06 - M06$;
    new$Month07Delta := new$Month07 - M07$;
    new$Month08Delta := new$Month08 - M08$;
    new$Month09Delta := new$Month09 - M09$;
    new$Month10Delta := new$Month10 - M10$;
    new$Month11Delta := new$Month11 - M11$;
    new$Month12Delta := new$Month12 - M12$;
    new$Quarter1Delta := new$Quarter1 - Q1$;
    new$Quarter2Delta := new$Quarter2 - Q2$;
    new$Quarter3Delta := new$Quarter3 - Q3$;
    new$Quarter4Delta := new$Quarter4 - Q4$;
    new$SummaDelta := new$Summa - S$;
    new$SummaYear1Delta := new$SummaYear1 - S1$;
    new$SummaYear2Delta := new$SummaYear2 - S2$;
    new$SummaYear3Delta := new$SummaYear3 - S3$;
        
  else /* В первых версиях дельты равны суммам БО */  
    new$Month01Delta := new$Month01;
    new$Month02Delta := new$Month02;
    new$Month03Delta := new$Month03;
    new$Month04Delta := new$Month04;
    new$Month05Delta := new$Month05;
    new$Month06Delta := new$Month06;
    new$Month07Delta := new$Month07;
    new$Month08Delta := new$Month08;
    new$Month09Delta := new$Month09;
    new$Month10Delta := new$Month10;
    new$Month11Delta := new$Month11;
    new$Month12Delta := new$Month12;
    new$Quarter1Delta := new$Quarter1;
    new$Quarter2Delta := new$Quarter2;
    new$Quarter3Delta := new$Quarter3;
    new$Quarter4Delta := new$Quarter4;
    new$SummaDelta := new$Summa;
    new$SummaYear1Delta := new$SummaYear1;
    new$SummaYear2Delta := new$SummaYear2;
    new$SummaYear3Delta := new$SummaYear3;
        
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_PAYMENTSCHEDULE_BU_200)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* если отклоняем БО */
  if (new$Accepted = 0 and new$AcceptDate is not null and :old.Accepted = 1) then
    /* смотрим все документы, в которых указано данное БО
         * если документ не отклонен, то нельзя отклонить и БО */
    FOR REC$1 IN (      select ffc.Reject_Cls  AS DocumentRejectCls from FacialFinDetail ffd
    left join FacialFinCaption ffc on (ffc.ID = ffd.RecordIndex)
    where SourcePromise = new$ANumber and SourceBudgetPromise = new$InnerPromiseNum
    or DestPromise = new$ANumber and DestBudgetPromise = new$InnerPromiseNum
    )
    LOOP
      if (REC$1.DocumentRejectCls is null) then
        RaiseException('Ex_BP_CannotReject');    
      END IF;
    END LOOP;
    /* проверяем, что на БО не уточнено более поздним неотклоненным уточнением*/
    FOR REC$1 IN (      SELECT Count(ps_in.ID)  AS AdjCount FROM PaymentSchedule ps_in
    WHERE (ps_in.InnerPromiseNum = new$InnerPromiseNum)and(ps_in.AdjustmentNumber > new$AdjustmentNumber)
    and (ps_in.Accepted<>0) 
    )
    LOOP
      if (REC$1.AdjCount > 0) then
        RaiseException('EX_BP_AdjustmentedCANNOTREJECT');    
      END IF;
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_400 (tr_PaymentSchedule_BU_400)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$AgreementRef <> :old.AgreementRef or new$ExecutionRef <> :old.ExecutionRef) then
    RaiseException('EX_CANTCHANGECAPTIONREF');
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_PAYMENTSCHEDULE_BU_700)
-- Create 14.10.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$RVersion is null) then
    new$RVersion := 1;
  elsif ((new$RVersion = -1) and (:Old.RVersion <> -1)) then
    new$RVersion := :Old.RVersion;
  else
    new$RVersion := :Old.RVersion + 1;
  end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_PAYMENTSCHEDULE SET
    ID = new$ID,
    ANUMBER = new$ANUMBER,
    PARENTNUMBER = new$PARENTNUMBER,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVSR = new$KVSR,
    KCSR = new$KCSR,
    KVR = new$KVR,
    MONTH01 = new$MONTH01,
    MONTH02 = new$MONTH02,
    MONTH03 = new$MONTH03,
    MONTH04 = new$MONTH04,
    MONTH05 = new$MONTH05,
    MONTH06 = new$MONTH06,
    MONTH07 = new$MONTH07,
    MONTH08 = new$MONTH08,
    MONTH09 = new$MONTH09,
    MONTH10 = new$MONTH10,
    MONTH11 = new$MONTH11,
    MONTH12 = new$MONTH12,
    SUMMA = new$SUMMA,
    REGION = new$REGION,
    SUBKESR = new$SUBKESR,
    MEANSTYPE = new$MEANSTYPE,
    FINSOURCE = new$FINSOURCE,
    FINTYPE = new$FINTYPE,
    FACT = new$FACT,
    FACIALACC_CLS = new$FACIALACC_CLS,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    ACCEPTDATE = new$ACCEPTDATE,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    ACCEPTED = new$ACCEPTED,
    LASTACCEPTED = new$LASTACCEPTED,
    PROMISETYPE = new$PROMISETYPE,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    OLDNUMBER = new$OLDNUMBER,
    SUMMAPREVIOUSYEAR = new$SUMMAPREVIOUSYEAR,
    SUMMAFINPREVIOUSYEAR = new$SUMMAFINPREVIOUSYEAR,
    QUARTER1 = new$QUARTER1,
    QUARTER2 = new$QUARTER2,
    QUARTER3 = new$QUARTER3,
    QUARTER4 = new$QUARTER4,
    RECORDINDEX = new$RECORDINDEX,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    DIRECTIONCLS = new$DIRECTIONCLS,
    RVERSION = new$RVERSION,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    MONTH01DELTA = new$MONTH01DELTA,
    MONTH02DELTA = new$MONTH02DELTA,
    MONTH03DELTA = new$MONTH03DELTA,
    MONTH04DELTA = new$MONTH04DELTA,
    MONTH05DELTA = new$MONTH05DELTA,
    MONTH06DELTA = new$MONTH06DELTA,
    MONTH07DELTA = new$MONTH07DELTA,
    MONTH08DELTA = new$MONTH08DELTA,
    MONTH09DELTA = new$MONTH09DELTA,
    MONTH10DELTA = new$MONTH10DELTA,
    MONTH11DELTA = new$MONTH11DELTA,
    MONTH12DELTA = new$MONTH12DELTA,
    QUARTER1DELTA = new$QUARTER1DELTA,
    QUARTER2DELTA = new$QUARTER2DELTA,
    QUARTER3DELTA = new$QUARTER3DELTA,
    QUARTER4DELTA = new$QUARTER4DELTA,
    SUMMADELTA = new$SUMMADELTA,
    NOTE = new$NOTE,
    FINYEAR = new$FINYEAR,
    SUMMAYEAR1 = new$SUMMAYEAR1,
    SUMMAYEAR2 = new$SUMMAYEAR2,
    SUMMAYEAR3 = new$SUMMAYEAR3,
    SUMMAYEAR1DELTA = new$SUMMAYEAR1DELTA,
    SUMMAYEAR2DELTA = new$SUMMAYEAR2DELTA,
    SUMMAYEAR3DELTA = new$SUMMAYEAR3DELTA,
    ASSIGNMENTKIND = new$ASSIGNMENTKIND,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    EXECUTIONREF = new$EXECUTIONREF,
    INNERPROMISENUM = new$INNERPROMISENUM,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    PROMISENUMBER = new$PROMISENUMBER,
    SUBSIDYCLS = new$SUBSIDYCLS,
    AGREEMENTREF = new$AGREEMENTREF,
    BUDALLOCATIONCLS = new$BUDALLOCATIONCLS,
    PAYPROMISECLS = new$PAYPROMISECLS,
    PROGINDEX = new$PROGINDEX,
    INVESTOBJECT = new$INVESTOBJECT,
    SUMMAYEAR4 = new$SUMMAYEAR4,
    SUMMAOTHERYEARS = new$SUMMAOTHERYEARS,
    SUMMAYEAR4DELTA = new$SUMMAYEAR4DELTA,
    SUMMAOTHERYEARSDELTA = new$SUMMAOTHERYEARSDELTA
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_10 (TR_PAYMENTSCHEDULE_AU_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/

  /* Коррекция вспомогательных флагов в уточняемой записи*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentNumber > 0) and (new$LastAccepted <> :old.LastAccepted) and (:old.LastAdjustment = 1)) then
    update PaymentSchedule set
    LastAccepted = :old.LastAccepted,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;
  /* После отклонения БО необходимо восстановить флаг LastAdjustment у последней принятой версии*/
  if ((new$AdjustmentNumber > 0) and (:old.LastAdjustment = 1) and (new$LastAdjustment = 0) and 
  (new$AcceptDate is not null) and (new$Accepted = 0)) then
    update PaymentSchedule set
    LastAdjustment = 1,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_PAYMENTSCHEDULE_AU_500)
-- Create 28.04.2005
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (113, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=113) and (RecordId=new$ID);
  end if;

END;
/
commit work
/
update PAYMENTSCHEDULE set
  SummaYear4 = 0,
  SummaOtherYears = 0,
  SummaYear4Delta = 0,
  SummaOtherYearsDelta = 0
/
commit work
/
-- CREATE TRIGGER TR_PAYMENTSCHEDULE_BU
CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_IU
  INSTEAD OF UPDATE
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  new$ID PAYMENTSCHEDULE.ID%TYPE := :NEW.ID;
  new$ANUMBER PAYMENTSCHEDULE.ANUMBER%TYPE := :NEW.ANUMBER;
  new$PARENTNUMBER PAYMENTSCHEDULE.PARENTNUMBER%TYPE := :NEW.PARENTNUMBER;
  new$KFSR PAYMENTSCHEDULE.KFSR%TYPE := :NEW.KFSR;
  new$KESR PAYMENTSCHEDULE.KESR%TYPE := :NEW.KESR;
  new$KVSR PAYMENTSCHEDULE.KVSR%TYPE := :NEW.KVSR;
  new$KCSR PAYMENTSCHEDULE.KCSR%TYPE := :NEW.KCSR;
  new$KVR PAYMENTSCHEDULE.KVR%TYPE := :NEW.KVR;
  new$MONTH01 PAYMENTSCHEDULE.MONTH01%TYPE := :NEW.MONTH01;
  new$MONTH02 PAYMENTSCHEDULE.MONTH02%TYPE := :NEW.MONTH02;
  new$MONTH03 PAYMENTSCHEDULE.MONTH03%TYPE := :NEW.MONTH03;
  new$MONTH04 PAYMENTSCHEDULE.MONTH04%TYPE := :NEW.MONTH04;
  new$MONTH05 PAYMENTSCHEDULE.MONTH05%TYPE := :NEW.MONTH05;
  new$MONTH06 PAYMENTSCHEDULE.MONTH06%TYPE := :NEW.MONTH06;
  new$MONTH07 PAYMENTSCHEDULE.MONTH07%TYPE := :NEW.MONTH07;
  new$MONTH08 PAYMENTSCHEDULE.MONTH08%TYPE := :NEW.MONTH08;
  new$MONTH09 PAYMENTSCHEDULE.MONTH09%TYPE := :NEW.MONTH09;
  new$MONTH10 PAYMENTSCHEDULE.MONTH10%TYPE := :NEW.MONTH10;
  new$MONTH11 PAYMENTSCHEDULE.MONTH11%TYPE := :NEW.MONTH11;
  new$MONTH12 PAYMENTSCHEDULE.MONTH12%TYPE := :NEW.MONTH12;
  new$SUMMA PAYMENTSCHEDULE.SUMMA%TYPE := :NEW.SUMMA;
  new$REGION PAYMENTSCHEDULE.REGION%TYPE := :NEW.REGION;
  new$SUBKESR PAYMENTSCHEDULE.SUBKESR%TYPE := :NEW.SUBKESR;
  new$MEANSTYPE PAYMENTSCHEDULE.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$FINSOURCE PAYMENTSCHEDULE.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$FINTYPE PAYMENTSCHEDULE.FINTYPE%TYPE := :NEW.FINTYPE;
  new$FACT PAYMENTSCHEDULE.FACT%TYPE := :NEW.FACT;
  new$FACIALACC_CLS PAYMENTSCHEDULE.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$CREATERUSER PAYMENTSCHEDULE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE PAYMENTSCHEDULE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE PAYMENTSCHEDULE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER PAYMENTSCHEDULE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF PAYMENTSCHEDULE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$ACCEPTDATE PAYMENTSCHEDULE.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$LASTADJUSTMENT PAYMENTSCHEDULE.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$ACCEPTED PAYMENTSCHEDULE.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED PAYMENTSCHEDULE.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$PROMISETYPE PAYMENTSCHEDULE.PROMISETYPE%TYPE := :NEW.PROMISETYPE;
  new$ADJUSTMENTREF PAYMENTSCHEDULE.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$OLDNUMBER PAYMENTSCHEDULE.OLDNUMBER%TYPE := :NEW.OLDNUMBER;
  new$SUMMAPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAPREVIOUSYEAR%TYPE := :NEW.SUMMAPREVIOUSYEAR;
  new$SUMMAFINPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAFINPREVIOUSYEAR%TYPE := :NEW.SUMMAFINPREVIOUSYEAR;
  new$QUARTER1 PAYMENTSCHEDULE.QUARTER1%TYPE := :NEW.QUARTER1;
  new$QUARTER2 PAYMENTSCHEDULE.QUARTER2%TYPE := :NEW.QUARTER2;
  new$QUARTER3 PAYMENTSCHEDULE.QUARTER3%TYPE := :NEW.QUARTER3;
  new$QUARTER4 PAYMENTSCHEDULE.QUARTER4%TYPE := :NEW.QUARTER4;
  new$RECORDINDEX PAYMENTSCHEDULE.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CRYPTOSTATUS PAYMENTSCHEDULE.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID PAYMENTSCHEDULE.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID PAYMENTSCHEDULE.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DIRECTIONCLS PAYMENTSCHEDULE.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$RVERSION PAYMENTSCHEDULE.RVERSION%TYPE := :NEW.RVERSION;
  new$BUHOPERATIONCLS PAYMENTSCHEDULE.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$MONTH01DELTA PAYMENTSCHEDULE.MONTH01DELTA%TYPE := :NEW.MONTH01DELTA;
  new$MONTH02DELTA PAYMENTSCHEDULE.MONTH02DELTA%TYPE := :NEW.MONTH02DELTA;
  new$MONTH03DELTA PAYMENTSCHEDULE.MONTH03DELTA%TYPE := :NEW.MONTH03DELTA;
  new$MONTH04DELTA PAYMENTSCHEDULE.MONTH04DELTA%TYPE := :NEW.MONTH04DELTA;
  new$MONTH05DELTA PAYMENTSCHEDULE.MONTH05DELTA%TYPE := :NEW.MONTH05DELTA;
  new$MONTH06DELTA PAYMENTSCHEDULE.MONTH06DELTA%TYPE := :NEW.MONTH06DELTA;
  new$MONTH07DELTA PAYMENTSCHEDULE.MONTH07DELTA%TYPE := :NEW.MONTH07DELTA;
  new$MONTH08DELTA PAYMENTSCHEDULE.MONTH08DELTA%TYPE := :NEW.MONTH08DELTA;
  new$MONTH09DELTA PAYMENTSCHEDULE.MONTH09DELTA%TYPE := :NEW.MONTH09DELTA;
  new$MONTH10DELTA PAYMENTSCHEDULE.MONTH10DELTA%TYPE := :NEW.MONTH10DELTA;
  new$MONTH11DELTA PAYMENTSCHEDULE.MONTH11DELTA%TYPE := :NEW.MONTH11DELTA;
  new$MONTH12DELTA PAYMENTSCHEDULE.MONTH12DELTA%TYPE := :NEW.MONTH12DELTA;
  new$QUARTER1DELTA PAYMENTSCHEDULE.QUARTER1DELTA%TYPE := :NEW.QUARTER1DELTA;
  new$QUARTER2DELTA PAYMENTSCHEDULE.QUARTER2DELTA%TYPE := :NEW.QUARTER2DELTA;
  new$QUARTER3DELTA PAYMENTSCHEDULE.QUARTER3DELTA%TYPE := :NEW.QUARTER3DELTA;
  new$QUARTER4DELTA PAYMENTSCHEDULE.QUARTER4DELTA%TYPE := :NEW.QUARTER4DELTA;
  new$SUMMADELTA PAYMENTSCHEDULE.SUMMADELTA%TYPE := :NEW.SUMMADELTA;
  new$NOTE PAYMENTSCHEDULE.NOTE%TYPE := :NEW.NOTE;
  new$FINYEAR PAYMENTSCHEDULE.FINYEAR%TYPE := :NEW.FINYEAR;
  new$SUMMAYEAR1 PAYMENTSCHEDULE.SUMMAYEAR1%TYPE := :NEW.SUMMAYEAR1;
  new$SUMMAYEAR2 PAYMENTSCHEDULE.SUMMAYEAR2%TYPE := :NEW.SUMMAYEAR2;
  new$SUMMAYEAR3 PAYMENTSCHEDULE.SUMMAYEAR3%TYPE := :NEW.SUMMAYEAR3;
  new$SUMMAYEAR1DELTA PAYMENTSCHEDULE.SUMMAYEAR1DELTA%TYPE := :NEW.SUMMAYEAR1DELTA;
  new$SUMMAYEAR2DELTA PAYMENTSCHEDULE.SUMMAYEAR2DELTA%TYPE := :NEW.SUMMAYEAR2DELTA;
  new$SUMMAYEAR3DELTA PAYMENTSCHEDULE.SUMMAYEAR3DELTA%TYPE := :NEW.SUMMAYEAR3DELTA;
  new$ASSIGNMENTKIND PAYMENTSCHEDULE.ASSIGNMENTKIND%TYPE := :NEW.ASSIGNMENTKIND;
  new$TRANSFERTCLS PAYMENTSCHEDULE.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SENDERIDKEY PAYMENTSCHEDULE.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY PAYMENTSCHEDULE.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$EXECUTIONREF PAYMENTSCHEDULE.EXECUTIONREF%TYPE := :NEW.EXECUTIONREF;
  new$INNERPROMISENUM PAYMENTSCHEDULE.INNERPROMISENUM%TYPE := :NEW.INNERPROMISENUM;
  new$ADJUSTMENTNUMBER PAYMENTSCHEDULE.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$PROMISENUMBER PAYMENTSCHEDULE.PROMISENUMBER%TYPE := :NEW.PROMISENUMBER;
  new$SUBSIDYCLS PAYMENTSCHEDULE.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$AGREEMENTREF PAYMENTSCHEDULE.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$BUDALLOCATIONCLS PAYMENTSCHEDULE.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS PAYMENTSCHEDULE.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
  new$PROGINDEX PAYMENTSCHEDULE.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$INVESTOBJECT PAYMENTSCHEDULE.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
  new$SUMMAYEAR4 PAYMENTSCHEDULE.SUMMAYEAR4%TYPE := :NEW.SUMMAYEAR4;
  new$SUMMAOTHERYEARS PAYMENTSCHEDULE.SUMMAOTHERYEARS%TYPE := :NEW.SUMMAOTHERYEARS;
  new$SUMMAYEAR4DELTA PAYMENTSCHEDULE.SUMMAYEAR4DELTA%TYPE := :NEW.SUMMAYEAR4DELTA;
  new$SUMMAOTHERYEARSDELTA PAYMENTSCHEDULE.SUMMAOTHERYEARSDELTA%TYPE := :NEW.SUMMAOTHERYEARSDELTA;
--
  M01$ NUMBER;
  M02$ NUMBER;
  M03$ NUMBER;
  M04$ NUMBER;
  M05$ NUMBER;
  M06$ NUMBER;
  M07$ NUMBER;
  M08$ NUMBER;
  M09$ NUMBER;
  M10$ NUMBER;
  M11$ NUMBER;
  M12$ NUMBER;
  Q1$ NUMBER;
  Q2$ NUMBER;
  Q3$ NUMBER;
  Q4$ NUMBER;
  S$ NUMBER;
  S1$ NUMBER;
  S2$ NUMBER;
  S3$ NUMBER;
  MaxNumber1$ NUMBER(10);
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_PAYMENTSCHEDULE_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 2.4*/
  /* установка значений полей по-умолчанию*/
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$PromiseType is null) then 
    new$PromiseType := 0;
  END IF;
  if (new$KFSR is null) then 
    new$KFSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KCSR is null) then 
    new$KCSR := 0;
  END IF;
  if (new$KVR is null) then 
    new$KVR := 0;
  END IF;
  if (new$SubKESR is null) then 
    new$SubKESR := 0;
  END IF;
  if (new$AssignmentKind is null) then 
    new$AssignmentKind := 0;
  END IF;
   
  if (new$DirectionCls is null) then 
    new$DirectionCls := 0;
  END IF;
   
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$MeansType is null) then 
    new$MeansType := 0;
  END IF;
  if (new$FinSource is null) then 
    new$FinSource := 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$BuhOperationCLS is null) then 
    GetIntConst(60, 15,new$BuhOperationCLS); 
  END IF;
  if (new$Month01 is null) then 
    new$Month01 := 0;
  END IF;
  if (new$Month02 is null) then 
    new$Month02 := 0;
  END IF;
  if (new$Month03 is null) then 
    new$Month03 := 0;
  END IF;
  if (new$Month04 is null) then 
    new$Month04 := 0;
  END IF;
  if (new$Month05 is null) then 
    new$Month05 := 0;
  END IF;
  if (new$Month06 is null) then 
    new$Month06 := 0;
  END IF;
  if (new$Month07 is null) then 
    new$Month07 := 0;
  END IF;
  if (new$Month08 is null) then 
    new$Month08 := 0;
  END IF;
  if (new$Month09 is null) then 
    new$Month09 := 0;
  END IF;
  if (new$Month10 is null) then 
    new$Month10 := 0;
  END IF;
  if (new$Month11 is null) then 
    new$Month11 := 0;
  END IF;
  if (new$Month12 is null) then 
    new$Month12 := 0;
  END IF;
  if (new$Quarter1 is null) then 
    new$Quarter1 := 0;
  END IF;
  if (new$Quarter2 is null) then 
    new$Quarter2 := 0;
  END IF;
  if (new$Quarter3 is null) then 
    new$Quarter3 := 0;
  END IF;
  if (new$Quarter4 is null) then 
    new$Quarter4 := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$Month01Delta is null) then 
    new$Month01Delta := 0;
  END IF;
  if (new$Month02Delta is null) then 
    new$Month02Delta := 0;
  END IF;
  if (new$Month03Delta is null) then 
    new$Month03Delta := 0;
  END IF;
  if (new$Month04Delta is null) then 
    new$Month04Delta := 0;
  END IF;
  if (new$Month05Delta is null) then 
    new$Month05Delta := 0;
  END IF;
  if (new$Month06Delta is null) then 
    new$Month06Delta := 0;
  END IF;
  if (new$Month07Delta is null) then 
    new$Month07Delta := 0;
  END IF;
  if (new$Month08Delta is null) then 
    new$Month08Delta := 0;
  END IF;
  if (new$Month09Delta is null) then 
    new$Month09Delta := 0;
  END IF;
  if (new$Month10Delta is null) then 
    new$Month10Delta := 0;
  END IF;
  if (new$Month11Delta is null) then 
    new$Month11Delta := 0;
  END IF;
  if (new$Month12Delta is null) then 
    new$Month12Delta := 0;
  END IF;
  if (new$Quarter1Delta is null) then 
    new$Quarter1Delta := 0;
  END IF;
  if (new$Quarter2Delta is null) then 
    new$Quarter2Delta := 0;
  END IF;
  if (new$Quarter3Delta is null) then 
    new$Quarter3Delta := 0;
  END IF;
  if (new$Quarter4Delta is null) then 
    new$Quarter4Delta := 0;
  END IF;
  if (new$SummaDelta is null) then 
    new$SummaDelta := 0; 
  END IF;
  if (new$SummaPreviousYear is null) then 
    new$SummaPreviousYear := 0;
  END IF;
  if (new$SummaFinPreviousYear is null) then 
    new$SummaFinPreviousYear := 0;
  END IF;
   
  if (new$SummaYear1 is null) then 
    new$SummaYear1 := 0;
  END IF;
  if (new$SummaYear2 is null) then 
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then 
    new$SummaYear3 := 0;
  END IF;
  if (new$SummaYear4 is null) then 
    new$SummaYear4 := 0;
  END IF;
  if (new$SummaOtherYears is null) then 
    new$SummaOtherYears := 0;
  END IF;
   
  if (new$SummaYear1Delta is null) then 
    new$SummaYear1Delta := 0;
  END IF;
  if (new$SummaYear2Delta is null) then 
    new$SummaYear2Delta := 0;
  END IF;
  if (new$SummaYear3Delta is null) then 
    new$SummaYear3Delta := 0;
  END IF;
  if (new$SummaYear4Delta is null) then 
    new$SummaYear4Delta := 0;
  END IF;
  if (new$SummaOtherYearsDelta is null) then 
    new$SummaOtherYearsDelta := 0;
  END IF;
   
  /* проверка на то, что ссылаемся на этап из этого договора */
  if (new$ProgIndex = 304 and new$RecordIndex is not null and (:old.RecordIndex is null or :old.RecordIndex <> new$RecordIndex)) then
    SELECT COUNT(*) INTO CNT$1
    from AgreementSteps s where (s.Id = new$RecordIndex and s.RecordIndex = new$AgreementRef) AND (ROWNUM = 1);
    if (not (CNT$1<> 0)) then
      RaiseException('Ex_WrongStep');
    END IF;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      RaiseException('Ex_CantModufyBudget');
    END IF;
  END IF;
  if ((:old.ANumber is null) and (new$ANumber is not Null)) then
    SELECT COUNT(                    id
    ) INTO CNT$2
    from
    PaymentSchedule ps
    where
    (                    (ps.ANumber = new$ANumber)
    and
    (ps.BudgetRef = new$BudgetRef)) AND (ROWNUM = 1);
    if ((CNT$2<> 0)) then
      RaiseException('ex_Promise_NumUQ');
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_PAYMENTSCHEDULE_BU_1)
-- Create 05.03.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /* Версия триггера 1.0*/
    if (new$Quarter1 = 0) then new$Quarter1 := new$Month01 + new$Month02 + new$Month03; end if;
    if (new$Quarter2 = 0) then new$Quarter2 := new$Month04 + new$Month05 + new$Month06; end if;
    if (new$Quarter3 = 0) then new$Quarter3 := new$Month07 + new$Month08 + new$Month09; end if;
    if (new$Quarter4 = 0) then new$Quarter4 := new$Month10 + new$Month11 + new$Month12; end if;
    new$SummaYear1 := new$Quarter1 + new$Quarter2 + new$Quarter3 + new$Quarter4;

-- - - - - - - - - - - - -
-- BU_3 (TR_PAYMENTSCHEDULE_BU_3)
-- Create 03.12.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

    /* Это поле проставляется при вставке и никогда не может изменить значение */
    new$AdjustmentRef := :old.AdjustmentRef;

-- - - - - - - - - - - - -
-- BU_10 (TR_PAYMENTSCHEDULE_BU_10)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Следим, чтобы никто не поменял внутреннюю нумерацию, иначе все накернится*/
  if ((new$ANumber <> :old.ANumber) or
  (new$InnerPromiseNum <> :old.InnerPromiseNum) or
  (new$AdjustmentNumber <> :old.AdjustmentNumber)) then
    RaiseException('EX_AGR_ChangeInnerNums');
  END IF;
      
  /* Отменять отклонение нельзя!!!*/
  if (((:old.AcceptDate is not null) and (:old.Accepted = 0)) and 
  ((new$Accepted = 1) or (new$AcceptDate is null))) then
    RaiseException('EX_RollbackCancel');
  END IF;
  /* Если приняли ДИ, тогда необходимо установить флаг LastAccepted*/
  if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 1)) or 
  ((:old.Accepted = 0) and (new$Accepted = 1) and (new$AcceptDate is not null))) then
    /* Менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (new$LastAdjustment = 1) then
      new$LastAccepted := 1;
              
    else
      RaiseException('EX_BP_ChangeStateAdjust');    
    END IF;
  END IF;
      
  /* Если отменили принятие документа, тогда необходимо снять флаг LastAccepted*/
  if (((:old.AcceptDate is not null) and (:old.Accepted = 1)) and
  ((new$Accepted = 0) or (new$AcceptDate is null))) then
    /* Менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (new$LastAdjustment = 1) then
      new$LastAccepted := 0;
              
    else
      RaiseException('EX_BP_ChangeStateAdjust');    
    END IF;
  END IF;
      
  /* Если отклонили ДИ, тогда необходимо скинуть флаг LastAdjustment*/
  if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 0)) or 
  ((:old.Accepted = 1) and (new$Accepted = 0) and (new$AcceptDate is not null))) then
    if (new$LastAdjustment = 1) then
      new$LastAdjustment := 0;
      new$LastAccepted := 0;
              
    else
      RaiseException('EX_AGR_ChangeStateAdjust');
    END IF;

    select max(AdjustmentNumber) into MaxNumber1$ from PaymentSchedule 
    where (InnerPromiseNum = new$InnerPromiseNum) ;
    /* нельзя отклонять первоначальное БО, если к нему существуют уточнения*/
    if ((new$adjustmentNumber=0) and (MaxNumber1$<>0))
    then 
      RaiseException('EX_BP_PrimaryBPHasNotify');    
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_PAYMENTSCHEDULE_BU_100)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Для уточнений дельту вычисляем как разницу текущего уточнения и предыдущего */  
  if (new$AdjustmentNumber > 0) then
    BEGIN
      select 
      Month01, Month02, Month03, Month04, Month05, Month06,
      Month07, Month08, Month09, Month10, Month11, Month12,
      Quarter1, Quarter2, Quarter3, Quarter4, Summa,
      SummaYear1, SummaYear2, SummaYear3
      into
      M01$, M02$, M03$, M04$, M05$, M06$, M07$, M08$, M09$, M10$, M11$, M12$, 
      Q1$, Q2$, Q3$, Q4$, S$, S1$, S2$, S3$         from 
      PaymentSchedule
      where
      ID = new$AdjustmentRef
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
          
    new$Month01Delta := new$Month01 - M01$;
    new$Month02Delta := new$Month02 - M02$;
    new$Month03Delta := new$Month03 - M03$;
    new$Month04Delta := new$Month04 - M04$;
    new$Month05Delta := new$Month05 - M05$;
    new$Month06Delta := new$Month06 - M06$;
    new$Month07Delta := new$Month07 - M07$;
    new$Month08Delta := new$Month08 - M08$;
    new$Month09Delta := new$Month09 - M09$;
    new$Month10Delta := new$Month10 - M10$;
    new$Month11Delta := new$Month11 - M11$;
    new$Month12Delta := new$Month12 - M12$;
    new$Quarter1Delta := new$Quarter1 - Q1$;
    new$Quarter2Delta := new$Quarter2 - Q2$;
    new$Quarter3Delta := new$Quarter3 - Q3$;
    new$Quarter4Delta := new$Quarter4 - Q4$;
    new$SummaDelta := new$Summa - S$;
    new$SummaYear1Delta := new$SummaYear1 - S1$;
    new$SummaYear2Delta := new$SummaYear2 - S2$;
    new$SummaYear3Delta := new$SummaYear3 - S3$;
        
  else /* В первых версиях дельты равны суммам БО */  
    new$Month01Delta := new$Month01;
    new$Month02Delta := new$Month02;
    new$Month03Delta := new$Month03;
    new$Month04Delta := new$Month04;
    new$Month05Delta := new$Month05;
    new$Month06Delta := new$Month06;
    new$Month07Delta := new$Month07;
    new$Month08Delta := new$Month08;
    new$Month09Delta := new$Month09;
    new$Month10Delta := new$Month10;
    new$Month11Delta := new$Month11;
    new$Month12Delta := new$Month12;
    new$Quarter1Delta := new$Quarter1;
    new$Quarter2Delta := new$Quarter2;
    new$Quarter3Delta := new$Quarter3;
    new$Quarter4Delta := new$Quarter4;
    new$SummaDelta := new$Summa;
    new$SummaYear1Delta := new$SummaYear1;
    new$SummaYear2Delta := new$SummaYear2;
    new$SummaYear3Delta := new$SummaYear3;
        
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_PAYMENTSCHEDULE_BU_200)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* если отклоняем БО */
  if (new$Accepted = 0 and new$AcceptDate is not null and :old.Accepted = 1) then
    /* смотрим все документы, в которых указано данное БО
         * если документ не отклонен, то нельзя отклонить и БО */
    FOR REC$1 IN (      select ffc.Reject_Cls  AS DocumentRejectCls from FacialFinDetail ffd
    left join FacialFinCaption ffc on (ffc.ID = ffd.RecordIndex)
    where SourcePromise = new$ANumber and SourceBudgetPromise = new$InnerPromiseNum
    or DestPromise = new$ANumber and DestBudgetPromise = new$InnerPromiseNum
    )
    LOOP
      if (REC$1.DocumentRejectCls is null) then
        RaiseException('Ex_BP_CannotReject');    
      END IF;
    END LOOP;
    /* проверяем, что на БО не уточнено более поздним неотклоненным уточнением*/
    FOR REC$1 IN (      SELECT Count(ps_in.ID)  AS AdjCount FROM PaymentSchedule ps_in
    WHERE (ps_in.InnerPromiseNum = new$InnerPromiseNum)and(ps_in.AdjustmentNumber > new$AdjustmentNumber)
    and (ps_in.Accepted<>0) 
    )
    LOOP
      if (REC$1.AdjCount > 0) then
        RaiseException('EX_BP_AdjustmentedCANNOTREJECT');    
      END IF;
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_400 (tr_PaymentSchedule_BU_400)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$AgreementRef <> :old.AgreementRef or new$ExecutionRef <> :old.ExecutionRef) then
    RaiseException('EX_CANTCHANGECAPTIONREF');
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_PAYMENTSCHEDULE_BU_700)
-- Create 14.10.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$RVersion is null) then
    new$RVersion := 1;
  elsif ((new$RVersion = -1) and (:Old.RVersion <> -1)) then
    new$RVersion := :Old.RVersion;
  else
    new$RVersion := :Old.RVersion + 1;
  end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_PAYMENTSCHEDULE SET
    ID = new$ID,
    ANUMBER = new$ANUMBER,
    PARENTNUMBER = new$PARENTNUMBER,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVSR = new$KVSR,
    KCSR = new$KCSR,
    KVR = new$KVR,
    MONTH01 = new$MONTH01,
    MONTH02 = new$MONTH02,
    MONTH03 = new$MONTH03,
    MONTH04 = new$MONTH04,
    MONTH05 = new$MONTH05,
    MONTH06 = new$MONTH06,
    MONTH07 = new$MONTH07,
    MONTH08 = new$MONTH08,
    MONTH09 = new$MONTH09,
    MONTH10 = new$MONTH10,
    MONTH11 = new$MONTH11,
    MONTH12 = new$MONTH12,
    SUMMA = new$SUMMA,
    REGION = new$REGION,
    SUBKESR = new$SUBKESR,
    MEANSTYPE = new$MEANSTYPE,
    FINSOURCE = new$FINSOURCE,
    FINTYPE = new$FINTYPE,
    FACT = new$FACT,
    FACIALACC_CLS = new$FACIALACC_CLS,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    ACCEPTDATE = new$ACCEPTDATE,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    ACCEPTED = new$ACCEPTED,
    LASTACCEPTED = new$LASTACCEPTED,
    PROMISETYPE = new$PROMISETYPE,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    OLDNUMBER = new$OLDNUMBER,
    SUMMAPREVIOUSYEAR = new$SUMMAPREVIOUSYEAR,
    SUMMAFINPREVIOUSYEAR = new$SUMMAFINPREVIOUSYEAR,
    QUARTER1 = new$QUARTER1,
    QUARTER2 = new$QUARTER2,
    QUARTER3 = new$QUARTER3,
    QUARTER4 = new$QUARTER4,
    RECORDINDEX = new$RECORDINDEX,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    DIRECTIONCLS = new$DIRECTIONCLS,
    RVERSION = new$RVERSION,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    MONTH01DELTA = new$MONTH01DELTA,
    MONTH02DELTA = new$MONTH02DELTA,
    MONTH03DELTA = new$MONTH03DELTA,
    MONTH04DELTA = new$MONTH04DELTA,
    MONTH05DELTA = new$MONTH05DELTA,
    MONTH06DELTA = new$MONTH06DELTA,
    MONTH07DELTA = new$MONTH07DELTA,
    MONTH08DELTA = new$MONTH08DELTA,
    MONTH09DELTA = new$MONTH09DELTA,
    MONTH10DELTA = new$MONTH10DELTA,
    MONTH11DELTA = new$MONTH11DELTA,
    MONTH12DELTA = new$MONTH12DELTA,
    QUARTER1DELTA = new$QUARTER1DELTA,
    QUARTER2DELTA = new$QUARTER2DELTA,
    QUARTER3DELTA = new$QUARTER3DELTA,
    QUARTER4DELTA = new$QUARTER4DELTA,
    SUMMADELTA = new$SUMMADELTA,
    NOTE = new$NOTE,
    FINYEAR = new$FINYEAR,
    SUMMAYEAR1 = new$SUMMAYEAR1,
    SUMMAYEAR2 = new$SUMMAYEAR2,
    SUMMAYEAR3 = new$SUMMAYEAR3,
    SUMMAYEAR1DELTA = new$SUMMAYEAR1DELTA,
    SUMMAYEAR2DELTA = new$SUMMAYEAR2DELTA,
    SUMMAYEAR3DELTA = new$SUMMAYEAR3DELTA,
    ASSIGNMENTKIND = new$ASSIGNMENTKIND,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    EXECUTIONREF = new$EXECUTIONREF,
    INNERPROMISENUM = new$INNERPROMISENUM,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    PROMISENUMBER = new$PROMISENUMBER,
    SUBSIDYCLS = new$SUBSIDYCLS,
    AGREEMENTREF = new$AGREEMENTREF,
    BUDALLOCATIONCLS = new$BUDALLOCATIONCLS,
    PAYPROMISECLS = new$PAYPROMISECLS,
    PROGINDEX = new$PROGINDEX,
    INVESTOBJECT = new$INVESTOBJECT,
    SUMMAYEAR4 = new$SUMMAYEAR4,
    SUMMAOTHERYEARS = new$SUMMAOTHERYEARS,
    SUMMAYEAR4DELTA = new$SUMMAYEAR4DELTA,
    SUMMAOTHERYEARSDELTA = new$SUMMAOTHERYEARSDELTA
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_10 (TR_PAYMENTSCHEDULE_AU_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/

  /* Коррекция вспомогательных флагов в уточняемой записи*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentNumber > 0) and (new$LastAccepted <> :old.LastAccepted) and (:old.LastAdjustment = 1)) then
    update PaymentSchedule set
    LastAccepted = :old.LastAccepted,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;
  /* После отклонения БО необходимо восстановить флаг LastAdjustment у последней принятой версии*/
  if ((new$AdjustmentNumber > 0) and (:old.LastAdjustment = 1) and (new$LastAdjustment = 0) and 
  (new$AcceptDate is not null) and (new$Accepted = 0)) then
    update PaymentSchedule set
    LastAdjustment = 1,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_PAYMENTSCHEDULE_AU_500)
-- Create 28.04.2005
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (113, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=113) and (RecordId=new$ID);
  end if;

END;
/
-- CREATE TRIGGER TR_PAYMENTSCHEDULE_BI
CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_II
  INSTEAD OF INSERT
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  new$ID PAYMENTSCHEDULE.ID%TYPE := :NEW.ID;
  new$ANUMBER PAYMENTSCHEDULE.ANUMBER%TYPE := :NEW.ANUMBER;
  new$PARENTNUMBER PAYMENTSCHEDULE.PARENTNUMBER%TYPE := :NEW.PARENTNUMBER;
  new$KFSR PAYMENTSCHEDULE.KFSR%TYPE := :NEW.KFSR;
  new$KESR PAYMENTSCHEDULE.KESR%TYPE := :NEW.KESR;
  new$KVSR PAYMENTSCHEDULE.KVSR%TYPE := :NEW.KVSR;
  new$KCSR PAYMENTSCHEDULE.KCSR%TYPE := :NEW.KCSR;
  new$KVR PAYMENTSCHEDULE.KVR%TYPE := :NEW.KVR;
  new$MONTH01 PAYMENTSCHEDULE.MONTH01%TYPE := :NEW.MONTH01;
  new$MONTH02 PAYMENTSCHEDULE.MONTH02%TYPE := :NEW.MONTH02;
  new$MONTH03 PAYMENTSCHEDULE.MONTH03%TYPE := :NEW.MONTH03;
  new$MONTH04 PAYMENTSCHEDULE.MONTH04%TYPE := :NEW.MONTH04;
  new$MONTH05 PAYMENTSCHEDULE.MONTH05%TYPE := :NEW.MONTH05;
  new$MONTH06 PAYMENTSCHEDULE.MONTH06%TYPE := :NEW.MONTH06;
  new$MONTH07 PAYMENTSCHEDULE.MONTH07%TYPE := :NEW.MONTH07;
  new$MONTH08 PAYMENTSCHEDULE.MONTH08%TYPE := :NEW.MONTH08;
  new$MONTH09 PAYMENTSCHEDULE.MONTH09%TYPE := :NEW.MONTH09;
  new$MONTH10 PAYMENTSCHEDULE.MONTH10%TYPE := :NEW.MONTH10;
  new$MONTH11 PAYMENTSCHEDULE.MONTH11%TYPE := :NEW.MONTH11;
  new$MONTH12 PAYMENTSCHEDULE.MONTH12%TYPE := :NEW.MONTH12;
  new$SUMMA PAYMENTSCHEDULE.SUMMA%TYPE := :NEW.SUMMA;
  new$REGION PAYMENTSCHEDULE.REGION%TYPE := :NEW.REGION;
  new$SUBKESR PAYMENTSCHEDULE.SUBKESR%TYPE := :NEW.SUBKESR;
  new$MEANSTYPE PAYMENTSCHEDULE.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$FINSOURCE PAYMENTSCHEDULE.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$FINTYPE PAYMENTSCHEDULE.FINTYPE%TYPE := :NEW.FINTYPE;
  new$FACT PAYMENTSCHEDULE.FACT%TYPE := :NEW.FACT;
  new$FACIALACC_CLS PAYMENTSCHEDULE.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$CREATERUSER PAYMENTSCHEDULE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE PAYMENTSCHEDULE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE PAYMENTSCHEDULE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER PAYMENTSCHEDULE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF PAYMENTSCHEDULE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$ACCEPTDATE PAYMENTSCHEDULE.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$LASTADJUSTMENT PAYMENTSCHEDULE.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$ACCEPTED PAYMENTSCHEDULE.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED PAYMENTSCHEDULE.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$PROMISETYPE PAYMENTSCHEDULE.PROMISETYPE%TYPE := :NEW.PROMISETYPE;
  new$ADJUSTMENTREF PAYMENTSCHEDULE.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$OLDNUMBER PAYMENTSCHEDULE.OLDNUMBER%TYPE := :NEW.OLDNUMBER;
  new$SUMMAPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAPREVIOUSYEAR%TYPE := :NEW.SUMMAPREVIOUSYEAR;
  new$SUMMAFINPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAFINPREVIOUSYEAR%TYPE := :NEW.SUMMAFINPREVIOUSYEAR;
  new$QUARTER1 PAYMENTSCHEDULE.QUARTER1%TYPE := :NEW.QUARTER1;
  new$QUARTER2 PAYMENTSCHEDULE.QUARTER2%TYPE := :NEW.QUARTER2;
  new$QUARTER3 PAYMENTSCHEDULE.QUARTER3%TYPE := :NEW.QUARTER3;
  new$QUARTER4 PAYMENTSCHEDULE.QUARTER4%TYPE := :NEW.QUARTER4;
  new$RECORDINDEX PAYMENTSCHEDULE.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CRYPTOSTATUS PAYMENTSCHEDULE.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID PAYMENTSCHEDULE.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID PAYMENTSCHEDULE.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DIRECTIONCLS PAYMENTSCHEDULE.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$RVERSION PAYMENTSCHEDULE.RVERSION%TYPE := :NEW.RVERSION;
  new$BUHOPERATIONCLS PAYMENTSCHEDULE.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$MONTH01DELTA PAYMENTSCHEDULE.MONTH01DELTA%TYPE := :NEW.MONTH01DELTA;
  new$MONTH02DELTA PAYMENTSCHEDULE.MONTH02DELTA%TYPE := :NEW.MONTH02DELTA;
  new$MONTH03DELTA PAYMENTSCHEDULE.MONTH03DELTA%TYPE := :NEW.MONTH03DELTA;
  new$MONTH04DELTA PAYMENTSCHEDULE.MONTH04DELTA%TYPE := :NEW.MONTH04DELTA;
  new$MONTH05DELTA PAYMENTSCHEDULE.MONTH05DELTA%TYPE := :NEW.MONTH05DELTA;
  new$MONTH06DELTA PAYMENTSCHEDULE.MONTH06DELTA%TYPE := :NEW.MONTH06DELTA;
  new$MONTH07DELTA PAYMENTSCHEDULE.MONTH07DELTA%TYPE := :NEW.MONTH07DELTA;
  new$MONTH08DELTA PAYMENTSCHEDULE.MONTH08DELTA%TYPE := :NEW.MONTH08DELTA;
  new$MONTH09DELTA PAYMENTSCHEDULE.MONTH09DELTA%TYPE := :NEW.MONTH09DELTA;
  new$MONTH10DELTA PAYMENTSCHEDULE.MONTH10DELTA%TYPE := :NEW.MONTH10DELTA;
  new$MONTH11DELTA PAYMENTSCHEDULE.MONTH11DELTA%TYPE := :NEW.MONTH11DELTA;
  new$MONTH12DELTA PAYMENTSCHEDULE.MONTH12DELTA%TYPE := :NEW.MONTH12DELTA;
  new$QUARTER1DELTA PAYMENTSCHEDULE.QUARTER1DELTA%TYPE := :NEW.QUARTER1DELTA;
  new$QUARTER2DELTA PAYMENTSCHEDULE.QUARTER2DELTA%TYPE := :NEW.QUARTER2DELTA;
  new$QUARTER3DELTA PAYMENTSCHEDULE.QUARTER3DELTA%TYPE := :NEW.QUARTER3DELTA;
  new$QUARTER4DELTA PAYMENTSCHEDULE.QUARTER4DELTA%TYPE := :NEW.QUARTER4DELTA;
  new$SUMMADELTA PAYMENTSCHEDULE.SUMMADELTA%TYPE := :NEW.SUMMADELTA;
  new$NOTE PAYMENTSCHEDULE.NOTE%TYPE := :NEW.NOTE;
  new$FINYEAR PAYMENTSCHEDULE.FINYEAR%TYPE := :NEW.FINYEAR;
  new$SUMMAYEAR1 PAYMENTSCHEDULE.SUMMAYEAR1%TYPE := :NEW.SUMMAYEAR1;
  new$SUMMAYEAR2 PAYMENTSCHEDULE.SUMMAYEAR2%TYPE := :NEW.SUMMAYEAR2;
  new$SUMMAYEAR3 PAYMENTSCHEDULE.SUMMAYEAR3%TYPE := :NEW.SUMMAYEAR3;
  new$SUMMAYEAR1DELTA PAYMENTSCHEDULE.SUMMAYEAR1DELTA%TYPE := :NEW.SUMMAYEAR1DELTA;
  new$SUMMAYEAR2DELTA PAYMENTSCHEDULE.SUMMAYEAR2DELTA%TYPE := :NEW.SUMMAYEAR2DELTA;
  new$SUMMAYEAR3DELTA PAYMENTSCHEDULE.SUMMAYEAR3DELTA%TYPE := :NEW.SUMMAYEAR3DELTA;
  new$ASSIGNMENTKIND PAYMENTSCHEDULE.ASSIGNMENTKIND%TYPE := :NEW.ASSIGNMENTKIND;
  new$TRANSFERTCLS PAYMENTSCHEDULE.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SENDERIDKEY PAYMENTSCHEDULE.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY PAYMENTSCHEDULE.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$EXECUTIONREF PAYMENTSCHEDULE.EXECUTIONREF%TYPE := :NEW.EXECUTIONREF;
  new$INNERPROMISENUM PAYMENTSCHEDULE.INNERPROMISENUM%TYPE := :NEW.INNERPROMISENUM;
  new$ADJUSTMENTNUMBER PAYMENTSCHEDULE.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$PROMISENUMBER PAYMENTSCHEDULE.PROMISENUMBER%TYPE := :NEW.PROMISENUMBER;
  new$SUBSIDYCLS PAYMENTSCHEDULE.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$AGREEMENTREF PAYMENTSCHEDULE.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$BUDALLOCATIONCLS PAYMENTSCHEDULE.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS PAYMENTSCHEDULE.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
  new$PROGINDEX PAYMENTSCHEDULE.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$INVESTOBJECT PAYMENTSCHEDULE.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
  new$SUMMAYEAR4 PAYMENTSCHEDULE.SUMMAYEAR4%TYPE := :NEW.SUMMAYEAR4;
  new$SUMMAOTHERYEARS PAYMENTSCHEDULE.SUMMAOTHERYEARS%TYPE := :NEW.SUMMAOTHERYEARS;
  new$SUMMAYEAR4DELTA PAYMENTSCHEDULE.SUMMAYEAR4DELTA%TYPE := :NEW.SUMMAYEAR4DELTA;
  new$SUMMAOTHERYEARSDELTA PAYMENTSCHEDULE.SUMMAOTHERYEARSDELTA%TYPE := :NEW.SUMMAOTHERYEARSDELTA;
--
  M01$ NUMBER;
  M02$ NUMBER;
  M03$ NUMBER;
  M04$ NUMBER;
  M05$ NUMBER;
  M06$ NUMBER;
  M07$ NUMBER;
  M08$ NUMBER;
  M09$ NUMBER;
  M10$ NUMBER;
  M11$ NUMBER;
  M12$ NUMBER;
  Q1$ NUMBER;
  Q2$ NUMBER;
  Q3$ NUMBER;
  Q4$ NUMBER;
  S$ NUMBER;
  S1$ NUMBER;
  S2$ NUMBER;
  S3$ NUMBER;
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  AdjDocNum$ NUMBER(10);
  InnerNumber_parent$ NUMBER(10);
  InnerNumber_child$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_PAYMENTSCHEDULE_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$PromiseType is null) then 
    new$PromiseType := 0;
  END IF;
  if (new$KFSR is null) then 
    new$KFSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KCSR is null) then 
    new$KCSR := 0;
  END IF;
  if (new$KVR is null) then 
    new$KVR := 0;
  END IF;
  if (new$SubKESR is null) then 
    new$SubKESR := 0;
  END IF;
  if (new$AssignmentKind is null) then 
    new$AssignmentKind := 0;
  END IF;
  if (new$DirectionCls is null) then 
    new$DirectionCls := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$MeansType is null) then 
    new$MeansType := 0;
  END IF;
  if (new$FinSource is null) then 
    new$FinSource := 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$Month01 is null) then 
    new$Month01 := 0;
  END IF;
  if (new$Month02 is null) then 
    new$Month02 := 0;
  END IF;
  if (new$Month03 is null) then 
    new$Month03 := 0;
  END IF;
  if (new$Month04 is null) then 
    new$Month04 := 0;
  END IF;
  if (new$Month05 is null) then 
    new$Month05 := 0;
  END IF;
  if (new$Month06 is null) then 
    new$Month06 := 0;
  END IF;
  if (new$Month07 is null) then 
    new$Month07 := 0;
  END IF;
  if (new$Month08 is null) then 
    new$Month08 := 0;
  END IF;
  if (new$Month09 is null) then 
    new$Month09 := 0;
  END IF;
  if (new$Month10 is null) then 
    new$Month10 := 0;
  END IF;
  if (new$Month11 is null) then 
    new$Month11 := 0;
  END IF;
  if (new$Month12 is null) then 
    new$Month12 := 0;
  END IF;
  if (new$Quarter1 is null) then 
    new$Quarter1 := 0;
  END IF;
  if (new$Quarter2 is null) then 
    new$Quarter2 := 0;
  END IF;
  if (new$Quarter3 is null) then 
    new$Quarter3 := 0;
  END IF;
  if (new$Quarter4 is null) then 
    new$Quarter4 := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$Month01Delta is null) then 
    new$Month01Delta := 0;
  END IF;
  if (new$Month02Delta is null) then 
    new$Month02Delta := 0;
  END IF;
  if (new$Month03Delta is null) then 
    new$Month03Delta := 0;
  END IF;
  if (new$Month04Delta is null) then 
    new$Month04Delta := 0;
  END IF;
  if (new$Month05Delta is null) then 
    new$Month05Delta := 0;
  END IF;
  if (new$Month06Delta is null) then 
    new$Month06Delta := 0;
  END IF;
  if (new$Month07Delta is null) then 
    new$Month07Delta := 0;
  END IF;
  if (new$Month08Delta is null) then 
    new$Month08Delta := 0;
  END IF;
  if (new$Month09Delta is null) then 
    new$Month09Delta := 0;
  END IF;
  if (new$Month10Delta is null) then 
    new$Month10Delta := 0;
  END IF;
  if (new$Month11Delta is null) then 
    new$Month11Delta := 0;
  END IF;
  if (new$Month12Delta is null) then 
    new$Month12Delta := 0;
  END IF;
  if (new$Quarter1Delta is null) then 
    new$Quarter1Delta := 0;
  END IF;
  if (new$Quarter2Delta is null) then 
    new$Quarter2Delta := 0;
  END IF;
  if (new$Quarter3Delta is null) then 
    new$Quarter3Delta := 0;
  END IF;
  if (new$Quarter4Delta is null) then 
    new$Quarter4Delta := 0;
  END IF;
  if (new$SummaDelta is null) then 
    new$SummaDelta := 0;
  END IF;
  if (new$SummaPreviousYear is null) then 
    new$SummaPreviousYear := 0;
  END IF;
  if (new$SummaFinPreviousYear is null) then 
    new$SummaFinPreviousYear := 0;
  END IF;
  if (new$SummaYear1 is null) then 
    new$SummaYear1 := 0;
  END IF;
  if (new$SummaYear2 is null) then 
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then 
    new$SummaYear3 := 0;
  END IF;
  if (new$SummaYear4 is null) then 
    new$SummaYear4 := 0;
  END IF;
  if (new$SummaOtherYears is null) then 
    new$SummaOtherYears := 0;
  END IF;
  if (new$SummaYear1Delta is null) then 
    new$SummaYear1Delta := 0;
  END IF;
  if (new$SummaYear2Delta is null) then 
    new$SummaYear2Delta := 0;
  END IF;
  if (new$SummaYear3Delta is null) then 
    new$SummaYear3Delta := 0;
  END IF;
  if (new$SummaYear4Delta is null) then 
    new$SummaYear4Delta := 0;
  END IF;
  if (new$SummaOtherYearsDelta is null) then 
    new$SummaOtherYearsDelta := 0;
  END IF;
  /* проверка на то, что ссылаемся на этап из этого договора */
  if (new$ProgIndex = 304 and new$RecordIndex is not null) then
    SELECT COUNT(*) INTO CNT$1
    from AgreementSteps s where (s.Id = new$RecordIndex and s.RecordIndex = new$AgreementRef) AND (ROWNUM = 1);
    if (not (CNT$1<> 0)) then
      RaiseException('Ex_WrongStep');
    END IF;
  END IF;
  /* Заполнение Бюджета из этапа или заголовка */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    if (new$ProgIndex in (304,314,317,318)) then
      BEGIN
        select a.BudgetRef       into new$BudgetRef from Agreements a
        where a.ID = new$AgreementRef
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
    else 
      if (new$ProgIndex = 308) then
        BEGIN
          select e.BudgetRef
          into new$BudgetRef       from ExecutionDocumentsCaption e
          where e.ID = new$ExecutionRef
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
      END IF;
    END IF;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  if (new$ANumber is not null) then
    SELECT COUNT(                    id
    ) INTO CNT$2
    from
    PaymentSchedule ps
    where
    (                    (ps.ANumber = new$ANumber)
    and
    (ps.BudgetRef = new$BudgetRef)) AND (ROWNUM = 1);
    if ((CNT$2<> 0)) then
      RaiseException('ex_Promise_NumUQ');
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_1 (TR_PAYMENTSCHEDULE_BI_1)
-- Create 05.03.2004
-- Last update 29.12.2007
-- - - - - - - - - - - - -

/* Версия триггера 1.0*/
    if (new$Quarter1 = 0) then new$Quarter1 := new$Month01 + new$Month02 + new$Month03; end if;
    if (new$Quarter2 = 0) then new$Quarter2 := new$Month04 + new$Month05 + new$Month06; end if;
    if (new$Quarter3 = 0) then new$Quarter3 := new$Month07 + new$Month08 + new$Month09; end if;
    if (new$Quarter4 = 0) then new$Quarter4 := new$Month10 + new$Month11 + new$Month12; end if;
    new$SummaYear1 := new$Quarter1 + new$Quarter2 + new$Quarter3 + new$Quarter4;

-- - - - - - - - - - - - -
-- BI_10 (TR_PAYMENTSCHEDULE_BI_10)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
     
  /* Проверка указания внутренних номеров.*/
  if (new$InnerPromiseNum is null) then
    RaiseException('EX_BP_InnerNumsIsNull');
  END IF;
      
  /* Получение внутреннего номера уточнения*/
  select max(AdjustmentNumber)
  into Tmp$         from PaymentSchedule 
  where (InnerPromiseNum = new$InnerPromiseNum)
  ;
  /* Если это первая запись в цепочке, тогда устанавливаем 0*/
  if (Tmp$ is null) then
    new$AdjustmentNumber := 0;
        
  else
    new$AdjustmentNumber := Tmp$ + 1;
  END IF;
      
  /* Флаг последнего уточнения устанавливается в единицу при вставке, только если уточнение не отклонено*/
  if ((new$Accepted = 0) and (new$AcceptDate is not null)) then
    new$LastAdjustment := 0;
        
  else
    new$LastAdjustment := 1;
  END IF;
      
  /* Если БО принято, тогда устанавливаем флаг постледнего принятого в цепочке*/
  if ((new$AcceptDate is not null) and (new$Accepted = 1)) then 
    new$LastAccepted := 1;
        
  else
    new$LastAccepted := 0;
  END IF;
  /* Если БО является уточнением*/
  if (new$AdjustmentNumber > 0) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID), max(ANumber)
    into Tmp$, AdjID$, AdjDocNum$             from PaymentSchedule
    where (InnerPromiseNum = new$InnerPromiseNum) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/
    if (Tmp$ <> 1) then 
      RaiseException('EX_BP_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID) 
    into Tmp$             from PaymentSchedule
    where (InnerPromiseNum = new$InnerPromiseNum) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then 
      RaiseException('EX_BP_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/        
    new$AdjustmentRef := AdjID$;
    new$ParentNumber := AdjDocNum$;
    /* если пытаемся что-то уточнить, то проверим, что заголовки одни и те же */
    if (new$ProgIndex in (304, 314)) then
      BEGIN
        /* получим номер цепочки заголовка */        
        select a.InnerNumber
        into InnerNumber_child$             from Agreements a
        where a.ID = new$AgreementRef
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN
        /* получим номер цепочки заголовка уточняемой детали */
        select a.InnerNumber
        into InnerNumber_parent$             from PaymentSchedule ps
        left join Agreements a on (a.Id = ps.AgreementRef)
        where (ps.Id = new$AdjustmentRef)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* номера цепочек заголовков обязаны совпадать */
      if (InnerNumber_parent$ <> InnerNumber_child$) then
        RaiseException('EX_PROMISE_ADJ_INCORRECT');        
      END IF;
    else 
      if (new$ProgIndex = 308) then
        BEGIN
          /* получим номер цепочки заголовка */        
          select edc.InnerNumber
          into InnerNumber_child$             from ExecutionDocumentsCaption edc
          where edc.ID = new$ExecutionRef
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        BEGIN
          /* получим номер цепочки заголовка уточняемой детали */
          select edc.InnerNumber
          into InnerNumber_parent$             from PaymentSchedule ps
          left join ExecutionDocumentsCaption edc on (edc.id=ps.ExecutionRef)
          where (ps.Id = new$AdjustmentRef)
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        /* номера цепочек заголовков обязаны совпадать */
        if (InnerNumber_parent$ <> InnerNumber_child$) then
          RaiseException('EX_PROMISE_ADJ_INCORRECT');        
        END IF;
      END IF;    
    END IF;
  else /* Если БО не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/        
    new$AdjustmentRef := null;
    new$ParentNumber := null;
        
  END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_PAYMENTSCHEDULE_BI_100)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Для уточнений дельту вычисляем как разницу текущего уточнения и предыдущего */
  if (new$AdjustmentNumber > 0) then
    BEGIN
      select 
      Month01, Month02, Month03, Month04, Month05, Month06,
      Month07, Month08, Month09, Month10, Month11, Month12,
      Quarter1, Quarter2, Quarter3, Quarter4, Summa, 
      SummaYear1, SummaYear2, SummaYear3
      into
      M01$, M02$, M03$, M04$, M05$, M06$, M07$, M08$, M09$, M10$, M11$, M12$, 
      Q1$, Q2$, Q3$, Q4$, S$, S1$, S2$, S3$         from 
      PaymentSchedule
      where
      ID = new$AdjustmentRef
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
          
    new$Month01Delta := new$Month01 - M01$;
    new$Month02Delta := new$Month02 - M02$;
    new$Month03Delta := new$Month03 - M03$;
    new$Month04Delta := new$Month04 - M04$;
    new$Month05Delta := new$Month05 - M05$;
    new$Month06Delta := new$Month06 - M06$;
    new$Month07Delta := new$Month07 - M07$;
    new$Month08Delta := new$Month08 - M08$;
    new$Month09Delta := new$Month09 - M09$;
    new$Month10Delta := new$Month10 - M10$;
    new$Month11Delta := new$Month11 - M11$;
    new$Month12Delta := new$Month12 - M12$;
    new$Quarter1Delta := new$Quarter1 - Q1$;
    new$Quarter2Delta := new$Quarter2 - Q2$;
    new$Quarter3Delta := new$Quarter3 - Q3$;
    new$Quarter4Delta := new$Quarter4 - Q4$;
    new$SummaDelta := new$Summa - S$;
    new$SummaYear1Delta := new$SummaYear1 - S1$;
    new$SummaYear2Delta := new$SummaYear2 - S2$;
    new$SummaYear3Delta := new$SummaYear3 - S3$;
        
  else    /* В первых версиях дельты равны суммам БО */  
    new$Month01Delta := new$Month01;
    new$Month02Delta := new$Month02;
    new$Month03Delta := new$Month03;
    new$Month04Delta := new$Month04;
    new$Month05Delta := new$Month05;
    new$Month06Delta := new$Month06;
    new$Month07Delta := new$Month07;
    new$Month08Delta := new$Month08;
    new$Month09Delta := new$Month09;
    new$Month10Delta := new$Month10;
    new$Month11Delta := new$Month11;
    new$Month12Delta := new$Month12;
    new$Quarter1Delta := new$Quarter1;
    new$Quarter2Delta := new$Quarter2;
    new$Quarter3Delta := new$Quarter3;
    new$Quarter4Delta := new$Quarter4;
    new$SummaDelta := new$Summa;
    new$SummaYear1Delta := new$SummaYear1;
    new$SummaYear2Delta := new$SummaYear2;
    new$SummaYear3Delta := new$SummaYear3;
        
  END IF;

-- - - - - - - - - - - - -
-- BI_200 (TR_PAYMENTSCHEDULE_BI_200)
-- Create 06.08.2010
-- - - - - - - - - - - - -

  /*автозаполнение полей информации о строке в УРМ*/
  if (new$senderId is null) then 
    new$senderIdKey := -1;
  else
    new$senderIdKey := new$senderId;
  end if;

  if (new$SenderRecordID is null)then
    new$SenderRecordIDKey := new$ID;
  else
    new$SenderRecordIDKey := new$SenderRecordID;
  end if;       

-- - - - - - - - - - - - -
-- BI_500 (TR_PAYMENTSCHEDULE_BI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_PAYMENTSCHEDULE (
    ID,
    ANUMBER,
    PARENTNUMBER,
    KFSR,
    KESR,
    KVSR,
    KCSR,
    KVR,
    MONTH01,
    MONTH02,
    MONTH03,
    MONTH04,
    MONTH05,
    MONTH06,
    MONTH07,
    MONTH08,
    MONTH09,
    MONTH10,
    MONTH11,
    MONTH12,
    SUMMA,
    REGION,
    SUBKESR,
    MEANSTYPE,
    FINSOURCE,
    FINTYPE,
    FACT,
    FACIALACC_CLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    ACCEPTDATE,
    LASTADJUSTMENT,
    ACCEPTED,
    LASTACCEPTED,
    PROMISETYPE,
    ADJUSTMENTREF,
    OLDNUMBER,
    SUMMAPREVIOUSYEAR,
    SUMMAFINPREVIOUSYEAR,
    QUARTER1,
    QUARTER2,
    QUARTER3,
    QUARTER4,
    RECORDINDEX,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    DIRECTIONCLS,
    RVERSION,
    BUHOPERATIONCLS,
    MONTH01DELTA,
    MONTH02DELTA,
    MONTH03DELTA,
    MONTH04DELTA,
    MONTH05DELTA,
    MONTH06DELTA,
    MONTH07DELTA,
    MONTH08DELTA,
    MONTH09DELTA,
    MONTH10DELTA,
    MONTH11DELTA,
    MONTH12DELTA,
    QUARTER1DELTA,
    QUARTER2DELTA,
    QUARTER3DELTA,
    QUARTER4DELTA,
    SUMMADELTA,
    NOTE,
    FINYEAR,
    SUMMAYEAR1,
    SUMMAYEAR2,
    SUMMAYEAR3,
    SUMMAYEAR1DELTA,
    SUMMAYEAR2DELTA,
    SUMMAYEAR3DELTA,
    ASSIGNMENTKIND,
    TRANSFERTCLS,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    EXECUTIONREF,
    INNERPROMISENUM,
    ADJUSTMENTNUMBER,
    PROMISENUMBER,
    SUBSIDYCLS,
    AGREEMENTREF,
    BUDALLOCATIONCLS,
    PAYPROMISECLS,
    PROGINDEX,
    INVESTOBJECT,
    SUMMAYEAR4,
    SUMMAOTHERYEARS,
    SUMMAYEAR4DELTA,
    SUMMAOTHERYEARSDELTA
  ) VALUES (
    new$ID,
    new$ANUMBER,
    new$PARENTNUMBER,
    new$KFSR,
    new$KESR,
    new$KVSR,
    new$KCSR,
    new$KVR,
    new$MONTH01,
    new$MONTH02,
    new$MONTH03,
    new$MONTH04,
    new$MONTH05,
    new$MONTH06,
    new$MONTH07,
    new$MONTH08,
    new$MONTH09,
    new$MONTH10,
    new$MONTH11,
    new$MONTH12,
    new$SUMMA,
    new$REGION,
    new$SUBKESR,
    new$MEANSTYPE,
    new$FINSOURCE,
    new$FINTYPE,
    new$FACT,
    new$FACIALACC_CLS,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$ACCEPTDATE,
    new$LASTADJUSTMENT,
    new$ACCEPTED,
    new$LASTACCEPTED,
    new$PROMISETYPE,
    new$ADJUSTMENTREF,
    new$OLDNUMBER,
    new$SUMMAPREVIOUSYEAR,
    new$SUMMAFINPREVIOUSYEAR,
    new$QUARTER1,
    new$QUARTER2,
    new$QUARTER3,
    new$QUARTER4,
    new$RECORDINDEX,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$DIRECTIONCLS,
    new$RVERSION,
    new$BUHOPERATIONCLS,
    new$MONTH01DELTA,
    new$MONTH02DELTA,
    new$MONTH03DELTA,
    new$MONTH04DELTA,
    new$MONTH05DELTA,
    new$MONTH06DELTA,
    new$MONTH07DELTA,
    new$MONTH08DELTA,
    new$MONTH09DELTA,
    new$MONTH10DELTA,
    new$MONTH11DELTA,
    new$MONTH12DELTA,
    new$QUARTER1DELTA,
    new$QUARTER2DELTA,
    new$QUARTER3DELTA,
    new$QUARTER4DELTA,
    new$SUMMADELTA,
    new$NOTE,
    new$FINYEAR,
    new$SUMMAYEAR1,
    new$SUMMAYEAR2,
    new$SUMMAYEAR3,
    new$SUMMAYEAR1DELTA,
    new$SUMMAYEAR2DELTA,
    new$SUMMAYEAR3DELTA,
    new$ASSIGNMENTKIND,
    new$TRANSFERTCLS,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$EXECUTIONREF,
    new$INNERPROMISENUM,
    new$ADJUSTMENTNUMBER,
    new$PROMISENUMBER,
    new$SUBSIDYCLS,
    new$AGREEMENTREF,
    new$BUDALLOCATIONCLS,
    new$PAYPROMISECLS,
    new$PROGINDEX,
    new$INVESTOBJECT,
    new$SUMMAYEAR4,
    new$SUMMAOTHERYEARS,
    new$SUMMAYEAR4DELTA,
    new$SUMMAOTHERYEARSDELTA);

-- - - - - - - - - - - - -
-- AI_10 (TR_PAYMENTSCHEDULE_AI_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Коррекция вспомогательных флагов в уточняемой записи*/
  if ((new$AdjustmentNumber > 0) and (new$LastAdjustment = 1)) then
    update PaymentSchedule set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);            
    if (new$LastAccepted = 1) then
      update PaymentSchedule set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_PAYMENTSCHEDULE_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 113) and (RecordID = new$ID);

END;
/
-- CREATE TRIGGER TR_PaymentSchedule_BI_100
CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_II
  INSTEAD OF INSERT
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  new$ID PAYMENTSCHEDULE.ID%TYPE := :NEW.ID;
  new$ANUMBER PAYMENTSCHEDULE.ANUMBER%TYPE := :NEW.ANUMBER;
  new$PARENTNUMBER PAYMENTSCHEDULE.PARENTNUMBER%TYPE := :NEW.PARENTNUMBER;
  new$KFSR PAYMENTSCHEDULE.KFSR%TYPE := :NEW.KFSR;
  new$KESR PAYMENTSCHEDULE.KESR%TYPE := :NEW.KESR;
  new$KVSR PAYMENTSCHEDULE.KVSR%TYPE := :NEW.KVSR;
  new$KCSR PAYMENTSCHEDULE.KCSR%TYPE := :NEW.KCSR;
  new$KVR PAYMENTSCHEDULE.KVR%TYPE := :NEW.KVR;
  new$MONTH01 PAYMENTSCHEDULE.MONTH01%TYPE := :NEW.MONTH01;
  new$MONTH02 PAYMENTSCHEDULE.MONTH02%TYPE := :NEW.MONTH02;
  new$MONTH03 PAYMENTSCHEDULE.MONTH03%TYPE := :NEW.MONTH03;
  new$MONTH04 PAYMENTSCHEDULE.MONTH04%TYPE := :NEW.MONTH04;
  new$MONTH05 PAYMENTSCHEDULE.MONTH05%TYPE := :NEW.MONTH05;
  new$MONTH06 PAYMENTSCHEDULE.MONTH06%TYPE := :NEW.MONTH06;
  new$MONTH07 PAYMENTSCHEDULE.MONTH07%TYPE := :NEW.MONTH07;
  new$MONTH08 PAYMENTSCHEDULE.MONTH08%TYPE := :NEW.MONTH08;
  new$MONTH09 PAYMENTSCHEDULE.MONTH09%TYPE := :NEW.MONTH09;
  new$MONTH10 PAYMENTSCHEDULE.MONTH10%TYPE := :NEW.MONTH10;
  new$MONTH11 PAYMENTSCHEDULE.MONTH11%TYPE := :NEW.MONTH11;
  new$MONTH12 PAYMENTSCHEDULE.MONTH12%TYPE := :NEW.MONTH12;
  new$SUMMA PAYMENTSCHEDULE.SUMMA%TYPE := :NEW.SUMMA;
  new$REGION PAYMENTSCHEDULE.REGION%TYPE := :NEW.REGION;
  new$SUBKESR PAYMENTSCHEDULE.SUBKESR%TYPE := :NEW.SUBKESR;
  new$MEANSTYPE PAYMENTSCHEDULE.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$FINSOURCE PAYMENTSCHEDULE.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$FINTYPE PAYMENTSCHEDULE.FINTYPE%TYPE := :NEW.FINTYPE;
  new$FACT PAYMENTSCHEDULE.FACT%TYPE := :NEW.FACT;
  new$FACIALACC_CLS PAYMENTSCHEDULE.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$CREATERUSER PAYMENTSCHEDULE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE PAYMENTSCHEDULE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE PAYMENTSCHEDULE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER PAYMENTSCHEDULE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF PAYMENTSCHEDULE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$ACCEPTDATE PAYMENTSCHEDULE.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$LASTADJUSTMENT PAYMENTSCHEDULE.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$ACCEPTED PAYMENTSCHEDULE.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED PAYMENTSCHEDULE.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$PROMISETYPE PAYMENTSCHEDULE.PROMISETYPE%TYPE := :NEW.PROMISETYPE;
  new$ADJUSTMENTREF PAYMENTSCHEDULE.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$OLDNUMBER PAYMENTSCHEDULE.OLDNUMBER%TYPE := :NEW.OLDNUMBER;
  new$SUMMAPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAPREVIOUSYEAR%TYPE := :NEW.SUMMAPREVIOUSYEAR;
  new$SUMMAFINPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAFINPREVIOUSYEAR%TYPE := :NEW.SUMMAFINPREVIOUSYEAR;
  new$QUARTER1 PAYMENTSCHEDULE.QUARTER1%TYPE := :NEW.QUARTER1;
  new$QUARTER2 PAYMENTSCHEDULE.QUARTER2%TYPE := :NEW.QUARTER2;
  new$QUARTER3 PAYMENTSCHEDULE.QUARTER3%TYPE := :NEW.QUARTER3;
  new$QUARTER4 PAYMENTSCHEDULE.QUARTER4%TYPE := :NEW.QUARTER4;
  new$RECORDINDEX PAYMENTSCHEDULE.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CRYPTOSTATUS PAYMENTSCHEDULE.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID PAYMENTSCHEDULE.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID PAYMENTSCHEDULE.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DIRECTIONCLS PAYMENTSCHEDULE.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$RVERSION PAYMENTSCHEDULE.RVERSION%TYPE := :NEW.RVERSION;
  new$BUHOPERATIONCLS PAYMENTSCHEDULE.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$MONTH01DELTA PAYMENTSCHEDULE.MONTH01DELTA%TYPE := :NEW.MONTH01DELTA;
  new$MONTH02DELTA PAYMENTSCHEDULE.MONTH02DELTA%TYPE := :NEW.MONTH02DELTA;
  new$MONTH03DELTA PAYMENTSCHEDULE.MONTH03DELTA%TYPE := :NEW.MONTH03DELTA;
  new$MONTH04DELTA PAYMENTSCHEDULE.MONTH04DELTA%TYPE := :NEW.MONTH04DELTA;
  new$MONTH05DELTA PAYMENTSCHEDULE.MONTH05DELTA%TYPE := :NEW.MONTH05DELTA;
  new$MONTH06DELTA PAYMENTSCHEDULE.MONTH06DELTA%TYPE := :NEW.MONTH06DELTA;
  new$MONTH07DELTA PAYMENTSCHEDULE.MONTH07DELTA%TYPE := :NEW.MONTH07DELTA;
  new$MONTH08DELTA PAYMENTSCHEDULE.MONTH08DELTA%TYPE := :NEW.MONTH08DELTA;
  new$MONTH09DELTA PAYMENTSCHEDULE.MONTH09DELTA%TYPE := :NEW.MONTH09DELTA;
  new$MONTH10DELTA PAYMENTSCHEDULE.MONTH10DELTA%TYPE := :NEW.MONTH10DELTA;
  new$MONTH11DELTA PAYMENTSCHEDULE.MONTH11DELTA%TYPE := :NEW.MONTH11DELTA;
  new$MONTH12DELTA PAYMENTSCHEDULE.MONTH12DELTA%TYPE := :NEW.MONTH12DELTA;
  new$QUARTER1DELTA PAYMENTSCHEDULE.QUARTER1DELTA%TYPE := :NEW.QUARTER1DELTA;
  new$QUARTER2DELTA PAYMENTSCHEDULE.QUARTER2DELTA%TYPE := :NEW.QUARTER2DELTA;
  new$QUARTER3DELTA PAYMENTSCHEDULE.QUARTER3DELTA%TYPE := :NEW.QUARTER3DELTA;
  new$QUARTER4DELTA PAYMENTSCHEDULE.QUARTER4DELTA%TYPE := :NEW.QUARTER4DELTA;
  new$SUMMADELTA PAYMENTSCHEDULE.SUMMADELTA%TYPE := :NEW.SUMMADELTA;
  new$NOTE PAYMENTSCHEDULE.NOTE%TYPE := :NEW.NOTE;
  new$FINYEAR PAYMENTSCHEDULE.FINYEAR%TYPE := :NEW.FINYEAR;
  new$SUMMAYEAR1 PAYMENTSCHEDULE.SUMMAYEAR1%TYPE := :NEW.SUMMAYEAR1;
  new$SUMMAYEAR2 PAYMENTSCHEDULE.SUMMAYEAR2%TYPE := :NEW.SUMMAYEAR2;
  new$SUMMAYEAR3 PAYMENTSCHEDULE.SUMMAYEAR3%TYPE := :NEW.SUMMAYEAR3;
  new$SUMMAYEAR1DELTA PAYMENTSCHEDULE.SUMMAYEAR1DELTA%TYPE := :NEW.SUMMAYEAR1DELTA;
  new$SUMMAYEAR2DELTA PAYMENTSCHEDULE.SUMMAYEAR2DELTA%TYPE := :NEW.SUMMAYEAR2DELTA;
  new$SUMMAYEAR3DELTA PAYMENTSCHEDULE.SUMMAYEAR3DELTA%TYPE := :NEW.SUMMAYEAR3DELTA;
  new$ASSIGNMENTKIND PAYMENTSCHEDULE.ASSIGNMENTKIND%TYPE := :NEW.ASSIGNMENTKIND;
  new$TRANSFERTCLS PAYMENTSCHEDULE.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SENDERIDKEY PAYMENTSCHEDULE.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY PAYMENTSCHEDULE.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$EXECUTIONREF PAYMENTSCHEDULE.EXECUTIONREF%TYPE := :NEW.EXECUTIONREF;
  new$INNERPROMISENUM PAYMENTSCHEDULE.INNERPROMISENUM%TYPE := :NEW.INNERPROMISENUM;
  new$ADJUSTMENTNUMBER PAYMENTSCHEDULE.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$PROMISENUMBER PAYMENTSCHEDULE.PROMISENUMBER%TYPE := :NEW.PROMISENUMBER;
  new$SUBSIDYCLS PAYMENTSCHEDULE.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$AGREEMENTREF PAYMENTSCHEDULE.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$BUDALLOCATIONCLS PAYMENTSCHEDULE.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS PAYMENTSCHEDULE.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
  new$PROGINDEX PAYMENTSCHEDULE.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$INVESTOBJECT PAYMENTSCHEDULE.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
  new$SUMMAYEAR4 PAYMENTSCHEDULE.SUMMAYEAR4%TYPE := :NEW.SUMMAYEAR4;
  new$SUMMAOTHERYEARS PAYMENTSCHEDULE.SUMMAOTHERYEARS%TYPE := :NEW.SUMMAOTHERYEARS;
  new$SUMMAYEAR4DELTA PAYMENTSCHEDULE.SUMMAYEAR4DELTA%TYPE := :NEW.SUMMAYEAR4DELTA;
  new$SUMMAOTHERYEARSDELTA PAYMENTSCHEDULE.SUMMAOTHERYEARSDELTA%TYPE := :NEW.SUMMAOTHERYEARSDELTA;
--
  M01$ NUMBER;
  M02$ NUMBER;
  M03$ NUMBER;
  M04$ NUMBER;
  M05$ NUMBER;
  M06$ NUMBER;
  M07$ NUMBER;
  M08$ NUMBER;
  M09$ NUMBER;
  M10$ NUMBER;
  M11$ NUMBER;
  M12$ NUMBER;
  Q1$ NUMBER;
  Q2$ NUMBER;
  Q3$ NUMBER;
  Q4$ NUMBER;
  S$ NUMBER;
  S1$ NUMBER;
  S2$ NUMBER;
  S3$ NUMBER;
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  AdjDocNum$ NUMBER(10);
  InnerNumber_parent$ NUMBER(10);
  InnerNumber_child$ NUMBER(10);
  S4$ NUMBER;
  SOther$ NUMBER;
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_PAYMENTSCHEDULE_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$PromiseType is null) then 
    new$PromiseType := 0;
  END IF;
  if (new$KFSR is null) then 
    new$KFSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KCSR is null) then 
    new$KCSR := 0;
  END IF;
  if (new$KVR is null) then 
    new$KVR := 0;
  END IF;
  if (new$SubKESR is null) then 
    new$SubKESR := 0;
  END IF;
  if (new$AssignmentKind is null) then 
    new$AssignmentKind := 0;
  END IF;
  if (new$DirectionCls is null) then 
    new$DirectionCls := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$MeansType is null) then 
    new$MeansType := 0;
  END IF;
  if (new$FinSource is null) then 
    new$FinSource := 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$Month01 is null) then 
    new$Month01 := 0;
  END IF;
  if (new$Month02 is null) then 
    new$Month02 := 0;
  END IF;
  if (new$Month03 is null) then 
    new$Month03 := 0;
  END IF;
  if (new$Month04 is null) then 
    new$Month04 := 0;
  END IF;
  if (new$Month05 is null) then 
    new$Month05 := 0;
  END IF;
  if (new$Month06 is null) then 
    new$Month06 := 0;
  END IF;
  if (new$Month07 is null) then 
    new$Month07 := 0;
  END IF;
  if (new$Month08 is null) then 
    new$Month08 := 0;
  END IF;
  if (new$Month09 is null) then 
    new$Month09 := 0;
  END IF;
  if (new$Month10 is null) then 
    new$Month10 := 0;
  END IF;
  if (new$Month11 is null) then 
    new$Month11 := 0;
  END IF;
  if (new$Month12 is null) then 
    new$Month12 := 0;
  END IF;
  if (new$Quarter1 is null) then 
    new$Quarter1 := 0;
  END IF;
  if (new$Quarter2 is null) then 
    new$Quarter2 := 0;
  END IF;
  if (new$Quarter3 is null) then 
    new$Quarter3 := 0;
  END IF;
  if (new$Quarter4 is null) then 
    new$Quarter4 := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$Month01Delta is null) then 
    new$Month01Delta := 0;
  END IF;
  if (new$Month02Delta is null) then 
    new$Month02Delta := 0;
  END IF;
  if (new$Month03Delta is null) then 
    new$Month03Delta := 0;
  END IF;
  if (new$Month04Delta is null) then 
    new$Month04Delta := 0;
  END IF;
  if (new$Month05Delta is null) then 
    new$Month05Delta := 0;
  END IF;
  if (new$Month06Delta is null) then 
    new$Month06Delta := 0;
  END IF;
  if (new$Month07Delta is null) then 
    new$Month07Delta := 0;
  END IF;
  if (new$Month08Delta is null) then 
    new$Month08Delta := 0;
  END IF;
  if (new$Month09Delta is null) then 
    new$Month09Delta := 0;
  END IF;
  if (new$Month10Delta is null) then 
    new$Month10Delta := 0;
  END IF;
  if (new$Month11Delta is null) then 
    new$Month11Delta := 0;
  END IF;
  if (new$Month12Delta is null) then 
    new$Month12Delta := 0;
  END IF;
  if (new$Quarter1Delta is null) then 
    new$Quarter1Delta := 0;
  END IF;
  if (new$Quarter2Delta is null) then 
    new$Quarter2Delta := 0;
  END IF;
  if (new$Quarter3Delta is null) then 
    new$Quarter3Delta := 0;
  END IF;
  if (new$Quarter4Delta is null) then 
    new$Quarter4Delta := 0;
  END IF;
  if (new$SummaDelta is null) then 
    new$SummaDelta := 0;
  END IF;
  if (new$SummaPreviousYear is null) then 
    new$SummaPreviousYear := 0;
  END IF;
  if (new$SummaFinPreviousYear is null) then 
    new$SummaFinPreviousYear := 0;
  END IF;
  if (new$SummaYear1 is null) then 
    new$SummaYear1 := 0;
  END IF;
  if (new$SummaYear2 is null) then 
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then 
    new$SummaYear3 := 0;
  END IF;
  if (new$SummaYear4 is null) then 
    new$SummaYear4 := 0;
  END IF;
  if (new$SummaOtherYears is null) then 
    new$SummaOtherYears := 0;
  END IF;
  if (new$SummaYear1Delta is null) then 
    new$SummaYear1Delta := 0;
  END IF;
  if (new$SummaYear2Delta is null) then 
    new$SummaYear2Delta := 0;
  END IF;
  if (new$SummaYear3Delta is null) then 
    new$SummaYear3Delta := 0;
  END IF;
  if (new$SummaYear4Delta is null) then 
    new$SummaYear4Delta := 0;
  END IF;
  if (new$SummaOtherYearsDelta is null) then 
    new$SummaOtherYearsDelta := 0;
  END IF;
  /* проверка на то, что ссылаемся на этап из этого договора */
  if (new$ProgIndex = 304 and new$RecordIndex is not null) then
    SELECT COUNT(*) INTO CNT$1
    from AgreementSteps s where (s.Id = new$RecordIndex and s.RecordIndex = new$AgreementRef) AND (ROWNUM = 1);
    if (not (CNT$1<> 0)) then
      RaiseException('Ex_WrongStep');
    END IF;
  END IF;
  /* Заполнение Бюджета из этапа или заголовка */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    if (new$ProgIndex in (304,314,317,318)) then
      BEGIN
        select a.BudgetRef       into new$BudgetRef from Agreements a
        where a.ID = new$AgreementRef
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
    else 
      if (new$ProgIndex = 308) then
        BEGIN
          select e.BudgetRef
          into new$BudgetRef       from ExecutionDocumentsCaption e
          where e.ID = new$ExecutionRef
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
      END IF;
    END IF;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  if (new$ANumber is not null) then
    SELECT COUNT(                    id
    ) INTO CNT$2
    from
    PaymentSchedule ps
    where
    (                    (ps.ANumber = new$ANumber)
    and
    (ps.BudgetRef = new$BudgetRef)) AND (ROWNUM = 1);
    if ((CNT$2<> 0)) then
      RaiseException('ex_Promise_NumUQ');
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_1 (TR_PAYMENTSCHEDULE_BI_1)
-- Create 05.03.2004
-- Last update 29.12.2007
-- - - - - - - - - - - - -

/* Версия триггера 1.0*/
    if (new$Quarter1 = 0) then new$Quarter1 := new$Month01 + new$Month02 + new$Month03; end if;
    if (new$Quarter2 = 0) then new$Quarter2 := new$Month04 + new$Month05 + new$Month06; end if;
    if (new$Quarter3 = 0) then new$Quarter3 := new$Month07 + new$Month08 + new$Month09; end if;
    if (new$Quarter4 = 0) then new$Quarter4 := new$Month10 + new$Month11 + new$Month12; end if;
    new$SummaYear1 := new$Quarter1 + new$Quarter2 + new$Quarter3 + new$Quarter4;

-- - - - - - - - - - - - -
-- BI_10 (TR_PAYMENTSCHEDULE_BI_10)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
     
  /* Проверка указания внутренних номеров.*/
  if (new$InnerPromiseNum is null) then
    RaiseException('EX_BP_InnerNumsIsNull');
  END IF;
      
  /* Получение внутреннего номера уточнения*/
  select max(AdjustmentNumber)
  into Tmp$         from PaymentSchedule 
  where (InnerPromiseNum = new$InnerPromiseNum)
  ;
  /* Если это первая запись в цепочке, тогда устанавливаем 0*/
  if (Tmp$ is null) then
    new$AdjustmentNumber := 0;
        
  else
    new$AdjustmentNumber := Tmp$ + 1;
  END IF;
      
  /* Флаг последнего уточнения устанавливается в единицу при вставке, только если уточнение не отклонено*/
  if ((new$Accepted = 0) and (new$AcceptDate is not null)) then
    new$LastAdjustment := 0;
        
  else
    new$LastAdjustment := 1;
  END IF;
      
  /* Если БО принято, тогда устанавливаем флаг постледнего принятого в цепочке*/
  if ((new$AcceptDate is not null) and (new$Accepted = 1)) then 
    new$LastAccepted := 1;
        
  else
    new$LastAccepted := 0;
  END IF;
  /* Если БО является уточнением*/
  if (new$AdjustmentNumber > 0) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID), max(ANumber)
    into Tmp$, AdjID$, AdjDocNum$             from PaymentSchedule
    where (InnerPromiseNum = new$InnerPromiseNum) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/
    if (Tmp$ <> 1) then 
      RaiseException('EX_BP_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID) 
    into Tmp$             from PaymentSchedule
    where (InnerPromiseNum = new$InnerPromiseNum) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then 
      RaiseException('EX_BP_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/        
    new$AdjustmentRef := AdjID$;
    new$ParentNumber := AdjDocNum$;
    /* если пытаемся что-то уточнить, то проверим, что заголовки одни и те же */
    if (new$ProgIndex in (304, 314)) then
      BEGIN
        /* получим номер цепочки заголовка */        
        select a.InnerNumber
        into InnerNumber_child$             from Agreements a
        where a.ID = new$AgreementRef
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN
        /* получим номер цепочки заголовка уточняемой детали */
        select a.InnerNumber
        into InnerNumber_parent$             from PaymentSchedule ps
        left join Agreements a on (a.Id = ps.AgreementRef)
        where (ps.Id = new$AdjustmentRef)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* номера цепочек заголовков обязаны совпадать */
      if (InnerNumber_parent$ <> InnerNumber_child$) then
        RaiseException('EX_PROMISE_ADJ_INCORRECT');        
      END IF;
    else 
      if (new$ProgIndex = 308) then
        BEGIN
          /* получим номер цепочки заголовка */        
          select edc.InnerNumber
          into InnerNumber_child$             from ExecutionDocumentsCaption edc
          where edc.ID = new$ExecutionRef
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        BEGIN
          /* получим номер цепочки заголовка уточняемой детали */
          select edc.InnerNumber
          into InnerNumber_parent$             from PaymentSchedule ps
          left join ExecutionDocumentsCaption edc on (edc.id=ps.ExecutionRef)
          where (ps.Id = new$AdjustmentRef)
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        /* номера цепочек заголовков обязаны совпадать */
        if (InnerNumber_parent$ <> InnerNumber_child$) then
          RaiseException('EX_PROMISE_ADJ_INCORRECT');        
        END IF;
      END IF;    
    END IF;
  else /* Если БО не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/        
    new$AdjustmentRef := null;
    new$ParentNumber := null;
        
  END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_PAYMENTSCHEDULE_BI_100)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Для уточнений дельту вычисляем как разницу текущего уточнения и предыдущего */
  if (new$AdjustmentNumber > 0) then
    BEGIN
      select 
      Month01, Month02, Month03, Month04, Month05, Month06,
      Month07, Month08, Month09, Month10, Month11, Month12,
      Quarter1, Quarter2, Quarter3, Quarter4, Summa, 
      SummaYear1, SummaYear2, SummaYear3, SummaYear4, SummaOtherYears
      into
      M01$, M02$, M03$, M04$, M05$, M06$, M07$, M08$, M09$, M10$, M11$, M12$, 
      Q1$, Q2$, Q3$, Q4$, S$, S1$, S2$, S3$, S4$, SOther$         from 
      PaymentSchedule
      where
      ID = new$AdjustmentRef
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
          
    new$Month01Delta := new$Month01 - M01$;
    new$Month02Delta := new$Month02 - M02$;
    new$Month03Delta := new$Month03 - M03$;
    new$Month04Delta := new$Month04 - M04$;
    new$Month05Delta := new$Month05 - M05$;
    new$Month06Delta := new$Month06 - M06$;
    new$Month07Delta := new$Month07 - M07$;
    new$Month08Delta := new$Month08 - M08$;
    new$Month09Delta := new$Month09 - M09$;
    new$Month10Delta := new$Month10 - M10$;
    new$Month11Delta := new$Month11 - M11$;
    new$Month12Delta := new$Month12 - M12$;
    new$Quarter1Delta := new$Quarter1 - Q1$;
    new$Quarter2Delta := new$Quarter2 - Q2$;
    new$Quarter3Delta := new$Quarter3 - Q3$;
    new$Quarter4Delta := new$Quarter4 - Q4$;
    new$SummaDelta := new$Summa - S$;
    new$SummaYear1Delta := new$SummaYear1 - S1$;
    new$SummaYear2Delta := new$SummaYear2 - S2$;
    new$SummaYear3Delta := new$SummaYear3 - S3$;
    new$SummaYear4Delta := new$SummaYear4 - S4$;
    new$SummaOtherYearsDelta := new$SummaOtherYears - SOther$;        
        
  else    /* В первых версиях дельты равны суммам БО */  
    new$Month01Delta := new$Month01;
    new$Month02Delta := new$Month02;
    new$Month03Delta := new$Month03;
    new$Month04Delta := new$Month04;
    new$Month05Delta := new$Month05;
    new$Month06Delta := new$Month06;
    new$Month07Delta := new$Month07;
    new$Month08Delta := new$Month08;
    new$Month09Delta := new$Month09;
    new$Month10Delta := new$Month10;
    new$Month11Delta := new$Month11;
    new$Month12Delta := new$Month12;
    new$Quarter1Delta := new$Quarter1;
    new$Quarter2Delta := new$Quarter2;
    new$Quarter3Delta := new$Quarter3;
    new$Quarter4Delta := new$Quarter4;
    new$SummaDelta := new$Summa;
    new$SummaYear1Delta := new$SummaYear1;
    new$SummaYear2Delta := new$SummaYear2;
    new$SummaYear3Delta := new$SummaYear3;
    new$SummaYear4Delta := new$SummaYear4;
    new$SummaOtherYearsDelta := new$SummaOtherYears;        
        
  END IF;

-- - - - - - - - - - - - -
-- BI_200 (TR_PAYMENTSCHEDULE_BI_200)
-- Create 06.08.2010
-- - - - - - - - - - - - -

  /*автозаполнение полей информации о строке в УРМ*/
  if (new$senderId is null) then 
    new$senderIdKey := -1;
  else
    new$senderIdKey := new$senderId;
  end if;

  if (new$SenderRecordID is null)then
    new$SenderRecordIDKey := new$ID;
  else
    new$SenderRecordIDKey := new$SenderRecordID;
  end if;       

-- - - - - - - - - - - - -
-- BI_500 (TR_PAYMENTSCHEDULE_BI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_PAYMENTSCHEDULE (
    ID,
    ANUMBER,
    PARENTNUMBER,
    KFSR,
    KESR,
    KVSR,
    KCSR,
    KVR,
    MONTH01,
    MONTH02,
    MONTH03,
    MONTH04,
    MONTH05,
    MONTH06,
    MONTH07,
    MONTH08,
    MONTH09,
    MONTH10,
    MONTH11,
    MONTH12,
    SUMMA,
    REGION,
    SUBKESR,
    MEANSTYPE,
    FINSOURCE,
    FINTYPE,
    FACT,
    FACIALACC_CLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    ACCEPTDATE,
    LASTADJUSTMENT,
    ACCEPTED,
    LASTACCEPTED,
    PROMISETYPE,
    ADJUSTMENTREF,
    OLDNUMBER,
    SUMMAPREVIOUSYEAR,
    SUMMAFINPREVIOUSYEAR,
    QUARTER1,
    QUARTER2,
    QUARTER3,
    QUARTER4,
    RECORDINDEX,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    DIRECTIONCLS,
    RVERSION,
    BUHOPERATIONCLS,
    MONTH01DELTA,
    MONTH02DELTA,
    MONTH03DELTA,
    MONTH04DELTA,
    MONTH05DELTA,
    MONTH06DELTA,
    MONTH07DELTA,
    MONTH08DELTA,
    MONTH09DELTA,
    MONTH10DELTA,
    MONTH11DELTA,
    MONTH12DELTA,
    QUARTER1DELTA,
    QUARTER2DELTA,
    QUARTER3DELTA,
    QUARTER4DELTA,
    SUMMADELTA,
    NOTE,
    FINYEAR,
    SUMMAYEAR1,
    SUMMAYEAR2,
    SUMMAYEAR3,
    SUMMAYEAR1DELTA,
    SUMMAYEAR2DELTA,
    SUMMAYEAR3DELTA,
    ASSIGNMENTKIND,
    TRANSFERTCLS,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    EXECUTIONREF,
    INNERPROMISENUM,
    ADJUSTMENTNUMBER,
    PROMISENUMBER,
    SUBSIDYCLS,
    AGREEMENTREF,
    BUDALLOCATIONCLS,
    PAYPROMISECLS,
    PROGINDEX,
    INVESTOBJECT,
    SUMMAYEAR4,
    SUMMAOTHERYEARS,
    SUMMAYEAR4DELTA,
    SUMMAOTHERYEARSDELTA
  ) VALUES (
    new$ID,
    new$ANUMBER,
    new$PARENTNUMBER,
    new$KFSR,
    new$KESR,
    new$KVSR,
    new$KCSR,
    new$KVR,
    new$MONTH01,
    new$MONTH02,
    new$MONTH03,
    new$MONTH04,
    new$MONTH05,
    new$MONTH06,
    new$MONTH07,
    new$MONTH08,
    new$MONTH09,
    new$MONTH10,
    new$MONTH11,
    new$MONTH12,
    new$SUMMA,
    new$REGION,
    new$SUBKESR,
    new$MEANSTYPE,
    new$FINSOURCE,
    new$FINTYPE,
    new$FACT,
    new$FACIALACC_CLS,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$ACCEPTDATE,
    new$LASTADJUSTMENT,
    new$ACCEPTED,
    new$LASTACCEPTED,
    new$PROMISETYPE,
    new$ADJUSTMENTREF,
    new$OLDNUMBER,
    new$SUMMAPREVIOUSYEAR,
    new$SUMMAFINPREVIOUSYEAR,
    new$QUARTER1,
    new$QUARTER2,
    new$QUARTER3,
    new$QUARTER4,
    new$RECORDINDEX,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$DIRECTIONCLS,
    new$RVERSION,
    new$BUHOPERATIONCLS,
    new$MONTH01DELTA,
    new$MONTH02DELTA,
    new$MONTH03DELTA,
    new$MONTH04DELTA,
    new$MONTH05DELTA,
    new$MONTH06DELTA,
    new$MONTH07DELTA,
    new$MONTH08DELTA,
    new$MONTH09DELTA,
    new$MONTH10DELTA,
    new$MONTH11DELTA,
    new$MONTH12DELTA,
    new$QUARTER1DELTA,
    new$QUARTER2DELTA,
    new$QUARTER3DELTA,
    new$QUARTER4DELTA,
    new$SUMMADELTA,
    new$NOTE,
    new$FINYEAR,
    new$SUMMAYEAR1,
    new$SUMMAYEAR2,
    new$SUMMAYEAR3,
    new$SUMMAYEAR1DELTA,
    new$SUMMAYEAR2DELTA,
    new$SUMMAYEAR3DELTA,
    new$ASSIGNMENTKIND,
    new$TRANSFERTCLS,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$EXECUTIONREF,
    new$INNERPROMISENUM,
    new$ADJUSTMENTNUMBER,
    new$PROMISENUMBER,
    new$SUBSIDYCLS,
    new$AGREEMENTREF,
    new$BUDALLOCATIONCLS,
    new$PAYPROMISECLS,
    new$PROGINDEX,
    new$INVESTOBJECT,
    new$SUMMAYEAR4,
    new$SUMMAOTHERYEARS,
    new$SUMMAYEAR4DELTA,
    new$SUMMAOTHERYEARSDELTA);

-- - - - - - - - - - - - -
-- AI_10 (TR_PAYMENTSCHEDULE_AI_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Коррекция вспомогательных флагов в уточняемой записи*/
  if ((new$AdjustmentNumber > 0) and (new$LastAdjustment = 1)) then
    update PaymentSchedule set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);            
    if (new$LastAccepted = 1) then
      update PaymentSchedule set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_PAYMENTSCHEDULE_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 113) and (RecordID = new$ID);

END;
/
-- CREATE TRIGGER TR_PaymentSchedule_BU_100
CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_IU
  INSTEAD OF UPDATE
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  new$ID PAYMENTSCHEDULE.ID%TYPE := :NEW.ID;
  new$ANUMBER PAYMENTSCHEDULE.ANUMBER%TYPE := :NEW.ANUMBER;
  new$PARENTNUMBER PAYMENTSCHEDULE.PARENTNUMBER%TYPE := :NEW.PARENTNUMBER;
  new$KFSR PAYMENTSCHEDULE.KFSR%TYPE := :NEW.KFSR;
  new$KESR PAYMENTSCHEDULE.KESR%TYPE := :NEW.KESR;
  new$KVSR PAYMENTSCHEDULE.KVSR%TYPE := :NEW.KVSR;
  new$KCSR PAYMENTSCHEDULE.KCSR%TYPE := :NEW.KCSR;
  new$KVR PAYMENTSCHEDULE.KVR%TYPE := :NEW.KVR;
  new$MONTH01 PAYMENTSCHEDULE.MONTH01%TYPE := :NEW.MONTH01;
  new$MONTH02 PAYMENTSCHEDULE.MONTH02%TYPE := :NEW.MONTH02;
  new$MONTH03 PAYMENTSCHEDULE.MONTH03%TYPE := :NEW.MONTH03;
  new$MONTH04 PAYMENTSCHEDULE.MONTH04%TYPE := :NEW.MONTH04;
  new$MONTH05 PAYMENTSCHEDULE.MONTH05%TYPE := :NEW.MONTH05;
  new$MONTH06 PAYMENTSCHEDULE.MONTH06%TYPE := :NEW.MONTH06;
  new$MONTH07 PAYMENTSCHEDULE.MONTH07%TYPE := :NEW.MONTH07;
  new$MONTH08 PAYMENTSCHEDULE.MONTH08%TYPE := :NEW.MONTH08;
  new$MONTH09 PAYMENTSCHEDULE.MONTH09%TYPE := :NEW.MONTH09;
  new$MONTH10 PAYMENTSCHEDULE.MONTH10%TYPE := :NEW.MONTH10;
  new$MONTH11 PAYMENTSCHEDULE.MONTH11%TYPE := :NEW.MONTH11;
  new$MONTH12 PAYMENTSCHEDULE.MONTH12%TYPE := :NEW.MONTH12;
  new$SUMMA PAYMENTSCHEDULE.SUMMA%TYPE := :NEW.SUMMA;
  new$REGION PAYMENTSCHEDULE.REGION%TYPE := :NEW.REGION;
  new$SUBKESR PAYMENTSCHEDULE.SUBKESR%TYPE := :NEW.SUBKESR;
  new$MEANSTYPE PAYMENTSCHEDULE.MEANSTYPE%TYPE := :NEW.MEANSTYPE;
  new$FINSOURCE PAYMENTSCHEDULE.FINSOURCE%TYPE := :NEW.FINSOURCE;
  new$FINTYPE PAYMENTSCHEDULE.FINTYPE%TYPE := :NEW.FINTYPE;
  new$FACT PAYMENTSCHEDULE.FACT%TYPE := :NEW.FACT;
  new$FACIALACC_CLS PAYMENTSCHEDULE.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$CREATERUSER PAYMENTSCHEDULE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE PAYMENTSCHEDULE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE PAYMENTSCHEDULE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER PAYMENTSCHEDULE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF PAYMENTSCHEDULE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$ACCEPTDATE PAYMENTSCHEDULE.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$LASTADJUSTMENT PAYMENTSCHEDULE.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$ACCEPTED PAYMENTSCHEDULE.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED PAYMENTSCHEDULE.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$PROMISETYPE PAYMENTSCHEDULE.PROMISETYPE%TYPE := :NEW.PROMISETYPE;
  new$ADJUSTMENTREF PAYMENTSCHEDULE.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$OLDNUMBER PAYMENTSCHEDULE.OLDNUMBER%TYPE := :NEW.OLDNUMBER;
  new$SUMMAPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAPREVIOUSYEAR%TYPE := :NEW.SUMMAPREVIOUSYEAR;
  new$SUMMAFINPREVIOUSYEAR PAYMENTSCHEDULE.SUMMAFINPREVIOUSYEAR%TYPE := :NEW.SUMMAFINPREVIOUSYEAR;
  new$QUARTER1 PAYMENTSCHEDULE.QUARTER1%TYPE := :NEW.QUARTER1;
  new$QUARTER2 PAYMENTSCHEDULE.QUARTER2%TYPE := :NEW.QUARTER2;
  new$QUARTER3 PAYMENTSCHEDULE.QUARTER3%TYPE := :NEW.QUARTER3;
  new$QUARTER4 PAYMENTSCHEDULE.QUARTER4%TYPE := :NEW.QUARTER4;
  new$RECORDINDEX PAYMENTSCHEDULE.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CRYPTOSTATUS PAYMENTSCHEDULE.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID PAYMENTSCHEDULE.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID PAYMENTSCHEDULE.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DIRECTIONCLS PAYMENTSCHEDULE.DIRECTIONCLS%TYPE := :NEW.DIRECTIONCLS;
  new$RVERSION PAYMENTSCHEDULE.RVERSION%TYPE := :NEW.RVERSION;
  new$BUHOPERATIONCLS PAYMENTSCHEDULE.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$MONTH01DELTA PAYMENTSCHEDULE.MONTH01DELTA%TYPE := :NEW.MONTH01DELTA;
  new$MONTH02DELTA PAYMENTSCHEDULE.MONTH02DELTA%TYPE := :NEW.MONTH02DELTA;
  new$MONTH03DELTA PAYMENTSCHEDULE.MONTH03DELTA%TYPE := :NEW.MONTH03DELTA;
  new$MONTH04DELTA PAYMENTSCHEDULE.MONTH04DELTA%TYPE := :NEW.MONTH04DELTA;
  new$MONTH05DELTA PAYMENTSCHEDULE.MONTH05DELTA%TYPE := :NEW.MONTH05DELTA;
  new$MONTH06DELTA PAYMENTSCHEDULE.MONTH06DELTA%TYPE := :NEW.MONTH06DELTA;
  new$MONTH07DELTA PAYMENTSCHEDULE.MONTH07DELTA%TYPE := :NEW.MONTH07DELTA;
  new$MONTH08DELTA PAYMENTSCHEDULE.MONTH08DELTA%TYPE := :NEW.MONTH08DELTA;
  new$MONTH09DELTA PAYMENTSCHEDULE.MONTH09DELTA%TYPE := :NEW.MONTH09DELTA;
  new$MONTH10DELTA PAYMENTSCHEDULE.MONTH10DELTA%TYPE := :NEW.MONTH10DELTA;
  new$MONTH11DELTA PAYMENTSCHEDULE.MONTH11DELTA%TYPE := :NEW.MONTH11DELTA;
  new$MONTH12DELTA PAYMENTSCHEDULE.MONTH12DELTA%TYPE := :NEW.MONTH12DELTA;
  new$QUARTER1DELTA PAYMENTSCHEDULE.QUARTER1DELTA%TYPE := :NEW.QUARTER1DELTA;
  new$QUARTER2DELTA PAYMENTSCHEDULE.QUARTER2DELTA%TYPE := :NEW.QUARTER2DELTA;
  new$QUARTER3DELTA PAYMENTSCHEDULE.QUARTER3DELTA%TYPE := :NEW.QUARTER3DELTA;
  new$QUARTER4DELTA PAYMENTSCHEDULE.QUARTER4DELTA%TYPE := :NEW.QUARTER4DELTA;
  new$SUMMADELTA PAYMENTSCHEDULE.SUMMADELTA%TYPE := :NEW.SUMMADELTA;
  new$NOTE PAYMENTSCHEDULE.NOTE%TYPE := :NEW.NOTE;
  new$FINYEAR PAYMENTSCHEDULE.FINYEAR%TYPE := :NEW.FINYEAR;
  new$SUMMAYEAR1 PAYMENTSCHEDULE.SUMMAYEAR1%TYPE := :NEW.SUMMAYEAR1;
  new$SUMMAYEAR2 PAYMENTSCHEDULE.SUMMAYEAR2%TYPE := :NEW.SUMMAYEAR2;
  new$SUMMAYEAR3 PAYMENTSCHEDULE.SUMMAYEAR3%TYPE := :NEW.SUMMAYEAR3;
  new$SUMMAYEAR1DELTA PAYMENTSCHEDULE.SUMMAYEAR1DELTA%TYPE := :NEW.SUMMAYEAR1DELTA;
  new$SUMMAYEAR2DELTA PAYMENTSCHEDULE.SUMMAYEAR2DELTA%TYPE := :NEW.SUMMAYEAR2DELTA;
  new$SUMMAYEAR3DELTA PAYMENTSCHEDULE.SUMMAYEAR3DELTA%TYPE := :NEW.SUMMAYEAR3DELTA;
  new$ASSIGNMENTKIND PAYMENTSCHEDULE.ASSIGNMENTKIND%TYPE := :NEW.ASSIGNMENTKIND;
  new$TRANSFERTCLS PAYMENTSCHEDULE.TRANSFERTCLS%TYPE := :NEW.TRANSFERTCLS;
  new$SENDERIDKEY PAYMENTSCHEDULE.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY PAYMENTSCHEDULE.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$EXECUTIONREF PAYMENTSCHEDULE.EXECUTIONREF%TYPE := :NEW.EXECUTIONREF;
  new$INNERPROMISENUM PAYMENTSCHEDULE.INNERPROMISENUM%TYPE := :NEW.INNERPROMISENUM;
  new$ADJUSTMENTNUMBER PAYMENTSCHEDULE.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$PROMISENUMBER PAYMENTSCHEDULE.PROMISENUMBER%TYPE := :NEW.PROMISENUMBER;
  new$SUBSIDYCLS PAYMENTSCHEDULE.SUBSIDYCLS%TYPE := :NEW.SUBSIDYCLS;
  new$AGREEMENTREF PAYMENTSCHEDULE.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$BUDALLOCATIONCLS PAYMENTSCHEDULE.BUDALLOCATIONCLS%TYPE := :NEW.BUDALLOCATIONCLS;
  new$PAYPROMISECLS PAYMENTSCHEDULE.PAYPROMISECLS%TYPE := :NEW.PAYPROMISECLS;
  new$PROGINDEX PAYMENTSCHEDULE.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$INVESTOBJECT PAYMENTSCHEDULE.INVESTOBJECT%TYPE := :NEW.INVESTOBJECT;
  new$SUMMAYEAR4 PAYMENTSCHEDULE.SUMMAYEAR4%TYPE := :NEW.SUMMAYEAR4;
  new$SUMMAOTHERYEARS PAYMENTSCHEDULE.SUMMAOTHERYEARS%TYPE := :NEW.SUMMAOTHERYEARS;
  new$SUMMAYEAR4DELTA PAYMENTSCHEDULE.SUMMAYEAR4DELTA%TYPE := :NEW.SUMMAYEAR4DELTA;
  new$SUMMAOTHERYEARSDELTA PAYMENTSCHEDULE.SUMMAOTHERYEARSDELTA%TYPE := :NEW.SUMMAOTHERYEARSDELTA;
--
  M01$ NUMBER;
  M02$ NUMBER;
  M03$ NUMBER;
  M04$ NUMBER;
  M05$ NUMBER;
  M06$ NUMBER;
  M07$ NUMBER;
  M08$ NUMBER;
  M09$ NUMBER;
  M10$ NUMBER;
  M11$ NUMBER;
  M12$ NUMBER;
  Q1$ NUMBER;
  Q2$ NUMBER;
  Q3$ NUMBER;
  Q4$ NUMBER;
  S$ NUMBER;
  S1$ NUMBER;
  S2$ NUMBER;
  S3$ NUMBER;
  MaxNumber1$ NUMBER(10);
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  S4$ NUMBER;
  SOther$ NUMBER;
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_PAYMENTSCHEDULE_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 2.4*/
  /* установка значений полей по-умолчанию*/
  if (new$Accepted is null) then 
    new$Accepted := 1;
  END IF;
  if (new$PromiseType is null) then 
    new$PromiseType := 0;
  END IF;
  if (new$KFSR is null) then 
    new$KFSR := 0;
  END IF;
  if (new$KESR is null) then 
    new$KESR := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$KCSR is null) then 
    new$KCSR := 0;
  END IF;
  if (new$KVR is null) then 
    new$KVR := 0;
  END IF;
  if (new$SubKESR is null) then 
    new$SubKESR := 0;
  END IF;
  if (new$AssignmentKind is null) then 
    new$AssignmentKind := 0;
  END IF;
   
  if (new$DirectionCls is null) then 
    new$DirectionCls := 0;
  END IF;
   
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$Region is null) then 
    new$Region := 0;
  END IF;
  if (new$MeansType is null) then 
    new$MeansType := 0;
  END IF;
  if (new$FinSource is null) then 
    new$FinSource := 0;
  END IF;
  if (new$FinType is null) then 
    new$FinType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$BuhOperationCLS is null) then 
    GetIntConst(60, 15,new$BuhOperationCLS); 
  END IF;
  if (new$Month01 is null) then 
    new$Month01 := 0;
  END IF;
  if (new$Month02 is null) then 
    new$Month02 := 0;
  END IF;
  if (new$Month03 is null) then 
    new$Month03 := 0;
  END IF;
  if (new$Month04 is null) then 
    new$Month04 := 0;
  END IF;
  if (new$Month05 is null) then 
    new$Month05 := 0;
  END IF;
  if (new$Month06 is null) then 
    new$Month06 := 0;
  END IF;
  if (new$Month07 is null) then 
    new$Month07 := 0;
  END IF;
  if (new$Month08 is null) then 
    new$Month08 := 0;
  END IF;
  if (new$Month09 is null) then 
    new$Month09 := 0;
  END IF;
  if (new$Month10 is null) then 
    new$Month10 := 0;
  END IF;
  if (new$Month11 is null) then 
    new$Month11 := 0;
  END IF;
  if (new$Month12 is null) then 
    new$Month12 := 0;
  END IF;
  if (new$Quarter1 is null) then 
    new$Quarter1 := 0;
  END IF;
  if (new$Quarter2 is null) then 
    new$Quarter2 := 0;
  END IF;
  if (new$Quarter3 is null) then 
    new$Quarter3 := 0;
  END IF;
  if (new$Quarter4 is null) then 
    new$Quarter4 := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$Month01Delta is null) then 
    new$Month01Delta := 0;
  END IF;
  if (new$Month02Delta is null) then 
    new$Month02Delta := 0;
  END IF;
  if (new$Month03Delta is null) then 
    new$Month03Delta := 0;
  END IF;
  if (new$Month04Delta is null) then 
    new$Month04Delta := 0;
  END IF;
  if (new$Month05Delta is null) then 
    new$Month05Delta := 0;
  END IF;
  if (new$Month06Delta is null) then 
    new$Month06Delta := 0;
  END IF;
  if (new$Month07Delta is null) then 
    new$Month07Delta := 0;
  END IF;
  if (new$Month08Delta is null) then 
    new$Month08Delta := 0;
  END IF;
  if (new$Month09Delta is null) then 
    new$Month09Delta := 0;
  END IF;
  if (new$Month10Delta is null) then 
    new$Month10Delta := 0;
  END IF;
  if (new$Month11Delta is null) then 
    new$Month11Delta := 0;
  END IF;
  if (new$Month12Delta is null) then 
    new$Month12Delta := 0;
  END IF;
  if (new$Quarter1Delta is null) then 
    new$Quarter1Delta := 0;
  END IF;
  if (new$Quarter2Delta is null) then 
    new$Quarter2Delta := 0;
  END IF;
  if (new$Quarter3Delta is null) then 
    new$Quarter3Delta := 0;
  END IF;
  if (new$Quarter4Delta is null) then 
    new$Quarter4Delta := 0;
  END IF;
  if (new$SummaDelta is null) then 
    new$SummaDelta := 0; 
  END IF;
  if (new$SummaPreviousYear is null) then 
    new$SummaPreviousYear := 0;
  END IF;
  if (new$SummaFinPreviousYear is null) then 
    new$SummaFinPreviousYear := 0;
  END IF;
   
  if (new$SummaYear1 is null) then 
    new$SummaYear1 := 0;
  END IF;
  if (new$SummaYear2 is null) then 
    new$SummaYear2 := 0;
  END IF;
  if (new$SummaYear3 is null) then 
    new$SummaYear3 := 0;
  END IF;
  if (new$SummaYear4 is null) then 
    new$SummaYear4 := 0;
  END IF;
  if (new$SummaOtherYears is null) then 
    new$SummaOtherYears := 0;
  END IF;
   
  if (new$SummaYear1Delta is null) then 
    new$SummaYear1Delta := 0;
  END IF;
  if (new$SummaYear2Delta is null) then 
    new$SummaYear2Delta := 0;
  END IF;
  if (new$SummaYear3Delta is null) then 
    new$SummaYear3Delta := 0;
  END IF;
  if (new$SummaYear4Delta is null) then 
    new$SummaYear4Delta := 0;
  END IF;
  if (new$SummaOtherYearsDelta is null) then 
    new$SummaOtherYearsDelta := 0;
  END IF;
   
  /* проверка на то, что ссылаемся на этап из этого договора */
  if (new$ProgIndex = 304 and new$RecordIndex is not null and (:old.RecordIndex is null or :old.RecordIndex <> new$RecordIndex)) then
    SELECT COUNT(*) INTO CNT$1
    from AgreementSteps s where (s.Id = new$RecordIndex and s.RecordIndex = new$AgreementRef) AND (ROWNUM = 1);
    if (not (CNT$1<> 0)) then
      RaiseException('Ex_WrongStep');
    END IF;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      RaiseException('Ex_CantModufyBudget');
    END IF;
  END IF;
  if ((:old.ANumber is null) and (new$ANumber is not Null)) then
    SELECT COUNT(                    id
    ) INTO CNT$2
    from
    PaymentSchedule ps
    where
    (                    (ps.ANumber = new$ANumber)
    and
    (ps.BudgetRef = new$BudgetRef)) AND (ROWNUM = 1);
    if ((CNT$2<> 0)) then
      RaiseException('ex_Promise_NumUQ');
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_PAYMENTSCHEDULE_BU_1)
-- Create 05.03.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /* Версия триггера 1.0*/
    if (new$Quarter1 = 0) then new$Quarter1 := new$Month01 + new$Month02 + new$Month03; end if;
    if (new$Quarter2 = 0) then new$Quarter2 := new$Month04 + new$Month05 + new$Month06; end if;
    if (new$Quarter3 = 0) then new$Quarter3 := new$Month07 + new$Month08 + new$Month09; end if;
    if (new$Quarter4 = 0) then new$Quarter4 := new$Month10 + new$Month11 + new$Month12; end if;
    new$SummaYear1 := new$Quarter1 + new$Quarter2 + new$Quarter3 + new$Quarter4;

-- - - - - - - - - - - - -
-- BU_3 (TR_PAYMENTSCHEDULE_BU_3)
-- Create 03.12.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

    /* Это поле проставляется при вставке и никогда не может изменить значение */
    new$AdjustmentRef := :old.AdjustmentRef;

-- - - - - - - - - - - - -
-- BU_10 (TR_PAYMENTSCHEDULE_BU_10)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  /* Следим, чтобы никто не поменял внутреннюю нумерацию, иначе все накернится*/
  if ((new$ANumber <> :old.ANumber) or
  (new$InnerPromiseNum <> :old.InnerPromiseNum) or
  (new$AdjustmentNumber <> :old.AdjustmentNumber)) then
    RaiseException('EX_AGR_ChangeInnerNums');
  END IF;
      
  /* Отменять отклонение нельзя!!!*/
  if (((:old.AcceptDate is not null) and (:old.Accepted = 0)) and 
  ((new$Accepted = 1) or (new$AcceptDate is null))) then
    RaiseException('EX_RollbackCancel');
  END IF;
  /* Если приняли ДИ, тогда необходимо установить флаг LastAccepted*/
  if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 1)) or 
  ((:old.Accepted = 0) and (new$Accepted = 1) and (new$AcceptDate is not null))) then
    /* Менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (new$LastAdjustment = 1) then
      new$LastAccepted := 1;
              
    else
      RaiseException('EX_BP_ChangeStateAdjust');    
    END IF;
  END IF;
      
  /* Если отменили принятие документа, тогда необходимо снять флаг LastAccepted*/
  if (((:old.AcceptDate is not null) and (:old.Accepted = 1)) and
  ((new$Accepted = 0) or (new$AcceptDate is null))) then
    /* Менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (new$LastAdjustment = 1) then
      new$LastAccepted := 0;
              
    else
      RaiseException('EX_BP_ChangeStateAdjust');    
    END IF;
  END IF;
      
  /* Если отклонили ДИ, тогда необходимо скинуть флаг LastAdjustment*/
  if (((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted = 0)) or 
  ((:old.Accepted = 1) and (new$Accepted = 0) and (new$AcceptDate is not null))) then
    if (new$LastAdjustment = 1) then
      new$LastAdjustment := 0;
      new$LastAccepted := 0;
              
    else
      RaiseException('EX_AGR_ChangeStateAdjust');
    END IF;

    select max(AdjustmentNumber) into MaxNumber1$ from PaymentSchedule 
    where (InnerPromiseNum = new$InnerPromiseNum) ;
    /* нельзя отклонять первоначальное БО, если к нему существуют уточнения*/
    if ((new$adjustmentNumber=0) and (MaxNumber1$<>0))
    then 
      RaiseException('EX_BP_PrimaryBPHasNotify');    
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_PAYMENTSCHEDULE_BU_100)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Для уточнений дельту вычисляем как разницу текущего уточнения и предыдущего */  
  if (new$AdjustmentNumber > 0) then
    BEGIN
      select 
      Month01, Month02, Month03, Month04, Month05, Month06,
      Month07, Month08, Month09, Month10, Month11, Month12,
      Quarter1, Quarter2, Quarter3, Quarter4, Summa,
      SummaYear1, SummaYear2, SummaYear3, SummaYear4, SummaOtherYears
      into
      M01$, M02$, M03$, M04$, M05$, M06$, M07$, M08$, M09$, M10$, M11$, M12$, 
      Q1$, Q2$, Q3$, Q4$, S$, S1$, S2$, S3$, S4$, SOther$         from 
      PaymentSchedule
      where
      ID = new$AdjustmentRef
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
          
    new$Month01Delta := new$Month01 - M01$;
    new$Month02Delta := new$Month02 - M02$;
    new$Month03Delta := new$Month03 - M03$;
    new$Month04Delta := new$Month04 - M04$;
    new$Month05Delta := new$Month05 - M05$;
    new$Month06Delta := new$Month06 - M06$;
    new$Month07Delta := new$Month07 - M07$;
    new$Month08Delta := new$Month08 - M08$;
    new$Month09Delta := new$Month09 - M09$;
    new$Month10Delta := new$Month10 - M10$;
    new$Month11Delta := new$Month11 - M11$;
    new$Month12Delta := new$Month12 - M12$;
    new$Quarter1Delta := new$Quarter1 - Q1$;
    new$Quarter2Delta := new$Quarter2 - Q2$;
    new$Quarter3Delta := new$Quarter3 - Q3$;
    new$Quarter4Delta := new$Quarter4 - Q4$;
    new$SummaDelta := new$Summa - S$;
    new$SummaYear1Delta := new$SummaYear1 - S1$;
    new$SummaYear2Delta := new$SummaYear2 - S2$;
    new$SummaYear3Delta := new$SummaYear3 - S3$;
    new$SummaYear4Delta := new$SummaYear4 - S4$;
    new$SummaOtherYearsDelta := new$SummaOtherYears - SOther$;
        
  else /* В первых версиях дельты равны суммам БО */  
    new$Month01Delta := new$Month01;
    new$Month02Delta := new$Month02;
    new$Month03Delta := new$Month03;
    new$Month04Delta := new$Month04;
    new$Month05Delta := new$Month05;
    new$Month06Delta := new$Month06;
    new$Month07Delta := new$Month07;
    new$Month08Delta := new$Month08;
    new$Month09Delta := new$Month09;
    new$Month10Delta := new$Month10;
    new$Month11Delta := new$Month11;
    new$Month12Delta := new$Month12;
    new$Quarter1Delta := new$Quarter1;
    new$Quarter2Delta := new$Quarter2;
    new$Quarter3Delta := new$Quarter3;
    new$Quarter4Delta := new$Quarter4;
    new$SummaDelta := new$Summa;
    new$SummaYear1Delta := new$SummaYear1;
    new$SummaYear2Delta := new$SummaYear2;
    new$SummaYear3Delta := new$SummaYear3;
    new$SummaYear4Delta := new$SummaYear4;
    new$SummaOtherYearsDelta := new$SummaOtherYears;        
        
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_PAYMENTSCHEDULE_BU_200)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* если отклоняем БО */
  if (new$Accepted = 0 and new$AcceptDate is not null and :old.Accepted = 1) then
    /* смотрим все документы, в которых указано данное БО
         * если документ не отклонен, то нельзя отклонить и БО */
    FOR REC$1 IN (      select ffc.Reject_Cls  AS DocumentRejectCls from FacialFinDetail ffd
    left join FacialFinCaption ffc on (ffc.ID = ffd.RecordIndex)
    where SourcePromise = new$ANumber and SourceBudgetPromise = new$InnerPromiseNum
    or DestPromise = new$ANumber and DestBudgetPromise = new$InnerPromiseNum
    )
    LOOP
      if (REC$1.DocumentRejectCls is null) then
        RaiseException('Ex_BP_CannotReject');    
      END IF;
    END LOOP;
    /* проверяем, что на БО не уточнено более поздним неотклоненным уточнением*/
    FOR REC$1 IN (      SELECT Count(ps_in.ID)  AS AdjCount FROM PaymentSchedule ps_in
    WHERE (ps_in.InnerPromiseNum = new$InnerPromiseNum)and(ps_in.AdjustmentNumber > new$AdjustmentNumber)
    and (ps_in.Accepted<>0) 
    )
    LOOP
      if (REC$1.AdjCount > 0) then
        RaiseException('EX_BP_AdjustmentedCANNOTREJECT');    
      END IF;
    END LOOP;
  END IF;

-- - - - - - - - - - - - -
-- BU_400 (tr_PaymentSchedule_BU_400)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$AgreementRef <> :old.AgreementRef or new$ExecutionRef <> :old.ExecutionRef) then
    RaiseException('EX_CANTCHANGECAPTIONREF');
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_PAYMENTSCHEDULE_BU_700)
-- Create 14.10.2004
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$RVersion is null) then
    new$RVersion := 1;
  elsif ((new$RVersion = -1) and (:Old.RVersion <> -1)) then
    new$RVersion := :Old.RVersion;
  else
    new$RVersion := :Old.RVersion + 1;
  end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_PAYMENTSCHEDULE SET
    ID = new$ID,
    ANUMBER = new$ANUMBER,
    PARENTNUMBER = new$PARENTNUMBER,
    KFSR = new$KFSR,
    KESR = new$KESR,
    KVSR = new$KVSR,
    KCSR = new$KCSR,
    KVR = new$KVR,
    MONTH01 = new$MONTH01,
    MONTH02 = new$MONTH02,
    MONTH03 = new$MONTH03,
    MONTH04 = new$MONTH04,
    MONTH05 = new$MONTH05,
    MONTH06 = new$MONTH06,
    MONTH07 = new$MONTH07,
    MONTH08 = new$MONTH08,
    MONTH09 = new$MONTH09,
    MONTH10 = new$MONTH10,
    MONTH11 = new$MONTH11,
    MONTH12 = new$MONTH12,
    SUMMA = new$SUMMA,
    REGION = new$REGION,
    SUBKESR = new$SUBKESR,
    MEANSTYPE = new$MEANSTYPE,
    FINSOURCE = new$FINSOURCE,
    FINTYPE = new$FINTYPE,
    FACT = new$FACT,
    FACIALACC_CLS = new$FACIALACC_CLS,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    ACCEPTDATE = new$ACCEPTDATE,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    ACCEPTED = new$ACCEPTED,
    LASTACCEPTED = new$LASTACCEPTED,
    PROMISETYPE = new$PROMISETYPE,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    OLDNUMBER = new$OLDNUMBER,
    SUMMAPREVIOUSYEAR = new$SUMMAPREVIOUSYEAR,
    SUMMAFINPREVIOUSYEAR = new$SUMMAFINPREVIOUSYEAR,
    QUARTER1 = new$QUARTER1,
    QUARTER2 = new$QUARTER2,
    QUARTER3 = new$QUARTER3,
    QUARTER4 = new$QUARTER4,
    RECORDINDEX = new$RECORDINDEX,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    DIRECTIONCLS = new$DIRECTIONCLS,
    RVERSION = new$RVERSION,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    MONTH01DELTA = new$MONTH01DELTA,
    MONTH02DELTA = new$MONTH02DELTA,
    MONTH03DELTA = new$MONTH03DELTA,
    MONTH04DELTA = new$MONTH04DELTA,
    MONTH05DELTA = new$MONTH05DELTA,
    MONTH06DELTA = new$MONTH06DELTA,
    MONTH07DELTA = new$MONTH07DELTA,
    MONTH08DELTA = new$MONTH08DELTA,
    MONTH09DELTA = new$MONTH09DELTA,
    MONTH10DELTA = new$MONTH10DELTA,
    MONTH11DELTA = new$MONTH11DELTA,
    MONTH12DELTA = new$MONTH12DELTA,
    QUARTER1DELTA = new$QUARTER1DELTA,
    QUARTER2DELTA = new$QUARTER2DELTA,
    QUARTER3DELTA = new$QUARTER3DELTA,
    QUARTER4DELTA = new$QUARTER4DELTA,
    SUMMADELTA = new$SUMMADELTA,
    NOTE = new$NOTE,
    FINYEAR = new$FINYEAR,
    SUMMAYEAR1 = new$SUMMAYEAR1,
    SUMMAYEAR2 = new$SUMMAYEAR2,
    SUMMAYEAR3 = new$SUMMAYEAR3,
    SUMMAYEAR1DELTA = new$SUMMAYEAR1DELTA,
    SUMMAYEAR2DELTA = new$SUMMAYEAR2DELTA,
    SUMMAYEAR3DELTA = new$SUMMAYEAR3DELTA,
    ASSIGNMENTKIND = new$ASSIGNMENTKIND,
    TRANSFERTCLS = new$TRANSFERTCLS,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    EXECUTIONREF = new$EXECUTIONREF,
    INNERPROMISENUM = new$INNERPROMISENUM,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    PROMISENUMBER = new$PROMISENUMBER,
    SUBSIDYCLS = new$SUBSIDYCLS,
    AGREEMENTREF = new$AGREEMENTREF,
    BUDALLOCATIONCLS = new$BUDALLOCATIONCLS,
    PAYPROMISECLS = new$PAYPROMISECLS,
    PROGINDEX = new$PROGINDEX,
    INVESTOBJECT = new$INVESTOBJECT,
    SUMMAYEAR4 = new$SUMMAYEAR4,
    SUMMAOTHERYEARS = new$SUMMAOTHERYEARS,
    SUMMAYEAR4DELTA = new$SUMMAYEAR4DELTA,
    SUMMAOTHERYEARSDELTA = new$SUMMAOTHERYEARSDELTA
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_10 (TR_PAYMENTSCHEDULE_AU_10)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/

  /* Коррекция вспомогательных флагов в уточняемой записи*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentNumber > 0) and (new$LastAccepted <> :old.LastAccepted) and (:old.LastAdjustment = 1)) then
    update PaymentSchedule set
    LastAccepted = :old.LastAccepted,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;
  /* После отклонения БО необходимо восстановить флаг LastAdjustment у последней принятой версии*/
  if ((new$AdjustmentNumber > 0) and (:old.LastAdjustment = 1) and (new$LastAdjustment = 0) and 
  (new$AcceptDate is not null) and (new$Accepted = 0)) then
    update PaymentSchedule set
    LastAdjustment = 1,
    RVersion = -1
    where (ID = new$AdjustmentRef);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_PAYMENTSCHEDULE_AU_500)
-- Create 28.04.2005
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (113, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=113) and (RecordId=new$ID);
  end if;

END;
/
commit work
/
ALTER TABLE InvestObject ADD (
  SubsidyCls NUMBER(10),
    CHECK((SubsidyCls<=2147483647)AND(SubsidyCls>-2147483648)),
  constraint FK_IObj_SubsidyCls foreign key (SubsidyCls) references SubsidyCls(ID)
)
/
CREATE INDEX FK_IObj_SubsidyCls ON InvestObject(SubsidyCls)
/
commit work
/
ALTER TABLE BudgetData MODIFY(SummaYear4 NOT NULL)
/
ALTER TABLE BudgetData MODIFY(SummaOtherYears NOT NULL)
/
ALTER TABLE UNIONNOTIFYDETAIL MODIFY(SummaYear4 NOT NULL)
/
ALTER TABLE UNIONNOTIFYDETAIL MODIFY(SummaOtherYears NOT NULL)
/
ALTER TABLE TB_PAYMENTSCHEDULE MODIFY(SummaYear4 NOT NULL)
/
ALTER TABLE TB_PAYMENTSCHEDULE MODIFY(SummaOtherYears NOT NULL)
/

-- #########################################################
-- #########################################################
-- Alter_LayerData_ObjectCode_OKPD_FinType.sql
-- #########################################################
-- #########################################################


/* <TRANS_COMMAND>
ALTER TABLE LAYERDATA
  ADD INVESTOBJECT VARCHAR2(20)
/  

CREATE INDEX IDX_LAYERDATA_INVESTOBJECT ON LAYERDATA (INVESTOBJECT)
/

COMMIT WORK
/

ALTER TABLE LAYERDATA
  ADD FINTYPE VARCHAR2(20)
/  

CREATE INDEX IDX_LAYERDATA_FINTYPE ON LAYERDATA (FINTYPE)
/

COMMIT WORK
/

ALTER TABLE LAYERDATA
  ADD OKPD NUMBER(10,0)
/  

ALTER TABLE LAYERDATA ADD(
  CHECK((OKPD<=2147483647)AND(OKPD>-2147483648))
)
/

CREATE INDEX IDX_LAYERDATA_OKPD ON LAYERDATA (OKPD)
/
COMMIT WORK
/
*/
-- <TRANS_IGNORE>
DECLARE 
  v_exists integer;
BEGIN
  SELECT count(*) 
    INTO v_exists
    FROM USER_TAB_COLUMNS 
    WHERE TABLE_NAME='LAYERDATA' AND COLUMN_NAME='INVESTOBJECT';
  IF (v_exists=0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA
      ADD INVESTOBJECT VARCHAR2(20)';

    EXECUTE IMMEDIATE 'CREATE INDEX IDX_LAYERDATA_INVESTOBJECT ON LAYERDATA (INVESTOBJECT)';
    EXECUTE IMMEDIATE 'COMMIT WORK';
  END IF;
  SELECT count(*) 
    INTO v_exists
    FROM USER_TAB_COLUMNS 
    WHERE TABLE_NAME='LAYERDATA' AND COLUMN_NAME='FINTYPE';
  IF (v_exists=0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA
      ADD FINTYPE VARCHAR2(20)';

    EXECUTE IMMEDIATE 'CREATE INDEX IDX_LAYERDATA_FINTYPE ON LAYERDATA (FINTYPE)';
    EXECUTE IMMEDIATE 'COMMIT WORK';
  END IF;
  SELECT count(*) 
    INTO v_exists
    FROM USER_TAB_COLUMNS 
    WHERE TABLE_NAME='LAYERDATA' AND COLUMN_NAME='OKPD';
  IF (v_exists=0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA
      ADD OKPD NUMBER(10,0)';

    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA ADD(
      CHECK((OKPD<=2147483647)AND(OKPD>-2147483648))
    )';
    EXECUTE IMMEDIATE 'CREATE INDEX IDX_LAYERDATA_OKPD ON LAYERDATA (OKPD)';
    EXECUTE IMMEDIATE 'COMMIT WORK';
  END IF;
END;
/


-- #########################################################
-- #########################################################
-- LayerClassifierFieldToVarchar2.sql
-- #########################################################
-- #########################################################


/* Скрипт сделает поле FACT, DIRECTIONCLS строковым. */

/* <TRANS_COMMAND>
ALTER TABLE LAYERDATA ADD (tempFACT varchar2(20))
/

update LAYERDATA set tempFACT = FACT where FACT is not null
/

DROP INDEX IDX_LAYERDATA_FACT
/

ALTER TABLE LAYERDATA DROP (FACT)
/

ALTER TABLE LAYERDATA ADD (FACT varchar2(20))
/

update LAYERDATA set FACT = tempFACT where tempFACT is not null
/

ALTER TABLE LAYERDATA DROP (tempFACT)
/

CREATE INDEX IDX_LAYERDATA_FACT ON LAYERDATA(FACT)
/

COMMIT WORK
/
*/
-- <TRANS_IGNORE>
DECLARE
  v_exists INTEGER;
BEGIN
  SELECT COUNT(*)
  INTO v_exists
  FROM USER_TAB_COLUMNS
  WHERE TABLE_NAME = 'LAYERDATA'
  AND COLUMN_NAME = 'FACT'
  AND DATA_TYPE = 'NUMBER';
  IF (v_exists > 0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA ADD (tempFACT varchar2(20))';
    EXECUTE IMMEDIATE 'update LAYERDATA set tempFACT = FACT where FACT is not null';
    EXECUTE IMMEDIATE 'DROP INDEX IDX_LAYERDATA_FACT';
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA DROP (FACT)';
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA ADD (FACT varchar2(20))';
    EXECUTE IMMEDIATE 'update LAYERDATA set FACT = tempFACT where tempFACT is not null';
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA DROP (tempFACT)';
    EXECUTE IMMEDIATE 'CREATE INDEX IDX_LAYERDATA_FACT ON LAYERDATA(FACT)';
    EXECUTE IMMEDIATE 'COMMIT WORK';
  END IF;
END;
/

/* <TRANS_COMMAND>
ALTER TABLE LAYERDATA ADD (tempDIRECTIONCLS varchar2(20))
/

update LAYERDATA set tempDIRECTIONCLS = DIRECTIONCLS where DIRECTIONCLS is not null
/

DROP INDEX IDX_LAYERDATA_DIRECTIONCLS
/

ALTER TABLE LAYERDATA DROP (DIRECTIONCLS)
/

ALTER TABLE LAYERDATA ADD (DIRECTIONCLS varchar2(20))
/

update LAYERDATA set DIRECTIONCLS = tempDIRECTIONCLS where tempDIRECTIONCLS is not null
/

ALTER TABLE LAYERDATA DROP (tempDIRECTIONCLS)
/

CREATE INDEX IDX_LAYERDATA_DIRECTIONCLS ON LAYERDATA(DIRECTIONCLS)
/

COMMIT WORK
/
*/
-- <TRANS_IGNORE>
DECLARE
  v_exists INTEGER;
BEGIN
  SELECT COUNT(*)
  INTO v_exists
  FROM USER_TAB_COLUMNS
  WHERE TABLE_NAME = 'LAYERDATA'
  AND COLUMN_NAME = 'DIRECTIONCLS'
  AND DATA_TYPE = 'NUMBER';
  IF (v_exists > 0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA ADD (tempDIRECTIONCLS varchar2(20))';
    EXECUTE IMMEDIATE 'update LAYERDATA set tempDIRECTIONCLS = DIRECTIONCLS where DIRECTIONCLS is not null';
    EXECUTE IMMEDIATE 'DROP INDEX IDX_LAYERDATA_DIRECTIONCLS';
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA DROP (DIRECTIONCLS)';
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA ADD (DIRECTIONCLS varchar2(20))';
    EXECUTE IMMEDIATE 'update LAYERDATA set DIRECTIONCLS = tempDIRECTIONCLS where tempDIRECTIONCLS is not null';
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA DROP (tempDIRECTIONCLS)';
    EXECUTE IMMEDIATE 'CREATE INDEX IDX_LAYERDATA_DIRECTIONCLS ON LAYERDATA(DIRECTIONCLS)';
    EXECUTE IMMEDIATE 'COMMIT WORK';
  END IF;
END;
/


-- #########################################################
-- #########################################################
-- Add_WritNotifyCLSPart.sql
-- #########################################################
-- #########################################################

-- Скрипт добавляет в атрибуты уведомлений исполнительных листов лицевой счет и причину отклонения
-- процедуры
CREATE OR REPLACE PROCEDURE IMPORT_CLSPART(   
  ID_$ NUMBER,  NAME_$ VARCHAR2,  SHORTNAME_$ VARCHAR2,  NOTIFY_FIELDTYPE_$ NUMBER,
      HANDBOOKID_$ NUMBER  
)
AS
  IDExists$ NUMBER(10);
BEGIN
  SELECT COUNT(ID)
  INTO IDExists$   FROM WritNotifyClsPart
  WHERE (ID = ID_$)
  ;
   
   
  IF (IDExists$  <> 0) THEN
    UPDATE WritNotifyClsPart SET
    NAME = NAME_$,
    SHORTNAME = SHORTNAME_$,
    NOTIFY_FIELDTYPE = NOTIFY_FIELDTYPE_$,
    HANDBOOKID = HANDBOOKID_$

    WHERE ID = ID_$;
      
  ELSE
    INSERT INTO WritNotifyClsPart (Id,Name,ShortName,Notify_FieldType,HANDBOOKID)
    VALUES
    (ID_$,NAME_$,SHORTNAME_$,NOTIFY_FIELDTYPE_$, HANDBOOKID_$);
  END IF;
END;
/
-- описание типа полей справочника уведомлений
CALL IMPORT_CLSPART(20,'Лицевой счет','ЛицСчет',5,41)
/
CALL IMPORT_CLSPART(21,'Причина возврата','ПричинаСпр',5,50)
/
DROP PROCEDURE IMPORT_CLSPART 
/
CREATE OR REPLACE PROCEDURE IMPORT_CLSDETAIL(   
  ID_$ NUMBER,  RecordIndex_$ NUMBER,  NotifyCLSPart_$ NUMBER,  Note_$ VARCHAR2,
      issystem_$ NUMBER,  isrequired_$ NUMBER  
)
AS
  IDExists$ NUMBER(10);
BEGIN
  SELECT COUNT(ID)
  INTO IDExists$   FROM writnotifyclsdetail
  WHERE (ID = ID_$)
  ;
    
  IF (IDExists$  <> 0) THEN
    UPDATE writnotifyclsdetail SET
    RecordIndex = RecordIndex_$,
    NotifyCLSPart = NotifyCLSPart_$,
    Note = Note_$,
    issystem = issystem_$,
    isrequired = isrequired_$

    WHERE ID = ID_$  ;
      
  ELSE
    INSERT INTO writnotifyclsdetail (Id,RecordIndex,NotifyCLSPart,Note,issystem,isrequired)
    VALUES
    (ID_$,RecordIndex_$,NotifyCLSPart_$,Note_$,issystem_$,isrequired_$);
  END IF;
END;
/
CALL IMPORT_CLSDETAIL(53,16,20,'Лицевой счет',1,0)
/
DROP PROCEDURE IMPORT_CLSDETAIL
/
COMMIT WORK
/


-- #########################################################
-- #########################################################
-- alter_Org_RemotePBS.sql
-- #########################################################
-- #########################################################

/* Добавляет поля УПБС, НУБП в справочник организаций
*/
ALTER TABLE TB_Organizations ADD (
  RemotePBSCode VARCHAR2(20),/* УПБС */
  RemoteNotPBSCode VARCHAR2(20)/* НУБП */
)
/

CREATE OR REPLACE VIEW Organizations (
  ID,
  NAME,
  GOSNI,
  CITY,
  COUNTRY,
  PHONE,
  ADDRESS,
  ORG_CLS,
  INN20,
  SUBINN,
  FACIALACC,
  REGIONCLS,
  DIRNAME,
  BUGNAME,
  DIRPHONE,
  BUGPHONE,
  RCORG,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  INN,
  OKATO,
  EMAIL,
  WEBSITE,
  UFKCODE,
  ADDOKATO,
  SHORTNAME,
  RVERSION,
  SENDERID,
  KVSR,
  OKFS,
  OKOPF,
  OPENDATE,
  CLOSEDATE,
  CHANGEDATE,
  GENERALORG_REF,
  FEDERALREGIONCODE,
  ORG_TYPE,
  BUDGETREF,
  SUPPLIERSTATUS,
  COUNTRYCODE,
  DATECLOSE,
  ORGCODE,
  COSTAUTHORITY,
  INCOMEAUTHORITY,
  DEBTAUTHORITY,
  SVRAUTHORITY,
  CLIENTID,
  DATEOPEN,
  FUID,
  OKPO,
  OKTMO,
  DOCSTATEREF,
  CRYPTOSTATUS,
  OGRN,
  REJECT_CLS,
  REJECTCAUSE,
  EXTID,
  EXTOWNER,
  EXTSYNCDATE,
  REMOTEPBSCODE,
  REMOTENOTPBSCODE)
AS
  SELECT
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS,
    OGRN,
    REJECT_CLS,
    REJECTCAUSE,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE,
    REMOTEPBSCODE,
    REMOTENOTPBSCODE
  FROM TB_Organizations
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_ID
  INSTEAD OF DELETE
  ON ORGANIZATIONS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_ORGANIZATIONS_BD)
-- Last update 09.06.2008
-- - - - - - - - - - - - -

  if (:old.ID = 0) then
    RaiseException('ex_CantDelUnknownOrg');
  end if;

  delete from Org_Accounts where org_ref = :old.id;
  delete from Banks where id = :old.id;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_ORGANIZATIONS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_200 (TR_ORGANIZATIONS_AD_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

update Organizations set
    GeneralOrg_Ref = id
  where
    GeneralOrg_Ref = :old.id;

-- - - - - - - - - - - - -
-- AD_210 (TR_ORGANIZATIONS_AD_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Удаление истории изменений состоний для удаленного документа*/
  delete 
  from 
  StateJumpHistory
  where 
  DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_500 (TR_ORGANIZATIONS_AD_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(27, :old.ID ,SYSDATE);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_II
  INSTEAD OF INSERT
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$EXTID ORGANIZATIONS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORGANIZATIONS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORGANIZATIONS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
  new$REMOTEPBSCODE ORGANIZATIONS.REMOTEPBSCODE%TYPE := :NEW.REMOTEPBSCODE;
  new$REMOTENOTPBSCODE ORGANIZATIONS.REMOTENOTPBSCODE%TYPE := :NEW.REMOTENOTPBSCODE;
--
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_Organizations_bi)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$FUID is null) then 
    new$FUID := new$id;
  END IF;
  if (new$GOSNI is null) then 
    new$GOSNI := 0;
  END IF;
  if (new$Name is null) then 
    new$Name := 'Не указано наименование';
  END IF;
  if (new$City is null) then 
    GetVarcharConst(-1,7,new$City);
  END IF;
  if (new$COUNTRY is null) then 
    new$COUNTRY := 'Россия';
  END IF;
  if (new$CountryCode is null) then 
    new$CountryCode := 643;
  END IF;
  if (new$ORG_CLS is NULL) then 
    new$ORG_CLS:= 0;
  END IF;
  if (new$SubINN is null) then 
    new$SubINN:= 0;
  END IF;
  if (new$INN20 is null) then 
    new$INN20:= '';
  END IF;
  if (new$RCOrg is null) then 
    new$RCOrg := 0;
  END IF;
  if (new$RegionCls is null) then 
    new$RegionCls := 0;
  END IF;
  if (new$OKATO is null) then 
    new$OKATO := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$OKFS is null) then 
    new$OKFS := 0;
  END IF;
  if (new$OKOPF is null) then 
    new$OKOPF := 0;
  END IF;
  if (new$FederalRegionCode is null) then
    GetIntConst(-1, 27,new$FederalRegionCode);
  END IF;
  if (new$FederalRegionCode is null) then
    new$FederalRegionCode := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;
  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$INN > 9999999999.9) and (new$INN20 <> '') and (new$INN20 is not null)) then
    RaiseException('EX_WRONGKPP');
  END IF;
  check_unique_organization(new$inn,  new$inn20);
  if (new$CostAuthority is null) then 
    new$CostAuthority:= 0;
  END IF;
  if (new$IncomeAuthority is null) then 
    new$IncomeAuthority := 0;
  END IF;
  if (new$DebtAuthority is null) then 
    new$DebtAuthority := 0;
  END IF;
  if (new$SVRAuthority is null) then 
    new$SVRAuthority := 0;
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if (new$Org_Type is not null)
  then 
    if (new$Org_Type between 10100 and 10299) then
      new$CostAuthority:= 1;
    END IF;
    if (new$Org_Type between 10300 and 10399) then
      new$CostAuthority:= 2;
    END IF;
    if (new$Org_Type between 10400 and 10499) then
      new$CostAuthority:= 4;
    END IF;
    if (((new$Org_Type between 10500 and 10599) and (new$CostAuthority<>16)) or
    (((new$Org_Type between 10000 and 10099) or (new$Org_Type between 10600 and 10799))
    and (new$CostAuthority=0))) then
      new$CostAuthority:= 8;
        
    END IF;
  else 
    new$Org_Type := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_ORGANIZATIONS_BI_10)
-- Last update 19.10.2006
-- - - - - - - - - - - - -

  if (new$FacialAcc is not null) then
    select count(id) into cnt$ from Organizations where (FacialAcc = new$FacialAcc) AND (ROWNUM = 1);
    if (cnt$ <> 0) then RaiseException('ex_DublicateFacialAcc'); end if;
  end if;

-- - - - - - - - - - - - -
-- BI_200 (TR_ORGANIZATIONS_BI_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;

    /*  При вставке КВСР берем из распорядителя, если он уже не заполнен*/
    if (new$KVSR = 0) then
      select o.KVSR into new$KVSR
      from Organizations o
      where o.id = new$GeneralOrg_Ref;
    end if;
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORGANIZATIONS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORGANIZATIONS (
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS,
    OGRN,
    REJECT_CLS,
    REJECTCAUSE,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE,
    REMOTEPBSCODE,
    REMOTENOTPBSCODE
  ) VALUES (
    new$ID,
    new$NAME,
    new$GOSNI,
    new$CITY,
    new$COUNTRY,
    new$PHONE,
    new$ADDRESS,
    new$ORG_CLS,
    new$INN20,
    new$SUBINN,
    new$FACIALACC,
    new$REGIONCLS,
    new$DIRNAME,
    new$BUGNAME,
    new$DIRPHONE,
    new$BUGPHONE,
    new$RCORG,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$INN,
    new$OKATO,
    new$EMAIL,
    new$WEBSITE,
    new$UFKCODE,
    new$ADDOKATO,
    new$SHORTNAME,
    new$RVERSION,
    new$SENDERID,
    new$KVSR,
    new$OKFS,
    new$OKOPF,
    new$OPENDATE,
    new$CLOSEDATE,
    new$CHANGEDATE,
    new$GENERALORG_REF,
    new$FEDERALREGIONCODE,
    new$ORG_TYPE,
    new$BUDGETREF,
    new$SUPPLIERSTATUS,
    new$COUNTRYCODE,
    new$DATECLOSE,
    new$ORGCODE,
    new$COSTAUTHORITY,
    new$INCOMEAUTHORITY,
    new$DEBTAUTHORITY,
    new$SVRAUTHORITY,
    new$CLIENTID,
    new$DATEOPEN,
    new$FUID,
    new$OKPO,
    new$OKTMO,
    new$DOCSTATEREF,
    new$CRYPTOSTATUS,
    new$OGRN,
    new$REJECT_CLS,
    new$REJECTCAUSE,
    new$EXTID,
    new$EXTOWNER,
    new$EXTSYNCDATE,
    new$REMOTEPBSCODE,
    new$REMOTENOTPBSCODE);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORGANIZATIONS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 27) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_IU
  INSTEAD OF UPDATE
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$EXTID ORGANIZATIONS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORGANIZATIONS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORGANIZATIONS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
  new$REMOTEPBSCODE ORGANIZATIONS.REMOTEPBSCODE%TYPE := :NEW.REMOTEPBSCODE;
  new$REMOTENOTPBSCODE ORGANIZATIONS.REMOTENOTPBSCODE%TYPE := :NEW.REMOTENOTPBSCODE;
--
  CNT$ NUMBER(10);
  c$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_organizations_bu)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$gosni is null) then 
    new$gosni := 0;
  END IF;
  if (new$city is null) then 
    getvarcharconst(-1,7,new$city);
  END IF;
  if (new$country is null) then 
    new$country := 'Россия';
  END IF;
  if (new$countrycode is null) then 
    new$countrycode := 643;
  END IF;
  if (new$org_cls is null) then 
    new$org_cls:= 0;
  END IF;
  if (new$inn20 is null) then 
    new$inn20:= '';
  END IF;
  if (new$rcorg is null) then 
    new$rcorg := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$okato is null) then 
    new$okato := 0;
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$okfs is null) then 
    new$okfs := 0;
  END IF;
  if (new$okopf is null) then 
    new$okopf := 0;
  END IF;
  if (new$federalregioncode is null) then
    getintconst(-1, 27,new$federalregioncode);
  END IF;
  if (new$federalregioncode is null) then
    new$federalregioncode := 0;
  END IF;
  if (new$budgetref is null) then 
    new$budgetref := 0;
  END IF;
  if (new$org_type is null) then 
    new$org_type := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;

  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null))) then 
    if ((new$inn > 9999999999.9) and (new$inn20 <> '')) then
      RaiseException('ex_wrongkpp');  
    END IF;
  END IF;
  if ( ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null)))
  or ( (new$inn20 <> :old.inn20) or ((:old.inn20 is null) and (new$inn20 is not null))) )
  then
    check_unique_organization(new$inn,  new$inn20);
  END IF;
   
  if (new$regioncls <> :old.regioncls) then
    update dfaccountsbuhtable set
    regioncls = new$regioncls
    where id = any (select id from org_accounts where org_ref = new$id);
  END IF;
  /* Запрет изменений в неуказанной организации */
  if (:old.id = 0) then
    RaiseException('ex_cantmodifyunknownorg');
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if ((new$org_type<>:old.org_type) or (new$costauthority<>:old.costauthority))
  then 
    c$ := new$costauthority;
    if (new$org_type between 10100 and 10299) then
      new$costauthority:= 1;
    END IF;
    if (new$org_type between 10300 and 10399) then
      new$costauthority:= 2;
    END IF;
    if (new$org_type between 10400 and 10499) then
      new$costauthority:= 4;
    END IF;
    if (((new$org_type between 10500 and 10599) and (new$costauthority<>16)) or
    (((new$org_type between 10000 and 10099) or (new$org_type between 10600 and 10799))
    and (new$costauthority=0))) then
      new$costauthority:= 8;
    END IF;
    if ((new$org_type=:old.org_type) and (c$<>new$costauthority)) then
      RaiseException('ex_wrongcostauthority');  
    END IF;
  END IF;
  /* если изменилось значение RegionCls у организации, то меняем
      и у подведомственных лс*/
  if (new$regioncls <> :old.regioncls) then
    update facialacc_cls fac set
    fac.regioncls = new$regioncls
    where
    new$id = fac.org_ref;
      
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_ORGANIZATIONS_BU_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$FacialAcc <> :old.FacialAcc) then
    select count(id) into CNT$ from Organizations
      where (FacialAcc = new$FacialAcc) and (id <> new$id) AND (ROWNUM = 1);
    if (CNT$ <> 0) then
      RaiseException('ex_DublicateFacialAcc');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORGANIZATIONS_BU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- COMMENT сноска в детали даты закрытия


    /*  закрытие организации */
    if ((new$DateClose is not null) and (:old.DateClose is null)) then
      /*  закрываем счета флажком и указываем причину закрытия */
      update Org_Accounts set
        CloseCode = CloseCode + 10
      where Org_Ref = new$Id;
    end if;

    /*  Для л/с надо еще учитывать изменение даты */
    if (((new$DateClose is not null) and (:old.DateClose is null)) or (new$DateClose <> :old.DateClose)) then
      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode + 10
      where Org_ref = new$Id;
    end if;

    /*  открытие организации */
    if ((new$DateClose is null) and (:old.DateClose is not null)) then
      update Org_Accounts set
        CloseCode = CloseCode - 10
      where Org_Ref = new$Id;

      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode - 10
      where Org_ref = new$Id;
    end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_ORGANIZATIONS_BU_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;
  end if;

  if (new$GeneralOrg_Ref <> :old.GeneralOrg_Ref) then
    update FacialAcc_CLS set
      GeneralOrg_Ref = new$GeneralOrg_Ref
    where
      Org_Ref = new$id;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_ORGANIZATIONS_BU_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$DOCSTATEREF <> :old.DOCSTATEREF) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(new$id, :old.DOCSTATEREF, new$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORGANIZATIONS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  IF (new$RVersion IS NULL) THEN
    new$RVersion := 1;
  ELSIF ( (new$RVersion = -1) AND (:OLD.RVersion <> -1) ) THEN
    new$RVersion := :OLD.RVersion;
  ELSE
    new$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORGANIZATIONS SET
    ID = new$ID,
    NAME = new$NAME,
    GOSNI = new$GOSNI,
    CITY = new$CITY,
    COUNTRY = new$COUNTRY,
    PHONE = new$PHONE,
    ADDRESS = new$ADDRESS,
    ORG_CLS = new$ORG_CLS,
    INN20 = new$INN20,
    SUBINN = new$SUBINN,
    FACIALACC = new$FACIALACC,
    REGIONCLS = new$REGIONCLS,
    DIRNAME = new$DIRNAME,
    BUGNAME = new$BUGNAME,
    DIRPHONE = new$DIRPHONE,
    BUGPHONE = new$BUGPHONE,
    RCORG = new$RCORG,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    INN = new$INN,
    OKATO = new$OKATO,
    EMAIL = new$EMAIL,
    WEBSITE = new$WEBSITE,
    UFKCODE = new$UFKCODE,
    ADDOKATO = new$ADDOKATO,
    SHORTNAME = new$SHORTNAME,
    RVERSION = new$RVERSION,
    SENDERID = new$SENDERID,
    KVSR = new$KVSR,
    OKFS = new$OKFS,
    OKOPF = new$OKOPF,
    OPENDATE = new$OPENDATE,
    CLOSEDATE = new$CLOSEDATE,
    CHANGEDATE = new$CHANGEDATE,
    GENERALORG_REF = new$GENERALORG_REF,
    FEDERALREGIONCODE = new$FEDERALREGIONCODE,
    ORG_TYPE = new$ORG_TYPE,
    BUDGETREF = new$BUDGETREF,
    SUPPLIERSTATUS = new$SUPPLIERSTATUS,
    COUNTRYCODE = new$COUNTRYCODE,
    DATECLOSE = new$DATECLOSE,
    ORGCODE = new$ORGCODE,
    COSTAUTHORITY = new$COSTAUTHORITY,
    INCOMEAUTHORITY = new$INCOMEAUTHORITY,
    DEBTAUTHORITY = new$DEBTAUTHORITY,
    SVRAUTHORITY = new$SVRAUTHORITY,
    CLIENTID = new$CLIENTID,
    DATEOPEN = new$DATEOPEN,
    FUID = new$FUID,
    OKPO = new$OKPO,
    OKTMO = new$OKTMO,
    DOCSTATEREF = new$DOCSTATEREF,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    OGRN = new$OGRN,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    EXTID = new$EXTID,
    EXTOWNER = new$EXTOWNER,
    EXTSYNCDATE = new$EXTSYNCDATE,
    REMOTEPBSCODE = new$REMOTEPBSCODE,
    REMOTENOTPBSCODE = new$REMOTENOTPBSCODE
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_100 (TR_ORGANIZATIONS_AU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- Comment Триггер обработки открытия/закрытия организации


  /*  Закрытие организации */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
    update Banks set DateClose = new$DateClose where (id = new$ID) and (DateClose is null);
  end if;

  /*  открытие организации */
  if ((new$DateClose is null) and (:old.DateClose is not null)) then
    update Banks set DateClose = null where (id = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_200 (TR_ORGANIZATIONS_AU_200)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$BudgetRef <> :old.BudgetRef) then
    update FacialAcc_CLS set
    BudgetRef = new$BudgetRef
    where
    (ORG_REF = new$id)and((BudgetRef = :old.BudgetRef)or(BudgetRef<>0));
  END IF;
  /* Сносим организацию в проставленный КВСР, только если это ГРБС*/
  if ((new$KVSR <> :old.KVSR)and(new$Org_Type >= 10100)and(new$Org_Type <= 10299)) then
    update KVSR set
    Org_Ref = new$id
    where
    id = new$KVSR;
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update FacialAcc_CLS set
    KVSR = new$KVSR
    where
    (ORG_REF = new$id) and (KVSR = :old.KVSR);
  END IF;
  if (new$BudgetRef <> :old.BudgetRef) then
    update organizations set
    BudgetRef = new$BudgetRef
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update organizations set
    KVSR = new$KVSR
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORGANIZATIONS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (27, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=27) and (RecordId=new$ID);
  end if;

END;
/
commit work
/

-- #########################################################
-- #########################################################
-- Add_CardNumber_to_ED_OUTPAYDOC.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет поле номер карты (CardNumber)*/
ALTER TABLE ed_outpaydoc ADD (
  CardNumber VARCHAR2(50)
)
/
commit work 
/

-- #########################################################
-- #########################################################
-- alter_Organizations_add_UseCheck_Card.sql
-- #########################################################
-- #########################################################

/* Добавление поля "Принадлежность к перечням" в таблицу организаций */
ALTER TABLE TB_Organizations ADD (
  UseCheck_Card NUMBER(10)/* Принадлежность к перечням */,
    CHECK((UseCheck_Card<=2147483647)AND(UseCheck_Card>-2147483648))
)
/

CREATE OR REPLACE VIEW Organizations (
  ID,
  NAME,
  GOSNI,
  CITY,
  COUNTRY,
  PHONE,
  ADDRESS,
  ORG_CLS,
  INN20,
  SUBINN,
  FACIALACC,
  REGIONCLS,
  DIRNAME,
  BUGNAME,
  DIRPHONE,
  BUGPHONE,
  RCORG,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  INN,
  OKATO,
  EMAIL,
  WEBSITE,
  UFKCODE,
  ADDOKATO,
  SHORTNAME,
  RVERSION,
  SENDERID,
  KVSR,
  OKFS,
  OKOPF,
  OPENDATE,
  CLOSEDATE,
  CHANGEDATE,
  GENERALORG_REF,
  FEDERALREGIONCODE,
  ORG_TYPE,
  BUDGETREF,
  SUPPLIERSTATUS,
  COUNTRYCODE,
  DATECLOSE,
  ORGCODE,
  COSTAUTHORITY,
  INCOMEAUTHORITY,
  DEBTAUTHORITY,
  SVRAUTHORITY,
  CLIENTID,
  DATEOPEN,
  FUID,
  OKPO,
  OKTMO,
  DOCSTATEREF,
  CRYPTOSTATUS,
  OGRN,
  REJECT_CLS,
  REJECTCAUSE,
  EXTID,
  EXTOWNER,
  EXTSYNCDATE,
  REMOTEPBSCODE,
  REMOTENOTPBSCODE,
  USECHECK_CARD)
AS
  SELECT
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS,
    OGRN,
    REJECT_CLS,
    REJECTCAUSE,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE,
    REMOTEPBSCODE,
    REMOTENOTPBSCODE,
    USECHECK_CARD
  FROM TB_Organizations
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_ID
  INSTEAD OF DELETE
  ON ORGANIZATIONS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_ORGANIZATIONS_BD)
-- Last update 09.06.2008
-- - - - - - - - - - - - -

  if (:old.ID = 0) then
    RaiseException('ex_CantDelUnknownOrg');
  end if;

  delete from Org_Accounts where org_ref = :old.id;
  delete from Banks where id = :old.id;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_ORGANIZATIONS
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_200 (TR_ORGANIZATIONS_AD_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

update Organizations set
    GeneralOrg_Ref = id
  where
    GeneralOrg_Ref = :old.id;

-- - - - - - - - - - - - -
-- AD_210 (TR_ORGANIZATIONS_AD_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* Удаление истории изменений состоний для удаленного документа*/
  delete 
  from 
  StateJumpHistory
  where 
  DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_500 (TR_ORGANIZATIONS_AD_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate) values(27, :old.ID ,SYSDATE);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_II
  INSTEAD OF INSERT
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$EXTID ORGANIZATIONS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORGANIZATIONS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORGANIZATIONS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
  new$REMOTEPBSCODE ORGANIZATIONS.REMOTEPBSCODE%TYPE := :NEW.REMOTEPBSCODE;
  new$REMOTENOTPBSCODE ORGANIZATIONS.REMOTENOTPBSCODE%TYPE := :NEW.REMOTENOTPBSCODE;
  new$USECHECK_CARD ORGANIZATIONS.USECHECK_CARD%TYPE := :NEW.USECHECK_CARD;
--
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_Organizations_bi)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$FUID is null) then 
    new$FUID := new$id;
  END IF;
  if (new$GOSNI is null) then 
    new$GOSNI := 0;
  END IF;
  if (new$Name is null) then 
    new$Name := 'Не указано наименование';
  END IF;
  if (new$City is null) then 
    GetVarcharConst(-1,7,new$City);
  END IF;
  if (new$COUNTRY is null) then 
    new$COUNTRY := 'Россия';
  END IF;
  if (new$CountryCode is null) then 
    new$CountryCode := 643;
  END IF;
  if (new$ORG_CLS is NULL) then 
    new$ORG_CLS:= 0;
  END IF;
  if (new$SubINN is null) then 
    new$SubINN:= 0;
  END IF;
  if (new$INN20 is null) then 
    new$INN20:= '';
  END IF;
  if (new$RCOrg is null) then 
    new$RCOrg := 0;
  END IF;
  if (new$RegionCls is null) then 
    new$RegionCls := 0;
  END IF;
  if (new$OKATO is null) then 
    new$OKATO := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$OKFS is null) then 
    new$OKFS := 0;
  END IF;
  if (new$OKOPF is null) then 
    new$OKOPF := 0;
  END IF;
  if (new$FederalRegionCode is null) then
    GetIntConst(-1, 27,new$FederalRegionCode);
  END IF;
  if (new$FederalRegionCode is null) then
    new$FederalRegionCode := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;
  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$INN > 9999999999.9) and (new$INN20 <> '') and (new$INN20 is not null)) then
    RaiseException('EX_WRONGKPP');
  END IF;
  check_unique_organization(new$inn,  new$inn20);
  if (new$CostAuthority is null) then 
    new$CostAuthority:= 0;
  END IF;
  if (new$IncomeAuthority is null) then 
    new$IncomeAuthority := 0;
  END IF;
  if (new$DebtAuthority is null) then 
    new$DebtAuthority := 0;
  END IF;
  if (new$SVRAuthority is null) then 
    new$SVRAuthority := 0;
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if (new$Org_Type is not null)
  then 
    if (new$Org_Type between 10100 and 10299) then
      new$CostAuthority:= 1;
    END IF;
    if (new$Org_Type between 10300 and 10399) then
      new$CostAuthority:= 2;
    END IF;
    if (new$Org_Type between 10400 and 10499) then
      new$CostAuthority:= 4;
    END IF;
    if (((new$Org_Type between 10500 and 10599) and (new$CostAuthority<>16)) or
    (((new$Org_Type between 10000 and 10099) or (new$Org_Type between 10600 and 10799))
    and (new$CostAuthority=0))) then
      new$CostAuthority:= 8;
        
    END IF;
  else 
    new$Org_Type := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_ORGANIZATIONS_BI_10)
-- Last update 19.10.2006
-- - - - - - - - - - - - -

  if (new$FacialAcc is not null) then
    select count(id) into cnt$ from Organizations where (FacialAcc = new$FacialAcc) AND (ROWNUM = 1);
    if (cnt$ <> 0) then RaiseException('ex_DublicateFacialAcc'); end if;
  end if;

-- - - - - - - - - - - - -
-- BI_200 (TR_ORGANIZATIONS_BI_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;

    /*  При вставке КВСР берем из распорядителя, если он уже не заполнен*/
    if (new$KVSR = 0) then
      select o.KVSR into new$KVSR
      from Organizations o
      where o.id = new$GeneralOrg_Ref;
    end if;
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORGANIZATIONS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORGANIZATIONS (
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS,
    OGRN,
    REJECT_CLS,
    REJECTCAUSE,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE,
    REMOTEPBSCODE,
    REMOTENOTPBSCODE,
    USECHECK_CARD
  ) VALUES (
    new$ID,
    new$NAME,
    new$GOSNI,
    new$CITY,
    new$COUNTRY,
    new$PHONE,
    new$ADDRESS,
    new$ORG_CLS,
    new$INN20,
    new$SUBINN,
    new$FACIALACC,
    new$REGIONCLS,
    new$DIRNAME,
    new$BUGNAME,
    new$DIRPHONE,
    new$BUGPHONE,
    new$RCORG,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$INN,
    new$OKATO,
    new$EMAIL,
    new$WEBSITE,
    new$UFKCODE,
    new$ADDOKATO,
    new$SHORTNAME,
    new$RVERSION,
    new$SENDERID,
    new$KVSR,
    new$OKFS,
    new$OKOPF,
    new$OPENDATE,
    new$CLOSEDATE,
    new$CHANGEDATE,
    new$GENERALORG_REF,
    new$FEDERALREGIONCODE,
    new$ORG_TYPE,
    new$BUDGETREF,
    new$SUPPLIERSTATUS,
    new$COUNTRYCODE,
    new$DATECLOSE,
    new$ORGCODE,
    new$COSTAUTHORITY,
    new$INCOMEAUTHORITY,
    new$DEBTAUTHORITY,
    new$SVRAUTHORITY,
    new$CLIENTID,
    new$DATEOPEN,
    new$FUID,
    new$OKPO,
    new$OKTMO,
    new$DOCSTATEREF,
    new$CRYPTOSTATUS,
    new$OGRN,
    new$REJECT_CLS,
    new$REJECTCAUSE,
    new$EXTID,
    new$EXTOWNER,
    new$EXTSYNCDATE,
    new$REMOTEPBSCODE,
    new$REMOTENOTPBSCODE,
    new$USECHECK_CARD);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORGANIZATIONS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 27) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_IU
  INSTEAD OF UPDATE
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$EXTID ORGANIZATIONS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORGANIZATIONS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORGANIZATIONS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
  new$REMOTEPBSCODE ORGANIZATIONS.REMOTEPBSCODE%TYPE := :NEW.REMOTEPBSCODE;
  new$REMOTENOTPBSCODE ORGANIZATIONS.REMOTENOTPBSCODE%TYPE := :NEW.REMOTENOTPBSCODE;
  new$USECHECK_CARD ORGANIZATIONS.USECHECK_CARD%TYPE := :NEW.USECHECK_CARD;
--
  CNT$ NUMBER(10);
  c$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_organizations_bu)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$gosni is null) then 
    new$gosni := 0;
  END IF;
  if (new$city is null) then 
    getvarcharconst(-1,7,new$city);
  END IF;
  if (new$country is null) then 
    new$country := 'Россия';
  END IF;
  if (new$countrycode is null) then 
    new$countrycode := 643;
  END IF;
  if (new$org_cls is null) then 
    new$org_cls:= 0;
  END IF;
  if (new$inn20 is null) then 
    new$inn20:= '';
  END IF;
  if (new$rcorg is null) then 
    new$rcorg := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$okato is null) then 
    new$okato := 0;
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$okfs is null) then 
    new$okfs := 0;
  END IF;
  if (new$okopf is null) then 
    new$okopf := 0;
  END IF;
  if (new$federalregioncode is null) then
    getintconst(-1, 27,new$federalregioncode);
  END IF;
  if (new$federalregioncode is null) then
    new$federalregioncode := 0;
  END IF;
  if (new$budgetref is null) then 
    new$budgetref := 0;
  END IF;
  if (new$org_type is null) then 
    new$org_type := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;

  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null))) then 
    if ((new$inn > 9999999999.9) and (new$inn20 <> '')) then
      RaiseException('ex_wrongkpp');  
    END IF;
  END IF;
  if ( ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null)))
  or ( (new$inn20 <> :old.inn20) or ((:old.inn20 is null) and (new$inn20 is not null))) )
  then
    check_unique_organization(new$inn,  new$inn20);
  END IF;
   
  if (new$regioncls <> :old.regioncls) then
    update dfaccountsbuhtable set
    regioncls = new$regioncls
    where id = any (select id from org_accounts where org_ref = new$id);
  END IF;
  /* Запрет изменений в неуказанной организации */
  if (:old.id = 0) then
    RaiseException('ex_cantmodifyunknownorg');
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if ((new$org_type<>:old.org_type) or (new$costauthority<>:old.costauthority))
  then 
    c$ := new$costauthority;
    if (new$org_type between 10100 and 10299) then
      new$costauthority:= 1;
    END IF;
    if (new$org_type between 10300 and 10399) then
      new$costauthority:= 2;
    END IF;
    if (new$org_type between 10400 and 10499) then
      new$costauthority:= 4;
    END IF;
    if (((new$org_type between 10500 and 10599) and (new$costauthority<>16)) or
    (((new$org_type between 10000 and 10099) or (new$org_type between 10600 and 10799))
    and (new$costauthority=0))) then
      new$costauthority:= 8;
    END IF;
    if ((new$org_type=:old.org_type) and (c$<>new$costauthority)) then
      RaiseException('ex_wrongcostauthority');  
    END IF;
  END IF;
  /* если изменилось значение RegionCls у организации, то меняем
      и у подведомственных лс*/
  if (new$regioncls <> :old.regioncls) then
    update facialacc_cls fac set
    fac.regioncls = new$regioncls
    where
    new$id = fac.org_ref;
      
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_ORGANIZATIONS_BU_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$FacialAcc <> :old.FacialAcc) then
    select count(id) into CNT$ from Organizations
      where (FacialAcc = new$FacialAcc) and (id <> new$id) AND (ROWNUM = 1);
    if (CNT$ <> 0) then
      RaiseException('ex_DublicateFacialAcc');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORGANIZATIONS_BU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- COMMENT сноска в детали даты закрытия


    /*  закрытие организации */
    if ((new$DateClose is not null) and (:old.DateClose is null)) then
      /*  закрываем счета флажком и указываем причину закрытия */
      update Org_Accounts set
        CloseCode = CloseCode + 10
      where Org_Ref = new$Id;
    end if;

    /*  Для л/с надо еще учитывать изменение даты */
    if (((new$DateClose is not null) and (:old.DateClose is null)) or (new$DateClose <> :old.DateClose)) then
      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode + 10
      where Org_ref = new$Id;
    end if;

    /*  открытие организации */
    if ((new$DateClose is null) and (:old.DateClose is not null)) then
      update Org_Accounts set
        CloseCode = CloseCode - 10
      where Org_Ref = new$Id;

      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode - 10
      where Org_ref = new$Id;
    end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_ORGANIZATIONS_BU_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;
  end if;

  if (new$GeneralOrg_Ref <> :old.GeneralOrg_Ref) then
    update FacialAcc_CLS set
      GeneralOrg_Ref = new$GeneralOrg_Ref
    where
      Org_Ref = new$id;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_ORGANIZATIONS_BU_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$DOCSTATEREF <> :old.DOCSTATEREF) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(new$id, :old.DOCSTATEREF, new$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORGANIZATIONS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  IF (new$RVersion IS NULL) THEN
    new$RVersion := 1;
  ELSIF ( (new$RVersion = -1) AND (:OLD.RVersion <> -1) ) THEN
    new$RVersion := :OLD.RVersion;
  ELSE
    new$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORGANIZATIONS SET
    ID = new$ID,
    NAME = new$NAME,
    GOSNI = new$GOSNI,
    CITY = new$CITY,
    COUNTRY = new$COUNTRY,
    PHONE = new$PHONE,
    ADDRESS = new$ADDRESS,
    ORG_CLS = new$ORG_CLS,
    INN20 = new$INN20,
    SUBINN = new$SUBINN,
    FACIALACC = new$FACIALACC,
    REGIONCLS = new$REGIONCLS,
    DIRNAME = new$DIRNAME,
    BUGNAME = new$BUGNAME,
    DIRPHONE = new$DIRPHONE,
    BUGPHONE = new$BUGPHONE,
    RCORG = new$RCORG,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    INN = new$INN,
    OKATO = new$OKATO,
    EMAIL = new$EMAIL,
    WEBSITE = new$WEBSITE,
    UFKCODE = new$UFKCODE,
    ADDOKATO = new$ADDOKATO,
    SHORTNAME = new$SHORTNAME,
    RVERSION = new$RVERSION,
    SENDERID = new$SENDERID,
    KVSR = new$KVSR,
    OKFS = new$OKFS,
    OKOPF = new$OKOPF,
    OPENDATE = new$OPENDATE,
    CLOSEDATE = new$CLOSEDATE,
    CHANGEDATE = new$CHANGEDATE,
    GENERALORG_REF = new$GENERALORG_REF,
    FEDERALREGIONCODE = new$FEDERALREGIONCODE,
    ORG_TYPE = new$ORG_TYPE,
    BUDGETREF = new$BUDGETREF,
    SUPPLIERSTATUS = new$SUPPLIERSTATUS,
    COUNTRYCODE = new$COUNTRYCODE,
    DATECLOSE = new$DATECLOSE,
    ORGCODE = new$ORGCODE,
    COSTAUTHORITY = new$COSTAUTHORITY,
    INCOMEAUTHORITY = new$INCOMEAUTHORITY,
    DEBTAUTHORITY = new$DEBTAUTHORITY,
    SVRAUTHORITY = new$SVRAUTHORITY,
    CLIENTID = new$CLIENTID,
    DATEOPEN = new$DATEOPEN,
    FUID = new$FUID,
    OKPO = new$OKPO,
    OKTMO = new$OKTMO,
    DOCSTATEREF = new$DOCSTATEREF,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    OGRN = new$OGRN,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    EXTID = new$EXTID,
    EXTOWNER = new$EXTOWNER,
    EXTSYNCDATE = new$EXTSYNCDATE,
    REMOTEPBSCODE = new$REMOTEPBSCODE,
    REMOTENOTPBSCODE = new$REMOTENOTPBSCODE,
    USECHECK_CARD = new$USECHECK_CARD
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_100 (TR_ORGANIZATIONS_AU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- Comment Триггер обработки открытия/закрытия организации


  /*  Закрытие организации */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
    update Banks set DateClose = new$DateClose where (id = new$ID) and (DateClose is null);
  end if;

  /*  открытие организации */
  if ((new$DateClose is null) and (:old.DateClose is not null)) then
    update Banks set DateClose = null where (id = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_200 (TR_ORGANIZATIONS_AU_200)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$BudgetRef <> :old.BudgetRef) then
    update FacialAcc_CLS set
    BudgetRef = new$BudgetRef
    where
    (ORG_REF = new$id)and((BudgetRef = :old.BudgetRef)or(BudgetRef<>0));
  END IF;
  /* Сносим организацию в проставленный КВСР, только если это ГРБС*/
  if ((new$KVSR <> :old.KVSR)and(new$Org_Type >= 10100)and(new$Org_Type <= 10299)) then
    update KVSR set
    Org_Ref = new$id
    where
    id = new$KVSR;
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update FacialAcc_CLS set
    KVSR = new$KVSR
    where
    (ORG_REF = new$id) and (KVSR = :old.KVSR);
  END IF;
  if (new$BudgetRef <> :old.BudgetRef) then
    update organizations set
    BudgetRef = new$BudgetRef
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update organizations set
    KVSR = new$KVSR
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORGANIZATIONS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (27, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=27) and (RecordId=new$ID);
  end if;

END;
/
commit work
/
-- ALTER TRIGGER tr_organizations_bi
CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_II
  INSTEAD OF INSERT
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$EXTID ORGANIZATIONS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORGANIZATIONS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORGANIZATIONS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
  new$REMOTEPBSCODE ORGANIZATIONS.REMOTEPBSCODE%TYPE := :NEW.REMOTEPBSCODE;
  new$REMOTENOTPBSCODE ORGANIZATIONS.REMOTENOTPBSCODE%TYPE := :NEW.REMOTENOTPBSCODE;
  new$USECHECK_CARD ORGANIZATIONS.USECHECK_CARD%TYPE := :NEW.USECHECK_CARD;
--
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_Organizations_bi)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$FUID is null) then 
    new$FUID := new$id;
  END IF;
  if (new$GOSNI is null) then 
    new$GOSNI := 0;
  END IF;
  if (new$Name is null) then 
    new$Name := 'Не указано наименование';
  END IF;
  if (new$City is null) then 
    GetVarcharConst(-1,7,new$City);
  END IF;
  if (new$COUNTRY is null) then 
    new$COUNTRY := 'Россия';
  END IF;
  if (new$CountryCode is null) then 
    new$CountryCode := 643;
  END IF;
  if (new$ORG_CLS is NULL) then 
    new$ORG_CLS:= 0;
  END IF;
  if (new$SubINN is null) then 
    new$SubINN:= 0;
  END IF;
  if (new$INN20 is null) then 
    new$INN20:= '';
  END IF;
  if (new$RCOrg is null) then 
    new$RCOrg := 0;
  END IF;
  if (new$RegionCls is null) then 
    new$RegionCls := 0;
  END IF;
  if (new$OKATO is null) then 
    new$OKATO := 0;
  END IF;
  if (new$KVSR is null) then 
    new$KVSR := 0;
  END IF;
  if (new$OKFS is null) then 
    new$OKFS := 0;
  END IF;
  if (new$OKOPF is null) then 
    new$OKOPF := 0;
  END IF;
  if (new$FederalRegionCode is null) then
    GetIntConst(-1, 27,new$FederalRegionCode);
  END IF;
  if (new$FederalRegionCode is null) then
    new$FederalRegionCode := 0;
  END IF;
  if (new$BudgetRef is null) then 
    new$BudgetRef := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;
  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$INN > 9999999999.9) and (new$INN20 <> '') and (new$INN20 is not null)) then
    RaiseException('EX_WRONGKPP');
  END IF;
  check_unique_organization(new$inn,  new$inn20);
  if (new$CostAuthority is null) then 
    new$CostAuthority:= 0;
  END IF;
  if (new$IncomeAuthority is null) then 
    new$IncomeAuthority := 0;
  END IF;
  if (new$DebtAuthority is null) then 
    new$DebtAuthority := 0;
  END IF;
  if (new$SVRAuthority is null) then 
    new$SVRAuthority := 0;
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if (new$Org_Type is not null)
  then 
    if (new$Org_Type between 10100 and 10299) then
      new$CostAuthority:= 1;
    END IF;
    if (new$Org_Type between 10300 and 10399) then
      new$CostAuthority:= 2;
    END IF;
    if (new$Org_Type between 10400 and 10499) then
      new$CostAuthority:= 4;
    END IF;
    if (((new$Org_Type between 10500 and 10599) and (new$CostAuthority<>16)) or
    (((new$Org_Type between 10000 and 10099) or (new$Org_Type between 10600 and 10799))
    and (new$CostAuthority=0))) then
      new$CostAuthority:= 8;
        
    END IF;
  else 
    new$Org_Type := 0;
  END IF;
  if (new$UseCheck_Card is null) then 
    new$UseCheck_Card := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_10 (TR_ORGANIZATIONS_BI_10)
-- Last update 19.10.2006
-- - - - - - - - - - - - -

  if (new$FacialAcc is not null) then
    select count(id) into cnt$ from Organizations where (FacialAcc = new$FacialAcc) AND (ROWNUM = 1);
    if (cnt$ <> 0) then RaiseException('ex_DublicateFacialAcc'); end if;
  end if;

-- - - - - - - - - - - - -
-- BI_200 (TR_ORGANIZATIONS_BI_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;

    /*  При вставке КВСР берем из распорядителя, если он уже не заполнен*/
    if (new$KVSR = 0) then
      select o.KVSR into new$KVSR
      from Organizations o
      where o.id = new$GeneralOrg_Ref;
    end if;
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_ORGANIZATIONS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_ORGANIZATIONS (
    ID,
    NAME,
    GOSNI,
    CITY,
    COUNTRY,
    PHONE,
    ADDRESS,
    ORG_CLS,
    INN20,
    SUBINN,
    FACIALACC,
    REGIONCLS,
    DIRNAME,
    BUGNAME,
    DIRPHONE,
    BUGPHONE,
    RCORG,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    INN,
    OKATO,
    EMAIL,
    WEBSITE,
    UFKCODE,
    ADDOKATO,
    SHORTNAME,
    RVERSION,
    SENDERID,
    KVSR,
    OKFS,
    OKOPF,
    OPENDATE,
    CLOSEDATE,
    CHANGEDATE,
    GENERALORG_REF,
    FEDERALREGIONCODE,
    ORG_TYPE,
    BUDGETREF,
    SUPPLIERSTATUS,
    COUNTRYCODE,
    DATECLOSE,
    ORGCODE,
    COSTAUTHORITY,
    INCOMEAUTHORITY,
    DEBTAUTHORITY,
    SVRAUTHORITY,
    CLIENTID,
    DATEOPEN,
    FUID,
    OKPO,
    OKTMO,
    DOCSTATEREF,
    CRYPTOSTATUS,
    OGRN,
    REJECT_CLS,
    REJECTCAUSE,
    EXTID,
    EXTOWNER,
    EXTSYNCDATE,
    REMOTEPBSCODE,
    REMOTENOTPBSCODE,
    USECHECK_CARD
  ) VALUES (
    new$ID,
    new$NAME,
    new$GOSNI,
    new$CITY,
    new$COUNTRY,
    new$PHONE,
    new$ADDRESS,
    new$ORG_CLS,
    new$INN20,
    new$SUBINN,
    new$FACIALACC,
    new$REGIONCLS,
    new$DIRNAME,
    new$BUGNAME,
    new$DIRPHONE,
    new$BUGPHONE,
    new$RCORG,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$INN,
    new$OKATO,
    new$EMAIL,
    new$WEBSITE,
    new$UFKCODE,
    new$ADDOKATO,
    new$SHORTNAME,
    new$RVERSION,
    new$SENDERID,
    new$KVSR,
    new$OKFS,
    new$OKOPF,
    new$OPENDATE,
    new$CLOSEDATE,
    new$CHANGEDATE,
    new$GENERALORG_REF,
    new$FEDERALREGIONCODE,
    new$ORG_TYPE,
    new$BUDGETREF,
    new$SUPPLIERSTATUS,
    new$COUNTRYCODE,
    new$DATECLOSE,
    new$ORGCODE,
    new$COSTAUTHORITY,
    new$INCOMEAUTHORITY,
    new$DEBTAUTHORITY,
    new$SVRAUTHORITY,
    new$CLIENTID,
    new$DATEOPEN,
    new$FUID,
    new$OKPO,
    new$OKTMO,
    new$DOCSTATEREF,
    new$CRYPTOSTATUS,
    new$OGRN,
    new$REJECT_CLS,
    new$REJECTCAUSE,
    new$EXTID,
    new$EXTOWNER,
    new$EXTSYNCDATE,
    new$REMOTEPBSCODE,
    new$REMOTENOTPBSCODE,
    new$USECHECK_CARD);

-- - - - - - - - - - - - -
-- AI_500 (TR_ORGANIZATIONS_AI_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 27) and (RecordID = new$ID);

END;
/
-- ALTER TRIGGER tr_organizations_bu
CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_IU
  INSTEAD OF UPDATE
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$EXTID ORGANIZATIONS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORGANIZATIONS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORGANIZATIONS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
  new$REMOTEPBSCODE ORGANIZATIONS.REMOTEPBSCODE%TYPE := :NEW.REMOTEPBSCODE;
  new$REMOTENOTPBSCODE ORGANIZATIONS.REMOTENOTPBSCODE%TYPE := :NEW.REMOTENOTPBSCODE;
  new$USECHECK_CARD ORGANIZATIONS.USECHECK_CARD%TYPE := :NEW.USECHECK_CARD;
--
  CNT$ NUMBER(10);
  c1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_organizations_bu)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$gosni is null) then 
    new$gosni := 0;
  END IF;
  if (new$city is null) then 
    getvarcharconst(-1,7,new$city);
  END IF;
  if (new$country is null) then 
    new$country := 'Россия';
  END IF;
  if (new$countrycode is null) then 
    new$countrycode := 643;
  END IF;
  if (new$org_cls is null) then 
    new$org_cls:= 0;
  END IF;
  if (new$inn20 is null) then 
    new$inn20:= '';
  END IF;
  if (new$rcorg is null) then 
    new$rcorg := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$okato is null) then 
    new$okato := 0;
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$okfs is null) then 
    new$okfs := 0;
  END IF;
  if (new$okopf is null) then 
    new$okopf := 0;
  END IF;
  if (new$federalregioncode is null) then
    getintconst(-1, 27,new$federalregioncode);
  END IF;
  if (new$federalregioncode is null) then
    new$federalregioncode := 0;
  END IF;
  if (new$budgetref is null) then 
    new$budgetref := 0;
  END IF;
  if (new$org_type is null) then 
    new$org_type := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;

  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null))) then 
    if ((new$inn > 9999999999.9) and (new$inn20 <> '')) then
      RaiseException('ex_wrongkpp');  
    END IF;
  END IF;
  if ( ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null)))
  or ( (new$inn20 <> :old.inn20) or ((:old.inn20 is null) and (new$inn20 is not null))) )
  then
    check_unique_organization(new$inn,  new$inn20);
  END IF;
   
  if (new$regioncls <> :old.regioncls) then
    update dfaccountsbuhtable set
    regioncls = new$regioncls
    where id = any (select id from org_accounts where org_ref = new$id);
  END IF;
  /* Запрет изменений в неуказанной организации */
  if (:old.id = 0) then
    RaiseException('ex_cantmodifyunknownorg');
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if ((new$org_type<>:old.org_type) or (new$costauthority<>:old.costauthority))
  then 
    c1$ := new$costauthority;
    if (new$org_type between 10100 and 10299) then
      new$costauthority:= 1;
    END IF;
    if (new$org_type between 10300 and 10399) then
      new$costauthority:= 2;
    END IF;
    if (new$org_type between 10400 and 10499) then
      new$costauthority:= 4;
    END IF;
    if (((new$org_type between 10500 and 10599) and (new$costauthority<>16)) or
    (((new$org_type between 10000 and 10099) or (new$org_type between 10600 and 10799))
    and (new$costauthority=0))) then
      new$costauthority:= 8;
    END IF;
    if ((new$org_type=:old.org_type) and (c1$<>new$costauthority)) then
      RaiseException('ex_wrongcostauthority');  
    END IF;
  END IF;
  /* если изменилось значение RegionCls у организации, то меняем
      и у подведомственных лс*/
  if (new$regioncls <> :old.regioncls) then
    update facialacc_cls fac set
    fac.regioncls = new$regioncls
    where
    new$id = fac.org_ref;
      
  END IF;
  if (new$UseCheck_Card is null) then 
    new$UseCheck_Card := 0;
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_ORGANIZATIONS_BU_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$FacialAcc <> :old.FacialAcc) then
    select count(id) into CNT$ from Organizations
      where (FacialAcc = new$FacialAcc) and (id <> new$id) AND (ROWNUM = 1);
    if (CNT$ <> 0) then
      RaiseException('ex_DublicateFacialAcc');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORGANIZATIONS_BU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- COMMENT сноска в детали даты закрытия


    /*  закрытие организации */
    if ((new$DateClose is not null) and (:old.DateClose is null)) then
      /*  закрываем счета флажком и указываем причину закрытия */
      update Org_Accounts set
        CloseCode = CloseCode + 10
      where Org_Ref = new$Id;
    end if;

    /*  Для л/с надо еще учитывать изменение даты */
    if (((new$DateClose is not null) and (:old.DateClose is null)) or (new$DateClose <> :old.DateClose)) then
      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode + 10
      where Org_ref = new$Id;
    end if;

    /*  открытие организации */
    if ((new$DateClose is null) and (:old.DateClose is not null)) then
      update Org_Accounts set
        CloseCode = CloseCode - 10
      where Org_Ref = new$Id;

      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode - 10
      where Org_ref = new$Id;
    end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_ORGANIZATIONS_BU_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;
  end if;

  if (new$GeneralOrg_Ref <> :old.GeneralOrg_Ref) then
    update FacialAcc_CLS set
      GeneralOrg_Ref = new$GeneralOrg_Ref
    where
      Org_Ref = new$id;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_ORGANIZATIONS_BU_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$DOCSTATEREF <> :old.DOCSTATEREF) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(new$id, :old.DOCSTATEREF, new$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORGANIZATIONS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  IF (new$RVersion IS NULL) THEN
    new$RVersion := 1;
  ELSIF ( (new$RVersion = -1) AND (:OLD.RVersion <> -1) ) THEN
    new$RVersion := :OLD.RVersion;
  ELSE
    new$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORGANIZATIONS SET
    ID = new$ID,
    NAME = new$NAME,
    GOSNI = new$GOSNI,
    CITY = new$CITY,
    COUNTRY = new$COUNTRY,
    PHONE = new$PHONE,
    ADDRESS = new$ADDRESS,
    ORG_CLS = new$ORG_CLS,
    INN20 = new$INN20,
    SUBINN = new$SUBINN,
    FACIALACC = new$FACIALACC,
    REGIONCLS = new$REGIONCLS,
    DIRNAME = new$DIRNAME,
    BUGNAME = new$BUGNAME,
    DIRPHONE = new$DIRPHONE,
    BUGPHONE = new$BUGPHONE,
    RCORG = new$RCORG,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    INN = new$INN,
    OKATO = new$OKATO,
    EMAIL = new$EMAIL,
    WEBSITE = new$WEBSITE,
    UFKCODE = new$UFKCODE,
    ADDOKATO = new$ADDOKATO,
    SHORTNAME = new$SHORTNAME,
    RVERSION = new$RVERSION,
    SENDERID = new$SENDERID,
    KVSR = new$KVSR,
    OKFS = new$OKFS,
    OKOPF = new$OKOPF,
    OPENDATE = new$OPENDATE,
    CLOSEDATE = new$CLOSEDATE,
    CHANGEDATE = new$CHANGEDATE,
    GENERALORG_REF = new$GENERALORG_REF,
    FEDERALREGIONCODE = new$FEDERALREGIONCODE,
    ORG_TYPE = new$ORG_TYPE,
    BUDGETREF = new$BUDGETREF,
    SUPPLIERSTATUS = new$SUPPLIERSTATUS,
    COUNTRYCODE = new$COUNTRYCODE,
    DATECLOSE = new$DATECLOSE,
    ORGCODE = new$ORGCODE,
    COSTAUTHORITY = new$COSTAUTHORITY,
    INCOMEAUTHORITY = new$INCOMEAUTHORITY,
    DEBTAUTHORITY = new$DEBTAUTHORITY,
    SVRAUTHORITY = new$SVRAUTHORITY,
    CLIENTID = new$CLIENTID,
    DATEOPEN = new$DATEOPEN,
    FUID = new$FUID,
    OKPO = new$OKPO,
    OKTMO = new$OKTMO,
    DOCSTATEREF = new$DOCSTATEREF,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    OGRN = new$OGRN,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    EXTID = new$EXTID,
    EXTOWNER = new$EXTOWNER,
    EXTSYNCDATE = new$EXTSYNCDATE,
    REMOTEPBSCODE = new$REMOTEPBSCODE,
    REMOTENOTPBSCODE = new$REMOTENOTPBSCODE,
    USECHECK_CARD = new$USECHECK_CARD
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_100 (TR_ORGANIZATIONS_AU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- Comment Триггер обработки открытия/закрытия организации


  /*  Закрытие организации */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
    update Banks set DateClose = new$DateClose where (id = new$ID) and (DateClose is null);
  end if;

  /*  открытие организации */
  if ((new$DateClose is null) and (:old.DateClose is not null)) then
    update Banks set DateClose = null where (id = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_200 (TR_ORGANIZATIONS_AU_200)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$BudgetRef <> :old.BudgetRef) then
    update FacialAcc_CLS set
    BudgetRef = new$BudgetRef
    where
    (ORG_REF = new$id)and((BudgetRef = :old.BudgetRef)or(BudgetRef<>0));
  END IF;
  /* Сносим организацию в проставленный КВСР, только если это ГРБС*/
  if ((new$KVSR <> :old.KVSR)and(new$Org_Type >= 10100)and(new$Org_Type <= 10299)) then
    update KVSR set
    Org_Ref = new$id
    where
    id = new$KVSR;
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update FacialAcc_CLS set
    KVSR = new$KVSR
    where
    (ORG_REF = new$id) and (KVSR = :old.KVSR);
  END IF;
  if (new$BudgetRef <> :old.BudgetRef) then
    update organizations set
    BudgetRef = new$BudgetRef
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update organizations set
    KVSR = new$KVSR
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORGANIZATIONS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (27, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=27) and (RecordId=new$ID);
  end if;

END;
/
ALTER TRIGGER TR_ORGANIZATIONS_BU_500 DISABLE
/
-- ALTER TRIGGER TR_ORGANIZATIONS_BU
CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_IU
  INSTEAD OF UPDATE
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$EXTID ORGANIZATIONS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORGANIZATIONS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORGANIZATIONS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
  new$REMOTEPBSCODE ORGANIZATIONS.REMOTEPBSCODE%TYPE := :NEW.REMOTEPBSCODE;
  new$REMOTENOTPBSCODE ORGANIZATIONS.REMOTENOTPBSCODE%TYPE := :NEW.REMOTENOTPBSCODE;
  new$USECHECK_CARD ORGANIZATIONS.USECHECK_CARD%TYPE := :NEW.USECHECK_CARD;
--
  CNT$ NUMBER(10);
  c1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_organizations_bu)
-- Version 10.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   if (new$gosni is null) then 
--     new$gosni := 0;
--   END IF;
--   if (new$city is null) then 
--     getvarcharconst(-1,7,new$city);
--   END IF;
--   if (new$country is null) then 
--     new$country := 'Россия';
--   END IF;
--   if (new$countrycode is null) then 
--     new$countrycode := 643;
--   END IF;
--   if (new$org_cls is null) then 
--     new$org_cls:= 0;
--   END IF;
--   if (new$inn20 is null) then 
--     new$inn20:= '';
--   END IF;
--   if (new$rcorg is null) then 
--     new$rcorg := 0;
--   END IF;
--   if (new$regioncls is null) then 
--     new$regioncls := 0;
--   END IF;
--   if (new$okato is null) then 
--     new$okato := 0;
--   END IF;
--   if (new$kvsr is null) then 
--     new$kvsr := 0;
--   END IF;
--   if (new$okfs is null) then 
--     new$okfs := 0;
--   END IF;
--   if (new$okopf is null) then 
--     new$okopf := 0;
--   END IF;
--   if (new$federalregioncode is null) then
--     getintconst(-1, 27,new$federalregioncode);
--   END IF;
--   if (new$federalregioncode is null) then
--     new$federalregioncode := 0;
--   END IF;
--   if (new$budgetref is null) then 
--     new$budgetref := 0;
--   END IF;
--   if (new$org_type is null) then 
--     new$org_type := 0;
--   END IF;
--   /* для не бюджетных организаций заполняем распорядителя самой организацией*/
--   if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
--     new$generalorg_ref := new$id;
--   END IF;
-- 
--   /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
--   if ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null))) then 
--     if ((new$inn > 9999999999.9) and (new$inn20 <> '')) then
--       RaiseException('ex_wrongkpp');  
--     END IF;
--   END IF;
--   if ( ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null)))
--   or ( (new$inn20 <> :old.inn20) or ((:old.inn20 is null) and (new$inn20 is not null))) )
--   then
--     check_unique_organization(new$inn,  new$inn20);
--   END IF;
--    
--   if (new$regioncls <> :old.regioncls) then
--     update dfaccountsbuhtable set
--     regioncls = new$regioncls
--     where id = any (select id from org_accounts where org_ref = new$id);
--   END IF;
--   /* Запрет изменений в неуказанной организации */
--   if (:old.id = 0) then
--     RaiseException('ex_cantmodifyunknownorg');
--   END IF;
--   /* Синхронизация вида организации и полномочий по расходам */
--   if ((new$org_type<>:old.org_type) or (new$costauthority<>:old.costauthority))
--   then 
--     c1$ := new$costauthority;
--     if (new$org_type between 10100 and 10299) then
--       new$costauthority:= 1;
--     END IF;
--     if (new$org_type between 10300 and 10399) then
--       new$costauthority:= 2;
--     END IF;
--     if (new$org_type between 10400 and 10499) then
--       new$costauthority:= 4;
--     END IF;
--     if (((new$org_type between 10500 and 10599) and (new$costauthority<>16)) or
--     (((new$org_type between 10000 and 10099) or (new$org_type between 10600 and 10799))
--     and (new$costauthority=0))) then
--       new$costauthority:= 8;
--     END IF;
--     if ((new$org_type=:old.org_type) and (c1$<>new$costauthority)) then
--       RaiseException('ex_wrongcostauthority');  
--     END IF;
--   END IF;
--   /* если изменилось значение RegionCls у организации, то меняем
--       и у подведомственных лс*/
--   if (new$regioncls <> :old.regioncls) then
--     update facialacc_cls fac set
--     fac.regioncls = new$regioncls
--     where
--     new$id = fac.org_ref;
--       
--   END IF;
--   if (new$UseCheck_Card is null) then 
--     new$UseCheck_Card := 0;
--   END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_ORGANIZATIONS_BU_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$FacialAcc <> :old.FacialAcc) then
    select count(id) into CNT$ from Organizations
      where (FacialAcc = new$FacialAcc) and (id <> new$id) AND (ROWNUM = 1);
    if (CNT$ <> 0) then
      RaiseException('ex_DublicateFacialAcc');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORGANIZATIONS_BU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- COMMENT сноска в детали даты закрытия


    /*  закрытие организации */
    if ((new$DateClose is not null) and (:old.DateClose is null)) then
      /*  закрываем счета флажком и указываем причину закрытия */
      update Org_Accounts set
        CloseCode = CloseCode + 10
      where Org_Ref = new$Id;
    end if;

    /*  Для л/с надо еще учитывать изменение даты */
    if (((new$DateClose is not null) and (:old.DateClose is null)) or (new$DateClose <> :old.DateClose)) then
      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode + 10
      where Org_ref = new$Id;
    end if;

    /*  открытие организации */
    if ((new$DateClose is null) and (:old.DateClose is not null)) then
      update Org_Accounts set
        CloseCode = CloseCode - 10
      where Org_Ref = new$Id;

      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode - 10
      where Org_ref = new$Id;
    end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_ORGANIZATIONS_BU_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;
  end if;

  if (new$GeneralOrg_Ref <> :old.GeneralOrg_Ref) then
    update FacialAcc_CLS set
      GeneralOrg_Ref = new$GeneralOrg_Ref
    where
      Org_Ref = new$id;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_ORGANIZATIONS_BU_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$DOCSTATEREF <> :old.DOCSTATEREF) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(new$id, :old.DOCSTATEREF, new$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORGANIZATIONS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  IF (new$RVersion IS NULL) THEN
    new$RVersion := 1;
  ELSIF ( (new$RVersion = -1) AND (:OLD.RVersion <> -1) ) THEN
    new$RVersion := :OLD.RVersion;
  ELSE
    new$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORGANIZATIONS SET
    ID = new$ID,
    NAME = new$NAME,
    GOSNI = new$GOSNI,
    CITY = new$CITY,
    COUNTRY = new$COUNTRY,
    PHONE = new$PHONE,
    ADDRESS = new$ADDRESS,
    ORG_CLS = new$ORG_CLS,
    INN20 = new$INN20,
    SUBINN = new$SUBINN,
    FACIALACC = new$FACIALACC,
    REGIONCLS = new$REGIONCLS,
    DIRNAME = new$DIRNAME,
    BUGNAME = new$BUGNAME,
    DIRPHONE = new$DIRPHONE,
    BUGPHONE = new$BUGPHONE,
    RCORG = new$RCORG,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    INN = new$INN,
    OKATO = new$OKATO,
    EMAIL = new$EMAIL,
    WEBSITE = new$WEBSITE,
    UFKCODE = new$UFKCODE,
    ADDOKATO = new$ADDOKATO,
    SHORTNAME = new$SHORTNAME,
    RVERSION = new$RVERSION,
    SENDERID = new$SENDERID,
    KVSR = new$KVSR,
    OKFS = new$OKFS,
    OKOPF = new$OKOPF,
    OPENDATE = new$OPENDATE,
    CLOSEDATE = new$CLOSEDATE,
    CHANGEDATE = new$CHANGEDATE,
    GENERALORG_REF = new$GENERALORG_REF,
    FEDERALREGIONCODE = new$FEDERALREGIONCODE,
    ORG_TYPE = new$ORG_TYPE,
    BUDGETREF = new$BUDGETREF,
    SUPPLIERSTATUS = new$SUPPLIERSTATUS,
    COUNTRYCODE = new$COUNTRYCODE,
    DATECLOSE = new$DATECLOSE,
    ORGCODE = new$ORGCODE,
    COSTAUTHORITY = new$COSTAUTHORITY,
    INCOMEAUTHORITY = new$INCOMEAUTHORITY,
    DEBTAUTHORITY = new$DEBTAUTHORITY,
    SVRAUTHORITY = new$SVRAUTHORITY,
    CLIENTID = new$CLIENTID,
    DATEOPEN = new$DATEOPEN,
    FUID = new$FUID,
    OKPO = new$OKPO,
    OKTMO = new$OKTMO,
    DOCSTATEREF = new$DOCSTATEREF,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    OGRN = new$OGRN,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    EXTID = new$EXTID,
    EXTOWNER = new$EXTOWNER,
    EXTSYNCDATE = new$EXTSYNCDATE,
    REMOTEPBSCODE = new$REMOTEPBSCODE,
    REMOTENOTPBSCODE = new$REMOTENOTPBSCODE,
    USECHECK_CARD = new$USECHECK_CARD
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_100 (TR_ORGANIZATIONS_AU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- Comment Триггер обработки открытия/закрытия организации


  /*  Закрытие организации */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
    update Banks set DateClose = new$DateClose where (id = new$ID) and (DateClose is null);
  end if;

  /*  открытие организации */
  if ((new$DateClose is null) and (:old.DateClose is not null)) then
    update Banks set DateClose = null where (id = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_200 (TR_ORGANIZATIONS_AU_200)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$BudgetRef <> :old.BudgetRef) then
    update FacialAcc_CLS set
    BudgetRef = new$BudgetRef
    where
    (ORG_REF = new$id)and((BudgetRef = :old.BudgetRef)or(BudgetRef<>0));
  END IF;
  /* Сносим организацию в проставленный КВСР, только если это ГРБС*/
  if ((new$KVSR <> :old.KVSR)and(new$Org_Type >= 10100)and(new$Org_Type <= 10299)) then
    update KVSR set
    Org_Ref = new$id
    where
    id = new$KVSR;
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update FacialAcc_CLS set
    KVSR = new$KVSR
    where
    (ORG_REF = new$id) and (KVSR = :old.KVSR);
  END IF;
  if (new$BudgetRef <> :old.BudgetRef) then
    update organizations set
    BudgetRef = new$BudgetRef
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update organizations set
    KVSR = new$KVSR
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORGANIZATIONS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (27, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=27) and (RecordId=new$ID);
  end if;

END;
/
update Organizations set
  UseCheck_Card = 0
/
ALTER TRIGGER TR_ORGANIZATIONS_BU_500 ENABLE
/
-- ALTER TRIGGER TR_ORGANIZATIONS_BU
CREATE OR REPLACE TRIGGER TR_ORGANIZATIONS_IU
  INSTEAD OF UPDATE
  ON ORGANIZATIONS
  FOR EACH ROW
DECLARE
  new$ID ORGANIZATIONS.ID%TYPE := :NEW.ID;
  new$NAME ORGANIZATIONS.NAME%TYPE := :NEW.NAME;
  new$GOSNI ORGANIZATIONS.GOSNI%TYPE := :NEW.GOSNI;
  new$CITY ORGANIZATIONS.CITY%TYPE := :NEW.CITY;
  new$COUNTRY ORGANIZATIONS.COUNTRY%TYPE := :NEW.COUNTRY;
  new$PHONE ORGANIZATIONS.PHONE%TYPE := :NEW.PHONE;
  new$ADDRESS ORGANIZATIONS.ADDRESS%TYPE := :NEW.ADDRESS;
  new$ORG_CLS ORGANIZATIONS.ORG_CLS%TYPE := :NEW.ORG_CLS;
  new$INN20 ORGANIZATIONS.INN20%TYPE := :NEW.INN20;
  new$SUBINN ORGANIZATIONS.SUBINN%TYPE := :NEW.SUBINN;
  new$FACIALACC ORGANIZATIONS.FACIALACC%TYPE := :NEW.FACIALACC;
  new$REGIONCLS ORGANIZATIONS.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$DIRNAME ORGANIZATIONS.DIRNAME%TYPE := :NEW.DIRNAME;
  new$BUGNAME ORGANIZATIONS.BUGNAME%TYPE := :NEW.BUGNAME;
  new$DIRPHONE ORGANIZATIONS.DIRPHONE%TYPE := :NEW.DIRPHONE;
  new$BUGPHONE ORGANIZATIONS.BUGPHONE%TYPE := :NEW.BUGPHONE;
  new$RCORG ORGANIZATIONS.RCORG%TYPE := :NEW.RCORG;
  new$CREATERUSER ORGANIZATIONS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE ORGANIZATIONS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE ORGANIZATIONS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER ORGANIZATIONS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$INN ORGANIZATIONS.INN%TYPE := :NEW.INN;
  new$OKATO ORGANIZATIONS.OKATO%TYPE := :NEW.OKATO;
  new$EMAIL ORGANIZATIONS.EMAIL%TYPE := :NEW.EMAIL;
  new$WEBSITE ORGANIZATIONS.WEBSITE%TYPE := :NEW.WEBSITE;
  new$UFKCODE ORGANIZATIONS.UFKCODE%TYPE := :NEW.UFKCODE;
  new$ADDOKATO ORGANIZATIONS.ADDOKATO%TYPE := :NEW.ADDOKATO;
  new$SHORTNAME ORGANIZATIONS.SHORTNAME%TYPE := :NEW.SHORTNAME;
  new$RVERSION ORGANIZATIONS.RVERSION%TYPE := :NEW.RVERSION;
  new$SENDERID ORGANIZATIONS.SENDERID%TYPE := :NEW.SENDERID;
  new$KVSR ORGANIZATIONS.KVSR%TYPE := :NEW.KVSR;
  new$OKFS ORGANIZATIONS.OKFS%TYPE := :NEW.OKFS;
  new$OKOPF ORGANIZATIONS.OKOPF%TYPE := :NEW.OKOPF;
  new$OPENDATE ORGANIZATIONS.OPENDATE%TYPE := :NEW.OPENDATE;
  new$CLOSEDATE ORGANIZATIONS.CLOSEDATE%TYPE := :NEW.CLOSEDATE;
  new$CHANGEDATE ORGANIZATIONS.CHANGEDATE%TYPE := :NEW.CHANGEDATE;
  new$GENERALORG_REF ORGANIZATIONS.GENERALORG_REF%TYPE := :NEW.GENERALORG_REF;
  new$FEDERALREGIONCODE ORGANIZATIONS.FEDERALREGIONCODE%TYPE := :NEW.FEDERALREGIONCODE;
  new$ORG_TYPE ORGANIZATIONS.ORG_TYPE%TYPE := :NEW.ORG_TYPE;
  new$BUDGETREF ORGANIZATIONS.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$SUPPLIERSTATUS ORGANIZATIONS.SUPPLIERSTATUS%TYPE := :NEW.SUPPLIERSTATUS;
  new$COUNTRYCODE ORGANIZATIONS.COUNTRYCODE%TYPE := :NEW.COUNTRYCODE;
  new$DATECLOSE ORGANIZATIONS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$ORGCODE ORGANIZATIONS.ORGCODE%TYPE := :NEW.ORGCODE;
  new$COSTAUTHORITY ORGANIZATIONS.COSTAUTHORITY%TYPE := :NEW.COSTAUTHORITY;
  new$INCOMEAUTHORITY ORGANIZATIONS.INCOMEAUTHORITY%TYPE := :NEW.INCOMEAUTHORITY;
  new$DEBTAUTHORITY ORGANIZATIONS.DEBTAUTHORITY%TYPE := :NEW.DEBTAUTHORITY;
  new$SVRAUTHORITY ORGANIZATIONS.SVRAUTHORITY%TYPE := :NEW.SVRAUTHORITY;
  new$CLIENTID ORGANIZATIONS.CLIENTID%TYPE := :NEW.CLIENTID;
  new$DATEOPEN ORGANIZATIONS.DATEOPEN%TYPE := :NEW.DATEOPEN;
  new$FUID ORGANIZATIONS.FUID%TYPE := :NEW.FUID;
  new$OKPO ORGANIZATIONS.OKPO%TYPE := :NEW.OKPO;
  new$OKTMO ORGANIZATIONS.OKTMO%TYPE := :NEW.OKTMO;
  new$DOCSTATEREF ORGANIZATIONS.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$CRYPTOSTATUS ORGANIZATIONS.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$OGRN ORGANIZATIONS.OGRN%TYPE := :NEW.OGRN;
  new$REJECT_CLS ORGANIZATIONS.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE ORGANIZATIONS.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$EXTID ORGANIZATIONS.EXTID%TYPE := :NEW.EXTID;
  new$EXTOWNER ORGANIZATIONS.EXTOWNER%TYPE := :NEW.EXTOWNER;
  new$EXTSYNCDATE ORGANIZATIONS.EXTSYNCDATE%TYPE := :NEW.EXTSYNCDATE;
  new$REMOTEPBSCODE ORGANIZATIONS.REMOTEPBSCODE%TYPE := :NEW.REMOTEPBSCODE;
  new$REMOTENOTPBSCODE ORGANIZATIONS.REMOTENOTPBSCODE%TYPE := :NEW.REMOTENOTPBSCODE;
  new$USECHECK_CARD ORGANIZATIONS.USECHECK_CARD%TYPE := :NEW.USECHECK_CARD;
--
  CNT$ NUMBER(10);
  c1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_organizations_bu)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$gosni is null) then 
    new$gosni := 0;
  END IF;
  if (new$city is null) then 
    getvarcharconst(-1,7,new$city);
  END IF;
  if (new$country is null) then 
    new$country := 'Россия';
  END IF;
  if (new$countrycode is null) then 
    new$countrycode := 643;
  END IF;
  if (new$org_cls is null) then 
    new$org_cls:= 0;
  END IF;
  if (new$inn20 is null) then 
    new$inn20:= '';
  END IF;
  if (new$rcorg is null) then 
    new$rcorg := 0;
  END IF;
  if (new$regioncls is null) then 
    new$regioncls := 0;
  END IF;
  if (new$okato is null) then 
    new$okato := 0;
  END IF;
  if (new$kvsr is null) then 
    new$kvsr := 0;
  END IF;
  if (new$okfs is null) then 
    new$okfs := 0;
  END IF;
  if (new$okopf is null) then 
    new$okopf := 0;
  END IF;
  if (new$federalregioncode is null) then
    getintconst(-1, 27,new$federalregioncode);
  END IF;
  if (new$federalregioncode is null) then
    new$federalregioncode := 0;
  END IF;
  if (new$budgetref is null) then 
    new$budgetref := 0;
  END IF;
  if (new$org_type is null) then 
    new$org_type := 0;
  END IF;
  /* для не бюджетных организаций заполняем распорядителя самой организацией*/
  if ((new$generalorg_ref is null) or (new$org_type < 10000) or (new$org_type >= 20000)) then
    new$generalorg_ref := new$id;
  END IF;

  /* если ИНН больше 10 разрядов, то КПП должен быть пустым */
  if ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null))) then 
    if ((new$inn > 9999999999.9) and (new$inn20 <> '')) then
      RaiseException('ex_wrongkpp');  
    END IF;
  END IF;
  if ( ((new$inn <> :old.inn) or ((:old.inn is null) and (new$inn is not null)))
  or ( (new$inn20 <> :old.inn20) or ((:old.inn20 is null) and (new$inn20 is not null))) )
  then
    check_unique_organization(new$inn,  new$inn20);
  END IF;
   
  if (new$regioncls <> :old.regioncls) then
    update dfaccountsbuhtable set
    regioncls = new$regioncls
    where id = any (select id from org_accounts where org_ref = new$id);
  END IF;
  /* Запрет изменений в неуказанной организации */
  if (:old.id = 0) then
    RaiseException('ex_cantmodifyunknownorg');
  END IF;
  /* Синхронизация вида организации и полномочий по расходам */
  if ((new$org_type<>:old.org_type) or (new$costauthority<>:old.costauthority))
  then 
    c1$ := new$costauthority;
    if (new$org_type between 10100 and 10299) then
      new$costauthority:= 1;
    END IF;
    if (new$org_type between 10300 and 10399) then
      new$costauthority:= 2;
    END IF;
    if (new$org_type between 10400 and 10499) then
      new$costauthority:= 4;
    END IF;
    if (((new$org_type between 10500 and 10599) and (new$costauthority<>16)) or
    (((new$org_type between 10000 and 10099) or (new$org_type between 10600 and 10799))
    and (new$costauthority=0))) then
      new$costauthority:= 8;
    END IF;
    if ((new$org_type=:old.org_type) and (c1$<>new$costauthority)) then
      RaiseException('ex_wrongcostauthority');  
    END IF;
  END IF;
  /* если изменилось значение RegionCls у организации, то меняем
      и у подведомственных лс*/
  if (new$regioncls <> :old.regioncls) then
    update facialacc_cls fac set
    fac.regioncls = new$regioncls
    where
    new$id = fac.org_ref;
      
  END IF;
  if (new$UseCheck_Card is null) then 
    new$UseCheck_Card := 0;
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_ORGANIZATIONS_BU_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$FacialAcc <> :old.FacialAcc) then
    select count(id) into CNT$ from Organizations
      where (FacialAcc = new$FacialAcc) and (id <> new$id) AND (ROWNUM = 1);
    if (CNT$ <> 0) then
      RaiseException('ex_DublicateFacialAcc');
    end if;
  end if;

-- - - - - - - - - - - - -
-- BU_100 (TR_ORGANIZATIONS_BU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- COMMENT сноска в детали даты закрытия


    /*  закрытие организации */
    if ((new$DateClose is not null) and (:old.DateClose is null)) then
      /*  закрываем счета флажком и указываем причину закрытия */
      update Org_Accounts set
        CloseCode = CloseCode + 10
      where Org_Ref = new$Id;
    end if;

    /*  Для л/с надо еще учитывать изменение даты */
    if (((new$DateClose is not null) and (:old.DateClose is null)) or (new$DateClose <> :old.DateClose)) then
      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode + 10
      where Org_ref = new$Id;
    end if;

    /*  открытие организации */
    if ((new$DateClose is null) and (:old.DateClose is not null)) then
      update Org_Accounts set
        CloseCode = CloseCode - 10
      where Org_Ref = new$Id;

      /*  сносим дату закрытия в л/с */
      update FacialAcc_Cls set
        DateClose = new$DateClose,
        CloseCode = CloseCode - 10
      where Org_ref = new$Id;
    end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_ORGANIZATIONS_BU_200)
-- Create 25.05.2007
-- - - - - - - - - - - - -

  if (new$id <> new$GeneralOrg_Ref) then
    select count(*) into cnt$
    from Organizations o where (o.id = new$GeneralOrg_Ref) AND (ROWNUM = 1);

    if cnt$ = 0 then
      RaiseException('ex_GeneralOrgNotFound');
    end if;
  end if;

  if (new$GeneralOrg_Ref <> :old.GeneralOrg_Ref) then
    update FacialAcc_CLS set
      GeneralOrg_Ref = new$GeneralOrg_Ref
    where
      Org_Ref = new$id;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_ORGANIZATIONS_BU_210)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$DOCSTATEREF <> :old.DOCSTATEREF) then
    insert into StateJumpHistory(DocID, BeginStateRef, EndStateRef)
    values(new$id, :old.DOCSTATEREF, new$DOCSTATEREF);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_ORGANIZATIONS_BU_700)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  IF (new$RVersion IS NULL) THEN
    new$RVersion := 1;
  ELSIF ( (new$RVersion = -1) AND (:OLD.RVersion <> -1) ) THEN
    new$RVersion := :OLD.RVersion;
  ELSE
    new$RVersion := :OLD.RVersion + 1;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_ORGANIZATIONS SET
    ID = new$ID,
    NAME = new$NAME,
    GOSNI = new$GOSNI,
    CITY = new$CITY,
    COUNTRY = new$COUNTRY,
    PHONE = new$PHONE,
    ADDRESS = new$ADDRESS,
    ORG_CLS = new$ORG_CLS,
    INN20 = new$INN20,
    SUBINN = new$SUBINN,
    FACIALACC = new$FACIALACC,
    REGIONCLS = new$REGIONCLS,
    DIRNAME = new$DIRNAME,
    BUGNAME = new$BUGNAME,
    DIRPHONE = new$DIRPHONE,
    BUGPHONE = new$BUGPHONE,
    RCORG = new$RCORG,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    INN = new$INN,
    OKATO = new$OKATO,
    EMAIL = new$EMAIL,
    WEBSITE = new$WEBSITE,
    UFKCODE = new$UFKCODE,
    ADDOKATO = new$ADDOKATO,
    SHORTNAME = new$SHORTNAME,
    RVERSION = new$RVERSION,
    SENDERID = new$SENDERID,
    KVSR = new$KVSR,
    OKFS = new$OKFS,
    OKOPF = new$OKOPF,
    OPENDATE = new$OPENDATE,
    CLOSEDATE = new$CLOSEDATE,
    CHANGEDATE = new$CHANGEDATE,
    GENERALORG_REF = new$GENERALORG_REF,
    FEDERALREGIONCODE = new$FEDERALREGIONCODE,
    ORG_TYPE = new$ORG_TYPE,
    BUDGETREF = new$BUDGETREF,
    SUPPLIERSTATUS = new$SUPPLIERSTATUS,
    COUNTRYCODE = new$COUNTRYCODE,
    DATECLOSE = new$DATECLOSE,
    ORGCODE = new$ORGCODE,
    COSTAUTHORITY = new$COSTAUTHORITY,
    INCOMEAUTHORITY = new$INCOMEAUTHORITY,
    DEBTAUTHORITY = new$DEBTAUTHORITY,
    SVRAUTHORITY = new$SVRAUTHORITY,
    CLIENTID = new$CLIENTID,
    DATEOPEN = new$DATEOPEN,
    FUID = new$FUID,
    OKPO = new$OKPO,
    OKTMO = new$OKTMO,
    DOCSTATEREF = new$DOCSTATEREF,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    OGRN = new$OGRN,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    EXTID = new$EXTID,
    EXTOWNER = new$EXTOWNER,
    EXTSYNCDATE = new$EXTSYNCDATE,
    REMOTEPBSCODE = new$REMOTEPBSCODE,
    REMOTENOTPBSCODE = new$REMOTENOTPBSCODE,
    USECHECK_CARD = new$USECHECK_CARD
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AU_100 (TR_ORGANIZATIONS_AU_100)
-- Create 27.07.2007
-- - - - - - - - - - - - -

-- Comment Триггер обработки открытия/закрытия организации


  /*  Закрытие организации */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
    update Banks set DateClose = new$DateClose where (id = new$ID) and (DateClose is null);
  end if;

  /*  открытие организации */
  if ((new$DateClose is null) and (:old.DateClose is not null)) then
    update Banks set DateClose = null where (id = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_200 (TR_ORGANIZATIONS_AU_200)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$BudgetRef <> :old.BudgetRef) then
    update FacialAcc_CLS set
    BudgetRef = new$BudgetRef
    where
    (ORG_REF = new$id)and((BudgetRef = :old.BudgetRef)or(BudgetRef<>0));
  END IF;
  /* Сносим организацию в проставленный КВСР, только если это ГРБС*/
  if ((new$KVSR <> :old.KVSR)and(new$Org_Type >= 10100)and(new$Org_Type <= 10299)) then
    update KVSR set
    Org_Ref = new$id
    where
    id = new$KVSR;
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update FacialAcc_CLS set
    KVSR = new$KVSR
    where
    (ORG_REF = new$id) and (KVSR = :old.KVSR);
  END IF;
  if (new$BudgetRef <> :old.BudgetRef) then
    update organizations set
    BudgetRef = new$BudgetRef
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;
  if (new$KVSR <> :old.KVSR) then
    update organizations set
    KVSR = new$KVSR
    where                       
    (generalorg_ref = new$id) and (id <> new$id);
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_ORGANIZATIONS_AU_500)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (27, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=27) and (RecordId=new$ID);
  end if;

END;
/
commit work 
/
ALTER TABLE TB_Organizations MODIFY(UseCheck_Card NOT NULL)
/

-- #########################################################
-- #########################################################
-- Новые протоколы по 136н.sql
-- #########################################################
-- #########################################################


/* отключаем блокирующие изменения справочника триггера */
alter trigger tr_protocoldoctype_bi disable
/

alter trigger tr_ProtocolDocType_bd disable
/

alter trigger tr_ProtocolDocType_bu disable
/

create or replace procedure AddProtocolDocType(ID$ Number, Name$ VarChar2, AType$ Number)
as
  cnt$ Number(10);
begin
    select count(*) into cnt$
    from ProtocolDocType
    where ID = ID$;

    if cnt$ <> 0 then
      update ProtocolDocType set
        Name = Name$,
        AType = AType$
      where 
        ID = ID$;
    else
     insert into ProtocolDocType(ID, Name, AType, CreateDate, UpdateDate) values(ID$, Name$, AType$, SYSDATE, SYSDATE);
    end if;
end;
/

/* увеличим размер поля, что бы влезли новые значения */
ALTER TABLE ProtocolDocType modify (NAME VARCHAR2(1024))
/

commit work
/

call AddProtocolDocType(20, 'Федеральный закон, нормативно правовой акт Президента Российской Федерации, нормативно правовой акт Правительства Российской Федерации, законодательный акт соответствующего субъекта Российской Федерации, устанавливающий полномочия органа исполнительной власти или подведомственного ему государственного учреждения, государственного унитарного предприятия в случае закупки у единственного поставщика (подрядчика, исполнителя)', 150)
/

call AddProtocolDocType(21, 'Нормативно правовой акт Правительства Российской Федерации, утверждающий перечень товаров, работ, услуг производство, выполнение, оказание, которых осуществляется учреждением и предприятием уголовно-исполнительной системы в случае закупки у единственного поставщика (подрядчика, исполнителя)', 150)
/

call AddProtocolDocType(22, 'Распоряжение Правительства Российской Федерации об определении поставщика бюллетеней, открепительных удостоверений, специальных знаков (марок)', 150)
/

call AddProtocolDocType(23, 'Решение о подготовке и реализации бюджетных инвестиций или о предоставлении субсидий на осуществление капитальных вложений в целях приобретения объектов недвижимого имущества в государственную или муниципальную собственность, принятое в порядке, установленном соответственно Правительством Российской Федерации, высшим исполнительным органом государственной власти субъекта Российской Федерации, местной администрацией в случае закупки у единственного поставщика (подрядчика, исполнителя)', 150)
/


alter trigger tr_protocoldoctype_bi enable
/

alter trigger tr_ProtocolDocType_bd enable
/

alter trigger tr_ProtocolDocType_bu enable
/

drop procedure AddProtocolDocType
/

commit work
/


-- #########################################################
-- #########################################################
-- Единицы измерения по 1101ст.sql
-- #########################################################
-- #########################################################

CREATE OR REPLACE procedure AddMeasurementCls(ID$ NUMBER,Name$ VARCHAR2,ShortName$ VARCHAR2)
AS
  CNT$1 NUMBER(10);
BEGIN
  SELECT COUNT(id ) INTO CNT$1
  from Measurementcls where (id = ID$) AND (ROWNUM = 1);
  if ((CNT$1<> 0)) then
    update Measurementcls set Name = Name$, ShortName = ShortName$  where id = ID$;
      
  else
    insert into Measurementcls(ID, Name, ShortName) values (ID$, Name$, ShortName$);
  END IF;
END;
/
commit work
/
CALL AddMeasurementCls(984, 'Центнеров с гектара', 'Ц/ГА')
/
CALL AddMeasurementCls(985, 'Тысяча голов',             'ТЫС ГОЛ')
/
CALL AddMeasurementCls(986, 'Тысяча краско-оттисков',   'ТЫС КРАСК ОТТИСК')
/
CALL AddMeasurementCls(987, 'Миллион краско-оттисков',  'МЛН КРАСК ОТТИСК')
/
CALL AddMeasurementCls(988, 'Миллион условных плиток',  'МЛН УСЛ ПЛИТ')
/
CALL AddMeasurementCls(989, 'Человек в час',            'ЧЕЛ/Ч')
/
CALL AddMeasurementCls(990, 'Пассажиров в час',         'ПАСС/Ч')
/
CALL AddMeasurementCls(991, 'Пассажиро-миля',           'ПАСС МИЛЯ')
/
CALL AddMeasurementCls(2541, 'Бит в секунду',             'БИТ/С')
/
CALL AddMeasurementCls(2543, 'Килобит в секунду',         'КБИТ/С')
/
CALL AddMeasurementCls(2545, 'Мегабит в секунду',         'МБИТ/С')
/
CALL AddMeasurementCls(2547, 'Гигабит в секунду',         'ГБИТ/С')
/
CALL AddMeasurementCls(2551, 'Байт в секунду',            'БАЙТ/С')
/
CALL AddMeasurementCls(2552, 'Гигабайт в секунду',        'ГБАЙТ/С')
/
CALL AddMeasurementCls(2553, 'Гигабайт',                  'ГБАЙТ')
/
CALL AddMeasurementCls(2554, 'Терабайт',                  'ТБАЙТ')
/
CALL AddMeasurementCls(2555, 'Петабайт',                  'ПБАЙТ')
/
CALL AddMeasurementCls(2556, 'Эксабайт',                  'ЭБАЙТ')
/
CALL AddMeasurementCls(2557, 'Зеттабайт',                 'ЗБАЙТ')
/
CALL AddMeasurementCls(2558, 'Йоттабайт',                 'ЙБАЙТ')
/
CALL AddMeasurementCls(2561, 'Килобайт в секунду',        'КБАЙТ/С')
/
CALL AddMeasurementCls(2571, 'Мегабайт в секунду',        'МБАЙТ/С')
/
CALL AddMeasurementCls(2581, 'Эрланг',                    'ЭРЛАНГ')
/
CALL AddMeasurementCls(2931, 'Гигагерц',                  'ГИГАГЦ')
/
CALL AddMeasurementCls(3135, 'Децибел',                   'ДЕЦИБЕЛ')
/
CALL AddMeasurementCls(3831, 'Рубль тонна',             'РУБ ТОННА')
/
CALL AddMeasurementCls(5401, 'Дето-день',                'ДЕТ ДН')
/
CALL AddMeasurementCls(5423, 'Человек в год',            'ЧЕЛ/ГОД')
/
CALL AddMeasurementCls(5451, 'Посещение',                 'ПОСЕЩ')
/
CALL AddMeasurementCls(5562, 'Тысяча гнезд',            'ТЫС ГНЕЗД')
/
CALL AddMeasurementCls(6421, 'Единиц в год',             'ЕД/ГОД')
/
CALL AddMeasurementCls(6422, 'Вызов',                     'ВЫЗОВ')
/
CALL AddMeasurementCls(6424, 'Штамм',                     'ШТАММ')
/
CALL AddMeasurementCls(7923, 'Абонент',                   'АБОНЕНТ')
/
CALL AddMeasurementCls(8361, 'Особь',                     'ОСОБЬ')
/
CALL AddMeasurementCls(8751, 'Коробка',                    'КОР')
/
CALL AddMeasurementCls(9061, 'Миллион гектаров',          'МЛН ГА')
/
CALL AddMeasurementCls(9062, 'Миллиард гектаров',         'МЛРД ГА')
/
CALL AddMeasurementCls(9111, 'Койко-день',               'КОЙК ДН')
/
CALL AddMeasurementCls(9113, 'Пациенто-день',          'ПАЦИЕНТ ДН')
/
CALL AddMeasurementCls(9245, 'Запись',                   'ЗАПИСЬ')
/
CALL AddMeasurementCls(9246, 'Документ',                 'ДОКУМ')
/
CALL AddMeasurementCls(9491, 'Лист-оттиск',           'ЛИСТ. ОТТИСК')
/
CALL AddMeasurementCls(9501, 'Вагоно (машино)-час',    'ВАГ (МАШ) Ч')
/
CALL AddMeasurementCls(9557, 'Миллион голов',             'МЛН ГОЛ')
/
CALL AddMeasurementCls(9641, 'Летный час',               'ЛЕТН Ч')
/
CALL AddMeasurementCls(9642, 'Балл',                      'БАЛЛ')
/
CALL AddMeasurementCls(9802, 'Миллион долларов',        'МЛН ДОЛЛАР')
/
CALL AddMeasurementCls(9803, 'Миллиард долларов',      'МЛРД ДОЛЛАР')
/
CALL AddMeasurementCls(9805, 'Доллар за тонну',         'ДОЛЛАР ЗА ТОННУ')
/
drop procedure AddMeasurementCls
/
commit work
/

-- #########################################################
-- #########################################################
-- Alter_Fcsorder_placing_to_note10.sql
-- #########################################################
-- #########################################################

/* скрипт расширяет FCSORDER_PLACING до 10 символов */
ALTER TABLE oos_contract MODIFY (FCSORDER_PLACING VARCHAR2(10))
/
COMMIT WORK
/





-- #########################################################
-- #########################################################
-- alter_FacialFinCaption_add_DestClsType.sql
-- #########################################################
-- #########################################################

/* Добавление поля DestClsType в таблицу FacialFinCaption */
ALTER TABLE TB_FacialFinCaption ADD (
  DestClsType NUMBER(10)/* Тип классификации получателя */,
    CHECK((DestClsType<=2147483647)AND(DestClsType>-2147483648))
)
/

CREATE OR REPLACE VIEW FacialFinCaption (
  ID,
  DOCNUMBER,
  SOURCEDOCNUM,
  PAYDATE,
  ACCEPTDATE,
  DOCUMENTDATE,
  REESTRDATE,
  CREDIT,
  SOURCEACCOUNT,
  SOURCEFACIALACC_CLS,
  DESTACCOUNT,
  DESTFACIALACC_CLS,
  PROGINDEX,
  ARHIVEDOC,
  PAYSYMBOLCLS,
  PAYTYPECLS,
  NOTE,
  PERIOD,
  PAYPRIORITY,
  TYPEOPERATIONCLS,
  BUHPAYMENTCLS,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  BUDGETREF,
  RECORDINDEX,
  SENDERID,
  SENDERRECORDID,
  REESTR_REF,
  REJECT_CLS,
  REJECTCAUSE,
  CLIENTBANKNUMBER,
  CRYPTOSTATUS,
  TRUSTNUMBER,
  LINKEDDOCUMENT,
  BNKRECORDID,
  SUBPROGINDEX,
  DOCUMENTSTATE,
  USERSVISA,
  TREASUARYDOCSTATECLS,
  DEPARTMENTCLS,
  NDS,
  TAXNOTE,
  MANAGERBID,
  BIDNUMBER,
  GROUPID,
  GROUPSUMMA,
  DOCSTATEREF,
  LASTEXTRCHANGE,
  FAXDOCCOUNT,
  STIMATEID,
  INTEGRATEDDOCREF,
  REQUESTNUMBER,
  REQUESTDATE,
  RVERSION,
  FEDERALFUNDSREF,
  ELDOCREF,
  BUHOPERATIONCLS,
  CLSTYPE,
  OPERATIONDIRECTION,
  SOURCETYPE,
  DESTTYPE,
  CARDNUMBER,
  ISBLOCKED,
  BLOCKEDCAUSE,
  UNBLOCKEDDATE,
  UNBLOCKEDCAUSE,
  CASHIERPERSONALINFO,
  BIDDATE,
  CARDREF,
  SOURCESTOREDPAYMENTPROPS,
  DESTSTOREDPAYMENTPROPS,
  STOREDPAYMENTNOTE,
  DOCCHANGEDATE,
  UINCODE,
  DOCOSN,
  SIGNERS,
  DESTCLSTYPE)
AS
  SELECT
    ID,
    DOCNUMBER,
    SOURCEDOCNUM,
    PAYDATE,
    ACCEPTDATE,
    DOCUMENTDATE,
    REESTRDATE,
    CREDIT,
    SOURCEACCOUNT,
    SOURCEFACIALACC_CLS,
    DESTACCOUNT,
    DESTFACIALACC_CLS,
    PROGINDEX,
    ARHIVEDOC,
    PAYSYMBOLCLS,
    PAYTYPECLS,
    NOTE,
    PERIOD,
    PAYPRIORITY,
    TYPEOPERATIONCLS,
    BUHPAYMENTCLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    RECORDINDEX,
    SENDERID,
    SENDERRECORDID,
    REESTR_REF,
    REJECT_CLS,
    REJECTCAUSE,
    CLIENTBANKNUMBER,
    CRYPTOSTATUS,
    TRUSTNUMBER,
    LINKEDDOCUMENT,
    BNKRECORDID,
    SUBPROGINDEX,
    DOCUMENTSTATE,
    USERSVISA,
    TREASUARYDOCSTATECLS,
    DEPARTMENTCLS,
    NDS,
    TAXNOTE,
    MANAGERBID,
    BIDNUMBER,
    GROUPID,
    GROUPSUMMA,
    DOCSTATEREF,
    LASTEXTRCHANGE,
    FAXDOCCOUNT,
    STIMATEID,
    INTEGRATEDDOCREF,
    REQUESTNUMBER,
    REQUESTDATE,
    RVERSION,
    FEDERALFUNDSREF,
    ELDOCREF,
    BUHOPERATIONCLS,
    CLSTYPE,
    OPERATIONDIRECTION,
    SOURCETYPE,
    DESTTYPE,
    CARDNUMBER,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO,
    BIDDATE,
    CARDREF,
    SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE,
    DOCCHANGEDATE,
    UINCODE,
    DOCOSN,
    SIGNERS,
    DESTCLSTYPE
  FROM TB_FacialFinCaption
/

CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_ID
  INSTEAD OF DELETE
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  reestrAccepted1$ NUMBER(10);
  CNT$1 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_FACIALFINCAPTION_BD)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

 /*  Удалить детализацию распоряжения на финансирование */
  DELETE FROM FacialFinDetail
        WHERE (RecordIndex = :OLD.ID);

-- - - - - - - - - - - - -
-- BD_5 (TR_FACIALFINCAPTION_BD_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (((:old.progIndex = 63) or (:old.progIndex = 64) or
  (:old.progIndex = 68) or (:old.progIndex = 70))
  and (:old.REESTR_REF is not null)) then
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id = :old.REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrDelete');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BD_6 (TR_FACIALFINCAPTION_BD_6)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  SELECT COUNT(id ) INTO CNT$1
  from paydocexchange where ((paydocref=:old.id)and(status<>0)and(CodeFormat<>50)) AND (ROWNUM = 1);
  if ((CNT$1<> 0)) then
    RaiseException('ex_CannotChangeSended');
  else
    delete from PayDocExchange where paydocref = :old.id;  
  END IF;

-- - - - - - - - - - - - -
-- BD_430 (TR_FACIALFINCAPTION_BD_430)
-- Create 04.12.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  /* При удалении ПП зануляем ссылку на него в факсах*/
  UPDATE FaxDocs
     SET OwnerID = NULL
  WHERE OwnerID = :OLD.ID;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_FACIALFINCAPTION
  WHERE ID = :OLD.ID and (RVersion = :old.RVersion or RVersion is NULL and :old.RVersion is NULL);

  if SQL%ROWCOUNT <> 1 then
    RaiseException('EX_RECORDCHANGED');
  end if;

-- - - - - - - - - - - - -
-- AD_70 (TR_FACIALFINCAPTION_AD_70)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

-- При удалении п/п очищаем ссылающиеся поля у гарантии
  IF (:OLD.SubProgIndex = 416) THEN
    UPDATE Guarantee
       SET SubRecordIndex = NULL,
           SubProgIndex = 0
     WHERE SubRecordIndex = :OLD.ID;
  END IF;

-- - - - - - - - - - - - -
-- AD_200 (TR_FACIALFINCAPTION_AD_200)
-- Create 27.08.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  /* Удаление истории изменений состоний для удаленного документа*/
  delete from StateJumpHistory
    where DocID = :old.ID;

-- - - - - - - - - - - - -
-- AD_300 (TR_FACIALFINCAPTION_AD_300)
-- Create 24.02.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  IF (:OLD.FaxDocCount > 0) THEN
--    :old.FaxDocCount := :old.FaxDocCount;
    NULL;
  ELSE
    UPDATE FaxDocs
       SET OwnerID = NULL
     WHERE OwnerID = :OLD.ID;
  END IF;

-- - - - - - - - - - - - -
-- AD_500 (TR_FACIALFINCAPTION_AD_500)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate, ProgIndex, Summa)
    VALUES (23, :OLD.ID, SYSDATE, :OLD.ProgIndex, :OLD.Credit);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_II
  INSTEAD OF INSERT
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  new$ID FACIALFINCAPTION.ID%TYPE := :NEW.ID;
  new$DOCNUMBER FACIALFINCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SOURCEDOCNUM FACIALFINCAPTION.SOURCEDOCNUM%TYPE := :NEW.SOURCEDOCNUM;
  new$PAYDATE FACIALFINCAPTION.PAYDATE%TYPE := :NEW.PAYDATE;
  new$ACCEPTDATE FACIALFINCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$DOCUMENTDATE FACIALFINCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$REESTRDATE FACIALFINCAPTION.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$CREDIT FACIALFINCAPTION.CREDIT%TYPE := :NEW.CREDIT;
  new$SOURCEACCOUNT FACIALFINCAPTION.SOURCEACCOUNT%TYPE := :NEW.SOURCEACCOUNT;
  new$SOURCEFACIALACC_CLS FACIALFINCAPTION.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$DESTACCOUNT FACIALFINCAPTION.DESTACCOUNT%TYPE := :NEW.DESTACCOUNT;
  new$DESTFACIALACC_CLS FACIALFINCAPTION.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$PROGINDEX FACIALFINCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$ARHIVEDOC FACIALFINCAPTION.ARHIVEDOC%TYPE := :NEW.ARHIVEDOC;
  new$PAYSYMBOLCLS FACIALFINCAPTION.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$PAYTYPECLS FACIALFINCAPTION.PAYTYPECLS%TYPE := :NEW.PAYTYPECLS;
  new$NOTE FACIALFINCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$PERIOD FACIALFINCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$PAYPRIORITY FACIALFINCAPTION.PAYPRIORITY%TYPE := :NEW.PAYPRIORITY;
  new$TYPEOPERATIONCLS FACIALFINCAPTION.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$BUHPAYMENTCLS FACIALFINCAPTION.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$CREATERUSER FACIALFINCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF FACIALFINCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$RECORDINDEX FACIALFINCAPTION.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SENDERID FACIALFINCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REESTR_REF FACIALFINCAPTION.REESTR_REF%TYPE := :NEW.REESTR_REF;
  new$REJECT_CLS FACIALFINCAPTION.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE FACIALFINCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CLIENTBANKNUMBER FACIALFINCAPTION.CLIENTBANKNUMBER%TYPE := :NEW.CLIENTBANKNUMBER;
  new$CRYPTOSTATUS FACIALFINCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$TRUSTNUMBER FACIALFINCAPTION.TRUSTNUMBER%TYPE := :NEW.TRUSTNUMBER;
  new$LINKEDDOCUMENT FACIALFINCAPTION.LINKEDDOCUMENT%TYPE := :NEW.LINKEDDOCUMENT;
  new$BNKRECORDID FACIALFINCAPTION.BNKRECORDID%TYPE := :NEW.BNKRECORDID;
  new$SUBPROGINDEX FACIALFINCAPTION.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$DOCUMENTSTATE FACIALFINCAPTION.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA FACIALFINCAPTION.USERSVISA%TYPE := :NEW.USERSVISA;
  new$TREASUARYDOCSTATECLS FACIALFINCAPTION.TREASUARYDOCSTATECLS%TYPE := :NEW.TREASUARYDOCSTATECLS;
  new$DEPARTMENTCLS FACIALFINCAPTION.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$NDS FACIALFINCAPTION.NDS%TYPE := :NEW.NDS;
  new$TAXNOTE FACIALFINCAPTION.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$MANAGERBID FACIALFINCAPTION.MANAGERBID%TYPE := :NEW.MANAGERBID;
  new$BIDNUMBER FACIALFINCAPTION.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$GROUPID FACIALFINCAPTION.GROUPID%TYPE := :NEW.GROUPID;
  new$GROUPSUMMA FACIALFINCAPTION.GROUPSUMMA%TYPE := :NEW.GROUPSUMMA;
  new$DOCSTATEREF FACIALFINCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$LASTEXTRCHANGE FACIALFINCAPTION.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$FAXDOCCOUNT FACIALFINCAPTION.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$STIMATEID FACIALFINCAPTION.STIMATEID%TYPE := :NEW.STIMATEID;
  new$INTEGRATEDDOCREF FACIALFINCAPTION.INTEGRATEDDOCREF%TYPE := :NEW.INTEGRATEDDOCREF;
  new$REQUESTNUMBER FACIALFINCAPTION.REQUESTNUMBER%TYPE := :NEW.REQUESTNUMBER;
  new$REQUESTDATE FACIALFINCAPTION.REQUESTDATE%TYPE := :NEW.REQUESTDATE;
  new$RVERSION FACIALFINCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$FEDERALFUNDSREF FACIALFINCAPTION.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$ELDOCREF FACIALFINCAPTION.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$BUHOPERATIONCLS FACIALFINCAPTION.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CLSTYPE FACIALFINCAPTION.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$OPERATIONDIRECTION FACIALFINCAPTION.OPERATIONDIRECTION%TYPE := :NEW.OPERATIONDIRECTION;
  new$SOURCETYPE FACIALFINCAPTION.SOURCETYPE%TYPE := :NEW.SOURCETYPE;
  new$DESTTYPE FACIALFINCAPTION.DESTTYPE%TYPE := :NEW.DESTTYPE;
  new$CARDNUMBER FACIALFINCAPTION.CARDNUMBER%TYPE := :NEW.CARDNUMBER;
  new$ISBLOCKED FACIALFINCAPTION.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINCAPTION.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINCAPTION.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINCAPTION.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$CASHIERPERSONALINFO FACIALFINCAPTION.CASHIERPERSONALINFO%TYPE := :NEW.CASHIERPERSONALINFO;
  new$BIDDATE FACIALFINCAPTION.BIDDATE%TYPE := :NEW.BIDDATE;
  new$CARDREF FACIALFINCAPTION.CARDREF%TYPE := :NEW.CARDREF;
  new$SOURCESTOREDPAYMENTPROPS FACIALFINCAPTION.SOURCESTOREDPAYMENTPROPS%TYPE := :NEW.SOURCESTOREDPAYMENTPROPS;
  new$DESTSTOREDPAYMENTPROPS FACIALFINCAPTION.DESTSTOREDPAYMENTPROPS%TYPE := :NEW.DESTSTOREDPAYMENTPROPS;
  new$STOREDPAYMENTNOTE FACIALFINCAPTION.STOREDPAYMENTNOTE%TYPE := :NEW.STOREDPAYMENTNOTE;
  new$DOCCHANGEDATE FACIALFINCAPTION.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
  new$UINCODE FACIALFINCAPTION.UINCODE%TYPE := :NEW.UINCODE;
  new$DOCOSN FACIALFINCAPTION.DOCOSN%TYPE := :NEW.DOCOSN;
  new$SIGNERS FACIALFINCAPTION.SIGNERS%TYPE := :NEW.SIGNERS;
  new$DESTCLSTYPE FACIALFINCAPTION.DESTCLSTYPE%TYPE := :NEW.DESTCLSTYPE;
--
  UseFax$ NUMBER(10);
  pdt$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  CmpFacialAcc_Cls1$ NUMBER(10);
  PIndex$ NUMBER(10);
  reestrAccepted1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FACIALFINCAPTION_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$credit is null)then 
    new$credit:= 0;
  END IF;
  if (new$ArhiveDoc is null) then 
    new$ArhiveDoc:= 0;
  END IF;
  if (new$PayTypeCls is null) then 
    new$PayTypeCls:= 0;
  END IF;
  if (new$BuhPaymentCls is null) then 
    new$BuhPaymentCls:= 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 0;
  END IF;
  if (new$SourceFacialAcc_CLS is null) then 
    new$SourceFacialAcc_CLS:= 0;
  END IF;
  if (new$DestFacialAcc_CLS is null) then 
    new$DestFacialAcc_CLS:= 0;
  END IF;
  if (new$FaxDocCount is null) then 
    new$FaxDocCount := 0;
  END IF;
  if (new$OperationDirection is null) then 
    new$OperationDirection := 0;
  END IF;
  if (new$OperationDirection = 0) then
    new$SourceType := 1;
    new$DestType := 1;
     
  else
    if (new$OperationDirection = 1) then
      new$SourceType := 1;
      new$DestType := -1;
         
    else
      if (new$OperationDirection = 2) then
        new$SourceType := -1;
        new$DestType := 1;
             
      else
        new$SourceType := -1;
        new$DestType := -1;
             
      END IF;
    END IF;
  END IF;
  if (new$DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber1$); 
    if (DocNumber1$ is null) then 
      new$DepartmentCls:= 0;
           
    else 
      new$DepartmentCls:= DocNumber1$;
       
    END IF;
  END IF;
   
  /* Заполнение Бюджета. Если пустой или ноль, берем из лицевого счета */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    PIndex$ := new$ProgIndex;
    if (PIndex$=60) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Приход средств от фин.органа*/
    END IF;
    if (PIndex$=61) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Приход средств от прочих и восстановление расходов*/
    END IF;
    if (PIndex$=62) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Приход средств по объявлениям*/
    END IF;
    if (PIndex$=63) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Уход средств по платежным поручениям*/
    END IF;
    if (PIndex$=64) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Уход средств по чекам*/
    END IF;
    if (PIndex$=65) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Переброска средств, Разассигновка*/
    END IF;
    if (PIndex$=66) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Внутренняя переброска средств, один - многим*/
    END IF;
    if (PIndex$=67) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Уход средств в районы*/
    END IF;
    if (PIndex$=68) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Перечисление на р\с районов*/
    END IF;
    if (PIndex$=69) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Подтверждение перечисления на р\с районов*/
    END IF;
    if (PIndex$=70) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Возврат с р\с районов*/
    END IF;
    if (PIndex$=71) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Подтверждение возврата с р\с районов*/
    END IF;
    if (PIndex$=73) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Учет кассовых выбытий*/
    END IF;
    if (PIndex$=75) then 
      CmpFacialAcc_Cls1$ := new$DestFacialAcc_CLS;           /* Утверждение ОФ*/
    END IF;
    if (PIndex$=76) then 
      CmpFacialAcc_Cls1$ := new$SourceFacialAcc_CLS;         /* Распределение ОФ*/
    END IF;
    BEGIN

      select fa.BudgetRef      into new$BudgetRef from FacialAcc_Cls fa
      where fa.Id = CmpFacialAcc_Cls1$

      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$AcceptDate is not null) and (new$Reject_CLS is not null )) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_1 (TR_FACIALFINCAPTION_BI_1)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- Инициализация значений по-умолчанию для добавляемых полей на вставку
   IF (new$GroupID IS NULL) THEN new$GroupID := new$ID; END IF;
   IF (new$GroupSumma IS NULL) THEN new$GroupSumma := 0; END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_FACIALFINCAPTION_BI_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (((new$progIndex = 63) or (new$progIndex = 64) or
  (new$progIndex = 68) or (new$progIndex = 70))
  and (new$REESTR_REF is not null)) then
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id = new$REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrInsert');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_16 (TR_FACIALFINCAPTION_BI_16)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /*  Вставляется запись по новой схеме. Делаем сноску в FacialFinCaption
     даты и номера реестра из таблицы реестров по ссылке*/
   IF (new$Reestr_ref IS NULL) THEN
      new$SourceDocNum := '';
      new$ReestrDate := NULL;
   ELSE
      BEGIN
         SELECT ffr.ReestrNumber, ffr.ReestrDate
           INTO new$SourceDocNum, new$ReestrDate
           FROM FacialFinReestr ffr
          WHERE ffr.ID = new$Reestr_ref;
      EXCEPTION
         WHEN NO_DATA_FOUND THEN
            new$SourceDocNum := NULL;
            new$ReestrDate := NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BI_430 (TR_FACIALFINCAPTION_BI_430)
-- Create 04.12.2004
-- Last update 11.10.2006
-- - - - - - - - - - - - -

  IF (NEW$SenderID IS NOT NULL) THEN
    pdt$ := NULL;
    IF (NEW$progindex = 63) THEN pdt$ := 302; END IF;
    IF (NEW$progindex = 66) THEN pdt$ := 301; END IF;
    IF (NEW$progindex = 64) THEN pdt$ := 304; END IF;

    /*  Платежное поручение получено из УРМ */
    GetIntConst(30, 19, UseFax$);
    IF ((new$BidNumber IS NULL) AND (UseFax$ = 1)) THEN
      new$BidNumber := new$DocNumber;
    END IF;
    SELECT COUNT(*) INTO new$FaxDocCount
    FROM FaxDocs
      WHERE (OwnerDocNumber=new$BidNumber)
        AND (ClientID=new$SenderID)
        AND (FacialAcc_Cls=new$SourceFacialAcc_CLS)
        AND (OwnerDate = new$DocumentDate)
        AND (PrimaryDocType = PDT$);
  ELSE
    new$FaxDocCount := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_FACIALFINCAPTION_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$DocChangeDate := new$UpdateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_FACIALFINCAPTION (
    ID,
    DOCNUMBER,
    SOURCEDOCNUM,
    PAYDATE,
    ACCEPTDATE,
    DOCUMENTDATE,
    REESTRDATE,
    CREDIT,
    SOURCEACCOUNT,
    SOURCEFACIALACC_CLS,
    DESTACCOUNT,
    DESTFACIALACC_CLS,
    PROGINDEX,
    ARHIVEDOC,
    PAYSYMBOLCLS,
    PAYTYPECLS,
    NOTE,
    PERIOD,
    PAYPRIORITY,
    TYPEOPERATIONCLS,
    BUHPAYMENTCLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    RECORDINDEX,
    SENDERID,
    SENDERRECORDID,
    REESTR_REF,
    REJECT_CLS,
    REJECTCAUSE,
    CLIENTBANKNUMBER,
    CRYPTOSTATUS,
    TRUSTNUMBER,
    LINKEDDOCUMENT,
    BNKRECORDID,
    SUBPROGINDEX,
    DOCUMENTSTATE,
    USERSVISA,
    TREASUARYDOCSTATECLS,
    DEPARTMENTCLS,
    NDS,
    TAXNOTE,
    MANAGERBID,
    BIDNUMBER,
    GROUPID,
    GROUPSUMMA,
    DOCSTATEREF,
    LASTEXTRCHANGE,
    FAXDOCCOUNT,
    STIMATEID,
    INTEGRATEDDOCREF,
    REQUESTNUMBER,
    REQUESTDATE,
    RVERSION,
    FEDERALFUNDSREF,
    ELDOCREF,
    BUHOPERATIONCLS,
    CLSTYPE,
    OPERATIONDIRECTION,
    SOURCETYPE,
    DESTTYPE,
    CARDNUMBER,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO,
    BIDDATE,
    CARDREF,
    SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE,
    DOCCHANGEDATE,
    UINCODE,
    DOCOSN,
    SIGNERS,
    DESTCLSTYPE
  ) VALUES (
    new$ID,
    new$DOCNUMBER,
    new$SOURCEDOCNUM,
    new$PAYDATE,
    new$ACCEPTDATE,
    new$DOCUMENTDATE,
    new$REESTRDATE,
    new$CREDIT,
    new$SOURCEACCOUNT,
    new$SOURCEFACIALACC_CLS,
    new$DESTACCOUNT,
    new$DESTFACIALACC_CLS,
    new$PROGINDEX,
    new$ARHIVEDOC,
    new$PAYSYMBOLCLS,
    new$PAYTYPECLS,
    new$NOTE,
    new$PERIOD,
    new$PAYPRIORITY,
    new$TYPEOPERATIONCLS,
    new$BUHPAYMENTCLS,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$RECORDINDEX,
    new$SENDERID,
    new$SENDERRECORDID,
    new$REESTR_REF,
    new$REJECT_CLS,
    new$REJECTCAUSE,
    new$CLIENTBANKNUMBER,
    new$CRYPTOSTATUS,
    new$TRUSTNUMBER,
    new$LINKEDDOCUMENT,
    new$BNKRECORDID,
    new$SUBPROGINDEX,
    new$DOCUMENTSTATE,
    new$USERSVISA,
    new$TREASUARYDOCSTATECLS,
    new$DEPARTMENTCLS,
    new$NDS,
    new$TAXNOTE,
    new$MANAGERBID,
    new$BIDNUMBER,
    new$GROUPID,
    new$GROUPSUMMA,
    new$DOCSTATEREF,
    new$LASTEXTRCHANGE,
    new$FAXDOCCOUNT,
    new$STIMATEID,
    new$INTEGRATEDDOCREF,
    new$REQUESTNUMBER,
    new$REQUESTDATE,
    new$RVERSION,
    new$FEDERALFUNDSREF,
    new$ELDOCREF,
    new$BUHOPERATIONCLS,
    new$CLSTYPE,
    new$OPERATIONDIRECTION,
    new$SOURCETYPE,
    new$DESTTYPE,
    new$CARDNUMBER,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$CASHIERPERSONALINFO,
    new$BIDDATE,
    new$CARDREF,
    new$SOURCESTOREDPAYMENTPROPS,
    new$DESTSTOREDPAYMENTPROPS,
    new$STOREDPAYMENTNOTE,
    new$DOCCHANGEDATE,
    new$UINCODE,
    new$DOCOSN,
    new$SIGNERS,
    new$DESTCLSTYPE);

-- - - - - - - - - - - - -
-- AI_430 (TR_FACIALFINCAPTION_AI_430)
-- Create 04.12.2004
-- Last update 11.10.2006
-- - - - - - - - - - - - -

  IF (new$SenderID IS NOT NULL) THEN
      /*  Платежное поручение получено из УРМ */
      pdt$ := NULL;
      IF (new$progindex = 63) THEN pdt$ := 302; END IF;
      IF (new$progindex = 66) THEN pdt$ := 301; END IF;
      IF (new$progindex = 64) THEN pdt$ := 304; END IF;

        UPDATE FaxDocs
            SET OwnerId=new$id
        WHERE
            (OwnerDocNumber=new$BidNumber)
            AND (ClientID=new$SenderID)
            AND (FacialAcc_Cls=new$SourceFacialAcc_CLS)
            AND (OwnerDate = new$DocumentDate)
            AND (primarydoctype = pdt$);
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_FACIALFINCAPTION_AI_500)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
     WHERE (TableID = 23) AND (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_IU
  INSTEAD OF UPDATE
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  new$ID FACIALFINCAPTION.ID%TYPE := :NEW.ID;
  new$DOCNUMBER FACIALFINCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SOURCEDOCNUM FACIALFINCAPTION.SOURCEDOCNUM%TYPE := :NEW.SOURCEDOCNUM;
  new$PAYDATE FACIALFINCAPTION.PAYDATE%TYPE := :NEW.PAYDATE;
  new$ACCEPTDATE FACIALFINCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$DOCUMENTDATE FACIALFINCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$REESTRDATE FACIALFINCAPTION.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$CREDIT FACIALFINCAPTION.CREDIT%TYPE := :NEW.CREDIT;
  new$SOURCEACCOUNT FACIALFINCAPTION.SOURCEACCOUNT%TYPE := :NEW.SOURCEACCOUNT;
  new$SOURCEFACIALACC_CLS FACIALFINCAPTION.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$DESTACCOUNT FACIALFINCAPTION.DESTACCOUNT%TYPE := :NEW.DESTACCOUNT;
  new$DESTFACIALACC_CLS FACIALFINCAPTION.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$PROGINDEX FACIALFINCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$ARHIVEDOC FACIALFINCAPTION.ARHIVEDOC%TYPE := :NEW.ARHIVEDOC;
  new$PAYSYMBOLCLS FACIALFINCAPTION.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$PAYTYPECLS FACIALFINCAPTION.PAYTYPECLS%TYPE := :NEW.PAYTYPECLS;
  new$NOTE FACIALFINCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$PERIOD FACIALFINCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$PAYPRIORITY FACIALFINCAPTION.PAYPRIORITY%TYPE := :NEW.PAYPRIORITY;
  new$TYPEOPERATIONCLS FACIALFINCAPTION.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$BUHPAYMENTCLS FACIALFINCAPTION.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$CREATERUSER FACIALFINCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF FACIALFINCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$RECORDINDEX FACIALFINCAPTION.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SENDERID FACIALFINCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REESTR_REF FACIALFINCAPTION.REESTR_REF%TYPE := :NEW.REESTR_REF;
  new$REJECT_CLS FACIALFINCAPTION.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE FACIALFINCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CLIENTBANKNUMBER FACIALFINCAPTION.CLIENTBANKNUMBER%TYPE := :NEW.CLIENTBANKNUMBER;
  new$CRYPTOSTATUS FACIALFINCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$TRUSTNUMBER FACIALFINCAPTION.TRUSTNUMBER%TYPE := :NEW.TRUSTNUMBER;
  new$LINKEDDOCUMENT FACIALFINCAPTION.LINKEDDOCUMENT%TYPE := :NEW.LINKEDDOCUMENT;
  new$BNKRECORDID FACIALFINCAPTION.BNKRECORDID%TYPE := :NEW.BNKRECORDID;
  new$SUBPROGINDEX FACIALFINCAPTION.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$DOCUMENTSTATE FACIALFINCAPTION.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA FACIALFINCAPTION.USERSVISA%TYPE := :NEW.USERSVISA;
  new$TREASUARYDOCSTATECLS FACIALFINCAPTION.TREASUARYDOCSTATECLS%TYPE := :NEW.TREASUARYDOCSTATECLS;
  new$DEPARTMENTCLS FACIALFINCAPTION.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$NDS FACIALFINCAPTION.NDS%TYPE := :NEW.NDS;
  new$TAXNOTE FACIALFINCAPTION.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$MANAGERBID FACIALFINCAPTION.MANAGERBID%TYPE := :NEW.MANAGERBID;
  new$BIDNUMBER FACIALFINCAPTION.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$GROUPID FACIALFINCAPTION.GROUPID%TYPE := :NEW.GROUPID;
  new$GROUPSUMMA FACIALFINCAPTION.GROUPSUMMA%TYPE := :NEW.GROUPSUMMA;
  new$DOCSTATEREF FACIALFINCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$LASTEXTRCHANGE FACIALFINCAPTION.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$FAXDOCCOUNT FACIALFINCAPTION.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$STIMATEID FACIALFINCAPTION.STIMATEID%TYPE := :NEW.STIMATEID;
  new$INTEGRATEDDOCREF FACIALFINCAPTION.INTEGRATEDDOCREF%TYPE := :NEW.INTEGRATEDDOCREF;
  new$REQUESTNUMBER FACIALFINCAPTION.REQUESTNUMBER%TYPE := :NEW.REQUESTNUMBER;
  new$REQUESTDATE FACIALFINCAPTION.REQUESTDATE%TYPE := :NEW.REQUESTDATE;
  new$RVERSION FACIALFINCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$FEDERALFUNDSREF FACIALFINCAPTION.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$ELDOCREF FACIALFINCAPTION.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$BUHOPERATIONCLS FACIALFINCAPTION.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CLSTYPE FACIALFINCAPTION.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$OPERATIONDIRECTION FACIALFINCAPTION.OPERATIONDIRECTION%TYPE := :NEW.OPERATIONDIRECTION;
  new$SOURCETYPE FACIALFINCAPTION.SOURCETYPE%TYPE := :NEW.SOURCETYPE;
  new$DESTTYPE FACIALFINCAPTION.DESTTYPE%TYPE := :NEW.DESTTYPE;
  new$CARDNUMBER FACIALFINCAPTION.CARDNUMBER%TYPE := :NEW.CARDNUMBER;
  new$ISBLOCKED FACIALFINCAPTION.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINCAPTION.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINCAPTION.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINCAPTION.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$CASHIERPERSONALINFO FACIALFINCAPTION.CASHIERPERSONALINFO%TYPE := :NEW.CASHIERPERSONALINFO;
  new$BIDDATE FACIALFINCAPTION.BIDDATE%TYPE := :NEW.BIDDATE;
  new$CARDREF FACIALFINCAPTION.CARDREF%TYPE := :NEW.CARDREF;
  new$SOURCESTOREDPAYMENTPROPS FACIALFINCAPTION.SOURCESTOREDPAYMENTPROPS%TYPE := :NEW.SOURCESTOREDPAYMENTPROPS;
  new$DESTSTOREDPAYMENTPROPS FACIALFINCAPTION.DESTSTOREDPAYMENTPROPS%TYPE := :NEW.DESTSTOREDPAYMENTPROPS;
  new$STOREDPAYMENTNOTE FACIALFINCAPTION.STOREDPAYMENTNOTE%TYPE := :NEW.STOREDPAYMENTNOTE;
  new$DOCCHANGEDATE FACIALFINCAPTION.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
  new$UINCODE FACIALFINCAPTION.UINCODE%TYPE := :NEW.UINCODE;
  new$DOCOSN FACIALFINCAPTION.DOCOSN%TYPE := :NEW.DOCOSN;
  new$SIGNERS FACIALFINCAPTION.SIGNERS%TYPE := :NEW.SIGNERS;
  new$DESTCLSTYPE FACIALFINCAPTION.DESTCLSTYPE%TYPE := :NEW.DESTCLSTYPE;
--
  SourceFacialAcc_CLS$ NUMBER(10);
  DestFacialAcc_CLS$ NUMBER(10);
  UseFax1$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  DetCount1$ NUMBER(10);
  CNT$1 NUMBER(10);
  reestrAccepted1$ NUMBER(10);
  IsReject1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_FACIALFINCAPTION_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$SenderID is not null) then 
    /* Платежное поручение получено из УРМ */
    GetIntConst(30, 19,UseFax1$);
    if ((new$BidNumber is null) and (UseFax1$ = 1)) then 
      new$BidNumber:= new$DocNumber;
      
    END IF;
  END IF;
  if (new$credit is null)then 
    new$credit:= 0;
  END IF;
  if (new$ArhiveDoc is null) then 
    new$ArhiveDoc:= 0;
  END IF;
  if (new$PayTypeCls is null) then 
    new$PayTypeCls:= 0;
  END IF;
  if (new$BuhPaymentCls is null) then 
    new$BuhPaymentCls:= 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 0;
  END IF;
  if (new$SourceFacialAcc_CLS is null) then 
    new$SourceFacialAcc_CLS:= 0;
  END IF;
  if (new$DestFacialAcc_CLS is null) then 
    new$DestFacialAcc_CLS:= 0;
  END IF;
  if (new$FaxDocCount is null) then 
    new$FaxDocCount := 0;
  END IF;
  if (new$OperationDirection is null) then 
    new$OperationDirection := 0;
  END IF;
  if (new$OperationDirection <> :old.OperationDirection) then
    if (new$OperationDirection = 0) then
      new$SourceType := 1;
      new$DestType := 1;
          
    else
      if (new$OperationDirection = 1) then
        new$SourceType := 1;
        new$DestType := -1;
              
      else
        if (new$OperationDirection = 2) then
          new$SourceType := -1;
          new$DestType := 1;
                  
        else
          new$SourceType := -1;
          new$DestType := -1;
                  
        END IF;
      END IF;  
    END IF;
  END IF;
  if (new$DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber1$); 
    if (DocNumber1$ is null) then 
      new$DepartmentCls:= 0;
          
    else 
      new$DepartmentCls:= DocNumber1$;
      
    END IF;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      select count(ID)       into DetCount1$ from FacialFinDetail where RecordIndex = :old.ID
      ;
      if (DetCount1$ > 0) then 
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$AcceptDate is not null) and (new$Reject_Cls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_FACIALFINCAPTION_BU_1)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- Инициализация значений по-умолчанию для добавляемых полей на изменение
   IF (new$GroupID IS NULL) THEN new$GroupID := new$ID; END IF;
   IF (new$GroupSumma IS NULL) THEN new$GroupSumma := 0; END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_FACIALFINCAPTION_BU_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (not (    ((new$progindex = 63) or (new$progindex = 64) or (new$progindex = 68) or (new$progindex = 70))
  and (   (((new$credit - :old.credit)>0.001)or((new$credit - :old.credit)<-0.001))
  or (new$sourcefacialacc_cls <> :old.sourcefacialacc_cls)
  or (
  ((new$sourceaccount is null) and (:old.sourceaccount is not null)) or
  ((new$sourceaccount is not null) and (:old.sourceaccount is null)) or
  ((new$sourceaccount <> :old.sourceaccount ) and (:old.sourceaccount is not null) and (new$sourceaccount is not null))                                             
  )
  or (
  ((new$destaccount is null) and (:old.destaccount is not null)) or
  ((new$destaccount is not null) and (:old.destaccount is null)) or
  ((new$destaccount <> :old.destaccount ) and (:old.destaccount is not null) and (new$destaccount is not null))
  )
  or (    (:old.reestr_ref is null)
  and (new$reestr_ref is not null)
  )
  or (    (:old.reestr_ref is not null)
  and (new$reestr_ref is null)
  )
  or (:old.reestr_ref <> new$reestr_ref)
  )
  )
  )
  then /* для корректной обработки неопределенности с NULL полями*/
    reestrAccepted1$ := 0;  /* заглушка для IB 4.2 */
      
  else 
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id=new$REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrUpdate');
    END IF;
    BEGIN

      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where
      id=:old.REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrUpdate');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_6 (TR_FACIALFINCAPTION_BU_6)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:old.ProgIndex in(63,68,70)) then /* только для исходящих платежек*/
    SELECT COUNT(id ) INTO CNT$1
    from paydocexchange where ((paydocref=:old.id)and(status<>0)and(CodeFormat<>50)) AND (ROWNUM = 1);
    if ((CNT$1<> 0)) then
      if(/* (new.DOCNUMBER<>old.DOCNUMBER) or ((new.DOCNUMBER is NULL)and(not old.DOCNUMBER is NULL)) or ((old.DOCNUMBER is NULL)and(not new.DOCNUMBER is NULL)) or*/
      (new$SOURCEDOCNUM<>:old.SOURCEDOCNUM) or ((new$SOURCEDOCNUM is NULL)and(not :old.SOURCEDOCNUM is NULL)) or ((:old.SOURCEDOCNUM is NULL)and(not new$SOURCEDOCNUM is NULL)) or
      (new$PAYDATE<>:old.PAYDATE) or ((new$PAYDATE is NULL)and(not :old.PAYDATE is NULL)) or ((:old.PAYDATE is NULL)and(not new$PAYDATE is NULL))or
      /* (new.DOCUMENTDATE<>old.DOCUMENTDATE) or ((new.DOCUMENTDATE is NULL)and(not old.DOCUMENTDATE is NULL)) or ((old.DOCUMENTDATE is NULL)and(not new.DOCUMENTDATE is NULL))or*/
      (new$REESTRDATE<>:old.REESTRDATE) or ((new$REESTRDATE is NULL)and(not :old.REESTRDATE is NULL)) or ((:old.REESTRDATE is NULL)and(not new$REESTRDATE is NULL))or
      (((new$credit - :old.credit)>0.001)or((new$credit - :old.credit)<-0.001)) or
      (new$SOURCEACCOUNT<>:old.SOURCEACCOUNT) or
      (new$DESTACCOUNT<>:old.DESTACCOUNT) or
      (new$PAYTYPECLS<>:old.PAYTYPECLS) or
      (new$NOTE<>:old.NOTE) or  ((new$NOTE is NULL)and(not :old.NOTE is NULL)) or ((:old.NOTE is NULL)and(not new$NOTE is NULL))or
      (new$PAYPRIORITY<>:old.PAYPRIORITY) or ((new$PAYPRIORITY is NULL)and(not :old.PAYPRIORITY is NULL)) or ((:old.PAYPRIORITY is NULL)and(not new$PAYPRIORITY is NULL))or
      (new$REESTR_REF<>:old.REESTR_REF) or ((new$REESTR_REF is NULL)and(not :old.REESTR_REF is NULL)) or ((:old.REESTR_REF is NULL)and(not new$REESTR_REF is NULL))or
      (new$NDS<>:old.NDS) or ((new$NDS is NULL)and(not :old.NDS is NULL)) or ((:old.NDS is NULL)and(not new$NDS is NULL))or
      (new$TAXNOTE<>:old.TAXNOTE) or ((new$TAXNOTE is NULL)and(not :old.TAXNOTE is NULL)) or ((:old.TAXNOTE is NULL)and(not new$TAXNOTE is NULL)) )then
        RaiseException('ex_CannotChangeSended');
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_FACIALFINCAPTION_BU_10)
-- Create 16.03.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$IntegratedDocRef IS NOT NULL) THEN
        /* Если документ входит в сводный и у него изменились ключевые аттрибуты, то нельзя их менять если они отличаются
      /* от атрибутов родительского документа*/
      IF (    (   (new$AcceptDate = :OLD.AcceptDate)
               OR ((new$AcceptDate IS NULL) AND (:OLD.AcceptDate IS NULL))
              )
          AND (   (new$Reject_CLS = :OLD.Reject_CLS)
               OR ((new$Reject_CLS IS NULL) AND (:OLD.Reject_CLS IS NULL))
              )
          AND (   (new$RejectCause = :OLD.RejectCause)
               OR ((new$RejectCause IS NULL) AND (:OLD.RejectCause IS NULL))
              )
          AND (   (new$TREASUARYDOCSTATECLS = :OLD.TREASUARYDOCSTATECLS)
               OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                   AND (:OLD.TREASUARYDOCSTATECLS IS NULL)
                  )
              )
          AND (   (new$DOCSTATEREF = :OLD.DOCSTATEREF)
               OR ((new$DOCSTATEREF IS NULL) AND (:OLD.DOCSTATEREF IS NULL))
              )
          AND (   (new$REESTR_REF = :OLD.REESTR_REF)
               OR ((new$REESTR_REF IS NULL) AND (:OLD.REESTR_REF IS NULL))
              )
          AND (new$SOURCEACCOUNT = :OLD.SOURCEACCOUNT)
          AND (new$DESTACCOUNT = :OLD.DESTACCOUNT)
         ) THEN
         new$AcceptDate := :OLD.AcceptDate;
      ELSE
         FOR R$ IN (SELECT fc.AcceptDate, fc.Reject_CLS, fc.RejectCause,
                           fc.TREASUARYDOCSTATECLS, fc.DOCSTATEREF,
                           fc.REESTR_REF, fc.SOURCEACCOUNT, fc.DESTACCOUNT
                      FROM FacialFinCaption fc
                     WHERE (fc.ID = :NEW.IntegratedDocRef)) LOOP
            IF (    (   (new$AcceptDate = R$.AcceptDate)
                     OR ((new$AcceptDate IS NULL) AND (R$.AcceptDate IS NULL)
                        )
                    )
                AND (   (new$Reject_CLS = R$.Reject_CLS)
                     OR ((new$Reject_CLS IS NULL) AND (R$.Reject_CLS IS NULL)
                        )
                    )
                AND (   (new$RejectCause = R$.RejectCause)
                     OR (    (new$RejectCause IS NULL)
                         AND (R$.RejectCause IS NULL)
                        )
                    )
                AND (   (new$TREASUARYDOCSTATECLS = R$.TREASUARYDOCSTATECLS)
                     OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                         AND (R$.TREASUARYDOCSTATECLS IS NULL)
                        )
                    )
                AND (   (new$DOCSTATEREF = R$.DOCSTATEREF)
                     OR (    (new$DOCSTATEREF IS NULL)
                         AND (R$.DOCSTATEREF IS NULL)
                        )
                    )
                AND (   (new$REESTR_REF = R$.REESTR_REF)
                     OR ((new$REESTR_REF IS NULL) AND (R$.REESTR_REF IS NULL)
                        )
                    )
                AND (new$SOURCEACCOUNT = R$.SOURCEACCOUNT)
                AND (new$DESTACCOUNT = R$.DESTACCOUNT)
               ) THEN
               new$AcceptDate := R$.AcceptDate;
            ELSE
               RaiseException ('EX_CANNOTUPDATECHILDDOC');
            END IF;
         END LOOP;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_32 (TR_FACIALFINCAPTION_BU_32)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$Reestr_ref IS NULL)    /* Чтобы не вызывать select чаще, чем нужно*/
                              THEN
      new$SourceDocNum := '';
      new$ReestrDate := NULL;
   ELSIF (    (new$Reestr_ref = :OLD.Reestr_ref)
          AND (new$SourceDocNum = :OLD.SourceDocNum)
          AND (new$ReestrDate = :OLD.ReestrDate)
         ) THEN
/* нужно для корректной обработки неопределенности со сравнением нуловых полей */
      NULL;
   ELSE
      BEGIN
         SELECT ffr.ReestrNumber, ffr.ReestrDate
           INTO new$SourceDocNum, new$ReestrDate
           FROM FacialFinReestr ffr
          WHERE ffr.ID = new$Reestr_ref;
      EXCEPTION
         WHEN NO_DATA_FOUND THEN
            new$SourceDocNum := NULL;
            new$ReestrDate := NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BU_60 (T_FACIALFINCAPTION_BU_60)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF ((new$progindex = 60) AND (new$Credit <> :OLD.Credit)) THEN
      UPDATE FacialFinDetail
         SET Credit = new$Credit
       WHERE (RecordIndex = new$ID);
   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_FACIALFINCAPTION_BU_70)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- При проведении реестра устанавливаем дату принятия у записи гарантии
   IF (new$SubProgIndex = 416) THEN
      UPDATE Guarantee
         SET AcceptDate = new$AcceptDate
       WHERE SubRecordIndex = new$ID;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (T_FACIALFINCAPTION_BU_100)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /* Триггер изменения данных, записи по финансированию */
   IF (    (   (:OLD.SourceFacialAcc_CLS <> new$SourceFacialAcc_CLS)
            OR (:OLD.DestFacialAcc_CLS <> new$DestFacialAcc_CLS)
           )
       AND ((new$SubProgIndex <> 1) OR (new$SubProgIndex IS NULL))
      ) THEN
      FOR R$ IN (SELECT ID, SourceFacialAcc_CLS, DestFacialAcc_CLS
                   FROM FacialFinDetail
                  WHERE RecordIndex = new$ID) LOOP
         IF (NOT (new$SourceFacialAcc_CLS = 0)) THEN
            SourceFacialAcc_CLS$ := new$SourceFacialAcc_CLS;
         ELSE
            SourceFacialAcc_CLS$ := R$.SourceFacialAcc_CLS;
         END IF;

         IF (NOT (new$DestFacialAcc_CLS = 0)) THEN
            DestFacialAcc_CLS$ := new$DestFacialAcc_CLS;
         ELSE
            DestFacialAcc_CLS$ := R$.DestFacialAcc_CLS;
         END IF;

         IF (:OLD.SourceFacialAcc_CLS <> new$SourceFacialAcc_CLS) THEN
            UPDATE FacialFinDetail
               SET SourceFacialAcc_CLS = SourceFacialAcc_CLS$,
                   RVersion = -1
             WHERE (ID = R$.ID);
         END IF;

         IF (:OLD.DestFacialAcc_CLS <> new$DestFacialAcc_CLS) THEN
            UPDATE FacialFinDetail
               SET DestFacialAcc_CLS = DestFacialAcc_CLS$,
                   RVersion = -1
             WHERE (ID = R$.ID);
         END IF;
      END LOOP;
   END IF;

   /* Если изменились поля блокировки/разблокировки средств, полученных
     от предпринимательской деятельности сносим их в деталь.*/
  IF (((NEW$IsBlocked <> :OLD.IsBlocked) OR
      ((NEW$IsBlocked IS NULL) AND (:OLD.IsBlocked IS NOT NULL)) OR
      ((NEW$IsBlocked IS NOT NULL) AND (:OLD.IsBlocked IS NULL))
     ) OR
     ((NEW$BlockedCause <> :OLD.BlockedCause) OR
      ((NEW$BlockedCause IS NULL) AND (:OLD.BlockedCause IS NOT NULL)) OR
      ((NEW$BlockedCause IS NOT NULL) AND (:OLD.BlockedCause IS NULL))
     ) OR
     ((NEW$UnBlockedDate <> :OLD.UnBlockedDate) OR
      ((NEW$UnBlockedDate IS NULL) AND (:OLD.UnBlockedDate IS NOT NULL)) OR
      ((NEW$UnBlockedDate IS NOT NULL) AND (:OLD.UnBlockedDate IS NULL))
     ) OR
     ((NEW$UnBlockedCause <> :OLD.UnBlockedCause) OR
      ((NEW$UnBlockedDate IS NULL) AND (:OLD.UnBlockedCause IS NOT NULL)) OR
      ((NEW$UnBlockedCause IS NOT NULL) AND (:OLD.UnBlockedCause IS NULL))
     )) THEN
     UPDATE FacialFinDetail ffd
     SET ffd.IsBlocked = NEW$IsBlocked, ffd.BlockedCause = NEW$BlockedCause,
         ffd.UnBlockedDate = NEW$UnBlockedDate, ffd.UnBlockedCause = NEW$UnBlockedCause
     WHERE ffd.recordindex = NEW$ID;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_FACIALFINCAPTION_BU_210)
-- Create 27.08.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /* Сохранение в базу истории изменений состояний*/
   IF (new$DOCSTATEREF <> :OLD.DOCSTATEREF) THEN
      INSERT INTO StateJumpHistory
                  (DocID, BeginStateRef, EndStateRef
                  )
           VALUES (new$ID, :OLD.DOCSTATEREF, new$DOCSTATEREF
                  );
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (T_FACIALFINCAPTION_BU_300)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IsReject1$ := -1;
  if ((:old.Reject_CLS is null)and(new$Reject_CLS is not null)) then
    IsReject1$ := 1;
      
  else
    if ((:old.Reject_CLS is not null)and(new$Reject_CLS is null)) then
      IsReject1$ := 0;
    END IF;
  END IF;
  if (IsReject1$  <> -1) then
    update LinkRecords set
    IsRejected = IsReject1$

    where
    ChildID = new$ID;
    update LinkRecords set
    IsRejected = IsReject1$

    where
    ChildID in (select d.id from FacialFinDetail d where d.RecordIndex = new$id);
      
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_FACIALFINCAPTION_BU_700)
-- Create 17.09.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_FACIALFINCAPTION SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    SOURCEDOCNUM = new$SOURCEDOCNUM,
    PAYDATE = new$PAYDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    DOCUMENTDATE = new$DOCUMENTDATE,
    REESTRDATE = new$REESTRDATE,
    CREDIT = new$CREDIT,
    SOURCEACCOUNT = new$SOURCEACCOUNT,
    SOURCEFACIALACC_CLS = new$SOURCEFACIALACC_CLS,
    DESTACCOUNT = new$DESTACCOUNT,
    DESTFACIALACC_CLS = new$DESTFACIALACC_CLS,
    PROGINDEX = new$PROGINDEX,
    ARHIVEDOC = new$ARHIVEDOC,
    PAYSYMBOLCLS = new$PAYSYMBOLCLS,
    PAYTYPECLS = new$PAYTYPECLS,
    NOTE = new$NOTE,
    PERIOD = new$PERIOD,
    PAYPRIORITY = new$PAYPRIORITY,
    TYPEOPERATIONCLS = new$TYPEOPERATIONCLS,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    RECORDINDEX = new$RECORDINDEX,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    REESTR_REF = new$REESTR_REF,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CLIENTBANKNUMBER = new$CLIENTBANKNUMBER,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    TRUSTNUMBER = new$TRUSTNUMBER,
    LINKEDDOCUMENT = new$LINKEDDOCUMENT,
    BNKRECORDID = new$BNKRECORDID,
    SUBPROGINDEX = new$SUBPROGINDEX,
    DOCUMENTSTATE = new$DOCUMENTSTATE,
    USERSVISA = new$USERSVISA,
    TREASUARYDOCSTATECLS = new$TREASUARYDOCSTATECLS,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    NDS = new$NDS,
    TAXNOTE = new$TAXNOTE,
    MANAGERBID = new$MANAGERBID,
    BIDNUMBER = new$BIDNUMBER,
    GROUPID = new$GROUPID,
    GROUPSUMMA = new$GROUPSUMMA,
    DOCSTATEREF = new$DOCSTATEREF,
    LASTEXTRCHANGE = new$LASTEXTRCHANGE,
    FAXDOCCOUNT = new$FAXDOCCOUNT,
    STIMATEID = new$STIMATEID,
    INTEGRATEDDOCREF = new$INTEGRATEDDOCREF,
    REQUESTNUMBER = new$REQUESTNUMBER,
    REQUESTDATE = new$REQUESTDATE,
    RVERSION = new$RVERSION,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    ELDOCREF = new$ELDOCREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    CLSTYPE = new$CLSTYPE,
    OPERATIONDIRECTION = new$OPERATIONDIRECTION,
    SOURCETYPE = new$SOURCETYPE,
    DESTTYPE = new$DESTTYPE,
    CARDNUMBER = new$CARDNUMBER,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO = new$CASHIERPERSONALINFO,
    BIDDATE = new$BIDDATE,
    CARDREF = new$CARDREF,
    SOURCESTOREDPAYMENTPROPS = new$SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS = new$DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE = new$STOREDPAYMENTNOTE,
    DOCCHANGEDATE = new$DOCCHANGEDATE,
    UINCODE = new$UINCODE,
    DOCOSN = new$DOCOSN,
    SIGNERS = new$SIGNERS,
    DESTCLSTYPE = new$DESTCLSTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_10 (TR_FACIALFINCAPTION_AU_10)
-- Create 05.03.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$ProgIndex = 72) THEN                       /* Для сводных платежек*/
      IF (    (   (new$AcceptDate = :OLD.AcceptDate)
               OR ((new$AcceptDate IS NULL) AND (:OLD.AcceptDate IS NULL))
              )
          AND (   (new$Reject_CLS = :OLD.Reject_CLS)
               OR ((new$Reject_CLS IS NULL) AND (:OLD.Reject_CLS IS NULL))
              )
          AND (   (new$RejectCause = :OLD.RejectCause)
               OR ((new$RejectCause IS NULL) AND (:OLD.RejectCause IS NULL))
              )
          AND (   (new$TREASUARYDOCSTATECLS = :OLD.TREASUARYDOCSTATECLS)
               OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                   AND (:OLD.TREASUARYDOCSTATECLS IS NULL)
                  )
              )
          AND (   (new$DOCSTATEREF = :OLD.DOCSTATEREF)
               OR ((new$DOCSTATEREF IS NULL) AND (:OLD.DOCSTATEREF IS NULL))
              )
          AND (   (new$REESTR_REF = :OLD.REESTR_REF)
               OR ((new$REESTR_REF IS NULL) AND (:OLD.REESTR_REF IS NULL))
              )
          AND (new$SOURCEACCOUNT = :OLD.SOURCEACCOUNT)
          AND (new$DESTACCOUNT = :OLD.DESTACCOUNT)
         ) THEN
         NULL;                /*      new$AcceptDate := :old.AcceptDate;   */
      ELSE
         /* Если изменились ключевые атрибуты, сносим их во входящие в нее*/
         UPDATE TB_FacialFinCaption
            SET AcceptDate = new$AcceptDate,
                Reject_CLS = new$Reject_CLS,
                RejectCause = new$RejectCause,
                TREASUARYDOCSTATECLS = new$TREASUARYDOCSTATECLS,
                DOCSTATEREF = new$DOCSTATEREF,
                REESTR_REF = new$REESTR_REF,
                SOURCEACCOUNT = new$SOURCEACCOUNT,
                DESTACCOUNT = new$DESTACCOUNT
          WHERE IntegratedDocRef = new$ID;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- AU_300 (TR_FACIALFINCAPTION_AU_300)
-- Create 20.02.2006
-- Last update 11.04.2007
-- - - - - - - - - - - - -

  /* если поменялась дата принятия или бух операция или тип классификации, то сносим это в деталь */
  if ((new$AcceptDate <> :old.AcceptDate)or((new$AcceptDate is not null)and(:old.AcceptDate is null))
      or((new$AcceptDate is null)and(:old.AcceptDate is not null)))
  then
    update facialfindetail set
      AcceptDate = new$AcceptDate,
      RVersion = -1
    where
      RecordIndex = new$id;
  end if;

  if (new$BuhOperationCLS <> :old.BuhOperationCLS)  then
    update facialfindetail set
      BuhOperationCLS = new$BuhOperationCLS,
      RVersion = -1
    where
      RecordIndex = new$id;
  end if;

  if (new$ClsType <> :old.ClsType) then
    if (new$ClsType = 0) then
      update facialfindetail set
        SourceKD = 0,
        DestKD = 0,
        SourceIFS = 0,
        DestIFS = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;

    if (new$ClsType = 1) then
      update facialfindetail set
        SourceKD = 0,
        DestKD = 0,
        SourceKVSR = 0,
        SourceKFSR = 0,
        SourceKCSR = 0,
        SourceKVR = 0,
        SourceKESR = 0,
        DestKVSR = 0,
        DestKFSR = 0,
        DestKCSR = 0,
        DestKVR = 0,
        DestKESR = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;
    
    if (new$ClsType = 2) then
      update facialfindetail set
        SourceIFS = 0,
        DestIFS = 0,
        SourceKVSR = 0,
        SourceKFSR = 0,
        SourceKCSR = 0,
        SourceKVR = 0,
        SourceKESR = 0,
        DestKVSR = 0,
        DestKFSR = 0,
        DestKCSR = 0,
        DestKVR = 0,
        DestKESR = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;
    
  end if;

-- - - - - - - - - - - - -
-- AU_500 (TR_FACIALFINCAPTION_AU_500)
-- Create 28.04.2005
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (:NEW.ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (23, :OLD.ID, SYSDATE);

      DELETE FROM DelRecIndexes
        WHERE (TableID = 23) AND (RecordId = :NEW.ID);
   END IF;

END;
/
commit work 
/
ALTER TRIGGER TR_FACIALFINCAPTION_BU_500 DISABLE
/
ALTER TRIGGER TR_FACIALFINDETAIL_BU_500 DISABLE
/
commit work 
/
update FacialFinCaption ffc set
  ffc.DestClsType = 0
where 
  exists 
   (select * from FacialFinDetail ffd 
  	where (ffc.id = ffd.RecordIndex) and (ffd.DestClsType = 0))
/
update FacialFinCaption ffc set
  ffc.DestClsType = 1
where 
  exists 
   (select * from FacialFinDetail ffd 
  	where (ffc.id = ffd.RecordIndex) and (ffd.DestClsType = 1))
/
update FacialFinCaption ffc set
  ffc.DestClsType = 2
where 
  exists 
   (select * from FacialFinDetail ffd 
  	where (ffc.id = ffd.RecordIndex) and (ffd.DestClsType = 2))
/
update FacialFinCaption set
  DestClsType = ClsType
where
  DestClsType is null
/
commit work 
/
ALTER TRIGGER TR_FACIALFINCAPTION_BU_500 ENABLE
/
ALTER TRIGGER TR_FACIALFINDETAIL_BU_500 ENABLE
/
commit work 
/
-- ALTER TRIGGER TR_FACIALFINCAPTION_BI
CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_II
  INSTEAD OF INSERT
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  new$ID FACIALFINCAPTION.ID%TYPE := :NEW.ID;
  new$DOCNUMBER FACIALFINCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SOURCEDOCNUM FACIALFINCAPTION.SOURCEDOCNUM%TYPE := :NEW.SOURCEDOCNUM;
  new$PAYDATE FACIALFINCAPTION.PAYDATE%TYPE := :NEW.PAYDATE;
  new$ACCEPTDATE FACIALFINCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$DOCUMENTDATE FACIALFINCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$REESTRDATE FACIALFINCAPTION.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$CREDIT FACIALFINCAPTION.CREDIT%TYPE := :NEW.CREDIT;
  new$SOURCEACCOUNT FACIALFINCAPTION.SOURCEACCOUNT%TYPE := :NEW.SOURCEACCOUNT;
  new$SOURCEFACIALACC_CLS FACIALFINCAPTION.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$DESTACCOUNT FACIALFINCAPTION.DESTACCOUNT%TYPE := :NEW.DESTACCOUNT;
  new$DESTFACIALACC_CLS FACIALFINCAPTION.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$PROGINDEX FACIALFINCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$ARHIVEDOC FACIALFINCAPTION.ARHIVEDOC%TYPE := :NEW.ARHIVEDOC;
  new$PAYSYMBOLCLS FACIALFINCAPTION.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$PAYTYPECLS FACIALFINCAPTION.PAYTYPECLS%TYPE := :NEW.PAYTYPECLS;
  new$NOTE FACIALFINCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$PERIOD FACIALFINCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$PAYPRIORITY FACIALFINCAPTION.PAYPRIORITY%TYPE := :NEW.PAYPRIORITY;
  new$TYPEOPERATIONCLS FACIALFINCAPTION.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$BUHPAYMENTCLS FACIALFINCAPTION.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$CREATERUSER FACIALFINCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF FACIALFINCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$RECORDINDEX FACIALFINCAPTION.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SENDERID FACIALFINCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REESTR_REF FACIALFINCAPTION.REESTR_REF%TYPE := :NEW.REESTR_REF;
  new$REJECT_CLS FACIALFINCAPTION.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE FACIALFINCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CLIENTBANKNUMBER FACIALFINCAPTION.CLIENTBANKNUMBER%TYPE := :NEW.CLIENTBANKNUMBER;
  new$CRYPTOSTATUS FACIALFINCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$TRUSTNUMBER FACIALFINCAPTION.TRUSTNUMBER%TYPE := :NEW.TRUSTNUMBER;
  new$LINKEDDOCUMENT FACIALFINCAPTION.LINKEDDOCUMENT%TYPE := :NEW.LINKEDDOCUMENT;
  new$BNKRECORDID FACIALFINCAPTION.BNKRECORDID%TYPE := :NEW.BNKRECORDID;
  new$SUBPROGINDEX FACIALFINCAPTION.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$DOCUMENTSTATE FACIALFINCAPTION.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA FACIALFINCAPTION.USERSVISA%TYPE := :NEW.USERSVISA;
  new$TREASUARYDOCSTATECLS FACIALFINCAPTION.TREASUARYDOCSTATECLS%TYPE := :NEW.TREASUARYDOCSTATECLS;
  new$DEPARTMENTCLS FACIALFINCAPTION.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$NDS FACIALFINCAPTION.NDS%TYPE := :NEW.NDS;
  new$TAXNOTE FACIALFINCAPTION.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$MANAGERBID FACIALFINCAPTION.MANAGERBID%TYPE := :NEW.MANAGERBID;
  new$BIDNUMBER FACIALFINCAPTION.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$GROUPID FACIALFINCAPTION.GROUPID%TYPE := :NEW.GROUPID;
  new$GROUPSUMMA FACIALFINCAPTION.GROUPSUMMA%TYPE := :NEW.GROUPSUMMA;
  new$DOCSTATEREF FACIALFINCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$LASTEXTRCHANGE FACIALFINCAPTION.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$FAXDOCCOUNT FACIALFINCAPTION.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$STIMATEID FACIALFINCAPTION.STIMATEID%TYPE := :NEW.STIMATEID;
  new$INTEGRATEDDOCREF FACIALFINCAPTION.INTEGRATEDDOCREF%TYPE := :NEW.INTEGRATEDDOCREF;
  new$REQUESTNUMBER FACIALFINCAPTION.REQUESTNUMBER%TYPE := :NEW.REQUESTNUMBER;
  new$REQUESTDATE FACIALFINCAPTION.REQUESTDATE%TYPE := :NEW.REQUESTDATE;
  new$RVERSION FACIALFINCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$FEDERALFUNDSREF FACIALFINCAPTION.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$ELDOCREF FACIALFINCAPTION.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$BUHOPERATIONCLS FACIALFINCAPTION.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CLSTYPE FACIALFINCAPTION.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$OPERATIONDIRECTION FACIALFINCAPTION.OPERATIONDIRECTION%TYPE := :NEW.OPERATIONDIRECTION;
  new$SOURCETYPE FACIALFINCAPTION.SOURCETYPE%TYPE := :NEW.SOURCETYPE;
  new$DESTTYPE FACIALFINCAPTION.DESTTYPE%TYPE := :NEW.DESTTYPE;
  new$CARDNUMBER FACIALFINCAPTION.CARDNUMBER%TYPE := :NEW.CARDNUMBER;
  new$ISBLOCKED FACIALFINCAPTION.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINCAPTION.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINCAPTION.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINCAPTION.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$CASHIERPERSONALINFO FACIALFINCAPTION.CASHIERPERSONALINFO%TYPE := :NEW.CASHIERPERSONALINFO;
  new$BIDDATE FACIALFINCAPTION.BIDDATE%TYPE := :NEW.BIDDATE;
  new$CARDREF FACIALFINCAPTION.CARDREF%TYPE := :NEW.CARDREF;
  new$SOURCESTOREDPAYMENTPROPS FACIALFINCAPTION.SOURCESTOREDPAYMENTPROPS%TYPE := :NEW.SOURCESTOREDPAYMENTPROPS;
  new$DESTSTOREDPAYMENTPROPS FACIALFINCAPTION.DESTSTOREDPAYMENTPROPS%TYPE := :NEW.DESTSTOREDPAYMENTPROPS;
  new$STOREDPAYMENTNOTE FACIALFINCAPTION.STOREDPAYMENTNOTE%TYPE := :NEW.STOREDPAYMENTNOTE;
  new$DOCCHANGEDATE FACIALFINCAPTION.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
  new$UINCODE FACIALFINCAPTION.UINCODE%TYPE := :NEW.UINCODE;
  new$DOCOSN FACIALFINCAPTION.DOCOSN%TYPE := :NEW.DOCOSN;
  new$SIGNERS FACIALFINCAPTION.SIGNERS%TYPE := :NEW.SIGNERS;
  new$DESTCLSTYPE FACIALFINCAPTION.DESTCLSTYPE%TYPE := :NEW.DESTCLSTYPE;
--
  UseFax$ NUMBER(10);
  pdt$ NUMBER(10);
  reestrAccepted1$ NUMBER(10);
  DocNumber$ NUMBER(10);
  CmpFacialAcc_Cls$ NUMBER(10);
  PIndex1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FACIALFINCAPTION_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$credit is null)then 
    new$credit:= 0;
  END IF;
  if (new$ArhiveDoc is null) then 
    new$ArhiveDoc:= 0;
  END IF;
  if (new$PayTypeCls is null) then 
    new$PayTypeCls:= 0;
  END IF;
  if (new$BuhPaymentCls is null) then 
    new$BuhPaymentCls:= 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 0;
  END IF;
  if (new$DestClsType is null) then 
    new$DestClsType := new$ClsType;
  END IF;
  if (new$SourceFacialAcc_CLS is null) then 
    new$SourceFacialAcc_CLS:= 0;
  END IF;
  if (new$DestFacialAcc_CLS is null) then 
    new$DestFacialAcc_CLS:= 0;
  END IF;
  if (new$FaxDocCount is null) then 
    new$FaxDocCount := 0;
  END IF;
  if (new$OperationDirection is null) then 
    new$OperationDirection := 0;
  END IF;
  if (new$OperationDirection = 0) then
    new$SourceType := 1;
    new$DestType := 1;
     
  else
    if (new$OperationDirection = 1) then
      new$SourceType := 1;
      new$DestType := -1;
         
    else
      if (new$OperationDirection = 2) then
        new$SourceType := -1;
        new$DestType := 1;
             
      else
        new$SourceType := -1;
        new$DestType := -1;
             
      END IF;
    END IF;
  END IF;
  if (new$DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber$); 
    if (DocNumber$ is null) then 
      new$DepartmentCls:= 0;
           
    else 
      new$DepartmentCls:= DocNumber$;
       
    END IF;
  END IF;
   
  /* Заполнение Бюджета. Если пустой или ноль, берем из лицевого счета */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    PIndex1$ := new$ProgIndex;
    if (PIndex1$=60) then 
      CmpFacialAcc_Cls$ := new$SourceFacialAcc_CLS;         /* Приход средств от фин.органа*/
    END IF;
    if (PIndex1$=61) then 
      CmpFacialAcc_Cls$ := new$DestFacialAcc_CLS;           /* Приход средств от прочих и восстановление расходов*/
    END IF;
    if (PIndex1$=62) then 
      CmpFacialAcc_Cls$ := new$DestFacialAcc_CLS;           /* Приход средств по объявлениям*/
    END IF;
    if (PIndex1$=63) then 
      CmpFacialAcc_Cls$ := new$SourceFacialAcc_CLS;         /* Уход средств по платежным поручениям*/
    END IF;
    if (PIndex1$=64) then 
      CmpFacialAcc_Cls$ := new$SourceFacialAcc_CLS;         /* Уход средств по чекам*/
    END IF;
    if (PIndex1$=65) then 
      CmpFacialAcc_Cls$ := new$DestFacialAcc_CLS;           /* Переброска средств, Разассигновка*/
    END IF;
    if (PIndex1$=66) then 
      CmpFacialAcc_Cls$ := new$SourceFacialAcc_CLS;         /* Внутренняя переброска средств, один - многим*/
    END IF;
    if (PIndex1$=67) then 
      CmpFacialAcc_Cls$ := new$SourceFacialAcc_CLS;         /* Уход средств в районы*/
    END IF;
    if (PIndex1$=68) then 
      CmpFacialAcc_Cls$ := new$DestFacialAcc_CLS;           /* Перечисление на р\с районов*/
    END IF;
    if (PIndex1$=69) then 
      CmpFacialAcc_Cls$ := new$DestFacialAcc_CLS;           /* Подтверждение перечисления на р\с районов*/
    END IF;
    if (PIndex1$=70) then 
      CmpFacialAcc_Cls$ := new$SourceFacialAcc_CLS;         /* Возврат с р\с районов*/
    END IF;
    if (PIndex1$=71) then 
      CmpFacialAcc_Cls$ := new$DestFacialAcc_CLS;           /* Подтверждение возврата с р\с районов*/
    END IF;
    if (PIndex1$=73) then 
      CmpFacialAcc_Cls$ := new$SourceFacialAcc_CLS;         /* Учет кассовых выбытий*/
    END IF;
    if (PIndex1$=75) then 
      CmpFacialAcc_Cls$ := new$DestFacialAcc_CLS;           /* Утверждение ОФ*/
    END IF;
    if (PIndex1$=76) then 
      CmpFacialAcc_Cls$ := new$SourceFacialAcc_CLS;         /* Распределение ОФ*/
    END IF;
    BEGIN

      select fa.BudgetRef      into new$BudgetRef from FacialAcc_Cls fa
      where fa.Id = CmpFacialAcc_Cls$

      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  /* Если пустой или ноль, берем из константы */
  if ((new$BudgetRef is null) or (new$BudgetRef = 0))
  then 
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$AcceptDate is not null) and (new$Reject_CLS is not null )) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BI_1 (TR_FACIALFINCAPTION_BI_1)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- Инициализация значений по-умолчанию для добавляемых полей на вставку
   IF (new$GroupID IS NULL) THEN new$GroupID := new$ID; END IF;
   IF (new$GroupSumma IS NULL) THEN new$GroupSumma := 0; END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_FACIALFINCAPTION_BI_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (((new$progIndex = 63) or (new$progIndex = 64) or
  (new$progIndex = 68) or (new$progIndex = 70))
  and (new$REESTR_REF is not null)) then
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id = new$REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrInsert');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_16 (TR_FACIALFINCAPTION_BI_16)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /*  Вставляется запись по новой схеме. Делаем сноску в FacialFinCaption
     даты и номера реестра из таблицы реестров по ссылке*/
   IF (new$Reestr_ref IS NULL) THEN
      new$SourceDocNum := '';
      new$ReestrDate := NULL;
   ELSE
      BEGIN
         SELECT ffr.ReestrNumber, ffr.ReestrDate
           INTO new$SourceDocNum, new$ReestrDate
           FROM FacialFinReestr ffr
          WHERE ffr.ID = new$Reestr_ref;
      EXCEPTION
         WHEN NO_DATA_FOUND THEN
            new$SourceDocNum := NULL;
            new$ReestrDate := NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BI_430 (TR_FACIALFINCAPTION_BI_430)
-- Create 04.12.2004
-- Last update 11.10.2006
-- - - - - - - - - - - - -

  IF (NEW$SenderID IS NOT NULL) THEN
    pdt$ := NULL;
    IF (NEW$progindex = 63) THEN pdt$ := 302; END IF;
    IF (NEW$progindex = 66) THEN pdt$ := 301; END IF;
    IF (NEW$progindex = 64) THEN pdt$ := 304; END IF;

    /*  Платежное поручение получено из УРМ */
    GetIntConst(30, 19, UseFax$);
    IF ((new$BidNumber IS NULL) AND (UseFax$ = 1)) THEN
      new$BidNumber := new$DocNumber;
    END IF;
    SELECT COUNT(*) INTO new$FaxDocCount
    FROM FaxDocs
      WHERE (OwnerDocNumber=new$BidNumber)
        AND (ClientID=new$SenderID)
        AND (FacialAcc_Cls=new$SourceFacialAcc_CLS)
        AND (OwnerDate = new$DocumentDate)
        AND (PrimaryDocType = PDT$);
  ELSE
    new$FaxDocCount := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_FACIALFINCAPTION_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$DocChangeDate := new$UpdateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_FACIALFINCAPTION (
    ID,
    DOCNUMBER,
    SOURCEDOCNUM,
    PAYDATE,
    ACCEPTDATE,
    DOCUMENTDATE,
    REESTRDATE,
    CREDIT,
    SOURCEACCOUNT,
    SOURCEFACIALACC_CLS,
    DESTACCOUNT,
    DESTFACIALACC_CLS,
    PROGINDEX,
    ARHIVEDOC,
    PAYSYMBOLCLS,
    PAYTYPECLS,
    NOTE,
    PERIOD,
    PAYPRIORITY,
    TYPEOPERATIONCLS,
    BUHPAYMENTCLS,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    RECORDINDEX,
    SENDERID,
    SENDERRECORDID,
    REESTR_REF,
    REJECT_CLS,
    REJECTCAUSE,
    CLIENTBANKNUMBER,
    CRYPTOSTATUS,
    TRUSTNUMBER,
    LINKEDDOCUMENT,
    BNKRECORDID,
    SUBPROGINDEX,
    DOCUMENTSTATE,
    USERSVISA,
    TREASUARYDOCSTATECLS,
    DEPARTMENTCLS,
    NDS,
    TAXNOTE,
    MANAGERBID,
    BIDNUMBER,
    GROUPID,
    GROUPSUMMA,
    DOCSTATEREF,
    LASTEXTRCHANGE,
    FAXDOCCOUNT,
    STIMATEID,
    INTEGRATEDDOCREF,
    REQUESTNUMBER,
    REQUESTDATE,
    RVERSION,
    FEDERALFUNDSREF,
    ELDOCREF,
    BUHOPERATIONCLS,
    CLSTYPE,
    OPERATIONDIRECTION,
    SOURCETYPE,
    DESTTYPE,
    CARDNUMBER,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO,
    BIDDATE,
    CARDREF,
    SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE,
    DOCCHANGEDATE,
    UINCODE,
    DOCOSN,
    SIGNERS,
    DESTCLSTYPE
  ) VALUES (
    new$ID,
    new$DOCNUMBER,
    new$SOURCEDOCNUM,
    new$PAYDATE,
    new$ACCEPTDATE,
    new$DOCUMENTDATE,
    new$REESTRDATE,
    new$CREDIT,
    new$SOURCEACCOUNT,
    new$SOURCEFACIALACC_CLS,
    new$DESTACCOUNT,
    new$DESTFACIALACC_CLS,
    new$PROGINDEX,
    new$ARHIVEDOC,
    new$PAYSYMBOLCLS,
    new$PAYTYPECLS,
    new$NOTE,
    new$PERIOD,
    new$PAYPRIORITY,
    new$TYPEOPERATIONCLS,
    new$BUHPAYMENTCLS,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$RECORDINDEX,
    new$SENDERID,
    new$SENDERRECORDID,
    new$REESTR_REF,
    new$REJECT_CLS,
    new$REJECTCAUSE,
    new$CLIENTBANKNUMBER,
    new$CRYPTOSTATUS,
    new$TRUSTNUMBER,
    new$LINKEDDOCUMENT,
    new$BNKRECORDID,
    new$SUBPROGINDEX,
    new$DOCUMENTSTATE,
    new$USERSVISA,
    new$TREASUARYDOCSTATECLS,
    new$DEPARTMENTCLS,
    new$NDS,
    new$TAXNOTE,
    new$MANAGERBID,
    new$BIDNUMBER,
    new$GROUPID,
    new$GROUPSUMMA,
    new$DOCSTATEREF,
    new$LASTEXTRCHANGE,
    new$FAXDOCCOUNT,
    new$STIMATEID,
    new$INTEGRATEDDOCREF,
    new$REQUESTNUMBER,
    new$REQUESTDATE,
    new$RVERSION,
    new$FEDERALFUNDSREF,
    new$ELDOCREF,
    new$BUHOPERATIONCLS,
    new$CLSTYPE,
    new$OPERATIONDIRECTION,
    new$SOURCETYPE,
    new$DESTTYPE,
    new$CARDNUMBER,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$CASHIERPERSONALINFO,
    new$BIDDATE,
    new$CARDREF,
    new$SOURCESTOREDPAYMENTPROPS,
    new$DESTSTOREDPAYMENTPROPS,
    new$STOREDPAYMENTNOTE,
    new$DOCCHANGEDATE,
    new$UINCODE,
    new$DOCOSN,
    new$SIGNERS,
    new$DESTCLSTYPE);

-- - - - - - - - - - - - -
-- AI_430 (TR_FACIALFINCAPTION_AI_430)
-- Create 04.12.2004
-- Last update 11.10.2006
-- - - - - - - - - - - - -

  IF (new$SenderID IS NOT NULL) THEN
      /*  Платежное поручение получено из УРМ */
      pdt$ := NULL;
      IF (new$progindex = 63) THEN pdt$ := 302; END IF;
      IF (new$progindex = 66) THEN pdt$ := 301; END IF;
      IF (new$progindex = 64) THEN pdt$ := 304; END IF;

        UPDATE FaxDocs
            SET OwnerId=new$id
        WHERE
            (OwnerDocNumber=new$BidNumber)
            AND (ClientID=new$SenderID)
            AND (FacialAcc_Cls=new$SourceFacialAcc_CLS)
            AND (OwnerDate = new$DocumentDate)
            AND (primarydoctype = pdt$);
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_FACIALFINCAPTION_AI_500)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   DELETE FROM DelRecIndexes
     WHERE (TableID = 23) AND (RecordID = new$ID);

END;
/
-- ALTER TRIGGER TR_FACIALFINCAPTION_BU
CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_IU
  INSTEAD OF UPDATE
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  new$ID FACIALFINCAPTION.ID%TYPE := :NEW.ID;
  new$DOCNUMBER FACIALFINCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SOURCEDOCNUM FACIALFINCAPTION.SOURCEDOCNUM%TYPE := :NEW.SOURCEDOCNUM;
  new$PAYDATE FACIALFINCAPTION.PAYDATE%TYPE := :NEW.PAYDATE;
  new$ACCEPTDATE FACIALFINCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$DOCUMENTDATE FACIALFINCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$REESTRDATE FACIALFINCAPTION.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$CREDIT FACIALFINCAPTION.CREDIT%TYPE := :NEW.CREDIT;
  new$SOURCEACCOUNT FACIALFINCAPTION.SOURCEACCOUNT%TYPE := :NEW.SOURCEACCOUNT;
  new$SOURCEFACIALACC_CLS FACIALFINCAPTION.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$DESTACCOUNT FACIALFINCAPTION.DESTACCOUNT%TYPE := :NEW.DESTACCOUNT;
  new$DESTFACIALACC_CLS FACIALFINCAPTION.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$PROGINDEX FACIALFINCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$ARHIVEDOC FACIALFINCAPTION.ARHIVEDOC%TYPE := :NEW.ARHIVEDOC;
  new$PAYSYMBOLCLS FACIALFINCAPTION.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$PAYTYPECLS FACIALFINCAPTION.PAYTYPECLS%TYPE := :NEW.PAYTYPECLS;
  new$NOTE FACIALFINCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$PERIOD FACIALFINCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$PAYPRIORITY FACIALFINCAPTION.PAYPRIORITY%TYPE := :NEW.PAYPRIORITY;
  new$TYPEOPERATIONCLS FACIALFINCAPTION.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$BUHPAYMENTCLS FACIALFINCAPTION.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$CREATERUSER FACIALFINCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF FACIALFINCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$RECORDINDEX FACIALFINCAPTION.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SENDERID FACIALFINCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REESTR_REF FACIALFINCAPTION.REESTR_REF%TYPE := :NEW.REESTR_REF;
  new$REJECT_CLS FACIALFINCAPTION.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE FACIALFINCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CLIENTBANKNUMBER FACIALFINCAPTION.CLIENTBANKNUMBER%TYPE := :NEW.CLIENTBANKNUMBER;
  new$CRYPTOSTATUS FACIALFINCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$TRUSTNUMBER FACIALFINCAPTION.TRUSTNUMBER%TYPE := :NEW.TRUSTNUMBER;
  new$LINKEDDOCUMENT FACIALFINCAPTION.LINKEDDOCUMENT%TYPE := :NEW.LINKEDDOCUMENT;
  new$BNKRECORDID FACIALFINCAPTION.BNKRECORDID%TYPE := :NEW.BNKRECORDID;
  new$SUBPROGINDEX FACIALFINCAPTION.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$DOCUMENTSTATE FACIALFINCAPTION.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA FACIALFINCAPTION.USERSVISA%TYPE := :NEW.USERSVISA;
  new$TREASUARYDOCSTATECLS FACIALFINCAPTION.TREASUARYDOCSTATECLS%TYPE := :NEW.TREASUARYDOCSTATECLS;
  new$DEPARTMENTCLS FACIALFINCAPTION.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$NDS FACIALFINCAPTION.NDS%TYPE := :NEW.NDS;
  new$TAXNOTE FACIALFINCAPTION.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$MANAGERBID FACIALFINCAPTION.MANAGERBID%TYPE := :NEW.MANAGERBID;
  new$BIDNUMBER FACIALFINCAPTION.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$GROUPID FACIALFINCAPTION.GROUPID%TYPE := :NEW.GROUPID;
  new$GROUPSUMMA FACIALFINCAPTION.GROUPSUMMA%TYPE := :NEW.GROUPSUMMA;
  new$DOCSTATEREF FACIALFINCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$LASTEXTRCHANGE FACIALFINCAPTION.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$FAXDOCCOUNT FACIALFINCAPTION.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$STIMATEID FACIALFINCAPTION.STIMATEID%TYPE := :NEW.STIMATEID;
  new$INTEGRATEDDOCREF FACIALFINCAPTION.INTEGRATEDDOCREF%TYPE := :NEW.INTEGRATEDDOCREF;
  new$REQUESTNUMBER FACIALFINCAPTION.REQUESTNUMBER%TYPE := :NEW.REQUESTNUMBER;
  new$REQUESTDATE FACIALFINCAPTION.REQUESTDATE%TYPE := :NEW.REQUESTDATE;
  new$RVERSION FACIALFINCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$FEDERALFUNDSREF FACIALFINCAPTION.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$ELDOCREF FACIALFINCAPTION.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$BUHOPERATIONCLS FACIALFINCAPTION.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CLSTYPE FACIALFINCAPTION.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$OPERATIONDIRECTION FACIALFINCAPTION.OPERATIONDIRECTION%TYPE := :NEW.OPERATIONDIRECTION;
  new$SOURCETYPE FACIALFINCAPTION.SOURCETYPE%TYPE := :NEW.SOURCETYPE;
  new$DESTTYPE FACIALFINCAPTION.DESTTYPE%TYPE := :NEW.DESTTYPE;
  new$CARDNUMBER FACIALFINCAPTION.CARDNUMBER%TYPE := :NEW.CARDNUMBER;
  new$ISBLOCKED FACIALFINCAPTION.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINCAPTION.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINCAPTION.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINCAPTION.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$CASHIERPERSONALINFO FACIALFINCAPTION.CASHIERPERSONALINFO%TYPE := :NEW.CASHIERPERSONALINFO;
  new$BIDDATE FACIALFINCAPTION.BIDDATE%TYPE := :NEW.BIDDATE;
  new$CARDREF FACIALFINCAPTION.CARDREF%TYPE := :NEW.CARDREF;
  new$SOURCESTOREDPAYMENTPROPS FACIALFINCAPTION.SOURCESTOREDPAYMENTPROPS%TYPE := :NEW.SOURCESTOREDPAYMENTPROPS;
  new$DESTSTOREDPAYMENTPROPS FACIALFINCAPTION.DESTSTOREDPAYMENTPROPS%TYPE := :NEW.DESTSTOREDPAYMENTPROPS;
  new$STOREDPAYMENTNOTE FACIALFINCAPTION.STOREDPAYMENTNOTE%TYPE := :NEW.STOREDPAYMENTNOTE;
  new$DOCCHANGEDATE FACIALFINCAPTION.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
  new$UINCODE FACIALFINCAPTION.UINCODE%TYPE := :NEW.UINCODE;
  new$DOCOSN FACIALFINCAPTION.DOCOSN%TYPE := :NEW.DOCOSN;
  new$SIGNERS FACIALFINCAPTION.SIGNERS%TYPE := :NEW.SIGNERS;
  new$DESTCLSTYPE FACIALFINCAPTION.DESTCLSTYPE%TYPE := :NEW.DESTCLSTYPE;
--
  SourceFacialAcc_CLS$ NUMBER(10);
  DestFacialAcc_CLS$ NUMBER(10);
  CNT$1 NUMBER(10);
  reestrAccepted1$ NUMBER(10);
  IsReject1$ NUMBER(10);
  UseFax$ NUMBER(10);
  DocNumber$ NUMBER(10);
  DetCount$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_FACIALFINCAPTION_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$SenderID is not null) then 
    /* Платежное поручение получено из УРМ */
    GetIntConst(30, 19,UseFax$);
    if ((new$BidNumber is null) and (UseFax$ = 1)) then 
      new$BidNumber:= new$DocNumber;
      
    END IF;
  END IF;
  if (new$credit is null)then 
    new$credit:= 0;
  END IF;
  if (new$ArhiveDoc is null) then 
    new$ArhiveDoc:= 0;
  END IF;
  if (new$PayTypeCls is null) then 
    new$PayTypeCls:= 0;
  END IF;
  if (new$BuhPaymentCls is null) then 
    new$BuhPaymentCls:= 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 0;
  END IF;
  if (new$DestClsType is null) then 
    new$DestClsType := new$ClsType;
  END IF;
  if (new$SourceFacialAcc_CLS is null) then 
    new$SourceFacialAcc_CLS:= 0;
  END IF;
  if (new$DestFacialAcc_CLS is null) then 
    new$DestFacialAcc_CLS:= 0;
  END IF;
  if (new$FaxDocCount is null) then 
    new$FaxDocCount := 0;
  END IF;
  if (new$OperationDirection is null) then 
    new$OperationDirection := 0;
  END IF;
  if (new$OperationDirection <> :old.OperationDirection) then
    if (new$OperationDirection = 0) then
      new$SourceType := 1;
      new$DestType := 1;
          
    else
      if (new$OperationDirection = 1) then
        new$SourceType := 1;
        new$DestType := -1;
              
      else
        if (new$OperationDirection = 2) then
          new$SourceType := -1;
          new$DestType := 1;
                  
        else
          new$SourceType := -1;
          new$DestType := -1;
                  
        END IF;
      END IF;  
    END IF;
  END IF;
  if (new$DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber$); 
    if (DocNumber$ is null) then 
      new$DepartmentCls:= 0;
          
    else 
      new$DepartmentCls:= DocNumber$;
      
    END IF;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      select count(ID)       into DetCount$ from FacialFinDetail where RecordIndex = :old.ID
      ;
      if (DetCount$ > 0) then 
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$AcceptDate is not null) and (new$Reject_Cls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_FACIALFINCAPTION_BU_1)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- Инициализация значений по-умолчанию для добавляемых полей на изменение
   IF (new$GroupID IS NULL) THEN new$GroupID := new$ID; END IF;
   IF (new$GroupSumma IS NULL) THEN new$GroupSumma := 0; END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_FACIALFINCAPTION_BU_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (not (    ((new$progindex = 63) or (new$progindex = 64) or (new$progindex = 68) or (new$progindex = 70))
  and (   (((new$credit - :old.credit)>0.001)or((new$credit - :old.credit)<-0.001))
  or (new$sourcefacialacc_cls <> :old.sourcefacialacc_cls)
  or (
  ((new$sourceaccount is null) and (:old.sourceaccount is not null)) or
  ((new$sourceaccount is not null) and (:old.sourceaccount is null)) or
  ((new$sourceaccount <> :old.sourceaccount ) and (:old.sourceaccount is not null) and (new$sourceaccount is not null))                                             
  )
  or (
  ((new$destaccount is null) and (:old.destaccount is not null)) or
  ((new$destaccount is not null) and (:old.destaccount is null)) or
  ((new$destaccount <> :old.destaccount ) and (:old.destaccount is not null) and (new$destaccount is not null))
  )
  or (    (:old.reestr_ref is null)
  and (new$reestr_ref is not null)
  )
  or (    (:old.reestr_ref is not null)
  and (new$reestr_ref is null)
  )
  or (:old.reestr_ref <> new$reestr_ref)
  )
  )
  )
  then /* для корректной обработки неопределенности с NULL полями*/
    reestrAccepted1$ := 0;  /* заглушка для IB 4.2 */
      
  else 
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id=new$REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrUpdate');
    END IF;
    BEGIN

      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where
      id=:old.REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrUpdate');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_6 (TR_FACIALFINCAPTION_BU_6)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:old.ProgIndex in(63,68,70)) then /* только для исходящих платежек*/
    SELECT COUNT(id ) INTO CNT$1
    from paydocexchange where ((paydocref=:old.id)and(status<>0)and(CodeFormat<>50)) AND (ROWNUM = 1);
    if ((CNT$1<> 0)) then
      if(/* (new.DOCNUMBER<>old.DOCNUMBER) or ((new.DOCNUMBER is NULL)and(not old.DOCNUMBER is NULL)) or ((old.DOCNUMBER is NULL)and(not new.DOCNUMBER is NULL)) or*/
      (new$SOURCEDOCNUM<>:old.SOURCEDOCNUM) or ((new$SOURCEDOCNUM is NULL)and(not :old.SOURCEDOCNUM is NULL)) or ((:old.SOURCEDOCNUM is NULL)and(not new$SOURCEDOCNUM is NULL)) or
      (new$PAYDATE<>:old.PAYDATE) or ((new$PAYDATE is NULL)and(not :old.PAYDATE is NULL)) or ((:old.PAYDATE is NULL)and(not new$PAYDATE is NULL))or
      /* (new.DOCUMENTDATE<>old.DOCUMENTDATE) or ((new.DOCUMENTDATE is NULL)and(not old.DOCUMENTDATE is NULL)) or ((old.DOCUMENTDATE is NULL)and(not new.DOCUMENTDATE is NULL))or*/
      (new$REESTRDATE<>:old.REESTRDATE) or ((new$REESTRDATE is NULL)and(not :old.REESTRDATE is NULL)) or ((:old.REESTRDATE is NULL)and(not new$REESTRDATE is NULL))or
      (((new$credit - :old.credit)>0.001)or((new$credit - :old.credit)<-0.001)) or
      (new$SOURCEACCOUNT<>:old.SOURCEACCOUNT) or
      (new$DESTACCOUNT<>:old.DESTACCOUNT) or
      (new$PAYTYPECLS<>:old.PAYTYPECLS) or
      (new$NOTE<>:old.NOTE) or  ((new$NOTE is NULL)and(not :old.NOTE is NULL)) or ((:old.NOTE is NULL)and(not new$NOTE is NULL))or
      (new$PAYPRIORITY<>:old.PAYPRIORITY) or ((new$PAYPRIORITY is NULL)and(not :old.PAYPRIORITY is NULL)) or ((:old.PAYPRIORITY is NULL)and(not new$PAYPRIORITY is NULL))or
      (new$REESTR_REF<>:old.REESTR_REF) or ((new$REESTR_REF is NULL)and(not :old.REESTR_REF is NULL)) or ((:old.REESTR_REF is NULL)and(not new$REESTR_REF is NULL))or
      (new$NDS<>:old.NDS) or ((new$NDS is NULL)and(not :old.NDS is NULL)) or ((:old.NDS is NULL)and(not new$NDS is NULL))or
      (new$TAXNOTE<>:old.TAXNOTE) or ((new$TAXNOTE is NULL)and(not :old.TAXNOTE is NULL)) or ((:old.TAXNOTE is NULL)and(not new$TAXNOTE is NULL)) )then
        RaiseException('ex_CannotChangeSended');
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_FACIALFINCAPTION_BU_10)
-- Create 16.03.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$IntegratedDocRef IS NOT NULL) THEN
        /* Если документ входит в сводный и у него изменились ключевые аттрибуты, то нельзя их менять если они отличаются
      /* от атрибутов родительского документа*/
      IF (    (   (new$AcceptDate = :OLD.AcceptDate)
               OR ((new$AcceptDate IS NULL) AND (:OLD.AcceptDate IS NULL))
              )
          AND (   (new$Reject_CLS = :OLD.Reject_CLS)
               OR ((new$Reject_CLS IS NULL) AND (:OLD.Reject_CLS IS NULL))
              )
          AND (   (new$RejectCause = :OLD.RejectCause)
               OR ((new$RejectCause IS NULL) AND (:OLD.RejectCause IS NULL))
              )
          AND (   (new$TREASUARYDOCSTATECLS = :OLD.TREASUARYDOCSTATECLS)
               OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                   AND (:OLD.TREASUARYDOCSTATECLS IS NULL)
                  )
              )
          AND (   (new$DOCSTATEREF = :OLD.DOCSTATEREF)
               OR ((new$DOCSTATEREF IS NULL) AND (:OLD.DOCSTATEREF IS NULL))
              )
          AND (   (new$REESTR_REF = :OLD.REESTR_REF)
               OR ((new$REESTR_REF IS NULL) AND (:OLD.REESTR_REF IS NULL))
              )
          AND (new$SOURCEACCOUNT = :OLD.SOURCEACCOUNT)
          AND (new$DESTACCOUNT = :OLD.DESTACCOUNT)
         ) THEN
         new$AcceptDate := :OLD.AcceptDate;
      ELSE
         FOR R$ IN (SELECT fc.AcceptDate, fc.Reject_CLS, fc.RejectCause,
                           fc.TREASUARYDOCSTATECLS, fc.DOCSTATEREF,
                           fc.REESTR_REF, fc.SOURCEACCOUNT, fc.DESTACCOUNT
                      FROM FacialFinCaption fc
                     WHERE (fc.ID = :NEW.IntegratedDocRef)) LOOP
            IF (    (   (new$AcceptDate = R$.AcceptDate)
                     OR ((new$AcceptDate IS NULL) AND (R$.AcceptDate IS NULL)
                        )
                    )
                AND (   (new$Reject_CLS = R$.Reject_CLS)
                     OR ((new$Reject_CLS IS NULL) AND (R$.Reject_CLS IS NULL)
                        )
                    )
                AND (   (new$RejectCause = R$.RejectCause)
                     OR (    (new$RejectCause IS NULL)
                         AND (R$.RejectCause IS NULL)
                        )
                    )
                AND (   (new$TREASUARYDOCSTATECLS = R$.TREASUARYDOCSTATECLS)
                     OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                         AND (R$.TREASUARYDOCSTATECLS IS NULL)
                        )
                    )
                AND (   (new$DOCSTATEREF = R$.DOCSTATEREF)
                     OR (    (new$DOCSTATEREF IS NULL)
                         AND (R$.DOCSTATEREF IS NULL)
                        )
                    )
                AND (   (new$REESTR_REF = R$.REESTR_REF)
                     OR ((new$REESTR_REF IS NULL) AND (R$.REESTR_REF IS NULL)
                        )
                    )
                AND (new$SOURCEACCOUNT = R$.SOURCEACCOUNT)
                AND (new$DESTACCOUNT = R$.DESTACCOUNT)
               ) THEN
               new$AcceptDate := R$.AcceptDate;
            ELSE
               RaiseException ('EX_CANNOTUPDATECHILDDOC');
            END IF;
         END LOOP;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_32 (TR_FACIALFINCAPTION_BU_32)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$Reestr_ref IS NULL)    /* Чтобы не вызывать select чаще, чем нужно*/
                              THEN
      new$SourceDocNum := '';
      new$ReestrDate := NULL;
   ELSIF (    (new$Reestr_ref = :OLD.Reestr_ref)
          AND (new$SourceDocNum = :OLD.SourceDocNum)
          AND (new$ReestrDate = :OLD.ReestrDate)
         ) THEN
/* нужно для корректной обработки неопределенности со сравнением нуловых полей */
      NULL;
   ELSE
      BEGIN
         SELECT ffr.ReestrNumber, ffr.ReestrDate
           INTO new$SourceDocNum, new$ReestrDate
           FROM FacialFinReestr ffr
          WHERE ffr.ID = new$Reestr_ref;
      EXCEPTION
         WHEN NO_DATA_FOUND THEN
            new$SourceDocNum := NULL;
            new$ReestrDate := NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BU_60 (T_FACIALFINCAPTION_BU_60)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF ((new$progindex = 60) AND (new$Credit <> :OLD.Credit)) THEN
      UPDATE FacialFinDetail
         SET Credit = new$Credit
       WHERE (RecordIndex = new$ID);
   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_FACIALFINCAPTION_BU_70)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- При проведении реестра устанавливаем дату принятия у записи гарантии
   IF (new$SubProgIndex = 416) THEN
      UPDATE Guarantee
         SET AcceptDate = new$AcceptDate
       WHERE SubRecordIndex = new$ID;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (T_FACIALFINCAPTION_BU_100)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /* Триггер изменения данных, записи по финансированию */
   IF (    (   (:OLD.SourceFacialAcc_CLS <> new$SourceFacialAcc_CLS)
            OR (:OLD.DestFacialAcc_CLS <> new$DestFacialAcc_CLS)
           )
       AND ((new$SubProgIndex <> 1) OR (new$SubProgIndex IS NULL))
      ) THEN
      FOR R$ IN (SELECT ID, SourceFacialAcc_CLS, DestFacialAcc_CLS
                   FROM FacialFinDetail
                  WHERE RecordIndex = new$ID) LOOP
         IF (NOT (new$SourceFacialAcc_CLS = 0)) THEN
            SourceFacialAcc_CLS$ := new$SourceFacialAcc_CLS;
         ELSE
            SourceFacialAcc_CLS$ := R$.SourceFacialAcc_CLS;
         END IF;

         IF (NOT (new$DestFacialAcc_CLS = 0)) THEN
            DestFacialAcc_CLS$ := new$DestFacialAcc_CLS;
         ELSE
            DestFacialAcc_CLS$ := R$.DestFacialAcc_CLS;
         END IF;

         IF (:OLD.SourceFacialAcc_CLS <> new$SourceFacialAcc_CLS) THEN
            UPDATE FacialFinDetail
               SET SourceFacialAcc_CLS = SourceFacialAcc_CLS$,
                   RVersion = -1
             WHERE (ID = R$.ID);
         END IF;

         IF (:OLD.DestFacialAcc_CLS <> new$DestFacialAcc_CLS) THEN
            UPDATE FacialFinDetail
               SET DestFacialAcc_CLS = DestFacialAcc_CLS$,
                   RVersion = -1
             WHERE (ID = R$.ID);
         END IF;
      END LOOP;
   END IF;

   /* Если изменились поля блокировки/разблокировки средств, полученных
     от предпринимательской деятельности сносим их в деталь.*/
  IF (((NEW$IsBlocked <> :OLD.IsBlocked) OR
      ((NEW$IsBlocked IS NULL) AND (:OLD.IsBlocked IS NOT NULL)) OR
      ((NEW$IsBlocked IS NOT NULL) AND (:OLD.IsBlocked IS NULL))
     ) OR
     ((NEW$BlockedCause <> :OLD.BlockedCause) OR
      ((NEW$BlockedCause IS NULL) AND (:OLD.BlockedCause IS NOT NULL)) OR
      ((NEW$BlockedCause IS NOT NULL) AND (:OLD.BlockedCause IS NULL))
     ) OR
     ((NEW$UnBlockedDate <> :OLD.UnBlockedDate) OR
      ((NEW$UnBlockedDate IS NULL) AND (:OLD.UnBlockedDate IS NOT NULL)) OR
      ((NEW$UnBlockedDate IS NOT NULL) AND (:OLD.UnBlockedDate IS NULL))
     ) OR
     ((NEW$UnBlockedCause <> :OLD.UnBlockedCause) OR
      ((NEW$UnBlockedDate IS NULL) AND (:OLD.UnBlockedCause IS NOT NULL)) OR
      ((NEW$UnBlockedCause IS NOT NULL) AND (:OLD.UnBlockedCause IS NULL))
     )) THEN
     UPDATE FacialFinDetail ffd
     SET ffd.IsBlocked = NEW$IsBlocked, ffd.BlockedCause = NEW$BlockedCause,
         ffd.UnBlockedDate = NEW$UnBlockedDate, ffd.UnBlockedCause = NEW$UnBlockedCause
     WHERE ffd.recordindex = NEW$ID;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_FACIALFINCAPTION_BU_210)
-- Create 27.08.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /* Сохранение в базу истории изменений состояний*/
   IF (new$DOCSTATEREF <> :OLD.DOCSTATEREF) THEN
      INSERT INTO StateJumpHistory
                  (DocID, BeginStateRef, EndStateRef
                  )
           VALUES (new$ID, :OLD.DOCSTATEREF, new$DOCSTATEREF
                  );
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (T_FACIALFINCAPTION_BU_300)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IsReject1$ := -1;
  if ((:old.Reject_CLS is null)and(new$Reject_CLS is not null)) then
    IsReject1$ := 1;
      
  else
    if ((:old.Reject_CLS is not null)and(new$Reject_CLS is null)) then
      IsReject1$ := 0;
    END IF;
  END IF;
  if (IsReject1$  <> -1) then
    update LinkRecords set
    IsRejected = IsReject1$

    where
    ChildID = new$ID;
    update LinkRecords set
    IsRejected = IsReject1$

    where
    ChildID in (select d.id from FacialFinDetail d where d.RecordIndex = new$id);
      
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_FACIALFINCAPTION_BU_700)
-- Create 17.09.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_FACIALFINCAPTION SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    SOURCEDOCNUM = new$SOURCEDOCNUM,
    PAYDATE = new$PAYDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    DOCUMENTDATE = new$DOCUMENTDATE,
    REESTRDATE = new$REESTRDATE,
    CREDIT = new$CREDIT,
    SOURCEACCOUNT = new$SOURCEACCOUNT,
    SOURCEFACIALACC_CLS = new$SOURCEFACIALACC_CLS,
    DESTACCOUNT = new$DESTACCOUNT,
    DESTFACIALACC_CLS = new$DESTFACIALACC_CLS,
    PROGINDEX = new$PROGINDEX,
    ARHIVEDOC = new$ARHIVEDOC,
    PAYSYMBOLCLS = new$PAYSYMBOLCLS,
    PAYTYPECLS = new$PAYTYPECLS,
    NOTE = new$NOTE,
    PERIOD = new$PERIOD,
    PAYPRIORITY = new$PAYPRIORITY,
    TYPEOPERATIONCLS = new$TYPEOPERATIONCLS,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    RECORDINDEX = new$RECORDINDEX,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    REESTR_REF = new$REESTR_REF,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CLIENTBANKNUMBER = new$CLIENTBANKNUMBER,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    TRUSTNUMBER = new$TRUSTNUMBER,
    LINKEDDOCUMENT = new$LINKEDDOCUMENT,
    BNKRECORDID = new$BNKRECORDID,
    SUBPROGINDEX = new$SUBPROGINDEX,
    DOCUMENTSTATE = new$DOCUMENTSTATE,
    USERSVISA = new$USERSVISA,
    TREASUARYDOCSTATECLS = new$TREASUARYDOCSTATECLS,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    NDS = new$NDS,
    TAXNOTE = new$TAXNOTE,
    MANAGERBID = new$MANAGERBID,
    BIDNUMBER = new$BIDNUMBER,
    GROUPID = new$GROUPID,
    GROUPSUMMA = new$GROUPSUMMA,
    DOCSTATEREF = new$DOCSTATEREF,
    LASTEXTRCHANGE = new$LASTEXTRCHANGE,
    FAXDOCCOUNT = new$FAXDOCCOUNT,
    STIMATEID = new$STIMATEID,
    INTEGRATEDDOCREF = new$INTEGRATEDDOCREF,
    REQUESTNUMBER = new$REQUESTNUMBER,
    REQUESTDATE = new$REQUESTDATE,
    RVERSION = new$RVERSION,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    ELDOCREF = new$ELDOCREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    CLSTYPE = new$CLSTYPE,
    OPERATIONDIRECTION = new$OPERATIONDIRECTION,
    SOURCETYPE = new$SOURCETYPE,
    DESTTYPE = new$DESTTYPE,
    CARDNUMBER = new$CARDNUMBER,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO = new$CASHIERPERSONALINFO,
    BIDDATE = new$BIDDATE,
    CARDREF = new$CARDREF,
    SOURCESTOREDPAYMENTPROPS = new$SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS = new$DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE = new$STOREDPAYMENTNOTE,
    DOCCHANGEDATE = new$DOCCHANGEDATE,
    UINCODE = new$UINCODE,
    DOCOSN = new$DOCOSN,
    SIGNERS = new$SIGNERS,
    DESTCLSTYPE = new$DESTCLSTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_10 (TR_FACIALFINCAPTION_AU_10)
-- Create 05.03.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$ProgIndex = 72) THEN                       /* Для сводных платежек*/
      IF (    (   (new$AcceptDate = :OLD.AcceptDate)
               OR ((new$AcceptDate IS NULL) AND (:OLD.AcceptDate IS NULL))
              )
          AND (   (new$Reject_CLS = :OLD.Reject_CLS)
               OR ((new$Reject_CLS IS NULL) AND (:OLD.Reject_CLS IS NULL))
              )
          AND (   (new$RejectCause = :OLD.RejectCause)
               OR ((new$RejectCause IS NULL) AND (:OLD.RejectCause IS NULL))
              )
          AND (   (new$TREASUARYDOCSTATECLS = :OLD.TREASUARYDOCSTATECLS)
               OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                   AND (:OLD.TREASUARYDOCSTATECLS IS NULL)
                  )
              )
          AND (   (new$DOCSTATEREF = :OLD.DOCSTATEREF)
               OR ((new$DOCSTATEREF IS NULL) AND (:OLD.DOCSTATEREF IS NULL))
              )
          AND (   (new$REESTR_REF = :OLD.REESTR_REF)
               OR ((new$REESTR_REF IS NULL) AND (:OLD.REESTR_REF IS NULL))
              )
          AND (new$SOURCEACCOUNT = :OLD.SOURCEACCOUNT)
          AND (new$DESTACCOUNT = :OLD.DESTACCOUNT)
         ) THEN
         NULL;                /*      new$AcceptDate := :old.AcceptDate;   */
      ELSE
         /* Если изменились ключевые атрибуты, сносим их во входящие в нее*/
         UPDATE TB_FacialFinCaption
            SET AcceptDate = new$AcceptDate,
                Reject_CLS = new$Reject_CLS,
                RejectCause = new$RejectCause,
                TREASUARYDOCSTATECLS = new$TREASUARYDOCSTATECLS,
                DOCSTATEREF = new$DOCSTATEREF,
                REESTR_REF = new$REESTR_REF,
                SOURCEACCOUNT = new$SOURCEACCOUNT,
                DESTACCOUNT = new$DESTACCOUNT
          WHERE IntegratedDocRef = new$ID;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- AU_300 (TR_FACIALFINCAPTION_AU_300)
-- Create 20.02.2006
-- Last update 11.04.2007
-- - - - - - - - - - - - -

  /* если поменялась дата принятия или бух операция или тип классификации, то сносим это в деталь */
  if ((new$AcceptDate <> :old.AcceptDate)or((new$AcceptDate is not null)and(:old.AcceptDate is null))
      or((new$AcceptDate is null)and(:old.AcceptDate is not null)))
  then
    update facialfindetail set
      AcceptDate = new$AcceptDate,
      RVersion = -1
    where
      RecordIndex = new$id;
  end if;

  if (new$BuhOperationCLS <> :old.BuhOperationCLS)  then
    update facialfindetail set
      BuhOperationCLS = new$BuhOperationCLS,
      RVersion = -1
    where
      RecordIndex = new$id;
  end if;

  if (new$ClsType <> :old.ClsType) then
    if (new$ClsType = 0) then
      update facialfindetail set
        SourceKD = 0,
        DestKD = 0,
        SourceIFS = 0,
        DestIFS = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;

    if (new$ClsType = 1) then
      update facialfindetail set
        SourceKD = 0,
        DestKD = 0,
        SourceKVSR = 0,
        SourceKFSR = 0,
        SourceKCSR = 0,
        SourceKVR = 0,
        SourceKESR = 0,
        DestKVSR = 0,
        DestKFSR = 0,
        DestKCSR = 0,
        DestKVR = 0,
        DestKESR = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;
    
    if (new$ClsType = 2) then
      update facialfindetail set
        SourceIFS = 0,
        DestIFS = 0,
        SourceKVSR = 0,
        SourceKFSR = 0,
        SourceKCSR = 0,
        SourceKVR = 0,
        SourceKESR = 0,
        DestKVSR = 0,
        DestKFSR = 0,
        DestKCSR = 0,
        DestKVR = 0,
        DestKESR = 0,
        ClsType = new$ClsType,
        RVersion = -1
      where
        (RecordIndex = new$id)and(ClsType=:old.ClsType);
    end if;
    
  end if;

-- - - - - - - - - - - - -
-- AU_500 (TR_FACIALFINCAPTION_AU_500)
-- Create 28.04.2005
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (:NEW.ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (23, :OLD.ID, SYSDATE);

      DELETE FROM DelRecIndexes
        WHERE (TableID = 23) AND (RecordId = :NEW.ID);
   END IF;

END;
/
-- ALTER TRIGGER TR_FACIALFINDETAIL_AI_100
CREATE OR REPLACE TRIGGER TR_FACIALFINDETAIL_II
  INSTEAD OF INSERT
  ON FACIALFINDETAIL
  FOR EACH ROW
DECLARE
  new$ID FACIALFINDETAIL.ID%TYPE := :NEW.ID;
  new$SOURCEFACIALACC_CLS FACIALFINDETAIL.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$SOURCEKVR FACIALFINDETAIL.SOURCEKVR%TYPE := :NEW.SOURCEKVR;
  new$SOURCEKESR FACIALFINDETAIL.SOURCEKESR%TYPE := :NEW.SOURCEKESR;
  new$DESTFACIALACC_CLS FACIALFINDETAIL.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$DESTKVR FACIALFINDETAIL.DESTKVR%TYPE := :NEW.DESTKVR;
  new$DESTKESR FACIALFINDETAIL.DESTKESR%TYPE := :NEW.DESTKESR;
  new$BUDGETREF FACIALFINDETAIL.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREDIT FACIALFINDETAIL.CREDIT%TYPE := :NEW.CREDIT;
  new$PAYSYMBOLCLS FACIALFINDETAIL.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$MEMORDERNUM FACIALFINDETAIL.MEMORDERNUM%TYPE := :NEW.MEMORDERNUM;
  new$NOTE FACIALFINDETAIL.NOTE%TYPE := :NEW.NOTE;
  new$PROGINDEX FACIALFINDETAIL.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$RECORDINDEX FACIALFINDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$CREATERUSER FACIALFINDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$SOURCEKVSR FACIALFINDETAIL.SOURCEKVSR%TYPE := :NEW.SOURCEKVSR;
  new$SOURCEKCSR FACIALFINDETAIL.SOURCEKCSR%TYPE := :NEW.SOURCEKCSR;
  new$SOURCEKFSR FACIALFINDETAIL.SOURCEKFSR%TYPE := :NEW.SOURCEKFSR;
  new$SOURCESUBKESR FACIALFINDETAIL.SOURCESUBKESR%TYPE := :NEW.SOURCESUBKESR;
  new$SOURCEFACT FACIALFINDETAIL.SOURCEFACT%TYPE := :NEW.SOURCEFACT;
  new$SOURCEMEANSTYPE FACIALFINDETAIL.SOURCEMEANSTYPE%TYPE := :NEW.SOURCEMEANSTYPE;
  new$SOURCEFINSOURCE FACIALFINDETAIL.SOURCEFINSOURCE%TYPE := :NEW.SOURCEFINSOURCE;
  new$SOURCEFINTYPE FACIALFINDETAIL.SOURCEFINTYPE%TYPE := :NEW.SOURCEFINTYPE;
  new$DESTKVSR FACIALFINDETAIL.DESTKVSR%TYPE := :NEW.DESTKVSR;
  new$DESTKCSR FACIALFINDETAIL.DESTKCSR%TYPE := :NEW.DESTKCSR;
  new$DESTKFSR FACIALFINDETAIL.DESTKFSR%TYPE := :NEW.DESTKFSR;
  new$DESTSUBKESR FACIALFINDETAIL.DESTSUBKESR%TYPE := :NEW.DESTSUBKESR;
  new$DESTFACT FACIALFINDETAIL.DESTFACT%TYPE := :NEW.DESTFACT;
  new$DESTMEANSTYPE FACIALFINDETAIL.DESTMEANSTYPE%TYPE := :NEW.DESTMEANSTYPE;
  new$DESTFINSOURCE FACIALFINDETAIL.DESTFINSOURCE%TYPE := :NEW.DESTFINSOURCE;
  new$DESTFINTYPE FACIALFINDETAIL.DESTFINTYPE%TYPE := :NEW.DESTFINTYPE;
  new$REQUESTSINDEX FACIALFINDETAIL.REQUESTSINDEX%TYPE := :NEW.REQUESTSINDEX;
  new$SENDERID FACIALFINDETAIL.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINDETAIL.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$PROMISE FACIALFINDETAIL.PROMISE%TYPE := :NEW.PROMISE;
  new$SOURCEDOCTYPE FACIALFINDETAIL.SOURCEDOCTYPE%TYPE := :NEW.SOURCEDOCTYPE;
  new$DESTDOCTYPE FACIALFINDETAIL.DESTDOCTYPE%TYPE := :NEW.DESTDOCTYPE;
  new$SOURCEPROMISE FACIALFINDETAIL.SOURCEPROMISE%TYPE := :NEW.SOURCEPROMISE;
  new$DESTPROMISE FACIALFINDETAIL.DESTPROMISE%TYPE := :NEW.DESTPROMISE;
  new$RECORDINDEX2 FACIALFINDETAIL.RECORDINDEX2%TYPE := :NEW.RECORDINDEX2;
  new$SOURCEBUDGETPROMISE FACIALFINDETAIL.SOURCEBUDGETPROMISE%TYPE := :NEW.SOURCEBUDGETPROMISE;
  new$DESTBUDGETPROMISE FACIALFINDETAIL.DESTBUDGETPROMISE%TYPE := :NEW.DESTBUDGETPROMISE;
  new$SUBPROGINDEX FACIALFINDETAIL.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$STIMATEID FACIALFINDETAIL.STIMATEID%TYPE := :NEW.STIMATEID;
  new$RVERSION FACIALFINDETAIL.RVERSION%TYPE := :NEW.RVERSION;
  new$SOURCEDIRECTIONCLS FACIALFINDETAIL.SOURCEDIRECTIONCLS%TYPE := :NEW.SOURCEDIRECTIONCLS;
  new$DESTDIRECTIONCLS FACIALFINDETAIL.DESTDIRECTIONCLS%TYPE := :NEW.DESTDIRECTIONCLS;
  new$SOURCEDOCBASE FACIALFINDETAIL.SOURCEDOCBASE%TYPE := :NEW.SOURCEDOCBASE;
  new$DESTDOCBASE FACIALFINDETAIL.DESTDOCBASE%TYPE := :NEW.DESTDOCBASE;
  new$SOURCEEXECDOC FACIALFINDETAIL.SOURCEEXECDOC%TYPE := :NEW.SOURCEEXECDOC;
  new$DESTEXECDOC FACIALFINDETAIL.DESTEXECDOC%TYPE := :NEW.DESTEXECDOC;
  new$BUHOPERATIONCLS FACIALFINDETAIL.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$SOURCEIFS FACIALFINDETAIL.SOURCEIFS%TYPE := :NEW.SOURCEIFS;
  new$DESTIFS FACIALFINDETAIL.DESTIFS%TYPE := :NEW.DESTIFS;
  new$CLSTYPE FACIALFINDETAIL.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$UNIONNOTIFYREF FACIALFINDETAIL.UNIONNOTIFYREF%TYPE := :NEW.UNIONNOTIFYREF;
  new$ACCEPTDATE FACIALFINDETAIL.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SOURCEKD FACIALFINDETAIL.SOURCEKD%TYPE := :NEW.SOURCEKD;
  new$DESTKD FACIALFINDETAIL.DESTKD%TYPE := :NEW.DESTKD;
  new$SOURCEREGIONCLS FACIALFINDETAIL.SOURCEREGIONCLS%TYPE := :NEW.SOURCEREGIONCLS;
  new$DESTREGIONCLS FACIALFINDETAIL.DESTREGIONCLS%TYPE := :NEW.DESTREGIONCLS;
  new$DESTFUNDSSOURCE FACIALFINDETAIL.DESTFUNDSSOURCE%TYPE := :NEW.DESTFUNDSSOURCE;
  new$SOURCEFUNDSSOURCE FACIALFINDETAIL.SOURCEFUNDSSOURCE%TYPE := :NEW.SOURCEFUNDSSOURCE;
  new$ISBLOCKED FACIALFINDETAIL.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINDETAIL.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINDETAIL.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINDETAIL.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$SOURCETRANSFERTCLS FACIALFINDETAIL.SOURCETRANSFERTCLS%TYPE := :NEW.SOURCETRANSFERTCLS;
  new$DESTTRANSFERTCLS FACIALFINDETAIL.DESTTRANSFERTCLS%TYPE := :NEW.DESTTRANSFERTCLS;
  new$DESTCLSTYPE FACIALFINDETAIL.DESTCLSTYPE%TYPE := :NEW.DESTCLSTYPE;
  new$SOURCEASSIGNMENTKIND FACIALFINDETAIL.SOURCEASSIGNMENTKIND%TYPE := :NEW.SOURCEASSIGNMENTKIND;
  new$DESTASSIGNMENTKIND FACIALFINDETAIL.DESTASSIGNMENTKIND%TYPE := :NEW.DESTASSIGNMENTKIND;
  new$SOURCEEXECINNERNUMBER FACIALFINDETAIL.SOURCEEXECINNERNUMBER%TYPE := :NEW.SOURCEEXECINNERNUMBER;
  new$DESTEXECINNERNUMBER FACIALFINDETAIL.DESTEXECINNERNUMBER%TYPE := :NEW.DESTEXECINNERNUMBER;
  new$SOURCESUBSIDYCLS FACIALFINDETAIL.SOURCESUBSIDYCLS%TYPE := :NEW.SOURCESUBSIDYCLS;
  new$DESTSUBSIDYCLS FACIALFINDETAIL.DESTSUBSIDYCLS%TYPE := :NEW.DESTSUBSIDYCLS;
  new$SOURCEFAORG_TYPE FACIALFINDETAIL.SOURCEFAORG_TYPE%TYPE := :NEW.SOURCEFAORG_TYPE;
  new$DESTFAORG_TYPE FACIALFINDETAIL.DESTFAORG_TYPE%TYPE := :NEW.DESTFAORG_TYPE;
  new$SOURCEBUDALLOCATIONCLS FACIALFINDETAIL.SOURCEBUDALLOCATIONCLS%TYPE := :NEW.SOURCEBUDALLOCATIONCLS;
  new$SOURCEPAYPROMISECLS FACIALFINDETAIL.SOURCEPAYPROMISECLS%TYPE := :NEW.SOURCEPAYPROMISECLS;
  new$DESTBUDALLOCATIONCLS FACIALFINDETAIL.DESTBUDALLOCATIONCLS%TYPE := :NEW.DESTBUDALLOCATIONCLS;
  new$DESTPAYPROMISECLS FACIALFINDETAIL.DESTPAYPROMISECLS%TYPE := :NEW.DESTPAYPROMISECLS;
  new$SOURCEINVESTOBJECT FACIALFINDETAIL.SOURCEINVESTOBJECT%TYPE := :NEW.SOURCEINVESTOBJECT;
  new$DESTINVESTOBJECT FACIALFINDETAIL.DESTINVESTOBJECT%TYPE := :NEW.DESTINVESTOBJECT;
  new$TRANSFERTORG_REF FACIALFINDETAIL.TRANSFERTORG_REF%TYPE := :NEW.TRANSFERTORG_REF;
--
  SourceFacialAcc_CLS$ NUMBER(10);
  DestFacialAcc_CLS$ NUMBER(10);
  CapBuhOperationCLS$ NUMBER(10);
  CapClsType$ NUMBER(10);
  CapAcceptDate$ NUMBER(10);
  CaptionAcceptDate$ NUMBER;
  PromiseAcceptDate$ NUMBER;
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  BPInnerNum1$ NUMBER(10);
  PromiseMode1$ NUMBER(10);
  Promise_Count1$ NUMBER(10);
  CaptionRejectCls1$ NUMBER(10);
  PromiseAccepted1$ NUMBER(10);
  PromiseMode$ NUMBER(10);
  ProgIndex$ NUMBER(10);
  ExecID$ NUMBER(10);
  ExecInnerNumber$ NUMBER(10);
  ExecRegType$ NUMBER(10);
  ExecAgrInnerNum$ NUMBER(10);
  AgrInnerNumber$ NUMBER(10);
  CaptionRejectCls$ NUMBER(10);
  EDAccepted$ NUMBER(10);
  i_fintype$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FACIALFINDETAIL_BI_0)
-- Last update 15.12.2002
-- - - - - - - - - - - - -

   IF (new$ID IS NULL) THEN
      SELECT g_Shared.NEXTVAL INTO new$ID FROM DUAL;
   END IF;

   IF (new$Credit IS NULL) THEN new$Credit := 0; END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_FACIALFINDETAIL_BI_100)
-- Last update 12.01.2009
-- - - - - - - - - - - - -

 /* Заполнение Бюджета, берем из мастера */
   BEGIN

     select
       ffc.BudgetRef, ffc.BuhOperationCls, ffc.ClsType, ffc.AcceptDate,
       ffc.IsBlocked, ffc.BlockedCause, ffc.UnBlockedDate, ffc.UnBlockedCause
     into new$BudgetRef, CapBuhOperationCls$, CapClsType$, CapAcceptDate$,
       new$IsBlocked, new$BlockedCause, new$UnBlockedDate, new$UnBlockedCause
     from
       FacialFinCaption ffc
     where
       ffc.id = new$RecordIndex;
     
   EXCEPTION
     WHEN NO_DATA_FOUND THEN
       new$BudgetRef := NULL;
       CapBuhOperationCls$ := NULL;
       CapClsType$ := NULL;
       CapAcceptDate$ := NULL;
   END;

   /* Бух операцию заполняем из заголовка */
   if (new$BuhOperationCls is null) then new$BuhOperationCls := CapBuhOperationCls$; end if;

   /* Тип классификации заполняем из заголовка */
   if (new$ClsType is null) then new$ClsType := CapClsType$; end if;

   if (new$DestClsType is null) then new$DestClsType := new$ClsType; end if;
   
   /* Дату принятия заполняем из заголовка */
   if (new$AcceptDate is null) then new$AcceptDate := CapAcceptDate$; end if;

   /* Сносим Лицевые счета из заголовка */
   if ((new$SourceFacialAcc_CLS is null) or (new$DestFacialAcc_CLS is null)) then
     BEGIN
       select SourceFacialAcc_CLS, DestFacialAcc_CLS
         into SourceFacialAcc_CLS$, DestFacialAcc_CLS$
       from FacialFinCaption
       where new$RecordIndex = id;
     EXCEPTION
       WHEN NO_DATA_FOUND THEN
         SourceFacialAcc_CLS$ := NULL;
         DestFacialAcc_CLS$ := NULL;
     END;

     if (new$SourceFacialAcc_CLS is null) then new$SourceFacialAcc_CLS := SourceFacialAcc_CLS$; end if;
     if (new$DestFacialAcc_CLS is null) then new$DestFacialAcc_CLS := DestFacialAcc_CLS$; end if;
   end if;

-- - - - - - - - - - - - -
-- BI_110 (TR_FACIALFINDETAIL_BI_110)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  /* Если тип финансирования не задан, то берем его из констант казначейства*/ 
  i_fintype$ := -1 ;
  IF (new$SourceFintype IS NULL OR (new$Sourcefintype=0)) THEN 
    BEGIN
      SELECT constvalue INTO i_fintype$   FROM intconst
      WHERE (progindex=30) AND (constindex=10) ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    new$SourceFintype := i_fintype$  ;
     
  END IF;
  IF (new$DestFintype IS NULL OR (new$Destfintype=0)) THEN 
    IF (i_fintype$ = -1) THEN
      BEGIN
        SELECT constvalue INTO i_fintype$   FROM intconst
        WHERE (progindex=30) AND (constindex=10) ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
    END IF;
    new$DestFintype := i_fintype$  ;
     
  END IF;
  IF (new$SourceFacialAcc_CLS IS NULL) THEN 
    new$SourceFacialAcc_CLS := 0;
  END IF;
  IF (new$SourceKVR IS NULL) THEN 
    new$SourceKVR := 0;
  END IF;
  IF (new$SourceKESR IS NULL) THEN 
    new$SourceKESR := 0;
  END IF;
  IF (new$SourceKVSR IS NULL) THEN 
    new$SourceKVSR := 0;
  END IF;
  IF (new$SourceKFSR IS NULL) THEN 
    new$SourceKFSR := 0;
  END IF;
  IF (new$SourceKCSR IS NULL) THEN 
    new$SourceKCSR := 0;
  END IF;
  IF (new$SourceSubKESR IS NULL) THEN 
    new$SourceSubKESR := 0;
  END IF;
  IF (new$SourceDirectionCls IS NULL) THEN 
    new$SourceDirectionCls := 0;
  END IF;
  IF (new$SourceFact IS NULL) THEN 
    new$SourceFact := 0;
  END IF;
  IF (new$SourceMeansType IS NULL) THEN 
    new$SourceMeansType := 0;
  END IF;
  IF (new$SourceFinSource IS NULL) THEN 
    new$SourceFinSource := 0;
  END IF;
  IF (new$SourceFinType IS NULL) THEN 
    new$SourceFinType := 0;
  END IF;
  IF (new$SourceDocType IS NULL) THEN 
    new$SourceDocType := 1000;
  END IF;
  IF (new$SourceIFS IS NULL) THEN 
    new$Sourceifs := 0;
  END IF;
  IF (new$SourceKD IS NULL) THEN 
    new$SourceKD := 0;
  END IF;
  IF (new$SourceFundsSource IS NULL) THEN 
    new$SourceFundsSource := 0;
  END IF;
  IF (new$SourceAssignmentKind IS NULL) THEN 
    new$SourceAssignmentKind := 0;
  END IF;
  IF (new$SourceRegionCLS IS NULL) THEN 
    new$SourceRegionCLS := 0;
  END IF;
  IF (new$DestFacialAcc_CLS IS NULL) THEN 
    new$DestFacialAcc_CLS := 0;
  END IF;
  IF (new$DestKVR IS NULL) THEN 
    new$DestKVR := 0;
  END IF;
  IF (new$DestKESR IS NULL) THEN 
    new$DestKESR := 0;
  END IF;
  IF (new$DestKVSR IS NULL) THEN 
    new$DestKVSR := 0;
  END IF;
  IF (new$DestKFSR IS NULL) THEN 
    new$DestKFSR := 0;
  END IF;
  IF (new$DestKCSR IS NULL) THEN 
    new$DestKCSR := 0;
  END IF;
  IF (new$DestSubKESR IS NULL) THEN 
    new$DestSubKESR := 0;
  END IF;
  IF (new$DestDirectionCls IS NULL) THEN 
    new$DestDirectionCls := 0;
  END IF;
  IF (new$DestFact IS NULL) THEN 
    new$DestFact := 0;
  END IF;
  IF (new$DestMeansType IS NULL) THEN 
    new$DestMeansType := 0;
  END IF;
  IF (new$DestFinSource IS NULL) THEN 
    new$DestFinSource := 0;
  END IF;
  IF (new$DestFinType IS NULL) THEN 
    new$DestFinType := 0;
  END IF;
  IF (new$DestDocType IS NULL) THEN 
    new$DestDocType := 1000;
  END IF;
  IF (new$DestIFS IS NULL) THEN 
    new$Destifs := 0;
  END IF;
  IF (new$DestKD IS NULL) THEN 
    new$DestKD := 0;
  END IF;
  IF (new$DestFundsSource IS NULL) THEN 
    new$DestFundsSource := 0;
  END IF;
  IF (new$DestAssignmentKind IS NULL) THEN 
    new$DestAssignmentKind := 0;
  END IF;
  IF (new$DestRegionCLS IS NULL) THEN 
    new$DestRegionCLS := 0;
  END IF;
  /* для Распределения ОФ: классификация плательщика не должна быть нулевой */
  if (new$progindex=76) then
    new$SourceKVR := new$DestKVR;
    new$SourceKESR := new$DestKESR;
    new$SourceKVSR := new$DestKVSR;
    new$SourceKFSR := new$DestKFSR;
    new$SourceKCSR := new$DestKCSR;
    new$SourceSubKESR := new$DestSubKESR;
    new$SourceDirectionCls := new$DestDirectionCls;
    new$SourceFact := new$DestFact;
    new$SourceMeansType := new$DestMeansType;
    new$SourceFinSource := new$DestFinSource;
    new$SourceFinType := new$DestFinType;
    new$SourceDocType := new$DestDocType;
    new$SourceIFS := new$DestIFS;
    new$SourceKD := new$DestKD;
    new$SourceRegionCls := new$DestRegionCls;
    new$SourceDocBase := new$DestDocBase;
    new$SourceAssignmentKind := new$DestAssignmentKind;
     
  END IF;
  IF (new$BuhOperationCLS IS NULL)
  THEN 
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  /* старое поле Promise null, а новые нет */
  IF ((new$Promise IS NULL) AND
  ((new$SourcePromise IS NOT NULL) OR
  (new$DestPromise IS NOT NULL))) THEN
    IF (new$progindex IN (63, 64, 73)) THEN
      new$Promise := new$SourcePromise;
         
    ELSE 
      IF (new$progindex IN (61, 62, 65, 75)) THEN
        new$Promise := new$DestPromise;
           
      ELSE 
        IF ((new$progindex in (66, 67, 76))AND(new$DestPromise IS NOT NULL)AND
        (new$SourcePromise=new$DestPromise)) THEN
          new$Promise := new$DestPromise;
        END IF;
      END IF; 
    END IF;/* если новые поля пустые,а старый нет, то старый ± преобразуем в новый */
  ELSE
    IF ((new$Promise IS NOT NULL) AND
    (new$SourcePromise IS NULL) AND
    (new$DestPromise IS NULL)) THEN
      IF (new$progindex IN (63, 64, 73)) THEN
        new$SourcePromise := new$Promise;
           
      ELSE 
        IF (new$progindex IN (61, 62, 65, 75)) THEN
          new$DestPromise := new$Promise;
             
        ELSE 
          IF (new$progindex in (66, 67, 76)) THEN
            new$SourcePromise := new$Promise;
            new$DestPromise := new$Promise;
               
          END IF;
        END IF; 
      END IF;
    END IF;
  END IF;
  BEGIN

    /* заполняем вид организации владельца л\с плательщика и получателя*/
    SELECT org.Org_Type  INTO new$SourceFAOrg_Type FROM Organizations org
    INNER JOIN FacialACC_Cls fac ON (org.ID = fac.Org_ref)
    WHERE fac.ID = new$SourceFacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  BEGIN

    SELECT org.Org_Type  INTO new$DestFAOrg_Type FROM Organizations org
    INNER JOIN facialacc_cls fac  on (org.ID = fac.Org_ref)
    WHERE fac.ID = new$DestFacialACC_Cls
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;

-- - - - - - - - - - - - -
-- BI_120 (TR_FACIALFINDETAIL_BI_120)
-- Create 28.04.2005
-- Last update 15.12.2008
-- - - - - - - - - - - - -

    /*  60 :  'Приход средств от фин.органа'; source
        61 :  'Приход средств от прочих и восстановление расходов'; dest
        62 :  'Приход средств по объявлениям';dest
        63 :  'Уход средств по платежным поручениям'; source
        64 :  'Уход средств по чекам'; source
        65 :  'Переброска средств, Разассигновка';dest
        66 :  'Внутренняя переброска средств, один - многим'; source dest
        67 :  'Уход средств в районы';source
        68 :  'Перечисление на р\с районов';dest
        69 :  'Подтверждение перечисления на р\с районов'; dest
        70 :  'Возврат с р\с районов';source
        71 :  'Подтверждение возврата с р\с районов'; dest */

  /*ClsType*/
  if ((New$ClsType is NULL) and 
        ( 
          ((New$SourceIFS <> 0) and (New$ProgIndex in (63,64,66,67,68,70))) or
          (New$ProgIndex = 60)
        )) then
    New$ClsType := 1; /* если это источник и забыли ввести ClsType */
  elsif ((New$ClsType is NULL) and (New$SourceKD <> 0) and
        (New$ProgIndex in (63,64,66,67,68,70))) then
    New$ClsType := 2; /* если это код дохода и забыли ввести ClsType */
  elsif (new$ClsType is null) then
    new$ClsType := 0; /* иначе - расходная */
  end if;  

  IF ((new$ClsType = 0) AND 
      (((new$SourceIFS <> 0) or (new$SourceKD <> 0)) and
      (new$ProgIndex in (63,64,66,67,68,70)))
     ) THEN /* классификация расходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;
  IF ((new$ClsType = 1) AND (
    (new$SourceKVSR <> 0) OR (new$SourceKFSR <> 0) OR
    (new$SourceKCSR <> 0) OR (new$SourceKVR <> 0) OR
    (new$SourceKESR <> 0) OR
    ((new$SourceKD <> 0) and (new$ProgIndex in (63,64,66,67,68,70)))
    )) THEN /* классификация источниковая */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;
  IF ((new$ClsType = 2) AND (
    (new$SourceKVSR <> 0) OR (new$SourceKFSR <> 0) OR
    (new$SourceKCSR <> 0) OR (new$SourceKVR <> 0) OR
    (new$SourceKESR <> 0) OR
    ((new$SourceIFS <> 0) and (new$ProgIndex in (63,64,66,67,68,70)))
    )) THEN /* классификация доходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  /*DestClsType*/
  if ((new$DestClsType is NULL) and
        ( 
          ((new$DestIFS <> 0) and (new$ProgIndex in (61,62,65,69,71))) or (new$ProgIndex = 60)
        )) then
    new$DestClsType := 1; /* если это источник и забыли ввести ClsType */
  elsif ((new$DestClsType is NULL) and
          ((new$DestKD <> 0) and (new$ProgIndex in (61,62,65,69,71)))
        ) then
    new$DestClsType := 2; /* если это код дохода и забыли ввести ClsType */
  elsif (new$DestClsType is null) then
    new$DestClsType := 0; /* иначе - расходная */
  end if;      

  IF ((new$DestClsType = 0) AND
      (((new$DestIFS <> 0) or (new$DestKD <> 0)) and
      (new$ProgIndex in (61,62,65,69,71)))
     ) THEN /* классификация расходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;
  IF ((new$DestClsType = 1) AND (
    (new$DestKVSR <> 0) OR (new$DestKFSR <> 0) OR
    (new$DestKCSR <> 0) OR (new$DestKVR <> 0) OR
    (new$DestKESR <> 0) or
    ((new$DestKD <> 0) and (new$ProgIndex in (61,62,65,69,71)))
    )) THEN /* классификация источниковая */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

  IF ((new$DestClsType = 2) AND (
    (new$DestKVSR <> 0) OR (new$DestKFSR <> 0) OR
    (new$DestKCSR <> 0) OR (new$DestKVR <> 0) OR
    (new$DestKESR <> 0) or
    ((new$DestIFS <> 0) and (new$ProgIndex in (61,62,65,69,71)))
    )) THEN /* классификация доходная */
    RaiseEXCEPTION('EX_WRONGBUDCLS');
  end if;  

-- - - - - - - - - - - - -
-- BI_200 (TR_FACIALFINDETAIL_BI_200)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  /* проставляем номера бюджетных обязательств по Учету договоров*/
  GetIntConst(30, 15,PromiseMode1$);
  /* ПРОВЕРКА ДЛЯ БЛОКА БО */
  if (((new$SourcePromise is not null) or (new$DestPromise is not null)) and (PromiseMode1$ <> 1)) then
    if (new$SourcePromise is not null) then
      /* Проверка сущствует ли такое БО на который ссылается документ*/
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count1$         from
      promise_detail pr
      where
      (pr.registrnumber = new$SOURCEPROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count1$ = 0) then
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    if (new$DestPromise is not null) then
      /* Проверка сущствует ли такое БО на который ссылается документ*/
      select
      count(pr.REGISTRNUMBER)
      into
      Promise_Count1$         from
      promise_detail pr
      where
      (pr.registrnumber = new$DESTPROMISE)
      ;
      /* Если такого поля нет, тогда ругаемся*/
      if (Promise_Count1$ = 0) then
        RaiseException('EX_BP_NotExist');      
      END IF;    
    END IF;
  END IF;
  if (PromiseMode1$ = 1) then
    /* source Подтяжка внутр. номера по номеру БО*/
    if ((new$SourcePromise is not null) and (new$SourceBudgetPromise is null)) then
      select max(InnerPromiseNum) 
      into BPInnerNum1$           from PaymentSchedule 
      where (ANumber = new$SourcePromise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum1$ <> 0) then
        new$SourceBudgetPromise := BPInnerNum1$;
                
      else
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    /* dest Подтяжка внутр. номера по номеру БО*/
    if ((new$DestPromise is not null) and (new$DestBudgetPromise is null)) then
      select max(InnerPromiseNum) 
      into BPInnerNum1$           from PaymentSchedule
      where (ANumber = new$DestPromise) and (AcceptDate is not null) and (Accepted = 1)
      ;
      if (BPInnerNum1$ <> 0) then
        new$DestBudgetPromise := BPInnerNum1$;
                
      else
        RaiseException('EX_BP_NotExist');      
      END IF;
    END IF;
    /* source Если есть новый номер, но нет старого, тогда проставляем старый*/
    if ((new$SourceBudgetPromise is not null) and (new$SourcePromise is null)) then
      BEGIN
        select ANumber 
        into BPInnerNum1$           from PaymentSchedule
        where (InnerPromiseNum = new$SourceBudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      new$SourcePromise := BPInnerNum1$;
      new$Promise := BPInnerNum1$;
            
    END IF;
    /* dest */
    if ((new$DestBudgetPromise is not null) and (new$DestPromise is null)) then
      BEGIN
        select ANumber 
        into BPInnerNum1$           from PaymentSchedule
        where (InnerPromiseNum = new$DestBudgetPromise) and (LastAccepted = 1)
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      new$DestPromise := BPInnerNum1$;
      new$Promise := BPInnerNum1$;
            
    END IF;
    /* проверка по двум полям */
    if (new$SourceBudgetPromise is not null and new$SourcePromise is not null) then
      SELECT COUNT(ANumber ) INTO CNT$1
      from PaymentSchedule where (ANumber = new$SourcePromise and InnerPromiseNum = new$SourceBudgetPromise) AND (ROWNUM = 1);
      if (not (CNT$1<> 0)) then
        RaiseException('Ex_BP_NotExist');
      END IF;
      BEGIN

        /* выбираем дату принятия и причину отклонения заголовка */
        select AcceptDate, Reject_Cls         into CaptionAcceptDate$, CaptionRejectCls1$ from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия БО для Source */
        select AcceptDate, Accepted         into PromiseAcceptDate$, PromiseAccepted1$ from PaymentSchedule
        where ANumber = new$SourcePromise and InnerPromiseNum = new$SourceBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls1$ is null and PromiseAccepted1$ <> 1) then
        RaiseException('Ex_BP_Rejected');
      END IF;
      /* если принятый документ ссылается на не принятое БО */
      if (CaptionAcceptDate$ is not null and (PromiseAcceptDate$ is null or PromiseAccepted1$ <> 1)) then
        RaiseException('Ex_BP_NotAccepted');      
      END IF;
    END IF;
    if (new$DestBudgetPromise is not null and new$DestPromise is not null) then
      SELECT COUNT(ANumber ) INTO CNT$2
      from PaymentSchedule where (ANumber = new$DestPromise and InnerPromiseNum = new$DestBudgetPromise) AND (ROWNUM = 1);
      if (not (CNT$2<> 0)) then
        RaiseException('Ex_BP_NotExist');
      END IF;
      BEGIN

        /* выбираем дату принятия и причину отклонения заголовка */
        select AcceptDate, Reject_Cls         into CaptionAcceptDate$, CaptionRejectCls1$ from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия БО для Dest */
        select AcceptDate, Accepted         into PromiseAcceptDate$, PromiseAccepted1$ from PaymentSchedule
        where ANumber = new$DestPromise and InnerPromiseNum = new$DestBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls1$ is null and PromiseAccepted1$ <> 1) then
        RaiseException('Ex_BP_Rejected');
      END IF;
      /* если принятый документ ссылается на не принятое БО */
      if (CaptionAcceptDate$ is not null and (PromiseAcceptDate$ is null or PromiseAccepted1$ <> 1)) then
        RaiseException('Ex_BP_NotAccepted');      
      END IF;    
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_210 (TR_FACIALFINDETAIL_BI_210)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* используем болк учета договоров?*/
  GetIntConst(30, 15,PromiseMode$);
  if (PromiseMode$ = 1) then
    /* при простановке БО плательщика или его изменении */
    if (new$SourcePromise is not null) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$SourcePromise and ps.InnerPromiseNum = new$SourceBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$SourceExecDoc := ExecID$;
        new$SourceExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$SourceExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$SourceExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$SourceExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано, а ДИ указано, то */
    else 
      if (new$SourceExecDoc is not null) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$SourceExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$SourceExecInnerNumber := ExecInnerNumber$;
            
      END IF;
    END IF;
    /* теперь тоже самое для Dest */

    /* при простановке БО получателя или его изменении */
    if (new$DestPromise is not null) then
      BEGIN
        /* проверяем, что оно по ДИ и если так, подтягиваем соотвествующее ДИ */
        select
        ps.ProgIndex, ps.ExecutionRef, edc.InnerNumber, a.InnerNumber
        into ProgIndex$, ExecID$, ExecInnerNumber$, AgrInnerNumber$       from PaymentSchedule ps
        left join ExecutionDocumentsCaption edc on edc.ID = ps.ExecutionRef
        left join Agreements a on a.Id = ps.AgreementRef
        where
        ps.ANumber = new$DestPromise and ps.InnerPromiseNum = new$DestBudgetPromise
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если БО по ДИ, то подтягиваем сразу и ДИ */
      if (ProgIndex$ = 308) then
        new$DestExecDoc := ExecID$;
        new$DestExecInnerNumber := ExecInnerNumber$;
              
      else 
        if (new$DestExecDoc is not null) then
          BEGIN
            /* если ДИ у нас тоже вставляется, то выберем его тип и номер цепочки договоров */
            /* а за одно и номер цепочки ДИ */
            select
            RegistrationType, AgreementInnerNumber, InnerNumber
            into ExecRegType$, ExecAgrInnerNum$, ExecInnerNumber$         from ExecutionDocumentsCaption
            where
            Id = new$DestExecDoc
            ;
          EXCEPTION
            WHEN NO_DATA_FOUND THEN NULL;
          END;
          /* если ДИ без договора, то это неправильно */
          if (ExecRegType$ = 4) then
            RaiseException('EX_IncorrectBindingExec_BO');
          END IF;
          /* если БО и ДИ ссылаются на разный договор, то это тоже неправильно */
          if (ExecAgrInnerNum$ <> AgrInnerNumber$) then
            RaiseException('EX_DiffAgree_InBOExec');
          END IF;
          /* если ДИ удовлетворяет договору, то проставляем номер цепочки ДИ */        
          new$DestExecInnerNumber := ExecInnerNumber$;
                
        END IF;    
      END IF;/* если БО не указано, а ДИ указано, то */
    else 
      if (new$DestExecDoc is not null) then
        BEGIN
          /* просто подтягиваем номер цепочки ДИ */
          select
          InnerNumber
          into ExecInnerNumber$       from ExecutionDocumentsCaption
          where
          Id = new$DestExecDoc
          ;
        EXCEPTION
          WHEN NO_DATA_FOUND THEN NULL;
        END;
        new$DestExecInnerNumber := ExecInnerNumber$;
            
      END IF;
    END IF;
    if (new$SourceExecDoc is not null) then
      BEGIN
        /* выбираем причину отклонения заголовка */
        select Reject_Cls
        into CaptionRejectCls$       from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия для Source */
        select Accepted
        into EDAccepted$       from ExecutionDocumentsCaption
        where id = new$SourceExecDoc
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное БО */
      if (CaptionRejectCls$ is null and EDAccepted$ <> 1) then
        RaiseException('Ex_ExecDoc_Rejected');    
      END IF;
    END IF;
    if (new$DestExecDoc is not null) then
      BEGIN
        /* выбираем причину отклонения заголовка */
        select Reject_Cls
        into CaptionRejectCls$       from FacialFinCaption
        where ID = new$RecordIndex
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      BEGIN

        /* выбираем признаки принятия для Dest */
        select Accepted
        into EDAccepted$       from ExecutionDocumentsCaption
        where ID = new$DestExecDoc
        ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      /* если в неотклоненном документе указано отклоненное ДИ */
      if (CaptionRejectCls$ is null and EDAccepted$ <> 1) then
        RaiseException('Ex_ExecDoc_Rejected');    
      END IF;  
    END IF;/* использование блока "Учет договоров"*/
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_FACIALFINDETAIL_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := user;
  new$UpdaterUser := user;

  Update facialfincaption set
  DocChangeDate = new$UpdateDate,
  RVersion=-1
  where id=new$recordindex;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_FACIALFINDETAIL (
    ID,
    SOURCEFACIALACC_CLS,
    SOURCEKVR,
    SOURCEKESR,
    DESTFACIALACC_CLS,
    DESTKVR,
    DESTKESR,
    BUDGETREF,
    CREDIT,
    PAYSYMBOLCLS,
    MEMORDERNUM,
    NOTE,
    PROGINDEX,
    RECORDINDEX,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    SOURCEKVSR,
    SOURCEKCSR,
    SOURCEKFSR,
    SOURCESUBKESR,
    SOURCEFACT,
    SOURCEMEANSTYPE,
    SOURCEFINSOURCE,
    SOURCEFINTYPE,
    DESTKVSR,
    DESTKCSR,
    DESTKFSR,
    DESTSUBKESR,
    DESTFACT,
    DESTMEANSTYPE,
    DESTFINSOURCE,
    DESTFINTYPE,
    REQUESTSINDEX,
    SENDERID,
    SENDERRECORDID,
    PROMISE,
    SOURCEDOCTYPE,
    DESTDOCTYPE,
    SOURCEPROMISE,
    DESTPROMISE,
    RECORDINDEX2,
    SOURCEBUDGETPROMISE,
    DESTBUDGETPROMISE,
    SUBPROGINDEX,
    STIMATEID,
    RVERSION,
    SOURCEDIRECTIONCLS,
    DESTDIRECTIONCLS,
    SOURCEDOCBASE,
    DESTDOCBASE,
    SOURCEEXECDOC,
    DESTEXECDOC,
    BUHOPERATIONCLS,
    SOURCEIFS,
    DESTIFS,
    CLSTYPE,
    UNIONNOTIFYREF,
    ACCEPTDATE,
    SOURCEKD,
    DESTKD,
    SOURCEREGIONCLS,
    DESTREGIONCLS,
    DESTFUNDSSOURCE,
    SOURCEFUNDSSOURCE,
    ISBLOCKED,
    BLOCKEDCAUSE,
    UNBLOCKEDDATE,
    UNBLOCKEDCAUSE,
    SOURCETRANSFERTCLS,
    DESTTRANSFERTCLS,
    DESTCLSTYPE,
    SOURCEASSIGNMENTKIND,
    DESTASSIGNMENTKIND,
    SOURCEEXECINNERNUMBER,
    DESTEXECINNERNUMBER,
    SOURCESUBSIDYCLS,
    DESTSUBSIDYCLS,
    SOURCEFAORG_TYPE,
    DESTFAORG_TYPE,
    SOURCEBUDALLOCATIONCLS,
    SOURCEPAYPROMISECLS,
    DESTBUDALLOCATIONCLS,
    DESTPAYPROMISECLS,
    SOURCEINVESTOBJECT,
    DESTINVESTOBJECT,
    TRANSFERTORG_REF
  ) VALUES (
    new$ID,
    new$SOURCEFACIALACC_CLS,
    new$SOURCEKVR,
    new$SOURCEKESR,
    new$DESTFACIALACC_CLS,
    new$DESTKVR,
    new$DESTKESR,
    new$BUDGETREF,
    new$CREDIT,
    new$PAYSYMBOLCLS,
    new$MEMORDERNUM,
    new$NOTE,
    new$PROGINDEX,
    new$RECORDINDEX,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$SOURCEKVSR,
    new$SOURCEKCSR,
    new$SOURCEKFSR,
    new$SOURCESUBKESR,
    new$SOURCEFACT,
    new$SOURCEMEANSTYPE,
    new$SOURCEFINSOURCE,
    new$SOURCEFINTYPE,
    new$DESTKVSR,
    new$DESTKCSR,
    new$DESTKFSR,
    new$DESTSUBKESR,
    new$DESTFACT,
    new$DESTMEANSTYPE,
    new$DESTFINSOURCE,
    new$DESTFINTYPE,
    new$REQUESTSINDEX,
    new$SENDERID,
    new$SENDERRECORDID,
    new$PROMISE,
    new$SOURCEDOCTYPE,
    new$DESTDOCTYPE,
    new$SOURCEPROMISE,
    new$DESTPROMISE,
    new$RECORDINDEX2,
    new$SOURCEBUDGETPROMISE,
    new$DESTBUDGETPROMISE,
    new$SUBPROGINDEX,
    new$STIMATEID,
    new$RVERSION,
    new$SOURCEDIRECTIONCLS,
    new$DESTDIRECTIONCLS,
    new$SOURCEDOCBASE,
    new$DESTDOCBASE,
    new$SOURCEEXECDOC,
    new$DESTEXECDOC,
    new$BUHOPERATIONCLS,
    new$SOURCEIFS,
    new$DESTIFS,
    new$CLSTYPE,
    new$UNIONNOTIFYREF,
    new$ACCEPTDATE,
    new$SOURCEKD,
    new$DESTKD,
    new$SOURCEREGIONCLS,
    new$DESTREGIONCLS,
    new$DESTFUNDSSOURCE,
    new$SOURCEFUNDSSOURCE,
    new$ISBLOCKED,
    new$BLOCKEDCAUSE,
    new$UNBLOCKEDDATE,
    new$UNBLOCKEDCAUSE,
    new$SOURCETRANSFERTCLS,
    new$DESTTRANSFERTCLS,
    new$DESTCLSTYPE,
    new$SOURCEASSIGNMENTKIND,
    new$DESTASSIGNMENTKIND,
    new$SOURCEEXECINNERNUMBER,
    new$DESTEXECINNERNUMBER,
    new$SOURCESUBSIDYCLS,
    new$DESTSUBSIDYCLS,
    new$SOURCEFAORG_TYPE,
    new$DESTFAORG_TYPE,
    new$SOURCEBUDALLOCATIONCLS,
    new$SOURCEPAYPROMISECLS,
    new$DESTBUDALLOCATIONCLS,
    new$DESTPAYPROMISECLS,
    new$SOURCEINVESTOBJECT,
    new$DESTINVESTOBJECT,
    new$TRANSFERTORG_REF);

-- - - - - - - - - - - - -
-- AI_100 (TR_FACIALFINDETAIL_AI_100)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  update FacialFinCaption set
  ClsType = new$ClsType,
  RVersion = -1
  where
  (id = new$RecordIndex)and(ClsType <> new$ClsType);
  update FacialFinCaption set
  DestClsType = new$DestClsType,
  RVersion = -1
  where
  (id = new$RecordIndex)and(DestClsType <> new$DestClsType);

-- - - - - - - - - - - - -
-- AI_500 (TR_FACIALFINDETAIL_AI_500)
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID =22 ) and (RecordID = new$ID);

END;
/
-- ALTER TRIGGER TR_FACIALFINCAPTION_AU_300
CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_IU
  INSTEAD OF UPDATE
  ON FACIALFINCAPTION
  FOR EACH ROW
DECLARE
  new$ID FACIALFINCAPTION.ID%TYPE := :NEW.ID;
  new$DOCNUMBER FACIALFINCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SOURCEDOCNUM FACIALFINCAPTION.SOURCEDOCNUM%TYPE := :NEW.SOURCEDOCNUM;
  new$PAYDATE FACIALFINCAPTION.PAYDATE%TYPE := :NEW.PAYDATE;
  new$ACCEPTDATE FACIALFINCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$DOCUMENTDATE FACIALFINCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$REESTRDATE FACIALFINCAPTION.REESTRDATE%TYPE := :NEW.REESTRDATE;
  new$CREDIT FACIALFINCAPTION.CREDIT%TYPE := :NEW.CREDIT;
  new$SOURCEACCOUNT FACIALFINCAPTION.SOURCEACCOUNT%TYPE := :NEW.SOURCEACCOUNT;
  new$SOURCEFACIALACC_CLS FACIALFINCAPTION.SOURCEFACIALACC_CLS%TYPE := :NEW.SOURCEFACIALACC_CLS;
  new$DESTACCOUNT FACIALFINCAPTION.DESTACCOUNT%TYPE := :NEW.DESTACCOUNT;
  new$DESTFACIALACC_CLS FACIALFINCAPTION.DESTFACIALACC_CLS%TYPE := :NEW.DESTFACIALACC_CLS;
  new$PROGINDEX FACIALFINCAPTION.PROGINDEX%TYPE := :NEW.PROGINDEX;
  new$ARHIVEDOC FACIALFINCAPTION.ARHIVEDOC%TYPE := :NEW.ARHIVEDOC;
  new$PAYSYMBOLCLS FACIALFINCAPTION.PAYSYMBOLCLS%TYPE := :NEW.PAYSYMBOLCLS;
  new$PAYTYPECLS FACIALFINCAPTION.PAYTYPECLS%TYPE := :NEW.PAYTYPECLS;
  new$NOTE FACIALFINCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$PERIOD FACIALFINCAPTION.PERIOD%TYPE := :NEW.PERIOD;
  new$PAYPRIORITY FACIALFINCAPTION.PAYPRIORITY%TYPE := :NEW.PAYPRIORITY;
  new$TYPEOPERATIONCLS FACIALFINCAPTION.TYPEOPERATIONCLS%TYPE := :NEW.TYPEOPERATIONCLS;
  new$BUHPAYMENTCLS FACIALFINCAPTION.BUHPAYMENTCLS%TYPE := :NEW.BUHPAYMENTCLS;
  new$CREATERUSER FACIALFINCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE FACIALFINCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE FACIALFINCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER FACIALFINCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF FACIALFINCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$RECORDINDEX FACIALFINCAPTION.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SENDERID FACIALFINCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID FACIALFINCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REESTR_REF FACIALFINCAPTION.REESTR_REF%TYPE := :NEW.REESTR_REF;
  new$REJECT_CLS FACIALFINCAPTION.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE FACIALFINCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CLIENTBANKNUMBER FACIALFINCAPTION.CLIENTBANKNUMBER%TYPE := :NEW.CLIENTBANKNUMBER;
  new$CRYPTOSTATUS FACIALFINCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$TRUSTNUMBER FACIALFINCAPTION.TRUSTNUMBER%TYPE := :NEW.TRUSTNUMBER;
  new$LINKEDDOCUMENT FACIALFINCAPTION.LINKEDDOCUMENT%TYPE := :NEW.LINKEDDOCUMENT;
  new$BNKRECORDID FACIALFINCAPTION.BNKRECORDID%TYPE := :NEW.BNKRECORDID;
  new$SUBPROGINDEX FACIALFINCAPTION.SUBPROGINDEX%TYPE := :NEW.SUBPROGINDEX;
  new$DOCUMENTSTATE FACIALFINCAPTION.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA FACIALFINCAPTION.USERSVISA%TYPE := :NEW.USERSVISA;
  new$TREASUARYDOCSTATECLS FACIALFINCAPTION.TREASUARYDOCSTATECLS%TYPE := :NEW.TREASUARYDOCSTATECLS;
  new$DEPARTMENTCLS FACIALFINCAPTION.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$NDS FACIALFINCAPTION.NDS%TYPE := :NEW.NDS;
  new$TAXNOTE FACIALFINCAPTION.TAXNOTE%TYPE := :NEW.TAXNOTE;
  new$MANAGERBID FACIALFINCAPTION.MANAGERBID%TYPE := :NEW.MANAGERBID;
  new$BIDNUMBER FACIALFINCAPTION.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$GROUPID FACIALFINCAPTION.GROUPID%TYPE := :NEW.GROUPID;
  new$GROUPSUMMA FACIALFINCAPTION.GROUPSUMMA%TYPE := :NEW.GROUPSUMMA;
  new$DOCSTATEREF FACIALFINCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$LASTEXTRCHANGE FACIALFINCAPTION.LASTEXTRCHANGE%TYPE := :NEW.LASTEXTRCHANGE;
  new$FAXDOCCOUNT FACIALFINCAPTION.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$STIMATEID FACIALFINCAPTION.STIMATEID%TYPE := :NEW.STIMATEID;
  new$INTEGRATEDDOCREF FACIALFINCAPTION.INTEGRATEDDOCREF%TYPE := :NEW.INTEGRATEDDOCREF;
  new$REQUESTNUMBER FACIALFINCAPTION.REQUESTNUMBER%TYPE := :NEW.REQUESTNUMBER;
  new$REQUESTDATE FACIALFINCAPTION.REQUESTDATE%TYPE := :NEW.REQUESTDATE;
  new$RVERSION FACIALFINCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$FEDERALFUNDSREF FACIALFINCAPTION.FEDERALFUNDSREF%TYPE := :NEW.FEDERALFUNDSREF;
  new$ELDOCREF FACIALFINCAPTION.ELDOCREF%TYPE := :NEW.ELDOCREF;
  new$BUHOPERATIONCLS FACIALFINCAPTION.BUHOPERATIONCLS%TYPE := :NEW.BUHOPERATIONCLS;
  new$CLSTYPE FACIALFINCAPTION.CLSTYPE%TYPE := :NEW.CLSTYPE;
  new$OPERATIONDIRECTION FACIALFINCAPTION.OPERATIONDIRECTION%TYPE := :NEW.OPERATIONDIRECTION;
  new$SOURCETYPE FACIALFINCAPTION.SOURCETYPE%TYPE := :NEW.SOURCETYPE;
  new$DESTTYPE FACIALFINCAPTION.DESTTYPE%TYPE := :NEW.DESTTYPE;
  new$CARDNUMBER FACIALFINCAPTION.CARDNUMBER%TYPE := :NEW.CARDNUMBER;
  new$ISBLOCKED FACIALFINCAPTION.ISBLOCKED%TYPE := :NEW.ISBLOCKED;
  new$BLOCKEDCAUSE FACIALFINCAPTION.BLOCKEDCAUSE%TYPE := :NEW.BLOCKEDCAUSE;
  new$UNBLOCKEDDATE FACIALFINCAPTION.UNBLOCKEDDATE%TYPE := :NEW.UNBLOCKEDDATE;
  new$UNBLOCKEDCAUSE FACIALFINCAPTION.UNBLOCKEDCAUSE%TYPE := :NEW.UNBLOCKEDCAUSE;
  new$CASHIERPERSONALINFO FACIALFINCAPTION.CASHIERPERSONALINFO%TYPE := :NEW.CASHIERPERSONALINFO;
  new$BIDDATE FACIALFINCAPTION.BIDDATE%TYPE := :NEW.BIDDATE;
  new$CARDREF FACIALFINCAPTION.CARDREF%TYPE := :NEW.CARDREF;
  new$SOURCESTOREDPAYMENTPROPS FACIALFINCAPTION.SOURCESTOREDPAYMENTPROPS%TYPE := :NEW.SOURCESTOREDPAYMENTPROPS;
  new$DESTSTOREDPAYMENTPROPS FACIALFINCAPTION.DESTSTOREDPAYMENTPROPS%TYPE := :NEW.DESTSTOREDPAYMENTPROPS;
  new$STOREDPAYMENTNOTE FACIALFINCAPTION.STOREDPAYMENTNOTE%TYPE := :NEW.STOREDPAYMENTNOTE;
  new$DOCCHANGEDATE FACIALFINCAPTION.DOCCHANGEDATE%TYPE := :NEW.DOCCHANGEDATE;
  new$UINCODE FACIALFINCAPTION.UINCODE%TYPE := :NEW.UINCODE;
  new$DOCOSN FACIALFINCAPTION.DOCOSN%TYPE := :NEW.DOCOSN;
  new$SIGNERS FACIALFINCAPTION.SIGNERS%TYPE := :NEW.SIGNERS;
  new$DESTCLSTYPE FACIALFINCAPTION.DESTCLSTYPE%TYPE := :NEW.DESTCLSTYPE;
--
  SourceFacialAcc_CLS$ NUMBER(10);
  DestFacialAcc_CLS$ NUMBER(10);
  CNT$1 NUMBER(10);
  reestrAccepted1$ NUMBER(10);
  IsReject1$ NUMBER(10);
  UseFax$ NUMBER(10);
  DocNumber$ NUMBER(10);
  DetCount$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_FACIALFINCAPTION_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  if (new$SenderID is not null) then 
    /* Платежное поручение получено из УРМ */
    GetIntConst(30, 19,UseFax$);
    if ((new$BidNumber is null) and (UseFax$ = 1)) then 
      new$BidNumber:= new$DocNumber;
      
    END IF;
  END IF;
  if (new$credit is null)then 
    new$credit:= 0;
  END IF;
  if (new$ArhiveDoc is null) then 
    new$ArhiveDoc:= 0;
  END IF;
  if (new$PayTypeCls is null) then 
    new$PayTypeCls:= 0;
  END IF;
  if (new$BuhPaymentCls is null) then 
    new$BuhPaymentCls:= 0;
  END IF;
  if (new$BuhOperationCLS is null) then
    GetIntConst(60, 15,new$BuhOperationCLS);
  END IF;
  if (new$ClsType is null) then 
    new$ClsType := 0;
  END IF;
  if (new$DestClsType is null) then 
    new$DestClsType := new$ClsType;
  END IF;
  if (new$SourceFacialAcc_CLS is null) then 
    new$SourceFacialAcc_CLS:= 0;
  END IF;
  if (new$DestFacialAcc_CLS is null) then 
    new$DestFacialAcc_CLS:= 0;
  END IF;
  if (new$FaxDocCount is null) then 
    new$FaxDocCount := 0;
  END IF;
  if (new$OperationDirection is null) then 
    new$OperationDirection := 0;
  END IF;
  if (new$OperationDirection <> :old.OperationDirection) then
    if (new$OperationDirection = 0) then
      new$SourceType := 1;
      new$DestType := 1;
          
    else
      if (new$OperationDirection = 1) then
        new$SourceType := 1;
        new$DestType := -1;
              
      else
        if (new$OperationDirection = 2) then
          new$SourceType := -1;
          new$DestType := 1;
                  
        else
          new$SourceType := -1;
          new$DestType := -1;
                  
        END IF;
      END IF;  
    END IF;
  END IF;
  if (new$DepartmentCls is null) then
    GetIntConst(30, 20,DocNumber$); 
    if (DocNumber$ is null) then 
      new$DepartmentCls:= 0;
          
    else 
      new$DepartmentCls:= DocNumber$;
      
    END IF;
  END IF;
  /* проверка на изменение Бюджета */
  if (new$BudgetRef <> :old.BudgetRef) then
    if ( not((new$BudgetRef is null) and (:old.BudgetRef is null)) ) then
      select count(ID)       into DetCount$ from FacialFinDetail where RecordIndex = :old.ID
      ;
      if (DetCount$ > 0) then 
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* документ не может быть одновременно и принятым и отклоненным*/
  if ((new$AcceptDate is not null) and (new$Reject_Cls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_FACIALFINCAPTION_BU_1)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- Инициализация значений по-умолчанию для добавляемых полей на изменение
   IF (new$GroupID IS NULL) THEN new$GroupID := new$ID; END IF;
   IF (new$GroupSumma IS NULL) THEN new$GroupSumma := 0; END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_FACIALFINCAPTION_BU_5)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (not (    ((new$progindex = 63) or (new$progindex = 64) or (new$progindex = 68) or (new$progindex = 70))
  and (   (((new$credit - :old.credit)>0.001)or((new$credit - :old.credit)<-0.001))
  or (new$sourcefacialacc_cls <> :old.sourcefacialacc_cls)
  or (
  ((new$sourceaccount is null) and (:old.sourceaccount is not null)) or
  ((new$sourceaccount is not null) and (:old.sourceaccount is null)) or
  ((new$sourceaccount <> :old.sourceaccount ) and (:old.sourceaccount is not null) and (new$sourceaccount is not null))                                             
  )
  or (
  ((new$destaccount is null) and (:old.destaccount is not null)) or
  ((new$destaccount is not null) and (:old.destaccount is null)) or
  ((new$destaccount <> :old.destaccount ) and (:old.destaccount is not null) and (new$destaccount is not null))
  )
  or (    (:old.reestr_ref is null)
  and (new$reestr_ref is not null)
  )
  or (    (:old.reestr_ref is not null)
  and (new$reestr_ref is null)
  )
  or (:old.reestr_ref <> new$reestr_ref)
  )
  )
  )
  then /* для корректной обработки неопределенности с NULL полями*/
    reestrAccepted1$ := 0;  /* заглушка для IB 4.2 */
      
  else 
    BEGIN
      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where 
      id=new$REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
        
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrUpdate');
    END IF;
    BEGIN

      select accepted     into reestrAccepted1$ from
      FacialFinReestr
      where
      id=:old.REESTR_REF
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (reestrAccepted1$ = 1) then
      RaiseException('ex_AcceptedReestrUpdate');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_6 (TR_FACIALFINCAPTION_BU_6)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:old.ProgIndex in(63,68,70)) then /* только для исходящих платежек*/
    SELECT COUNT(id ) INTO CNT$1
    from paydocexchange where ((paydocref=:old.id)and(status<>0)and(CodeFormat<>50)) AND (ROWNUM = 1);
    if ((CNT$1<> 0)) then
      if(/* (new.DOCNUMBER<>old.DOCNUMBER) or ((new.DOCNUMBER is NULL)and(not old.DOCNUMBER is NULL)) or ((old.DOCNUMBER is NULL)and(not new.DOCNUMBER is NULL)) or*/
      (new$SOURCEDOCNUM<>:old.SOURCEDOCNUM) or ((new$SOURCEDOCNUM is NULL)and(not :old.SOURCEDOCNUM is NULL)) or ((:old.SOURCEDOCNUM is NULL)and(not new$SOURCEDOCNUM is NULL)) or
      (new$PAYDATE<>:old.PAYDATE) or ((new$PAYDATE is NULL)and(not :old.PAYDATE is NULL)) or ((:old.PAYDATE is NULL)and(not new$PAYDATE is NULL))or
      /* (new.DOCUMENTDATE<>old.DOCUMENTDATE) or ((new.DOCUMENTDATE is NULL)and(not old.DOCUMENTDATE is NULL)) or ((old.DOCUMENTDATE is NULL)and(not new.DOCUMENTDATE is NULL))or*/
      (new$REESTRDATE<>:old.REESTRDATE) or ((new$REESTRDATE is NULL)and(not :old.REESTRDATE is NULL)) or ((:old.REESTRDATE is NULL)and(not new$REESTRDATE is NULL))or
      (((new$credit - :old.credit)>0.001)or((new$credit - :old.credit)<-0.001)) or
      (new$SOURCEACCOUNT<>:old.SOURCEACCOUNT) or
      (new$DESTACCOUNT<>:old.DESTACCOUNT) or
      (new$PAYTYPECLS<>:old.PAYTYPECLS) or
      (new$NOTE<>:old.NOTE) or  ((new$NOTE is NULL)and(not :old.NOTE is NULL)) or ((:old.NOTE is NULL)and(not new$NOTE is NULL))or
      (new$PAYPRIORITY<>:old.PAYPRIORITY) or ((new$PAYPRIORITY is NULL)and(not :old.PAYPRIORITY is NULL)) or ((:old.PAYPRIORITY is NULL)and(not new$PAYPRIORITY is NULL))or
      (new$REESTR_REF<>:old.REESTR_REF) or ((new$REESTR_REF is NULL)and(not :old.REESTR_REF is NULL)) or ((:old.REESTR_REF is NULL)and(not new$REESTR_REF is NULL))or
      (new$NDS<>:old.NDS) or ((new$NDS is NULL)and(not :old.NDS is NULL)) or ((:old.NDS is NULL)and(not new$NDS is NULL))or
      (new$TAXNOTE<>:old.TAXNOTE) or ((new$TAXNOTE is NULL)and(not :old.TAXNOTE is NULL)) or ((:old.TAXNOTE is NULL)and(not new$TAXNOTE is NULL)) )then
        RaiseException('ex_CannotChangeSended');
      END IF;
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_10 (TR_FACIALFINCAPTION_BU_10)
-- Create 16.03.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$IntegratedDocRef IS NOT NULL) THEN
        /* Если документ входит в сводный и у него изменились ключевые аттрибуты, то нельзя их менять если они отличаются
      /* от атрибутов родительского документа*/
      IF (    (   (new$AcceptDate = :OLD.AcceptDate)
               OR ((new$AcceptDate IS NULL) AND (:OLD.AcceptDate IS NULL))
              )
          AND (   (new$Reject_CLS = :OLD.Reject_CLS)
               OR ((new$Reject_CLS IS NULL) AND (:OLD.Reject_CLS IS NULL))
              )
          AND (   (new$RejectCause = :OLD.RejectCause)
               OR ((new$RejectCause IS NULL) AND (:OLD.RejectCause IS NULL))
              )
          AND (   (new$TREASUARYDOCSTATECLS = :OLD.TREASUARYDOCSTATECLS)
               OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                   AND (:OLD.TREASUARYDOCSTATECLS IS NULL)
                  )
              )
          AND (   (new$DOCSTATEREF = :OLD.DOCSTATEREF)
               OR ((new$DOCSTATEREF IS NULL) AND (:OLD.DOCSTATEREF IS NULL))
              )
          AND (   (new$REESTR_REF = :OLD.REESTR_REF)
               OR ((new$REESTR_REF IS NULL) AND (:OLD.REESTR_REF IS NULL))
              )
          AND (new$SOURCEACCOUNT = :OLD.SOURCEACCOUNT)
          AND (new$DESTACCOUNT = :OLD.DESTACCOUNT)
         ) THEN
         new$AcceptDate := :OLD.AcceptDate;
      ELSE
         FOR R$ IN (SELECT fc.AcceptDate, fc.Reject_CLS, fc.RejectCause,
                           fc.TREASUARYDOCSTATECLS, fc.DOCSTATEREF,
                           fc.REESTR_REF, fc.SOURCEACCOUNT, fc.DESTACCOUNT
                      FROM FacialFinCaption fc
                     WHERE (fc.ID = :NEW.IntegratedDocRef)) LOOP
            IF (    (   (new$AcceptDate = R$.AcceptDate)
                     OR ((new$AcceptDate IS NULL) AND (R$.AcceptDate IS NULL)
                        )
                    )
                AND (   (new$Reject_CLS = R$.Reject_CLS)
                     OR ((new$Reject_CLS IS NULL) AND (R$.Reject_CLS IS NULL)
                        )
                    )
                AND (   (new$RejectCause = R$.RejectCause)
                     OR (    (new$RejectCause IS NULL)
                         AND (R$.RejectCause IS NULL)
                        )
                    )
                AND (   (new$TREASUARYDOCSTATECLS = R$.TREASUARYDOCSTATECLS)
                     OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                         AND (R$.TREASUARYDOCSTATECLS IS NULL)
                        )
                    )
                AND (   (new$DOCSTATEREF = R$.DOCSTATEREF)
                     OR (    (new$DOCSTATEREF IS NULL)
                         AND (R$.DOCSTATEREF IS NULL)
                        )
                    )
                AND (   (new$REESTR_REF = R$.REESTR_REF)
                     OR ((new$REESTR_REF IS NULL) AND (R$.REESTR_REF IS NULL)
                        )
                    )
                AND (new$SOURCEACCOUNT = R$.SOURCEACCOUNT)
                AND (new$DESTACCOUNT = R$.DESTACCOUNT)
               ) THEN
               new$AcceptDate := R$.AcceptDate;
            ELSE
               RaiseException ('EX_CANNOTUPDATECHILDDOC');
            END IF;
         END LOOP;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- BU_32 (TR_FACIALFINCAPTION_BU_32)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$Reestr_ref IS NULL)    /* Чтобы не вызывать select чаще, чем нужно*/
                              THEN
      new$SourceDocNum := '';
      new$ReestrDate := NULL;
   ELSIF (    (new$Reestr_ref = :OLD.Reestr_ref)
          AND (new$SourceDocNum = :OLD.SourceDocNum)
          AND (new$ReestrDate = :OLD.ReestrDate)
         ) THEN
/* нужно для корректной обработки неопределенности со сравнением нуловых полей */
      NULL;
   ELSE
      BEGIN
         SELECT ffr.ReestrNumber, ffr.ReestrDate
           INTO new$SourceDocNum, new$ReestrDate
           FROM FacialFinReestr ffr
          WHERE ffr.ID = new$Reestr_ref;
      EXCEPTION
         WHEN NO_DATA_FOUND THEN
            new$SourceDocNum := NULL;
            new$ReestrDate := NULL;
      END;
   END IF;

-- - - - - - - - - - - - -
-- BU_60 (T_FACIALFINCAPTION_BU_60)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF ((new$progindex = 60) AND (new$Credit <> :OLD.Credit)) THEN
      UPDATE FacialFinDetail
         SET Credit = new$Credit
       WHERE (RecordIndex = new$ID);
   END IF;

-- - - - - - - - - - - - -
-- BU_70 (TR_FACIALFINCAPTION_BU_70)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   -- При проведении реестра устанавливаем дату принятия у записи гарантии
   IF (new$SubProgIndex = 416) THEN
      UPDATE Guarantee
         SET AcceptDate = new$AcceptDate
       WHERE SubRecordIndex = new$ID;
   END IF;

-- - - - - - - - - - - - -
-- BU_100 (T_FACIALFINCAPTION_BU_100)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /* Триггер изменения данных, записи по финансированию */
   IF (    (   (:OLD.SourceFacialAcc_CLS <> new$SourceFacialAcc_CLS)
            OR (:OLD.DestFacialAcc_CLS <> new$DestFacialAcc_CLS)
           )
       AND ((new$SubProgIndex <> 1) OR (new$SubProgIndex IS NULL))
      ) THEN
      FOR R$ IN (SELECT ID, SourceFacialAcc_CLS, DestFacialAcc_CLS
                   FROM FacialFinDetail
                  WHERE RecordIndex = new$ID) LOOP
         IF (NOT (new$SourceFacialAcc_CLS = 0)) THEN
            SourceFacialAcc_CLS$ := new$SourceFacialAcc_CLS;
         ELSE
            SourceFacialAcc_CLS$ := R$.SourceFacialAcc_CLS;
         END IF;

         IF (NOT (new$DestFacialAcc_CLS = 0)) THEN
            DestFacialAcc_CLS$ := new$DestFacialAcc_CLS;
         ELSE
            DestFacialAcc_CLS$ := R$.DestFacialAcc_CLS;
         END IF;

         IF (:OLD.SourceFacialAcc_CLS <> new$SourceFacialAcc_CLS) THEN
            UPDATE FacialFinDetail
               SET SourceFacialAcc_CLS = SourceFacialAcc_CLS$,
                   RVersion = -1
             WHERE (ID = R$.ID);
         END IF;

         IF (:OLD.DestFacialAcc_CLS <> new$DestFacialAcc_CLS) THEN
            UPDATE FacialFinDetail
               SET DestFacialAcc_CLS = DestFacialAcc_CLS$,
                   RVersion = -1
             WHERE (ID = R$.ID);
         END IF;
      END LOOP;
   END IF;

   /* Если изменились поля блокировки/разблокировки средств, полученных
     от предпринимательской деятельности сносим их в деталь.*/
  IF (((NEW$IsBlocked <> :OLD.IsBlocked) OR
      ((NEW$IsBlocked IS NULL) AND (:OLD.IsBlocked IS NOT NULL)) OR
      ((NEW$IsBlocked IS NOT NULL) AND (:OLD.IsBlocked IS NULL))
     ) OR
     ((NEW$BlockedCause <> :OLD.BlockedCause) OR
      ((NEW$BlockedCause IS NULL) AND (:OLD.BlockedCause IS NOT NULL)) OR
      ((NEW$BlockedCause IS NOT NULL) AND (:OLD.BlockedCause IS NULL))
     ) OR
     ((NEW$UnBlockedDate <> :OLD.UnBlockedDate) OR
      ((NEW$UnBlockedDate IS NULL) AND (:OLD.UnBlockedDate IS NOT NULL)) OR
      ((NEW$UnBlockedDate IS NOT NULL) AND (:OLD.UnBlockedDate IS NULL))
     ) OR
     ((NEW$UnBlockedCause <> :OLD.UnBlockedCause) OR
      ((NEW$UnBlockedDate IS NULL) AND (:OLD.UnBlockedCause IS NOT NULL)) OR
      ((NEW$UnBlockedCause IS NOT NULL) AND (:OLD.UnBlockedCause IS NULL))
     )) THEN
     UPDATE FacialFinDetail ffd
     SET ffd.IsBlocked = NEW$IsBlocked, ffd.BlockedCause = NEW$BlockedCause,
         ffd.UnBlockedDate = NEW$UnBlockedDate, ffd.UnBlockedCause = NEW$UnBlockedCause
     WHERE ffd.recordindex = NEW$ID;
  end if;

-- - - - - - - - - - - - -
-- BU_210 (TR_FACIALFINCAPTION_BU_210)
-- Create 27.08.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   /* Сохранение в базу истории изменений состояний*/
   IF (new$DOCSTATEREF <> :OLD.DOCSTATEREF) THEN
      INSERT INTO StateJumpHistory
                  (DocID, BeginStateRef, EndStateRef
                  )
           VALUES (new$ID, :OLD.DOCSTATEREF, new$DOCSTATEREF
                  );
   END IF;

-- - - - - - - - - - - - -
-- BU_300 (T_FACIALFINCAPTION_BU_300)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IsReject1$ := -1;
  if ((:old.Reject_CLS is null)and(new$Reject_CLS is not null)) then
    IsReject1$ := 1;
      
  else
    if ((:old.Reject_CLS is not null)and(new$Reject_CLS is null)) then
      IsReject1$ := 0;
    END IF;
  END IF;
  if (IsReject1$  <> -1) then
    update LinkRecords set
    IsRejected = IsReject1$

    where
    ChildID = new$ID;
    update LinkRecords set
    IsRejected = IsReject1$

    where
    ChildID in (select d.id from FacialFinDetail d where d.RecordIndex = new$id);
      
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_FACIALFINCAPTION_BU_700)
-- Create 17.09.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$RVersion IS NULL) THEN
      new$RVersion := 1;
   ELSIF ((new$RVersion = -1) AND (:OLD.RVersion <> -1)) THEN
      new$RVersion := :OLD.RVersion;
   ELSE
      new$RVersion := :OLD.RVersion + 1;
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_FACIALFINCAPTION SET
    ID = new$ID,
    DOCNUMBER = new$DOCNUMBER,
    SOURCEDOCNUM = new$SOURCEDOCNUM,
    PAYDATE = new$PAYDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    DOCUMENTDATE = new$DOCUMENTDATE,
    REESTRDATE = new$REESTRDATE,
    CREDIT = new$CREDIT,
    SOURCEACCOUNT = new$SOURCEACCOUNT,
    SOURCEFACIALACC_CLS = new$SOURCEFACIALACC_CLS,
    DESTACCOUNT = new$DESTACCOUNT,
    DESTFACIALACC_CLS = new$DESTFACIALACC_CLS,
    PROGINDEX = new$PROGINDEX,
    ARHIVEDOC = new$ARHIVEDOC,
    PAYSYMBOLCLS = new$PAYSYMBOLCLS,
    PAYTYPECLS = new$PAYTYPECLS,
    NOTE = new$NOTE,
    PERIOD = new$PERIOD,
    PAYPRIORITY = new$PAYPRIORITY,
    TYPEOPERATIONCLS = new$TYPEOPERATIONCLS,
    BUHPAYMENTCLS = new$BUHPAYMENTCLS,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    RECORDINDEX = new$RECORDINDEX,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    REESTR_REF = new$REESTR_REF,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CLIENTBANKNUMBER = new$CLIENTBANKNUMBER,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    TRUSTNUMBER = new$TRUSTNUMBER,
    LINKEDDOCUMENT = new$LINKEDDOCUMENT,
    BNKRECORDID = new$BNKRECORDID,
    SUBPROGINDEX = new$SUBPROGINDEX,
    DOCUMENTSTATE = new$DOCUMENTSTATE,
    USERSVISA = new$USERSVISA,
    TREASUARYDOCSTATECLS = new$TREASUARYDOCSTATECLS,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    NDS = new$NDS,
    TAXNOTE = new$TAXNOTE,
    MANAGERBID = new$MANAGERBID,
    BIDNUMBER = new$BIDNUMBER,
    GROUPID = new$GROUPID,
    GROUPSUMMA = new$GROUPSUMMA,
    DOCSTATEREF = new$DOCSTATEREF,
    LASTEXTRCHANGE = new$LASTEXTRCHANGE,
    FAXDOCCOUNT = new$FAXDOCCOUNT,
    STIMATEID = new$STIMATEID,
    INTEGRATEDDOCREF = new$INTEGRATEDDOCREF,
    REQUESTNUMBER = new$REQUESTNUMBER,
    REQUESTDATE = new$REQUESTDATE,
    RVERSION = new$RVERSION,
    FEDERALFUNDSREF = new$FEDERALFUNDSREF,
    ELDOCREF = new$ELDOCREF,
    BUHOPERATIONCLS = new$BUHOPERATIONCLS,
    CLSTYPE = new$CLSTYPE,
    OPERATIONDIRECTION = new$OPERATIONDIRECTION,
    SOURCETYPE = new$SOURCETYPE,
    DESTTYPE = new$DESTTYPE,
    CARDNUMBER = new$CARDNUMBER,
    ISBLOCKED = new$ISBLOCKED,
    BLOCKEDCAUSE = new$BLOCKEDCAUSE,
    UNBLOCKEDDATE = new$UNBLOCKEDDATE,
    UNBLOCKEDCAUSE = new$UNBLOCKEDCAUSE,
    CASHIERPERSONALINFO = new$CASHIERPERSONALINFO,
    BIDDATE = new$BIDDATE,
    CARDREF = new$CARDREF,
    SOURCESTOREDPAYMENTPROPS = new$SOURCESTOREDPAYMENTPROPS,
    DESTSTOREDPAYMENTPROPS = new$DESTSTOREDPAYMENTPROPS,
    STOREDPAYMENTNOTE = new$STOREDPAYMENTNOTE,
    DOCCHANGEDATE = new$DOCCHANGEDATE,
    UINCODE = new$UINCODE,
    DOCOSN = new$DOCOSN,
    SIGNERS = new$SIGNERS,
    DESTCLSTYPE = new$DESTCLSTYPE
  WHERE ID = :OLD.ID
      AND (RVersion = :OLD.RVersion OR RVersion IS NULL AND :OLD.RVersion IS NULL);

   IF SQL%ROWCOUNT <> 1 THEN
      RaiseException ('EX_RECORDCHANGED');
   END IF;

-- - - - - - - - - - - - -
-- AU_10 (TR_FACIALFINCAPTION_AU_10)
-- Create 05.03.2004
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (new$ProgIndex = 72) THEN                       /* Для сводных платежек*/
      IF (    (   (new$AcceptDate = :OLD.AcceptDate)
               OR ((new$AcceptDate IS NULL) AND (:OLD.AcceptDate IS NULL))
              )
          AND (   (new$Reject_CLS = :OLD.Reject_CLS)
               OR ((new$Reject_CLS IS NULL) AND (:OLD.Reject_CLS IS NULL))
              )
          AND (   (new$RejectCause = :OLD.RejectCause)
               OR ((new$RejectCause IS NULL) AND (:OLD.RejectCause IS NULL))
              )
          AND (   (new$TREASUARYDOCSTATECLS = :OLD.TREASUARYDOCSTATECLS)
               OR (    (new$TREASUARYDOCSTATECLS IS NULL)
                   AND (:OLD.TREASUARYDOCSTATECLS IS NULL)
                  )
              )
          AND (   (new$DOCSTATEREF = :OLD.DOCSTATEREF)
               OR ((new$DOCSTATEREF IS NULL) AND (:OLD.DOCSTATEREF IS NULL))
              )
          AND (   (new$REESTR_REF = :OLD.REESTR_REF)
               OR ((new$REESTR_REF IS NULL) AND (:OLD.REESTR_REF IS NULL))
              )
          AND (new$SOURCEACCOUNT = :OLD.SOURCEACCOUNT)
          AND (new$DESTACCOUNT = :OLD.DESTACCOUNT)
         ) THEN
         NULL;                /*      new$AcceptDate := :old.AcceptDate;   */
      ELSE
         /* Если изменились ключевые атрибуты, сносим их во входящие в нее*/
         UPDATE TB_FacialFinCaption
            SET AcceptDate = new$AcceptDate,
                Reject_CLS = new$Reject_CLS,
                RejectCause = new$RejectCause,
                TREASUARYDOCSTATECLS = new$TREASUARYDOCSTATECLS,
                DOCSTATEREF = new$DOCSTATEREF,
                REESTR_REF = new$REESTR_REF,
                SOURCEACCOUNT = new$SOURCEACCOUNT,
                DESTACCOUNT = new$DESTACCOUNT
          WHERE IntegratedDocRef = new$ID;
      END IF;
   END IF;

-- - - - - - - - - - - - -
-- AU_300 (TR_FACIALFINCAPTION_AU_300)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  /* если поменялась дата принятия или бух операция или тип классификации, то сносим это в деталь */
  if ((new$AcceptDate <> :old.AcceptDate)or((new$AcceptDate is not null)and(:old.AcceptDate is null))
  or((new$AcceptDate is null)and(:old.AcceptDate is not null))) then
    update facialfindetail set
    AcceptDate = new$AcceptDate,
    RVersion = -1
    where
    RecordIndex = new$id;
  END IF;
  if (new$BuhOperationCLS <> :old.BuhOperationCLS)  then
    update facialfindetail set
    BuhOperationCLS = new$BuhOperationCLS,
    RVersion = -1
    where
    RecordIndex = new$id;
  END IF;
  if ((new$ClsType <> :old.ClsType)
  and
  ((new$RVersion<>:old.RVersion)
  or
  ((:old.RVersion is null)and(new$RVersion is not null)))) then
    if (new$ClsType = 0) then
      update facialfindetail set
      SourceKD = 0,
      DestKD = 0,
      SourceIFS = 0,
      DestIFS = 0,
      ClsType = new$ClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(ClsType=:old.ClsType);
    END IF;
    if (new$ClsType = 1) then
      update facialfindetail set
      SourceKD = 0,
      DestKD = 0,
      SourceKVSR = 0,
      SourceKFSR = 0,
      SourceKCSR = 0,
      SourceKVR = 0,
      SourceKESR = 0,
      DestKVSR = 0,
      DestKFSR = 0,
      DestKCSR = 0,
      DestKVR = 0,
      DestKESR = 0,
      ClsType = new$ClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(ClsType=:old.ClsType);
    END IF;
    if (new$ClsType = 2) then
      update facialfindetail set
      SourceIFS = 0,
      DestIFS = 0,
      SourceKVSR = 0,
      SourceKFSR = 0,
      SourceKCSR = 0,
      SourceKVR = 0,
      SourceKESR = 0,
      DestKVSR = 0,
      DestKFSR = 0,
      DestKCSR = 0,
      DestKVR = 0,
      DestKESR = 0,
      ClsType = new$ClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(ClsType=:old.ClsType);
      
    END IF;
  END IF;
  if ((new$DestClsType <> :old.DestClsType)
  and
  ((new$RVersion<>:old.RVersion)
  or
  ((:old.RVersion is null)and(new$RVersion is not null)))) then
    if (new$DestClsType = 0) then
      update facialfindetail set
      DestKD = 0,
      DestIFS = 0,
      DestClsType = new$DestClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(DestClsType=:old.DestClsType);
    END IF;
    if (new$DestClsType = 1) then
      update facialfindetail set
      DestKD = 0,
      DestKVSR = 0,
      DestKFSR = 0,
      DestKCSR = 0,
      DestKVR = 0,
      DestKESR = 0,
      DestClsType = new$DestClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(DestClsType=:old.DestClsType);
    END IF;
    if (new$DestClsType = 2) then
      update facialfindetail set
      DestIFS = 0,
      DestKVSR = 0,
      DestKFSR = 0,
      DestKCSR = 0,
      DestKVR = 0,
      DestKESR = 0,
      DestClsType = new$DestClsType,
      RVersion = -1
      where
      (RecordIndex = new$id)and(DestClsType=:old.DestClsType);
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_FACIALFINCAPTION_AU_500)
-- Create 28.04.2005
-- Last update 20.05.2005
-- - - - - - - - - - - - -

   IF (:NEW.ID <> :OLD.ID) THEN
      INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate)
        VALUES (23, :OLD.ID, SYSDATE);

      DELETE FROM DelRecIndexes
        WHERE (TableID = 23) AND (RecordId = :NEW.ID);
   END IF;

END;
/
commit work 
/




ALTER TABLE TB_FacialFinCaption MODIFY(DestClsType NOT NULL)
/

-- #########################################################
-- #########################################################
-- Delete_AccsOper.sql
-- #########################################################
-- #########################################################

/* Удаление Операции со счетами через распоряжение на финансирование */
delete from interfaces
where guid='{0A79A460-3E48-479A-940A-57315837EF15}'
/
commit work
/

-- #########################################################
-- #########################################################
-- UpdateFieldsDescr_ora.sql
-- #########################################################
-- #########################################################


-- Интервал обновлений: 60500 - 80000. Последнее изменение БД было 05.12.2014 16:52:31.
CREATE OR REPLACE PROCEDURE ImportDocType (
   ID_               NUMBER,
   PROGINDEX_        NUMBER,
   NAME_             VARCHAR2,
   USESTATE_         NUMBER,
   DBTABLE_          VARCHAR2,
   NEEDEDS_          NUMBER,
   LOCKMASK_         NUMBER,
   DEFAULTACTIONMACROSNAME_ VARCHAR2,
   DOCUMENTKIND_     NUMBER,
   SHORTNAME_         VARCHAR2
) IS
   IDExists$   NUMBER (10);
BEGIN
   SELECT COUNT (ID)
     INTO IDExists$
     FROM DocumentTypes
    WHERE (ID = ID_);

  IF (IDExists$ = 0) THEN
     INSERT INTO DocumentTypes
                 (ID, PROGINDEX, NAME, USESTATE, DBTABLE, NEEDEDS, LOCKMASK, DEFAULTACTIONMACROSNAME, DOCUMENTKIND, SHORTNAME)
          VALUES (ID_, PROGINDEX_, NAME_, USESTATE_, DBTABLE_, NEEDEDS_, LOCKMASK_, DEFAULTACTIONMACROSNAME_, DOCUMENTKIND_, SHORTNAME_);
  else
      Update documenttypes set
        Name=Name_,
		    DBTABLE=DBTABLE_,
        LockMask=LockMask_,
        DEFAULTACTIONMACROSNAME=DEFAULTACTIONMACROSNAME_,
        DOCUMENTKIND=DOCUMENTKIND_,
        SHORTNAME=SHORTNAME_,
	      PROGINDEX=PROGINDEX_
      where (id=ID_)
        and (
          (Name<>Name_) or
          ((LockMask is null) and (LockMask_ is not null)) or
          ((LockMask is not null) and (LockMask_ is null)) or
          ((LockMask is not null) and (LockMask_ is not null) and (LockMask <> LockMask_)) or
          (DEFAULTACTIONMACROSNAME is null) or
          (DOCUMENTKIND<>DOCUMENTKIND_) or 
          (SHORTNAME is null) or 
          (SHORTNAME<>SHORTNAME_) or
          (PROGINDEX <> PROGINDEX_)
        );
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE UPDATEINTERFACES (
  CLS_   NUMBER,
  NOTE_  VARCHAR2,
  GUID_  VARCHAR2,
  PARAM_ VARCHAR2
) IS
  IDExists$ NUMBER (10);
BEGIN
  SELECT COUNT (ID)
   INTO IDEXISTS$
   FROM INTERFACES
  WHERE (GUID=GUID_);
  
  IF (IDExists$ = 0)  THEN
    INSERT INTO INTERFACES
      (CLS,NOTE,GUID,PARAM)
    VALUES
      (CLS_,NOTE_,GUID_,PARAM_);
  ELSE
    IF ((PARAM_ ='')OR(PARAM_ IS NULL)) THEN 
      UPDATE INTERFACES SET
        CLS = CLS_
      WHERE (GUID=GUID_) AND ((CLS<> CLS_)OR(CLS IS NULL));
    ELSE 
      UPDATE INTERFACES SET
        CLS = CLS_
      WHERE (GUID=GUID_) AND (PARAM=PARAM_) AND ((CLS<> CLS_)OR(CLS IS NULL));
    END IF;
  END IF;
END;
/

-- Добавляем типы документов
DROP PROCEDURE ImportDocType
/

DROP PROCEDURE UPDATEINTERFACES
/




CREATE OR REPLACE PROCEDURE ImportField (
   ID_                NUMBER,
   NAME_              VARCHAR2,
   ITFFIELDNAME_      VARCHAR2,
   NOTE_              VARCHAR2,
   TEMPLATEFIELD_     VARCHAR2,
   ISBUDGET_          NUMBER,
   DOCTYPEREF_        NUMBER,
   DETAILNUMBER_      NUMBER,
   ONLYREAD_          NUMBER,
   ReportFieldName_   VARCHAR2,
   KIND_	      NUMBER,
   FIELDINFOREF_      NUMBER
) IS
   IDExists$   NUMBER (10);
BEGIN
   SELECT COUNT (ID)
     INTO IDExists$
     FROM DocumentFields
    WHERE (ID = ID_);

   IF (IDExists$ <> 0) THEN
      UPDATE DocumentFields
         SET NAME = NAME_,
             ITFFIELDNAME = ITFFIELDNAME_,
             NOTE = NOTE_,
             TEMPLATEFIELD = TEMPLATEFIELD_,
             ISBUDGET = ISBUDGET_,
             DOCTYPEREF = DOCTYPEREF_,
             DETAILNUMBER = DETAILNUMBER_,
             ONLYREAD = ONLYREAD_,
             ReportFieldName = ReportFieldName_,
			 FIELDINFOREF = FIELDINFOREF_
       WHERE (ID = ID_)
         AND NOT (
                      (
                          (
                           (NAME IS NOT NULL AND NAME_ IS NOT NULL) AND
                           (UPPER (NAME) = UPPER (NAME_))
                          )
                       OR (NAME IS NULL AND NAME_ IS NULL)
                      )

                  AND (
                          (
                           (ITFFIELDNAME_ IS NOT NULL AND ITFFIELDNAME IS NOT NULL) AND
                           (UPPER (ITFFIELDNAME_) = UPPER (ITFFIELDNAME))
                          )
                       OR (ITFFIELDNAME_ IS NULL AND ITFFIELDNAME IS NULL)
                      )
                      
                  AND (
                          (
                           (NOTE IS NOT NULL AND NOTE_ IS NOT NULL) AND
                           (UPPER (NOTE) = UPPER (NOTE_))
                          )
                       OR (NOTE IS NULL AND NOTE_ IS NULL)
                      )
                  AND (UPPER (TEMPLATEFIELD) = UPPER (TEMPLATEFIELD_))
                  AND (
                          (
                           (ISBUDGET IS NOT NULL AND ISBUDGET_ IS NOT NULL) AND
                           (ISBUDGET = ISBUDGET_)
                          )
                       OR (ISBUDGET IS NULL AND ISBUDGET_ IS NULL)
                      )
                  AND (
                          (
                           (FIELDINFOREF IS NOT NULL AND FIELDINFOREF_ IS NOT NULL) AND
                           (FIELDINFOREF = FIELDINFOREF_)
                          )
                       OR (FIELDINFOREF IS NULL AND FIELDINFOREF_ IS NULL)
                      )
                  AND (DOCTYPEREF = DOCTYPEREF_)
                  AND (DETAILNUMBER = DETAILNUMBER_)
                  AND (ONLYREAD = ONLYREAD_)
                  AND (
                          (
                           (ReportFieldName IS NOT NULL AND ReportFieldName_ IS NOT NULL) AND
                           (UPPER (ReportFieldName) = UPPER (ReportFieldName_))
                          )
                       OR (ReportFieldName IS NULL AND ReportFieldName_ IS NULL)
                      )
                 );
   ELSE
      INSERT INTO DocumentFields
                  (ID, NAME, ITFFIELDNAME, NOTE, TEMPLATEFIELD,
                   ISBUDGET, DOCTYPEREF, DETAILNUMBER, ONLYREAD, ReportFieldName, FIELDINFOREF
                  )
           VALUES (ID_, NAME_, ITFFIELDNAME_, NOTE_, TEMPLATEFIELD_,
                   ISBUDGET_, DOCTYPEREF_, DETAILNUMBER_, ONLYREAD_, ReportFieldName_, FIELDINFOREF_
                  );
   END IF;

   FOR tab_rec IN (
                   SELECT ID
                     FROM DocumentFields
                    WHERE (ID <> ID_)
                      AND (DOCTYPEREF = DOCTYPEREF_)
                      AND (
                              (
                               (ISBUDGET IS NOT NULL AND ISBUDGET_ IS NOT NULL) AND
                               (ISBUDGET = ISBUDGET_)
                              )
                           OR (ISBUDGET IS NULL AND ISBUDGET_ IS NULL)
                          )
                      AND (DETAILNUMBER = DETAILNUMBER_)
              AND ( /* если имя поля на интерфейсе пустое, а имя поля на шаблоне не пустое, то проверяем имя поля на шаблоне */
                            (
                             ((ITFFIELDNAME_ IS NULL)or(ITFFIELDNAME_=' '))
                 and not((TEMPLATEFIELD_ IS NULL)or(TEMPLATEFIELD_=' '))
                 and(TEMPLATEFIELD is NOT null) and (UPPER(TEMPLATEFIELD)=UPPER(TEMPLATEFIELD_))
                            )
                    or (
                        not ((ITFFIELDNAME_ IS NULL) or (ITFFIELDNAME_=' '))
                                and (ITFFIELDNAME IS NOT NULL) and (UPPER(ITFFIELDNAME)=UPPER(ITFFIELDNAME_)))
                            )
                       )
   LOOP
      UPDATE State_OpenFields
         SET DOCFIELDREF = ID_
       WHERE (DOCFIELDREF = tab_rec.ID);

      UPDATE DOCLOCKFIELDS
         SET FIELDREF = ID_
       WHERE (FIELDREF = tab_rec.ID);

      UPDATE staticlinks
         SET PARENTFIELDREF = ID_
      WHERE (PARENTFIELDREF = tab_rec.ID);

      UPDATE staticlinks
         SET CHILDFIELDREF = ID_
      WHERE (CHILDFIELDREF = tab_rec.ID);

      DELETE FROM DocumentFields
            WHERE (ID = tab_rec.ID);
   END LOOP;
END;
/

CREATE OR REPLACE PROCEDURE DeleteFields (ID$ NUMBER) IS
BEGIN
  DELETE FROM State_OpenFields
  WHERE (docfieldref = ID$);
  DELETE FROM DOCLOCKFIELDS
  WHERE (fieldref = ID$);

  DELETE FROM STATE_JUMPCONTROL
  WHERE STATICLINKREF IN(SELECT ID FROM staticlinks
                           WHERE (PARENTFIELDREF=ID$)OR(CHILDFIELDREF=ID$));
  DELETE FROM staticlinks
  WHERE (PARENTFIELDREF=ID$)OR(CHILDFIELDREF=ID$);
  
  DELETE FROM DOCUMENTTEMPLATEFIELDS
  WHERE (FIELDS=ID$);

  DELETE FROM DocumentFields
  WHERE (id = ID$);
END;
/

CREATE OR REPLACE PROCEDURE INSERTCONST (
  PROGINDEX_     NUMBER,
  CONSTINDEX_    NUMBER,
  CONSTTYPE_     NUMBER,
  NOTE_          VARCHAR2,
  VARCHARVALUE_  VARCHAR2,
  DOUBLEVALUE_   NUMBER,
  INTVALUE_      INTEGER
) IS
  IDEXISTS$ NUMBER;
BEGIN
  IF (CONSTTYPE_ = 3) THEN
    SELECT COUNT (PROGINDEX)
    INTO IDExists$
    FROM IntConst
    WHERE (PROGINDEX = PROGINDEX_) AND (CONSTINDEX = CONSTINDEX_);

    IF (IDExists$ = 0) THEN
      INSERT INTO INTCONST
        (PROGINDEX,CONSTINDEX,CONSTVALUE,NOTE)
      VALUES
        (PROGINDEX_,CONSTINDEX_,INTVALUE_,NOTE_);
    END IF;    
  END IF;

  IF (CONSTTYPE_ = 8) THEN
    SELECT COUNT (PROGINDEX)
    INTO IDExists$
    FROM VarcharConst
    WHERE (PROGINDEX = PROGINDEX_) AND (CONSTINDEX = CONSTINDEX_);

    IF (IDExists$ = 0) THEN
      INSERT INTO VARCHARCONST
        (PROGINDEX,CONSTINDEX,CONSTVALUE,NOTE)
      VALUES
        (PROGINDEX_,CONSTINDEX_,VARCHARVALUE_,NOTE_);
     END IF;   
  END IF;

  IF (CONSTTYPE_ = 5) THEN
    SELECT COUNT (PROGINDEX)
    INTO IDExists$
    FROM RealConst
    WHERE (PROGINDEX = PROGINDEX_) AND (CONSTINDEX = CONSTINDEX_);

    IF (IDExists$ = 0) THEN
      INSERT INTO REALCONST
        (PROGINDEX,CONSTINDEX,CONSTVALUE,NOTE)
      VALUES
        (PROGINDEX_,CONSTINDEX_,DOUBLEVALUE_,NOTE_);
    END IF;    
  END IF;
END;
/

-- Удаляем ненужные поля
CALL DeleteFields(20111059) ;

CALL DeleteFields(20110013) ;

CALL DeleteFields(20111016) ;

CALL DeleteFields(20111053) ;

CALL DeleteFields(20111056) ;

CALL DeleteFields(20211019) ;

CALL DeleteFields(20211068) ;

CALL DeleteFields(20211071) ;

CALL DeleteFields(20311019) ;

CALL DeleteFields(20311028) ;

CALL DeleteFields(20311058) ;

CALL DeleteFields(20311059) ;

CALL DeleteFields(20311060) ;

CALL DeleteFields(20311068) ;

CALL DeleteFields(20301003) ;

CALL DeleteFields(20301004) ;

CALL DeleteFields(20301005) ;

CALL DeleteFields(20301006) ;

CALL DeleteFields(20301007) ;

CALL DeleteFields(20301010) ;

CALL DeleteFields(20301011) ;

CALL DeleteFields(20301012) ;

CALL DeleteFields(20301013) ;

CALL DeleteFields(20301008) ;

CALL DeleteFields(20300025) ;

CALL DeleteFields(20300028) ;

CALL DeleteFields(20300030) ;

CALL DeleteFields(20300033) ;

CALL DeleteFields(20300041) ;

CALL DeleteFields(20301046) ;

CALL DeleteFields(20301047) ;

CALL DeleteFields(20301048) ;

CALL DeleteFields(20301049) ;

CALL DeleteFields(20301050) ;

CALL DeleteFields(20301051) ;

CALL DeleteFields(20301053) ;

CALL DeleteFields(20301054) ;

CALL DeleteFields(20301055) ;

CALL DeleteFields(20411068) ;

CALL DeleteFields(20411088) ;

CALL DeleteFields(20411089) ;

CALL DeleteFields(20501094) ;

CALL DeleteFields(20501095) ;

CALL DeleteFields(20511002) ;

CALL DeleteFields(20511003) ;

CALL DeleteFields(20511004) ;

CALL DeleteFields(20511005) ;

CALL DeleteFields(20511006) ;

CALL DeleteFields(20511020) ;

CALL DeleteFields(20511066) ;

CALL DeleteFields(20511088) ;

CALL DeleteFields(20510088) ;

CALL DeleteFields(20611008) ;

CALL DeleteFields(20611020) ;

CALL DeleteFields(20611029) ;

CALL DeleteFields(20611059) ;

CALL DeleteFields(20611060) ;

CALL DeleteFields(20611061) ;

CALL DeleteFields(20611069) ;

CALL DeleteFields(20611072) ;

CALL DeleteFields(20601038) ;

CALL DeleteFields(20600107) ;

CALL DeleteFields(20711008) ;

CALL DeleteFields(20710018) ;

CALL DeleteFields(20711069) ;

CALL DeleteFields(20711072) ;

CALL DeleteFields(20701114) ;

CALL DeleteFields(20701194) ;

CALL DeleteFields(20710157) ;

CALL DeleteFields(20801194) ;

CALL DeleteFields(20811008) ;

CALL DeleteFields(20810018) ;

CALL DeleteFields(20811069) ;

CALL DeleteFields(20811072) ;

CALL DeleteFields(20801114) ;

CALL DeleteFields(20810156) ;

CALL DeleteFields(30100017) ;

CALL DeleteFields(30100021) ;

CALL DeleteFields(30100022) ;

CALL DeleteFields(30100039) ;

CALL DeleteFields(30100045) ;

CALL DeleteFields(30101030) ;

CALL DeleteFields(30110025) ;

CALL DeleteFields(30111041) ;

CALL DeleteFields(30201026) ;

CALL DeleteFields(30201027) ;

CALL DeleteFields(30201028) ;

CALL DeleteFields(30201029) ;

CALL DeleteFields(30201030) ;

CALL DeleteFields(30201031) ;

CALL DeleteFields(30201032) ;

CALL DeleteFields(30201033) ;

CALL DeleteFields(30201034) ;

CALL DeleteFields(30201065) ;

CALL DeleteFields(30210042) ;

CALL DeleteFields(30211038) ;

CALL DeleteFields(30210133) ;

CALL DeleteFields(30200144) ;

CALL DeleteFields(30210116) ;

CALL DeleteFields(30301077) ;

CALL DeleteFields(30301078) ;

CALL DeleteFields(30310079) ;

CALL DeleteFields(30310080) ;

CALL DeleteFields(30310081) ;

CALL DeleteFields(30310082) ;

CALL DeleteFields(30410029) ;

CALL DeleteFields(30411039) ;

CALL DeleteFields(30400144) ;

CALL DeleteFields(30500023) ;

CALL DeleteFields(30500034) ;

CALL DeleteFields(30500091) ;

CALL DeleteFields(30501042) ;

CALL DeleteFields(30501043) ;

CALL DeleteFields(30501047) ;

CALL DeleteFields(30501049) ;

CALL DeleteFields(30510010) ;

CALL DeleteFields(30511007) ;

CALL DeleteFields(30500147) ;

CALL DeleteFields(30600146) ;

CALL DeleteFields(30600052) ;

CALL DeleteFields(30600062) ;

CALL DeleteFields(30601079) ;

CALL DeleteFields(30601080) ;

CALL DeleteFields(30601081) ;

CALL DeleteFields(30600092) ;

CALL DeleteFields(30710006) ;

CALL DeleteFields(30800066) ;

CALL DeleteFields(30801121) ;

CALL DeleteFields(30800189) ;

CALL DeleteFields(30801176) ;

CALL DeleteFields(31110037) ;

CALL DeleteFields(31101087) ;

CALL DeleteFields(31101088) ;

CALL DeleteFields(31101089) ;

CALL DeleteFields(31101090) ;

CALL DeleteFields(31100074) ;

CALL DeleteFields(31101091) ;

CALL DeleteFields(31101092) ;

CALL DeleteFields(31201018) ;

CALL DeleteFields(31201019) ;

CALL DeleteFields(31201020) ;

CALL DeleteFields(31201021) ;

CALL DeleteFields(31201022) ;

CALL DeleteFields(31201023) ;

CALL DeleteFields(31201024) ;

CALL DeleteFields(31201025) ;

CALL DeleteFields(31201026) ;

CALL DeleteFields(31201027) ;

CALL DeleteFields(31201028) ;

CALL DeleteFields(31201039) ;

CALL DeleteFields(31201040) ;

CALL DeleteFields(31201041) ;

CALL DeleteFields(31201042) ;

CALL DeleteFields(31201043) ;

CALL DeleteFields(31201044) ;

CALL DeleteFields(31201045) ;

CALL DeleteFields(31201046) ;

CALL DeleteFields(31201047) ;

CALL DeleteFields(31201048) ;

CALL DeleteFields(31201049) ;

CALL DeleteFields(31201050) ;

CALL DeleteFields(31201086) ;

CALL DeleteFields(31201090) ;

CALL DeleteFields(31201091) ;

CALL DeleteFields(31201092) ;

CALL DeleteFields(31210012) ;

CALL DeleteFields(31211007) ;

CALL DeleteFields(31201131) ;

CALL DeleteFields(31201103) ;

CALL DeleteFields(31200131) ;

CALL DeleteFields(31200144) ;

CALL DeleteFields(31400026) ;

CALL DeleteFields(31401027) ;

CALL DeleteFields(31401028) ;

CALL DeleteFields(31401029) ;

CALL DeleteFields(31401030) ;

CALL DeleteFields(31401031) ;

CALL DeleteFields(31401032) ;

CALL DeleteFields(31401033) ;

CALL DeleteFields(31401034) ;

CALL DeleteFields(31401035) ;

CALL DeleteFields(31401036) ;

CALL DeleteFields(31401049) ;

CALL DeleteFields(31401050) ;

CALL DeleteFields(31401051) ;

CALL DeleteFields(31401052) ;

CALL DeleteFields(31401053) ;

CALL DeleteFields(31401054) ;

CALL DeleteFields(31401055) ;

CALL DeleteFields(31401056) ;

CALL DeleteFields(31401057) ;

CALL DeleteFields(31401058) ;

CALL DeleteFields(31401059) ;

CALL DeleteFields(31401060) ;

CALL DeleteFields(31401069) ;

CALL DeleteFields(31401073) ;

CALL DeleteFields(31401086) ;

CALL DeleteFields(31410012) ;

CALL DeleteFields(31411007) ;

CALL DeleteFields(31400139) ;

CALL DeleteFields(31411124) ;

CALL DeleteFields(31500078) ;

CALL DeleteFields(32300185) ;

CALL DeleteFields(32300152) ;

CALL DeleteFields(32300153) ;

CALL DeleteFields(32300155) ;

CALL DeleteFields(32301195) ;

CALL DeleteFields(32301089) ;

CALL DeleteFields(32301090) ;

CALL DeleteFields(32300097) ;

CALL DeleteFields(32300112) ;

CALL DeleteFields(32300113) ;

CALL DeleteFields(32301118) ;

CALL DeleteFields(32301119) ;

CALL DeleteFields(32300122) ;

CALL DeleteFields(32300078) ;

CALL DeleteFields(32300094) ;

CALL DeleteFields(32300114) ;

CALL DeleteFields(32300115) ;

CALL DeleteFields(32411015) ;

CALL DeleteFields(32411016) ;

CALL DeleteFields(32411017) ;

CALL DeleteFields(32411018) ;

CALL DeleteFields(32411019) ;

CALL DeleteFields(32411021) ;

CALL DeleteFields(32411023) ;

CALL DeleteFields(32411024) ;

CALL DeleteFields(32411025) ;

CALL DeleteFields(32411029) ;

CALL DeleteFields(32411034) ;

CALL DeleteFields(32411035) ;

CALL DeleteFields(32411036) ;

CALL DeleteFields(32411037) ;

CALL DeleteFields(32411038) ;

CALL DeleteFields(32411039) ;

CALL DeleteFields(32411042) ;

CALL DeleteFields(32411046) ;

CALL DeleteFields(32411048) ;

CALL DeleteFields(32411049) ;

CALL DeleteFields(32400098) ;

CALL DeleteFields(32401100) ;

CALL DeleteFields(32401101) ;

CALL DeleteFields(32401102) ;

CALL DeleteFields(32401103) ;

CALL DeleteFields(32401104) ;

CALL DeleteFields(32401105) ;

CALL DeleteFields(32401106) ;

CALL DeleteFields(32401108) ;

CALL DeleteFields(32401109) ;

CALL DeleteFields(32401110) ;

CALL DeleteFields(32411061) ;

CALL DeleteFields(32411063) ;

CALL DeleteFields(32411065) ;

CALL DeleteFields(32411087) ;

CALL DeleteFields(32400117) ;

CALL DeleteFields(32400119) ;

CALL DeleteFields(32401121) ;

CALL DeleteFields(32401122) ;

CALL DeleteFields(32401123) ;

CALL DeleteFields(32401124) ;

CALL DeleteFields(32401125) ;

CALL DeleteFields(32401126) ;

CALL DeleteFields(32400140) ;

CALL DeleteFields(32401153) ;

CALL DeleteFields(32400156) ;

CALL DeleteFields(32401167) ;

CALL DeleteFields(32401171) ;

CALL DeleteFields(32411177) ;

CALL DeleteFields(32411180) ;

CALL DeleteFields(70212079) ;

CALL DeleteFields(70310044) ;

CALL DeleteFields(80100006) ;

CALL DeleteFields(80101001) ;

CALL DeleteFields(80101002) ;

CALL DeleteFields(80101073) ;

CALL DeleteFields(80100066) ;

CALL DeleteFields(80100067) ;

CALL DeleteFields(90111019) ;

CALL DeleteFields(90111063) ;

CALL DeleteFields(90210014) ;

CALL DeleteFields(90210004) ;

CALL DeleteFields(90211044) ;

CALL DeleteFields(90211045) ;

CALL DeleteFields(90311044) ;

CALL DeleteFields(90311030) ;

CALL DeleteFields(90311031) ;

CALL DeleteFields(90311032) ;

CALL DeleteFields(90311034) ;

CALL DeleteFields(90510025) ;

CALL DeleteFields(90510036) ;

CALL DeleteFields(90710013) ;

CALL DeleteFields(90710046) ;

CALL DeleteFields(120110024) ;

CALL DeleteFields(120110027) ;

CALL DeleteFields(160100081) ;

CALL DeleteFields(160100016) ;

CALL DeleteFields(160100056) ;

CALL DeleteFields(160100057) ;

CALL DeleteFields(160100068) ;

CALL DeleteFields(160101071) ;

CALL DeleteFields(160100069) ;

CALL DeleteFields(160100070) ;

CALL DeleteFields(160210017) ;

CALL DeleteFields(170110028) ;

CALL DeleteFields(170110042) ;

CALL DeleteFields(170110059) ;

CALL DeleteFields(181210001) ;

CALL DeleteFields(181211001) ;

CALL DeleteFields(190111029) ;

CALL DeleteFields(190111053) ;

CALL DeleteFields(190111054) ;

CALL DeleteFields(190111064) ;

CALL DeleteFields(190111071) ;

CALL DeleteFields(190200089) ;

CALL DeleteFields(190211003) ;

CALL DeleteFields(190211023) ;

CALL DeleteFields(190211072) ;

CALL DeleteFields(190211076) ;

CALL DeleteFields(190211078) ;

CALL DeleteFields(190311080) ;

CALL DeleteFields(190311022) ;

CALL DeleteFields(190311061) ;

CALL DeleteFields(190311062) ;

CALL DeleteFields(190311063) ;

CALL DeleteFields(190311071) ;

CALL DeleteFields(190611081) ;

CALL DeleteFields(190611082) ;

CALL DeleteFields(190611007) ;

CALL DeleteFields(190611023) ;

CALL DeleteFields(190611062) ;

CALL DeleteFields(190611063) ;

CALL DeleteFields(190611064) ;

CALL DeleteFields(190611072) ;

CALL DeleteFields(220111022) ;

CALL DeleteFields(220111044) ;

CALL DeleteFields(220111049) ;

CALL DeleteFields(220111050) ;

CALL DeleteFields(220111051) ;

CALL DeleteFields(220101062) ;

CALL DeleteFields(220101064) ;

CALL DeleteFields(220110059) ;

CALL DeleteFields(250213039) ;

CALL DeleteFields(250210040) ;

CALL DeleteFields(250311003) ;

CALL DeleteFields(250311011) ;

CALL DeleteFields(250312001) ;

CALL DeleteFields(250410001) ;

CALL DeleteFields(250410008) ;

CALL DeleteFields(250410023) ;

CALL DeleteFields(250410028) ;

CALL DeleteFields(250410037) ;

CALL DeleteFields(250410038) ;

CALL DeleteFields(250410040) ;

CALL DeleteFields(250410041) ;

CALL DeleteFields(250410050) ;

CALL DeleteFields(250410051) ;

CALL DeleteFields(250410052) ;

CALL DeleteFields(250410054) ;

CALL DeleteFields(250410055) ;

CALL DeleteFields(250410071) ;

CALL DeleteFields(250410072) ;

CALL DeleteFields(250410073) ;

CALL DeleteFields(250410074) ;

CALL DeleteFields(250410075) ;

CALL DeleteFields(250410076) ;

CALL DeleteFields(250410077) ;

CALL DeleteFields(300114005) ;

CALL DeleteFields(300111004) ;

CALL DeleteFields(300110007) ;

CALL DeleteFields(300111009) ;

CALL DeleteFields(300110020) ;

CALL DeleteFields(300114014) ;

CALL DeleteFields(300111056) ;

CALL DeleteFields(300110027) ;

CALL DeleteFields(361002118) ;

CALL DeleteFields(361003184) ;

CALL DeleteFields(361011063) ;

CALL DeleteFields(361011064) ;

CALL DeleteFields(361011065) ;

CALL DeleteFields(361011066) ;

CALL DeleteFields(361011067) ;

CALL DeleteFields(361011068) ;

CALL DeleteFields(361011081) ;

CALL DeleteFields(361011082) ;

CALL DeleteFields(361011083) ;

CALL DeleteFields(361011084) ;

CALL DeleteFields(361011085) ;

CALL DeleteFields(361011086) ;

CALL DeleteFields(361011087) ;

CALL DeleteFields(361011088) ;

CALL DeleteFields(361011089) ;

CALL DeleteFields(361011090) ;

CALL DeleteFields(361011101) ;

CALL DeleteFields(361011102) ;

CALL DeleteFields(361011103) ;

CALL DeleteFields(361011104) ;

CALL DeleteFields(361011105) ;

CALL DeleteFields(361011106) ;

CALL DeleteFields(361011107) ;

CALL DeleteFields(361011121) ;

CALL DeleteFields(361011122) ;

CALL DeleteFields(361011123) ;

CALL DeleteFields(361011124) ;

CALL DeleteFields(361011125) ;

CALL DeleteFields(361011126) ;

CALL DeleteFields(361011127) ;

CALL DeleteFields(361011128) ;

CALL DeleteFields(361011129) ;

CALL DeleteFields(361011141) ;

CALL DeleteFields(361011142) ;

CALL DeleteFields(361011143) ;

CALL DeleteFields(361011144) ;

CALL DeleteFields(361011145) ;

CALL DeleteFields(361011146) ;

CALL DeleteFields(361011161) ;

CALL DeleteFields(361011162) ;

CALL DeleteFields(361011163) ;

CALL DeleteFields(361011164) ;

CALL DeleteFields(361011181) ;

CALL DeleteFields(361011182) ;

CALL DeleteFields(361011183) ;

CALL DeleteFields(361011184) ;

CALL DeleteFields(361011185) ;

CALL DeleteFields(361011186) ;

CALL DeleteFields(361011187) ;

CALL DeleteFields(361011201) ;

CALL DeleteFields(361011202) ;

CALL DeleteFields(361011203) ;

CALL DeleteFields(361011204) ;

CALL DeleteFields(361011205) ;

CALL DeleteFields(361011206) ;

CALL DeleteFields(361011207) ;

CALL DeleteFields(361011221) ;

CALL DeleteFields(361011222) ;

CALL DeleteFields(361011223) ;

CALL DeleteFields(361011224) ;

CALL DeleteFields(361011225) ;

CALL DeleteFields(361011226) ;

CALL DeleteFields(361011227) ;

CALL DeleteFields(361011241) ;

CALL DeleteFields(361011242) ;

CALL DeleteFields(361011243) ;

CALL DeleteFields(361011244) ;

CALL DeleteFields(361011245) ;

CALL DeleteFields(361011246) ;

CALL DeleteFields(361011247) ;

CALL DeleteFields(361011248) ;

CALL DeleteFields(361011249) ;

CALL DeleteFields(361012001) ;

CALL DeleteFields(361012002) ;

CALL DeleteFields(361012003) ;

CALL DeleteFields(361012004) ;

CALL DeleteFields(361012005) ;

CALL DeleteFields(361012006) ;

CALL DeleteFields(361012007) ;

CALL DeleteFields(361012041) ;

CALL DeleteFields(361012042) ;

CALL DeleteFields(361012043) ;

CALL DeleteFields(361012044) ;

CALL DeleteFields(361012045) ;

CALL DeleteFields(361012046) ;

CALL DeleteFields(361012047) ;

CALL DeleteFields(361012048) ;

CALL DeleteFields(361012049) ;

CALL DeleteFields(361012050) ;

CALL DeleteFields(361012051) ;

CALL DeleteFields(361012061) ;

CALL DeleteFields(361012062) ;

CALL DeleteFields(361012063) ;

CALL DeleteFields(361012064) ;

CALL DeleteFields(361012065) ;

CALL DeleteFields(361012066) ;

CALL DeleteFields(361012067) ;

CALL DeleteFields(361012068) ;

CALL DeleteFields(361012081) ;

CALL DeleteFields(361012082) ;

CALL DeleteFields(361012083) ;

CALL DeleteFields(361012084) ;

CALL DeleteFields(361012085) ;

CALL DeleteFields(361012086) ;

CALL DeleteFields(361012087) ;

CALL DeleteFields(361012101) ;

CALL DeleteFields(361012102) ;

CALL DeleteFields(361012103) ;

CALL DeleteFields(361012104) ;

CALL DeleteFields(361012105) ;

CALL DeleteFields(361012106) ;

CALL DeleteFields(361012107) ;

CALL DeleteFields(361012121) ;

CALL DeleteFields(361012122) ;

CALL DeleteFields(361012123) ;

CALL DeleteFields(361012124) ;

CALL DeleteFields(361012125) ;

CALL DeleteFields(361012126) ;

CALL DeleteFields(361012127) ;

CALL DeleteFields(361012161) ;

CALL DeleteFields(361012162) ;

CALL DeleteFields(361012163) ;

CALL DeleteFields(361012164) ;

CALL DeleteFields(361012165) ;

CALL DeleteFields(361012166) ;

CALL DeleteFields(361012167) ;

CALL DeleteFields(361012168) ;

CALL DeleteFields(361012169) ;

CALL DeleteFields(361013001) ;

CALL DeleteFields(361013002) ;

CALL DeleteFields(361013003) ;

CALL DeleteFields(361013004) ;

CALL DeleteFields(361013005) ;

CALL DeleteFields(361013006) ;

CALL DeleteFields(361013007) ;

CALL DeleteFields(361013008) ;

CALL DeleteFields(361013009) ;

CALL DeleteFields(361013010) ;

CALL DeleteFields(361013011) ;

CALL DeleteFields(361013012) ;

CALL DeleteFields(361013013) ;

CALL DeleteFields(361013014) ;

CALL DeleteFields(361013015) ;

CALL DeleteFields(361013016) ;

CALL DeleteFields(361013017) ;

CALL DeleteFields(361013041) ;

CALL DeleteFields(361013042) ;

CALL DeleteFields(361013043) ;

CALL DeleteFields(361013044) ;

CALL DeleteFields(361013045) ;

CALL DeleteFields(361013046) ;

CALL DeleteFields(361013047) ;

CALL DeleteFields(361013048) ;

CALL DeleteFields(361013049) ;

CALL DeleteFields(361013061) ;

CALL DeleteFields(361013062) ;

CALL DeleteFields(361013063) ;

CALL DeleteFields(361013064) ;

CALL DeleteFields(361013065) ;

CALL DeleteFields(361013066) ;

CALL DeleteFields(361013081) ;

CALL DeleteFields(361013082) ;

CALL DeleteFields(361013083) ;

CALL DeleteFields(361013084) ;

CALL DeleteFields(361013085) ;

CALL DeleteFields(361013086) ;

CALL DeleteFields(361013087) ;

CALL DeleteFields(361013088) ;

CALL DeleteFields(361013089) ;

CALL DeleteFields(361013090) ;

CALL DeleteFields(361013091) ;

CALL DeleteFields(361013092) ;

CALL DeleteFields(361013093) ;

CALL DeleteFields(361013094) ;

CALL DeleteFields(361013095) ;

CALL DeleteFields(361013096) ;

CALL DeleteFields(361013097) ;

CALL DeleteFields(361013101) ;

CALL DeleteFields(361013102) ;

CALL DeleteFields(361013103) ;

CALL DeleteFields(361013104) ;

CALL DeleteFields(361013105) ;

CALL DeleteFields(361013106) ;

CALL DeleteFields(361013107) ;

CALL DeleteFields(361013108) ;

CALL DeleteFields(361013109) ;

CALL DeleteFields(361013110) ;

CALL DeleteFields(361013111) ;

CALL DeleteFields(361013112) ;

CALL DeleteFields(361013113) ;

CALL DeleteFields(361013114) ;

CALL DeleteFields(361013115) ;

CALL DeleteFields(361013116) ;

CALL DeleteFields(361013117) ;

CALL DeleteFields(361013121) ;

CALL DeleteFields(361013122) ;

CALL DeleteFields(361013123) ;

CALL DeleteFields(361013124) ;

CALL DeleteFields(361013125) ;

CALL DeleteFields(361013126) ;

CALL DeleteFields(361013127) ;

CALL DeleteFields(361013128) ;

CALL DeleteFields(361013129) ;

CALL DeleteFields(361013130) ;

CALL DeleteFields(361013131) ;

CALL DeleteFields(361013132) ;

CALL DeleteFields(361013133) ;

CALL DeleteFields(361011261) ;

CALL DeleteFields(361011262) ;

CALL DeleteFields(361011263) ;

CALL DeleteFields(361011264) ;

CALL DeleteFields(361011265) ;

CALL DeleteFields(361011266) ;

CALL DeleteFields(361011267) ;

CALL DeleteFields(361011268) ;

CALL DeleteFields(361011269) ;

CALL DeleteFields(361011270) ;

CALL DeleteFields(361011281) ;

CALL DeleteFields(361011282) ;

CALL DeleteFields(361011283) ;

CALL DeleteFields(361011284) ;

CALL DeleteFields(361011285) ;

CALL DeleteFields(361011286) ;

CALL DeleteFields(361011287) ;

CALL DeleteFields(361011288) ;

CALL DeleteFields(361011289) ;

CALL DeleteFields(361011290) ;

CALL DeleteFields(361011291) ;

CALL DeleteFields(361012181) ;

CALL DeleteFields(361012182) ;

CALL DeleteFields(361012183) ;

CALL DeleteFields(361012184) ;

CALL DeleteFields(361012185) ;

CALL DeleteFields(361012186) ;

CALL DeleteFields(361012187) ;

CALL DeleteFields(361012188) ;

CALL DeleteFields(361012189) ;

CALL DeleteFields(361012190) ;

CALL DeleteFields(361012191) ;

CALL DeleteFields(361013161) ;

CALL DeleteFields(361013162) ;

CALL DeleteFields(361013163) ;

CALL DeleteFields(361013164) ;

CALL DeleteFields(361013165) ;

CALL DeleteFields(361013166) ;

CALL DeleteFields(361013167) ;

CALL DeleteFields(361013168) ;

CALL DeleteFields(361013169) ;

CALL DeleteFields(361013170) ;

CALL DeleteFields(361013171) ;

CALL DeleteFields(361011301) ;

CALL DeleteFields(361011302) ;

CALL DeleteFields(361011303) ;

CALL DeleteFields(361011304) ;

CALL DeleteFields(361011305) ;

CALL DeleteFields(361011306) ;

CALL DeleteFields(361011307) ;

CALL DeleteFields(361011308) ;

CALL DeleteFields(361011309) ;

CALL DeleteFields(361011310) ;

CALL DeleteFields(361011311) ;

CALL DeleteFields(361011312) ;

CALL DeleteFields(361011313) ;

CALL DeleteFields(361012201) ;

CALL DeleteFields(361012202) ;

CALL DeleteFields(361012203) ;

CALL DeleteFields(361012204) ;

CALL DeleteFields(361012205) ;

CALL DeleteFields(361012206) ;

CALL DeleteFields(361012207) ;

CALL DeleteFields(361012208) ;

CALL DeleteFields(361012209) ;

CALL DeleteFields(361012210) ;

CALL DeleteFields(361012211) ;

CALL DeleteFields(361013181) ;

CALL DeleteFields(361013182) ;

CALL DeleteFields(361013183) ;

CALL DeleteFields(361013184) ;

CALL DeleteFields(361013185) ;

CALL DeleteFields(361013186) ;

CALL DeleteFields(361013187) ;

CALL DeleteFields(361013188) ;

CALL DeleteFields(361013189) ;

CALL DeleteFields(361013190) ;

CALL DeleteFields(361013191) ;

CALL DeleteFields(361013192) ;

CALL DeleteFields(361013193) ;

CALL DeleteFields(361013194) ;

CALL DeleteFields(361013195) ;

CALL DeleteFields(361014001) ;

CALL DeleteFields(361014002) ;

CALL DeleteFields(361014003) ;

CALL DeleteFields(361014004) ;

CALL DeleteFields(361014005) ;

CALL DeleteFields(361014006) ;

CALL DeleteFields(361014007) ;

CALL DeleteFields(361014008) ;

CALL DeleteFields(361014009) ;

CALL DeleteFields(361014010) ;

CALL DeleteFields(361014011) ;

CALL DeleteFields(361014012) ;

CALL DeleteFields(361014013) ;

CALL DeleteFields(361014014) ;

CALL DeleteFields(361014015) ;

CALL DeleteFields(361011321) ;

CALL DeleteFields(361011322) ;

CALL DeleteFields(361011323) ;

CALL DeleteFields(361011324) ;

CALL DeleteFields(361011325) ;

CALL DeleteFields(361011326) ;

CALL DeleteFields(361011327) ;

CALL DeleteFields(361011328) ;

CALL DeleteFields(361011329) ;

CALL DeleteFields(361011330) ;

CALL DeleteFields(361011331) ;

CALL DeleteFields(361011332) ;

CALL DeleteFields(361011333) ;

CALL DeleteFields(361011334) ;

CALL DeleteFields(361011335) ;

CALL DeleteFields(361012221) ;

CALL DeleteFields(361012222) ;

CALL DeleteFields(361012223) ;

CALL DeleteFields(361012224) ;

CALL DeleteFields(361012225) ;

CALL DeleteFields(361012226) ;

CALL DeleteFields(361012227) ;

CALL DeleteFields(361012228) ;

CALL DeleteFields(361012229) ;

CALL DeleteFields(361012230) ;

CALL DeleteFields(361012231) ;

CALL DeleteFields(361012232) ;

CALL DeleteFields(361012233) ;

CALL DeleteFields(361012234) ;

CALL DeleteFields(361012235) ;

CALL DeleteFields(361013201) ;

CALL DeleteFields(361013202) ;

CALL DeleteFields(361013203) ;

CALL DeleteFields(361013204) ;

CALL DeleteFields(361013205) ;

CALL DeleteFields(361013206) ;

CALL DeleteFields(361013207) ;

CALL DeleteFields(361013208) ;

CALL DeleteFields(361013209) ;

CALL DeleteFields(361013210) ;

CALL DeleteFields(361013211) ;

CALL DeleteFields(361013212) ;

CALL DeleteFields(361013213) ;

CALL DeleteFields(361013214) ;

CALL DeleteFields(361013215) ;

CALL DeleteFields(361013216) ;

CALL DeleteFields(361013217) ;

CALL DeleteFields(361011341) ;

CALL DeleteFields(361011342) ;

CALL DeleteFields(361011343) ;

CALL DeleteFields(361011344) ;

CALL DeleteFields(361011345) ;

CALL DeleteFields(361011346) ;

CALL DeleteFields(361011347) ;

CALL DeleteFields(361012241) ;

CALL DeleteFields(361012242) ;

CALL DeleteFields(361012243) ;

CALL DeleteFields(361012244) ;

CALL DeleteFields(361012245) ;

CALL DeleteFields(361012246) ;

CALL DeleteFields(361012247) ;

CALL DeleteFields(361012248) ;

CALL DeleteFields(361013221) ;

CALL DeleteFields(361013222) ;

CALL DeleteFields(361013223) ;

CALL DeleteFields(361013224) ;

CALL DeleteFields(361013225) ;

CALL DeleteFields(361013226) ;

CALL DeleteFields(361013227) ;

CALL DeleteFields(361013228) ;

CALL DeleteFields(361014021) ;

CALL DeleteFields(361014022) ;

CALL DeleteFields(361011001) ;

CALL DeleteFields(361011002) ;

CALL DeleteFields(361011003) ;

CALL DeleteFields(361011004) ;

CALL DeleteFields(361011005) ;

CALL DeleteFields(361011006) ;

CALL DeleteFields(361011007) ;

CALL DeleteFields(361011021) ;

CALL DeleteFields(361011022) ;

CALL DeleteFields(361011023) ;

CALL DeleteFields(361011024) ;

CALL DeleteFields(361011025) ;

CALL DeleteFields(361011026) ;

CALL DeleteFields(361011061) ;

CALL DeleteFields(361011062) ;

CALL DeleteFields(361014023) ;

CALL DeleteFields(361014024) ;

CALL DeleteFields(361014025) ;

CALL DeleteFields(361014026) ;

CALL DeleteFields(361014027) ;

CALL DeleteFields(361014028) ;

CALL DeleteFields(361015001) ;

CALL DeleteFields(361015002) ;

CALL DeleteFields(361015003) ;

CALL DeleteFields(361015004) ;

CALL DeleteFields(361015005) ;

CALL DeleteFields(361015006) ;

CALL DeleteFields(361015007) ;

CALL DeleteFields(361015008) ;

CALL DeleteFields(361000003) ;

CALL DeleteFields(361000015) ;

CALL DeleteFields(361001016) ;

CALL DeleteFields(361001017) ;

CALL DeleteFields(361001018) ;

CALL DeleteFields(361001019) ;

CALL DeleteFields(361001020) ;

CALL DeleteFields(361001021) ;

CALL DeleteFields(361001022) ;

CALL DeleteFields(361001023) ;

CALL DeleteFields(361001024) ;

CALL DeleteFields(361001025) ;

CALL DeleteFields(361001026) ;

CALL DeleteFields(361001027) ;

CALL DeleteFields(361001028) ;

CALL DeleteFields(361001038) ;

CALL DeleteFields(361001039) ;

CALL DeleteFields(361001040) ;

CALL DeleteFields(361001041) ;

CALL DeleteFields(361001042) ;

CALL DeleteFields(361001043) ;

CALL DeleteFields(361001044) ;

CALL DeleteFields(361001045) ;

CALL DeleteFields(361001046) ;

CALL DeleteFields(361001047) ;

CALL DeleteFields(361001048) ;

CALL DeleteFields(361001049) ;

CALL DeleteFields(361001050) ;

CALL DeleteFields(361001051) ;

CALL DeleteFields(361001052) ;

CALL DeleteFields(361001053) ;

CALL DeleteFields(361001054) ;

CALL DeleteFields(361001055) ;

CALL DeleteFields(361001056) ;

CALL DeleteFields(361001057) ;

CALL DeleteFields(361001058) ;

CALL DeleteFields(361001059) ;

CALL DeleteFields(361001060) ;

CALL DeleteFields(361001061) ;

CALL DeleteFields(361001062) ;

CALL DeleteFields(361001063) ;

CALL DeleteFields(361001064) ;

CALL DeleteFields(361001065) ;

CALL DeleteFields(361001066) ;

CALL DeleteFields(361001067) ;

CALL DeleteFields(361001068) ;

CALL DeleteFields(361001069) ;

CALL DeleteFields(361001070) ;

CALL DeleteFields(361001071) ;

CALL DeleteFields(361001072) ;

CALL DeleteFields(361001073) ;

CALL DeleteFields(361001074) ;

CALL DeleteFields(361001075) ;

CALL DeleteFields(361001076) ;

CALL DeleteFields(361001077) ;

CALL DeleteFields(361001078) ;

CALL DeleteFields(361001079) ;

CALL DeleteFields(361001080) ;

CALL DeleteFields(361001081) ;

CALL DeleteFields(361001082) ;

CALL DeleteFields(361001083) ;

CALL DeleteFields(361001084) ;

CALL DeleteFields(361001085) ;

CALL DeleteFields(361001086) ;

CALL DeleteFields(361001087) ;

CALL DeleteFields(361001088) ;

CALL DeleteFields(361001089) ;

CALL DeleteFields(361001090) ;

CALL DeleteFields(361001091) ;

CALL DeleteFields(361001092) ;

CALL DeleteFields(361001093) ;

CALL DeleteFields(361001094) ;

CALL DeleteFields(361001095) ;

CALL DeleteFields(361001096) ;

CALL DeleteFields(361001097) ;

CALL DeleteFields(361001098) ;

CALL DeleteFields(361001099) ;

CALL DeleteFields(361001100) ;

CALL DeleteFields(361002101) ;

CALL DeleteFields(361002102) ;

CALL DeleteFields(361002103) ;

CALL DeleteFields(361002104) ;

CALL DeleteFields(361002105) ;

CALL DeleteFields(361002106) ;

CALL DeleteFields(361002107) ;

CALL DeleteFields(361002119) ;

CALL DeleteFields(361002120) ;

CALL DeleteFields(361002121) ;

CALL DeleteFields(361002122) ;

CALL DeleteFields(361002123) ;

CALL DeleteFields(361002124) ;

CALL DeleteFields(361002125) ;

CALL DeleteFields(361002126) ;

CALL DeleteFields(361002127) ;

CALL DeleteFields(361002128) ;

CALL DeleteFields(361002129) ;

CALL DeleteFields(361002130) ;

CALL DeleteFields(361002131) ;

CALL DeleteFields(361002132) ;

CALL DeleteFields(361002133) ;

CALL DeleteFields(361002134) ;

CALL DeleteFields(361002135) ;

CALL DeleteFields(361002136) ;

CALL DeleteFields(361002137) ;

CALL DeleteFields(361002138) ;

CALL DeleteFields(361002139) ;

CALL DeleteFields(361002140) ;

CALL DeleteFields(361002141) ;

CALL DeleteFields(361002142) ;

CALL DeleteFields(361002143) ;

CALL DeleteFields(361002144) ;

CALL DeleteFields(361002145) ;

CALL DeleteFields(361002146) ;

CALL DeleteFields(361002147) ;

CALL DeleteFields(361002148) ;

CALL DeleteFields(361002149) ;

CALL DeleteFields(361002150) ;

CALL DeleteFields(361002151) ;

CALL DeleteFields(361002152) ;

CALL DeleteFields(361002153) ;

CALL DeleteFields(361002154) ;

CALL DeleteFields(361002155) ;

CALL DeleteFields(361002156) ;

CALL DeleteFields(361002157) ;

CALL DeleteFields(361002158) ;

CALL DeleteFields(361003159) ;

CALL DeleteFields(361003160) ;

CALL DeleteFields(361003161) ;

CALL DeleteFields(361003162) ;

CALL DeleteFields(361003163) ;

CALL DeleteFields(361003164) ;

CALL DeleteFields(361003165) ;

CALL DeleteFields(361003166) ;

CALL DeleteFields(361003167) ;

CALL DeleteFields(361003168) ;

CALL DeleteFields(361003169) ;

CALL DeleteFields(361003170) ;

CALL DeleteFields(361003171) ;

CALL DeleteFields(361003172) ;

CALL DeleteFields(361003173) ;

CALL DeleteFields(361003174) ;

CALL DeleteFields(361003175) ;

CALL DeleteFields(361003185) ;

CALL DeleteFields(361003186) ;

CALL DeleteFields(361003187) ;

CALL DeleteFields(361003188) ;

CALL DeleteFields(361003189) ;

CALL DeleteFields(361003190) ;

CALL DeleteFields(361003191) ;

CALL DeleteFields(361003192) ;

CALL DeleteFields(361003193) ;

CALL DeleteFields(361003194) ;

CALL DeleteFields(361003195) ;

CALL DeleteFields(361003196) ;

CALL DeleteFields(361003197) ;

CALL DeleteFields(361003198) ;

CALL DeleteFields(361003199) ;

CALL DeleteFields(361003200) ;

CALL DeleteFields(361003201) ;

CALL DeleteFields(361003202) ;

CALL DeleteFields(361003203) ;

CALL DeleteFields(361003204) ;

CALL DeleteFields(361003205) ;

CALL DeleteFields(361003206) ;

CALL DeleteFields(361003207) ;

CALL DeleteFields(361003208) ;

CALL DeleteFields(361003209) ;

CALL DeleteFields(361003210) ;

CALL DeleteFields(361003211) ;

CALL DeleteFields(361003212) ;

CALL DeleteFields(361003213) ;

CALL DeleteFields(361003214) ;

CALL DeleteFields(361003215) ;

CALL DeleteFields(361003216) ;

CALL DeleteFields(361003217) ;

CALL DeleteFields(361003218) ;

CALL DeleteFields(361003219) ;

CALL DeleteFields(361003220) ;

CALL DeleteFields(361003221) ;

CALL DeleteFields(361003222) ;

CALL DeleteFields(361003223) ;

CALL DeleteFields(361003224) ;

CALL DeleteFields(361003225) ;

CALL DeleteFields(361003226) ;

CALL DeleteFields(361003227) ;

CALL DeleteFields(361003228) ;

CALL DeleteFields(361003229) ;

CALL DeleteFields(361003230) ;

CALL DeleteFields(361003231) ;

CALL DeleteFields(361003232) ;

CALL DeleteFields(361003233) ;

CALL DeleteFields(361003234) ;

CALL DeleteFields(361003235) ;

CALL DeleteFields(361003236) ;

CALL DeleteFields(361003237) ;

CALL DeleteFields(361003238) ;

CALL DeleteFields(361003239) ;

CALL DeleteFields(361003240) ;

CALL DeleteFields(361003241) ;

CALL DeleteFields(361003242) ;

CALL DeleteFields(361003243) ;

CALL DeleteFields(361003244) ;

CALL DeleteFields(361003245) ;

CALL DeleteFields(361003246) ;

CALL DeleteFields(361011130) ;

CALL DeleteFields(361012130) ;

CALL DeleteFields(361013150) ;

CALL DeleteFields(361001117) ;

CALL DeleteFields(361000018) ;

CALL DeleteFields(370111001) ;

CALL DeleteFields(370110001) ;

CALL DeleteFields(370111002) ;

CALL DeleteFields(370111003) ;

CALL DeleteFields(370111004) ;

CALL DeleteFields(370111005) ;

CALL DeleteFields(370110015) ;

CALL DeleteFields(440310002) ;

CALL DeleteFields(440310011) ;

CALL DeleteFields(440310013) ;

CALL DeleteFields(440310014) ;

CALL DeleteFields(440310015) ;

CALL DeleteFields(440311033) ;

CALL DeleteFields(440311034) ;

CALL DeleteFields(440311036) ;

CALL DeleteFields(440311037) ;

CALL DeleteFields(520100003) ;

CALL DeleteFields(520100020) ;

CALL DeleteFields(520100022) ;

CALL DeleteFields(520100023) ;

CALL DeleteFields(520100024) ;

CALL DeleteFields(520100025) ;

CALL DeleteFields(520100031) ;

CALL DeleteFields(520110003) ;

CALL DeleteFields(520110020) ;

CALL DeleteFields(520110022) ;

CALL DeleteFields(520110023) ;

CALL DeleteFields(520110024) ;

CALL DeleteFields(520110025) ;

CALL DeleteFields(520110031) ;

CALL DeleteFields(550111119) ;

CALL DeleteFields(550100003) ;

CALL DeleteFields(550101060) ;

CALL DeleteFields(550101061) ;

CALL DeleteFields(550101063) ;

CALL DeleteFields(550101064) ;

CALL DeleteFields(550101065) ;

CALL DeleteFields(550101093) ;

CALL DeleteFields(550110162) ;

CALL DeleteFields(550200003) ;

CALL DeleteFields(990310065) ;

CALL DeleteFields(991210002) ;

CALL DeleteFields(991312020) ;

CALL DeleteFields(991510001) ;

CALL DeleteFields(991511001) ;

CALL DeleteFields(991610002) ;

CALL DeleteFields(991610029) ;

CALL DeleteFields(991610030) ;

CALL DeleteFields(991610031) ;

CALL DeleteFields(991610033) ;

CALL DeleteFields(991610034) ;

CALL DeleteFields(991610035) ;

CALL DeleteFields(991610036) ;

CALL DeleteFields(991610040) ;

CALL DeleteFields(991610042) ;

CALL DeleteFields(991610043) ;

CALL DeleteFields(991610044) ;

CALL DeleteFields(991610045) ;

CALL DeleteFields(991610046) ;

CALL DeleteFields(991610047) ;

CALL DeleteFields(991610048) ;

CALL DeleteFields(991610049) ;

CALL DeleteFields(991610050) ;

CALL DeleteFields(991610051) ;

CALL DeleteFields(991610052) ;

CALL DeleteFields(991610053) ;

CALL DeleteFields(991610059) ;

CALL DeleteFields(991610060) ;

CALL DeleteFields(991610061) ;

CALL DeleteFields(991610062) ;

CALL DeleteFields(991610063) ;

CALL DeleteFields(991610064) ;

CALL DeleteFields(991610069) ;

CALL DeleteFields(991610072) ;

CALL DeleteFields(991610073) ;

CALL DeleteFields(991610076) ;

CALL DeleteFields(991610077) ;

CALL DeleteFields(991610078) ;

CALL DeleteFields(991610097) ;

CALL DeleteFields(991610109) ;

CALL DeleteFields(991610110) ;

CALL DeleteFields(991610154) ;

CALL DeleteFields(991610147) ;

CALL DeleteFields(991710002) ;

CALL DeleteFields(991710006) ;

CALL DeleteFields(991710014) ;

CALL DeleteFields(991710034) ;

CALL DeleteFields(991710026) ;

-- Обобщенный документ, Бюджет(1)
CALL ImportField(10001, 'Дата принятия', '{РусПоле("ДатаПринятия")}', 'Дата принятия(проведения) документа', ' ', 1, 0, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(10002, 'Причина отклонения', '{РусПоле("ПричинаОтклон")}', '', ' ', 1, 0, 0, 0, '', 0, null) ;

CALL ImportField(10003, 'Причина отклонения (комментарий)', '{РусПоле("ПричинаОтклонТекст")}', 'Причина отклонения (комментарий)', ' ', 1, 0, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(10004, 'Код удалённого клиента', '{РусПоле("КодОтправителяДокумента")}', 'Код удалённого клиента(отправителя документа)', ' ', 1, 0, 0, 0, 'КодОтправителяДокумента', 0, null) ;

CALL ImportField(10005, 'Код документа', '{РусПоле("КодДокумента")}', 'Код документа', ' ', 1, 0, 0, 0, 'КодДокумента', 0, null) ;

CALL ImportField(10006, 'Состояние документа', '{РусПоле("СостояниеДокумента")}', 'Состояние документа', ' ', 1, 0, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(10007, 'Бюджет', '{РусПоле("КодБюджета")}', 'Бюджет документа', ' ', 1, 0, 0, 0, 'КодБюджета', 0, null) ;

-- Сводные распоряжения на финансирование, Бюджет(1)
CALL ImportField(10110001, 'Номер', 'NUMBER', 'Номер', ' ', 1, 101, 0, 0, 'НомерЗаголовка', 0, null) ;

CALL ImportField(10110002, 'Дата создания', 'MAKEDATE', 'Дата создания', ' ', 1, 101, 0, 0, 'ДатаВвода', 0, 17879) ;

CALL ImportField(10110003, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', ' ', 1, 101, 0, 0, 'ДатаПринятия', 0, 17880) ;

CALL ImportField(10110004, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 101, 0, 0, 'КодБюджета', 0, 17889) ;

CALL ImportField(10110005, 'Счет ФО', 'DFAccountName', 'Счет ФО', ' ', 1, 101, 0, 0, '', 0, 17112) ;

CALL ImportField(10110006, 'Примечание', 'USERNOTE', 'Примечание', ' ', 1, 101, 0, 0, 'ПримечаниеЗаголовка', 0, 17881) ;

CALL ImportField(10110170, 'Имя файла эл. пакета', 'ElPacketName', 'Имя файла эл. пакета', ' ', 1, 101, 0, 1, 'ИмяПакета', 0, 17890) ;

CALL ImportField(10110171, 'ID', 'ID', 'ID', ' ', 1, 101, 0, 1, 'КодДокумента', 0, 17877) ;

CALL ImportField(10110172, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 101, 0, 1, 'СчетПлат', 0, 17882) ;

CALL ImportField(10110173, 'Описание счета', 'DFAccountComment', 'Описание счета', ' ', 1, 101, 0, 0, 'Коментарий', 0, null) ;

CALL ImportField(10111007, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 101, 1, 0, '', 0, null) ;

CALL ImportField(10111008, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 101, 1, 1, 'КВСРКлюч', 0, 17825) ;

CALL ImportField(10111009, 'ФКР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 101, 1, 0, 'КФСР', 0, 17823) ;

CALL ImportField(10111010, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 101, 1, 1, 'КЦСРКлюч', 0, 17824) ;

CALL ImportField(10111011, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 101, 1, 1, 'КВРКлюч', 0, 17826) ;

CALL ImportField(10111012, 'ЭКР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 101, 1, 0, 'КЭСР', 0, 17827) ;

CALL ImportField(10111016, 'Вид источника(Классификация)', 'SourceIFS_DescriptionCode', 'Вид источника', ' ', 1, 101, 1, 0, '', 0, 17050) ;

CALL ImportField(10111017, 'ЭКИ(Классификация)', 'SourceIFS_KESR', 'ЭК', ' ', 1, 101, 1, 0, '', 0, 17054) ;

CALL ImportField(10111018, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 101, 1, 0, 'ТипКлассификации', 0, 17874) ;

CALL ImportField(10111019, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', ' ', 1, 101, 1, 0, 'СубКЭСР', 0, 17828) ;

CALL ImportField(10111020, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', ' ', 1, 101, 1, 0, 'ЛицевойСчет', 0, 17855) ;

CALL ImportField(10111021, 'Источник', 'FINSOURCE', 'Источник', ' ', 1, 101, 1, 0, 'ИсточникФинансирования', 0, 17830) ;

CALL ImportField(10111023, 'Район', 'REGIONCLS', 'Район', ' ', 1, 101, 1, 0, 'Регион', 0, 17831) ;

CALL ImportField(10111024, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 101, 1, 0, 'ТипДокумента', 0, 17832) ;

CALL ImportField(10111025, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 101, 1, 0, 'ТипСредств', 0, 17835) ;

CALL ImportField(10111026, 'Кредит', 'CREDIT', 'Кредит', ' ', 1, 101, 1, 0, 'Кредит', 0, 17843) ;

CALL ImportField(10111027, 'Дебет', 'DEBIT', 'Дебет', ' ', 1, 101, 1, 0, 'Дебет', 0, 17844) ;

CALL ImportField(10111028, 'Распорядитель', 'ManagerOwner', 'Распорядитель', ' ', 1, 101, 1, 0, '', 0, null) ;

CALL ImportField(10111029, 'ИНН(Распорядитель)', 'INN', 'ИНН распорядителя', ' ', 1, 101, 1, 0, '', 0, 16645) ;

CALL ImportField(10111030, 'КПП(Распорядитель)', 'KPP', 'КПП распорядителя', ' ', 1, 101, 1, 0, '', 0, 16653) ;

CALL ImportField(10111032, 'Тип организации(Распорядитель)', 'ORG_CLS', 'Тип организации', ' ', 1, 101, 1, 0, 'Тип_Организации', 0, 16652) ;

CALL ImportField(10111033, 'Счет(Распорядитель)', 'ACC', 'Счет распорядителя', ' ', 1, 101, 1, 0, '', 0, 17112) ;

CALL ImportField(10111034, 'Тип счета(Распорядитель)', 'ACC_CLS', 'Тип счета', ' ', 1, 101, 1, 0, 'ТипСчета', 0, 17113) ;

CALL ImportField(10111035, 'Назначение платежа', 'NOTE', 'Назначение платежа', ' ', 1, 101, 1, 0, 'Примечание', 0, 17845) ;

CALL ImportField(10111036, 'Получатель(*)', 'AcceptorOwner', 'Получатель(*)', ' ', 1, 101, 1, 0, '', 0, null) ;

CALL ImportField(10111037, 'ИНН(Получатель(*))', 'INNA', 'ИНН получателя', ' ', 1, 101, 1, 0, '', 0, 16645) ;

CALL ImportField(10111038, 'КПП(Получатель(*))', 'KPPA', 'КПП получателя', ' ', 1, 101, 1, 0, '', 0, 16653) ;

CALL ImportField(10111040, 'Счет(Получатель(*))', 'ACCA', 'Счет получателя', ' ', 1, 101, 1, 0, '', 0, 17112) ;

CALL ImportField(10111041, '№Бюджетного обязательства', 'Promise', '№Бюджетного обязательства', ' ', 1, 101, 1, 0, 'БюджОбяз', 0, 17857) ;

CALL ImportField(10111042, 'Л/С ФК', 'FacialCode', 'Л/С ФК', ' ', 1, 101, 1, 0, 'МнемоКодЛС', 0, 17149) ;

CALL ImportField(10111044, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 101, 1, 0, 'БухОперация', 0, 17871) ;

CALL ImportField(10111157, 'Бух. проводка', 'BuhPaymentCls', 'Бух. проводка', ' ', 1, 101, 1, 0, 'БухПроводка', 0, 17858) ;

CALL ImportField(10111158, 'Сумма в валюте', 'CURRENCYSUMMA', 'Сумма в валюте', ' ', 1, 101, 1, 0, 'СуммаВВалюте', 0, 17842) ;

CALL ImportField(10111159, 'Код валюты', 'CURRENCYCLS', 'Код валюты', ' ', 1, 101, 1, 0, 'КодВалюты', 0, 17834) ;

CALL ImportField(10111160, 'Информация о налоговом платеже', 'taxNote', 'Информация о налоговом платеже', ' ', 1, 101, 1, 0, 'ИнформацияОНалоге', 0, 17864) ;

CALL ImportField(10111161, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', ' ', 1, 101, 1, 0, '', 0, null) ;

CALL ImportField(10111162, 'Номер', 'DocNumber', 'Номер', ' ', 1, 101, 1, 0, 'НомерДокумента', 0, 17870) ;

CALL ImportField(10111173, 'Индекс заявки', 'RequestsIndex', 'Индекс заявки', ' ', 1, 101, 1, 1, 'Заявка', 0, 17859) ;

CALL ImportField(10111174, 'Источниковая классификация', 'SourceIFS', 'Источниковая классификация', ' ', 1, 101, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17872) ;

CALL ImportField(10111175, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 101, 1, 1, '', 0, 17840) ;

CALL ImportField(10111176, 'RECORDINDEX', 'RECORDINDEX', 'RECORDINDEX', ' ', 1, 101, 1, 1, 'КодДокумента', 0, 17849) ;

CALL ImportField(10111177, 'ID', 'ID', 'ID', ' ', 1, 101, 1, 1, 'КодЗаписи', 0, 17822) ;

CALL ImportField(10111178, 'ACCEPTORACCREF', 'ACCEPTORACCREF', 'ACCEPTORACCREF', ' ', 1, 101, 1, 1, 'СчетПолучателя', 0, 17854) ;

CALL ImportField(10111179, 'ACCOUNTREF', 'ACCOUNTREF', 'ACCOUNTREF', ' ', 1, 101, 1, 1, 'СчетРаспорядителя', 0, 17837) ;

CALL ImportField(10111180, 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', ' ', 1, 101, 1, 1, 'ФедеральныеСредства', 0, 17865) ;

CALL ImportField(10111184, 'Наименование(Распорядитель)', 'NAME', 'Наименование(Распорядитель)', ' ', 1, 101, 1, 0, '', 0, 16646) ;

CALL ImportField(10111185, 'Наименование(Получатель(*))', 'NAMEA', 'Наименование(Получатель(*))', ' ', 1, 101, 1, 0, '', 0, 16646) ;

CALL ImportField(10112045, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 101, 2, 0, 'БухПроводка', 0, 17858) ;

CALL ImportField(10112047, 'Кредит', 'CREDIT', 'Кредит', ' ', 1, 101, 2, 1, 'Кредит', 0, 17843) ;

CALL ImportField(10112048, 'Дебет', 'DEBIT', 'Дебет', ' ', 1, 101, 2, 1, 'Дебет', 0, 17844) ;

CALL ImportField(10112049, 'ЭКР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 101, 2, 0, 'КЭСР', 0, 17827) ;

CALL ImportField(10112050, 'ФКР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 101, 2, 0, 'КФСР', 0, 17823) ;

CALL ImportField(10112051, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 101, 2, 1, 'КЦСРКлюч', 0, 17824) ;

CALL ImportField(10112052, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 101, 2, 1, 'КВСРКлюч', 0, 17825) ;

CALL ImportField(10112053, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 101, 2, 1, 'КВРКлюч', 0, 17826) ;

CALL ImportField(10112054, 'СубКОСГУ', 'SUBKESR', 'СубКЭСР', ' ', 1, 101, 2, 0, 'СубКЭСР', 0, 17828) ;

CALL ImportField(10112056, 'Район', 'REGIONCLS', 'Район', ' ', 1, 101, 2, 0, 'Регион', 0, 17831) ;

CALL ImportField(10112057, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 101, 2, 1, 'ТипДокумента', 0, 17832) ;

CALL ImportField(10112058, 'Источник', 'FINSOURCE', 'Источник', ' ', 1, 101, 2, 0, 'ИсточникФинансирования', 0, 17830) ;

CALL ImportField(10112060, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 101, 2, 0, 'ТипСредств', 0, 17835) ;

CALL ImportField(10112062, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', ' ', 1, 101, 2, 0, 'ЛицевойСчет', 0, 17855) ;

CALL ImportField(10112063, 'Распорядитель', 'ManagerOwner', 'Распорядитель', ' ', 1, 101, 2, 0, '', 0, null) ;

CALL ImportField(10112064, 'Счет распорядителя', 'ACC', 'Счет распорядителя', ' ', 1, 101, 2, 1, '', 0, null) ;

CALL ImportField(10112069, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 101, 2, 1, 'Примечание', 0, 17845) ;

CALL ImportField(10112070, 'Получатель(*)', 'AcceptorOwner', 'Получатель(*)', ' ', 1, 101, 2, 0, '', 0, null) ;

CALL ImportField(10112071, 'Счет получателя', 'AccA', 'Счет получателя', ' ', 1, 101, 2, 1, '', 0, null) ;

CALL ImportField(10112075, 'Сумма в валюте', 'CURRENCYSUMMA', 'Сумма в валюте', ' ', 1, 101, 2, 1, 'СуммаВВалюте', 0, 17842) ;

CALL ImportField(10112076, 'Тип валюты', 'CURRENCYCLS', 'Тип валюты', ' ', 1, 101, 2, 1, 'КодВалюты', 0, 17834) ;

CALL ImportField(10112078, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 101, 2, 0, 'БухОперация', 0, 17871) ;

CALL ImportField(10112163, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', ' ', 1, 101, 2, 0, '', 0, null) ;

CALL ImportField(10112164, 'Номер', 'DocNumber', 'Номер', ' ', 1, 101, 2, 0, 'НомерДокумента', 0, 17870) ;

CALL ImportField(10112181, 'Дата выдачи', 'ACCEPTDATE', 'Дата выдачи', ' ', 1, 101, 2, 1, 'ДатаПринятия', 0, 17838) ;

CALL ImportField(10112182, 'BUDGETREF', 'BUDGETREF', 'BUDGETREF', ' ', 1, 101, 2, 1, '', 0, 17840) ;

CALL ImportField(10112183, 'RECORDINDEX', 'RECORDINDEX', 'RECORDINDEX', ' ', 1, 101, 2, 1, 'КодДокумента', 0, 17849) ;

CALL ImportField(10112184, 'ID', 'ID', 'ID', ' ', 1, 101, 2, 1, 'КодЗаписи', 0, 17822) ;

CALL ImportField(10112185, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 101, 2, 1, 'СчетПлат', 0, 17836) ;

CALL ImportField(10112186, 'Счет(Получатель(*))', 'AcceptorAccRef', 'ссылка на счет получателя', ' ', 1, 101, 2, 1, 'СчетПолучателя', 0, 17854) ;

CALL ImportField(10112187, 'Счет', 'ACCOUNTREF', 'Счет', ' ', 1, 101, 2, 1, 'СчетРаспорядителя', 0, 17837) ;

CALL ImportField(10112188, 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', ' ', 1, 101, 2, 1, 'ФедеральныеСредства', 0, 17865) ;

CALL ImportField(10112207, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 101, 2, 1, 'ДатаУчета', 0, 17861) ;

CALL ImportField(10112208, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 101, 2, 0, 'ТипКлассификации', 0, 17874) ;

CALL ImportField(10112209, 'Источниковая классификация', 'SourceIFS', 'Источниковая классификация', ' ', 1, 101, 2, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17872) ;

CALL ImportField(10112210, 'Классификация', 'TreeOwner1', 'Классификация', ' ', 1, 101, 2, 0, '', 0, null) ;

CALL ImportField(10112211, 'Вид источника(Классификация)', 'SourceIFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 101, 2, 0, '', 0, 17050) ;

CALL ImportField(10112212, 'ЭКИ(Классификация)', 'SourceIFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 101, 2, 0, '', 0, 17054) ;

CALL ImportField(10113079, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 101, 3, 1, 'ДатаУчета', 0, 19188) ;

CALL ImportField(10113080, 'Плановая дата', 'PlanDate', 'Плановая дата', ' ', 1, 101, 3, 1, 'Дата', 0, 19189) ;

CALL ImportField(10113082, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 101, 3, 1, 'БухПроводка', 0, 19208) ;

CALL ImportField(10113088, 'Счет распорядителя', 'ACC', 'Счет распорядителя', ' ', 1, 101, 3, 1, '', 0, null) ;

CALL ImportField(10113094, 'Счет получателя', 'AccA', 'Счет получателя', ' ', 1, 101, 3, 1, '', 0, null) ;

CALL ImportField(10113095, 'Субкод', 'SUBKD', 'Субкод', ' ', 1, 101, 3, 0, 'СубКД', 0, 19196) ;

CALL ImportField(10113096, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 101, 3, 1, 'ТипДокумента', 0, 19197) ;

CALL ImportField(10113097, '№ документа', 'SourceDocNumber', '№ документа', ' ', 1, 101, 3, 1, 'НомерЗаписи', 0, 19198) ;

CALL ImportField(10113098, 'Район', 'REGIONCLS', 'Район', ' ', 1, 101, 3, 1, 'РайонИзДетали', 0, 19199) ;

CALL ImportField(10113099, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 101, 3, 1, 'ПримечаниеДет', 0, 19200) ;

CALL ImportField(10113100, 'Тип валюты', 'CURRENCYCLS', 'Тип валюты', ' ', 1, 101, 3, 1, 'КодВалюты', 0, 19206) ;

CALL ImportField(10113101, 'Сумма в валюте', 'CURRENCYSUMMA', 'Сумма в валюте', ' ', 1, 101, 3, 1, 'СуммаВВалюте', 0, 19207) ;

CALL ImportField(10113102, 'Источники внутреннего и внешнего финансирования', 'FinSourceValue', 'Источники внутреннего и внешнего финансирования', ' ', 1, 101, 3, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(10113104, 'Вид источника(Источники внутреннего и внешнего финансирования)', 'DescriptionCode', 'Вид источника', ' ', 1, 101, 3, 0, '', 0, 17050) ;

CALL ImportField(10113105, 'ЭКИ(Источники внутреннего и внешнего финансирования)', 'IFSKESR', 'ЭКИ', ' ', 1, 101, 3, 0, '', 0, 17054) ;

CALL ImportField(10113106, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 101, 3, 0, '', 0, 19217) ;

CALL ImportField(10113107, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 101, 3, 0, '', 0, 19218) ;

CALL ImportField(10113165, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', ' ', 1, 101, 3, 0, '', 0, null) ;

CALL ImportField(10113208, 'Дата уплаты', 'ACCEPTDATE', 'Дата уплаты', ' ', 1, 101, 3, 1, '', 0, 19187) ;

CALL ImportField(10113209, 'AcceptorAccRef', 'AcceptorAccRef', 'AcceptorAccRef', ' ', 1, 101, 3, 1, 'СчетПолучателя', 0, 19194) ;

CALL ImportField(10113210, 'AccRef', 'AccRef', 'AccRef', ' ', 1, 101, 3, 1, 'СчетКредитора', 0, 19193) ;

CALL ImportField(10113211, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 101, 3, 1, 'РСФО', 0, 19190) ;

CALL ImportField(10113212, 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', ' ', 1, 101, 3, 1, 'ФедеральныеСредства', 0, 19216) ;

CALL ImportField(10113213, 'ID', 'ID', 'ID', ' ', 1, 101, 3, 1, 'КодЗаписи', 0, 19183) ;

CALL ImportField(10113214, 'ИВФ', 'IFS', 'ИВФ', ' ', 1, 101, 3, 1, 'ИсточникВнутрФинансированияКлюч', 0, 19195) ;

CALL ImportField(10113215, 'Получатель(*)', 'AcceptorOwner', 'Получатель(*)', ' ', 1, 101, 3, 0, '', 0, null) ;

CALL ImportField(10113217, 'Распорядитель', 'ManagerOwner', 'Распорядитель', ' ', 1, 101, 3, 0, '', 0, null) ;

CALL ImportField(10114108, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 101, 4, 1, 'БухПроводка', 0, 17858) ;

CALL ImportField(10114109, 'Кредит', 'Credit', 'Кредит', ' ', 1, 101, 4, 1, 'Кредит', 0, 17843) ;

CALL ImportField(10114110, 'Дебет', 'Debit', 'Дебет', ' ', 1, 101, 4, 0, 'Дебет', 0, 17844) ;

CALL ImportField(10114111, 'ЭКР', 'KESR', 'КЭСР', ' ', 1, 101, 4, 0, 'КЭСР', 0, 17827) ;

CALL ImportField(10114112, 'ФКР', 'KFSR', 'КФСР', ' ', 1, 101, 4, 0, 'КФСР', 0, 17823) ;

CALL ImportField(10114113, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 101, 4, 1, 'КЦСРКлюч', 0, 17824) ;

CALL ImportField(10114114, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 101, 4, 1, 'КВСРКлюч', 0, 17825) ;

CALL ImportField(10114115, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 101, 4, 1, 'КВРКлюч', 0, 17826) ;

CALL ImportField(10114116, 'СубКОСГУ', 'SUBKESR', 'СубКЭСР', ' ', 1, 101, 4, 0, 'СубКЭСР', 0, 17828) ;

CALL ImportField(10114118, 'Район', 'REGIONCLS', 'Район', ' ', 1, 101, 4, 0, 'Регион', 0, 17831) ;

CALL ImportField(10114119, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 101, 4, 1, 'ТипДокумента', 0, 17832) ;

CALL ImportField(10114120, 'Источник', 'FINSOURCE', 'Источник', ' ', 1, 101, 4, 1, 'ИсточникФинансирования', 0, 17830) ;

CALL ImportField(10114123, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 101, 4, 0, 'ТипСредств', 0, 17835) ;

CALL ImportField(10114124, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', ' ', 1, 101, 4, 0, 'ЛицевойСчет', 0, 17855) ;

CALL ImportField(10114125, 'Распорядитель', 'ManagerOwner', 'Распорядитель', ' ', 1, 101, 4, 0, '', 0, null) ;

CALL ImportField(10114129, 'Получатель(*)', 'AcceptorOwner', 'Получатель(*)', ' ', 1, 101, 4, 0, '', 0, null) ;

CALL ImportField(10114131, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 101, 4, 1, 'Примечание', 0, 17845) ;

CALL ImportField(10114133, 'Тип валюты', 'CURRENCYCLS', 'Тип валюты', ' ', 1, 101, 4, 1, 'КодВалюты', 0, 17834) ;

CALL ImportField(10114134, 'Сумма в валюте', 'CURRENCYSUMMA', 'Сумма в валюте', ' ', 1, 101, 4, 1, 'СуммаВВалюте', 0, 17842) ;

CALL ImportField(10114136, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 101, 4, 0, 'БухОперация', 0, 17871) ;

CALL ImportField(10114166, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', ' ', 1, 101, 4, 0, '', 0, null) ;

CALL ImportField(10114167, 'Номер', 'DocNumber', 'Номер', ' ', 1, 101, 4, 0, 'НомерДокумента', 0, 17870) ;

CALL ImportField(10114189, 'Дата уплаты', 'ACCEPTDATE', 'Дата уплаты', ' ', 1, 101, 4, 1, 'ДатаПринятия', 0, 17838) ;

CALL ImportField(10114190, 'Тип обслуживания', 'ProgIndex', 'Тип обслуживания', ' ', 1, 101, 4, 1, 'ИндексыДанных', 0, 17848) ;

CALL ImportField(10114191, 'BUDGETREF', 'BUDGETREF', 'BUDGETREF', ' ', 1, 101, 4, 1, '', 0, 17840) ;

CALL ImportField(10114192, 'RECORDINDEX', 'RECORDINDEX', 'RECORDINDEX', ' ', 1, 101, 4, 1, 'КодДокумента', 0, 17849) ;

CALL ImportField(10114193, 'ID', 'ID', 'ID', ' ', 1, 101, 4, 1, 'КодЗаписи', 0, 17822) ;

CALL ImportField(10114194, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 101, 4, 1, 'СчетПлат', 0, 17836) ;

CALL ImportField(10114195, 'AcceptorAccRef', 'AcceptorAccRef', 'AcceptorAccRef', ' ', 1, 101, 4, 1, 'СчетПолучателя', 0, 17854) ;

CALL ImportField(10114196, 'AccountRef', 'AccountRef', 'AccountRef', ' ', 1, 101, 4, 1, 'СчетРаспорядителя', 0, 17837) ;

CALL ImportField(10114197, 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', ' ', 1, 101, 4, 1, 'ФедеральныеСредства', 0, 17865) ;

CALL ImportField(10114215, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 101, 4, 1, 'ДатаУчета', 0, 17861) ;

CALL ImportField(10115137, 'Код дохода', 'KDValue', 'Код дохода', ' ', 1, 101, 5, 0, 'КодДохода', 0, 16836) ;

CALL ImportField(10115139, 'Вид дохода(Код дохода)', 'KDDescriptionCode', 'Вид дохода', ' ', 1, 101, 5, 0, '', 0, 16831) ;

CALL ImportField(10115140, 'Подвид(Код дохода)', 'KDProgramCode', 'Программа', ' ', 1, 101, 5, 0, '', 0, 16834) ;

CALL ImportField(10115141, 'ЭКД(Код дохода)', 'KDKESR', 'ЭКД', ' ', 1, 101, 5, 0, '', 0, 16835) ;

CALL ImportField(10115142, 'Субкод дохода', 'SUBKD', 'Субкод дохода', ' ', 1, 101, 5, 0, 'СубКД', 0, 17681) ;

CALL ImportField(10115143, 'Дебет', 'DEBIT', 'Дебет', ' ', 1, 101, 5, 1, 'Дебет', 0, 17673) ;

CALL ImportField(10115144, 'Кредит', 'CREDIT', 'Кредит', ' ', 1, 101, 5, 1, 'Кредит', 0, 17674) ;

CALL ImportField(10115145, 'Район', 'REGIONCLS', 'Район', ' ', 1, 101, 5, 0, 'Район', 0, 17682) ;

CALL ImportField(10115150, 'Счет', 'ACC', 'Счет', ' ', 1, 101, 5, 0, '', 0, null) ;

CALL ImportField(10115151, 'ГосНИ', 'GOSNI', 'ГосНИ', ' ', 1, 101, 5, 1, 'ГосНИ', 0, 17683) ;

CALL ImportField(10115152, 'Тип документа', 'DocType', 'Тип документа', ' ', 1, 101, 5, 1, 'ТипДокумента', 0, 17675) ;

CALL ImportField(10115153, 'Номер документа', 'DOCNUM', 'Номер документа', ' ', 1, 101, 5, 1, 'НомерДокумента', 0, 17707) ;

CALL ImportField(10115154, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 101, 5, 1, 'Примечание', 0, 17692) ;

CALL ImportField(10115155, 'Бух. проводка', 'BUHPAYMENTCLS', 'Бух. проводка', ' ', 1, 101, 5, 1, 'БухПроводка', 0, 17700) ;

CALL ImportField(10115156, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 101, 5, 0, 'БухОперация', 0, 17720) ;

CALL ImportField(10115169, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', ' ', 1, 101, 5, 0, '', 0, null) ;

CALL ImportField(10115198, 'Дата принятия', 'AcceptDate', 'Дата принятия', ' ', 1, 101, 5, 1, 'ДатаПринятия', 0, 17672) ;

CALL ImportField(10115199, 'Код дохода', 'KD', 'Код дохода', ' ', 1, 101, 5, 1, 'КДКлюч', 0, 17680) ;

CALL ImportField(10115200, 'BUDGETREF', 'BUDGETREF', 'BUDGETREF', ' ', 1, 101, 5, 1, '', 0, 17687) ;

CALL ImportField(10115201, 'ID', 'ID', 'ID', ' ', 1, 101, 5, 1, 'КодЗаписи', 0, 17669) ;

CALL ImportField(10115202, 'TotalRef', 'TotalRef', 'TotalRef', ' ', 1, 101, 5, 1, 'КодОбобщеннойЗаявки', 0, 17702) ;

CALL ImportField(10115203, 'Организация', 'ORG_REF', 'Организация', ' ', 1, 101, 5, 1, 'Организация', 0, 17677) ;

CALL ImportField(10115204, 'RecordIndex', 'RecordIndex', 'RecordIndex', ' ', 1, 101, 5, 1, 'СсылкаНаДеталь', 0, 17686) ;

CALL ImportField(10115205, 'Счет', 'ACCOUNTREF', 'Счет', ' ', 1, 101, 5, 1, 'СчетПлат', 0, 17679) ;

CALL ImportField(10115206, 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', ' ', 1, 101, 5, 1, 'ФедеральныеСредства', 0, 17719) ;

CALL ImportField(10115216, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 101, 5, 0, 'ТипСредств', 0, 17699) ;

CALL ImportField(10115218, 'Организация', 'OrgOwner', 'Организация', ' ', 1, 101, 5, 0, '', 0, null) ;

-- Все плановые документы(Расходы), УРМ(0)
CALL ImportField(20000001, 'Дата принятия', '{РусПоле("ДатаПринятия")}', 'Дата принятия(проведения) документа', ' ', 0, 200, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(20000002, 'Код причины отклонения', '{РусПоле("ПричинаОтклонКод")}', 'Код причины отклонения документа', ' ', 0, 200, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(20000003, 'Причина отклонения (комментарий)', '{РусПоле("ПричинаОтклонТекст")}', 'Причина отклонения (комментарий)', ' ', 0, 200, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(20000004, 'Код удалённого клиента', '{РусПоле("КодОтправителяДокумента")}', 'Код удалённого клиента(отправителя документа)', ' ', 0, 200, 0, 0, 'КодОтправителяДокумента', 0, null) ;

CALL ImportField(20000005, 'Автор документа', '{РусПоле("АвторДокумента")}', 'Автор документа', ' ', 0, 200, 0, 0, 'АвторДокумента', 0, null) ;

CALL ImportField(20000006, 'Состояние документа', '{РусПоле("СостояниеДокумента")}', 'Состояние документа', ' ', 0, 200, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(20000007, 'Бюджет', '{РусПоле("КодБюджета")}', 'Бюджет документа', ' ', 0, 200, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(20000008, 'Лицевой счет владельца документа', '{РусПоле("ЛицевойСчетЗаголовок")}', 'Лицевой счет владельца документа из заголовка', ' ', 0, 200, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(20000009, 'Число подтверждающих документов по факсу', '{РусПоле("ЧислоПодтверждающихДокументовПоФаксу")}', 'Число подтверждающих документов по факсу', ' ', 0, 200, 0, 0, 'ЧислоПодтверждающихДокументовПоФаксу', 0, null) ;

CALL ImportField(20000011, 'Статус ЭЦП', '{РусПоле("КриптоСтатус")}', 'Статус ЭЦП', ' ', 0, 200, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(20000012, 'Вариант росписи', '{РусПоле("ВариантРосписи")}', 'Вариант учета планового документа', ' ', 0, 200, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(20000013, 'Вид плана', '{РусПоле("ВидПлана")}', 'Вид плана', ' ', 0, 200, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(20001008, 'Лицевой счет', '{РусПоле("ЛицевойСчет")}', 'Лицевой счет из детализации', ' ', 0, 200, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(20001010, 'Код записи', '{РусПоле("КодЗаписи")}', 'Код записи', ' ', 0, 200, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(20001011, 'Код целевых средств (ключ)', '{РусПоле("КодЦелевыхСредствКлюч")}', 'Код целевых средств (ключ)', ' ', 0, 200, 1, 0, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(20001012, 'Тип классификации', '{РусПоле("ТипКлассификации")}', 'Тип классификации', ' ', 0, 200, 1, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(20001013, 'Код целевых средств', '{РусПоле("КодЦелевыхСредств")}', 'Код целевых средств', ' ', 0, 200, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(20001014, 'Код субсидии', '{РусПоле("КодСубсидии")}', 'Код субсидии', ' ', 0, 200, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(20001015, 'Код субсидии (ключ)', '{РусПоле("КодСубсидииКлюч")}', 'Код субсидии (ключ)', ' ', 0, 200, 1, 0, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(20001016, 'Операция', '{РусПоле("БухОперация")}', 'Операция', ' ', 0, 200, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(20001017, 'Код дохода (ключ)', '{РусПоле("КДКлюч")}', 'Код дохода (ключ)', ' ', 0, 200, 1, 0, 'КДКлюч', 0, null) ;

CALL ImportField(20001018, 'КВСРКлюч', '{РусПоле("КВСРКлюч")}', 'КВСР (ключ)', ' ', 0, 200, 1, 0, 'КВСРКлюч', 0, null) ;

CALL ImportField(20001019, 'КВРКлюч', '{РусПоле("КВРКлюч")}', 'КВР (ключ)', ' ', 0, 200, 1, 0, 'КВРКлюч', 0, null) ;

CALL ImportField(20001020, 'ФКР', '{РусПоле("КФСР")}', 'ФКР', ' ', 0, 200, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(20001021, 'ЭКР', '{РусПоле("КЭСР")}', 'ЭКР', ' ', 0, 200, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(20001022, 'КЦСРКлюч', '{РусПоле("КЦСРКлюч")}', 'КЦСР (ключ)', ' ', 0, 200, 1, 0, 'КЦСРКлюч', 0, null) ;

CALL ImportField(20001023, 'КВР', '{РусПоле("КВР")}', 'КВР', ' ', 0, 200, 1, 0, 'КВР', 0, null) ;

CALL ImportField(20001024, 'КВСР', '{РусПоле("КВСР")}', 'КВСР', ' ', 0, 200, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(20001025, 'КЦСР', '{РусПоле("КЦСР")}', 'КЦСР', ' ', 0, 200, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(20001026, 'Код дохода', '{РусПоле("КодДохода")}', 'Код дохода', ' ', 0, 200, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(20001027, 'Тип средств', '{РусПоле("ТипСредств")}', 'Тип средств', ' ', 0, 200, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(20001028, 'Получатель субсидии', '{РусПоле("ОргПолучСубсидии")}', 'Организация-получатель субсидии(ссылка)', ' ', 0, 200, 1, 0, 'ОргПолучСубсидии', 0, null) ;

-- Все плановые документы(Расходы), Бюджет(1)
CALL ImportField(20010001, 'Дата принятия', '{РусПоле("ДатаПринятия")}', 'Дата принятия(проведения) документа', ' ', 1, 200, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(20010002, 'Код причины отклонения', '{РусПоле("ПричинаОтклонКод")}', 'Код причины отклонения документа', ' ', 1, 200, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(20010003, 'Причина отклонения (комментарий)', '{РусПоле("ПричинаОтклонТекст")}', 'Причина отклонения (комментарий)', ' ', 1, 200, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(20010004, 'Код удалённого клиента', '{РусПоле("КодОтправителяДокумента")}', 'Код удалённого клиента(отправителя документа)', ' ', 1, 200, 0, 0, 'КодОтправителяДокумента', 0, null) ;

CALL ImportField(20010005, 'Автор документа', '{РусПоле("АвторДокумента")}', 'Автор документа', ' ', 1, 200, 0, 0, 'АвторДокумента', 0, null) ;

CALL ImportField(20010006, 'Состояние документа', '{РусПоле("СостояниеДокумента")}', 'Состояние документа', ' ', 1, 200, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(20010007, 'Бюджет', '{РусПоле("КодБюджета")}', 'Бюджет документа', ' ', 1, 200, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(20010008, 'Лицевой счет владельца документа', '{РусПоле("ЛицевойСчетЗаголовок")}', 'Лицевой счет владельца документа из заголовка', ' ', 1, 200, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(20010009, 'Число подтверждающих документов по факсу', '{РусПоле("ЧислоПодтверждающихДокументовПоФаксу")}', 'Число подтверждающих документов по факсу', ' ', 1, 200, 0, 0, 'ЧислоПодтверждающихДокументовПоФаксу', 0, null) ;

CALL ImportField(20010011, 'Статус ЭЦП', '{РусПоле("КриптоСтатус")}', 'Статус ЭЦП', ' ', 1, 200, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(20010012, 'Вариант росписи', '{РусПоле("ВариантРосписи")}', 'Вариант учета планового документа', ' ', 1, 200, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(20010013, 'Вид плана', '{РусПоле("ВидПлана")}', 'Вид плана', ' ', 1, 200, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(20010014, 'Организация (заголовок)', '{РусПоле("ОрганизацияЗаголовок")}', 'Организация (заголовок)', ' ', 1, 200, 0, 1, 'ОрганизацияЗаголовок', 0, null) ;

CALL ImportField(20011008, 'Лицевой счет', '{РусПоле("ЛицевойСчет")}', 'Лицевой счет из детализации', ' ', 1, 200, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(20011010, 'Код записи', '{РусПоле("КодЗаписи")}', 'Код записи', ' ', 1, 200, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(20011011, 'Код целевых средств (ключ)', '{РусПоле("КодЦелевыхСредствКлюч")}', 'Код целевых средств (ключ)', ' ', 1, 200, 1, 0, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(20011012, 'Тип классификации', '{РусПоле("ТипКлассификации")}', 'Тип классификации', ' ', 1, 200, 1, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(20011013, 'Код целевых средств', '{РусПоле("КодЦелевыхСредств")}', 'Код целевых средств', ' ', 1, 200, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(20011014, 'Код субсидии', '{РусПоле("КодСубсидии")}', 'Код субсидии', ' ', 1, 200, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(20011015, 'Код субсидии (ключ)', '{РусПоле("КодСубсидииКлюч")}', 'Код субсидии (ключ)', ' ', 1, 200, 1, 0, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(20011016, 'Операция', '{РусПоле("БухОперация")}', 'Операция', ' ', 1, 200, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(20011017, 'Код дохода (ключ)', '{РусПоле("КДКлюч")}', 'Код дохода (ключ)', ' ', 1, 200, 1, 0, 'КДКлюч', 0, null) ;

CALL ImportField(20011018, 'КВСРКлюч', '{РусПоле("КВСРКлюч")}', 'КВСР (ключ)', ' ', 1, 200, 1, 0, 'КВСРКлюч', 0, null) ;

CALL ImportField(20011019, 'КВРКлюч', '{РусПоле("КВРКлюч")}', 'КВР (ключ)', ' ', 1, 200, 1, 0, 'КВРКлюч', 0, null) ;

CALL ImportField(20011020, 'ФКР', '{РусПоле("КФСР")}', 'ФКР', ' ', 1, 200, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(20011021, 'ЭКР', '{РусПоле("КЭСР")}', 'ЭКР', ' ', 1, 200, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(20011022, 'КЦСРКлюч', '{РусПоле("КЦСРКлюч")}', 'КЦСР (ключ)', ' ', 1, 200, 1, 0, 'КЦСРКлюч', 0, null) ;

CALL ImportField(20011023, 'КВР', '{РусПоле("КВР")}', 'КВР', ' ', 1, 200, 1, 0, 'КВР', 0, null) ;

CALL ImportField(20011024, 'КВСР', '{РусПоле("КВСР")}', 'КВСР', ' ', 1, 200, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(20011025, 'КЦСР', '{РусПоле("КЦСР")}', 'КЦСР', ' ', 1, 200, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(20011026, 'Код дохода', '{РусПоле("КодДохода")}', 'Код дохода', ' ', 1, 200, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(20011027, 'Тип средств', '{РусПоле("ТипСредств")}', 'Тип средств', ' ', 1, 200, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(20011028, 'Получатель субсидии', '{РусПоле("ОргПолучСубсидии")}', 'Организация-получатель субсидии(ссылка)', ' ', 1, 200, 1, 0, 'ОргПолучСубсидии', 0, null) ;

CALL ImportField(20011029, 'Организация', '{РусПоле("ОрганизацияДеталь")}', 'Ссылка на орг. получ.', ' ', 1, 200, 1, 0, 'ОрганизацияДеталь', 0, null) ;

CALL ImportField(20011030, 'ИНН организации', '{РусПоле("ИННОрганизацииДеталь")}', 'ИНН организации', ' ', 1, 200, 1, 0, 'ИННОрганизацииДеталь', 0, null) ;

CALL ImportField(20011031, 'КПП организации', '{РусПоле("КППОрганизацииДеталь")}', 'КПП организации', ' ', 1, 200, 1, 0, 'КППОрганизацииДеталь', 0, null) ;

CALL ImportField(20011032, 'Наименование организации(деталь)', '{РусПоле("НаименованиеОрганизацииДеталь")}', 'Наименование организации', ' ', 1, 200, 1, 0, 'НаименованиеОрганизацииДеталь', 0, null) ;

CALL ImportField(20011033, 'Наименование организации', '{РусПоле("НаименованиеОрганизации")}', 'Наименование организации', ' ', 1, 200, 1, 0, 'НаименованиеОрганизации', 0, null) ;

-- Роспись по ПБС (расходы), УРМ(0)
CALL ImportField(20100001, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 0, 201, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(20100002, 'Код документа', 'Id', 'Код документа', 'Id', 0, 201, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20100003, 'Код документа в БД ФО', 'FUId', 'Код документа в БД ФО', 'FUId', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20100005, 'Основание', 'Note', 'Основание', 'Note', 0, 201, 0, 0, 'Основание', 0, null) ;

CALL ImportField(20100006, 'Дополнительная информация', 'Note1', 'Дополнительная информация', 'Note1', 0, 201, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(20100007, 'По вопросу', 'Note2', 'По вопросу', 'Note2', 0, 201, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(20100008, 'Источник финансирования', 'NotifyType', 'Источник финансирования', 'NotifyType', 0, 201, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(20100010, 'Вариант', 'Variant', 'Вариант', 'Variant', 0, 201, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(20100011, 'Номер', 'ANumber', 'Номер', 'Number', 0, 201, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(20100013, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 0, 201, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(20100015, 'Причина отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 0, 201, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(20100016, 'Причина отклонения(текст)', 'RejectNote', 'Причина отклонения(текст)', 'RejectCause', 0, 201, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(20100017, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 201, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(20100018, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 201, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(20100019, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', 'DestOrgName', 0, 201, 0, 0, '', 0, null) ;

CALL ImportField(20100021, 'Состояние', 'DocStateName', 'Состояние', 'DocStateName', 0, 201, 0, 0, '', 0, null) ;

CALL ImportField(20100022, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20100023, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20100024, 'Признак зависания', 'DocSuspended', '*Признак зависания', 'DocSuspended', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20100025, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20100026, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 0, 201, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(20100027, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LastExtrChange', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20100028, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20100029, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20100071, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'AssignmentSource', 0, 201, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(20100081, 'Отнесение к БА, ЛБО', 'Ba_Lbo_Flag', 'Отнесение к БА, ЛБО', 'Ba_Lbo_flag', 0, 201, 0, 0, 'ПринадлежностьБА_ЛБО', 0, null) ;

CALL ImportField(20100088, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 0, 201, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(20100095, '<Скртыое поле>', 'KPPeriod', '', ' ', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20100096, '<Скртыое поле>', 'ClsType', '', ' ', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20100097, '<Скртыое поле>', 'FacialCode', '', ' ', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20100110, '<Скртыое поле>', 'ProgIndex', '', ' ', 0, 201, 0, 1, '', 0, null) ;

CALL ImportField(20101001, 'Код записи', 'Id', '*Код записи', 'Id', 0, 201, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(20101002, 'Код записи в БД ФО', 'FUId', 'Код записи в БД ФО', 'FUId', 0, 201, 1, 0, '', 0, null) ;

CALL ImportField(20101003, 'КВСРКлюч', 'Kvsr', 'КВСР', 'DestKvsrKey', 0, 201, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(20101004, 'КВРКлюч', 'Kvr', 'КВР', 'DestKvrKey', 0, 201, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(20101005, 'КФСР', 'Kfsr', 'КФСР', 'DestKfsr', 0, 201, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(20101006, 'КЭСР', 'Kesr', 'КЭСР', 'DestKesr', 0, 201, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(20101007, 'КЦСРКлюч', 'Kcsr', 'КЦСР', 'DestKcsrKey', 0, 201, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(20101008, 'СубКЭСР', 'SubKesr', 'СубКЭСР', 'DestSubKesr', 0, 201, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(20101009, 'Регион', 'RegionCls', 'Регион', 'RegionCls', 0, 201, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, null) ;

CALL ImportField(20101011, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'DestFacialAccCls', 0, 201, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(20101012, 'ЛС в ФК', 'FacialCode', 'ЛС в ФК', 'DestFacialAccClsFacialCode', 0, 201, 1, 0, '', 0, null) ;

CALL ImportField(20101013, 'Ссылка на рс получ.', 'Acc_Ref', 'Ссылка на рс получ.', 'DestAccount', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101014, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 201, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20101015, 'Январь', 'Month01', 'Январь', 'Month01', 0, 201, 1, 0, 'РоспЯнварь', 0, null) ;

CALL ImportField(20101016, 'Февраль', 'Month02', 'Февраль', 'Month02', 0, 201, 1, 0, 'РоспФевраль', 0, null) ;

CALL ImportField(20101017, 'Март', 'Month03', 'Март', 'Month03', 0, 201, 1, 0, 'РоспМарт', 0, null) ;

CALL ImportField(20101018, 'Апрель', 'Month04', 'Апрель', 'Month04', 0, 201, 1, 0, 'РоспАпрель', 0, null) ;

CALL ImportField(20101019, 'Май', 'Month05', 'Май', 'Month05', 0, 201, 1, 0, 'РоспМай', 0, null) ;

CALL ImportField(20101020, 'Июнь', 'Month06', 'Июнь', 'Month06', 0, 201, 1, 0, 'РоспИюнь', 0, null) ;

CALL ImportField(20101021, 'Июль', 'Month07', 'Июль', 'Month07', 0, 201, 1, 0, 'РоспИюль', 0, null) ;

CALL ImportField(20101022, 'Август', 'Month08', 'Август', 'Month08', 0, 201, 1, 0, 'РоспАвгуст', 0, null) ;

CALL ImportField(20101023, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 0, 201, 1, 0, 'РоспСентябрь', 0, null) ;

CALL ImportField(20101024, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 0, 201, 1, 0, 'РоспОктябрь', 0, null) ;

CALL ImportField(20101025, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 0, 201, 1, 0, 'РоспНоябрь', 0, null) ;

CALL ImportField(20101026, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 0, 201, 1, 0, 'РоспДекабрь', 0, null) ;

CALL ImportField(20101027, 'Квартал1', 'Quarter1', 'Квартал1', 'Quarter1', 0, 201, 1, 0, 'РоспКвартал1', 0, null) ;

CALL ImportField(20101028, 'Квартал2', 'Quarter2', 'Квартал2', 'Quarter2', 0, 201, 1, 0, 'РоспКвартал2', 0, null) ;

CALL ImportField(20101029, 'Квартал3', 'Quarter3', 'Квартал3', 'Quarter3', 0, 201, 1, 0, 'РоспКвартал3', 0, null) ;

CALL ImportField(20101030, 'Квартал4', 'Quarter4', 'Квартал4', 'Quarter4', 0, 201, 1, 0, 'РоспКвартал4', 0, null) ;

CALL ImportField(20101031, 'За год', 'ONYEAR', 'За год', 'ONYEAR', 0, 201, 1, 0, '', 0, null) ;

CALL ImportField(20101033, 'Источниковая классификация', ' ', 'Источниковая классификация', 'IFS_DescriptionCode', 0, 201, 1, 0, '', 0, null) ;

CALL ImportField(20101037, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 0, 201, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(20101038, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 201, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(20101039, 'Счет', 'Acc', 'Счет', 'DestAccountName', 0, 201, 1, 0, '', 0, null) ;

CALL ImportField(20101040, 'Тип классификации', ' ', 'Тип классификации', 'ClsType', 0, 201, 1, 0, '', 0, null) ;

CALL ImportField(20101041, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 0, 201, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(20101043, 'Индекс данных', 'ProgIndex', 'Индекс данных', 'ProgIndex', 0, 201, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(20101044, 'Бюджетная классификация(группа)', 'TreeOwner0', 'Бюджетная классификация(группа)', 'TreeOwner0', 0, 201, 1, 0, '', 0, null) ;

CALL ImportField(20101060, 'Роспись на первый год', 'SummaYear1', 'Роспись на первый год', 'SummaYear1', 0, 201, 1, 0, 'РоспНаПервыйГод', 0, null) ;

CALL ImportField(20101061, 'Роспись на второй год', 'SummaYear2', 'Роспись на второй год', 'SummaYear2', 0, 201, 1, 0, 'РоспНаВторойГод', 0, null) ;

CALL ImportField(20101062, 'Роспись на третий год', 'SummaYear3', 'Роспись на третий год', 'SummaYear3', 0, 201, 1, 0, 'РоспНаТретийГод', 0, null) ;

CALL ImportField(20101063, 'Корреспондирующий ЭКР', 'KESRCorr', 'Корреспондирующий ЭКР', 'KESRCorr', 0, 201, 1, 0, 'КорКЭСР', 0, null) ;

CALL ImportField(20101070, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'AssignmentKind', 0, 201, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(20101082, 'Сумма на квартал', 'CurQuarter', '', ' ', 0, 201, 1, 0, '', 0, null) ;

CALL ImportField(20101083, '1-й месяц квартала', 'CurMonth1', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101084, '2-й месяц квартала', 'CurMonth2', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101085, '3-й месяц квартала', 'CurMonth3', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101089, 'Бюджет', 'BudgetRef', 'Бюджет', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101090, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 201, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(20101091, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 201, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(20101092, 'КЦСР(Классификация)', 'KCSRCode', '', 'DestKcsr', 0, 201, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(20101093, 'КВР(Классификация)', 'KVRCode', '', 'DestKvr', 0, 201, 1, 0, 'КВР', 0, null) ;

CALL ImportField(20101094, 'КВСР(Классификация)', 'KVSRCode', '', 'DestKvsr', 0, 201, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(20101096, 'Получатель субсидии(трансферта)', 'TransfertOrg_Name', 'Получатель субсидии(трансферта)', ' ', 0, 201, 1, 0, '', 0, null) ;

CALL ImportField(20101098, '<Скртыое поле>', 'KDCode', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101099, '<Скртыое поле>', 'SubKD', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101100, '<Скртыое поле>', 'IFSCode', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101101, '<Скртыое поле>', 'IFS', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101102, '<Скртыое поле>', 'KD', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101103, '<Скртыое поле>', 'TargetCls', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101104, '<Скртыое поле>', 'OnYearIncome', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101105, '<Скртыое поле>', 'OnYearCharges', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101106, '<Скртыое поле>', 'On3Year', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101107, '<Скртыое поле>', 'On3YearIncome', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101108, '<Скртыое поле>', 'On3YearCharges', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101109, '<Скртыое поле>', 'FundsSource', '', ' ', 0, 201, 1, 1, '', 0, null) ;

CALL ImportField(20101112, '<Скртыое поле>', 'ClsType', '', ' ', 0, 201, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20101113, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 0, 201, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(20101114, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 201, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(20101115, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 0, 201, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(20101116, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 0, 201, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(20101117, 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', '', ' ', 0, 201, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(20101118, 'Код расходного обязательства (ключ)', 'PayPromiseCls', '', ' ', 0, 201, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

-- Роспись по ПБС (расходы), Бюджет(1)
CALL ImportField(20110001, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 1, 201, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(20110002, 'Код документа', 'Id', 'Код документа', 'Id', 1, 201, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(20110004, 'Основание(Основание)', 'Note', 'Основание', 'Note', 1, 201, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(20110005, 'Дополнительная информация', 'Note1', 'Дополнительная информация', 'Note1', 1, 201, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(20110006, 'По вопросу(Основание)', 'Note2', 'По вопросу', 'Note2', 1, 201, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(20110007, 'Источник', 'NotifyType', 'Источник финансирования', 'NotifyType', 1, 201, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(20110008, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 1, 201, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(20110010, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 201, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(20110011, 'Номер', 'Number', 'Номер', 'Number', 1, 201, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(20110014, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 201, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(20110016, 'Код причины отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 1, 201, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(20110017, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения(текст)', 'RejectCause', 1, 201, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(20110018, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 201, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(20110019, 'Код сметы', ' ', 'Код сметы', 'StimateId', 1, 201, 0, 1, '', 1, null) ;

CALL ImportField(20110020, 'Статус ЭЦП', 'CryptoStatus', 'КриптоСтатус', 'CryptoStatus', 1, 201, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(20110021, 'СостояниеДокумента', 'DocStateRef', 'Состояние документа', 'DocStateRef', 1, 201, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(20110022, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 1, 201, 0, 0, '', 0, 16646) ;

CALL ImportField(20110025, 'RVersion', 'RVersion', 'Версия записи', ' ', 1, 201, 0, 1, '', 0, 17491) ;

CALL ImportField(20110026, 'Код удалённого клиента', 'SenderId', 'Код удаленного клиента', 'SenderId', 1, 201, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(20110027, 'Л\С владельца документа', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 1, 201, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(20110028, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LastExtrChange', 1, 201, 0, 1, '', 1, null) ;

CALL ImportField(20110029, 'Мягкая причина отклонения', ' ', 'Мягкая причина отклонения', 'SoftRejectCls', 1, 201, 0, 1, '', 1, null) ;

CALL ImportField(20110030, 'Мягкая причина отклонения(текст)', ' ', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 1, 201, 0, 1, '', 1, null) ;

CALL ImportField(20110058, 'Код УРМ документа', 'SenderRecordID', 'SenderRecordID', 'SenderRecordId', 1, 201, 0, 1, 'КодУРМДокумента', 0, 17476) ;

CALL ImportField(20110069, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'ASSIGNMENTSOURCE', 1, 201, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(20110074, 'Индексы данных', 'ProgIndex', 'ProgIndex', ' ', 1, 201, 0, 1, '', 0, 17493) ;

CALL ImportField(20110076, 'Отнесение к БА, ЛБО', 'Ba_Lbo_Flag', 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 1, 201, 0, 0, 'ПринадлежностьБА_ЛБО', 0, 17502) ;

CALL ImportField(20110080, 'Число подтверждающих документов по факсу', 'FaxDocCount', 'Число подтверждающих документов по факсу', ' ', 1, 201, 0, 1, 'ЧислоПодтверждающихДокументовПоФаксу', 0, 17497) ;

CALL ImportField(20110081, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 201, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(20111001, 'Код записи', 'Id', 'Код записи', 'Id', 1, 201, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(20111002, 'Код записи в БД ФО', ' ', '*Код записи в БД ФО', 'FUId', 1, 201, 1, 1, '', 1, null) ;

CALL ImportField(20111003, 'Бюджет', 'BudgetRef', 'Бюджет', 'BUDGETREF', 1, 201, 1, 1, '', 0, 17410) ;

CALL ImportField(20111004, 'КВСРКлюч', 'Kvsr', 'КВСР', 'DestKvsrKey', 1, 201, 1, 1, 'КВСРКлюч', 0, 17412) ;

CALL ImportField(20111005, 'КВРКлюч', 'Kvr', 'КВР', 'DestKvrKey', 1, 201, 1, 1, 'КВРКлюч', 0, 17414) ;

CALL ImportField(20111006, 'ФКР(Классификация)', 'Kfsr', 'КФСР', 'DestKfsr', 1, 201, 1, 0, 'КФСР', 0, 17411) ;

CALL ImportField(20111007, 'ЭКР(Классификация)', 'Kesr', 'КЭСР', 'DestKesr', 1, 201, 1, 0, 'КЭСР', 0, 17415) ;

CALL ImportField(20111008, 'КЦСРКлюч', 'KCSR', 'КЦСР', 'DestKcsrKey', 1, 201, 1, 1, 'КЦСРКлюч', 0, 17413) ;

CALL ImportField(20111009, 'Суб КОСГУ', 'SubKesr', 'СубКЭСР', 'DestSubKesr', 1, 201, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(20111010, 'Район трансферта', 'RegionCls', 'Регион', 'RegionCls', 1, 201, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17417) ;

CALL ImportField(20111012, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'DestFacialAccCls', 1, 201, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(20111014, 'Наименование лс', '', 'Наименование лс', 'DestFacialAccClsName', 1, 201, 1, 1, '', 1, null) ;

CALL ImportField(20111015, 'л/с ФК', 'FacialCode', 'ЛС в ФК', 'DestFacialAccClsFacialCode', 1, 201, 1, 0, '', 0, null) ;

CALL ImportField(20111020, 'Код документа', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 1, 201, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(20111021, 'RVersion', 'RVersion', 'Версия записи', ' ', 1, 201, 1, 1, '', 0, 17449) ;

CALL ImportField(20111022, 'Код отправителя записи', 'SenderId', 'Код удаленного клиента', 'SenderId', 1, 201, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(20111023, 'Код УРМ записи', 'SenderRecordId', 'Код записи удаленного клиента', 'SenderRecordId', 1, 201, 1, 1, 'КодУРМЗаписи', 0, 17435) ;

CALL ImportField(20111024, 'Январь', 'Month01', 'Январь', 'Month01', 1, 201, 1, 0, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(20111025, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 201, 1, 0, 'РоспФевраль', 0, 17437) ;

CALL ImportField(20111026, 'Март', 'Month03', 'Март', 'Month03', 1, 201, 1, 0, 'РоспМарт', 0, 17438) ;

CALL ImportField(20111027, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 201, 1, 0, 'РоспАпрель', 0, 17439) ;

CALL ImportField(20111028, 'Май', 'Month05', 'Май', 'Month05', 1, 201, 1, 0, 'РоспМай', 0, 17440) ;

CALL ImportField(20111029, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 201, 1, 0, 'РоспИюнь', 0, 17441) ;

CALL ImportField(20111030, 'Июль', 'Month07', 'Июль', 'Month07', 1, 201, 1, 0, 'РоспИюль', 0, 17442) ;

CALL ImportField(20111031, 'Август', 'Month08', 'Август', 'Month08', 1, 201, 1, 0, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(20111032, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 201, 1, 0, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(20111033, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 201, 1, 0, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(20111034, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 201, 1, 0, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(20111035, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 201, 1, 0, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(20111036, 'Квартал 1', 'Quarter1', 'Квартал1', 'Quarter1', 1, 201, 1, 0, 'РоспКвартал1', 0, 17421) ;

CALL ImportField(20111037, 'Квартал 2', 'Quarter2', 'Квартал2', 'Quarter2', 1, 201, 1, 0, 'РоспКвартал2', 0, 17422) ;

CALL ImportField(20111038, 'Квартал 3', 'Quarter3', 'Квартал3', 'Quarter3', 1, 201, 1, 0, 'РоспКвартал3', 0, 17423) ;

CALL ImportField(20111039, 'Квартал 4', 'Quarter4', 'Квартал4', 'Quarter4', 1, 201, 1, 0, 'РоспКвартал4', 0, 17424) ;

CALL ImportField(20111044, 'ИНН(Получатель)', 'INN', 'ИНН', 'DestOrgInn', 1, 201, 1, 0, 'ИННОрганизацииДеталь', 0, 16645) ;

CALL ImportField(20111046, 'Классификация', 'TreeOwner0', 'Бюджетная классификация(группа)', ' ', 1, 201, 1, 0, '', 0, null) ;

CALL ImportField(20111047, 'КПП(Получатель)', 'INN20', 'КПП', 'DestOrgKpp', 1, 201, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(20111048, 'Наименование(Получатель)', 'NAME', 'Наименование', 'DestOrgNAME', 1, 201, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(20111050, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 201, 1, 0, 'БухОперация', 0, 17451) ;

CALL ImportField(20111052, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 201, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(20111055, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 201, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(20111064, 'ЭКР (получено)', 'KESRCORR', 'ЭКР (получено)', 'KESRCORR', 1, 201, 1, 0, 'КорКЭСР', 0, 17461) ;

CALL ImportField(20111065, 'Первый год', 'SUMMAYEAR1', 'Очередной финансовый год', 'SUMMAYEAR1', 1, 201, 1, 0, 'РоспНаПервыйГод', 0, 17457) ;

CALL ImportField(20111066, 'Второй плановый год', 'SUMMAYEAR2', 'Второй плановый год', 'SUMMAYEAR2', 1, 201, 1, 0, 'РоспНаВторойГод', 0, 17458) ;

CALL ImportField(20111067, 'Третий плановый год', 'SUMMAYEAR3', 'Третий плановый год', 'SUMMAYEAR3', 1, 201, 1, 0, 'РоспНаТретийГод', 0, 17459) ;

CALL ImportField(20111068, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'ASSIGNMENTKIND', 1, 201, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(20111075, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 201, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(20111076, '1-й месяц квартала', 'CurMonth1', '1-й месяц квартала', ' ', 1, 201, 1, 1, '', 0, null) ;

CALL ImportField(20111077, '2-й месяц квартала', 'CurMonth2', '2-й месяц квартала', ' ', 1, 201, 1, 1, '', 0, null) ;

CALL ImportField(20111078, '3-й месяц квартала', 'CurMonth3', '3-й месяц квартала', ' ', 1, 201, 1, 1, '', 0, null) ;

CALL ImportField(20111079, 'Сумма на квартал', 'CurQuarter', 'Сумма на квартал', ' ', 1, 201, 1, 1, '', 0, null) ;

CALL ImportField(20111080, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 201, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(20111082, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 201, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(20111087, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 201, 1, 0, '', 0, null) ;

CALL ImportField(20111088, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 201, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20111089, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 201, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(20111091, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 201, 1, 0, '', 0, 26617) ;

CALL ImportField(20111094, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 201, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(20111095, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 201, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

CALL ImportField(20111096, 'Получатель субсидии(трансферта)', 'TransfertOrg_Name', 'Получатель субсидии(трансферта)', ' ', 1, 201, 1, 0, '', 0, 16646) ;

CALL ImportField(20111097, 'Получатель субсидии(трансферта)', 'TransfertOrg_Ref', 'Получатель субсидии(трансферта)(ссылка)', 'TransfertOrg_Ref', 1, 201, 1, 1, 'ОргПолучСубсидии', 0, 29463) ;

-- СБР (расходы), УРМ(0)
CALL ImportField(20200015, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 0, 202, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(20200016, 'Код документа', 'Id', 'Код документа', 'Id', 0, 202, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20200017, 'Код документа в БД ФО', 'FUId', 'Код документа в БД ФО', 'FUId', 0, 202, 0, 1, '', 0, null) ;

CALL ImportField(20200019, 'Основание', 'Note', 'Основание', 'Note', 0, 202, 0, 0, 'Основание', 0, null) ;

CALL ImportField(20200020, 'Дополнительная информация', 'Note1', 'Дополнительная информация', 'Note1', 0, 202, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(20200021, 'По вопросу', 'Note2', 'По вопросу', 'Note2', 0, 202, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(20200022, 'Источник финансирования', 'NotifyType', 'Источник финансирования', 'NotifyType', 0, 202, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(20200024, 'Вариант', 'Variant', 'Вариант', 'Variant', 0, 202, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(20200025, 'Номер', 'ANumber', 'Номер', 'Number', 0, 202, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(20200027, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 0, 202, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(20200029, 'Причина отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 0, 202, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(20200030, 'Причина отклонения(текст)', 'RejectNote', 'Причина отклонения(текст)', 'RejectCause', 0, 202, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(20200031, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 202, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(20200032, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 202, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(20200035, 'Состояние', 'DocStateName', 'Состояние', 'DocStateName', 0, 202, 0, 0, '', 0, null) ;

CALL ImportField(20200036, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 202, 0, 1, '', 0, null) ;

CALL ImportField(20200037, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 202, 0, 1, '', 0, null) ;

CALL ImportField(20200038, 'Признак зависания', 'DocSuspended', '*Признак зависания', 'DocSuspended', 0, 202, 0, 1, '', 0, null) ;

CALL ImportField(20200039, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 202, 0, 1, '', 0, null) ;

CALL ImportField(20200040, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 0, 202, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(20200041, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LastExtrChange', 0, 202, 0, 1, '', 0, null) ;

CALL ImportField(20200042, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 202, 0, 1, '', 0, null) ;

CALL ImportField(20200043, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 202, 0, 1, '', 0, null) ;

CALL ImportField(20200080, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'AssignmentSource', 0, 202, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(20200089, 'Отнесение к БА, ЛБО', 'Ba_Lbo_Flag', 'Отнесение к БА, ЛБО', 'Ba_Lbo_Flag', 0, 202, 0, 0, 'ПринадлежностьБА_ЛБО', 0, null) ;

CALL ImportField(20200094, 'Тип классфикации (заг.)', 'ClsType', '', ' ', 0, 202, 0, 0, '', 0, null) ;

CALL ImportField(20200096, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 202, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(20200109, 'Индексы данынх (заголовк)', 'ProgIndex', '', ' ', 0, 202, 0, 1, '', 0, null) ;

CALL ImportField(20200120, 'Л/с ФК', 'FacialCode', '', ' ', 0, 202, 0, 1, '', 0, null) ;

CALL ImportField(20200121, '<Не используется>', 'KPPeriod', '', ' ', 0, 202, 0, 1, '', 0, null) ;

CALL ImportField(20201001, 'Квартал4', 'Quarter4', 'Квартал4', 'Quarter4', 0, 202, 1, 0, 'РоспКвартал4', 0, null) ;

CALL ImportField(20201002, 'За год', 'ONYEAR', 'За год', 'ONYEAR', 0, 202, 1, 0, '', 0, null) ;

CALL ImportField(20201004, 'Источниковая классификация', ' ', 'Источниковая классификация', 'IFS_DescriptionCode', 0, 202, 1, 0, '', 0, null) ;

CALL ImportField(20201008, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 0, 202, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(20201009, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 202, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(20201010, 'Счет', 'Acc', 'Счет', 'DestAccountName', 0, 202, 1, 0, '', 0, null) ;

CALL ImportField(20201011, 'Тип классификации', ' ', 'Тип классификации', 'ClsType', 0, 202, 1, 0, '', 0, null) ;

CALL ImportField(20201012, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 0, 202, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(20201014, 'Индекс данных', 'ProgIndex', 'Индекс данных', 'ProgIndex', 0, 202, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(20201044, 'Код записи', 'Id', '*Код записи', 'Id', 0, 202, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(20201045, 'Код записи в БД ФО', 'FUId', 'Код записи в БД ФО', 'FUId', 0, 202, 1, 0, '', 0, null) ;

CALL ImportField(20201046, 'КВСРКлюч', 'Kvsr', 'КВСР(Классификация)', 'DestKvsr', 0, 202, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(20201047, 'КВРКлюч', 'Kvr', 'КВР(Классификация)', 'DestKvr', 0, 202, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(20201048, 'КФСР', 'Kfsr', 'КФСР', 'DestKfsr', 0, 202, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(20201049, 'КЭСР', 'Kesr', 'КЭСР', 'DestKesr', 0, 202, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(20201050, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsr', 0, 202, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(20201051, 'СубКЭСР', 'SubKESR', 'СубКЭСР', 'DestSubKesr', 0, 202, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(20201052, 'Регион', 'RegionCls', 'Регион', 'RegionCls', 0, 202, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, null) ;

CALL ImportField(20201054, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'DestFacialAccCls', 0, 202, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(20201055, 'ЛС в ФК', 'FacialCode', 'ЛС в ФК', 'DestFacialAccClsFacialCode', 0, 202, 1, 0, '', 0, null) ;

CALL ImportField(20201056, 'Ссылка на рс получ.', 'Acc_Ref', 'Ссылка на рс получ.', 'DestAccount', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201057, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 202, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20201058, 'Январь', 'Month01', 'Январь', 'Month01', 0, 202, 1, 0, 'РоспЯнварь', 0, null) ;

CALL ImportField(20201059, 'Февраль', 'Month02', 'Февраль', 'Month02', 0, 202, 1, 0, 'РоспФевраль', 0, null) ;

CALL ImportField(20201060, 'Март', 'Month03', 'Март', 'Month03', 0, 202, 1, 0, 'РоспМарт', 0, null) ;

CALL ImportField(20201061, 'Апрель', 'Month04', 'Апрель', 'Month04', 0, 202, 1, 0, 'РоспАпрель', 0, null) ;

CALL ImportField(20201062, 'Май', 'Month05', 'Май', 'Month05', 0, 202, 1, 0, 'РоспМай', 0, null) ;

CALL ImportField(20201063, 'Июнь', 'Month06', 'Июнь', 'Month06', 0, 202, 1, 0, 'РоспИюнь', 0, null) ;

CALL ImportField(20201064, 'Июль', 'Month07', 'Июль', 'Month07', 0, 202, 1, 0, 'РоспИюль', 0, null) ;

CALL ImportField(20201065, 'Август', 'Month08', 'Август', 'Month08', 0, 202, 1, 0, 'РоспАвгуст', 0, null) ;

CALL ImportField(20201066, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 0, 202, 1, 0, 'РоспСентябрь', 0, null) ;

CALL ImportField(20201067, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 0, 202, 1, 0, 'РоспОктябрь', 0, null) ;

CALL ImportField(20201068, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 0, 202, 1, 0, 'РоспНоябрь', 0, null) ;

CALL ImportField(20201069, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 0, 202, 1, 0, 'РоспДекабрь', 0, null) ;

CALL ImportField(20201070, 'Квартал1', 'Quarter1', 'Квартал1', 'Quarter1', 0, 202, 1, 0, 'РоспКвартал1', 0, null) ;

CALL ImportField(20201071, 'Квартал2', 'Quarter2', 'Квартал2', 'Quarter2', 0, 202, 1, 0, 'РоспКвартал2', 0, null) ;

CALL ImportField(20201072, 'Квартал3', 'Quarter3', 'Квартал3', 'Quarter3', 0, 202, 1, 0, 'РоспКвартал3', 0, null) ;

CALL ImportField(20201074, 'Бюджетная классификация(группа)', 'TreeOwner0', 'Бюджетная классификация(группа)', 'TreeOwner0', 0, 202, 1, 0, '', 0, null) ;

CALL ImportField(20201075, 'Роспись на первый год', 'SummaYear1', 'Роспись на первый год', 'SummaYear1', 0, 202, 1, 0, 'СБРНаПервыйГод', 0, null) ;

CALL ImportField(20201076, 'Роспись на второй год', 'SummaYear2', 'Роспись на второй год', 'SummaYear2', 0, 202, 1, 0, 'СБРНаВторойГод', 0, null) ;

CALL ImportField(20201077, 'Роспись на третий год', 'SummaYear3', 'Роспись на третий год', 'SummaYear3', 0, 202, 1, 0, 'СБРНаТретийГод', 0, null) ;

CALL ImportField(20201078, 'Корреспондирующий ЭКР', 'KESRCorr', 'Корреспондирующий ЭКР', 'KESRCorr', 0, 202, 1, 0, 'КорКЭСР', 0, null) ;

CALL ImportField(20201079, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'AssignmentKind', 0, 202, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(20201090, 'Сумма на квартал', 'CurQuarter', '', ' ', 0, 202, 1, 0, '', 0, null) ;

CALL ImportField(20201091, '1-й месяц квартала', 'CurMonth1', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201092, '2-й месяц квартала', 'CurMonth2', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201093, '3-й месяц квартала', 'CurMonth3', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201097, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201098, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 202, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(20201099, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 202, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(20201100, 'КЦСР(Классификация)', 'KCSRCode', '', 'KCSR', 0, 202, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(20201101, 'КВР(Классификация)', 'KVRCode', '', 'KVR', 0, 202, 1, 0, 'КВР', 0, null) ;

CALL ImportField(20201102, 'КВСР(Классификация)', 'KVSRCode', '', 'KVSR', 0, 202, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(20201103, 'Код цели', 'TargetCls', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201104, 'Тип классфикации (дет.)', 'ClsType', '', ' ', 0, 202, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20201109, '<Не используется>', 'KDCode', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201110, '<Не используется>', 'SubKD', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201111, '<Не используется>', 'IFSCode', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201112, '<Не используется>', 'IFS', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201113, '<Не используется>', 'KD', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201114, '<Не используется>', 'OnYearIncome', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201115, '<Не используется>', 'OnYearCharges', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201116, '<Не используется>', 'On3Year', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201117, '<Не используется>', 'On3YearIncome', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201118, '<Не используется>', 'FundsSource', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201119, '<Не используется>', 'On3YearCharges', '', ' ', 0, 202, 1, 1, '', 0, null) ;

CALL ImportField(20201122, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 0, 202, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(20201123, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 202, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(20201124, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 0, 202, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(20201125, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 0, 202, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(20201126, 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', '', ' ', 0, 202, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(20201127, 'Код расходного обязательства (ключ)', 'PayPromiseCls', '', ' ', 0, 202, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

-- СБР (расходы), Бюджет(1)
CALL ImportField(20210001, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 202, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(20210002, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 1, 202, 0, 0, '', 0, 16646) ;

CALL ImportField(20210010, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 202, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(20210012, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 202, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(20210013, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 202, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(20210015, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 202, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(20210016, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 202, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(20210017, 'Индексы данных', 'ProgIndex', 'ProgIndex', ' ', 1, 202, 0, 1, '', 0, 17493) ;

CALL ImportField(20210020, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 202, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(20210023, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 202, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(20210025, 'Код документа', 'ID', 'Код документа', 'Id', 1, 202, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(20210029, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CryptoStatus', 1, 202, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(20210034, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 202, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(20210040, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'Note', 1, 202, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(20210041, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'Note2', 1, 202, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(20210043, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 1, 202, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(20210044, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 202, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(20210045, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 202, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(20210066, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 202, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(20210082, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderId', 1, 202, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(20210084, 'Отнесение к БА, ЛБО', 'Ba_Lbo_Flag', 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 1, 202, 0, 0, 'ПринадлежностьБА_ЛБО', 0, 17502) ;

CALL ImportField(20210088, 'Число подтверждающих документов по факсу', 'FaxDocCount', 'Число подтверждающих документов по факсу', ' ', 1, 202, 0, 1, 'ЧислоПодтверждающихДокументовПоФаксу', 0, 17497) ;

CALL ImportField(20210089, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 202, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(20211003, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 202, 1, 0, '', 0, null) ;

CALL ImportField(20211004, 'л/с ФК', 'FACIALCODE', 'л/с ФК', 'DestFacialAccClsFacialCode', 1, 202, 1, 0, '', 0, null) ;

CALL ImportField(20211005, 'Главный распорядитель', 'OrgNameAndAcc', 'Главный распорядитель', ' ', 1, 202, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(20211006, 'ИНН(Главный распорядитель)', 'INN', 'ИНН(Главный распорядитель)', 'DestOrgInn', 1, 202, 1, 0, 'ИННОрганизацииДеталь', 0, 16645) ;

CALL ImportField(20211007, 'КПП(Главный распорядитель)', 'INN20', 'КПП(Главный распорядитель)', 'DestOrgKpp', 1, 202, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(20211008, 'Наименование(Главный распорядитель)', 'NAME', 'Наименование(Главный распорядитель)', 'DestOrgNAME', 1, 202, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(20211009, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 202, 1, 0, 'БухОперация', 0, 17451) ;

CALL ImportField(20211011, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 202, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(20211018, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 202, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(20211021, 'КВРКлюч', 'KVR', 'КВР(Классификация)', 'DestKvrKey', 1, 202, 1, 1, 'КВРКлюч', 0, 17414) ;

CALL ImportField(20211022, 'КВСРКлюч', 'KVSR', 'КВСР(Классификация)', 'DestKvsrKey', 1, 202, 1, 1, 'КВСРКлюч', 0, 17412) ;

CALL ImportField(20211024, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 202, 1, 1, '', 0, 17410) ;

CALL ImportField(20211026, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 202, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(20211027, 'Код записи', 'ID', 'Код записи', 'Id', 1, 202, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(20211028, 'ЭКР (получено)', 'KESRCORR', 'ЭКР (получено)', 'KESRCORR', 1, 202, 1, 1, 'КорКЭСР', 0, 17461) ;

CALL ImportField(20211030, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 202, 1, 0, 'КФСР', 0, 17411) ;

CALL ImportField(20211031, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsrKey', 1, 202, 1, 1, 'КЦСРКлюч', 0, 17413) ;

CALL ImportField(20211032, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 202, 1, 0, 'КЭСР', 0, 17415) ;

CALL ImportField(20211033, 'Лицевой счет ГРБС', 'FACIALACC_CLS', 'Лицевой счет ГРБС', 'DestFacialAccCls', 1, 202, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(20211042, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 202, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(20211046, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 202, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17417) ;

CALL ImportField(20211047, 'Август', 'Month08', 'Август', 'Month08', 1, 202, 1, 0, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(20211048, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 202, 1, 0, 'РоспАпрель', 0, 17439) ;

CALL ImportField(20211049, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 202, 1, 0, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(20211050, 'Июль', 'Month07', 'Июль', 'Month07', 1, 202, 1, 0, 'РоспИюль', 0, 17442) ;

CALL ImportField(20211051, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 202, 1, 0, 'РоспИюнь', 0, 17441) ;

CALL ImportField(20211052, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'Quarter1', 1, 202, 1, 0, 'РоспКвартал1', 0, 17421) ;

CALL ImportField(20211053, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'Quarter2', 1, 202, 1, 0, 'РоспКвартал2', 0, 17422) ;

CALL ImportField(20211054, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'Quarter3', 1, 202, 1, 0, 'РоспКвартал3', 0, 17423) ;

CALL ImportField(20211055, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'Quarter4', 1, 202, 1, 0, 'РоспКвартал4', 0, 17424) ;

CALL ImportField(20211056, 'Май', 'Month05', 'Май', 'Month05', 1, 202, 1, 0, 'РоспМай', 0, 17440) ;

CALL ImportField(20211057, 'Март', 'Month03', 'Март', 'Month03', 1, 202, 1, 0, 'РоспМарт', 0, 17438) ;

CALL ImportField(20211058, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 202, 1, 0, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(20211059, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 202, 1, 0, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(20211060, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 202, 1, 0, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(20211061, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 202, 1, 0, 'РоспФевраль', 0, 17437) ;

CALL ImportField(20211062, 'Январь', 'Month01', 'Январь', 'Month01', 1, 202, 1, 0, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(20211063, 'Второй плановый год', 'SUMMAYEAR2', 'Второй плановый год', 'SUMMAYEAR2', 1, 202, 1, 0, 'СБРНаВторойГод', 0, 17458) ;

CALL ImportField(20211064, 'Первый год', 'SUMMAYEAR1', 'Первый год', 'SUMMAYEAR1', 1, 202, 1, 0, 'СБРНаПервыйГод', 0, 17457) ;

CALL ImportField(20211065, 'Третий плановый год', 'SUMMAYEAR3', 'Третий плановый год', 'SUMMAYEAR3', 1, 202, 1, 0, 'СБРНаТретийГод', 0, 17459) ;

CALL ImportField(20211067, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', 'DestSubKesr', 1, 202, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(20211070, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 202, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(20211083, 'Код отправителя записи', 'SenderID', 'Код отправителя записи', 'SenderId', 1, 202, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(20211084, '1-й месяц квартала', 'CurMonth1', '1-й месяц квартала', ' ', 1, 202, 1, 1, '', 0, null) ;

CALL ImportField(20211085, '2-й месяц квартала', 'CurMonth2', '2-й месяц квартала', ' ', 1, 202, 1, 1, '', 0, null) ;

CALL ImportField(20211086, '3-й месяц квартала', 'CurMonth3', '3-й месяц квартала', ' ', 1, 202, 1, 1, '', 0, null) ;

CALL ImportField(20211087, 'Сумма на квартал', 'CurQuarter', 'Сумма на квартал', ' ', 1, 202, 1, 1, '', 0, null) ;

CALL ImportField(20211088, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 202, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(20211090, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 202, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(20211095, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 202, 1, 0, '', 0, null) ;

CALL ImportField(20211096, 'Тип классификации', 'ClsType', 'ТипКлассификации', 'ClsType', 1, 202, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20211098, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 202, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(20211099, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 202, 1, 0, '', 0, 26617) ;

CALL ImportField(20211102, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 202, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(20211103, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 202, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

CALL ImportField(20211104, 'Отдел', 'DepartmentCls', 'Отдел', 'DepartmentCls', 1, 202, 1, 0, 'Отдел', 0, 30005) ;

-- Кассовый план (расходы), УРМ(0)
CALL ImportField(20300015, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 0, 203, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(20300016, 'Код документа', 'Id', 'Код документа', 'Id', 0, 203, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20300017, 'Код документа в БД ФО', 'FUId', 'Код документа в БД ФО', 'FUId', 0, 203, 0, 1, '', 0, null) ;

CALL ImportField(20300019, 'Основание', 'Note', 'Основание', 'Note', 0, 203, 0, 0, 'Основание', 0, null) ;

CALL ImportField(20300020, 'Дополнительная информация', 'Note1', 'Дополнительная информация', 'Note1', 0, 203, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(20300021, 'По вопросу', 'Note2', 'По вопросу', 'Note2', 0, 203, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(20300022, 'Источник финансирования', 'NotifyType', 'Источник финансирования', 'NotifyType', 0, 203, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(20300024, 'Вариант', 'Variant', 'Вариант', 'Variant', 0, 203, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(20300027, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 0, 203, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(20300029, 'Причина отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 0, 203, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(20300031, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 203, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(20300032, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 203, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(20300035, 'Состояние', 'DocStateName', 'Состояние', 'DocStateName', 0, 203, 0, 0, '', 0, null) ;

CALL ImportField(20300036, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 203, 0, 1, '', 0, null) ;

CALL ImportField(20300037, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 203, 0, 1, '', 0, null) ;

CALL ImportField(20300038, 'Признак зависания', 'DocSuspended', '*Признак зависания', 'DocSuspended', 0, 203, 0, 1, '', 0, null) ;

CALL ImportField(20300039, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 203, 0, 1, '', 0, null) ;

CALL ImportField(20300040, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 0, 203, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(20300042, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 203, 0, 1, '', 0, null) ;

CALL ImportField(20300043, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 203, 0, 1, '', 0, null) ;

CALL ImportField(20300079, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'AssignmentSource', 0, 203, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(20300080, 'Период', 'KPPERIOD', '', 'KPPERIOD', 0, 203, 0, 0, 'ПериодКП', 0, null) ;

CALL ImportField(20300108, 'Номер', 'ANumber', 'Номер', 'Number', 0, 203, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(20300113, 'Причина отклонения(текст)', 'RejectNote', 'Причина отклонения(текст)', 'RejectCause', 0, 203, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(20300116, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', 'DestOrgName', 0, 203, 0, 0, '', 0, null) ;

CALL ImportField(20300118, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 203, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(20300119, '<Не используется>', 'Ba_Lbo_Flag', '', ' ', 0, 203, 0, 1, '', 0, null) ;

CALL ImportField(20300120, 'Тип классфикации (заг.)', 'ClsType', '', ' ', 0, 203, 0, 1, '', 0, null) ;

CALL ImportField(20300121, 'Л/с ФК', 'FacialCode', '', ' ', 0, 203, 0, 1, '', 0, null) ;

CALL ImportField(20300123, '<Не используется>', 'ProgIndex', '', ' ', 0, 203, 0, 1, '', 0, null) ;

CALL ImportField(20301001, 'Квартал4', 'Quarter4', 'Квартал4', 'Quarter4', 0, 203, 1, 0, 'РоспКвартал4', 0, null) ;

CALL ImportField(20301002, 'За год', 'ONYEAR', 'За год', 'ONYEAR', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301009, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 203, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(20301014, 'Индекс данных', 'ProgIndex', 'Индекс данных', 'ProgIndex', 0, 203, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(20301044, 'Код записи', 'Id', '*Код записи', 'Id', 0, 203, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(20301045, 'Код записи в БД ФО', 'FUId', 'Код записи в БД ФО', 'FUId', 0, 203, 1, 0, '', 0, null) ;

CALL ImportField(20301052, 'Регион', 'RegionCls', 'Регион', 'RegionCls', 0, 203, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, null) ;

CALL ImportField(20301056, 'Ссылка на рс получ.', 'Acc_ref', 'Ссылка на рс получ.', 'DestAccount', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301057, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 203, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20301058, 'Январь', 'Month01', 'Январь', 'Month01', 0, 203, 1, 0, 'РоспЯнварь', 0, null) ;

CALL ImportField(20301059, 'Февраль', 'Month02', 'Февраль', 'Month02', 0, 203, 1, 0, 'РоспФевраль', 0, null) ;

CALL ImportField(20301060, 'Март', 'Month03', 'Март', 'Month03', 0, 203, 1, 0, 'РоспМарт', 0, null) ;

CALL ImportField(20301061, 'Апрель', 'Month04', 'Апрель', 'Month04', 0, 203, 1, 0, 'РоспАпрель', 0, null) ;

CALL ImportField(20301062, 'Май', 'Month05', 'Май', 'Month05', 0, 203, 1, 0, 'РоспМай', 0, null) ;

CALL ImportField(20301063, 'Июнь', 'Month06', 'Июнь', 'Month06', 0, 203, 1, 0, 'РоспИюнь', 0, null) ;

CALL ImportField(20301064, 'Июль', 'Month07', 'Июль', 'Month07', 0, 203, 1, 0, 'РоспИюль', 0, null) ;

CALL ImportField(20301065, 'Август', 'Month08', 'Август', 'Month08', 0, 203, 1, 0, 'РоспАвгуст', 0, null) ;

CALL ImportField(20301066, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 0, 203, 1, 0, 'РоспСентябрь', 0, null) ;

CALL ImportField(20301067, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 0, 203, 1, 0, 'РоспОктябрь', 0, null) ;

CALL ImportField(20301068, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 0, 203, 1, 0, 'РоспНоябрь', 0, null) ;

CALL ImportField(20301069, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 0, 203, 1, 0, 'РоспДекабрь', 0, null) ;

CALL ImportField(20301070, 'Квартал1', 'Quarter1', 'Квартал1', 'Quarter1', 0, 203, 1, 0, 'РоспКвартал1', 0, null) ;

CALL ImportField(20301071, 'Квартал2', 'Quarter2', 'Квартал2', 'Quarter2', 0, 203, 1, 0, 'РоспКвартал2', 0, null) ;

CALL ImportField(20301072, 'Квартал3', 'Quarter3', 'Квартал3', 'Quarter3', 0, 203, 1, 0, 'РоспКвартал3', 0, null) ;

CALL ImportField(20301073, 'Бюджетная классификация(группа)', 'TreeOwner0', 'Бюджетная классификация(группа)', 'TreeOwner0', 0, 203, 1, 0, '', 0, null) ;

CALL ImportField(20301074, 'Роспись на первый год', 'SummaYear1', 'Роспись на первый год', 'SummaYear1', 0, 203, 1, 0, '', 0, null) ;

CALL ImportField(20301075, 'Роспись на второй год', 'SummaYear2', 'Роспись на второй год', 'SummaYear2', 0, 203, 1, 0, '', 0, null) ;

CALL ImportField(20301076, 'Роспись на третий год', 'SummaYear3', 'Роспись на третий год', 'SummaYear3', 0, 203, 1, 0, '', 0, null) ;

CALL ImportField(20301077, 'Корреспондирующий ЭКР', 'KESRCorr', 'Корреспондирующий ЭКР', 'KESRCorr', 0, 203, 1, 0, '', 0, null) ;

CALL ImportField(20301078, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'AssignmentKind', 0, 203, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(20301081, 'Сумма на квартал', 'CurQuarter', '', ' ', 0, 203, 1, 0, '', 0, null) ;

CALL ImportField(20301082, '1-й месяц квартала', 'CurMonth1', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301083, '2-й месяц квартала', 'CurMonth2', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301084, '3-й месяц квартала', 'CurMonth3', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301085, 'КФСР', 'Kfsr', 'КФСР', 'DestKfsr', 0, 203, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(20301086, 'КЭСР', 'Kesr', 'КЭСР', 'DestKesr', 0, 203, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(20301087, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsr', 0, 203, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(20301088, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'DestFacialAccCls', 0, 203, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(20301089, 'КВСРКлюч', 'Kvsr', 'КВСР(Классификация)', 'DestKvsr', 0, 203, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(20301090, 'КВРКлюч', 'Kvr', 'КВР(Классификация)', 'DestKvr', 0, 203, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(20301091, 'СубКЭСР', 'SubKESR', 'СубКЭСР', 'DestSubKesr', 0, 203, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(20301095, 'Счет', 'Acc', 'Счет', 'DestAccountName', 0, 203, 1, 0, '', 0, null) ;

CALL ImportField(20301099, 'ЛС в ФК', 'FacialCode', 'ЛС в ФК', 'DestFacialAccClsFacialCode', 0, 203, 1, 0, '', 0, null) ;

CALL ImportField(20301100, 'Источник образования средств', 'FundsSource', 'Источник образования средств', 'FUNDSSOURCE', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301117, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 0, 203, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(20301119, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301120, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 203, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(20301121, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 203, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(20301122, 'КЦСР(Классификация)', 'KCSRCode', '', 'KCSR', 0, 203, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(20301123, 'КВР(Классификация)', 'KVRCode', '', 'KVR', 0, 203, 1, 0, 'КВР', 0, null) ;

CALL ImportField(20301124, 'КВСР(Классификация)', 'KVSRCode', '', 'KVSR', 0, 203, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(20301125, '<Не используется>', 'SubKD', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301126, '<Не используется>', 'IFSCode', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301127, '<Не используется>', 'IFS', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301128, '<Не используется>', 'KD', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301130, 'Код цели', 'TargetCls', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301131, '<Не используется>', 'OnYearIncome', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301132, '<Не используется>', 'OnYearCharges', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301133, '<Не используется>', 'On3Year', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301134, '<Не используется>', 'On3YearIncome', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301135, '<Не используется>', 'On3YearCharges', '', ' ', 0, 203, 1, 1, '', 0, null) ;

CALL ImportField(20301137, 'Тип классфикации (дет.)', 'ClsType', '', ' ', 0, 203, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20301138, '<Не используется>', 'KDCode', '', ' ', 0, 203, 1, 0, '', 0, null) ;

CALL ImportField(20301140, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 0, 203, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(20301141, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 0, 203, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(20301142, 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', '', ' ', 0, 203, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(20301143, 'Код расходного обязательства (ключ)', 'PayPromiseCls', '', ' ', 0, 203, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

CALL ImportField(20301144, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 0, 203, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(20301145, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 0, 203, 1, 0, 'КодСубсидии', 0, null) ;

-- Кассовый план (расходы), Бюджет(1)
CALL ImportField(20310001, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 203, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(20310002, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 1, 203, 0, 0, '', 0, 16646) ;

CALL ImportField(20310010, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 203, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(20310012, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 203, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(20310013, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 203, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(20310015, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 203, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(20310016, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 203, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(20310017, 'Индексы данных', 'ProgIndex', 'ProgIndex', ' ', 1, 203, 0, 1, '', 0, 17493) ;

CALL ImportField(20310020, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 203, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(20310023, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 203, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(20310025, 'Код документа', 'ID', 'Код документа', 'Id', 1, 203, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(20310029, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CryptoStatus', 1, 203, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(20310034, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 203, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(20310040, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'Note', 1, 203, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(20310041, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'Note2', 1, 203, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(20310043, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 1, 203, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(20310044, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 203, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(20310045, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 203, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(20310066, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 203, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(20310073, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderId', 1, 203, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(20310074, 'Период', 'KPPERIOD', 'Период', 'KPPeriod', 1, 203, 0, 1, 'ПериодКП', 0, 24700) ;

CALL ImportField(20310079, 'Число подтверждающих документов по факсу', 'FaxDocCount', 'Число подтверждающих документов по факсу', ' ', 1, 203, 0, 1, 'ЧислоПодтверждающихДокументовПоФаксу', 0, 17497) ;

CALL ImportField(20310080, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 203, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(20311003, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 203, 1, 0, '', 0, null) ;

CALL ImportField(20311004, 'л/с ФК', 'FACIALCODE', 'л/с ФК', 'DestFacialAccClsFacialCode', 1, 203, 1, 0, '', 0, null) ;

CALL ImportField(20311005, 'Главный распорядитель', 'OrgNameAndAcc', 'Главный распорядитель', ' ', 1, 203, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(20311006, 'ИНН(Главный распорядитель)', 'INN', 'ИНН(Главный распорядитель)', 'DestOrgInn', 1, 203, 1, 0, 'ИННОрганизацииДеталь', 0, 16645) ;

CALL ImportField(20311007, 'КПП(Главный распорядитель)', 'INN20', 'КПП(Главный распорядитель)', 'DestOrgKpp', 1, 203, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(20311008, 'Наименование(Главный распорядитель)', 'NAME', 'Наименование(Главный распорядитель)', 'DestOrgNAME', 1, 203, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(20311011, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 203, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(20311018, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 203, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(20311021, 'КВРКлюч', 'KVR', 'КВР(Классификация)', 'DestKvrKey', 1, 203, 1, 1, 'КВРКлюч', 0, 17414) ;

CALL ImportField(20311022, 'КВСРКлюч', 'KVSR', 'КВСР(Классификация)', 'DestKvsrKey', 1, 203, 1, 1, 'КВСРКлюч', 0, 17412) ;

CALL ImportField(20311024, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 203, 1, 1, '', 0, 17410) ;

CALL ImportField(20311026, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 203, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(20311027, 'Код записи', 'ID', 'Код записи', 'Id', 1, 203, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(20311030, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 203, 1, 0, 'КФСР', 0, 17411) ;

CALL ImportField(20311031, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsrKey', 1, 203, 1, 1, 'КЦСРКлюч', 0, 17413) ;

CALL ImportField(20311032, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 203, 1, 0, 'КЭСР', 0, 17415) ;

CALL ImportField(20311033, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 203, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(20311042, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 203, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(20311046, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 203, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17417) ;

CALL ImportField(20311047, 'Август', 'Month08', 'Август', 'Month08', 1, 203, 1, 0, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(20311048, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 203, 1, 0, 'РоспАпрель', 0, 17439) ;

CALL ImportField(20311049, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 203, 1, 0, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(20311050, 'Июль', 'Month07', 'Июль', 'Month07', 1, 203, 1, 0, 'РоспИюль', 0, 17442) ;

CALL ImportField(20311051, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 203, 1, 0, 'РоспИюнь', 0, 17441) ;

CALL ImportField(20311052, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'Quarter1', 1, 203, 1, 0, 'РоспКвартал1', 0, 17421) ;

CALL ImportField(20311053, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'Quarter2', 1, 203, 1, 0, 'РоспКвартал2', 0, 17422) ;

CALL ImportField(20311054, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'Quarter3', 1, 203, 1, 0, 'РоспКвартал3', 0, 17423) ;

CALL ImportField(20311055, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'Quarter4', 1, 203, 1, 0, 'РоспКвартал4', 0, 17424) ;

CALL ImportField(20311056, 'Май', 'Month05', 'Май', 'Month05', 1, 203, 1, 0, 'РоспМай', 0, 17440) ;

CALL ImportField(20311057, 'Март', 'Month03', 'Март', 'Month03', 1, 203, 1, 0, 'РоспМарт', 0, 17438) ;

CALL ImportField(20311061, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 203, 1, 0, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(20311062, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 203, 1, 0, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(20311063, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 203, 1, 0, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(20311064, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 203, 1, 0, 'РоспФевраль', 0, 17437) ;

CALL ImportField(20311065, 'Январь', 'Month01', 'Январь', 'Month01', 1, 203, 1, 0, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(20311067, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', 'DestSubKesr', 1, 203, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(20311070, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 203, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(20311074, 'Код отправителя записи', 'SenderID', 'Код отправителя записи', 'SenderId', 1, 203, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(20311075, '1-й месяц квартала', 'CurMonth1', '1-й месяц квартала', ' ', 1, 203, 1, 1, '', 0, null) ;

CALL ImportField(20311076, '2-й месяц квартала', 'CurMonth2', '2-й месяц квартала', ' ', 1, 203, 1, 1, '', 0, null) ;

CALL ImportField(20311077, '3-й месяц квартала', 'CurMonth3', '3-й месяц квартала', ' ', 1, 203, 1, 1, '', 0, null) ;

CALL ImportField(20311078, 'Сумма на квартал', 'CurQuarter', 'Сумма на квартал', ' ', 1, 203, 1, 1, '', 0, null) ;

CALL ImportField(20311079, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 203, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(20311081, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 203, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(20311086, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 203, 1, 0, '', 0, null) ;

CALL ImportField(20311087, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 203, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20311088, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 203, 1, 0, '', 0, 26617) ;

CALL ImportField(20311091, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 1, 203, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(20311093, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 203, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(20311094, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 203, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

-- Сведения БУ, АУ, УРМ(0)
CALL ImportField(20400015, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 0, 204, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(20400016, 'Код документа', 'Id', 'Код документа', 'Id', 0, 204, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20400017, 'Код документа в БД ФО', 'FUId', 'Код документа в БД ФО', 'FUId', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400019, 'Основание', 'Note', 'Основание', 'Note', 0, 204, 0, 0, 'Основание', 0, null) ;

CALL ImportField(20400020, 'Дополнительная информация', 'Note1', 'Дополнительная информация', 'Note1', 0, 204, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(20400021, 'По вопросу', 'Note2', 'По вопросу', 'Note2', 0, 204, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(20400022, 'Источник финансирования', 'NotifyType', 'Источник финансирования', 'NotifyType', 0, 204, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(20400024, 'Вариант', 'Variant', 'Вариант', 'Variant', 0, 204, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(20400025, 'Номер', 'ANumber', 'Номер', 'Number', 0, 204, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(20400027, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 0, 204, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(20400029, 'Причина отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 0, 204, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(20400030, 'Причина отклонения(текст)', 'RejectNote', 'Причина отклонения(текст)', 'RejectCause', 0, 204, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(20400031, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 204, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(20400032, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 204, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(20400035, 'Состояние', 'DocStateName', 'Состояние', 'DocStateName', 0, 204, 0, 0, '', 0, null) ;

CALL ImportField(20400036, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400037, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400038, 'Признак зависания', 'DocSuspended', '*Признак зависания', 'DocSuspended', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400039, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400040, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 0, 204, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(20400041, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LastExtrChange', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400042, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400043, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400079, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'AssignmentSource', 0, 204, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(20400085, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 204, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(20400086, 'Л/с ФК', 'FacialCode', '', ' ', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400090, 'Индексы данных (заг.)', 'ProgIndex', '', ' ', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400091, '<Не используется>', 'Ba_Lbo_Flag', '', ' ', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400092, '<Не используется>', 'KPPeriod', '', ' ', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20400093, 'Тип классфикации (заг.)', 'ClsType', '', ' ', 0, 204, 0, 1, '', 0, null) ;

CALL ImportField(20401001, 'Квартал4', 'Quarter4', 'Квартал4', 'Quarter4', 0, 204, 1, 0, 'РоспКвартал4', 0, null) ;

CALL ImportField(20401002, 'За год', 'ONYEAR', 'За год', 'ONYEAR', 0, 204, 1, 0, '', 0, null) ;

CALL ImportField(20401004, 'Источниковая классификация', ' ', 'Источниковая классификация', 'IFS_DescriptionCode', 0, 204, 1, 0, '', 0, null) ;

CALL ImportField(20401008, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 0, 204, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(20401009, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 204, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(20401010, 'Счет', 'Acc', 'Счет', 'DestAccountName', 0, 204, 1, 0, '', 0, null) ;

CALL ImportField(20401011, 'Тип классификации', ' ', 'Тип классификации', 'ClsType', 0, 204, 1, 0, '', 0, null) ;

CALL ImportField(20401012, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 0, 204, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(20401014, 'Индекс данных', 'ProgIndex', 'Индекс данных', 'ProgIndex', 0, 204, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(20401044, 'Код записи', 'Id', '*Код записи', 'Id', 0, 204, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(20401045, 'Код записи в БД ФО', 'FUId', 'Код записи в БД ФО', 'FUId', 0, 204, 1, 0, '', 0, null) ;

CALL ImportField(20401046, 'КВСРКлюч', 'Kvsr', 'КВСР(Классификация)', 'DestKvsr', 0, 204, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(20401047, 'КВРКлюч', 'Kvr', 'КВР(Классификация)', 'DestKvr', 0, 204, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(20401048, 'КФСР', 'Kfsr', 'КФСР', 'DestKfsr', 0, 204, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(20401049, 'КЭСР', 'Kesr', 'КЭСР', 'DestKesr', 0, 204, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(20401050, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsr', 0, 204, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(20401051, 'СубКЭСР', 'SubKESR', 'СубКЭСР', 'DestSubKesr', 0, 204, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(20401052, 'Регион', 'RegionCls', 'Регион', 'RegionCls', 0, 204, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, null) ;

CALL ImportField(20401054, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'DestFacialAccCls', 0, 204, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(20401055, 'ЛС в ФК', 'FacialCode', 'ЛС в ФК', 'DestFacialAccClsFacialCode', 0, 204, 1, 0, '', 0, null) ;

CALL ImportField(20401056, 'Ссылка на рс получ.', 'Acc_Ref', 'Ссылка на рс получ.', 'DestAccount', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401057, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 204, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20401058, 'Январь', 'Month01', 'Январь', 'Month01', 0, 204, 1, 0, 'РоспЯнварь', 0, null) ;

CALL ImportField(20401059, 'Февраль', 'Month02', 'Февраль', 'Month02', 0, 204, 1, 0, 'РоспФевраль', 0, null) ;

CALL ImportField(20401060, 'Март', 'Month03', 'Март', 'Month03', 0, 204, 1, 0, 'РоспМарт', 0, null) ;

CALL ImportField(20401061, 'Апрель', 'Month04', 'Апрель', 'Month04', 0, 204, 1, 0, 'РоспАпрель', 0, null) ;

CALL ImportField(20401062, 'Май', 'Month05', 'Май', 'Month05', 0, 204, 1, 0, 'РоспМай', 0, null) ;

CALL ImportField(20401063, 'Июнь', 'Month06', 'Июнь', 'Month06', 0, 204, 1, 0, 'РоспИюнь', 0, null) ;

CALL ImportField(20401064, 'Июль', 'Month07', 'Июль', 'Month07', 0, 204, 1, 0, 'РоспИюль', 0, null) ;

CALL ImportField(20401065, 'Август', 'Month08', 'Август', 'Month08', 0, 204, 1, 0, 'РоспАвгуст', 0, null) ;

CALL ImportField(20401066, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 0, 204, 1, 0, 'РоспСентябрь', 0, null) ;

CALL ImportField(20401067, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 0, 204, 1, 0, 'РоспОктябрь', 0, null) ;

CALL ImportField(20401068, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 0, 204, 1, 0, 'РоспНоябрь', 0, null) ;

CALL ImportField(20401069, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 0, 204, 1, 0, 'РоспДекабрь', 0, null) ;

CALL ImportField(20401070, 'Квартал1', 'Quarter1', 'Квартал1', 'Quarter1', 0, 204, 1, 0, 'РоспКвартал1', 0, null) ;

CALL ImportField(20401071, 'Квартал2', 'Quarter2', 'Квартал2', 'Quarter2', 0, 204, 1, 0, 'РоспКвартал2', 0, null) ;

CALL ImportField(20401072, 'Квартал3', 'Quarter3', 'Квартал3', 'Quarter3', 0, 204, 1, 0, 'РоспКвартал3', 0, null) ;

CALL ImportField(20401073, 'Бюджетная классификация(группа)', 'TreeOwner0', 'Бюджетная классификация(группа)', 'TreeOwner0', 0, 204, 1, 0, '', 0, null) ;

CALL ImportField(20401074, 'Роспись на первый год', 'SummaYear1', 'Роспись на первый год', 'SummaYear1', 0, 204, 1, 0, 'РоспНаПервыйГод', 0, null) ;

CALL ImportField(20401075, 'Роспись на второй год', 'SummaYear2', 'Роспись на второй год', 'SummaYear2', 0, 204, 1, 0, 'РоспНаВторойГод', 0, null) ;

CALL ImportField(20401076, 'Роспись на третий год', 'SummaYear3', 'Роспись на третий год', 'SummaYear3', 0, 204, 1, 0, 'РоспНаТретийГод', 0, null) ;

CALL ImportField(20401077, 'Корреспондирующий ЭКР', 'KESRCorr', 'Корреспондирующий ЭКР', 'KESRCorr', 0, 204, 1, 0, 'КорКЭСР', 0, null) ;

CALL ImportField(20401078, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'AssignmentKind', 0, 204, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(20401084, 'Источник образования средств', 'FundsSource', 'Источник образования средств', 'FUNDSSOURCE', 0, 204, 1, 0, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(20401086, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401087, '<Не испльзуются>', 'CurQuarter', '', ' ', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401088, '<Не испльзуются>', 'CurMonth1', '', ' ', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401089, '<Не испльзуются>', 'CurMonth2', '', ' ', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401104, 'Код целевых средств(Ключ)', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 204, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(20401105, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 204, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(20401106, 'КЦСР(Классификация)', 'KCSRCode', '', 'KCSR', 0, 204, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(20401107, 'КВР(Классификация)', 'KVRCode', '', 'KVR', 0, 204, 1, 0, 'КВР', 0, null) ;

CALL ImportField(20401108, 'КВСР(Классификация)', 'KVSRCode', '', 'KVSR', 0, 204, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(20401109, 'Суб.код дохода', 'SUBKD', 'Суб.код дохода', 'SubKd', 0, 204, 1, 0, 'СубКД', 0, null) ;

CALL ImportField(20401110, 'КД (Ключ)', 'KD', '', 'KD', 0, 204, 1, 1, 'КДКлюч', 0, null) ;

CALL ImportField(20401111, 'КД', 'KDCode', '', 'KDValue', 0, 204, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(20401116, 'Код цели', 'TargetCls', 'Код цели', ' ', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401117, '<Не испльзуются>', 'CurMonth3', '', ' ', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401118, 'Постпление за год', 'OnYearIncome', '', ' ', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401119, 'Погашение за год', 'OnYearCharges', '', ' ', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401120, 'Сумма за 3 года', 'On3Year', '', ' ', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401121, 'Постпулеия за 3 года', 'On3YearIncome', '', ' ', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401122, 'Погашения за 3 года', 'On3YearCharges', '', ' ', 0, 204, 1, 1, '', 0, null) ;

CALL ImportField(20401124, 'Тип классфикации (дет.)', 'ClsType', '', ' ', 0, 204, 1, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(20401125, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 0, 204, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(20401126, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 204, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(20401127, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 0, 204, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(20401128, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 0, 204, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(20401129, 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', '', ' ', 0, 204, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(20401130, 'Код расходного обязательства (ключ)', 'PayPromiseCls', '', ' ', 0, 204, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

-- Сведения БУ, АУ, Бюджет(1)
CALL ImportField(20410001, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 204, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(20410010, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 204, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(20410012, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 204, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(20410013, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 204, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(20410015, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 204, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(20410016, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 204, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(20410017, 'Индексы данных', 'ProgIndex', 'ProgIndex', ' ', 1, 204, 0, 1, '', 0, 17493) ;

CALL ImportField(20410020, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 204, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(20410023, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 204, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(20410025, 'Код документа', 'ID', 'Код документа', 'Id', 1, 204, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(20410029, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CryptoStatus', 1, 204, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(20410034, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 204, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(20410040, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'Note', 1, 204, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(20410041, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'Note2', 1, 204, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(20410043, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 1, 204, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(20410044, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 204, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(20410045, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 204, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(20410066, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 204, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(20410081, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderId', 1, 204, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(20410083, 'Число подтверждающих документов по факсу', 'FaxDocCount', 'Число подтверждающих документов по факсу', ' ', 1, 204, 0, 1, 'ЧислоПодтверждающихДокументовПоФаксу', 0, 17497) ;

CALL ImportField(20410084, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 204, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(20410085, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 204, 0, 0, '', 0, null) ;

CALL ImportField(20411003, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 204, 1, 0, '', 0, null) ;

CALL ImportField(20411004, 'л/с ФК', 'FACIALCODE', 'л/с ФК', 'DestFacialAccClsFacialCode', 1, 204, 1, 0, '', 0, null) ;

CALL ImportField(20411006, 'ИНН(Организация)', 'INN', 'ИНН(Получатель)', 'DestOrgInn', 1, 204, 1, 0, 'ИННОрганизацииДеталь', 0, 16645) ;

CALL ImportField(20411007, 'КПП(Организация)', 'INN20', 'КПП(Получатель)', 'DestOrgKpp', 1, 204, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(20411008, 'Наименование(Организация)', 'NAME', 'Наименование(Получатель)', 'DestOrgNAME', 1, 204, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(20411009, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 204, 1, 1, 'БухОперация', 0, 17451) ;

CALL ImportField(20411011, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 204, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(20411018, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 204, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(20411019, 'Источник образования средств', 'FundsSource', 'Источник образования средств', 'FUNDSSOURCE', 1, 204, 1, 0, 'ИсточникОбразованияСредств', 0, 17456) ;

CALL ImportField(20411021, 'КВРКлюч', 'KVR', 'КВР(Классификация)', 'DestKvrKey', 1, 204, 1, 1, 'КВРКлюч', 0, 17414) ;

CALL ImportField(20411022, 'КВСРКлюч', 'KVSR', 'КВСР(Классификация)', 'DestKvsrKey', 1, 204, 1, 1, 'КВСРКлюч', 0, 17412) ;

CALL ImportField(20411024, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 204, 1, 1, '', 0, 17410) ;

CALL ImportField(20411026, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 204, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(20411027, 'Код записи', 'ID', 'Код записи', 'Id', 1, 204, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(20411028, 'ЭКР (получено)', 'KESRCORR', 'ЭКР (получено)', 'KESRCORR', 1, 204, 1, 1, 'КорКЭСР', 0, 17461) ;

CALL ImportField(20411030, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 204, 1, 0, 'КФСР', 0, 17411) ;

CALL ImportField(20411031, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsrKey', 1, 204, 1, 1, 'КЦСРКлюч', 0, 17413) ;

CALL ImportField(20411032, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 204, 1, 0, 'КЭСР', 0, 17415) ;

CALL ImportField(20411033, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 204, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(20411042, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 204, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(20411046, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 204, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17417) ;

CALL ImportField(20411047, 'Август', 'Month08', 'Август', 'Month08', 1, 204, 1, 0, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(20411048, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 204, 1, 0, 'РоспАпрель', 0, 17439) ;

CALL ImportField(20411049, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 204, 1, 0, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(20411050, 'Июль', 'Month07', 'Июль', 'Month07', 1, 204, 1, 0, 'РоспИюль', 0, 17442) ;

CALL ImportField(20411051, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 204, 1, 0, 'РоспИюнь', 0, 17441) ;

CALL ImportField(20411052, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'Quarter1', 1, 204, 1, 0, 'РоспКвартал1', 0, 17421) ;

CALL ImportField(20411053, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'Quarter2', 1, 204, 1, 0, 'РоспКвартал2', 0, 17422) ;

CALL ImportField(20411054, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'Quarter3', 1, 204, 1, 0, 'РоспКвартал3', 0, 17423) ;

CALL ImportField(20411055, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'Quarter4', 1, 204, 1, 0, 'РоспКвартал4', 0, 17424) ;

CALL ImportField(20411056, 'Май', 'Month05', 'Май', 'Month05', 1, 204, 1, 0, 'РоспМай', 0, 17440) ;

CALL ImportField(20411057, 'Март', 'Month03', 'Март', 'Month03', 1, 204, 1, 0, 'РоспМарт', 0, 17438) ;

CALL ImportField(20411058, 'Второй плановый год', 'SUMMAYEAR2', 'Второй плановый год', 'SUMMAYEAR2', 1, 204, 1, 0, 'РоспНаВторойГод', 0, 17458) ;

CALL ImportField(20411059, 'Первый год', 'SUMMAYEAR1', 'Первый год', 'SUMMAYEAR1', 1, 204, 1, 0, 'РоспНаПервыйГод', 0, 17457) ;

CALL ImportField(20411060, 'Третий плановый год', 'SUMMAYEAR3', 'Третий плановый год', 'SUMMAYEAR3', 1, 204, 1, 0, 'РоспНаТретийГод', 0, 17459) ;

CALL ImportField(20411061, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 204, 1, 0, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(20411062, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 204, 1, 0, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(20411063, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 204, 1, 0, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(20411064, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 204, 1, 0, 'РоспФевраль', 0, 17437) ;

CALL ImportField(20411065, 'Январь', 'Month01', 'Январь', 'Month01', 1, 204, 1, 0, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(20411067, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', 'DestSubKesr', 1, 204, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(20411070, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 204, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(20411082, 'Код отправителя записи', 'SenderID', 'Код отправителя записи', 'SenderId', 1, 204, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(20411083, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 204, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(20411085, 'Код целевых средств(Ключ)', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 204, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(20411087, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 204, 1, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(20411090, 'Вид дохода(Классификация)', 'DescriptionCode', 'Вид дохода(Классификация)', 'DescriptionCode', 1, 204, 1, 0, '', 0, 16831) ;

CALL ImportField(20411091, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFS', 1, 204, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(20411092, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', 'IFS_DescriptionCode', 1, 204, 1, 0, '', 0, 17050) ;

CALL ImportField(20411093, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', 'IFS_KESR', 1, 204, 1, 0, '', 0, 17054) ;

CALL ImportField(20411096, 'КД', 'KD', 'КД', 'KD', 1, 204, 1, 1, 'КДКлюч', 0, 25270) ;

CALL ImportField(20411097, 'ЭКД(Классификация)', 'KDKESR', 'ЭКД(Классификация)', 'KDKESR', 1, 204, 1, 0, '', 0, 16835) ;

CALL ImportField(20411101, 'Подвид дохода(Классификация)', 'ProgramCode', 'Подвид дохода(Классификация)', 'ProgramCode', 1, 204, 1, 0, '', 0, 16834) ;

CALL ImportField(20411102, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 204, 1, 0, '', 0, null) ;

CALL ImportField(20411103, 'Суб. код дохода', 'SubKD', 'Суб. код дохода', 'SUBKD', 1, 204, 1, 1, 'СубКД', 0, 25271) ;

CALL ImportField(20411104, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 204, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(20411106, 'Код дохода', 'KDValue', 'Код дохода', 'KDValue', 1, 204, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(20411107, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 204, 1, 0, '', 0, 26617) ;

CALL ImportField(20411111, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 204, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(20411112, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 204, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

CALL ImportField(20411113, 'Прежний код субсидии', 'SubsidyClsOld', '', ' ', 1, 204, 1, 1, 'ПрежнийКодСубсидииКлюч', 0, 27836) ;

-- Бюджет, Бюджет(1)
CALL ImportField(20510001, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 205, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(20510011, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 205, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(20510013, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 205, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(20510014, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 205, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(20510016, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 205, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(20510017, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 205, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(20510018, 'Индексы данных', 'ProgIndex', 'ProgIndex', ' ', 1, 205, 0, 1, '', 0, 17493) ;

CALL ImportField(20510021, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 205, 0, 1, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(20510024, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 205, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(20510026, 'Код документа', 'ID', 'Код документа', 'Id', 1, 205, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(20510030, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CryptoStatus', 1, 205, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(20510035, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 205, 0, 1, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(20510040, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 205, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20510041, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'Note', 1, 205, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(20510042, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'Note2', 1, 205, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(20510044, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 1, 205, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(20510045, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 205, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(20510046, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 205, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(20510064, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 205, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(20510071, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderId', 1, 205, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(20510084, 'Число подтверждающих документов по факсу', 'FaxDocCount', 'Число подтверждающих документов по факсу', ' ', 1, 205, 0, 1, 'ЧислоПодтверждающихДокументовПоФаксу', 0, 17497) ;

CALL ImportField(20510085, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 205, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(20511007, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 205, 1, 1, 'БухОперация', 0, 17451) ;

CALL ImportField(20511008, 'Второй плановый год', 'SUMMAYEAR2', 'Второй плановый год', 'SUMMAYEAR2', 1, 205, 1, 0, 'БюджетНаВторойГод', 0, 17458) ;

CALL ImportField(20511009, 'Первый год', 'SUMMAYEAR1', 'Первый год', 'SUMMAYEAR1', 1, 205, 1, 0, 'БюджетНаПервыйГод', 0, 17457) ;

CALL ImportField(20511010, 'Третий плановый год', 'SUMMAYEAR3', 'Третий плановый год', 'SUMMAYEAR3', 1, 205, 1, 0, 'БюджетНаТретийГод', 0, 17459) ;

CALL ImportField(20511012, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 205, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(20511019, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 205, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(20511022, 'КВРКлюч', 'KVR', 'КВР(Классификация)', 'DestKvrKey', 1, 205, 1, 1, 'КВРКлюч', 0, 17414) ;

CALL ImportField(20511023, 'КВСРКлюч', 'KVSR', 'КВСР(Классификация)', 'DestKvsrKey', 1, 205, 1, 1, 'КВСРКлюч', 0, 17412) ;

CALL ImportField(20511025, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 205, 1, 1, '', 0, 17410) ;

CALL ImportField(20511027, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 205, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(20511028, 'Код записи', 'ID', 'Код записи', 'Id', 1, 205, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(20511029, 'ЭКР (получено)', 'KESRCORR', 'ЭКР (получено)', 'KESRCORR', 1, 205, 1, 1, 'КорКЭСР', 0, 17461) ;

CALL ImportField(20511031, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 205, 1, 0, 'КФСР', 0, 17411) ;

CALL ImportField(20511032, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsrKey', 1, 205, 1, 1, 'КЦСРКлюч', 0, 17413) ;

CALL ImportField(20511033, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 205, 1, 0, 'КЭСР', 0, 17415) ;

CALL ImportField(20511034, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 205, 1, 1, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(20511039, 'Организация', 'Org_ref', 'Организация', 'Org_Ref_Det', 1, 205, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(20511043, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 205, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(20511047, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 205, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17417) ;

CALL ImportField(20511048, 'Август', 'Month08', 'Август', 'Month08', 1, 205, 1, 1, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(20511049, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 205, 1, 1, 'РоспАпрель', 0, 17439) ;

CALL ImportField(20511050, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 205, 1, 1, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(20511051, 'Июль', 'Month07', 'Июль', 'Month07', 1, 205, 1, 1, 'РоспИюль', 0, 17442) ;

CALL ImportField(20511052, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 205, 1, 1, 'РоспИюнь', 0, 17441) ;

CALL ImportField(20511053, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'Quarter1', 1, 205, 1, 1, 'РоспКвартал1', 0, 17421) ;

CALL ImportField(20511054, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'Quarter2', 1, 205, 1, 1, 'РоспКвартал2', 0, 17422) ;

CALL ImportField(20511055, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'Quarter3', 1, 205, 1, 1, 'РоспКвартал3', 0, 17423) ;

CALL ImportField(20511056, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'Quarter4', 1, 205, 1, 1, 'РоспКвартал4', 0, 17424) ;

CALL ImportField(20511057, 'Май', 'Month05', 'Май', 'Month05', 1, 205, 1, 1, 'РоспМай', 0, 17440) ;

CALL ImportField(20511058, 'Март', 'Month03', 'Март', 'Month03', 1, 205, 1, 1, 'РоспМарт', 0, 17438) ;

CALL ImportField(20511059, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 205, 1, 1, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(20511060, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 205, 1, 1, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(20511061, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 205, 1, 1, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(20511062, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 205, 1, 1, 'РоспФевраль', 0, 17437) ;

CALL ImportField(20511063, 'Январь', 'Month01', 'Январь', 'Month01', 1, 205, 1, 1, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(20511065, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', 'DestSubKesr', 1, 205, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(20511068, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 205, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(20511072, 'Код отправителя записи', 'SenderID', 'Код отправителя записи', 'SenderId', 1, 205, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(20511073, 'Вид дохода(Классификация)', 'DescriptionCode', 'Вид дохода(Классификация)', ' ', 1, 205, 1, 0, '', 0, 16831) ;

CALL ImportField(20511074, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFS', 1, 205, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(20511075, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 205, 1, 0, '', 0, 17050) ;

CALL ImportField(20511076, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 205, 1, 0, '', 0, 17054) ;

CALL ImportField(20511078, 'КД', 'KD', 'КД', 'KD', 1, 205, 1, 1, 'КДКлюч', 0, 25270) ;

CALL ImportField(20511079, 'ЭКД(Классификация)', 'KDKESR', 'ЭКД(Классификация)', ' ', 1, 205, 1, 0, '', 0, 16835) ;

CALL ImportField(20511081, 'Подвид дохода(Классификация)', 'ProgramCode', 'Подвид дохода(Классификация)', ' ', 1, 205, 1, 0, '', 0, 16834) ;

CALL ImportField(20511082, 'Суб. код дохода', 'SubKD', 'Суб. код дохода', 'SubKD', 1, 205, 1, 0, 'СубКД', 0, 25271) ;

CALL ImportField(20511083, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 205, 1, 0, '', 0, null) ;

CALL ImportField(20511084, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 205, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(20511086, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 205, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(20511094, 'Тип классификации', 'ClsType', 'Тип класссификации', 'ClsType', 1, 205, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20511095, 'Код дохода', 'KDValue', 'Код дохода', 'KDValue', 1, 205, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(20511098, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 205, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(20511099, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 205, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

CALL ImportField(20511100, 'Отдел', 'DepartmentCls', 'Отдел', 'DepartmentCls', 1, 205, 1, 0, 'Отдел', 0, 30005) ;

-- ПОФ по ПБС (расходы), УРМ(0)
CALL ImportField(20600001, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 0, 206, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(20600002, 'Код документа', 'Id', 'Код документа', 'Id', 0, 206, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20600003, 'Код документа в БД ФО', 'FUId', 'Код документа в БД ФО', 'FUId', 0, 206, 0, 1, '', 0, null) ;

CALL ImportField(20600005, 'Основание', 'Note', 'Основание', 'Note', 0, 206, 0, 0, 'Основание', 0, null) ;

CALL ImportField(20600006, 'Дополнительная информация', 'Note1', 'Дополнительная информация', 'Note1', 0, 206, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(20600007, 'По вопросу', 'Note2', 'По вопросу', 'Note2', 0, 206, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(20600008, 'Источник финансирования', 'NotifyType', 'Источник финансирования', 'NotifyType', 0, 206, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(20600010, 'Вариант', 'Variant', 'Вариант', 'Variant', 0, 206, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(20600011, 'Номер', 'ANumber', 'Номер', 'Number', 0, 206, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(20600013, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 0, 206, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(20600014, 'Главный распорядитель(ссылка)', 'OrgRef', 'Главный распорядитель(ссылка)', 'DestOrgRef', 0, 206, 0, 1, 'ОрганизацияЗаголовок', 0, null) ;

CALL ImportField(20600015, 'Причина отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 0, 206, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(20600016, 'Причина отклонения(текст)', 'RejectNote', 'Причина отклонения(текст)', 'RejectCause', 0, 206, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(20600017, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 206, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(20600018, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 206, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(20600019, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', 'DestOrgName', 0, 206, 0, 0, '', 0, null) ;

CALL ImportField(20600021, 'Состояние', 'DocStateName', 'Состояние', 'DocStateName', 0, 206, 0, 0, '', 0, null) ;

CALL ImportField(20600022, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 206, 0, 1, '', 0, null) ;

CALL ImportField(20600023, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 206, 0, 1, '', 0, null) ;

CALL ImportField(20600024, 'Признак зависания', 'DocSuspended', '*Признак зависания', 'DocSuspended', 0, 206, 0, 1, '', 0, null) ;

CALL ImportField(20600025, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 206, 0, 1, '', 0, null) ;

CALL ImportField(20600026, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 0, 206, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(20600027, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LastExtrChange', 0, 206, 0, 1, '', 0, null) ;

CALL ImportField(20600028, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 206, 0, 1, '', 0, null) ;

CALL ImportField(20600029, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 206, 0, 1, '', 0, null) ;

CALL ImportField(20600030, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'AssignmentSource', 0, 206, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(20600088, 'Период', 'KPPERIOD', 'Период', 'KPPERIOD', 0, 206, 0, 0, 'ПериодКП', 0, null) ;

CALL ImportField(20600093, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 206, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(20600094, 'Тип классфикации (заг.)', 'ClsType', '', ' ', 0, 206, 0, 0, '', 0, null) ;

CALL ImportField(20600095, '<Не используется>', 'Ba_Lbo_Flag', '', ' ', 0, 206, 0, 1, '', 0, null) ;

CALL ImportField(20600096, 'Л/с ФК', 'FacialCode', '', ' ', 0, 206, 0, 1, '', 0, null) ;

CALL ImportField(20600109, 'Индексы данынх (заголовк)', 'ProgIndex', '', ' ', 0, 206, 0, 1, '', 0, null) ;

CALL ImportField(20601031, 'Квартал4', 'Quarter4', 'Квартал4', 'Quarter4', 0, 206, 1, 0, 'РоспКвартал4', 0, null) ;

CALL ImportField(20601032, 'За год', 'ONYEAR', 'За год', 'ONYEAR', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601034, 'Источниковая классификация', ' ', 'Источниковая классификация', 'IFS_DescriptionCode', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601039, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 206, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(20601040, 'Счет', 'Acc', 'Счет', 'DestAccountName', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601041, 'Тип классификации', ' ', 'Тип классификации', 'ClsType', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601042, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 0, 206, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(20601044, 'Индекс данных', 'ProgIndex', 'Индекс данных', 'ProgIndex', 0, 206, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(20601045, 'Код записи', 'Id', '*Код записи', 'Id', 0, 206, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(20601046, 'Код записи в БД ФО', 'FUId', 'Код записи в БД ФО', 'FUId', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601047, 'КВСРКлюч', 'Kvsr', 'КВСР(Классификация)', 'DestKvsr', 0, 206, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(20601048, 'КВРКлюч', 'Kvr', 'КВР(Классификация)', 'DestKvr', 0, 206, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(20601049, 'КФСР', 'Kfsr', 'КФСР', 'DestKfsr', 0, 206, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(20601050, 'КЭСР', 'Kesr', 'КЭСР', 'DestKesr', 0, 206, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(20601051, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsrKey', 0, 206, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(20601052, 'СубКЭСР', 'SubKESR', 'СубКЭСР', 'DestSubKesr', 0, 206, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(20601053, 'Регион', 'RegionCls', 'Регион', 'RegionCls', 0, 206, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, null) ;

CALL ImportField(20601055, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'DestFacialAccCls', 0, 206, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(20601056, 'ЛС в ФК', 'FacialCode', 'ЛС в ФК', 'DestFacialAccClsFacialCode', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601057, 'Ссылка на рс получ.', 'Acc_Ref', 'Ссылка на рс получ.', 'DestAccount', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601058, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 206, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20601059, 'Январь', 'Month01', 'Январь', 'Month01', 0, 206, 1, 0, 'РоспЯнварь', 0, null) ;

CALL ImportField(20601060, 'Февраль', 'Month02', 'Февраль', 'Month02', 0, 206, 1, 0, 'РоспФевраль', 0, null) ;

CALL ImportField(20601061, 'Март', 'Month03', 'Март', 'Month03', 0, 206, 1, 0, 'РоспМарт', 0, null) ;

CALL ImportField(20601062, 'Апрель', 'Month04', 'Апрель', 'Month04', 0, 206, 1, 0, 'РоспАпрель', 0, null) ;

CALL ImportField(20601063, 'Май', 'Month05', 'Май', 'Month05', 0, 206, 1, 0, 'РоспМай', 0, null) ;

CALL ImportField(20601064, 'Июнь', 'Month06', 'Июнь', 'Month06', 0, 206, 1, 0, 'РоспИюнь', 0, null) ;

CALL ImportField(20601065, 'Июль', 'Month07', 'Июль', 'Month07', 0, 206, 1, 0, 'РоспИюль', 0, null) ;

CALL ImportField(20601066, 'Август', 'Month08', 'Август', 'Month08', 0, 206, 1, 0, 'РоспАвгуст', 0, null) ;

CALL ImportField(20601067, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 0, 206, 1, 0, 'РоспСентябрь', 0, null) ;

CALL ImportField(20601068, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 0, 206, 1, 0, 'РоспОктябрь', 0, null) ;

CALL ImportField(20601069, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 0, 206, 1, 0, 'РоспНоябрь', 0, null) ;

CALL ImportField(20601070, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 0, 206, 1, 0, 'РоспДекабрь', 0, null) ;

CALL ImportField(20601071, 'Квартал1', 'Quarter1', 'Квартал1', 'Quarter1', 0, 206, 1, 0, 'РоспКвартал1', 0, null) ;

CALL ImportField(20601072, 'Квартал2', 'Quarter2', 'Квартал2', 'Quarter2', 0, 206, 1, 0, 'РоспКвартал2', 0, null) ;

CALL ImportField(20601073, 'Квартал3', 'Quarter3', 'Квартал3', 'Quarter3', 0, 206, 1, 0, 'РоспКвартал3', 0, null) ;

CALL ImportField(20601074, 'Бюджетная классификация(группа)', 'TreeOwner0', 'Бюджетная классификация(группа)', 'TreeOwner0', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601075, 'Роспись на первый год', 'SummaYear1', 'Роспись на первый год', 'SummaYear1', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601076, 'Роспись на второй год', 'SummaYear2', 'Роспись на второй год', 'SummaYear2', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601077, 'Роспись на третий год', 'SummaYear3', 'Роспись на третий год', 'SummaYear3', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601078, 'Корреспондирующий ЭКР', 'KESRCorr', 'Корреспондирующий ЭКР', 'KESRCorr', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601079, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'AssignmentKind', 0, 206, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(20601089, 'Сумма на квартал', 'CurQuarter', '', ' ', 0, 206, 1, 0, '', 0, null) ;

CALL ImportField(20601090, '1-й месяц квартала', 'CurMonth1', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601091, '2-й месяц квартала', 'CurMonth2', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601092, '3-й месяц квартала', 'CurMonth3', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601094, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601095, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 206, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(20601096, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 206, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(20601097, 'КЦСР(Классификация)', 'KCSRCode', '', 'KCSR', 0, 206, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(20601098, 'КВР(Классификация)', 'KVRCode', '', 'KVR', 0, 206, 1, 0, 'КВР', 0, null) ;

CALL ImportField(20601099, 'КВСР(Классификация)', 'KVSRCode', '', 'KVSR', 0, 206, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(20601103, 'Код цели', 'TargetCls', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601104, 'Тип классфикации (дет.)', 'ClsType', '', ' ', 0, 206, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20601109, '<Не используется>', 'KDCode', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601110, '<Не используется>', 'SubKD', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601111, '<Не используется>', 'IFSCode', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601112, '<Не используется>', 'IFS', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601113, '<Не используется>', 'KD', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601114, '<Не используется>', 'OnYearIncome', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601115, '<Не используется>', 'OnYearCharges', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601116, '<Не используется>', 'On3Year', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601117, '<Не используется>', 'On3YearIncome', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601118, '<Не используется>', 'FundsSource', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601119, '<Не используется>', 'On3YearCharges', '', ' ', 0, 206, 1, 1, '', 0, null) ;

CALL ImportField(20601120, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 0, 206, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(20601121, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 206, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(20601122, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 0, 206, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(20601123, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 0, 206, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(20601124, 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', '', ' ', 0, 206, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(20601125, 'Код расходного обязательства (ключ)', 'PayPromiseCls', '', ' ', 0, 206, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

CALL ImportField(20601126, 'Получатель субсидии(трансферта)', 'TransfertOrg_Name', '', ' ', 0, 206, 1, 0, '', 0, null) ;

-- ПОФ по ПБС (расходы), Бюджет(1)
CALL ImportField(20610001, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 206, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(20610002, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 1, 206, 0, 0, '', 0, 16646) ;

CALL ImportField(20610011, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 206, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(20610013, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 206, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(20610014, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 206, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(20610016, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 206, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(20610017, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 206, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(20610018, 'Индексы данных', 'ProgIndex', 'ProgIndex', ' ', 1, 206, 0, 1, '', 0, 17493) ;

CALL ImportField(20610021, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 206, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(20610024, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 206, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(20610026, 'Код документа', 'ID', 'Код документа', 'Id', 1, 206, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(20610030, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CryptoStatus', 1, 206, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(20610035, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 206, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(20610040, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 206, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20610041, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'Note', 1, 206, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(20610042, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'Note2', 1, 206, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(20610044, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 1, 206, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(20610045, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 206, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(20610046, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 206, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(20610067, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 206, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(20610081, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderId', 1, 206, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(20610087, 'Число подтверждающих документов по факсу', 'FaxDocCount', 'Число подтверждающих документов по факсу', ' ', 1, 206, 0, 1, 'ЧислоПодтверждающихДокументовПоФаксу', 0, 17497) ;

CALL ImportField(20610088, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 206, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(20611003, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 206, 1, 0, '', 0, null) ;

CALL ImportField(20611004, 'л/с ФК', 'FACIALCODE', 'л/с ФК', 'DestFacialAccClsFacialCode', 1, 206, 1, 0, '', 0, null) ;

CALL ImportField(20611005, 'Получатель', 'OrgNameAndAcc', 'Получатель', ' ', 1, 206, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(20611006, 'ИНН(Получатель)', 'INN', 'ИНН(Получатель)', 'DestOrgInn', 1, 206, 1, 0, 'ИННОрганизацииДеталь', 0, 16645) ;

CALL ImportField(20611007, 'КПП(Получатель)', 'INN20', 'КПП(Получатель)', 'DestOrgKpp', 1, 206, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(20611009, 'Наименование(Получатель)', 'NAME', 'Наименование(Получатель)', 'DestOrgNAME', 1, 206, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(20611010, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 206, 1, 1, 'БухОперация', 0, 17451) ;

CALL ImportField(20611012, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 206, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(20611019, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 206, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(20611022, 'КВРКлюч', 'KVR', 'КВР(Классификация)', 'DestKvrKey', 1, 206, 1, 1, 'КВРКлюч', 0, 17414) ;

CALL ImportField(20611023, 'КВСРКлюч', 'KVSR', 'КВСР(Классификация)', 'DestKvsrKey', 1, 206, 1, 1, 'КВСРКлюч', 0, 17412) ;

CALL ImportField(20611025, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 206, 1, 1, '', 0, 17410) ;

CALL ImportField(20611027, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 206, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(20611028, 'Код записи', 'ID', 'Код записи', 'Id', 1, 206, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(20611031, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 206, 1, 0, 'КФСР', 0, 17411) ;

CALL ImportField(20611032, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsrKey', 1, 206, 1, 1, 'КЦСРКлюч', 0, 17413) ;

CALL ImportField(20611033, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 206, 1, 0, 'КЭСР', 0, 17415) ;

CALL ImportField(20611034, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 206, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(20611043, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 206, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(20611047, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 206, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17417) ;

CALL ImportField(20611048, 'Август', 'Month08', 'Август', 'Month08', 1, 206, 1, 0, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(20611049, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 206, 1, 0, 'РоспАпрель', 0, 17439) ;

CALL ImportField(20611050, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 206, 1, 0, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(20611051, 'Июль', 'Month07', 'Июль', 'Month07', 1, 206, 1, 0, 'РоспИюль', 0, 17442) ;

CALL ImportField(20611052, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 206, 1, 0, 'РоспИюнь', 0, 17441) ;

CALL ImportField(20611053, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'Quarter1', 1, 206, 1, 0, 'РоспКвартал1', 0, 17421) ;

CALL ImportField(20611054, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'Quarter2', 1, 206, 1, 0, 'РоспКвартал2', 0, 17422) ;

CALL ImportField(20611055, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'Quarter3', 1, 206, 1, 0, 'РоспКвартал3', 0, 17423) ;

CALL ImportField(20611056, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'Quarter4', 1, 206, 1, 0, 'РоспКвартал4', 0, 17424) ;

CALL ImportField(20611057, 'Май', 'Month05', 'Май', 'Month05', 1, 206, 1, 0, 'РоспМай', 0, 17440) ;

CALL ImportField(20611058, 'Март', 'Month03', 'Март', 'Month03', 1, 206, 1, 0, 'РоспМарт', 0, 17438) ;

CALL ImportField(20611062, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 206, 1, 0, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(20611063, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 206, 1, 0, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(20611064, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 206, 1, 0, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(20611065, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 206, 1, 0, 'РоспФевраль', 0, 17437) ;

CALL ImportField(20611066, 'Январь', 'Month01', 'Январь', 'Month01', 1, 206, 1, 0, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(20611068, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', 'DestSubKesr', 1, 206, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(20611071, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 206, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(20611082, 'Код отправителя записи', 'SenderID', 'Код отправителя записи', 'SenderId', 1, 206, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(20611083, '1-й месяц квартала', 'CurMonth1', '1-й месяц квартала', ' ', 1, 206, 1, 1, '', 0, null) ;

CALL ImportField(20611084, '2-й месяц квартала', 'CurMonth2', '2-й месяц квартала', ' ', 1, 206, 1, 1, '', 0, null) ;

CALL ImportField(20611085, '3-й месяц квартала', 'CurMonth3', '3-й месяц квартала', ' ', 1, 206, 1, 1, '', 0, null) ;

CALL ImportField(20611086, 'Сумма на квартал', 'CurQuarter', 'Сумма на квартал', ' ', 1, 206, 1, 1, '', 0, null) ;

CALL ImportField(20611087, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 206, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(20611089, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 206, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(20611094, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 206, 1, 0, '', 0, null) ;

CALL ImportField(20611095, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 206, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20611096, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 206, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(20611098, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 206, 1, 0, '', 0, 26617) ;

CALL ImportField(20611101, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 206, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(20611102, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 206, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

CALL ImportField(20611103, 'Получатель субсидии(трансферта)', 'TransfertOrg_Name', '', ' ', 1, 206, 1, 0, '', 0, 16646) ;

CALL ImportField(20611104, 'Получатель субсидии(трансферта)', 'TransfertOrg_Ref', '', 'TransfertOrg_Ref', 1, 206, 1, 1, 'ОргПолучСубсидии', 0, 29463) ;

-- Помесячный кассовый план, УРМ(0)
CALL ImportField(20700077, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 0, 207, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(20700078, 'Код документа', 'Id', 'Код документа', 'Id', 0, 207, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20700079, 'Код документа в БД ФО', 'FUId', 'Код документа в БД ФО', 'FUId', 0, 207, 0, 1, '', 0, null) ;

CALL ImportField(20700081, 'Основание', 'Note', 'Основание', 'Note', 0, 207, 0, 0, 'Основание', 0, null) ;

CALL ImportField(20700082, 'Дополнительная информация', 'Note1', 'Дополнительная информация', 'Note1', 0, 207, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(20700083, 'По вопросу', 'Note2', 'По вопросу', 'Note2', 0, 207, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(20700084, 'Источник финансирования', 'NotifyType', 'Источник финансирования', 'NotifyType', 0, 207, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(20700086, 'Вариант', 'Variant', 'Вариант', 'Variant', 0, 207, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(20700087, 'Номер', 'ANumber', 'Номер', 'Number', 0, 207, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(20700089, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 0, 207, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(20700090, 'Главный распорядитель(ссылка)', 'ORGREF', 'Главный распорядитель(ссылка)', 'DestOrgRef', 0, 207, 0, 0, 'ОрганизацияЗаголовок', 0, null) ;

CALL ImportField(20700091, 'Причина отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 0, 207, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(20700092, 'Причина отклонения(текст)', 'RejectNote', 'Причина отклонения(текст)', 'RejectCause', 0, 207, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(20700093, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 207, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(20700094, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 207, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(20700095, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', 'DestOrgName', 0, 207, 0, 0, '', 0, null) ;

CALL ImportField(20700097, 'Состояние', 'DocStateName', 'Состояние', 'DocStateName', 0, 207, 0, 0, '', 0, null) ;

CALL ImportField(20700098, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 207, 0, 1, '', 0, null) ;

CALL ImportField(20700099, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 207, 0, 1, '', 0, null) ;

CALL ImportField(20700100, 'Признак зависания', 'DocSuspended', '*Признак зависания', 'DocSuspended', 0, 207, 0, 1, '', 0, null) ;

CALL ImportField(20700101, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 207, 0, 1, '', 0, null) ;

CALL ImportField(20700102, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 0, 207, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(20700103, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LastExtrChange', 0, 207, 0, 1, '', 0, null) ;

CALL ImportField(20700104, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 207, 0, 1, '', 0, null) ;

CALL ImportField(20700105, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 207, 0, 1, '', 0, null) ;

CALL ImportField(20700106, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'AssignmentSource', 0, 207, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(20700123, '<Не используется>', 'ProgIndex', '', ' ', 0, 207, 0, 1, '', 0, null) ;

CALL ImportField(20700158, 'Период', 'KPPERIOD', 'Период', 'KPPERIOD', 0, 207, 0, 0, 'ПериодКП', 0, null) ;

CALL ImportField(20700160, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 207, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(20700162, '<Не используется>', 'Ba_Lbo_Flag', '', ' ', 0, 207, 0, 1, '', 0, null) ;

CALL ImportField(20700163, 'Тип классфикации (заг.)', 'ClsType', '', ' ', 0, 207, 0, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(20700165, 'Л/c ФК', 'FacialCode', '', ' ', 0, 207, 0, 1, '', 0, null) ;

CALL ImportField(20701089, '<Не испльзуются>', 'CurMonth2', '', ' ', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701107, 'Квартал4', 'Quarter4', 'Квартал4', 'Quarter4', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701108, 'За год', 'ONYEAR', 'За год', 'ONYEAR', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701110, 'Источниковая классификация', ' ', 'Источниковая классификация', 'IFS_DescriptionCode', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701115, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 207, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(20701116, 'Счет', 'Acc', 'Счет', 'DestAccountName', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701117, 'Тип классификации', ' ', 'Тип классификации', 'ClsType', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701118, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 0, 207, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(20701120, 'Индекс данных', 'ProgIndex', 'Индекс данных', 'ProgIndex', 0, 207, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(20701121, 'Код записи', 'Id', '*Код записи', 'Id', 0, 207, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(20701122, 'Код записи в БД ФО', 'FUId', 'Код записи в БД ФО', 'FUId', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701123, 'КВСРКлюч', 'KVSR', 'КВСР(Классификация)', 'DestKvsr', 0, 207, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(20701124, 'КВРКлюч', 'KVR', 'КВР(Классификация)', 'DestKvr', 0, 207, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(20701125, 'КФСР', 'KFSR', 'КФСР', 'DestKfsr', 0, 207, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(20701126, 'КЭСР', 'KESR', 'КЭСР', 'DestKesr', 0, 207, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(20701127, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsr', 0, 207, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(20701128, 'СубКЭСР', 'SUBKESR', 'СубКЭСР', 'DestSubKesr', 0, 207, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(20701129, 'Регион', 'RegionCls', 'Регион', 'RegionCls', 0, 207, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, null) ;

CALL ImportField(20701131, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 0, 207, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(20701132, 'ЛС в ФК', 'FACIALCODE', 'ЛС в ФК', 'DestFacialAccClsFacialCode', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701133, 'Ссылка на рс получ.', 'Acc_Ref', 'Ссылка на рс получ.', 'DestAccount', 0, 207, 1, 1, '', 0, null) ;

CALL ImportField(20701134, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 207, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20701135, 'Январь', 'Month01', 'Январь', 'Month01', 0, 207, 1, 0, 'РоспЯнварь', 0, null) ;

CALL ImportField(20701136, 'Февраль', 'Month02', 'Февраль', 'Month02', 0, 207, 1, 0, 'РоспФевраль', 0, null) ;

CALL ImportField(20701137, 'Март', 'Month03', 'Март', 'Month03', 0, 207, 1, 0, 'РоспМарт', 0, null) ;

CALL ImportField(20701138, 'Апрель', 'Month04', 'Апрель', 'Month04', 0, 207, 1, 0, 'РоспАпрель', 0, null) ;

CALL ImportField(20701139, 'Май', 'Month05', 'Май', 'Month05', 0, 207, 1, 0, 'РоспМай', 0, null) ;

CALL ImportField(20701140, 'Июнь', 'Month06', 'Июнь', 'Month06', 0, 207, 1, 0, 'РоспИюнь', 0, null) ;

CALL ImportField(20701141, 'Июль', 'Month07', 'Июль', 'Month07', 0, 207, 1, 0, 'РоспИюль', 0, null) ;

CALL ImportField(20701142, 'Август', 'Month08', 'Август', 'Month08', 0, 207, 1, 0, 'РоспАвгуст', 0, null) ;

CALL ImportField(20701143, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 0, 207, 1, 0, 'РоспСентябрь', 0, null) ;

CALL ImportField(20701144, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 0, 207, 1, 0, 'РоспОктябрь', 0, null) ;

CALL ImportField(20701145, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 0, 207, 1, 0, 'РоспНоябрь', 0, null) ;

CALL ImportField(20701146, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 0, 207, 1, 0, 'РоспДекабрь', 0, null) ;

CALL ImportField(20701147, 'Квартал1', 'Quarter1', 'Квартал1', 'Quarter1', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701148, 'Квартал2', 'Quarter2', 'Квартал2', 'Quarter2', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701149, 'Квартал3', 'Quarter3', 'Квартал3', 'Quarter3', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701150, 'Бюджетная классификация(группа)', 'TreeOwner0', 'Бюджетная классификация(группа)', 'TreeOwner0', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701151, 'Роспись на первый год', 'SummaYear1', 'Роспись на первый год', 'SummaYear1', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701152, 'Роспись на второй год', 'SummaYear2', 'Роспись на второй год', 'SummaYear2', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701153, 'Роспись на третий год', 'SummaYear3', 'Роспись на третий год', 'SummaYear3', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701154, 'Корреспондирующий ЭКР', 'KESRCorr', 'Корреспондирующий ЭКР', 'KESRCorr', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701155, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'AssignmentKind', 0, 207, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(20701159, 'Сумма на месяц', 'CurMonth1', '', ' ', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701161, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 207, 1, 1, '', 0, null) ;

CALL ImportField(20701167, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 207, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(20701168, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 207, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(20701169, 'КЦСР(Классификация)', 'KCSRCode', '', 'KCSR', 0, 207, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(20701170, 'КВР(Классификация)', 'KVRCode', '', 'KVR', 0, 207, 1, 0, 'КВР', 0, null) ;

CALL ImportField(20701171, 'КВСР(Классификация)', 'KVSRCode', '', 'KVSR', 0, 207, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(20701172, '<Не используется>', 'KDCode', '', ' ', 0, 207, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(20701173, '<Не используется>', 'SubKD', '', ' ', 0, 207, 1, 0, 'СубКД', 0, null) ;

CALL ImportField(20701185, '<Не используется>', 'KD', '', ' ', 0, 207, 1, 0, 'КДКлюч', 0, null) ;

CALL ImportField(20701186, 'Код цели', 'TargetCls', '', ' ', 0, 207, 1, 1, '', 0, null) ;

CALL ImportField(20701187, '<Не используется>', 'OnYearIncome', '', ' ', 0, 207, 1, 1, '', 0, null) ;

CALL ImportField(20701188, '<Не используется>', 'On3Year', '', ' ', 0, 207, 1, 1, '', 0, null) ;

CALL ImportField(20701189, '<Не используется>', 'On3YearCharges', '', ' ', 0, 207, 1, 1, '', 0, null) ;

CALL ImportField(20701190, '<Не используется>', 'On3YearIncome', '', ' ', 0, 207, 1, 1, '', 0, null) ;

CALL ImportField(20701192, '<Не используется>', 'OnYearCharges', '', ' ', 0, 207, 1, 1, '', 0, null) ;

CALL ImportField(20701195, 'Тип классфикации (дет.)', 'ClsType', '', ' ', 0, 207, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20701196, '<Не испльзуются>', 'CurQuarter', '', ' ', 0, 207, 1, 1, '', 0, null) ;

CALL ImportField(20701197, '<Не испльзуются>', 'CurMonth3', '', ' ', 0, 207, 1, 0, '', 0, null) ;

CALL ImportField(20701198, '<Скртыое поле>', 'FundsSource', '', ' ', 0, 207, 1, 1, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(20701199, 'Код сметы записи', 'StimateID', 'Код сметы записи', 'StimateID', 0, 207, 1, 1, 'КодСметыЗаписи', 0, null) ;

CALL ImportField(20701200, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 0, 207, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(20701201, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 0, 207, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(20701202, 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', '', ' ', 0, 207, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(20701203, 'Код расходного обязательства (ключ)', 'PayPromiseCls', '', ' ', 0, 207, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

CALL ImportField(20701204, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 0, 207, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(20701205, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 0, 207, 1, 0, 'КодСубсидии', 0, null) ;

-- Помесячный кассовый план, Бюджет(1)
CALL ImportField(20710001, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 207, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(20710002, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 1, 207, 0, 0, '', 0, 16646) ;

CALL ImportField(20710011, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 207, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(20710013, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 207, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(20710014, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 207, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(20710016, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 207, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(20710017, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 207, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(20710021, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 207, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(20710024, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 207, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(20710026, 'Код документа', 'ID', 'Код документа', 'Id', 1, 207, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(20710030, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CryptoStatus', 1, 207, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(20710035, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 207, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(20710040, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 207, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20710041, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'Note', 1, 207, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(20710042, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'Note2', 1, 207, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(20710044, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 1, 207, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(20710045, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 207, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(20710046, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 207, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(20710067, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 207, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(20710075, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderId', 1, 207, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(20710156, 'Период', 'KPPERIOD', 'Период', 'KPPERIOD', 1, 207, 0, 0, 'ПериодКП', 0, 24700) ;

CALL ImportField(20710157, 'Число подтверждающих документов по факсу', 'FaxDocCount', 'Число подтверждающих документов по факсу', ' ', 1, 207, 0, 1, 'ЧислоПодтверждающихДокументовПоФаксу', 0, 17497) ;

CALL ImportField(20710159, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 207, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(20711003, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 207, 1, 0, '', 0, null) ;

CALL ImportField(20711004, 'л/с ФК', 'FACIALCODE', 'л/с ФК', 'DestFacialAccClsFacialCode', 1, 207, 1, 0, '', 0, null) ;

CALL ImportField(20711006, 'ИНН(Организация)', 'INN', 'ИНН(Получатель)', 'DestOrgInn', 1, 207, 1, 0, 'ИННОрганизацииДеталь', 0, 16645) ;

CALL ImportField(20711007, 'КПП(Организация)', 'INN20', 'КПП(Получатель)', 'DestOrgKpp', 1, 207, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(20711009, 'Наименование(Организация)', 'NAME', 'Наименование(Получатель)', 'DestOrgNAME', 1, 207, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(20711010, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 207, 1, 1, 'БухОперация', 0, 17451) ;

CALL ImportField(20711012, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 207, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(20711019, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 207, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(20711020, 'Источник образования средств', 'FundsSource', 'Источник образования средств', 'FUNDSSOURCE', 1, 207, 1, 1, 'ИсточникОбразованияСредств', 0, 17456) ;

CALL ImportField(20711022, 'КВРКлюч', 'KVR', 'КВР(Классификация)', 'DestKvrKey', 1, 207, 1, 1, 'КВРКлюч', 0, 17414) ;

CALL ImportField(20711023, 'КВСРКлюч', 'KVSR', 'КВСР(Классификация)', 'DestKvsrKey', 1, 207, 1, 1, 'КВСРКлюч', 0, 17412) ;

CALL ImportField(20711025, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 207, 1, 1, '', 0, 17410) ;

CALL ImportField(20711027, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 207, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(20711028, 'Код записи', 'ID', 'Код записи', 'Id', 1, 207, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(20711031, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 207, 1, 0, 'КФСР', 0, 17411) ;

CALL ImportField(20711032, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsrKey', 1, 207, 1, 1, 'КЦСРКлюч', 0, 17413) ;

CALL ImportField(20711033, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 207, 1, 0, 'КЭСР', 0, 17415) ;

CALL ImportField(20711034, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 207, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(20711043, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 207, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(20711047, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 207, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17417) ;

CALL ImportField(20711048, 'Август', 'Month08', 'Август', 'Month08', 1, 207, 1, 0, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(20711049, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 207, 1, 0, 'РоспАпрель', 0, 17439) ;

CALL ImportField(20711050, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 207, 1, 0, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(20711051, 'Июль', 'Month07', 'Июль', 'Month07', 1, 207, 1, 0, 'РоспИюль', 0, 17442) ;

CALL ImportField(20711052, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 207, 1, 0, 'РоспИюнь', 0, 17441) ;

CALL ImportField(20711057, 'Май', 'Month05', 'Май', 'Month05', 1, 207, 1, 0, 'РоспМай', 0, 17440) ;

CALL ImportField(20711058, 'Март', 'Month03', 'Март', 'Month03', 1, 207, 1, 0, 'РоспМарт', 0, 17438) ;

CALL ImportField(20711062, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 207, 1, 0, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(20711063, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 207, 1, 0, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(20711064, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 207, 1, 0, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(20711065, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 207, 1, 0, 'РоспФевраль', 0, 17437) ;

CALL ImportField(20711066, 'Январь', 'Month01', 'Январь', 'Month01', 1, 207, 1, 0, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(20711068, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', 'DestSubKesr', 1, 207, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(20711071, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 207, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(20711076, 'Код отправителя записи', 'SenderID', 'Код отправителя записи', 'SenderId', 1, 207, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(20711077, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 207, 1, 1, 'ТипКлассификации', 0, 17453) ;

CALL ImportField(20711078, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFS', 1, 207, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(20711079, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', 'IFS_DescriptionCode', 1, 207, 1, 0, '', 0, 17050) ;

CALL ImportField(20711080, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', 'IFS_KESR', 1, 207, 1, 0, '', 0, 17054) ;

CALL ImportField(20711082, 'Сумма на месяц', 'CurMonth1', 'Сумма на месяц', ' ', 1, 207, 1, 0, '', 0, null) ;

CALL ImportField(20711083, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 207, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(20711160, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 207, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(20711166, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 207, 1, 0, '', 0, null) ;

CALL ImportField(20711167, 'Вид дохода(Классификация)', 'DescriptionCode', 'Вид дохода(Классификация)', 'DescriptionCode', 1, 207, 1, 0, '', 0, 16831) ;

CALL ImportField(20711168, 'ЭКД(Классификация)', 'KDKESR', 'ЭКД(Классификация)', 'KDKESR', 1, 207, 1, 0, '', 0, 16835) ;

CALL ImportField(20711170, 'Подвид дохода(Классификация)', 'ProgramCode', 'Подвид дохода(Классификация)', 'ProgramCode', 1, 207, 1, 0, '', 0, 16834) ;

CALL ImportField(20711171, 'КД', 'KD', 'КД', 'KD', 1, 207, 1, 1, 'КДКлюч', 0, 25270) ;

CALL ImportField(20711172, 'Суб. код дохода', 'SubKD', 'Суб. код дохода', 'SUBKD', 1, 207, 1, 0, 'СубКД', 0, 25271) ;

CALL ImportField(20711173, 'Номер БО', 'StimateId', '', 'StimateId', 1, 207, 1, 1, 'КодСметыЗаписи', 0, 17448) ;

CALL ImportField(20711174, 'Код дохода', 'KDValue', 'Код дохода', 'KDValue', 1, 207, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(20711175, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 207, 1, 0, '', 0, 26617) ;

CALL ImportField(20711178, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 1, 207, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(20711180, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 207, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(20711181, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 207, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

-- Помесячные ПОФ по ПБС, УРМ(0)
CALL ImportField(20800077, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 0, 208, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(20800078, 'Код документа', 'Id', 'Код документа', 'Id', 0, 208, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20800079, 'Код документа в БД ФО', 'FUId', 'Код документа в БД ФО', 'FUId', 0, 208, 0, 1, '', 0, null) ;

CALL ImportField(20800081, 'Основание', 'Note', 'Основание', 'Note', 0, 208, 0, 0, 'Основание', 0, null) ;

CALL ImportField(20800082, 'Дополнительная информация', 'Note1', 'Дополнительная информация', 'Note1', 0, 208, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(20800083, 'По вопросу', 'Note2', 'По вопросу', 'Note2', 0, 208, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(20800084, 'Источник финансирования', 'NotifyType', 'Источник финансирования', 'NotifyType', 0, 208, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(20800086, 'Вариант', 'Variant', 'Вариант', 'Variant', 0, 208, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(20800087, 'Номер', 'ANumber', 'Номер', 'Number', 0, 208, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(20800089, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 0, 208, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(20800090, 'Главный распорядитель(ссылка)', 'OrgRef', 'Главный распорядитель(ссылка)', 'DestOrgRef', 0, 208, 0, 0, 'ОрганизацияЗаголовок', 0, null) ;

CALL ImportField(20800091, 'Причина отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 0, 208, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(20800092, 'Причина отклонения(текст)', 'RejectNote', 'Причина отклонения(текст)', 'RejectCause', 0, 208, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(20800093, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 208, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(20800094, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 208, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(20800095, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', 'DestOrgName', 0, 208, 0, 0, '', 0, null) ;

CALL ImportField(20800097, 'Состояние', 'DocStateName', 'Состояние', 'DocStateName', 0, 208, 0, 0, '', 0, null) ;

CALL ImportField(20800098, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 208, 0, 1, '', 0, null) ;

CALL ImportField(20800099, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 208, 0, 1, '', 0, null) ;

CALL ImportField(20800100, 'Признак зависания', 'DocSuspended', '*Признак зависания', 'DocSuspended', 0, 208, 0, 1, '', 0, null) ;

CALL ImportField(20800101, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 208, 0, 1, '', 0, null) ;

CALL ImportField(20800102, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 0, 208, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(20800103, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LastExtrChange', 0, 208, 0, 1, '', 0, null) ;

CALL ImportField(20800104, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 208, 0, 1, '', 0, null) ;

CALL ImportField(20800105, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 208, 0, 1, '', 0, null) ;

CALL ImportField(20800106, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'AssignmentSource', 0, 208, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(20800123, '<Не используется>', 'ProgIndex', '', ' ', 0, 208, 0, 1, '', 0, null) ;

CALL ImportField(20800158, 'Период', 'KPPERIOD', 'Период', 'KPPERIOD', 0, 208, 0, 0, 'ПериодКП', 0, null) ;

CALL ImportField(20800160, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 208, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(20800162, '<Не используется>', 'Ba_Lbo_Flag', '', ' ', 0, 208, 0, 1, '', 0, null) ;

CALL ImportField(20800163, 'Тип классфикации (заг.)', 'ClsType', '', ' ', 0, 208, 0, 0, '', 0, null) ;

CALL ImportField(20800165, 'Л/c ФК', 'FacialCode', '', ' ', 0, 208, 0, 1, '', 0, null) ;

CALL ImportField(20801089, '<Не испльзуются>', 'CurMonth2', '', ' ', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801107, 'Квартал4', 'Quarter4', 'Квартал4', 'Quarter4', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801108, 'За год', 'ONYEAR', 'За год', 'ONYEAR', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801110, 'Источниковая классификация', ' ', 'Источниковая классификация', 'IFS_DescriptionCode', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801115, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 208, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(20801116, 'Счет', 'Acc', 'Счет', 'DestAccountName', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801117, 'Тип классификации', ' ', 'Тип классификации', 'ClsType', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801118, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 0, 208, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(20801120, 'Индекс данных', 'ProgIndex', 'Индекс данных', 'ProgIndex', 0, 208, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(20801121, 'Код записи', 'Id', '*Код записи', 'Id', 0, 208, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(20801122, 'Код записи в БД ФО', 'FUId', 'Код записи в БД ФО', 'FUId', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801123, 'КВСРКлюч', 'Kvsr', 'КВСР(Классификация)', 'DestKvsr', 0, 208, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(20801124, 'КВРКлюч', 'Kvr', 'КВР(Классификация)', 'DestKvr', 0, 208, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(20801125, 'КФСР', 'Kfsr', 'КФСР', 'DestKfsr', 0, 208, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(20801126, 'КЭСР', 'Kesr', 'КЭСР', 'DestKesr', 0, 208, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(20801127, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsr', 0, 208, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(20801128, 'СубКЭСР', 'SubKESR', 'СубКЭСР', 'DestSubKesr', 0, 208, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(20801129, 'Регион', 'RegionCls', 'Регион', 'RegionCls', 0, 208, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, null) ;

CALL ImportField(20801131, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 0, 208, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(20801132, 'ЛС в ФК', 'FACIALCODE', 'ЛС в ФК', 'DestFacialAccClsFacialCode', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801133, 'Ссылка на рс получ.', 'Acc_Ref', 'Ссылка на рс получ.', 'DestAccount', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801134, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 208, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20801135, 'Январь', 'Month01', 'Январь', 'Month01', 0, 208, 1, 0, 'РоспЯнварь', 0, null) ;

CALL ImportField(20801136, 'Февраль', 'Month02', 'Февраль', 'Month02', 0, 208, 1, 0, 'РоспФевраль', 0, null) ;

CALL ImportField(20801137, 'Март', 'Month03', 'Март', 'Month03', 0, 208, 1, 0, 'РоспМарт', 0, null) ;

CALL ImportField(20801138, 'Апрель', 'Month04', 'Апрель', 'Month04', 0, 208, 1, 0, 'РоспАпрель', 0, null) ;

CALL ImportField(20801139, 'Май', 'Month05', 'Май', 'Month05', 0, 208, 1, 0, 'РоспМай', 0, null) ;

CALL ImportField(20801140, 'Июнь', 'Month06', 'Июнь', 'Month06', 0, 208, 1, 0, 'РоспИюнь', 0, null) ;

CALL ImportField(20801141, 'Июль', 'Month07', 'Июль', 'Month07', 0, 208, 1, 0, 'РоспИюль', 0, null) ;

CALL ImportField(20801142, 'Август', 'Month08', 'Август', 'Month08', 0, 208, 1, 0, 'РоспАвгуст', 0, null) ;

CALL ImportField(20801143, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 0, 208, 1, 0, 'РоспСентябрь', 0, null) ;

CALL ImportField(20801144, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 0, 208, 1, 0, 'РоспОктябрь', 0, null) ;

CALL ImportField(20801145, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 0, 208, 1, 0, 'РоспНоябрь', 0, null) ;

CALL ImportField(20801146, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 0, 208, 1, 0, 'РоспДекабрь', 0, null) ;

CALL ImportField(20801147, 'Квартал1', 'Quarter1', 'Квартал1', 'Quarter1', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801148, 'Квартал2', 'Quarter2', 'Квартал2', 'Quarter2', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801149, 'Квартал3', 'Quarter3', 'Квартал3', 'Quarter3', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801150, 'Бюджетная классификация(группа)', 'TreeOwner0', 'Бюджетная классификация(группа)', 'TreeOwner0', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801151, 'Роспись на первый год', 'SummaYear1', 'Роспись на первый год', 'SummaYear1', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801152, 'Роспись на второй год', 'SummaYear2', 'Роспись на второй год', 'SummaYear2', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801153, 'Роспись на третий год', 'SummaYear3', 'Роспись на третий год', 'SummaYear3', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801154, 'Корреспондирующий ЭКР', 'KESRCorr', 'Корреспондирующий ЭКР', 'KESRCorr', 0, 208, 1, 0, '', 0, null) ;

CALL ImportField(20801155, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'AssignmentKind', 0, 208, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(20801159, 'Сумма на месяц', 'CurMonth1', '', ' ', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801161, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801170, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 208, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(20801171, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 208, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(20801172, 'КЦСР(Классификация)', 'KCSRCode', '', 'KCSR', 0, 208, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(20801173, 'КВР(Классификация)', 'KVRCode', '', 'KVR', 0, 208, 1, 0, 'КВР', 0, null) ;

CALL ImportField(20801174, 'КВСР(Классификация)', 'KVSRCode', '', 'KVSR', 0, 208, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(20801175, '<Не используется>', 'KDCode', '', ' ', 0, 208, 1, 1, 'КодДохода', 0, null) ;

CALL ImportField(20801176, '<Не используется>', 'SubKD', '', ' ', 0, 208, 1, 1, 'СубКД', 0, null) ;

CALL ImportField(20801185, '<Не используется>', 'KD', '', ' ', 0, 208, 1, 0, 'КДКлюч', 0, null) ;

CALL ImportField(20801186, 'Код цели', 'TargetCls', '', ' ', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801187, '<Не используется>', 'OnYearIncome', '', ' ', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801188, '<Не используется>', 'On3Year', '', ' ', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801189, '<Не используется>', 'On3YearCharges', '', ' ', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801190, '<Не используется>', 'On3YearIncome', '', ' ', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801192, '<Не используется>', 'OnYearCharges', '', ' ', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801195, 'Тип классфикации (дет.)', 'ClsType', '', ' ', 0, 208, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20801196, '<Не испльзуются>', 'CurMonth3', '', ' ', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801197, '<Не испльзуются>', 'CurQuarter', '', ' ', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801198, '<Скртыое поле>', 'FundsSource', '', ' ', 0, 208, 1, 1, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(20801199, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 0, 208, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(20801200, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 208, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(20801201, 'Код сметы записи', 'StimateID', 'Код сметы записи', 'StimateID', 0, 208, 1, 1, '', 0, null) ;

CALL ImportField(20801202, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 0, 208, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(20801203, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 0, 208, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(20801204, 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', '', ' ', 0, 208, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(20801205, 'Код расходного обязательства (ключ)', 'PayPromiseCls', '', ' ', 0, 208, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

CALL ImportField(20801206, 'Получатель субсидии(ссылка)', 'TransfertOrg_Ref', 'Получатель субсидии(ссылка)', 'TransfertOrg_Ref', 0, 208, 1, 1, 'ОргПолучСубсидии', 0, null) ;

CALL ImportField(20801207, 'Получатель субсидии(трансферта)', 'TransfertOrg_Name', 'Получатель субсидии(трансферта)', ' ', 0, 208, 1, 0, '', 0, null) ;

-- Помесячные ПОФ по ПБС, Бюджет(1)
CALL ImportField(20810001, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 208, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(20810002, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 1, 208, 0, 0, '', 0, 16646) ;

CALL ImportField(20810011, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 208, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(20810013, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 208, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(20810014, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 208, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(20810016, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 208, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(20810017, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 208, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(20810021, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 208, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(20810024, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 208, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(20810026, 'Код документа', 'ID', 'Код документа', 'Id', 1, 208, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(20810030, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CryptoStatus', 1, 208, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(20810035, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 208, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(20810040, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 208, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20810041, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'Note', 1, 208, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(20810042, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'Note2', 1, 208, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(20810044, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 1, 208, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(20810045, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 208, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(20810046, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 208, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(20810067, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 208, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(20810075, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderId', 1, 208, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(20810157, 'Число подтверждающих документов по факсу', 'FaxDocCount', 'Число подтверждающих документов по факсу', ' ', 1, 208, 0, 1, 'ЧислоПодтверждающихДокументовПоФаксу', 0, 17497) ;

CALL ImportField(20810158, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 208, 0, 0, '', 0, 24698) ;

CALL ImportField(20810159, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 208, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(20811003, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 208, 1, 0, '', 0, null) ;

CALL ImportField(20811004, 'л/с ФК', 'FACIALCODE', 'л/с ФК', 'DestFacialAccClsFacialCode', 1, 208, 1, 0, '', 0, null) ;

CALL ImportField(20811006, 'ИНН(Организация)', 'INN', 'ИНН(Получатель)', 'DestOrgInn', 1, 208, 1, 0, 'ИННОрганизацииДеталь', 0, 16645) ;

CALL ImportField(20811007, 'КПП(Организация)', 'INN20', 'КПП(Получатель)', 'DestOrgKpp', 1, 208, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(20811009, 'Наименование(Организация)', 'NAME', 'Наименование(Получатель)', 'DestOrgNAME', 1, 208, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(20811010, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 208, 1, 1, 'БухОперация', 0, 17451) ;

CALL ImportField(20811012, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 208, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(20811019, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 208, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(20811020, 'Источник образования средств', 'FundsSource', 'Источник образования средств', 'FUNDSSOURCE', 1, 208, 1, 1, 'ИсточникОбразованияСредств', 0, 17456) ;

CALL ImportField(20811022, 'КВРКлюч', 'KVR', 'КВР(Классификация)', 'DestKvrKey', 1, 208, 1, 1, 'КВРКлюч', 0, 17414) ;

CALL ImportField(20811023, 'КВСРКлюч', 'KVSR', 'КВСР(Классификация)', 'DestKvsrKey', 1, 208, 1, 1, 'КВСРКлюч', 0, 17412) ;

CALL ImportField(20811025, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 208, 1, 1, '', 0, 17410) ;

CALL ImportField(20811027, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 208, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(20811028, 'Код записи', 'ID', 'Код записи', 'Id', 1, 208, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(20811031, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 208, 1, 0, 'КФСР', 0, 17411) ;

CALL ImportField(20811032, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'DestKcsrKey', 1, 208, 1, 1, 'КЦСРКлюч', 0, 17413) ;

CALL ImportField(20811033, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 208, 1, 0, 'КЭСР', 0, 17415) ;

CALL ImportField(20811034, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 208, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(20811043, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 208, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(20811047, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 208, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17417) ;

CALL ImportField(20811048, 'Август', 'Month08', 'Август', 'Month08', 1, 208, 1, 0, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(20811049, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 208, 1, 0, 'РоспАпрель', 0, 17439) ;

CALL ImportField(20811050, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 208, 1, 0, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(20811051, 'Июль', 'Month07', 'Июль', 'Month07', 1, 208, 1, 0, 'РоспИюль', 0, 17442) ;

CALL ImportField(20811052, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 208, 1, 0, 'РоспИюнь', 0, 17441) ;

CALL ImportField(20811057, 'Май', 'Month05', 'Май', 'Month05', 1, 208, 1, 0, 'РоспМай', 0, 17440) ;

CALL ImportField(20811058, 'Март', 'Month03', 'Март', 'Month03', 1, 208, 1, 0, 'РоспМарт', 0, 17438) ;

CALL ImportField(20811062, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 208, 1, 0, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(20811063, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 208, 1, 0, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(20811064, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 208, 1, 0, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(20811065, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 208, 1, 0, 'РоспФевраль', 0, 17437) ;

CALL ImportField(20811066, 'Январь', 'Month01', 'Январь', 'Month01', 1, 208, 1, 0, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(20811068, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', 'DestSubKesr', 1, 208, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(20811071, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 208, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(20811076, 'Код отправителя записи', 'SenderID', 'Код отправителя записи', 'SenderId', 1, 208, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(20811077, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 208, 1, 1, 'ТипКлассификации', 0, 17453) ;

CALL ImportField(20811078, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFS', 1, 208, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(20811079, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', 'IFS_DescriptionCode', 1, 208, 1, 0, '', 0, null) ;

CALL ImportField(20811080, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', 'IFS_KESR', 1, 208, 1, 0, '', 0, null) ;

CALL ImportField(20811081, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', 'IFS_KVSRCode', 1, 208, 1, 0, '', 0, null) ;

CALL ImportField(20811082, 'КД', 'KD', 'КД', 'KD', 1, 208, 1, 1, 'КДКлюч', 0, 25270) ;

CALL ImportField(20811088, 'Суб. код дохода', 'SubKD', 'Суб. код дохода', 'SUBKD', 1, 208, 1, 1, 'СубКД', 0, 25271) ;

CALL ImportField(20811089, 'Сумма на месяц', 'CurMonth1', 'Сумма на месяц(либо на первый месяц квартала)', ' ', 1, 208, 1, 0, '', 0, null) ;

CALL ImportField(20811160, 'Сумма на второй месяц квартала', 'CurMonth2', 'Сумма на второй месяц квартала', ' ', 1, 208, 1, 0, '', 0, null) ;

CALL ImportField(20811161, 'Сумма на третий месяц квартала', 'CurMonth3', 'Сумма на третий месяц квартала', ' ', 1, 208, 1, 0, '', 0, null) ;

CALL ImportField(20811162, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 208, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(20811163, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 208, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(20811169, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 208, 1, 0, '', 0, null) ;

CALL ImportField(20811170, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 208, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(20811172, 'Код дохода ', 'KDValue', 'Код дохода', 'KDValue', 1, 208, 1, 1, 'КодДохода', 0, null) ;

CALL ImportField(20811173, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 208, 1, 0, '', 0, 26617) ;

CALL ImportField(20811176, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 208, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(20811177, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 208, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

CALL ImportField(20811178, 'Получатель субсидии(ссылка)', 'TransfertOrg_Ref', 'Получатель субсидии(ссылка)', 'TransfertOrg_Ref', 1, 208, 1, 1, 'ОргПолучСубсидии', 0, 29463) ;

CALL ImportField(20811179, 'Получатель субсидии(трансферта)', 'TransfertOrg_Name', 'Получатель субсидии(трансферта)', ' ', 1, 208, 1, 0, '', 0, 16646) ;

-- Подневный ПОФ, Бюджет(1)
CALL ImportField(20910001, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 209, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(20910002, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 209, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(20910003, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 209, 0, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(20910004, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 209, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(20910005, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 209, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(20910006, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 209, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(20910011, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 209, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(20910012, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 209, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(20910013, 'Код документа', 'ID', 'Код документа', 'ID', 1, 209, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(20910014, 'Период', 'KPPERIOD', 'Период', 'KPPeriod', 1, 209, 0, 0, 'ПериодКП', 0, null) ;

CALL ImportField(20910015, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'note', 1, 209, 0, 0, 'Основание', 0, null) ;

CALL ImportField(20910016, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'note1 ', 1, 209, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(20910017, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'note2 ', 1, 209, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(20910018, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 209, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(20910019, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 209, 0, 0, '', 0, null) ;

CALL ImportField(20910021, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 209, 0, 1, 'ОрганизацияЗаголовок', 0, null) ;

CALL ImportField(20910022, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 209, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(20910023, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 209, 0, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(20910024, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 209, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(20910025, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 209, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(20910026, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 209, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(20911002, 'Дата создания(Авторизация)', 'CreateDate', 'Дата создания(Авторизация)', 'CreateDate_Det', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911003, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911005, 'Сумма', 'DAYPLANSUMMA', 'Сумма', 'DayPlanSumma', 1, 209, 1, 0, '', 0, null) ;

CALL ImportField(20911029, 'Дата изменения(Авторизация)', 'UpdateDate', 'Дата изменения(Авторизация)', 'UpdateDate_Det', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911030, 'Изменил(Авторизация)', 'UpdaterUser', 'Изменил(Авторизация)', 'UpdaterUser_det', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20912033, 'Число записей детали', 'RecordCount', 'Число записей детали', ' ', 1, 209, 2, 1, '', 0, null) ;

-- Внутренние РР, УРМ(0)
CALL ImportField(21000001, 'Номер', 'ANUMBER', 'Номер', ' ', 0, 210, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(21000002, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', ' ', 0, 210, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(21000003, 'Отнесение к БА, ЛБО', 'Ba_Lbo_Flag', 'Отнесение к БА, ЛБО', ' ', 0, 210, 0, 0, 'ПринадлежностьБА_ЛБО', 0, null) ;

CALL ImportField(21000004, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 210, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(21000005, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 0, 210, 0, 0, '', 0, null) ;

CALL ImportField(21000006, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', ' ', 0, 210, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(21000007, 'Дата принятия', 'DAT', 'Дата принятия', ' ', 0, 210, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(21000008, 'Дата введения в действие', 'DATE_UTV_PP', 'Дата введения в действие', ' ', 0, 210, 0, 0, 'ДатаВДРР', 0, null) ;

CALL ImportField(21000009, 'Дата формирования', 'DateInput', 'Дата формирования', ' ', 0, 210, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(21000013, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', ' ', 0, 210, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(21000015, 'Код документа', 'ID', 'Код документа', ' ', 0, 210, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(21000016, 'Месяц', 'KPPERIOD', 'Месяц', ' ', 0, 210, 0, 0, 'ПериодКП', 0, null) ;

CALL ImportField(21000017, 'Специальные указания', 'NOTE', 'Специальные указания', ' ', 0, 210, 0, 0, 'Основание', 0, null) ;

CALL ImportField(21000018, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', ' ', 0, 210, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(21000019, 'По вопросу', 'NOTE2', 'По вопросу', ' ', 0, 210, 0, 1, 'ПоВопросу', 0, null) ;

CALL ImportField(21000020, 'Источник', 'NOTIFYTYPE', 'Источник', ' ', 0, 210, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(21000021, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 0, 210, 0, 0, '', 0, null) ;

CALL ImportField(21000023, 'Вид плана', 'PlanDocType', 'Вид плана', ' ', 0, 210, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(21000024, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', ' ', 0, 210, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(21000025, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', ' ', 0, 210, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(21000026, 'Вариант', 'Variant', 'Вариант', ' ', 0, 210, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(21001001, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', ' ', 0, 210, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(21001002, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 210, 1, 1, 'КодБюджета', 0, null) ;

CALL ImportField(21001003, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 0, 210, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(21001004, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 0, 210, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(21001005, 'Направление(Классификация)', 'DirectionCLS', 'Направление(Классификация)', ' ', 0, 210, 1, 0, 'Направление', 0, null) ;

CALL ImportField(21001006, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', ' ', 0, 210, 1, 1, 'ЛицевойСчет', 0, null) ;

CALL ImportField(21001007, 'л/с ФК', 'FACIALCODE', 'л/с ФК', ' ', 0, 210, 1, 0, '', 0, null) ;

CALL ImportField(21001008, 'Мероприятие', 'FACT', 'Мероприятие', ' ', 0, 210, 1, 0, 'Мероприятие', 0, null) ;

CALL ImportField(21001009, 'Тип финансирования', 'FINTYPE', 'Тип финансирования', ' ', 0, 210, 1, 0, 'ТипФинансирования', 0, null) ;

CALL ImportField(21001010, 'Источник образования средств', 'FundsSource', 'Источник образования средств', ' ', 0, 210, 1, 1, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(21001011, 'Код записи', 'ID', 'Код записи', ' ', 0, 210, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(21001012, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 0, 210, 1, 0, '', 0, null) ;

CALL ImportField(21001013, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 0, 210, 1, 0, '', 0, null) ;

CALL ImportField(21001014, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 0, 210, 1, 0, '', 0, null) ;

CALL ImportField(21001015, 'КЦСРКлюч', 'KCSR', 'КЦСРКлюч', ' ', 0, 210, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(21001016, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 0, 210, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(21001017, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', ' ', 0, 210, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(21001018, 'ЭКР (получено)', 'KESRCORR', 'ЭКР (получено)', ' ', 0, 210, 1, 1, 'КорКЭСР', 0, null) ;

CALL ImportField(21001019, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', ' ', 0, 210, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(21001020, 'КВРКлюч', 'KVR', 'КВРКлюч', ' ', 0, 210, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(21001021, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 0, 210, 1, 0, 'КВР', 0, null) ;

CALL ImportField(21001022, 'КВСРКлюч', 'KVSR', 'КВСРКлюч', ' ', 0, 210, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(21001023, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 0, 210, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(21001024, 'Тип средств', 'MeansType', 'Тип средств', ' ', 0, 210, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(21001025, 'Примечание', 'NOTE', 'Примечание', ' ', 0, 210, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(21001026, 'Код документа', 'RECORDINDEX', 'Код документа', ' ', 0, 210, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(21001027, 'Район трансферта', 'REGIONCLS', 'Район трансферта', ' ', 0, 210, 1, 0, 'Регион', 0, null) ;

CALL ImportField(21001028, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 0, 210, 1, 0, '', 0, null) ;

CALL ImportField(21001029, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', ' ', 0, 210, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(21001030, 'Первый год', 'SUMMAYEAR1', 'Первый год', ' ', 0, 210, 1, 0, 'РоспНаПервыйГод', 0, null) ;

CALL ImportField(21001031, 'Второй плановый год', 'SUMMAYEAR2', 'Второй плановый год', ' ', 0, 210, 1, 0, 'РоспНаВторойГод', 0, null) ;

CALL ImportField(21001032, 'Третий плановый год', 'SUMMAYEAR3', 'Третий плановый год', ' ', 0, 210, 1, 0, 'РоспНаТретийГод', 0, null) ;

CALL ImportField(21001033, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 0, 210, 1, 0, '', 0, null) ;

CALL ImportField(21001035, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средствКлюч', ' ', 0, 210, 1, 0, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(21001036, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 0, 210, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(21001054, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии(ссылка)', 'SubsidyCls', 0, 210, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(21001056, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 210, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(21002001, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', ' ', 0, 210, 2, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(21002002, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 210, 2, 1, 'КодБюджета', 0, null) ;

CALL ImportField(21002003, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 0, 210, 2, 0, 'БухОперация', 0, null) ;

CALL ImportField(21002004, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 0, 210, 2, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(21002005, 'Сумма', 'CurMonth1', 'Сумма', ' ', 0, 210, 2, 0, '', 0, null) ;

CALL ImportField(21002006, 'Направление(Классификация)', 'DirectionCLS', 'Направление(Классификация)', ' ', 0, 210, 2, 0, 'Направление', 0, null) ;

CALL ImportField(21002007, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', ' ', 0, 210, 2, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(21002008, 'л/с ФК', 'FACIALCODE', 'л/с ФК', ' ', 0, 210, 2, 0, '', 0, null) ;

CALL ImportField(21002009, 'Мероприятие', 'FACT', 'Мероприятие', ' ', 0, 210, 2, 0, 'Мероприятие', 0, null) ;

CALL ImportField(21002010, 'Тип финансирования', 'FINTYPE', 'Тип финансирования', ' ', 0, 210, 2, 0, 'ТипФинансирования', 0, null) ;

CALL ImportField(21002011, 'Источник образования средств', 'FundsSource', 'Источник образования средств', ' ', 0, 210, 2, 1, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(21002012, 'Код записи', 'ID', 'Код записи', ' ', 0, 210, 2, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(21002013, 'КЦСРКлюч', 'KCSR', 'КЦСРКлюч', ' ', 0, 210, 2, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(21002014, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 0, 210, 2, 0, 'КЦСР', 0, null) ;

CALL ImportField(21002015, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', ' ', 0, 210, 2, 0, 'КЭСР', 0, null) ;

CALL ImportField(21002016, 'ЭКР (получено)', 'KESRCORR', 'ЭКР (получено)', ' ', 0, 210, 2, 1, 'КорКЭСР', 0, null) ;

CALL ImportField(21002017, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', ' ', 0, 210, 2, 0, 'КФСР', 0, null) ;

CALL ImportField(21002018, 'КВРКлюч', 'KVR', 'КВРКлюч', ' ', 0, 210, 2, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(21002019, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 0, 210, 2, 0, 'КВР', 0, null) ;

CALL ImportField(21002020, 'КВСРКлюч', 'KVSR', 'КВСРКлюч', ' ', 0, 210, 2, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(21002021, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 0, 210, 2, 0, 'КВСР', 0, null) ;

CALL ImportField(21002022, 'Тип средств', 'MeansType', 'Тип средств', ' ', 0, 210, 2, 0, 'ТипСредств', 0, null) ;

CALL ImportField(21002023, 'Январь', 'Month01', 'Январь', ' ', 0, 210, 2, 1, 'РоспЯнварь', 0, null) ;

CALL ImportField(21002024, 'Февраль', 'Month02', 'Февраль', ' ', 0, 210, 2, 1, 'РоспФевраль', 0, null) ;

CALL ImportField(21002025, 'Март', 'Month03', 'Март', ' ', 0, 210, 2, 1, 'РоспМарт', 0, null) ;

CALL ImportField(21002026, 'Апрель', 'Month04', 'Апрель', ' ', 0, 210, 2, 1, 'РоспАпрель', 0, null) ;

CALL ImportField(21002027, 'Май', 'Month05', 'Май', ' ', 0, 210, 2, 1, 'РоспМай', 0, null) ;

CALL ImportField(21002028, 'Июнь', 'Month06', 'Июнь', ' ', 0, 210, 2, 1, 'РоспИюнь', 0, null) ;

CALL ImportField(21002029, 'Июль', 'Month07', 'Июль', ' ', 0, 210, 2, 1, 'РоспИюль', 0, null) ;

CALL ImportField(21002030, 'Август', 'Month08', 'Август', ' ', 0, 210, 2, 1, 'РоспАвгуст', 0, null) ;

CALL ImportField(21002031, 'Сентябрь', 'Month09', 'Сентябрь', ' ', 0, 210, 2, 1, 'РоспСентябрь', 0, null) ;

CALL ImportField(21002032, 'Октябрь', 'Month10', 'Октябрь', ' ', 0, 210, 2, 1, 'РоспОктябрь', 0, null) ;

CALL ImportField(21002033, 'Ноябрь', 'Month11', 'Ноябрь', ' ', 0, 210, 2, 1, 'РоспНоябрь', 0, null) ;

CALL ImportField(21002034, 'Декабрь', 'Month12', 'Декабрь', ' ', 0, 210, 2, 1, 'РоспДекабрь', 0, null) ;

CALL ImportField(21002035, 'Примечание', 'NOTE', 'Примечание', ' ', 0, 210, 2, 0, 'Примечание', 0, null) ;

CALL ImportField(21002036, 'Квартал 1', 'QUARTER1', 'Квартал 1', ' ', 0, 210, 2, 1, 'РоспКвартал1', 0, null) ;

CALL ImportField(21002037, 'Квартал 2', 'QUARTER2', 'Квартал 2', ' ', 0, 210, 2, 1, 'РоспКвартал2', 0, null) ;

CALL ImportField(21002038, 'Квартал 3', 'QUARTER3', 'Квартал 3', ' ', 0, 210, 2, 1, 'РоспКвартал3', 0, null) ;

CALL ImportField(21002039, 'Квартал 4', 'QUARTER4', 'Квартал 4', ' ', 0, 210, 2, 1, 'РоспКвартал4', 0, null) ;

CALL ImportField(21002040, 'Код документа', 'RECORDINDEX', 'Код документа', ' ', 0, 210, 2, 1, 'КодДокумента', 0, null) ;

CALL ImportField(21002041, 'Район трансферта', 'REGIONCLS', 'Район трансферта', ' ', 0, 210, 2, 0, 'Регион', 0, null) ;

CALL ImportField(21002042, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 0, 210, 2, 0, '', 0, null) ;

CALL ImportField(21002043, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', ' ', 0, 210, 2, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(21002044, 'Классификация', 'TreeOwner1', 'Классификация', ' ', 0, 210, 2, 0, '', 0, null) ;

CALL ImportField(21002045, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средствКлюч', ' ', 0, 210, 2, 0, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(21002046, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 0, 210, 2, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(21002055, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии(ссылка)', 'SubsidyCls', 0, 210, 2, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(21002057, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 210, 2, 0, 'КодСубсидии', 0, null) ;

-- Внутренние РР, Бюджет(1)
CALL ImportField(21010001, 'Номер', 'ANUMBER', 'Номер', 'Number', 1, 210, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(21010002, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 210, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(21010003, 'Отнесение к БА, ЛБО', 'Ba_Lbo_Flag', 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 1, 210, 0, 0, 'ПринадлежностьБА_ЛБО', 0, 17502) ;

CALL ImportField(21010004, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 210, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(21010005, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 210, 0, 0, '', 0, 24698) ;

CALL ImportField(21010006, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 210, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(21010007, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 210, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(21010008, 'Дата введения в действие', 'DATE_UTV_PP', 'Дата введения в действие', 'DATE_UTV_PP', 1, 210, 0, 0, 'ДатаВДРР', 0, 24699) ;

CALL ImportField(21010009, 'Дата формирования', 'DateInput', 'Дата формирования', 'DateInput', 1, 210, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(21010013, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 210, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(21010014, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 1, 210, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(21010015, 'Код документа', 'ID', 'Код документа', 'Id', 1, 210, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(21010016, 'Месяц', 'KPPERIOD', 'Месяц', 'KPPeriod', 1, 210, 0, 0, 'ПериодКП', 0, 24700) ;

CALL ImportField(21010017, 'Специальные указания', 'NOTE', 'Специальные указания', 'note', 1, 210, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(21010018, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'note1', 1, 210, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(21010019, 'По вопросу', 'NOTE2', 'По вопросу', 'note2', 1, 210, 0, 1, 'ПоВопросу', 0, 17470) ;

CALL ImportField(21010020, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 210, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(21010021, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 1, 210, 0, 0, '', 0, 16646) ;

CALL ImportField(21010023, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 210, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(21010024, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 210, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(21010025, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 210, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(21010026, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 210, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(21011001, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 210, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(21011002, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 210, 1, 1, 'КодБюджета', 0, 17410) ;

CALL ImportField(21011003, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 210, 1, 0, 'БухОперация', 0, 17451) ;

CALL ImportField(21011004, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 210, 1, 1, 'ТипКлассификации', 0, 17453) ;

CALL ImportField(21011006, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 210, 1, 1, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(21011007, 'л/с ФК', 'FACIALCODE', 'л/с ФК', ' ', 1, 210, 1, 0, '', 0, null) ;

CALL ImportField(21011010, 'Источник образования средств', 'FundsSource', 'Источник образования средств', 'FUNDSSOURCE', 1, 210, 1, 1, 'ИсточникОбразованияСредств', 0, 17456) ;

CALL ImportField(21011011, 'Код записи', 'ID', 'Код записи', 'Id', 1, 210, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(21011012, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 210, 1, 0, '', 0, 17050) ;

CALL ImportField(21011013, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 210, 1, 0, '', 0, 17054) ;

CALL ImportField(21011015, 'КЦСРКлюч', 'KCSR', 'КЦСРКлюч', 'DestKcsrKey', 1, 210, 1, 1, 'КЦСРКлюч', 0, 17413) ;

CALL ImportField(21011017, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 210, 1, 0, 'КЭСР', 0, 17415) ;

CALL ImportField(21011018, 'ЭКР (получено)', 'KESRCORR', 'ЭКР (получено)', 'KESRCORR', 1, 210, 1, 1, 'КорКЭСР', 0, 17461) ;

CALL ImportField(21011019, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 210, 1, 0, 'КФСР', 0, 17411) ;

CALL ImportField(21011020, 'КВРКлюч', 'KVR', 'КВРКлюч', 'DestKvrKey', 1, 210, 1, 1, 'КВРКлюч', 0, 17414) ;

CALL ImportField(21011022, 'КВСРКлюч', 'KVSR', 'КВСРКлюч', 'DestKvsrKey', 1, 210, 1, 1, 'КВСРКлюч', 0, 17412) ;

CALL ImportField(21011024, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 210, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(21011025, 'Примечание', 'NOTE', 'Примечание', 'Note', 1, 210, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(21011026, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 210, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(21011027, 'Район трансферта', 'REGIONCLS', 'Район трансферта', 'RegionCLS', 1, 210, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17417) ;

CALL ImportField(21011028, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 210, 1, 0, '', 0, null) ;

CALL ImportField(21011029, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', 'DestSubkesr', 1, 210, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(21011030, 'Первый год', 'SUMMAYEAR1', 'Первый год', 'SummaYear1', 1, 210, 1, 0, 'РоспНаПервыйГод', 0, 17457) ;

CALL ImportField(21011031, 'Второй плановый год', 'SUMMAYEAR2', 'Второй плановый год', 'SummaYear2', 1, 210, 1, 0, 'РоспНаВторойГод', 0, 17458) ;

CALL ImportField(21011032, 'Третий плановый год', 'SUMMAYEAR3', 'Третий плановый год', 'SummaYear3', 1, 210, 1, 0, 'РоспНаТретийГод', 0, 17459) ;

CALL ImportField(21011033, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 210, 1, 0, '', 0, null) ;

CALL ImportField(21011034, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFS', 1, 210, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(21011035, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средствКлюч', 'TransfertCls', 1, 210, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(21011039, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии(ссылка)', 'SubsidyCls', 1, 210, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(21011040, 'Код бюджетного ассингованияКлюч', 'BudAllocationCls', '', ' ', 1, 210, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(21011042, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', ' ', 1, 210, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

CALL ImportField(21012001, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 210, 2, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(21012002, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 210, 2, 1, 'КодБюджета', 0, 17410) ;

CALL ImportField(21012003, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 210, 2, 0, 'БухОперация', 0, 17451) ;

CALL ImportField(21012004, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 210, 2, 1, 'ТипКлассификации', 0, 17453) ;

CALL ImportField(21012005, 'Сумма', 'CurMonth1', 'Сумма', ' ', 1, 210, 2, 0, '', 0, null) ;

CALL ImportField(21012007, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 210, 2, 1, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(21012008, 'л/с ФК', 'FACIALCODE', 'л/с ФК', ' ', 1, 210, 2, 0, '', 0, null) ;

CALL ImportField(21012011, 'Источник образования средств', 'FundsSource', 'Источник образования средств', 'FUNDSSOURCE', 1, 210, 2, 1, 'ИсточникОбразованияСредств', 0, 17456) ;

CALL ImportField(21012012, 'Код записи', 'ID', 'Код записи', 'Id', 1, 210, 2, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(21012013, 'КЦСРКлюч', 'KCSR', 'КЦСРКлюч', 'DestKcsrKey', 1, 210, 2, 1, 'КЦСРКлюч', 0, 17413) ;

CALL ImportField(21012015, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 210, 2, 0, 'КЭСР', 0, 17415) ;

CALL ImportField(21012016, 'ЭКР (получено)', 'KESRCORR', 'ЭКР (получено)', 'KESRCORR', 1, 210, 2, 1, 'КорКЭСР', 0, 17461) ;

CALL ImportField(21012017, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 210, 2, 0, 'КФСР', 0, 17411) ;

CALL ImportField(21012018, 'КВРКлюч', 'KVR', 'КВРКлюч', 'DestKvrKey', 1, 210, 2, 1, 'КВРКлюч', 0, 17414) ;

CALL ImportField(21012020, 'КВСРКлюч', 'KVSR', 'КВСРКлюч', 'DestKvsrKey', 1, 210, 2, 1, 'КВСРКлюч', 0, 17412) ;

CALL ImportField(21012022, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 210, 2, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(21012023, 'Январь', 'Month01', 'Январь', 'Month01', 1, 210, 2, 1, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(21012024, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 210, 2, 1, 'РоспФевраль', 0, 17437) ;

CALL ImportField(21012025, 'Март', 'Month03', 'Март', 'Month03', 1, 210, 2, 1, 'РоспМарт', 0, 17438) ;

CALL ImportField(21012026, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 210, 2, 1, 'РоспАпрель', 0, 17439) ;

CALL ImportField(21012027, 'Май', 'Month05', 'Май', 'Month05', 1, 210, 2, 1, 'РоспМай', 0, 17440) ;

CALL ImportField(21012028, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 210, 2, 1, 'РоспИюнь', 0, 17441) ;

CALL ImportField(21012029, 'Июль', 'Month07', 'Июль', 'Month07', 1, 210, 2, 1, 'РоспИюль', 0, 17442) ;

CALL ImportField(21012030, 'Август', 'Month08', 'Август', 'Month08', 1, 210, 2, 1, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(21012031, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 210, 2, 1, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(21012032, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 210, 2, 1, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(21012033, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 210, 2, 1, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(21012034, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 210, 2, 1, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(21012035, 'Примечание', 'NOTE', 'Примечание', 'Note', 1, 210, 2, 0, 'Примечание', 0, 17431) ;

CALL ImportField(21012036, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'QUARTER1', 1, 210, 2, 1, 'РоспКвартал1', 0, 17421) ;

CALL ImportField(21012037, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'QUARTER2', 1, 210, 2, 1, 'РоспКвартал2', 0, 17422) ;

CALL ImportField(21012038, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'QUARTER3', 1, 210, 2, 1, 'РоспКвартал3', 0, 17423) ;

CALL ImportField(21012039, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'QUARTER4', 1, 210, 2, 1, 'РоспКвартал4', 0, 17424) ;

CALL ImportField(21012040, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 210, 2, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(21012041, 'Район трансферта', 'REGIONCLS', 'Район трансферта', 'RegionCLS', 1, 210, 2, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17417) ;

CALL ImportField(21012042, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 210, 2, 0, '', 0, null) ;

CALL ImportField(21012043, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', 'DestSubkesr', 1, 210, 2, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(21012044, 'Классификация', 'TreeOwner1', 'Классификация', ' ', 1, 210, 2, 0, '', 0, null) ;

CALL ImportField(21012045, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средствКлюч', 'TransfertCls', 1, 210, 2, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(21012047, 'Источниковая классификация', 'IFS', '', 'IFS', 1, 210, 2, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(21012048, 'Вид источника(Классификация)', 'IFS_DescriptionCode', '', ' ', 1, 210, 2, 0, '', 0, 17050) ;

CALL ImportField(21012049, 'ЭКИ(Классификация)', 'IFS_KESR', '', ' ', 1, 210, 2, 0, '', 0, 17054) ;

CALL ImportField(21012053, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии(ссылка)', 'SubsidyCls', 1, 210, 2, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(21012054, 'Код бюджетного ассингованияКлюч', 'BudAllocationCls', '', ' ', 1, 210, 2, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(21012056, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', ' ', 1, 210, 2, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

-- Все казначейские документы, УРМ(0)
CALL ImportField(30000001, 'Дата принятия', '{РусПоле("ДатаПринятия")}', 'Дата принятия(проведения) документа', ' ', 0, 300, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(30000002, 'Код причины отклонения', '{РусПоле("ПричинаОтклонКод")}', 'Код причины отклонения документа', ' ', 0, 300, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(30000003, 'Причина отклонения (комментарий)', '{РусПоле("ПричинаОтклонТекст")}', 'Причина отклонения (комментарий)', ' ', 0, 300, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(30000004, 'Код удалённого клиента', '{РусПоле("КодОтправителяДокумента")}', 'Код удалённого клиента(отправителя документа)', ' ', 0, 300, 0, 1, 'КодОтправителяДокумента', 0, null) ;

CALL ImportField(30000005, 'Автор документа', '{РусПоле("АвторДокумента")}', 'Автор документа', ' ', 0, 300, 0, 1, 'АвторДокумента', 0, null) ;

CALL ImportField(30000006, 'Состояние документа', '{РусПоле("СостояниеДокумента")}', 'Состояние документа', ' ', 0, 300, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(30000007, 'Бюджет', '{РусПоле("КодБюджета")}', 'Бюджет документа', ' ', 0, 300, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(30000008, 'Лицевой счет', '{РусПоле("ЛицевойСчет")}', 'Основной лицевой счет документа (в заголовке либо детали)', ' ', 0, 300, 0, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(30000009, 'Статус ЭЦП', '{РусПоле("КриптоСтатус")}', 'Статус ЭЦП', ' ', 0, 300, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(30000010, 'Код реестра', '{РусПоле("КодРеестра")}', 'Код реестра', ' ', 0, 300, 0, 1, 'КодРеестра', 0, null) ;

CALL ImportField(30000011, 'Признак принятого реестра', '{РусПоле("ПринятиеРеестра")}', 'Признак принятого реестра', ' ', 0, 300, 0, 1, 'ПринятиеРеестра', 0, null) ;

CALL ImportField(30000012, 'Номер реестра', '{РусПоле("НомерРеестра")}', 'Номер реестра', ' ', 0, 300, 0, 0, 'НомерРеестра', 0, null) ;

CALL ImportField(30000013, 'Архив', '{РусПоле("ПризнакАрхивности")}', 'Признак архивности', ' ', 0, 300, 0, 0, 'ПризнакАрхивности', 0, null) ;

CALL ImportField(30000015, 'Сумма заголовка', '{РусПоле("СуммаЗаголовка")}', 'Сумма', ' ', 0, 300, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(30000021, 'РСФО', '{РусПоле("РСФО")}', 'Код счета финансового органа', ' ', 0, 300, 0, 1, 'РСФО', 0, null) ;

CALL ImportField(30001014, 'Заявка', '{РусПоле("Заявка")}', 'Заявка', ' ', 0, 300, 1, 1, 'Заявка', 0, null) ;

CALL ImportField(30001016, 'Сумма записи', '{РусПоле("СуммаЗаписи")}', 'Сумма', ' ', 0, 300, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(30001017, '№ бюджетного обязательства', '{РусПоле("БюджОбяз")}', '№ бюджетного обязательства', ' ', 0, 300, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(30001018, 'Код целевых средств (ключ)', '{РусПоле("КодЦелевыхСредствКлюч")}', 'Код целевых средств (ключ)', ' ', 0, 300, 1, 0, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(30001019, 'Тип классификации', '{РусПоле("ТипКлассификации")}', 'Тип классификации', ' ', 0, 300, 1, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(30001020, 'Код целевых средств', '{РусПоле("КодЦелевыхСредств")}', 'Код целевых средств', ' ', 0, 300, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(30001022, 'Код субсидии', '{РусПоле("КодСубсидии")}', 'Код субсидии', ' ', 0, 300, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(30001023, 'Код субсидии (ключ)', '{РусПоле("КодСубсидииКлюч")}', 'Код субсидии (ключ)', ' ', 0, 300, 1, 0, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(30001024, 'Операция', '{РусПоле("БухОперация")}', 'Бух операция', ' ', 0, 300, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(30001025, 'КДКлюч', '{РусПоле("КДКлюч")}', 'Код дохода (ключ)', ' ', 0, 300, 1, 0, 'КДКлюч', 0, null) ;

CALL ImportField(30001026, 'КВСРКлюч', '{РусПоле("КВСРКлюч")}', 'КВСР (ключ)', ' ', 0, 300, 1, 0, 'КВСРКлюч', 0, null) ;

CALL ImportField(30001027, 'КЦСРКлюч', '{РусПоле("КЦСРКлюч")}', 'КЦСР (ключ)', ' ', 0, 300, 1, 0, 'КЦСРКлюч', 0, null) ;

CALL ImportField(30001028, 'КВРКлюч', '{РусПоле("КВРКлюч")}', 'КВР (ключ)', ' ', 0, 300, 1, 0, 'КВРКлюч', 0, null) ;

CALL ImportField(30001029, 'ФКР', '{РусПоле("КФСР")}', 'ФКР (ключ)', ' ', 0, 300, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(30001030, 'ЭКР', '{РусПоле("КЭСР")}', 'ЭКР (ключ)', ' ', 0, 300, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(30001031, 'КЦСР', '{РусПоле("КЦСР")}', 'КЦСР', ' ', 0, 300, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(30001032, 'КВР', '{РусПоле("КВР")}', 'КВР', ' ', 0, 300, 1, 0, 'КВР', 0, null) ;

CALL ImportField(30001033, 'КВСР', '{РусПоле("КВСР")}', 'КВСР', ' ', 0, 300, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(30001034, 'Код дохода', '{РусПоле("КодДохода")}', 'Код дохода', ' ', 0, 300, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(30001035, 'Тип средств', '{РусПоле("ТипСредств")}', 'Тип средств', ' ', 0, 300, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(30001036, '№ бюдж.обяз(УД) Родитель', '{РусПоле("БОВнутрНомерГруппа")}', '№ бюдж.обяз(УД) Родитель', ' ', 0, 300, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30001037, '№ бюдж.обяз(УД)', '{РусПоле("БОНомер")}', '№ бюдж.обяз(УД)', ' ', 0, 300, 1, 0, 'БОНомер', 0, null) ;

CALL ImportField(30001038, 'Реестровый номер договора(№ бюдж.обяз.УД)', '{РусПоле("ДоговораБОРеестрНомерДоговора")}', 'Реестровый номер договора(№ бюдж.обяз.УД)', ' ', 0, 300, 1, 0, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(30001039, 'Номер документа исполнения', '{РусПоле("ДокИсполненияНомер")}', 'Номер документа исполнения', ' ', 0, 300, 1, 0, 'ДокИсполненияНомер', 0, null) ;

CALL ImportField(30001040, 'Документ исполнения (группа)', '{РусПоле("ДокИсполненияГруппа")}', 'Документ исполнения (группа)', ' ', 0, 300, 1, 0, 'ДокИсполненияГруппа', 0, null) ;

-- Все казначейские документы, Бюджет(1)
CALL ImportField(30010001, 'Дата принятия', '{РусПоле("ДатаПринятия")}', 'Дата принятия(проведения) документа', ' ', 1, 300, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(30010002, 'Код причины отклонения', '{РусПоле("ПричинаОтклонКод")}', 'Код причины отклонения документа', ' ', 1, 300, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(30010003, 'Причина отклонения (комментарий)', '{РусПоле("ПричинаОтклонТекст")}', 'Причина отклонения (комментарий)', ' ', 1, 300, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(30010004, 'Код удалённого клиента', '{РусПоле("КодОтправителяДокумента")}', 'Код удалённого клиента(отправителя документа)', ' ', 1, 300, 0, 1, 'КодОтправителяДокумента', 0, null) ;

CALL ImportField(30010005, 'Автор документа', '{РусПоле("АвторДокумента")}', 'Автор документа', ' ', 1, 300, 0, 1, 'АвторДокумента', 0, null) ;

CALL ImportField(30010006, 'Состояние документа', '{РусПоле("СостояниеДокумента")}', 'Состояние документа', ' ', 1, 300, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(30010007, 'Бюджет', '{РусПоле("КодБюджета")}', 'Бюджет документа', ' ', 1, 300, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(30010008, 'Лицевой счет', '{РусПоле("ЛицевойСчет")}', 'Основной лицевой счет документа (в заголовке либо детали)', ' ', 1, 300, 0, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(30010009, 'Статус ЭЦП', '{РусПоле("КриптоСтатус")}', 'Статус ЭЦП', ' ', 1, 300, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(30010010, 'Код реестра', '{РусПоле("КодРеестра")}', 'Код реестра', ' ', 1, 300, 0, 1, 'КодРеестра', 0, null) ;

CALL ImportField(30010011, 'Признак принятого реестра', '{РусПоле("ПринятиеРеестра")}', 'Признак принятого реестра', ' ', 1, 300, 0, 1, 'ПринятиеРеестра', 0, null) ;

CALL ImportField(30010012, 'Номер реестра', '{РусПоле("НомерРеестра")}', 'Номер реестра', ' ', 1, 300, 0, 0, 'НомерРеестра', 0, null) ;

CALL ImportField(30010013, 'Архив', '{РусПоле("ПризнакАрхивности")}', 'Признак архивности', ' ', 1, 300, 0, 0, 'ПризнакАрхивности', 0, null) ;

CALL ImportField(30010015, 'Сумма заголовка', '{РусПоле("СуммаЗаголовка")}', 'Сумма', ' ', 1, 300, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(30010021, 'РСФО', '{РусПоле("РСФО")}', 'Код счета финансового органа', ' ', 1, 300, 0, 1, 'РСФО', 0, null) ;

CALL ImportField(30011014, 'Заявка', '{РусПоле("Заявка")}', 'Заявка', ' ', 1, 300, 1, 1, 'Заявка', 0, null) ;

CALL ImportField(30011016, 'Сумма записи', '{РусПоле("СуммаЗаписи")}', 'Сумма', ' ', 1, 300, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(30011017, '№ бюджетного обязательства', '{РусПоле("БюджОбяз")}', '№ бюджетного обязательства', ' ', 1, 300, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(30011018, 'Код целевых средств (ключ)', '{РусПоле("КодЦелевыхСредствКлюч")}', 'Код целевых средств (ключ)', ' ', 1, 300, 1, 0, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(30011019, 'Тип классификации', '{РусПоле("ТипКлассификации")}', 'Тип классификации', ' ', 1, 300, 1, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(30011020, 'Код целевых средств', '{РусПоле("КодЦелевыхСредств")}', 'Код целевых средств', ' ', 1, 300, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(30011022, 'Код субсидии', '{РусПоле("КодСубсидии")}', 'Код субсидии', ' ', 1, 300, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(30011023, 'Код субсидии (ключ)', '{РусПоле("КодСубсидииКлюч")}', 'Код субсидии (ключ)', ' ', 1, 300, 1, 0, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(30011024, 'Операция', '{РусПоле("БухОперация")}', 'Бух операция', ' ', 1, 300, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(30011025, 'КДКлюч', '{РусПоле("КДКлюч")}', 'Код дохода (ключ)', ' ', 1, 300, 1, 0, 'КДКлюч', 0, null) ;

CALL ImportField(30011026, 'КВСРКлюч', '{РусПоле("КВСРКлюч")}', 'КВСР (ключ)', ' ', 1, 300, 1, 0, 'КВСРКлюч', 0, null) ;

CALL ImportField(30011027, 'КЦСРКлюч', '{РусПоле("КЦСРКлюч")}', 'КЦСР (ключ)', ' ', 1, 300, 1, 0, 'КЦСРКлюч', 0, null) ;

CALL ImportField(30011028, 'КВРКлюч', '{РусПоле("КВРКлюч")}', 'КВР (ключ)', ' ', 1, 300, 1, 0, 'КВРКлюч', 0, null) ;

CALL ImportField(30011029, 'ФКР', '{РусПоле("КФСР")}', 'ФКР (ключ)', ' ', 1, 300, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(30011030, 'ЭКР', '{РусПоле("КЭСР")}', 'ЭКР (ключ)', ' ', 1, 300, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(30011031, 'КЦСР', '{РусПоле("КЦСР")}', 'КЦСР', ' ', 1, 300, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(30011032, 'КВР', '{РусПоле("КВР")}', 'КВР', ' ', 1, 300, 1, 0, 'КВР', 0, null) ;

CALL ImportField(30011033, 'КВСР', '{РусПоле("КВСР")}', 'КВСР', ' ', 1, 300, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(30011034, 'Код дохода', '{РусПоле("КодДохода")}', 'Код дохода', ' ', 1, 300, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(30011035, 'Тип средств', '{РусПоле("ТипСредств")}', 'Тип средств', ' ', 1, 300, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(30011036, '№ бюдж.обяз(УД) Родитель', '{РусПоле("БОВнутрНомерГруппа")}', '№ бюдж.обяз(УД) Родитель', ' ', 1, 300, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30011037, '№ бюдж.обяз(УД)', '{РусПоле("БОНомер")}', '№ бюдж.обяз(УД)', ' ', 1, 300, 1, 0, 'БОНомер', 0, null) ;

CALL ImportField(30011038, 'Реестровый номер договора(№ бюдж.обяз.УД)', '{РусПоле("ДоговораБОРеестрНомерДоговора")}', 'Реестровый номер договора(№ бюдж.обяз.УД)', ' ', 1, 300, 1, 0, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(30011041, 'ИВВФКлюч', '{РусПоле("ИсточникВнутрФинансированияКлюч")}', 'Ключ источника внутреннего и внешнего финансирования дефицита бюджета', ' ', 1, 300, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, null) ;

CALL ImportField(30011042, 'ИВВФ', '{РусПоле("ИсточникВнутрФинансирования")}', 'Источник внутреннего и внешнего финансирования дефицита бюджета', ' ', 1, 300, 1, 0, 'ИсточникВнутрФинансирования', 0, null) ;

-- Внутренняя переброска, УРМ(0)
CALL ImportField(30100001, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 0, 301, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(30100002, 'Казначейский счет', 'SourceAccountName', 'Казначейский счет', 'SOURCEACCOUNTNAME', 0, 301, 0, 0, '', 0, null) ;

CALL ImportField(30100003, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 0, 301, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(30100004, 'Причина отклонения', 'Reject_Cls', 'Причина отклонения', 'REJECTCLS', 0, 301, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(30100005, 'Бухгалтерская операция', 'BuhPaymentCls', 'Бухгалтерская операция', 'BUHPAYMENTCLS', 0, 301, 0, 0, 'БухПроводка', 0, null) ;

CALL ImportField(30100006, 'Назначение платежа (заголовок)', 'Note', 'Назначение платежа (заголовок)', 'NOTE', 0, 301, 0, 0, 'Примечание', 0, null) ;

CALL ImportField(30100007, 'Сумма (заголовок)', 'Summa', 'Сумма (заголовок)', 'SUMMA', 0, 301, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(30100008, 'Лицевой счет плательщика', 'SourceFacialAcc_Cls', 'Лицевой счет плательщика', 'SourceFacialAccCls', 0, 301, 0, 0, 'ЛицевойСчет,ЛицСчетПлательщика', 0, null) ;

CALL ImportField(30100009, 'Дата документа', 'DocumentDate', 'Дата документа', 'DocumentDate', 0, 301, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(30100010, 'Лицевой счет плательщика в ФК', ' ', 'Лицевой счет плательщика в ФК', 'SourceFKFacialCode', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100011, 'Номер документа', 'DocNumber', 'Номер документа', 'DocumentNumber', 0, 301, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(30100012, 'Вид операции', 'TypeOperationCls', 'Вид операции', 'OperationTypeCls', 0, 301, 0, 0, 'ТипОперации', 0, null) ;

CALL ImportField(30100013, 'Код документа', 'ID', 'Код документа', 'ID', 0, 301, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30100014, 'Код ФО документа', 'FUID', 'Код ФО документа', 'FUID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100015, 'Код УРМ документа', ' ', 'Код УРМ документа', 'SenderRecordID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100016, 'Код отправителя документа', ' ', 'Код отправителя документа', 'SenderID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100018, 'Номер реестра', 'ReestrNumber', 'Номер реестра', 'ReestrNumber', 0, 301, 0, 1, 'НомерРеестра', 0, null) ;

CALL ImportField(30100019, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 0, 301, 0, 1, 'ДатаРеестра', 0, null) ;

CALL ImportField(30100020, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 301, 0, 1, 'ИндексыДанныхЗаголовок', 0, null) ;

CALL ImportField(30100023, 'Номер карточки', ' ', 'Номер карточки', 'CARDNUMBER', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100024, 'Ссылка на р/c плательщика', 'SOURCEACCOUNT', 'Ссылка на р/c плательщика', 'SOURCEACCOUNT', 0, 301, 0, 1, 'СчетПлат,РСФО', 0, null) ;

CALL ImportField(30100025, 'Ссылка на счет организации-получателя', 'DESTACCOUNT', 'Ссылка на счет организации-получателя', 'DESTACCOUNT', 0, 301, 0, 1, 'СчетПолуч', 0, null) ;

CALL ImportField(30100026, 'л\с получателя', ' ', 'л\с получателя', 'DestFacialAccCls', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100027, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 301, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(30100028, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100029, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100030, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100031, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100032, 'Номер заявки', ' ', 'Номер заявки', 'BidNumber', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100033, 'Локальный реестр', ' ', 'Локальный реестр', 'ManagerBid', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100034, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100035, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100038, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100040, 'Статус ЭЦП', ' ', 'Статус ЭЦП', 'CRYPTOSTATUS', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100041, 'Отдел', ' ', 'Отдел', 'DEPARTMENTCLS', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100042, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100043, 'Текст мягкой причины отклонения', 'SoftRejectCause', 'Текст мягкой причины отклонения', 'SoftRejectCause', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100044, 'Ссылка на счет получателя ФО', ' ', 'Ссылка на счет получателя ФО', 'DestAccountFUID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100046, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100047, 'Субсчет получателя', ' ', 'Субсчет получателя', 'DestFKFacialCode', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100048, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100049, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100050, 'ИНН организации-получателя', ' ', 'ИНН организации-получателя', 'DestOrgINN', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100051, 'КПП организации-получателя', ' ', 'КПП организации-получателя', 'DestOrgKPP', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100052, 'Наименование организации-получателя', ' ', 'Наименование организации-получателя', 'DestOrgName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100053, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100054, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100055, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100056, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100057, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100058, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100059, 'Имя л\с получателя', ' ', 'Имя л\с получателя', 'DestFacialAccClsName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100060, 'мнемокод л\с получателя', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100061, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100062, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100063, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100064, 'Организация ФК получателя(код)', ' ', 'Организация ФК получателя(код)', 'DestFKOrgId', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100065, 'Организация ФК получателя ФО', ' ', 'Организация ФК получателя ФО', 'DestFKOrgFUID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100066, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100067, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100068, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100069, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100070, 'Ссылка на р/c ФО плательщика', ' ', 'Ссылка на р/c ФО плательщика', 'SourceAccountFUID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100071, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100072, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100073, 'Ссылка на организацию плательщика(для УРМ)', ' ', 'Ссылка на организацию плательщика(для УРМ)', 'SourceOrgFUID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100074, 'ИНН организации-плательщика', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100075, 'КПП организации-плательщика', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100076, 'Наименование организации-плательщика', ' ', 'Наименование организации-плательщика', 'SourceOrgName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100077, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100078, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100079, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100080, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100081, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100082, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100083, 'л\с плательщика', 'SourceFacialAccName', 'л\с плательщика', 'SourceFacialAccClsName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100084, 'Мнемокод л\с плательщика', 'SourceFacialCode', 'Мнемокод л\с плательщика', 'SourceFacialAccClsFacialCode', 0, 301, 0, 0, '', 0, null) ;

CALL ImportField(30100085, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100086, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100087, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100088, 'Организация ФК плательщика(код)', ' ', 'Организация ФК плательщика(код)', 'SourceFKOrgId', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100089, 'Организация ФК ФО плательщика', ' ', 'Организация ФК ФО плательщика', 'SourceFKOrgFUID', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100090, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100091, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100092, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100093, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100094, 'НаправлениеОперации', '', 'Направление операции', 'НаправлениеОперации', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100133, 'Направление операции', 'OperationDirection', 'Направление операции', ' ', 0, 301, 0, 0, 'НаправлениеОперации', 0, null) ;

CALL ImportField(30100134, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 301, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(30100149, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 0, 301, 0, 0, 'ТипКлассификацииЗаголовок', 0, null) ;

CALL ImportField(30100160, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100161, 'Казн. счет (получ.)', 'DestAccountName', 'Казн. счет (получ.)', 'DestAccountName', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30100176, 'Признак принятого реестра', 'Accepted', 'Признак принятого реестра', 'Accepted', 0, 301, 0, 1, 'ПринятиеРеестра', 0, null) ;

CALL ImportField(30100177, 'Код реестра', 'Reestr_Ref', 'Код реестра', 'Reestr_Ref', 0, 301, 0, 1, 'КодРеестра', 0, null) ;

CALL ImportField(30100178, 'Район бюджетного учреждения', 'SourceRegionBudgetEst', 'Район бюджетного учреждения плательщика', 'SourceRegionBudgetEst', 0, 301, 0, 1, '', 0, null) ;

CALL ImportField(30101001, 'Примечание по строке детализации', 'Note', 'Примечание по строке детализации', 'NOTE', 0, 301, 1, 0, 'ПримечаниеДеталь', 0, null) ;

CALL ImportField(30101003, 'Источник финансирования плательщика', 'SourceFinSource', 'Источник финансирования плательщика', 'SourceFINSOURCECLS', 0, 301, 1, 0, 'ИсточникФинансирования,ИсточникФинансированияПлат', 0, null) ;

CALL ImportField(30101004, 'Лицевой счет получателя', 'DestFacialAcc_Cls', 'Лицевой счет получателя', 'DestFacialAccCls', 0, 301, 1, 0, 'ЛицСчетПолучателя,DestFacialACCCLS', 0, null) ;

CALL ImportField(30101005, 'Лицевой счет получателя в ФК', 'DestFacialCode', 'Лицевой счет получателя в ФК', 'DestFacialAccClsFacialCode', 0, 301, 1, 0, '', 0, null) ;

CALL ImportField(30101006, 'КВР получ-ляКлюч', 'DestKVR', 'КВР получателя', 'DestKVRKey', 0, 301, 1, 1, 'DestKVR,КВРКлючПолуч', 0, null) ;

CALL ImportField(30101007, 'КЭСР получателя', 'DestKESR', 'КЭСР получателя', 'DestKESR', 0, 301, 1, 0, 'DestKESR,КЭСРПолуч', 0, null) ;

CALL ImportField(30101008, 'КФСР получателя', 'DestKFSR', 'КФСР получателя', 'DestKFSR', 0, 301, 1, 0, 'DestKFSR,КФСРПолуч', 0, null) ;

CALL ImportField(30101009, 'Номер мем. ордера', 'MemOrderNum', 'Номер мем. ордера', 'MemOrderNum', 0, 301, 1, 0, 'НомерМемордера', 0, null) ;

CALL ImportField(30101010, 'КЦСР получ-ляКлюч', 'DestKCSR', 'КЦСР получателя', 'DestKCSRKey', 0, 301, 1, 1, 'DestKCSR,КЦСРКлючПолуч', 0, null) ;

CALL ImportField(30101011, 'Источник финансирования получателя', 'DestFinSource', 'Источник финансирования получателя', 'DestFINSOURCECLS', 0, 301, 1, 0, 'DestFinSource,ИсточникФинансированияПолуч', 0, null) ;

CALL ImportField(30101013, 'Тип средств получателя', 'DestMeansType', 'Тип средств получателя', 'DestMEANSTYPECLS', 0, 301, 1, 0, 'DestMeansType,ТипСредствПолуч', 0, null) ;

CALL ImportField(30101014, 'Тип средств плательщика', 'SourceMeansType', 'Тип средств плательщика', 'SourceMEANSTYPECLS', 0, 301, 1, 0, 'ТипСредств,ТипСредствПлат', 0, null) ;

CALL ImportField(30101016, 'Номер БО плательщика', 'SourcePromise', 'Номер БО плательщика', 'SOURCEPROMISE', 0, 301, 1, 0, 'БюджОбяз,БюджОбязПлат', 0, null) ;

CALL ImportField(30101017, 'Суб. КЭСР получателя', 'DestSubKESR', 'Суб. КЭСР получателя', 'DestSUBKESR', 0, 301, 1, 0, 'DestSubKESR,СубКЭСРПолуч', 0, null) ;

CALL ImportField(30101018, 'КВСР получ-ля (Ключ)', 'DestKVSR', 'КВСР получ-ля (Ключ)', 'DestKVSRKey', 0, 301, 1, 1, 'DestKVSR,КВСРКлючПолуч', 0, null) ;

CALL ImportField(30101019, 'Номер БО получателя', 'DestPromise', 'Номер БО получателя', 'DestPROMISE', 0, 301, 1, 0, 'DestPromise,БюджОбязПолуч', 0, null) ;

CALL ImportField(30101023, 'Сумма по строке детализации', 'Summa', 'Сумма по строке детализации', 'SUMMA', 0, 301, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(30101024, 'КВР плат.Ключ', 'SourceKVR', 'КВР плательщика', 'SourceKVRKey', 0, 301, 1, 1, 'SourceKVR,КВРКлюч', 0, null) ;

CALL ImportField(30101025, 'КЭСР плательщика', 'SourceKESR', 'КЭСР плательщика', 'SourceKESR', 0, 301, 1, 0, 'КЭСР,КЭСРПлат', 0, null) ;

CALL ImportField(30101026, 'КФСР плательщика', 'SourceKFSR', 'КФСР плательщика', 'SourceKFSR', 0, 301, 1, 0, 'КФСР,КФСРПлат', 0, null) ;

CALL ImportField(30101027, 'КЦСР плат.Ключ', 'SourceKCSR', 'КЦСР плательщика', 'SourceKCSRKey', 0, 301, 1, 1, 'SourceKCSR,КЦСРКлюч', 0, null) ;

CALL ImportField(30101028, 'КВСР плат. (Ключ)', 'SourceKVSR', 'КВСР плат. (Ключ)', 'SourceKVSRKey', 0, 301, 1, 1, 'SourceKVSR,КВСРКлюч', 0, null) ;

CALL ImportField(30101029, 'Суб. КЭСР плательщика', 'SourceSubKESR', 'Суб. КЭСР плательщика', 'SourceSUBKESR', 0, 301, 1, 0, 'СубКЭСР,СубКЭСРПлат', 0, null) ;

CALL ImportField(30101031, 'Номер БО плательщика(договора)', 'SourceBudgetPromiseNum', 'Номер БО плательщика(договора)', 'Номер БО плательщика', 0, 301, 1, 0, 'БОНомер,ДоговораБОПлатНомер', 0, null) ;

CALL ImportField(30101032, 'Документ исполнения плательщика', 'SourceExecDocCollaps', 'Документ исполнения плательщика', 'Документ исполнения плательщика', 0, 301, 1, 0, 'ДокИсполненияГруппа,ДокИсполненияПлатГруппа', 0, null) ;

CALL ImportField(30101033, 'Ссылка на документ исполнения плательщика', 'SourceExecDoc', 'Ссылка на документ исполнения плательщика', 'Ссылка на документ исполнения плательщика', 0, 301, 1, 1, 'ДокИсполнения,ДокИсполненияПлат', 0, null) ;

CALL ImportField(30101034, 'Номер документа исполнения плательщика', 'SourceExecDocNum', 'Номер документа исполнения плательщика', 'Номер документа исполнения плательщика', 0, 301, 1, 0, 'ДокИсполненияНомер,ДокИсполненияПлатНомер', 0, null) ;

CALL ImportField(30101035, 'Реестровый номер ДИ плательщика', 'SourceExecDocReestr', 'Реестровый номер ДИ плательщика', 'Реестровый номер ДИ плательщика', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101036, 'Дата ДИ плательщика', 'SourceExecDocDate', 'Дата ДИ плательщика', 'Дата ДИ плательщика', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101037, 'Тип ДИ плательщика', 'SourceExecDocType', 'Тип ДИ плательщика', 'Тип ДИ плательщика', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101038, 'Сумма по ДИ плательщика', 'SourceExecDocSumma', 'Сумма по ДИ плательщика', 'Сумма по ДИ плательщика', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101039, 'Примечание ДИ плательщика', 'SourceExecDocNote', 'Примечание ДИ плательщика', 'Примечание ДИ плательщика', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101040, 'Ссылка на внутренний номер БО получателя', 'DestBudgetPromise', 'Ссылка на внутренний номер БО получателя', 'Ссылка на внутренний номер БО получателя', 0, 301, 1, 1, 'DestBUDGETPROMISE,ДоговораБОПолуч', 0, null) ;

CALL ImportField(30101041, 'Номер БО получателя(договора)', 'DestBudgetPromiseNum', 'Номер БО получателя(договора)', 'Номер БО получателя', 0, 301, 1, 0, 'DESTBUDGETPROMISENUM,ДоговораБОПолучНомер', 0, null) ;

CALL ImportField(30101042, 'Документ исполнения получателя', 'DestExecDocCollaps', 'Документ исполнения получателя', 'Документ исполнения получателя', 0, 301, 1, 0, 'ДокИсполненияПолучГруппа', 0, null) ;

CALL ImportField(30101043, 'Ссылка на документ исполнения получателя', 'DestExecDoc', 'Ссылка на документ исполнения получателя', 'Ссылка на документ исполнения получателя', 0, 301, 1, 1, 'ДокИсполненияПолуч', 0, null) ;

CALL ImportField(30101044, 'Номер документа исполнения получателя', 'DestExecDocNum', 'Номер документа исполнения получателя', 'Номер документа исполнения получателя', 0, 301, 1, 0, 'ДокИсполненияПолучНомер', 0, null) ;

CALL ImportField(30101045, 'Реестровый номер ДИ получателя', 'DestExecDocReestr', 'Реестровый номер ДИ получателя', 'Реестровый номер ДИ получателя', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101046, 'Дата ДИ получателя', 'DestExecDocDate', 'Дата ДИ получателя', 'Дата ДИ получателя', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101047, 'Тип ДИ получателя', 'DestExecDocType', 'Тип ДИ получателя', 'Тип ДИ получателя', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101048, 'Сумма по ДИ получателя', 'DestExecDocSumma', 'Сумма по ДИ получателя', 'Сумма по ДИ получателя', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101049, 'Примечание ДИ получателя', 'DestExecDocNote', 'Примечание ДИ получателя', 'Примечание ДИ получателя', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101050, 'Бюджетное обязательство плательщика', 'SourceBudgetPromiseCollaps', 'Бюджетное обязательство плательщика', 'SourceBudgetPromiseCollaps', 0, 301, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30101051, 'Сумма БО плательщика', 'SourceBudgetPromiseSumma', 'Сумма БО плательщика', 'SourceBudgetPromiseSumma', 0, 301, 1, 1, 'ДоговораБОПлатСумма', 0, null) ;

CALL ImportField(30101052, 'Номер договора плательщика', 'SourceBudgetPromiseDocNumber', 'Номер договора плательщика', 'SourceBudgetPromiseDocNumber', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101053, 'Дата договора плательщика', 'SourceBudgetPromiseDocDate', 'Дата договора плательщика', 'SourceBudgetPromiseDocDate', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101054, 'Сумма договора плательщика', 'SourceBudgetPromiseDocSumma', 'Сумма договора плательщика', 'SourceBudgetPromiseDocSumma', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101055, 'Реестровый номер дог.', 'SourceBudgetPromiseDocReestrNum', 'Реестровый номер дог.', 'SourceBudgetPromiseDocReestrNum', 0, 301, 1, 0, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(30101056, 'Дог. примечание плательщика', 'SourceBudgetPromiseDocNote', 'Дог. примечание плательщика', 'SourceBudgetPromiseDocNote', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101057, 'Номер гос. контракта плательщика', 'SourceBudgetPromiseSONum', 'Номер гос. контракта плательщика', 'SourceBudgetPromiseSONum', 0, 301, 1, 1, 'ДоговораБОПлатНомерКонтракта', 0, null) ;

CALL ImportField(30101058, 'Дата гос. контракта плательщика', 'SourceBudgetPromiseSODate', 'Дата гос. контракта плательщика', 'SourceBudgetPromiseSODate', 0, 301, 1, 1, 'ДоговораБОПлатДатаКонтракта', 0, null) ;

CALL ImportField(30101059, 'Сумма гос. контракта плательщика', 'SourceBudgetPromiseSOSumma', 'Сумма гос. контракта плательщика', 'SourceBudgetPromiseSOSumma', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101060, 'Реестровый номер гос. контр плательщика', 'SourceBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр плательщика', 'SourceBudgetPromiseSOReestrNum', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101061, 'Прим. гос. контракта плательщика', 'SourceBudgetPromiseSONote', 'Прим. гос. контракта плательщика', 'SourceBudgetPromiseSONote', 0, 301, 1, 1, 'ДоговораБОПлатПримечаниеКонтракта', 0, null) ;

CALL ImportField(30101062, 'Бюджетное обязательство получателя', 'DestBudgetPromiseCollaps', 'Бюджетное обязательство получателя', 'DestBudgetPromiseCollaps', 0, 301, 1, 0, '', 0, null) ;

CALL ImportField(30101063, 'Сумма БО получателя', 'DestBudgetPromiseSumma', 'Сумма БО получателя', 'DestBudgetPromiseSumma', 0, 301, 1, 1, 'ДоговораБОПолучСумма', 0, null) ;

CALL ImportField(30101064, 'Номер договора  получателя', 'DestBudgetPromiseDocNumber', 'Номер договора получателя', 'DestBudgetPromiseDocNumber', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101065, 'Дата договора получателя', 'DestBudgetPromiseDocDate', 'Дата договора получателя', 'DestBudgetPromiseDocDate', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101066, 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101067, 'Реестровый номер дог. получателя', 'DestBudgetPromiseDocReestrNum', 'Реестровый номер дог. получателя', 'DestBudgetPromiseDocReestrNum', 0, 301, 1, 0, '', 0, null) ;

CALL ImportField(30101068, 'Дог. примечание получателя', 'DestBudgetPromiseDocNote', 'Дог. примечание получателя', 'DestBudgetPromiseDocNote', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101069, 'Номер гос. контракта получателя', 'DestBudgetPromiseSONum', 'Номер гос. контракта получателя', 'DestBudgetPromiseSONum', 0, 301, 1, 1, 'ДоговораБОПолучНомерКонтракта', 0, null) ;

CALL ImportField(30101070, 'Дата гос. контракта получателя', 'DestBudgetPromiseSODate', 'Дата гос. контракта получателя', 'DestBudgetPromiseSODate', 0, 301, 1, 1, 'ДоговораБОПолучДатаКонтракта', 0, null) ;

CALL ImportField(30101071, 'Сумма гос. контракта получателя', 'DestBudgetPromiseSOSumma', 'Сумма гос. контракта получателя', 'DestBudgetPromiseSOSumma', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101072, 'Реестровый номер гос. контр  получателя', 'DestBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр получателя', 'DestBudgetPromiseSOReestrNum', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101073, 'Прим. гос. контракта  получателя', 'DestBudgetPromiseSONote', 'Прим. гос. контракта получателя', 'DestBudgetPromiseSONote', 0, 301, 1, 1, 'ДоговораБОПолучПримечаниеКонтракта', 0, null) ;

CALL ImportField(30101074, 'Код записи', 'Id', 'Код записи', 'Id', 0, 301, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(30101075, 'Код ФО записи', 'FUID', 'Код ФО записи', 'FUID', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101076, 'Код УРМ записи', ' ', 'Код УРМ записи', 'SenderRecordID', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101077, 'Код отправителя записи', ' ', 'Код отправителя записи', 'SenderID', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101078, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 301, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(30101079, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 301, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30101080, 'Бух операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 0, 301, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(30101081, 'Тип классификации', 'ClsType', 'Признак классификации', 'ClsType', 0, 301, 1, 1, 'ТипКлассификации,ТипКлассификацииПлат', 0, null) ;

CALL ImportField(30101085, 'Тип документа получателя', 'DestDOCTYPE', 'Тип документа получателя', 'DestDOCTYPECLS', 0, 301, 1, 0, 'DESTDocType,ТипДокументаПолуч', 0, null) ;

CALL ImportField(30101086, 'ИВФ получ-ля (Ключ)', 'DestIFS', 'Классификация получателя', 'DestIFS', 0, 301, 1, 1, 'DestIFS,ИсточникВнутрФинансированияКлючПолуч', 0, null) ;

CALL ImportField(30101089, 'Договора БО плательщика', 'SourceBUDGETPROMISE', 'Договора БО плательщика', 'SourceBUDGETPROMISE', 0, 301, 1, 1, 'БОВнутрНомер,ДоговораБОПлат', 0, null) ;

CALL ImportField(30101090, 'л\с плательщика', 'SourceFacialAcc_Cls', 'л\с плательщика', 'SourceFacialAccCls', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101091, 'Тип документа плательщика', 'SourceDOCTYPE', 'Тип документа плательщика', 'SourceDOCTYPECLS', 0, 301, 1, 0, 'ТипДокумента,ТипДокументаПлат', 0, null) ;

CALL ImportField(30101092, 'Классификация плательщика', 'SourceIFS', 'Классификация плательщика', 'SourceIFS', 0, 301, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПлат', 0, null) ;

CALL ImportField(30101093, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101102, 'Район получателя', 'DestRegionCls', 'Район получателя', 'DestRegionCls', 0, 301, 1, 0, 'DestRegionCls,РегионПолуч,РайонТрансфертаПолуч', 0, null) ;

CALL ImportField(30101105, 'Район плательщика', 'SourceRegionCls', 'Район плательщика', 'SourceRegionCls', 0, 301, 1, 0, 'Регион,РегионПлат,РайонТрансферта,РайонТрансфертаПлат', 0, null) ;

CALL ImportField(30101124, 'Классификация плательщика', 'TreeOwner0', 'Классификация плательщика', ' ', 0, 301, 1, 0, '', 0, null) ;

CALL ImportField(30101125, 'Классификация получателя', 'TreeOwner1', 'Классификация получателя', ' ', 0, 301, 1, 0, '', 0, null) ;

CALL ImportField(30101135, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101150, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств получателя (ссылка)', 'DestTransfertCls', 0, 301, 1, 1, 'КодЦелевыхСредствКлючПолуч', 0, null) ;

CALL ImportField(30101151, 'Код целевых средств получ-ля', 'DestTransfertClsCode', 'Код целевых средств получателя', 'DestTransfertClsValue', 0, 301, 1, 0, 'КодЦелевыхСредствПолуч', 0, null) ;

CALL ImportField(30101152, 'Код целевых средствКлюч', 'SourceTransfertCls', 'Код целевых средств плательщика (ссылка)', 'SourceTransfertCls', 0, 301, 1, 1, 'КодЦелевыхСредствКлюч,КодЦелевыхСредствКлючПлат', 0, null) ;

CALL ImportField(30101153, 'Код целевых средств плат.', 'SourceTransfertClsCode', 'Код целевых средств плательщика', 'SourceTransfertClsValue', 0, 301, 1, 0, 'КодЦелевыхСредств,КодЦелевыхСредствПлат', 0, null) ;

CALL ImportField(30101154, 'КЦСР получ-ля(Классификация получ-ля)', 'DestKCSRCode', '', 'DestKCSR', 0, 301, 1, 0, 'КЦСРПолуч,DestKCSRCode', 0, null) ;

CALL ImportField(30101155, 'КВР получ-ля(Классификация получ-ля)', 'DESTKVRCode', '', 'DestKVR', 0, 301, 1, 0, 'КВРПолуч,DESTKVRCode', 0, null) ;

CALL ImportField(30101156, 'КВСР получ-ля', 'DestKVSRCode', 'КВСР получ-ля', 'DestKVSR', 0, 301, 1, 0, 'КВСРПолуч,DestKVSRCode', 0, null) ;

CALL ImportField(30101157, 'КЦСР плат.(Классификация плат.)', 'SourceKCSRCode', '', 'SourceKCSR', 0, 301, 1, 0, 'КЦСР,КЦСРПлат,SourceKCSRCode', 0, null) ;

CALL ImportField(30101158, 'КВР плат.(Классификация плат.)', 'SOURCEKVRCode', '', 'SourceKVR', 0, 301, 1, 0, 'КВР,КВРПлат,SOURCEKVRCode', 0, null) ;

CALL ImportField(30101159, 'КВСР плат.', 'SourceKVSRCode', 'КВСР плат.', 'SourceKVSR', 0, 301, 1, 0, 'КВСР,КВСРПлат,SourceKVSRCode', 0, null) ;

CALL ImportField(30101161, 'Получатель', 'DestFacialAccName', 'Получатель', ' ', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101162, 'КД получ-ля (Ключ)', 'DestKD', 'КД Ключ', 'DestKD', 0, 301, 1, 1, 'DestKD,КДКлючПолуч', 0, null) ;

CALL ImportField(30101163, 'ИВФ получ-ля', 'DestIFSCode', 'Вид источника(расходный источник)', 'DestIFS_DescriptionCode', 0, 301, 1, 0, 'DestIFS_FullID,ИсточникВнутрФинансированияПолуч', 0, null) ;

CALL ImportField(30101165, 'КД получ-ля', 'DestKDCode', 'КД Классфикатор', 'DestKDValue', 0, 301, 1, 0, 'КодДоходаПолуч', 0, null) ;

CALL ImportField(30101166, 'КД плат. (Ключ)', 'SourceKD', 'КД плат. (Ключ)', 'SourceKD', 0, 301, 1, 1, 'КДКлюч,КДКлючПлат', 0, null) ;

CALL ImportField(30101167, 'КД плат.', 'SourceKDCode', 'КД плат.', 'SourceKDValue', 0, 301, 1, 0, 'КодДохода,КодДоходаПлат', 0, null) ;

CALL ImportField(30101169, 'ИВФ плат.', 'SourceIFSCode', 'ИВФ плат.', 'SourceIFS_DescriptionCode', 0, 301, 1, 0, 'ИсточникВнутрФинансированияПлат,ИсточникВнутрФинансирования', 0, null) ;

CALL ImportField(30101170, 'Код цели плат.', 'SourceTargetCLS', 'Код цели плат.', ' ', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101171, 'Код цели получ-ля', 'DestTargetCLS', 'Код цели получ-ля', ' ', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101172, 'ИД контракта плат.', 'SourceBudgetPromiseSOID', 'ИД контракта плат.', ' ', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101173, 'ИД контракта получ-ля', 'DestBudgetPromiseSOID', 'ИД контракта получ-ля', ' ', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101174, 'Источник образования плат.', 'SourceFundsSource', '', ' ', 0, 301, 1, 0, 'ИсточникОбразованияСредств,ИсточникОбразованияСредствПлат', 0, null) ;

CALL ImportField(30101175, 'Источник образования получ-ля', 'DestFundsSource', '', ' ', 0, 301, 1, 0, 'ИсточникОбразованияСредствПолуч', 0, null) ;

CALL ImportField(30101176, 'Код субсидии получ-ляКлюч', 'DestSubsidyCls', 'Код субсидии получател (ссылка)', 'DestSubsidyCls', 0, 301, 1, 1, 'КодСубсидииКлючПолуч', 0, null) ;

CALL ImportField(30101177, 'Код субсидии получ-ля', 'DestSubsidyClsCode', 'Код субсидии получателя', 'DestSubsidyClsCode', 0, 301, 1, 0, 'КодСубсидииПолуч', 0, null) ;

CALL ImportField(30101178, 'Код субсидии плат.Ключ', 'SourceSubsidyCls', 'Код субсидии плательщика (ссылка)', 'SourceSubsidyCls', 0, 301, 1, 1, 'КодСубсидииКлюч,КодСубсидииКлючПлат', 0, null) ;

CALL ImportField(30101179, 'Код субсидии плат.', 'SourceSubsidyClsCode', 'Код субсидии плательщика', 'SourceSubsidyClsCode', 0, 301, 1, 0, 'КодСубсидии,КодСубсидииПлат', 0, null) ;

CALL ImportField(30101180, 'Район бюджетного учреждения', 'DestRegionBudgetEst', 'Район бюджетного учреждения плательщика', 'DestRegionBudgetEst', 0, 301, 1, 1, '', 0, null) ;

CALL ImportField(30101181, 'Код бюджетного ассигнования получ-ля', 'DestBudAllocationClsCode', '', ' ', 0, 301, 1, 0, 'КодБюджАссигнованияПолуч', 0, null) ;

CALL ImportField(30101182, 'Код расходного обязательства получ-ля', 'DestPayPromiseClsCode', '', ' ', 0, 301, 1, 0, 'КодРасходногоОбязательстваПолуч', 0, null) ;

CALL ImportField(30101183, 'Код бюджетного ассигнования плат.', 'SourceBudAllocationClsCode', '', ' ', 0, 301, 1, 0, 'КодБюджАссигнованияПлат', 0, null) ;

CALL ImportField(30101184, 'Код расходного обязательства плат.', 'SourcePayPromiseClsCode', '', ' ', 0, 301, 1, 0, 'КодРасходногоОбязательстваПлат', 0, null) ;

CALL ImportField(30101185, 'Код бюджетного ассигнования получ-ля (ключ)', 'DestBudAllocationCls', '', ' ', 0, 301, 1, 1, 'КодБюджАссигнованияКлючПолуч', 0, null) ;

CALL ImportField(30101186, 'Код расходного обязательства получ-ля (ключ)', 'DestPayPromiseCls', '', ' ', 0, 301, 1, 1, 'КодРасходногоОбязательстваКлючПолуч', 0, null) ;

CALL ImportField(30101187, 'Код бюджетного ассигнования плат. (ключ)', 'SourceBudAllocationCls', '', ' ', 0, 301, 1, 1, 'КодБюджАссигнованияКлючПлат', 0, null) ;

CALL ImportField(30101188, 'Код расходного обязательства плат. (ключ)', 'SourcePayPromiseCls', '', ' ', 0, 301, 1, 1, 'КодРасходногоОбязательстваКлючПлат', 0, null) ;

-- Внутренняя переброска, Бюджет(1)
CALL ImportField(30110001, 'Л/С плательщика в ФК', 'SourceFacialCode', 'Лицевой счет плательщика в ФК', 'SourceFacialAccClsFacialCode', 1, 301, 0, 0, '', 0, null) ;

CALL ImportField(30110002, 'Номер документа', 'DocNumber', 'Номер документа', 'DocumentNumber', 1, 301, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(30110003, 'Л/с плательщика', 'SOURCEFACIALACC_CLS', 'Лицевой счет плательщика', 'SOURCEFACIALACCCLS', 1, 301, 0, 0, 'ЛицевойСчет,ЛицСчетПлательщика', 0, 18957) ;

CALL ImportField(30110004, 'Сумма (заголовок)', 'Summa', 'Сумма (заголовок)', 'Summa', 1, 301, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(30110005, 'Назначение платежа (заголовок)', 'Note', 'Назначение платежа (заголовок)', 'Note', 1, 301, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(30110006, 'Дата проводки', 'AcceptDate', 'Дата принятия', 'AcceptDate', 1, 301, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(30110007, 'Вид учета (старый)', 'BuhPaymentCls', 'Бухгалтерская операция', 'BuhPaymentCls', 1, 301, 0, 0, 'БухПроводка', 0, 18968) ;

CALL ImportField(30110008, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 1, 301, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(30110009, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 301, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(30110010, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 301, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(30110011, 'Казначейский счет', 'SourceAccountName', 'Казначейский счет', 'SourceAccountName', 1, 301, 0, 0, '', 0, 17112) ;

CALL ImportField(30110012, 'Номер мем. ордера(заголовок)', 'MemOrderNum', 'Номер мем. ордера', ' ', 1, 301, 0, 0, '', 0, null) ;

CALL ImportField(30110013, 'Федеральные средства(код)', 'FEDERALFUNDSREF', 'Федеральные средства(код)', 'FederalFundsRef', 1, 301, 0, 1, 'ФедеральныеСредства', 0, 19004) ;

CALL ImportField(30110014, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Федеральные средства', 'FEDERALFUNDSREESTR', 1, 301, 0, 0, '', 0, null) ;

CALL ImportField(30110015, 'Архив', 'ARHIVEDOC', 'Архив', 'ARHIVEDOC', 1, 301, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(30110016, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 1, 301, 0, 1, 'ВидПлатежа', 0, 18963) ;

CALL ImportField(30110017, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 1, 301, 0, 1, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(30110018, 'Номер реестра', 'REESTRNUMBER', 'Номер реестра', 'REESTRNUMBER', 1, 301, 0, 0, 'НомерРеестра', 0, 19090) ;

CALL ImportField(30110019, 'Дата документа', 'DocumentDate', 'Дата документа', 'DocumentDate', 1, 301, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(30110020, 'Срок платежа', 'PAYDATE', 'Срок платежа', 'PAYDATE', 1, 301, 0, 1, 'СрокПлатежа', 0, 18951) ;

CALL ImportField(30110021, 'Код документа', 'ID', 'Код документа', 'ID', 1, 301, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(30110022, 'Код ФО документа', ' ', 'Код ФО документа', 'FUID', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110023, 'Код УРМ документа', 'SenderRecordID', 'Код УРМ документа', 'SenderRecordID', 1, 301, 0, 1, 'КодУРМДокумента', 0, 18970) ;

CALL ImportField(30110024, 'Код удаленного клиента', 'SenderID', 'Код отправителя документа', 'SenderID', 1, 301, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(30110026, 'Очередность', 'PayPriority', 'Очередность', 'PayPriority', 1, 301, 0, 1, 'Очередность', 0, 18966) ;

CALL ImportField(30110027, 'Номер карточки', ' ', 'Номер карточки', 'CARDNUMBER', 1, 301, 0, 0, '', 1, null) ;

CALL ImportField(30110028, 'Ссылка на р/c плательщика', 'SOURCEACCOUNT', 'Ссылка на р/c плательщика', 'SOURCEACCOUNT', 1, 301, 0, 1, 'СчетПлат,РСФО', 0, 18956) ;

CALL ImportField(30110029, 'Ссылка на счет организации-получателя', 'DESTACCOUNT', 'Ссылка на счет организации-получателя', 'DESTACCOUNT', 1, 301, 0, 1, 'СчетПолуч', 0, 18958) ;

CALL ImportField(30110030, 'л\с получателя', ' ', 'л\с получателя', 'DestFacialAccCls', 1, 301, 0, 0, '', 1, null) ;

CALL ImportField(30110031, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 1, 301, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(30110032, 'Начальное состояние документа', ' ', 'Начальное состояние документа', 'BeginDocStateRef', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110033, 'Есть в Бюджете', ' ', 'Есть в Бюджете', 'IsInBudget', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110034, 'Признак зависания', ' ', 'Признак зависания', 'DocSuspended', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110035, 'Локальная виза', ' ', 'Локальная виза', 'IsVised', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110036, 'Номер заявки', ' ', 'Номер заявки', 'BidNumber', 1, 301, 0, 0, '', 1, null) ;

CALL ImportField(30110037, 'Локальный реестр', ' ', 'Локальный реестр', 'ManagerBid', 1, 301, 0, 0, '', 1, null) ;

CALL ImportField(30110038, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110039, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110042, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110043, 'Код реестра', 'Reestr_Ref', 'Код реестра', 'Reestr_Ref', 1, 301, 0, 1, 'КодРеестра', 0, 18971) ;

CALL ImportField(30110044, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 301, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(30110045, 'Отдел', ' ', 'Отдел', 'DEPARTMENTCLS', 1, 301, 0, 0, '', 1, null) ;

CALL ImportField(30110046, 'Мягкая причина отклонения', ' ', 'Мягкая причина отклонения', 'SoftRejectCls', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110047, 'Текст мягкой причины отклонения', ' ', 'Текст мягкой причины отклонения', 'SoftRejectCause', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110048, 'Ссылка на счет получателя ФО', ' ', 'Ссылка на счет получателя ФО', 'DestAccountFUID', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110049, 'Ссылка на счет получателя', 'DestAccountName', 'Ссылка на счет получателя', 'DestAccountName', 1, 301, 0, 1, '', 0, null) ;

CALL ImportField(30110050, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110051, 'Субсчет получателя', ' ', 'Субсчет получателя', 'DestFKFacialCode', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110052, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110053, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110054, 'ИНН организации-получателя', ' ', 'ИНН организации-получателя', 'DestOrgINN', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110055, 'КПП организации-получателя', ' ', 'КПП организации-получателя', 'DestOrgKPP', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110056, 'Наименование организации-получателя', ' ', 'Наименование организации-получателя', 'DestOrgName', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110057, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110058, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110059, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110060, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110061, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110062, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110063, 'Имя л\с получателя', ' ', 'Имя л\с получателя', 'DestFacialAccClsName', 1, 301, 0, 0, '', 1, null) ;

CALL ImportField(30110064, 'мнемокод л\с получателя', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 1, 301, 0, 0, '', 1, null) ;

CALL ImportField(30110065, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110066, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110067, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110068, 'Организация ФК получателя(код)', ' ', 'Организация ФК получателя(код)', 'DestFKOrgId', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110069, 'Организация ФК получателя ФО', ' ', 'Организация ФК получателя ФО', 'DestFKOrgFUID', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110070, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110071, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110072, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110073, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110074, 'Ссылка на р/c ФО плательщика', ' ', 'Ссылка на р/c ФО плательщика', 'SourceAccountFUID', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110075, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110076, 'Субсчет плательщика', ' ', 'Субсчет плательщика', 'SourceFKFacialCode', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110077, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110078, 'Ссылка на организацию плательщика(для УРМ)', ' ', 'Ссылка на организацию плательщика(для УРМ)', 'SourceOrgFUID', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110079, 'ИНН организации-плательщика', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110080, 'КПП организации-плательщика', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110081, 'Наименование организации-плательщика', ' ', 'Наименование организации-плательщика', 'SourceOrgName', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110082, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110083, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110084, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110085, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110086, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110087, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110088, 'л\с плательщика', ' ', 'л\с плательщика', 'SourceFacialAccClsName', 1, 301, 0, 0, '', 1, null) ;

CALL ImportField(30110089, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110090, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110091, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110092, 'Организация ФК плательщика(код)', ' ', 'Организация ФК плательщика(код)', 'SourceFKOrgId', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110093, 'Организация ФК ФО плательщика', ' ', 'Организация ФК ФО плательщика', 'SourceFKOrgFUID', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110094, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110095, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110096, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110097, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 1, 301, 0, 1, '', 1, null) ;

CALL ImportField(30110098, 'Направление операции', 'OperationDirection', 'Направление операции', 'OPERATIONDIRECTION', 1, 301, 0, 0, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(30110099, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 301, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(30110110, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 1, 301, 0, 0, 'ТипКлассификацииЗаголовок', 0, 19008) ;

CALL ImportField(30110126, 'Признак принятости реестра', 'Accepted', 'Признак принятости реестра', 'Accepted', 1, 301, 0, 1, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(30110132, 'Счетчик факсов', 'FaxDocCount', 'Счетчик факсов', ' ', 1, 301, 0, 1, '', 0, null) ;

CALL ImportField(30110133, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'Progindex', 1, 301, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(30110134, 'Отдел', 'DepartmentCLS', 'Отдел', 'DEPARTMENTCLS', 1, 301, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(30110135, 'Номер л/с плательщика', 'SourceFacialCodeEx', '', ' ', 1, 301, 0, 0, '', 0, 26617) ;

CALL ImportField(30111001, 'Тип документа получ-ля', 'DESTDocType', 'Тип документа получателя', 'DestDOCTYPECLS', 1, 301, 1, 0, 'DESTDocType,ТипДокументаПолуч', 0, 18903) ;

CALL ImportField(30111002, '№ БО плательщика', 'SourcePromise', 'Номер БО плательщика', 'SourcePromise', 1, 301, 1, 0, 'БюджОбяз,БюджОбязПлат', 0, 18905) ;

CALL ImportField(30111003, 'Сумма по строке детализации', 'Summa', 'Сумма по строке детализации', 'Summa', 1, 301, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(30111004, 'КВР плат.Ключ', 'SourceKVR', 'КВР плательщика', 'SourceKVRKey', 1, 301, 1, 1, 'SourceKVR,КВРКлюч', 0, 18867) ;

CALL ImportField(30111005, 'ЭКР плат.(Классификация плат.)', 'SourceKESR', 'КЭСР плательщика', 'SourceKESR', 1, 301, 1, 0, 'КЭСР,КЭСРПлат', 0, 18868) ;

CALL ImportField(30111006, 'ФКР плат.(Классификация плат.)', 'SourceKFSR', 'КФСР плательщика', 'SourceKFSR', 1, 301, 1, 0, 'КФСР,КФСРПлат', 0, 18888) ;

CALL ImportField(30111007, 'КЦСР плат.Ключ', 'SourceKCSR', 'КЦСР плательщика', 'SourceKCSRKey', 1, 301, 1, 1, 'SourceKCSR,КЦСРКлюч', 0, 18887) ;

CALL ImportField(30111008, 'КВСР плат.Ключ', 'SourceKVSR', 'КВСР плательщика', 'SourceKVSRKey', 1, 301, 1, 1, 'SourceKVSR,КВСРКлюч', 0, 18886) ;

CALL ImportField(30111009, 'Суб КОСГУ плат.', 'SourceSubKESR', 'Суб. КЭСР плательщика', 'SourceSubKESR', 1, 301, 1, 0, 'СубКЭСР,СубКЭСРПлат', 0, 18889) ;

CALL ImportField(30111011, 'Тип средств плат.', 'SourceMeansType', 'Тип средств плательщика', 'SourceMEANSTYPECLS', 1, 301, 1, 0, 'ТипСредств,ТипСредствПлат', 0, 18891) ;

CALL ImportField(30111013, 'Источник фин-я плат.', 'SourceFinSource', 'Источник финансирования плательщика', 'SourceFINSOURCECLS', 1, 301, 1, 0, 'ИсточникФинансирования,ИсточникФинансированияПлат', 0, 18892) ;

CALL ImportField(30111014, 'Л/с получателя', 'DestFacialAcc_Cls', 'Лицевой счет получателя', 'DestFacialAccCls', 1, 301, 1, 0, 'ЛицСчетПолучателя,DestFacialACCCLS', 0, 18869) ;

CALL ImportField(30111015, 'Л/С получателя в ФК', 'DestFacialCode', 'Лицевой счет получателя в ФК', ' ', 1, 301, 1, 0, '', 0, null) ;

CALL ImportField(30111016, 'КВР получ-ляКлюч', 'DestKVR', 'КВР получателя', 'DestKVRKey', 1, 301, 1, 1, 'DestKVR,КВРКлючПолуч', 0, 18870) ;

CALL ImportField(30111017, 'ЭКР получ-ля(Классификация получ-ля)', 'DestKESR', 'КЭСР получателя', 'DestKESR', 1, 301, 1, 0, 'DestKESR,КЭСРПолуч', 0, 18871) ;

CALL ImportField(30111018, 'ФКР получ-ля(Классификация получ-ля)', 'DestKFSR', 'КФСР получателя', 'DestKFSR', 1, 301, 1, 0, 'DestKFSR,КФСРПолуч', 0, 18897) ;

CALL ImportField(30111019, 'КЦСР получ-ляКлюч', 'DestKCSR', 'КЦСР получателя', 'DestKCSRKey', 1, 301, 1, 1, 'DestKCSR,КЦСРКлючПолуч', 0, 18896) ;

CALL ImportField(30111020, 'КВСР получ-ляКлюч', 'DestKVSR', 'КВСР получателя', 'DestKVSRKey', 1, 301, 1, 1, 'DestKVSR,КВСРКлючПолуч', 0, 18895) ;

CALL ImportField(30111021, 'Суб КОСГУ получ-ля', 'DestSubKESR', 'Суб. КЭСР получателя', 'DestSubKESR', 1, 301, 1, 0, 'DestSubKESR,СубКЭСРПолуч', 0, 18898) ;

CALL ImportField(30111023, 'Тип средств получ-ля', 'DestMeansType', 'Тип средств получателя', 'DestMEANSTYPECLS', 1, 301, 1, 0, 'DestMeansType,ТипСредствПолуч', 0, 18900) ;

CALL ImportField(30111025, 'Источник фин-я получ-ля', 'DestFinSource', 'Источник финансирования получателя', 'DestFINSOURCECLS', 1, 301, 1, 0, 'DestFinSource,ИсточникФинансированияПолуч', 0, 18901) ;

CALL ImportField(30111026, 'Примечание по строке детализации', 'Note', 'Примечание по строке детализации', 'Note', 1, 301, 1, 0, 'ПримечаниеДеталь', 0, 18876) ;

CALL ImportField(30111027, '№ мем. ордера', 'MemOrderNum', 'Номер мем. ордера', 'MemOrderNum', 1, 301, 1, 0, 'НомерМемордера', 0, 18875) ;

CALL ImportField(30111028, '№ БО получателя', 'DestPromise', 'Номер БО получателя', 'DestPromise', 1, 301, 1, 0, 'DestPromise,БюджОбязПолуч', 0, 18906) ;

CALL ImportField(30111033, 'Классификация плательщика', 'TreeOwner0', 'Классификация плательщика', ' ', 1, 301, 1, 0, '', 0, null) ;

CALL ImportField(30111034, 'Классификация получателя', 'TreeOwner1', 'Классификация получателя', ' ', 1, 301, 1, 0, '', 0, null) ;

CALL ImportField(30111035, 'Номер БО плательщика(договора)', 'SOURCEBUDGETPROMISENUM', 'Номер БО плательщика(договора)', 'SOURCEBUDGETPROMISENUM', 1, 301, 1, 0, 'БОНомер,ДоговораБОПлатНомер', 0, 20223) ;

CALL ImportField(30111036, 'Номер БО получателя(договора)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', 'DESTBUDGETPROMISENUM', 1, 301, 1, 0, 'DESTBUDGETPROMISENUM,ДоговораБОПолучНомер', 0, 20223) ;

CALL ImportField(30111037, 'Код записи', 'Id', 'Код записи', 'Id', 1, 301, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(30111038, 'Код ФО записи', ' ', 'Код ФО записи', 'FUID', 1, 301, 1, 1, '', 1, null) ;

CALL ImportField(30111039, 'Код УРМ записи', ' ', 'Код УРМ записи', 'SenderRecordID', 1, 301, 1, 1, '', 1, null) ;

CALL ImportField(30111040, 'Код отправителя записи', ' ', 'Код отправителя записи', 'SenderID', 1, 301, 1, 1, '', 1, null) ;

CALL ImportField(30111042, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 1, 301, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(30111043, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Документ исполнения получателя', 'DestExecDoc', 1, 301, 1, 1, 'ДокИсполненияПолуч', 0, 18918) ;

CALL ImportField(30111044, 'Вн. номер БО получателя', 'DestBUDGETPROMISE', 'Договора БО получателя', 'DestBUDGETPROMISE', 1, 301, 1, 1, 'DestBUDGETPROMISE,ДоговораБОПолуч', 0, 18909) ;

CALL ImportField(30111045, 'Номер Д.И. плательщика ссылка', 'SourceExecDoc', 'Документ исполнения плательщика', 'SourceExecDoc', 1, 301, 1, 1, 'ДокИсполнения,ДокИсполненияПлат', 0, 18917) ;

CALL ImportField(30111046, 'Вн. номер БО плательщика', 'SourceBUDGETPROMISE', 'Договора БО плательщика', 'SourceBUDGETPROMISE', 1, 301, 1, 1, 'БОВнутрНомер,ДоговораБОПлат', 0, 18908) ;

CALL ImportField(30111047, 'л\с плательщика', ' ', 'л\с плательщика', 'SourceFacialAccCls', 1, 301, 1, 1, '', 1, null) ;

CALL ImportField(30111048, 'Тип документа плат.', 'SourceDOCTYPE', 'Тип документа плательщика', 'SourceDOCTYPECLS', 1, 301, 1, 0, 'ТипДокумента,ТипДокументаПлат', 0, 18894) ;

CALL ImportField(30111049, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 1, 301, 1, 1, '', 1, null) ;

CALL ImportField(30111050, 'Бух операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 1, 301, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(30111051, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'ClsType', 1, 301, 1, 1, 'ТипКлассификации,ТипКлассификацииПлат', 0, 18922) ;

CALL ImportField(30111052, 'Вид источника(Классификация получ-ля)', 'DestIFS_DescriptionCode', 'Источник внутреннего финансирвания дефицита бюджета получателя', 'DestIFS_DescriptionCode', 1, 301, 1, 0, '', 0, 17050) ;

CALL ImportField(30111053, 'Вид источника(Классификация плат.)', 'SourceIFS_DescriptionCode', 'Источник внутреннего финансирвания дефицита бюджета плательщика', 'SourceIFS_DescriptionCode', 1, 301, 1, 0, '', 0, 17050) ;

CALL ImportField(30111054, '№ бюдж. обязат-ва плательщика', 'SourceBudgetPromiseCollaps', 'Бюджетное обязательство плательщика', ' ', 1, 301, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30111055, 'Сумма БО плательщика', 'SourceBudgetPromiseSumma', 'Сумма БО плательщика', 'SourceBudgetPromiseSumma', 1, 301, 1, 1, 'ДоговораБОПлатСумма', 0, 20242) ;

CALL ImportField(30111056, 'Номер договора плательщика', 'SourceBudgetPromiseAgrNum', 'Номер договора плательщика', 'SourceBudgetPromiseAgrNum', 1, 301, 1, 1, 'ДоговораБОПлатНомерДоговора', 0, null) ;

CALL ImportField(30111057, 'Дата договора плательщика', 'SourceBudgetPromiseAgrDate', 'Дата договора', 'SourceBudgetPromiseAgrDate', 1, 301, 1, 1, 'ДоговораБОПлатДатаДоговора', 0, null) ;

CALL ImportField(30111058, 'Сумма договора плательщика', 'SourceBudgetPromiseAgrSumma', 'Сумма договора плательщика', 'SourceBudgetPromiseAgrSumma', 1, 301, 1, 1, '', 0, null) ;

CALL ImportField(30111059, 'Реестровый номер дог.', 'SourceBudgetPromiseAgrRNum', 'Реестровый номер дог.', 'SourceBudgetPromiseAgrReestrNum', 1, 301, 1, 1, 'ДоговораБОПлатРеестрНомерДоговора,ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(30111060, 'Дог. примечание плательщика', 'SourceBudgetPromiseAgrNote', 'Дог. примечание плательщика', 'SourceBudgetPromiseAgrNote', 1, 301, 1, 1, 'ДоговораБОПлатПримечаниеДоговора', 0, null) ;

CALL ImportField(30111061, 'Номер гос. контракта плательщика', 'SourceBudgetPromiseSONum', 'Номер гос. контракта плательщика', 'SourceBudgetPromiseAgrNum', 1, 301, 1, 1, 'ДоговораБОПлатНомерКонтракта', 0, 19798) ;

CALL ImportField(30111062, 'Дата гос. контракта плательщика', 'SourceBudgetPromiseSODate', 'Дата гос. контракта', 'SourceBudgetPromiseAgrDate', 1, 301, 1, 1, 'ДоговораБОПлатДатаКонтракта', 0, 19799) ;

CALL ImportField(30111063, 'Сумма гос. контракта плательщика', 'SourceBudgetPromiseSOSumma', 'Сумма гос. контракта плательщика', ' ', 1, 301, 1, 1, '', 0, null) ;

CALL ImportField(30111064, 'Реестровый номер гос. контр плательщика', 'SourceBudgetPromiseSORNum', 'Реестровый номер гос. контр плательщика', 'SourceBudgetPromiseAgrReestrNum', 1, 301, 1, 1, 'ДоговораБОПлатРеестрНомерКонтракта', 0, 19830) ;

CALL ImportField(30111065, 'Прим. гос. контракта плательщика', 'SourceBudgetPromiseSONote', 'Прим. гос. контракта плательщика', 'SourceBudgetPromiseAgrNote', 1, 301, 1, 1, 'ДоговораБОПлатПримечаниеКонтракта', 0, 19821) ;

CALL ImportField(30111066, '№ бюдж. обязат-ва получателя', 'DestBudgetPromiseCollaps', 'Бюджетное обязательство получателя', ' ', 1, 301, 1, 0, '', 0, null) ;

CALL ImportField(30111067, 'Сумма БО получателя', 'DestBudgetPromiseSumma', 'Сумма БО получателя', 'DestBudgetPromiseSumma', 1, 301, 1, 1, 'ДоговораБОПолучСумма', 0, 20242) ;

CALL ImportField(30111068, 'Номер договора получателя', 'DestBudgetPromiseAgrNum', 'Номер договора получателя', 'DestBudgetPromiseAgrNum', 1, 301, 1, 1, 'ДоговораБОПолучНомерДоговора', 0, null) ;

CALL ImportField(30111069, 'Дата договора получателя', 'DestBudgetPromiseAgrDate', 'Дата договора получателя', 'DestBudgetPromiseAgrDate', 1, 301, 1, 1, 'ДоговораБОПолучДатаДоговора', 0, null) ;

CALL ImportField(30111070, 'Сумма договора получателя', 'DestBudgetPromiseAgrSumma', 'Сумма договора получателя', 'DestBudgetPromiseAgrSumma', 1, 301, 1, 1, '', 0, null) ;

CALL ImportField(30111071, 'Реестр. номер документа(№ бюдж. обязат-ва получателя)', 'DestBudgetPromiseAgrRNum', 'Реестровый номер дог', 'DestBudgetPromiseAgrReestrNum', 1, 301, 1, 1, 'ДоговораБОПолучРеестрНомерДоговора', 0, null) ;

CALL ImportField(30111072, 'Дог. примечание получателя', 'DestBudgetPromiseAgrNote', 'Дог. примечание получателя', 'DestBudgetPromiseAgrNote', 1, 301, 1, 1, 'ДоговораБОПолучПримечаниеДоговора', 0, null) ;

CALL ImportField(30111073, 'Номер гос. контракта получателя', 'DestBudgetPromiseSONum', 'Номер гос. контракта получателя', 'DestBudgetPromiseAgrNum', 1, 301, 1, 1, 'ДоговораБОПолучНомерКонтракта', 0, 19798) ;

CALL ImportField(30111074, 'Дата гос. контракта получателя', 'DestBudgetPromiseSODate', 'Дата гос. контракта получателя', 'DestBudgetPromiseAgrDate', 1, 301, 1, 1, 'ДоговораБОПолучДатаКонтракта', 0, 19799) ;

CALL ImportField(30111075, 'Сумма гос. контракта получателя', 'DestBudgetPromiseSOSumma', 'Сумма гос. контракта получателя', ' ', 1, 301, 1, 1, '', 0, null) ;

CALL ImportField(30111076, 'Реестровый номер гос. контр получателя', 'DestBudgetPromiseSORNum', 'Реестровый номер гос. контр получателя', 'DestBudgetPromiseAgrReestrNum', 1, 301, 1, 1, 'ДоговораБОПолучРеестрНомерКонтракта', 0, 19830) ;

CALL ImportField(30111077, 'Прим. гос. контракта получателя', 'DestBudgetPromiseSONote', 'Прим. гос. контракта получателя', 'DestBudgetPromiseAgrNote', 1, 301, 1, 1, 'ДоговораБОПолучПримечаниеКонтракта', 0, 19821) ;

CALL ImportField(30111079, 'ЭКИ(Классификация плат.)', 'SourceIFS_KESR', 'ЭКИ (плательщик)', ' ', 1, 301, 1, 0, '', 0, 17054) ;

CALL ImportField(30111082, 'ЭКИ(Классификация получ-ля)', 'DestIFS_KESR', 'ЭКИ (получатель)', ' ', 1, 301, 1, 0, '', 0, 17054) ;

CALL ImportField(30111100, 'С района трансферта', 'SourceRegionCls', 'Район плательщика', 'SOURCEREGIONCLS', 1, 301, 1, 0, 'Регион,РегионПлат,РайонТрансферта,РайонТрансфертаПлат', 0, 18927) ;

CALL ImportField(30111101, 'На район трансферта', 'DestRegionCls', 'Район получателя', 'DESTREGIONCLS', 1, 301, 1, 0, 'DestRegionCls,РегионПолуч,РайонТрансфертаПолуч', 0, 18928) ;

CALL ImportField(30111106, 'Док. исполнения плательщика', 'SourceExecDocCollaps', 'Док. исполнения плательщика', ' ', 1, 301, 1, 0, '', 0, null) ;

CALL ImportField(30111107, 'Номер(Док. исполнения плательщика)', 'SourceExecDocNum', 'Номер док. исполнения плательщика', 'SourceExecDocNum', 1, 301, 1, 0, 'ДокИсполненияНомер,ДокИсполненияПлатНомер', 0, 19739) ;

CALL ImportField(30111108, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', ' ', 1, 301, 1, 0, '', 0, null) ;

CALL ImportField(30111109, 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 'Номер док. исполнения получателя', 'DestExecDocNum', 1, 301, 1, 0, 'ДокИсполненияПолучНомер', 0, 19739) ;

CALL ImportField(30111112, 'Вид дохода(Классификация плат.)', 'SourceKD_DescriptionCode', 'Вид дохода', ' ', 1, 301, 1, 0, '', 0, 16831) ;

CALL ImportField(30111113, 'Подвид дохода(Классификация плат.)', 'SourceKD_Program', 'Подвид дохода', ' ', 1, 301, 1, 0, '', 0, 16834) ;

CALL ImportField(30111114, 'ЭКД(Классификация плат.)', 'SourceKD_KESR', 'ЭКД', ' ', 1, 301, 1, 0, '', 0, 16835) ;

CALL ImportField(30111116, 'Вид дохода получ-ля(Классификация получ-ля)', 'DestKD_DescriptionCode', 'Вид дохода1', ' ', 1, 301, 1, 0, '', 0, 16831) ;

CALL ImportField(30111117, 'Подвид дохода получ-ля(Классификация получ-ля)', 'DestKD_Program', 'Программа1', ' ', 1, 301, 1, 0, '', 0, 16834) ;

CALL ImportField(30111118, 'ЭКД получ-ля(Классификация получ-ля)', 'DestKD_KESR', 'ЭКД1', ' ', 1, 301, 1, 0, '', 0, 16835) ;

CALL ImportField(30111119, 'Источниковая классификация', 'SourceIFS', 'Источниковая классификация', 'SourceIFS', 1, 301, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПлат', 0, 18920) ;

CALL ImportField(30111120, 'Источниковая классификация', 'DestIFS', 'Источниковая классификация', 'DestIFS', 1, 301, 1, 1, 'DestIFS,ИсточникВнутрФинансированияКлючПолуч', 0, 18921) ;

CALL ImportField(30111121, 'Код дохода плат.', 'SourceKD', 'Код дохода', 'SOURCEKD', 1, 301, 1, 1, 'КДКлюч,КДКлючПлат', 0, 18925) ;

CALL ImportField(30111122, 'Код дохода получ-ля', 'DestKD', 'Код дохода', 'DESTKD', 1, 301, 1, 1, 'DestKD,КДКлючПолуч', 0, 18926) ;

CALL ImportField(30111123, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 301, 1, 1, '', 0, 18872) ;

CALL ImportField(30111127, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 301, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(30111128, 'DestIFS_FullID(Источниковая классификация)', 'DestIFS_FullID', 'DestIFS_FullID(Источниковая классификация)', 'DestIFS_FullID', 1, 301, 1, 1, 'DestIFS_FullID,ИсточникВнутрФинансированияПолуч', 0, 17055) ;

CALL ImportField(30111129, 'SourceIFS_FullID(Источниковая классификация)', 'SourceIFS_FullID', 'SourceIFS_FullID(Источниковая классификация)', 'SOURCEIFS_DESCRIPTIONCODE', 1, 301, 1, 1, 'ИсточникВнутрФинансированияПлат,ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(30111130, 'Код дохода1(Код дохода)', 'DestKD_Value', 'Код дохода получателя', 'DESTKDVALUE', 1, 301, 1, 1, 'КодДоходаПолуч', 0, 16836) ;

CALL ImportField(30111131, 'Код дохода(Код дохода)', 'SourceKD_Value', 'Код дохода плательщика', 'SOURCEKDVALUE', 1, 301, 1, 1, 'КодДохода,КодДоходаПлат', 0, 16836) ;

CALL ImportField(30111132, 'Источник образования получ-ля', 'DestFundsSource', 'Источник образования получ-ля', ' ', 1, 301, 1, 0, 'ИсточникОбразованияСредствПолуч', 0, 18929) ;

CALL ImportField(30111133, 'Источник образования плат.', 'SourceFundsSource', 'Источник образования плат.', ' ', 1, 301, 1, 0, 'ИсточникОбразованияСредств,ИсточникОбразованияСредствПлат', 0, 18930) ;

CALL ImportField(30111134, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'Progindex', 1, 301, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(30111135, 'Код целевых средств плат.Ключ', 'SourceTransfertCls', 'Код целевых средств плательщика (ссылка)', 'SourceTransfertCls', 1, 301, 1, 1, 'КодЦелевыхСредствКлюч,КодЦелевыхСредствКлючПлат', 0, 18935) ;

CALL ImportField(30111136, 'Код целевых средств получ.Ключ', 'DestTransfertCls', 'Код целевых средств получателя (ссылка)', 'DestTransfertCls', 1, 301, 1, 1, 'КодЦелевыхСредствКлючПолуч', 0, 18936) ;

CALL ImportField(30111151, 'Код субсидии плат.Ключ', 'SourceSubsidyCls', 'Код субсидии плательщика (ссылка)', 'SourceSubsidyCls', 1, 301, 1, 1, 'КодСубсидииКлюч,КодСубсидииКлючПлат', 0, 26626) ;

CALL ImportField(30111153, 'Номер л/с получателя', 'DestFacialCodeEx', '', ' ', 1, 301, 1, 0, '', 0, 26617) ;

CALL ImportField(30111158, 'Код бюджетного ассигнования получ-ляКлюч', 'DestBudAllocationCls', '', 'DestBudAllocationCls', 1, 301, 1, 1, 'КодБюджАссигнованияКлючПолуч', 0, 27842) ;

CALL ImportField(30111159, 'Код расходного обязательства получ-ляКлюч', 'DestPayPromiseCls', '', 'DestPayPromiseCls', 1, 301, 1, 1, 'КодРасходногоОбязательстваКлючПолуч', 0, 27843) ;

CALL ImportField(30111160, 'Код бюджетного ассигнования плат.Ключ', 'SourceBudAllocationCls', '', 'SourceBudAllocationCls', 1, 301, 1, 1, 'КодБюджАссигнованияКлючПлат', 0, 27844) ;

CALL ImportField(30111161, 'Код расходного обязательства плат.Ключ', 'SourcePayPromiseCls', '', 'SourcePayProiseCls', 1, 301, 1, 1, 'КодРасходногоОбязательстваКлючПлат', 0, 27845) ;

-- Выбытия по п\п, УРМ(0)
CALL ImportField(30200001, 'НДС', 'NDS', 'НДС', 'NDS', 0, 302, 0, 0, 'НДС', 0, null) ;

CALL ImportField(30200002, 'Налоговая информация', 'TaxNote', 'Налоговая информация', 'TaxNote', 0, 302, 0, 0, 'ИнформацияОНалоге', 0, null) ;

CALL ImportField(30200003, 'ИНН организации-получателя', 'INN', 'ИНН организации-получателя', 'DestOrgINN', 0, 302, 0, 0, '', 0, null) ;

CALL ImportField(30200004, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 0, 302, 0, 0, 'ТипОперации', 0, null) ;

CALL ImportField(30200005, 'Лицевой счет плательщика в ФК', 'SourceFacialCode', 'Лицевой счет плательщика в ФК', 'SourceFacialAccClsFacialCode', 0, 302, 0, 0, '', 0, null) ;

CALL ImportField(30200006, 'Номер документа', 'DocNumber', 'Номер документа', 'DocumentNumber', 0, 302, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(30200007, 'Дата документа', 'DocumentDate', 'Дата документа', 'DocumentDate', 0, 302, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(30200008, 'Дата проводки', 'AcceptDate', 'Дата проводки', 'AcceptDate', 0, 302, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(30200009, 'Дата реестра', 'ReestrDate', 'Дата реестра', 'REESTRDATE', 0, 302, 0, 1, 'ДатаРеестра', 0, null) ;

CALL ImportField(30200010, 'Сумма по документу', 'Summa', 'Сумма по документу', 'SUMMA', 0, 302, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(30200011, 'Вид платежа', 'PayTypeCls', 'Вид платежа', 'PAYTYPECLS', 0, 302, 0, 0, 'ВидПлатежа', 0, null) ;

CALL ImportField(30200012, 'Наименование организации-получателя', 'NAME', 'Наименование организации-получателя', 'DestOrgName', 0, 302, 0, 0, '', 0, null) ;

CALL ImportField(30200013, 'Очередность платежа', 'PayPriority', 'Очередность платежа', 'PayPriority', 0, 302, 0, 0, 'Очередность', 0, null) ;

CALL ImportField(30200014, 'Срок платежа', 'PayDate', 'Срок платежа', 'PayDate', 0, 302, 0, 0, 'СрокПлатежа', 0, null) ;

CALL ImportField(30200015, 'Бухгалтерская проводка', 'BuhPaymentCls', 'Бухгалтерская проводка', 'BUHPAYMENTCLS', 0, 302, 0, 0, 'БухПроводка', 0, null) ;

CALL ImportField(30200016, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 0, 302, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(30200017, 'Причина отклонения (пояснение)', 'RejectCause', 'Причина отклонения (пояснение)', 'RejectCause', 0, 302, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(30200018, 'Кассовый символ', ' ', 'Кассовый символ', 'PaySymbolCls', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200019, 'Номер сводной заявки', 'ManagerBidNumber', 'Номер сводной заявки', 'ManagerBidNumber', 0, 302, 0, 0, 'НомерЛокальногоРеестра', 0, null) ;

CALL ImportField(30200020, 'Назначение платежа', 'Note', 'Назначение платежа', 'NOTE', 0, 302, 0, 0, 'Примечание', 0, null) ;

CALL ImportField(30200021, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200022, 'Р/С плательщика (казначейский счет)', 'SourceAccountName', 'Р/С плательщика (казначейский счет)', 'SourceAccountName', 0, 302, 0, 0, '', 0, null) ;

CALL ImportField(30200023, 'Номер заявки ПБС', 'BidNumber', 'Номер заявки ПБС', 'BidNumber', 0, 302, 0, 0, 'НомерЗаявки', 0, null) ;

CALL ImportField(30200024, 'Номер реестра', 'ReestrNumber', 'Номер реестра', 'ReestrNumber', 0, 302, 0, 0, 'НомерРеестра', 0, null) ;

CALL ImportField(30200025, 'Мягкая причина отклонения (текст)', 'SoftRejectCause', 'Мягкая причина отклонения (текст)', 'SoftRejectCause', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200026, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200027, 'КПП организации-получателя', 'INN20', 'КПП организации-получателя', 'DestOrgKPP', 0, 302, 0, 0, '', 0, null) ;

CALL ImportField(30200028, 'Л/С получателя', 'DESTFACIALACC_CLS', 'Л/С получателя', 'DestFacialAccCls', 0, 302, 0, 0, 'ЛицСчетПолучателя', 0, null) ;

CALL ImportField(30200029, 'Р/С получателя', 'ACC', 'Р/С получателя', 'DestAccountName', 0, 302, 0, 0, '', 0, null) ;

CALL ImportField(30200030, 'Л/С плательщика', 'SOURCEFACIALACC_CLS', 'Л/С плательщика', 'SourceFacialAccCls', 0, 302, 0, 0, 'ЛицевойСчет,ЛицСчетПлательщика', 0, null) ;

CALL ImportField(30200032, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 302, 0, 1, 'ИндексыДанныхЗаголовок', 0, null) ;

CALL ImportField(30200033, 'Код счета плательщика', 'SOURCEACCOUNT', 'Код счета плательщика', 'SOURCEACCOUNT', 0, 302, 0, 1, 'РСФО,СчетПлат', 0, null) ;

CALL ImportField(30200034, 'Код счета получателя', 'DESTACCOUNT', 'Код счета организации-получателя', 'DESTACCOUNT', 0, 302, 0, 1, 'СчетПолуч', 0, null) ;

CALL ImportField(30200035, 'Состояние документа(код)', 'DocStateRef', 'Состояние документа(код)', 'DocStateRef', 0, 302, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(30200036, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200037, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200038, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200039, 'Локальный реестр', 'ManagerBid', 'Локальный реестр', 'ManagerBid', 0, 302, 0, 0, 'ЛокальныйРеестр', 0, null) ;

CALL ImportField(30200040, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200041, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200042, 'Бух операция плательщика', ' ', 'Бух операция плательщика', 'SourceType', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200043, 'Бух операция получателя', ' ', 'Бух операция получателя', 'DestType', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200044, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200045, 'Код реестра', ' ', 'Код реестра', 'Reestr_Ref', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200046, 'Статус ЭЦП', ' ', 'Статус ЭЦП', 'CRYPTOSTATUS', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200047, 'Отдел', ' ', 'Отдел', 'DEPARTMENTCLS', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200048, 'Федеральные cредства', ' ', 'Федеральные cредства', 'FEDERALFUNDSREF', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200049, 'Номер реестра федеральных cредств', ' ', 'Номер реестра федеральных cредств', 'FEDERALFUNDSREESTR', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200050, 'Связанный документ', ' ', 'Связанный документ', 'LINKEDDOCUMENT', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200051, 'Номер заявки отдела', ' ', 'Номер заявки отдела', 'RequestNumber', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200052, 'Дата заявки отдела', ' ', 'Дата заявки отдела', 'RequestDate', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200053, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200054, 'Субсчет плательщика', ' ', 'Субсчет плательщика', 'SourceFKFacialCode', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200055, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200056, 'Ссылка на организацию ФО плательщика', ' ', 'Ссылка на организацию ФО плательщика', 'SourceOrgFUID', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200057, 'ИНН организации-плательщика', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200058, 'КПП организации-плательщика', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200059, 'Наименование организации-плательщика', ' ', 'Наименование организации-плательщика', 'SourceOrgName', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200060, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200061, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200062, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200063, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200064, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200065, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200066, 'л\с плательщика', ' ', 'Имя л\с плательщика', 'SourceFacialAccClsName', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200067, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200068, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200069, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200070, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200071, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200072, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200073, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200074, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200075, 'Субсчет получателя', 'SubFacialCode', 'Субсчет получателя', 'DestFKFacialCode', 0, 302, 0, 0, '', 0, null) ;

CALL ImportField(30200076, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200077, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200078, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200079, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200080, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200081, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200082, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200083, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200084, 'л\с получателя(РВС)', ' ', 'л\с получателя', 'DestFacialAccClsName', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200085, 'мнемокод л\с получателя', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200086, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200087, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200088, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200089, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200090, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200091, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200092, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200093, 'Направление операции', 'OperationDirection', 'Направление операции', 'НаправлениеОперации', 0, 302, 0, 0, 'НаправлениеОперации', 0, null) ;

CALL ImportField(30200124, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200130, 'Код документа', 'ID', 'Код документа', 'Id', 0, 302, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30200131, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 302, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(30200146, 'Тип классификации', 'ClsType', 'Вид классификации(расходная, источниковая, доходная)', 'CLSTYPE', 0, 302, 0, 0, 'ТипКлассификацииЗаголовок', 0, null) ;

CALL ImportField(30200150, 'Информация о факсах', 'FaxDocsInfo', 'Информация о факсах', ' ', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200151, 'Ссылка на организацию', 'Org_Ref', 'Ссылка на организацию', ' ', 0, 302, 0, 1, '', 0, null) ;

CALL ImportField(30200156, 'Код документа в ФО', 'FUID', 'Код документа в ФО', 'FUID', 0, 302, 0, 0, '', 0, null) ;

CALL ImportField(30200161, 'Район контрагента', 'RegionContractor', 'Район контрагента', 'RegionContractor', 0, 302, 0, 1, 'РайонКонтрагента', 0, null) ;

CALL ImportField(30200162, 'Район бюджетного учреждения', 'RegionBudgetEst', 'Район бюджетного учреждения', 'RegionBudgetEst', 0, 302, 0, 1, 'РайонБУ', 0, null) ;

CALL ImportField(30200165, 'Номер пластиковой карты(ключ)', 'CardRef', 'Ключ пластиковой карты', 'CardRef', 0, 302, 0, 1, 'КлючПластиковойКарты', 0, 31656) ;

CALL ImportField(30200166, 'Номер пластиковой карты', 'CardRefName', 'Номер пластиковой карты', 'CardRefName', 0, 302, 0, 0, 'НомерПластиковойКарты', 0, 18939) ;

CALL ImportField(30201001, 'Сумма по строке детализации', 'Summa', 'Сумма по строке детализации', 'SUMMA', 0, 302, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(30201003, 'Источник финансирования', 'SOURCEFINSOURCE', 'Источник финансирования', 'SOURCEFINSOURCECLS', 0, 302, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(30201004, 'Тип средств', 'SourceMeansType', 'Тип средств', 'SOURCEMEANSTYPECLS', 0, 302, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(30201006, 'СубКЭСР', 'SourceSubKESR', 'СубКЭСР', 'SOURCESUBKESR', 0, 302, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(30201007, 'КФСР', 'SourceKFSR', 'КФСР', 'SourceKFSR', 0, 302, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(30201009, 'КВСР (Ключ)', 'SOURCEKVSR', 'КВСР (Ключ)', 'SourceKVSRKey', 0, 302, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(30201010, 'КВРКлюч', 'SOURCEKVR', 'КВР', 'SourceKVRKey', 0, 302, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(30201011, 'КЦСРКлюч', 'SOURCEKCSR', 'КЦСР', 'SourceKCSRKey', 0, 302, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(30201012, 'Номер бюджетного обязательства', 'SourcePromise', 'Номер бюджетного обязательства', 'SOURCEPROMISE', 0, 302, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(30201013, 'Примечание (деталь)', 'Note', 'Примечание (деталь)', 'NOTE', 0, 302, 1, 0, 'ПримечаниеДеталь', 0, null) ;

CALL ImportField(30201014, 'КЭСР', 'SourceKESR', 'КЭСР', 'SourceKESR', 0, 302, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(30201015, 'Ссылка на внутренний номер БО плательщика', 'SourceBudgetPromise', 'Ссылка на внутренний номер БО плательщика', ' ', 0, 302, 1, 1, 'БОВнутрНомер,ДоговораБО', 0, null) ;

CALL ImportField(30201016, 'Номер БО плательщика(договора)', 'SourceBudgetPromiseNum', 'Номер БО плательщика(договора)', ' ', 0, 302, 1, 0, 'БОНомер,ДоговораБОНомер', 0, null) ;

CALL ImportField(30201017, 'Документ исполнения плательщика', 'SourceExecDocCollaps', 'Документ исполнения плательщика', ' ', 0, 302, 1, 0, 'ДокИсполненияГруппа', 0, null) ;

CALL ImportField(30201018, 'Ссылка на документ исполнения плательщика', 'SourceExecDoc', 'Ссылка на документ исполнения плательщика', ' ', 0, 302, 1, 1, 'ДокИсполнения', 0, null) ;

CALL ImportField(30201019, 'Номер документа исполнения плательщика', 'SourceExecDocNum', 'Номер документа исполнения плательщика', ' ', 0, 302, 1, 0, 'ДокИсполненияНомер', 0, null) ;

CALL ImportField(30201020, 'Реестровый номер ДИ плательщика', 'SourceExecDocReestr', 'Реестровый номер ДИ плательщика', ' ', 0, 302, 1, 1, 'ДокИсполненияНомерРеестра', 0, null) ;

CALL ImportField(30201021, 'Дата ДИ плательщика', 'SourceExecDocDate', 'Дата ДИ плательщика', ' ', 0, 302, 1, 1, 'ДокИсполненияДата', 0, null) ;

CALL ImportField(30201022, 'Тип ДИ плательщика', 'SourceExecDocType', 'Тип ДИ плательщика', ' ', 0, 302, 1, 1, 'ДокИсполненияТип', 0, null) ;

CALL ImportField(30201023, 'Сумма по ДИ плательщика', 'SourceExecDocSumma', 'Сумма по ДИ плательщика', ' ', 0, 302, 1, 1, 'ДокИсполненияСумма', 0, null) ;

CALL ImportField(30201024, 'Примечание ДИ плательщика', 'SourceExecDocNote', 'Примечание ДИ плательщика', ' ', 0, 302, 1, 1, 'ДокИсполненияПримечание', 0, null) ;

CALL ImportField(30201025, 'Ссылка на внутренний номер БО получателя', '', 'Ссылка на внутренний номер БО получателя', 'DestBudgetPromise', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201035, 'Бюджетное обязательство плательщика', 'SourceBudgetPromiseCollaps', 'Бюджетное обязательство плательщика', 'SourceBudgetPromiseCollaps', 0, 302, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30201036, 'Сумма БО', 'SourceBudgetPromiseSumma', 'Сумма БО', 'SourceBudgetPromiseSumma', 0, 302, 1, 1, 'ДоговораБОСумма', 0, null) ;

CALL ImportField(30201037, 'Номер договора', 'SourceBudgetPromiseDocNumber', 'Номер документа', 'SourceBudgetPromiseDocNum', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201038, 'Дата договора', 'SourceBudgetPromiseDocDate', 'Дата документа', 'SourceBudgetPromiseDocDate', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201039, 'Сумма договора', 'SourceBudgetPromiseDocSumma', 'Сумма документа', 'SourceBudgetPromiseDocSumma', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201040, 'Реестровый номер дог.', 'SourceBudgetPromiseDocReestrNum', 'Реестровый номер документа.', 'SourceBudgetPromiseDocReestrNum', 0, 302, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(30201041, 'Дог. примечание', 'SourceBudgetPromiseDocNote', 'Док. примечание', 'SourceBudgetPromiseDocNote', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201042, 'Номер гос. контракта', 'SourceBudgetPromiseSONum', 'Номер гос. контракта', 'SourceBudgetPromiseSONum', 0, 302, 1, 1, 'ДоговораБОНомерКонтракта', 0, null) ;

CALL ImportField(30201043, 'Дата гос. контракта', 'SourceBudgetPromiseSODate', 'Дата гос. контракта', 'SourceBudgetPromiseSODate', 0, 302, 1, 1, 'ДоговораБОДатаКонтракта', 0, null) ;

CALL ImportField(30201044, 'Сумма гос. контракта', 'SourceBudgetPromiseSOSumma', 'Сумма гос. контракта', 'SourceBudgetPromiseSOSumma', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201045, 'Реестровый номер гос. контр', 'SourceBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр', 'SourceBudgetPromiseSOReestrNum', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201046, 'Прим. гос. контракта', 'SourceBudgetPromiseSONote', 'Прим. гос. контракта', 'SourceBudgetPromiseSONote', 0, 302, 1, 1, 'ДоговораБОПримечаниеКонтракта', 0, null) ;

CALL ImportField(30201047, 'Бюджетное обязательство получателя', '', 'Бюджетное обязательство получателя', 'DestBudgetPromiseCollaps', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201048, 'Сумма БО получателя', '', 'Сумма БО получателя', 'DestBudgetPromiseSumma', 0, 302, 1, 0, '', 0, null) ;

CALL ImportField(30201049, 'Номер договора получателя', '', 'Номер договора получателя', 'DestBudgetPromiseAgrNum', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201050, 'Дата договора получателя', '', 'Дата договора получателя', 'DestBudgetPromiseAgrDate', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201051, 'Сумма договора получателя', '', 'Сумма договора получателя', 'DestBudgetPromiseAgrSumma', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201052, 'Реестровый номер дог', '', 'Реестровый номер дог', 'DestBudgetPromiseAgrReestrNum', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201053, 'Дог. примечание получателя', '', 'Дог. примечание получателя', 'DestBudgetPromiseAgrNote', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201054, 'Номер гос. контракта получателя', '', 'Номер гос. контракта получателя', 'DestBudgetPromiseSONum', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201055, 'Дата гос. контракта получателя', '', 'Дата гос. контракта получателя', 'DestBudgetPromiseSODate', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201056, 'Сумма гос. контракта получателя', '', 'Сумма гос. контракта получателя', 'DestBudgetPromiseSOSumma', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201057, 'Реестровый номер гос. контр получателя', '', 'Реестровый номер гос. контр получателя', 'DestBudgetPromiseSOReestrNum', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201058, 'Прим. гос. контракта получателя', '', 'Прим. гос. контракта получателя', 'DestBudgetPromiseSONote', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201059, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 302, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(30201060, 'Бух операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 0, 302, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(30201061, 'Тип классификации', 'ClsType', 'Вид классификации(расходная, источниковая, доходная)', 'ClsType', 0, 302, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(30201066, 'Тип документа плательщика', 'SOURCEDOCTYPE', 'Тип документа плательщика', 'SOURCEDOCTYPECLS', 0, 302, 1, 0, 'ТипДокумента', 0, null) ;

CALL ImportField(30201067, 'Район плательщика', 'SourceRegionCLS', 'Район плательщика', 'RegionCLS', 0, 302, 1, 0, 'Регион,РайонТрансферта', 0, null) ;

CALL ImportField(30201068, 'ИВВФ(Ключ)', 'SourceIFS', 'Ключ источника внутреннего и внешнего финансирвоания дефицита бюджета ', 'SourceIFS', 0, 302, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПлат', 0, null) ;

CALL ImportField(30201069, 'Классификация остатков средств', ' ', 'Классификация остатков средств', 'DestIFS_DescriptionCode', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201070, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201071, 'Классификация', 'TreeOwner0', 'Классификация', 'TreeOwner0', 0, 302, 1, 0, '', 0, null) ;

CALL ImportField(30201106, 'Код дохода(Ключ)', 'SourceKD', 'Код дохода', 'SourceKD', 0, 302, 1, 0, 'КДКлюч', 0, null) ;

CALL ImportField(30201121, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 0, 302, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30201125, 'Источник образования', 'SourceFundsSource', 'Источник образования', 'SourceFundsSource', 0, 302, 1, 1, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(30201132, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201144, 'Код целевых средствКлюч', 'SourceTransfertCls', 'Код целевых средств (ссылка)', 'SourceTransfertCls', 0, 302, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(30201145, 'Код целевых средств', 'SourceTransfertClsCode', 'Код целевых средств', 'SourceTransfertClsValue', 0, 302, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(30201147, 'КЦСР(Классификация)', 'SourceKCSRCode', '', 'SourceKCSR', 0, 302, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(30201148, 'КВР(Классификация)', 'SOURCEKVRCode', '', 'SourceKVR', 0, 302, 1, 0, 'КВР', 0, null) ;

CALL ImportField(30201149, 'КВСР', 'SourceKVSRCode', 'КВСР', 'SourceKVSR', 0, 302, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(30201153, 'ИВВФ', 'SourceIFSCode', 'Источник внутреннего и внешнего финансирвоания дефицита бюджета', 'SourceIFS_DescriptionCode', 0, 302, 1, 0, 'ИсточникВнутрФинансирования,ИсточникВнутрФинансированияПлат', 0, null) ;

CALL ImportField(30201154, 'Код цели', 'TargetCls', 'Код цели', ' ', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201155, 'ИД контракта', 'SourceBudgetPromiseSOID', '', ' ', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201157, 'Код записи в ФО', 'FUID', 'Код записи в ФО', 'FUID', 0, 302, 1, 1, '', 0, null) ;

CALL ImportField(30201158, 'Код записи', 'ID', 'Код записи', 'ID', 0, 302, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(30201159, 'Код субсидииКлюч', 'SourceSubsidyCls', 'Код субсидии (ссылка)', 'SourceSubsidyCls', 0, 302, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(30201160, 'Код субсидии', 'SourceSubsidyClsCode', 'Код субсидии', 'SourceSubsidyClsCode', 0, 302, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(30201161, 'Код бюджетного ассигнования', 'SourceBudAllocationClsCode', '', ' ', 0, 302, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(30201162, 'Код расходного обязательства', 'SourcePayPromiseClsCode', '', ' ', 0, 302, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(30201163, 'Код бюджетного ассигнования (ключ)', 'SourceBudAllocationCls', '', ' ', 0, 302, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(30201164, 'Код расходного обязательства (ключ)', 'SourcePayPromiseCls', '', ' ', 0, 302, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

-- Выбытия по п\п, Бюджет(1)
CALL ImportField(30210002, 'Лиц. счет (РВС) ', 'DESTFACIALACC_CLS', 'Л/С получателя (РВС)', 'DestFacialAccCls', 1, 302, 0, 0, 'ЛицСчетПолучателя', 0, 18959) ;

CALL ImportField(30210003, 'Номер р/с получателя', 'ACC', 'Номер р/с получателя', 'DestAccountName', 1, 302, 0, 0, '', 0, 17112) ;

CALL ImportField(30210004, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (текст)', 'RejectCause', 1, 302, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(30210006, 'Дата проводки', 'ACCEPTDATE', 'Дата проводки', 'AcceptDate', 1, 302, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(30210007, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', 'BUHPAYMENTCLS', 1, 302, 0, 0, 'БухПроводка', 0, 18968) ;

CALL ImportField(30210008, 'Архив', 'ARHIVEDOC', 'Признак архивности', 'ARHIVEDOC', 1, 302, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(30210009, 'Вид операции', 'TYPEOPERATIONCLS', 'Тип операции', 'OperationTypeCls', 1, 302, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(30210010, 'Информация для налогового платежа(Информация о платеже)', 'TAXNOTE', 'Налоговая информация', 'TaxNote', 1, 302, 0, 0, 'ИнформацияОНалоге', 0, 18991) ;

CALL ImportField(30210011, 'Срок платежа', 'PAYDATE', 'Срок платежа', 'PayDate', 1, 302, 0, 0, 'СрокПлатежа', 0, 18951) ;

CALL ImportField(30210012, 'Дата п/п', 'DOCUMENTDATE', 'Дата документа', 'DocumentDate', 1, 302, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(30210013, 'Р/С получателя', 'DESTACCOUNT', 'Р/С получателя', 'DESTACCOUNT', 1, 302, 0, 1, 'СчетПолуч', 0, 18958) ;

CALL ImportField(30210014, 'Назначение платежа(Информация о платеже)', 'NOTE', 'Назначение платежа', 'NOTE', 1, 302, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(30210016, 'НДС(Информация о платеже)', 'NDS', 'НДС', 'NDS', 1, 302, 0, 0, 'НДС', 0, 18990) ;

CALL ImportField(30210017, 'Номер заявки', 'BIDNUMBER', 'Номер заявки ПБС', 'BidNumber', 1, 302, 0, 0, 'НомерЗаявки', 0, 18993) ;

CALL ImportField(30210023, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 302, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(30210024, 'Сумма(руб)', 'SUMMA', 'Сумма', 'SUMMA', 1, 302, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(30210025, 'Номер реестра', 'REESTRNUMBER', 'Номер реестра', 'ReestrNumber', 1, 302, 0, 0, 'НомерРеестра', 0, 19090) ;

CALL ImportField(30210026, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 1, 302, 0, 1, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(30210027, 'Имя(Получатель)', 'NAME', 'Получатель (Наименование)', 'DestOrgName', 1, 302, 0, 0, '', 0, 16646) ;

CALL ImportField(30210028, 'ИНН(Получатель)', 'INN', 'Получатель (ИНН)', 'DestOrgINN', 1, 302, 0, 0, '', 0, 16645) ;

CALL ImportField(30210029, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 1, 302, 0, 0, 'ВидПлатежа', 0, 18963) ;

CALL ImportField(30210030, 'Р/С плательщика (казначейский)', 'SOURCEACCOUNTNAME', 'Р/С плательщика (казначейский)', 'SourceAccountName', 1, 302, 0, 0, '', 0, 17112) ;

CALL ImportField(30210032, 'Л/с плательщика', 'SOURCEFACIALACC_CLS', 'Л/С плательщика', 'SourceFacialAccCls', 1, 302, 0, 0, 'ЛицевойСчет,ЛицСчетПлательщика', 0, 18957) ;

CALL ImportField(30210033, 'Отдел', 'DEPARTMENTCLS', 'Отдел', 'DEPARTMENTCLS', 1, 302, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(30210034, '№ п/п', 'DOCNUMBER', 'Номер документа', 'DocumentNumber', 1, 302, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(30210035, 'КПП(Получатель)', 'INN20', 'Получатель (КПП)', 'DestOrgKPP', 1, 302, 0, 0, '', 0, 16653) ;

CALL ImportField(30210038, 'Информация о платеже', 'ParentNoteTax', 'Информация о платеже', ' ', 1, 302, 0, 0, '', 0, null) ;

CALL ImportField(30210039, 'Л/С плательщика в ФК', 'SourceFacialCode', 'ЛС плательщика в ФК', ' ', 1, 302, 0, 0, '', 0, null) ;

CALL ImportField(30210040, 'Реестр федеральных средств', 'FederalFundsName', 'Реестр федеральных средств', ' ', 1, 302, 0, 0, '', 0, null) ;

CALL ImportField(30210041, 'Получатель', 'ParentSource', 'Получатель', ' ', 1, 302, 0, 0, '', 0, null) ;

CALL ImportField(30210043, ' Код счета плательщика', 'SOURCEACCOUNT', 'Код счета плательщика', 'SOURCEACCOUNT', 1, 302, 0, 1, 'РСФО,СчетПлат', 0, 18956) ;

CALL ImportField(30210044, 'СостояниеДокумента', 'DocStateRef', 'Состояние документа', 'DocStateRef', 1, 302, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(30210045, 'Есть в бюджете', ' ', 'Есть в бюджете', 'IsInBudget', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210046, 'Признак зависания', ' ', 'Признак зависания', 'DocSuspended', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210047, 'ЛокальнаяВиза', ' ', 'ЛокальнаяВиза', 'IsVised', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210048, 'Ссылка на реестр заявок', 'ManagerBid', 'Локальный реестр', 'ManagerBid', 1, 302, 0, 1, 'ЛокальныйРеестр', 0, 18992) ;

CALL ImportField(30210049, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210050, 'Код cметы', ' ', 'Код cметы', 'StimateID', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210053, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210054, 'Код реестра', 'Reestr_Ref', 'Код реестра', 'Reestr_Ref', 1, 302, 0, 1, 'КодРеестра', 0, 18971) ;

CALL ImportField(30210055, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 302, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(30210056, 'Мягкая причина отклонения', ' ', 'Мягкая причина отклонения', 'SoftRejectCls', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210057, 'Текст мягкой причины отклонения', ' ', 'Текст мягкой причины отклонения', 'SoftRejectCause', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210058, 'Федеральные cредства', 'FEDERALFUNDSREF', 'Федеральные cредства', 'FEDERALFUNDSREF', 1, 302, 0, 1, 'ФедеральныеСредства', 0, 19004) ;

CALL ImportField(30210059, 'Номер реестра федеральных cредств', ' ', 'Номер реестра федеральных cредств', 'FEDERALFUNDSREESTR', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210061, 'Номер заявки отдела', ' ', 'Номер заявки отдела', 'RequestNumber', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210062, 'Дата заявки отдела', ' ', 'Дата заявки отдела', 'RequestDate', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210063, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210064, 'Субсчет плательщика', ' ', 'Субсчет плательщика', 'SourceFKFacialCode', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210065, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210066, 'Ссылка на организацию плательщика(для УРМ)', ' ', 'Ссылка на организацию плательщика(для УРМ)', 'SourceOrgFUID', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210067, 'ИНН плательщика', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210068, 'КПП плательщика', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210069, 'Наименование плательщика', ' ', 'Наименование организации-плательщика', 'SourceOrgName', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210070, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210071, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210072, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210073, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210074, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210075, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210076, 'л\с плательщика', ' ', 'Имя л\с плательщика', 'SourceFacialAccClsName', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210077, 'мнемокод л\с плательщика', ' ', 'мнемокод л\с плательщика', 'SourceFacialAccClsFacialCode', 1, 302, 0, 0, '', 1, null) ;

CALL ImportField(30210078, 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 1, 302, 0, 1, '', 0, null) ;

CALL ImportField(30210079, 'КПП владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210080, 'Имя организации владельца л\с плательщика', ' ', 'Имя организации владельца л\с плательщика', 'SourceFacialAccClsOrgName', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210081, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210082, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210083, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210084, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210085, 'Номер отделения банка получателя', ' ', 'Номер отделения банка получателя', 'DestBankDepartmentNumber', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210086, 'Субсчет получателя', ' ', 'Субсчет получателя', 'DestFKFacialCode', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210087, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210088, 'Ссылка на организацию получателя(для УРМ)', ' ', 'Ссылка на организацию получателя(для УРМ)', 'DestOrgFUID', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210089, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210090, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210091, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210092, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210093, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210094, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210095, 'л\с получателя (РВС)', ' ', 'л\с получателя', 'DestFacialAccClsName', 1, 302, 0, 0, '', 1, null) ;

CALL ImportField(30210096, 'мнемокод л\с получателя', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 1, 302, 0, 0, '', 1, null) ;

CALL ImportField(30210097, 'ИНН владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210098, 'КПП владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210099, 'Наименование владельца л\с получателя', ' ', 'Наименование организации-владельца л\с получателя', 'DestFacialAccClsOrgName', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210100, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210101, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210102, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210103, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 1, 302, 0, 1, '', 1, null) ;

CALL ImportField(30210104, 'Направление операции', 'OperationDirection', 'Направление операции', 'OperationDirection', 1, 302, 0, 0, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(30210105, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 302, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(30210113, 'Тип классификации', 'ClsType', 'Вид классификации(расходная, источниковая, доходная)', 'CLSTYPE', 1, 302, 0, 0, 'ТипКлассификацииЗаголовок', 0, 19008) ;

CALL ImportField(30210114, 'Код документа', 'ID', 'Код документа', 'Id', 1, 302, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(30210115, 'Состояние казн. док', 'TreasuaryDocStateCLS', 'Состояние казн. док', ' ', 1, 302, 0, 1, 'СостояниеДокументаКазн', 0, 18988) ;

CALL ImportField(30210122, 'Код удаленного клиента', 'SENDERID', 'Код удаленного клиента', 'SenderID', 1, 302, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(30210123, 'Код УРМ документа', 'SENDERRECORDID', 'Код УРМ документа', 'SenderRecordID', 1, 302, 0, 1, 'КодУРМДокумента', 0, 18970) ;

CALL ImportField(30210126, 'Признак принятого реестра', 'Accepted', 'Признак принятого реестра', 'Accepted', 1, 302, 0, 1, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(30210128, '№(Локальный реестр)', 'ManagerBIDNUMBER', '№(Локальный реестр)', ' ', 1, 302, 0, 1, 'НомерЛокальногоРеестра', 0, 20507) ;

CALL ImportField(30210131, 'Уточнение индекса данных', 'SubProgIndex', 'Уточнение индекса данных', ' ', 1, 302, 0, 1, '', 0, null) ;

CALL ImportField(30210132, 'Счетчик факсов', 'FaxDocCount', 'Счетчик факсов', ' ', 1, 302, 0, 1, '', 0, null) ;

CALL ImportField(30210134, 'Статус(Обмен с банком)', 'Status', 'Статус', 'Status', 1, 302, 0, 1, 'Статус', 0, 17233) ;

CALL ImportField(30210135, 'Код документа в Смете', 'StimateID', 'Код документа в Смете', 'StimateID', 1, 302, 0, 1, 'КодСметы', 0, 18999) ;

CALL ImportField(30210136, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'ProgIndex', 1, 302, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(30210137, 'Дата заявки', 'BidDate', 'Дата заявки', ' ', 1, 302, 0, 0, 'ДатаЗаявки', 0, 24730) ;

CALL ImportField(30210138, 'Локальный реестр', 'ManagerParent', 'Локальный реестр', ' ', 1, 302, 0, 0, '', 0, null) ;

CALL ImportField(30210139, 'Обмен с банком', 'ParentElBank', 'Обмен с банком', ' ', 1, 302, 0, 0, '', 0, null) ;

CALL ImportField(30210140, 'Район контрагента', 'RegionContractor', 'Район контрагента', 'RegionContractor', 1, 302, 0, 1, 'РайонКонтрагента', 0, null) ;

CALL ImportField(30210141, 'Район бюджетного учреждения', 'RegionBudgetEst', 'Район бюджетного учреждения', 'RegionBudgetEst', 1, 302, 0, 1, 'РайонБУ', 0, null) ;

CALL ImportField(30210142, 'Номер л/с плательщика', 'SourceFacialCodeEx', '', ' ', 1, 302, 0, 0, '', 0, 26617) ;

CALL ImportField(30210153, 'Получатель(Хранимые реквизиты платежа)', 'DestStoredPaymentProps', '', 'DestStoredPaymentProps', 1, 302, 0, 0, 'РеквизитыПлатежаПолуч', 0, 31657) ;

CALL ImportField(30210154, 'Плательщик(Хранимые реквизиты платежа)', 'SourceStoredPaymentProps', '', 'SourceStoredPaymentProps', 1, 302, 0, 0, 'РеквизитыПлатежаПлат', 0, 31658) ;

CALL ImportField(30210155, 'Назначение платежа(Хранимые реквизиты платежа)', 'StoredPaymentNote', '', 'StoredPaymentNote', 1, 302, 0, 0, 'ФорматНазначениеПлатежа', 0, 31659) ;

CALL ImportField(30210156, 'Хранимые реквизиты платежа', 'StoredPaymentProps', '', ' ', 1, 302, 0, 0, '', 0, null) ;

CALL ImportField(30211001, 'Суб КОСГУ', 'SOURCESUBKESR', 'СубКЭСР', 'SOURCESUBKESR', 1, 302, 1, 0, 'СубКЭСР', 0, 18889) ;

CALL ImportField(30211003, 'КВРКлюч', 'SOURCEKVR', 'КВР', 'SourceKVRKey', 1, 302, 1, 1, 'КВРКлюч', 0, 18867) ;

CALL ImportField(30211004, 'ЭКР(Классификация)', 'SOURCEKESR', 'КЭСР', 'SourceKESR', 1, 302, 1, 0, 'КЭСР', 0, 18868) ;

CALL ImportField(30211005, 'ФКР(Классификация)', 'SOURCEKFSR', 'КФСР', 'SourceKFSR', 1, 302, 1, 0, 'КФСР', 0, 18888) ;

CALL ImportField(30211006, 'КЦСРКлюч', 'SOURCEKCSR', 'КЦСР', 'SourceKCSRKey', 1, 302, 1, 1, 'КЦСРКлюч', 0, 18887) ;

CALL ImportField(30211007, 'КВСРКлюч', 'SOURCEKVSR', 'КВСР', 'SourceKVSRKey', 1, 302, 1, 1, 'КВСРКлюч', 0, 18886) ;

CALL ImportField(30211009, 'Тип средств', 'SOURCEMEANSTYPE', 'Тип средств', 'SOURCEMEANSTYPECLS', 1, 302, 1, 0, 'ТипСредств', 0, 18891) ;

CALL ImportField(30211010, 'Источник финансирования', 'SOURCEFINSOURCE', 'Источник финансирования', 'SOURCEFINSOURCECLS', 1, 302, 1, 0, 'ИсточникФинансирования', 0, 18892) ;

CALL ImportField(30211012, 'Тип документа', 'SOURCEDOCTYPE', 'Тип документа', 'SOURCEDOCTYPECLS', 1, 302, 1, 0, 'ТипДокумента', 0, 18894) ;

CALL ImportField(30211013, 'Сумма (руб)', 'SUMMA', 'Сумма', 'SUMMA', 1, 302, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(30211014, 'Номер БО плательщика(договора)', 'SOURCEBUDGETPROMISENUM', 'Номер БО плательщика(договора)', 'SourceBudgetPROMISENum', 1, 302, 1, 0, 'БОНомер,ДоговораБОНомер', 0, 20223) ;

CALL ImportField(30211015, '№ БО плательщика', 'SOURCEPROMISE', 'Номер бюджетного обязательства', 'SOURCEPROMISE', 1, 302, 1, 0, 'БюджОбяз', 0, 18905) ;

CALL ImportField(30211017, 'Классификация', 'TreeOwner0', 'Классификация (Группа)', ' ', 1, 302, 1, 0, '', 0, null) ;

CALL ImportField(30211018, 'Вн. номер БО плательщика', 'SourceBudgetPromise', 'Ссылка на внутренний номер БО плательщика', 'SOURCEBUDGETPROMISE', 1, 302, 1, 1, 'БОВнутрНомер,ДоговораБО', 0, 18908) ;

CALL ImportField(30211019, 'Док. исполнения плательщика', 'SourceExecDocCollaps', 'Документ исполнения плательщика', ' ', 1, 302, 1, 0, '', 0, null) ;

CALL ImportField(30211020, 'Номер Д.И. плательщика ссылка', 'SourceExecDoc', 'Ссылка на документ исполнения плательщика', 'SourceExecDoc', 1, 302, 1, 1, 'ДокИсполнения', 0, 18917) ;

CALL ImportField(30211021, 'Номер(Док. исполнения плательщика)', 'SourceExecDocNum', 'Номер документа исполнения плательщика', 'SourceExecDocNum', 1, 302, 1, 0, 'ДокИсполненияНомер,ДокИсполненияПлатНомер', 0, 19739) ;

CALL ImportField(30211022, 'Реестровый номер(Док. исполнения плательщика)', 'SourceExecDocReestr', 'Реестровый номер ДИ плательщика', 'SourceExecDocReestr', 1, 302, 1, 1, 'ДокИсполненияНомерРеестра', 0, 19756) ;

CALL ImportField(30211023, 'Дата(Док. исполнения плательщика)', 'SourceExecDocDate', 'Дата ДИ плательщика', 'SourceExecDocDate', 1, 302, 1, 1, 'ДокИсполненияДата,ДокИсполненияПлатДата', 0, 19740) ;

CALL ImportField(30211024, 'Тип(Док. исполнения плательщика)', 'SourceExecDocType', 'Тип ДИ плательщика', 'SourceExecDocType', 1, 302, 1, 1, 'ДокИсполненияТип', 0, 19738) ;

CALL ImportField(30211025, 'Сумма(Док. исполнения плательщика)', 'SourceExecDocSumma', 'Сумма по ДИ плательщика', 'SourceExecDocSumma', 1, 302, 1, 1, 'ДокИсполненияСумма', 0, 19744) ;

CALL ImportField(30211026, 'Назначение(Док. исполнения плательщика)', 'SourceExecDocNote', 'Примечание ДИ плательщика', 'SourceExecDocNote', 1, 302, 1, 1, 'ДокИсполненияПримечание', 0, 19762) ;

CALL ImportField(30211037, 'Примечание', 'NOTE', 'Примечание (деталь)', 'NOTE', 1, 302, 1, 0, 'ПримечаниеДеталь', 0, 18876) ;

CALL ImportField(30211040, 'л\с плательщика', ' ', 'л\с плательщика', 'SourceFacialAccCls', 1, 302, 1, 1, '', 1, null) ;

CALL ImportField(30211041, 'Район трансферта', 'SourceRegionCLS', 'Район плательщика', 'SourceRegionCls', 1, 302, 1, 0, 'Регион,РайонТрансферта', 0, 18927) ;

CALL ImportField(30211042, 'Код cметы', ' ', 'Код cметы', 'StimateId', 1, 302, 1, 1, '', 1, null) ;

CALL ImportField(30211043, 'Операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 1, 302, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(30211044, 'Тип классификации', 'ClsType', 'Вид классификации(расходная, источниковая, доходная)', 'ClsType', 1, 302, 1, 1, 'ТипКлассификации', 0, 18922) ;

CALL ImportField(30211047, '№ бюдж. обязат-ва плательщика', 'SourceBudgetPromiseCollaps', 'Бюджетное обязательство плательщика', ' ', 1, 302, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30211048, 'Сумма БО', 'SourceBudgetPromiseSumma', 'Сумма БО', 'SourceBudgetPromiseSumma', 1, 302, 1, 1, 'ДоговораБОСумма,ДоговораБОПлатСумма', 0, 20242) ;

CALL ImportField(30211049, 'Номер договора', 'SourceBudgetPromiseAgrNum', 'Номер договора', 'SourceBudgetPromiseAgrNum', 1, 302, 1, 1, 'ДоговораБОНомерДоговора,ДоговораБОПлатНомерДоговора', 0, null) ;

CALL ImportField(30211050, 'Дата договора', 'SourceBudgetPromiseAgrDate', 'Дата договора', 'SourceBudgetPromiseAgrDate', 1, 302, 1, 1, 'ДоговораБОДатаДоговора,ДоговораБОПлатДатаДоговора', 0, null) ;

CALL ImportField(30211051, 'Сумма договора', 'SourceBudgetPromiseAgrSumma', 'Сумма договора', 'SourceBudgetPromiseAgrSumma', 1, 302, 1, 1, 'ДоговораБОПлатСуммаДоговора', 0, null) ;

CALL ImportField(30211052, 'Реестровый номер дог.', 'SourceBudgetPromiseAgrRNum', 'Реестровый номер дог.', 'SourceBudgetPromiseAgrReestrNum', 1, 302, 1, 1, 'ДоговораБОРеестрНомерДоговора,ДоговораБОПлатРеестрНомерДоговора', 0, null) ;

CALL ImportField(30211053, 'Дог. примечание', 'SourceBudgetPromiseAgrNote', 'Дог. примечание', 'SourceBudgetPromiseAgrNote', 1, 302, 1, 1, 'ДоговораБОПримечаниеДоговора,ДоговораБОПлатПримечаниеДоговора', 0, null) ;

CALL ImportField(30211054, 'Номер гос. контракта', 'SourceBudgetPromiseSONum', 'Номер гос. контракта', 'SourceBudgetPromiseAgrNum', 1, 302, 1, 1, 'ДоговораБОНомерКонтракта', 0, 19798) ;

CALL ImportField(30211055, 'Дата гос. контракта', 'SourceBudgetPromiseSODate', 'Дата гос. контракта', 'SourceBudgetPromiseAgrDate', 1, 302, 1, 1, 'ДоговораБОДатаКонтракта', 0, 19799) ;

CALL ImportField(30211056, 'Сумма гос. контракта', 'SourceBudgetPromiseSOSumma', 'Сумма гос. контракта', ' ', 1, 302, 1, 1, '', 0, null) ;

CALL ImportField(30211057, 'Реестровый номер гос. контр', 'SourceBudgetPromiseSORNum', 'Реестровый номер гос. контр', 'SourceBudgetPromiseAgrReestrNum', 1, 302, 1, 1, 'ДоговораБОРеестрНомерКонтракта', 0, 19830) ;

CALL ImportField(30211058, 'Прим. гос. контракта', 'SourceBudgetPromiseSONote', 'Прим. гос. контракта', 'SourceBudgetPromiseAgrNote', 1, 302, 1, 1, 'ДоговораБОПримечаниеКонтракта', 0, 19821) ;

CALL ImportField(30211076, 'ЭКИ(Классификация)', 'SourceIFS_KESR', 'ЭКИ (расходный источник)', ' ', 1, 302, 1, 0, '', 0, 17054) ;

CALL ImportField(30211077, 'Вид источника(Классификация)', 'SourceIFS_DescriptionCode', 'Вид источника (расходный источник)', 'SourceIFS_DescriptionCode', 1, 302, 1, 0, '', 0, 17050) ;

CALL ImportField(30211108, 'Вид дохода(Классификация)', 'SourceKD_DescriptionCode', 'Вид дохода (КД)', ' ', 1, 302, 1, 0, '', 0, 16831) ;

CALL ImportField(30211109, 'Подвид дохода(Классификация)', 'SourceKD_Program', 'Подвид дохода', ' ', 1, 302, 1, 0, '', 0, 16834) ;

CALL ImportField(30211110, 'ЭКД(Классификация)', 'SourceKD_KESR', 'ЭКД(КД)', ' ', 1, 302, 1, 0, '', 0, 16835) ;

CALL ImportField(30211112, 'Источник образования', 'SourceFundsSource', 'Источник образования', 'SourceFundsSource', 1, 302, 1, 0, 'ИсточникОбразованияСредств', 0, 18930) ;

CALL ImportField(30211117, 'Источниковая классификация', 'SourceIFS', 'Источниковая классификация', 'SourceIFS', 1, 302, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПлат', 0, 18920) ;

CALL ImportField(30211118, 'Код дохода', 'SourceKD', 'Код дохода', 'SourceKD', 1, 302, 1, 1, 'КДКлюч', 0, 18925) ;

CALL ImportField(30211119, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 302, 1, 1, '', 0, 18872) ;

CALL ImportField(30211120, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 302, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(30211121, 'Код записи', 'ID', 'Код записи', 'Id', 1, 302, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(30211127, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 302, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(30211129, 'Источниковая классификация', 'SourceIFS_FullID', 'SourceIFS_FullID(Источниковая классификация)', 'SOURCEIFS_DESCRIPTIONCODE', 1, 302, 1, 1, 'ИсточникВнутрФинансирования,ИсточникВнутрФинансированияПлат', 0, null) ;

CALL ImportField(30211130, 'Код дохода', 'SourceKD_Value', 'Код дохода', 'SourceKDValue', 1, 302, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(30211131, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'ProgIndex', 1, 302, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(30211132, 'Код записи в Смете', 'StimateID', 'Код записи в Смете', 'StimateId', 1, 302, 1, 1, 'КодСметыЗаписи', 0, 18911) ;

CALL ImportField(30211137, 'Код целевых средствКлюч', 'SourceTransfertCls', 'Код целевых средств (ссылка)', 'SourceTransfertCls', 1, 302, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18935) ;

CALL ImportField(30211144, 'Код субсидииКлюч', 'SourceSubsidyCls', 'Код субсидии (ссылка)', 'SourceSubsidyCls', 1, 302, 1, 1, 'КодСубсидииКлюч', 0, 26626) ;

CALL ImportField(30211146, 'Наименование района трансферта', 'SourceRegionClsName', '', ' ', 1, 302, 1, 0, '', 0, null) ;

CALL ImportField(30211149, 'Код бюджетного ассигнованияКлюч', 'SourceBudAllocationCls', '', 'SourceBudAllocationCls', 1, 302, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27844) ;

CALL ImportField(30211150, 'Код расходного обязательстваКлюч', 'SourcePayPromiseCls', '', 'SourcePayPromiseCls', 1, 302, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27845) ;

-- Внутренние зачисления(разассигновка), Бюджет(1)
CALL ImportField(30310001, 'Номер реестра', 'REESTRNUMBER', 'Номер реестра', 'REESTRNUMBER', 1, 303, 0, 0, 'НомерРеестра', 0, 19090) ;

CALL ImportField(30310002, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', 'BUHPAYMENTCLS', 1, 303, 0, 0, 'БухПроводка', 0, 18968) ;

CALL ImportField(30310003, '№ док.', 'DOCNUMBER', '№ док.', 'DOCumentNUMBER', 1, 303, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(30310004, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 303, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(30310005, 'Дата документа', 'DOCUMENTDATE', 'Дата документа', 'DOCUMENTDATE', 1, 303, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(30310006, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', 'ACCEPTDATE', 1, 303, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(30310007, 'Казн. cчет', 'SourceAccountName', 'Казн. cчет', 'SourceAccountName', 1, 303, 0, 0, '', 0, 17112) ;

CALL ImportField(30310008, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 303, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(30310009, 'Архив', 'ARHIVEDOC', 'Архив', 'ARHIVEDOC', 1, 303, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(30310010, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 303, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(30310033, 'Л/с(НРС) ', 'SOURCEFACIALACC_CLS', 'Л/с(НРС) ', 'SOURCEFACIALACCCLS', 1, 303, 0, 0, 'ЛицСчетПлательщика', 0, 18957) ;

CALL ImportField(30310034, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OPERATIONTYPECLS', 1, 303, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(30310035, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', ' ', 1, 303, 0, 0, '', 0, null) ;

CALL ImportField(30310041, 'Код счета казн.', 'SourceAccount', 'Код счета казн.', 'SourceAccount', 1, 303, 0, 1, 'РСФО,СчетПлат', 0, 18956) ;

CALL ImportField(30310042, 'Код реестра', 'Reestr_ref', 'Код реестра', 'Reestr_ref', 1, 303, 0, 1, 'КодРеестра', 0, 18971) ;

CALL ImportField(30310043, 'Дата реестра', 'ReestrDate', 'Дата реестра', 'ReestrDate', 1, 303, 0, 1, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(30310044, 'Причина отклонения', 'Reject_CLS', 'Причина отклонения', 'RejectCLS', 1, 303, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(30310045, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (пояснение)', 'RejectCause', 1, 303, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(30310046, 'Направление операции', 'OperationDirection', 'Направление операции', 'OPERATIONDIRECTION', 1, 303, 0, 1, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(30310047, 'Л/С плательщика в ФК', 'SourceFACIALCODE', 'Л/С плательщика в ФК', ' ', 1, 303, 0, 0, '', 0, null) ;

CALL ImportField(30310052, 'Тип классификации', 'ClsType', 'Вид классификации(расходная, источниковая, доходная)', 'CLSTYPE', 1, 303, 0, 0, 'ТипКлассификацииЗаголовок', 0, 19008) ;

CALL ImportField(30310053, 'Код документа', 'ID', 'Код документа', 'ID', 1, 303, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(30310054, 'Казн. cчет', 'DESTACCOUNT', 'Казн. cчет', 'DESTACCOUNT', 1, 303, 0, 1, 'СчетПолуч', 0, 18958) ;

CALL ImportField(30310055, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 303, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(30310056, 'Федеральные cредства', 'FEDERALFUNDSREF', 'Федеральные cредства', 'FEDERALFUNDSREF', 1, 303, 0, 1, 'ФедеральныеСредства', 0, 19004) ;

CALL ImportField(30310063, 'Код отправителя документа', 'SENDERID', 'Код отправителя документа', 'SenderID', 1, 303, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(30310064, 'Код УРМ документа', 'SENDERRECORDID', 'Код УРМ документа', 'SenderRecordID', 1, 303, 0, 1, 'КодУРМДокумента', 0, 18970) ;

CALL ImportField(30310065, 'Признак принятого реестра', 'Accepted', 'Признак принятого реестра', 'Accepted', 1, 303, 0, 1, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(30310067, 'CRYPTOSTATUS', 'CryptoStatus', 'Статус ЭЦП', ' ', 1, 303, 0, 1, '', 0, null) ;

CALL ImportField(30310068, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'Progindex', 1, 303, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(30310069, 'Отдел', 'DepartmentCLS', '', 'DEPARTMENTCLS', 1, 303, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(30310070, 'Номер л/с плательщика', 'SourceFacialCodeEx', '', ' ', 1, 303, 0, 0, '', 0, 26617) ;

CALL ImportField(30311011, 'Получатель', 'DestFacial_accName', 'Получатель', ' ', 1, 303, 1, 1, '', 0, null) ;

CALL ImportField(30311012, 'Л/с получателя', 'DESTFACIALACC_CLS', 'Л/с получателя', 'DESTFACIALACCCLS', 1, 303, 1, 0, 'ЛицевойСчет', 0, 18869) ;

CALL ImportField(30311013, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 303, 1, 0, '', 0, null) ;

CALL ImportField(30311014, 'ФКР(Классификация)', 'DestKFSR', 'КФСР', 'DestKFSR', 1, 303, 1, 0, 'КФСР', 0, 18897) ;

CALL ImportField(30311015, 'КЦСРКлюч', 'DestKCSR', 'КЦСР', 'DestKCSRKey', 1, 303, 1, 1, 'КЦСРКлюч', 0, 18896) ;

CALL ImportField(30311016, 'КВР Ключ', 'DESTKVR', 'КВР ', 'DESTKVRKey', 1, 303, 1, 1, 'КВРКлюч', 0, 18870) ;

CALL ImportField(30311017, 'ЭКР(Классификация)', 'DESTKESR', 'КЭСР', 'DESTKESR', 1, 303, 1, 0, 'КЭСР', 0, 18871) ;

CALL ImportField(30311020, 'Вид источника(Классификация)', 'DestIFS_DescriptionCode', 'Вид источника', 'DestIFS_DescriptionCode', 1, 303, 1, 0, '', 0, 17050) ;

CALL ImportField(30311021, 'ЭКИ(Классификация)', 'DestIFS_KESR', 'ЭК', ' ', 1, 303, 1, 0, '', 0, 17054) ;

CALL ImportField(30311022, 'Суб КОСГУ', 'DestSubKESR', 'Суб КЭСР', 'DestSubKESR', 1, 303, 1, 0, 'СубКЭСР', 0, 18898) ;

CALL ImportField(30311023, 'Источник финансирования', 'DestFinSource', 'Источник финансирования', 'DestFinSourceCLS', 1, 303, 1, 0, 'ИсточникФинансирования', 0, 18901) ;

CALL ImportField(30311025, 'Тип средств', 'DestMeansType', 'Тип средств', 'DestMeansTypeCLS', 1, 303, 1, 0, 'ТипСредств', 0, 18900) ;

CALL ImportField(30311026, 'Тип документа', 'DestDocType', 'Тип документа', 'DestDocTypeCLS', 1, 303, 1, 0, 'ТипДокумента', 0, 18903) ;

CALL ImportField(30311027, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 303, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(30311028, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 303, 1, 0, 'ПримечаниеДеталь', 0, 18876) ;

CALL ImportField(30311029, '№ мем. ордера', 'MEMORDERNUM', '№ мем. ордера', 'MEMORDERNUM', 1, 303, 1, 0, 'НомерМемордера', 0, 18875) ;

CALL ImportField(30311030, '№ бюдж. обязат-ва', 'Promise', '№ бюдж. обязат-ва', 'PROMISE', 1, 303, 1, 0, 'БюджОбяз', 0, 18885) ;

CALL ImportField(30311031, 'Номер БО получателя(договора)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', 'DESTBUDGETPROMISENUM', 1, 303, 1, 0, 'БОНомер,ДоговораБОНомер', 0, 20223) ;

CALL ImportField(30311032, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 303, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(30311036, 'КВСРКлюч', 'DestKVSR', 'КВСР', 'DestKVSRKey', 1, 303, 1, 1, 'КВСРКлюч', 0, 18895) ;

CALL ImportField(30311038, 'Тип классификации', 'ClsType', 'Вид классификации(расходная, источниковая, доходная)', 'ClsType', 1, 303, 1, 1, 'ТипКлассификации,ТипКлассификацииПлат', 0, 18922) ;

CALL ImportField(30311040, 'Район трансферта', 'DestRegionCls', 'Район', 'DESTREGIONCLS', 1, 303, 1, 0, 'Регион,РайонТрансферта', 0, 18928) ;

CALL ImportField(30311048, 'Л/С получателя в ФК', 'destfacialcode', 'Л/С получателя в ФК', ' ', 1, 303, 1, 0, '', 0, null) ;

CALL ImportField(30311049, '№ бюдж. обязат-ва получателя', 'DestBudgetPromiseCollaps', '№ бюдж. обязат-ва получателя', ' ', 1, 303, 1, 0, '', 0, null) ;

CALL ImportField(30311050, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', ' ', 1, 303, 1, 0, '', 0, null) ;

CALL ImportField(30311051, 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 'Номер', 'DestExecDocNum', 1, 303, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(30311057, 'Вн. номер БО получателя', 'DESTBUDGETPROMISE', 'Вн. номер БО получателя', 'DestBUDGETPROMISE', 1, 303, 1, 1, 'БОВнутрНомер,ДоговораБО', 0, 18909) ;

CALL ImportField(30311058, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Номер Д.И. получателя ссылка', 'DestExecDoc', 1, 303, 1, 1, 'ДокИсполнения', 0, 18918) ;

CALL ImportField(30311059, 'Источниковая классификация', 'DestIFS', 'Источниковая классификация', 'DestIFS', 1, 303, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПолуч', 0, 18921) ;

CALL ImportField(30311060, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 303, 1, 1, '', 0, 18872) ;

CALL ImportField(30311061, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 303, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(30311062, 'Код записи', 'ID', 'Код записи', 'Id', 1, 303, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(30311068, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 303, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(30311069, 'Источниковая классификация', 'DestIFS_FullID', 'DestIFS_FullID(Источниковая классификация)', 'DestIFS_DescriptionCode', 1, 303, 1, 1, 'ИсточникВнутрФинансирования,ИсточникВнутрФинансированияПолуч', 0, null) ;

CALL ImportField(30311070, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'Progindex', 1, 303, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(30311071, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств (ссылка)', 'DestTransfertCls', 1, 303, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18936) ;

CALL ImportField(30311077, 'Номер л/с получателя', 'DestFacialCodeEx', '', ' ', 1, 303, 1, 0, '', 0, 26617) ;

CALL ImportField(30311078, 'Наименование района трансферта', 'DestRegionClsName', '', ' ', 1, 303, 1, 0, '', 0, null) ;

CALL ImportField(30311087, 'Код бюджетного ассигнованияКлюч', 'DestBudAllocationCls', '', 'DestBudAllocationCls', 1, 303, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27842) ;

CALL ImportField(30311088, 'Код расходного обязательстваКлюч', 'DestPayPromiseCls', '', 'DestPayPromiseCls', 1, 303, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27843) ;

-- Выбытия по чекам, УРМ(0)
CALL ImportField(30400001, 'Номер заявки ПБС', 'BidNumber', 'Номер заявки ПБС', 'BidNumber', 0, 304, 0, 0, 'НомерЗаявки', 0, null) ;

CALL ImportField(30400002, 'Номер документа', 'DocNumber', 'Номер документа', 'DocumentNumber', 0, 304, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(30400003, 'Лицевой счет плательщика в ФК', 'SourceFacialCode', 'Лицевой счет плательщика в ФК', 'SourceFacialCode', 0, 304, 0, 0, '', 0, null) ;

CALL ImportField(30400004, 'Номер сводной заявки', 'ManagerBidNumber', 'Номер сводной заявки', 'ManagerBidNumber', 0, 304, 0, 0, 'НомерЛокальногоРеестра', 0, null) ;

CALL ImportField(30400005, 'Номер доверенности', 'TrustNumber', 'Номер доверенности', 'TrustNumber', 0, 304, 0, 0, 'НомерДоверенности', 0, null) ;

CALL ImportField(30400006, 'Номер реестра', 'ReestrNumber', 'Номер реестра', 'ReestrNumber', 0, 304, 0, 0, 'НомерРеестра', 0, null) ;

CALL ImportField(30400007, 'Мягкая причина отклонения (текст)', 'SoftRejectCause', 'Мягкая причина отклонения (текст)', 'SoftRejectCause', 0, 304, 0, 0, '', 0, null) ;

CALL ImportField(30400008, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 304, 0, 0, '', 0, null) ;

CALL ImportField(30400009, 'Период платежа', 'Period', 'Период платежа', 'Period', 0, 304, 0, 0, 'Период', 0, null) ;

CALL ImportField(30400010, 'Наименование получателя', 'Name', 'Наименование организации-получателя', 'DestOrgName', 0, 304, 0, 0, '', 0, null) ;

CALL ImportField(30400011, 'КПП ополучателя', 'INN20', 'КПП организации-получателя', 'DestOrgKPP', 0, 304, 0, 0, '', 0, null) ;

CALL ImportField(30400012, 'ИНН получателя', 'INN', 'ИНН организации-получателя', 'DestOrgINN', 0, 304, 0, 0, '', 0, null) ;

CALL ImportField(30400013, 'Л/С получателя (РВС)', 'DESTFACIALACC_CLS', 'Л/С получателя (РВС)', 'DestFacialAccCls', 0, 304, 0, 0, 'ЛицСчетПолучателя', 0, null) ;

CALL ImportField(30400014, 'Р/С получателя (счет кассы)', 'ACC', 'Р/С получателя (счет кассы)', 'DestAccountName', 0, 304, 0, 0, '', 0, null) ;

CALL ImportField(30400015, 'Сумма по документу', 'Summa', 'Сумма по документу', 'Summa', 0, 304, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(30400016, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 304, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(30400017, 'Дата проводки', 'AcceptDate', 'Дата проводки', 'AcceptDate', 0, 304, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(30400019, 'Дата документа', 'DocumentDate', 'Дата документа', 'DocumentDate', 0, 304, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(30400020, 'Дата реестра', 'ReestrDate', 'Дата реестра', 'REESTRDATE', 0, 304, 0, 0, 'ДатаРеестра', 0, null) ;

CALL ImportField(30400021, 'Вид платежа', 'PayTypeCls', 'Вид платежа', 'PAYTYPECLS', 0, 304, 0, 0, 'ВидПлатежа', 0, null) ;

CALL ImportField(30400022, 'Назначение платежа', 'Note', 'Назначение платежа', 'NOTE', 0, 304, 0, 0, 'Примечание', 0, null) ;

CALL ImportField(30400023, 'Очередность платежа', 'PayPriority', 'Очередность платежа', 'PayPriority', 0, 304, 0, 0, 'Очередность', 0, null) ;

CALL ImportField(30400024, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 0, 304, 0, 0, 'ТипОперации', 0, null) ;

CALL ImportField(30400025, 'Бухгалтерская проводка', 'BuhPaymentCls', 'Бухгалтерская проводка', 'BUHPAYMENTCLS', 0, 304, 0, 0, 'БухПроводка', 0, null) ;

CALL ImportField(30400026, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 0, 304, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(30400027, 'Причина отклонения (пояснение)', 'RejectCause', 'Причина отклонения (пояснение)', 'RejectCause', 0, 304, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(30400028, 'Кассовый символ', 'PaySymbolCls', 'Кассовый символ', 'PaySymbolCls', 0, 304, 0, 0, '', 0, null) ;

CALL ImportField(30400029, 'Р/С плательщика (казначейский счет)', 'SourceAccountName', 'Р/С плательщика (казначейский счет)', 'SourceAccountName', 0, 304, 0, 0, '', 0, null) ;

CALL ImportField(30400030, 'Срок платежа', ' ', 'Срок платежа', 'PayDate', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400031, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 304, 0, 1, 'ИндексыДанныхЗаголовок', 0, null) ;

CALL ImportField(30400032, 'Номер карточки', ' ', 'Номер карточки', 'CARDNUMBER', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400033, 'Код счета плательщика', 'SOURCEACCOUNT', 'Код счета плательщика', 'SOURCEACCOUNT', 0, 304, 0, 1, 'РСФО,СчетПлат', 0, null) ;

CALL ImportField(30400034, 'Код счета получателя', 'DESTACCOUNT', 'Код счета организации-получателя', 'DESTACCOUNT', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400035, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400036, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400037, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400038, 'Локальный реестр', 'ManagerBid', 'Локальный реестр', 'ManagerBid', 0, 304, 0, 0, 'ЛокальныйРеестр', 0, null) ;

CALL ImportField(30400039, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400040, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400043, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400044, 'Код реестра', ' ', 'Код реестра', 'Reestr_Ref', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400045, 'Статус ЭЦП', ' ', 'Статус ЭЦП', 'CRYPTOSTATUS', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400046, 'Отдел', ' ', 'Отдел', 'DEPARTMENTCLS', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400047, 'Связанный документ', ' ', 'Связанный документ', 'LINKEDDOCUMENT', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400048, 'Номер заявки отдела', ' ', 'Номер заявки отдела', 'RequestNumber', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400049, 'Дата заявки отдела', ' ', 'Дата заявки отдела', 'RequestDate', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400050, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400051, 'Субсчет плательщика', ' ', 'Субсчет плательщика', 'SourceFKFacialCode', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400052, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400053, 'ИНН плательщика', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400054, 'КПП плательщика', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400055, 'Наименование плательщика', ' ', 'Наименование организации-плательщика', 'SourceOrgName', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400056, 'Город плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400057, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400058, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400059, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400060, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400061, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400062, 'л\с плательщика', ' ', 'л\с плательщика', 'SourceFacialAccClsName', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400063, 'Мнемокод л\с плательщика', ' ', 'Мнемокод л\с плательщика', 'SourceFacialAccClsFacialCode', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400064, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400065, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400066, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400067, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400068, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400069, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400070, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400071, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400072, 'Субсчет получателя', ' ', 'Субсчет получателя', 'DestFKFacialCode', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400073, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400074, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400075, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400076, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400077, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400078, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400079, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400080, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400081, 'л\с получателя (РВС)', ' ', 'л\с получателя', 'DestFacialAccClsName', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400082, 'мнемокод л\с получателя (РВС)', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400083, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400084, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400085, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400086, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400087, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400088, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400089, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400117, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400123, 'Код документа', 'ID', 'Код документа', 'ID', 0, 304, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30400125, 'Направление операции', 'OperationDirection', 'Направление операции', ' ', 0, 304, 0, 0, 'НаправлениеОперации', 0, null) ;

CALL ImportField(30400134, 'Персональная информация', 'CashierPersonalInfo', 'Персональная информация', 'CashierPersonalInfo', 0, 304, 0, 0, 'ПерсональнаяИнформация', 0, null) ;

CALL ImportField(30400135, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 304, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(30400137, 'Тип классификации', 'ClsType', 'Вид классификации(расходная, источниковая, доходная)', 'CLSTYPE', 0, 304, 0, 0, 'ТипКлассификацииЗаголовок', 0, null) ;

CALL ImportField(30400143, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400145, 'Дата заявки', 'BidDate', 'ДатаЗаявки', 'BidDate', 0, 304, 0, 0, 'ДатаЗаявки', 0, null) ;

CALL ImportField(30400150, 'Код документа в ФО', 'FUID', 'Код документа в ФО', 'FUID', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400151, 'Район бюджетного учреждения', 'RegionBudgetEst', 'Район бюджетного учреждения', 'RegionBudgetEst', 0, 304, 0, 1, '', 0, null) ;

CALL ImportField(30400159, 'Номер пластиковой карты', 'CardRefName', 'Номер пластиковой карты', 'CardRefName', 0, 304, 0, 0, 'НомерПластиковойКарты', 0, 18939) ;

CALL ImportField(30401001, 'Источник финансирования', 'SOURCEFINSOURCE', 'Источник финансирования', 'SOURCEFINSOURCECLS', 0, 304, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(30401002, 'Сумма по строке детализации', 'Summa', 'Сумма по строке детализации', 'Summa', 0, 304, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(30401003, 'КЭСР', 'SourceKESR', 'КЭСР', 'SourceKESR', 0, 304, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(30401004, 'КФСР', 'SourceKFSR', 'КФСР', 'SourceKFSR', 0, 304, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(30401005, 'Кассовый символ', 'PaySymbolCls', 'Кассовый символ', 'PaySymbolCls', 0, 304, 1, 0, 'КассовыйСимвол', 0, null) ;

CALL ImportField(30401007, 'КВСР (Ключ)', 'SOURCEKVSR', 'КВСР (Ключ)', 'SourceKVSRKey', 0, 304, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(30401008, 'Тип средств', 'SourceMeansType', 'Тип средств', 'SOURCEMEANSTYPECLS', 0, 304, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(30401009, 'КЦСРКлюч', 'SOURCEKCSR', 'КЦСР', 'SourceKCSRKey', 0, 304, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(30401010, 'Номер бюджетного обязательства', 'SourcePromise', 'Номер бюджетного обязательства', 'SOURCEPROMISE', 0, 304, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(30401012, 'СубКЭСР', 'SourceSubKESR', 'СубКЭСР', 'SOURCESUBKESR', 0, 304, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(30401013, 'Примечание по строке детализации', 'Note', 'Примечание по строке детализации', 'Note', 0, 304, 1, 0, 'ПримечаниеДеталь', 0, null) ;

CALL ImportField(30401014, 'КВРКлюч', 'SOURCEKVR', 'КВР', 'SourceKVRKey', 0, 304, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(30401016, 'Ссылка на внутренний номер БО плательщика', 'SourceBudgetPromise', 'Ссылка на внутренний номер БО плательщика', 'Ссылка на внутренний номер БО плательщика', 0, 304, 1, 1, 'ДоговораБО,БОВнутрНомер', 0, null) ;

CALL ImportField(30401017, 'Номер БО плательщика(договора)', 'SourceBudgetPromiseNum', 'Номер БО плательщика(договора)', 'Номер БО плательщика', 0, 304, 1, 0, 'ДоговораБОНомер,БОНомер', 0, null) ;

CALL ImportField(30401018, 'Документ исполнения плательщика', 'SourceExecDocCollaps', 'Документ исполнения плательщика', 'Документ исполнения плательщика', 0, 304, 1, 0, 'ДокИсполненияГруппа', 0, null) ;

CALL ImportField(30401019, 'Ссылка на документ исполнения плательщика', 'SourceExecDoc', 'Ссылка на документ исполнения плательщика', 'Ссылка на документ исполнения плательщика', 0, 304, 1, 1, 'ДокИсполнения', 0, null) ;

CALL ImportField(30401020, 'Номер документа исполнения плательщика', 'SourceExecDocNum', 'Номер документа исполнения плательщика', 'Номер документа исполнения плательщика', 0, 304, 1, 0, 'ДокИсполненияНомер', 0, null) ;

CALL ImportField(30401021, 'Реестровый номер ДИ плательщика', 'SourceExecDocReestr', 'Реестровый номер ДИ плательщика', 'Реестровый номер ДИ плательщика', 0, 304, 1, 1, 'ДокИсполненияНомерРеестра', 0, null) ;

CALL ImportField(30401022, 'Дата ДИ плательщика', 'SourceExecDocDate', 'Дата ДИ плательщика', 'Дата ДИ плательщика', 0, 304, 1, 1, 'ДокИсполненияДата', 0, null) ;

CALL ImportField(30401023, 'Тип ДИ плательщика', 'SourceExecDocType', 'Тип ДИ плательщика', 'Тип ДИ плательщика', 0, 304, 1, 1, 'ДокИсполненияТип', 0, null) ;

CALL ImportField(30401024, 'Сумма по ДИ плательщика', 'SourceExecDocSumma', 'Сумма по ДИ плательщика', 'Сумма по ДИ плательщика', 0, 304, 1, 1, 'ДокИсполненияСумма', 0, null) ;

CALL ImportField(30401025, 'Примечание ДИ плательщика', 'SourceExecDocNote', 'Примечание ДИ плательщика', 'Примечание ДИ плательщика', 0, 304, 1, 1, 'ДокИсполненияПримечание', 0, null) ;

CALL ImportField(30401026, 'Ссылка на внутренний номер БО получателя', ' ', 'Ссылка на внутренний номер БО получателя', 'Ссылка на внутренний номер БО получателя', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401027, 'Номер БО получателя(договора)', ' ', 'Номер БО получателя(договора)', 'Номер БО получателя', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401028, 'Документ исполнения получателя', ' ', 'Документ исполнения получателя', 'Документ исполнения получателя', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401029, 'Ссылка на документ исполнения получателя', ' ', 'Ссылка на документ исполнения получателя', 'Ссылка на документ исполнения получателя', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401030, 'Номер документа исполнения получателя', ' ', 'Номер документа исполнения получателя', 'Номер документа исполнения получателя', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401031, 'Реестровый номер ДИ получателя', ' ', 'Реестровый номер ДИ получателя', 'Реестровый номер ДИ получателя', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401032, 'Дата ДИ получателя', ' ', 'Дата ДИ получателя', 'Дата ДИ получателя', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401033, 'Тип ДИ получателя', ' ', 'Тип ДИ получателя', 'Тип ДИ получателя', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401034, 'Сумма по ДИ получателя', ' ', 'Сумма по ДИ получателя', 'Сумма по ДИ получателя', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401035, 'Примечание ДИ получателя', ' ', 'Примечание ДИ получателя', 'Примечание ДИ получателя', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401036, 'Бюджетное обязательство плательщика', 'SourceBudgetPromiseCollaps', 'Бюджетное обязательство плательщика', 'SourceBudgetPromiseCollaps', 0, 304, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30401037, 'Сумма БО', 'SourceBudgetPromiseSumma', 'Сумма БО', 'SourceBudgetPromiseSumma', 0, 304, 1, 1, 'ДоговораБОСумма', 0, null) ;

CALL ImportField(30401038, 'Номер договора', 'SourceBudgetPromiseDocNumber', 'Номер документа', 'SourceBudgetPromiseDocNumber', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401039, 'Дата договора', 'SourceBudgetPromiseDocDate', 'Дата документа', 'SourceBudgetPromiseDocDate', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401040, 'Сумма договора', 'SourceBudgetPromiseDocSumma', 'Сумма документа', 'SourceBudgetPromiseDocSumma', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401041, 'Реестровый номер дог.', 'SourceBudgetPromiseDocReestrNum', 'Реестровый номер док.', 'SourceBudgetPromiseDocReestrNum', 0, 304, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(30401042, 'Дог. примечание', 'SourceBudgetPromiseDocNote', 'Док. примечание', 'SourceBudgetPromiseDocNote', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401043, 'Номер гос. контракта', 'SourceBudgetPromiseSONum', 'Номер гос. контракта', 'SourceBudgetPromiseSONum', 0, 304, 1, 1, 'ДоговораБОНомерКонтракта', 0, null) ;

CALL ImportField(30401044, 'Дата гос. контракта', 'SourceBudgetPromiseSODate', 'Дата гос. контракта', 'SourceBudgetPromiseSODate', 0, 304, 1, 1, 'ДоговораБОДатаКонтракта', 0, null) ;

CALL ImportField(30401045, 'Сумма гос. контракта', 'SourceBudgetPromiseSOSumma', 'Сумма гос. контракта', 'SourceBudgetPromiseSOSumma', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401046, 'Реестровый номер гос. контр', 'SourceBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр', 'SourceBudgetPromiseSOReestrNum', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401047, 'Прим. гос. контракта', 'SourceBudgetPromiseSONote', 'Прим. гос. контракта', 'SourceBudgetPromiseSONote', 0, 304, 1, 1, 'ДоговораБОПримечаниеКонтракта', 0, null) ;

CALL ImportField(30401048, 'Бюджетное обязательство получателя', ' ', 'Бюджетное обязательство получателя', 'DestBudgetPromiseCollaps', 0, 304, 1, 0, '', 0, null) ;

CALL ImportField(30401049, 'Сумма БО получетеля', ' ', 'Сумма БО получетеля', 'DestBudgetPromiseSumma', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401050, 'Номер договора получетеля', ' ', 'Номер договора получетеля', 'DestBudgetPromiseAgrNum', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401051, 'Дата договора получателя', ' ', 'Дата договора получателя', 'DestBudgetPromiseAgrDate', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401052, 'Сумма договора получетеля', ' ', 'Сумма договора получетеля', 'DestBudgetPromiseAgrSumma', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401053, 'Реестровый номер дог', ' ', 'Реестровый номер дог', 'DestBudgetPromiseAgrReestrNum', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401054, 'Дог. примечание получателя', ' ', 'Дог. примечание получателя', 'DestBudgetPromiseAgrNote', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401055, 'Номер гос. контракта получетеля', ' ', 'Номер гос. контракта получетеля', 'DestBudgetPromiseSONum', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401056, 'Дата гос. контракта получателя', ' ', 'Дата гос. контракта получателя', 'DestBudgetPromiseSODate', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401057, 'Сумма гос. контракта получетеля', ' ', 'Сумма гос. контракта получетеля', 'DestBudgetPromiseSOSumma', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401058, 'Реестровый номер гос. контр получетеля', ' ', 'Реестровый номер гос. контр получетеля', 'DestBudgetPromiseSOReestrNum', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401059, 'Прим. гос. контракта получетеля', ' ', 'Прим. гос. контракта получетеля', 'DestBudgetPromiseSONote', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401060, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 304, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(30401061, 'Бух операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 0, 304, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(30401062, 'Тип классификации', 'ClsType', 'Вид классификации(расходная, источниковая, доходная)', 'ClsType', 0, 304, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(30401066, 'л\с плательщика', 'SourceFacialAcc_Cls', 'л\с плательщика', 'SourceFacialAccCls', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401067, 'Тип документа плательщика', 'SOURCEDOCTYPE', 'Тип документа плательщика', 'SOURCEDOCTYPECLS', 0, 304, 1, 0, 'ТипДокумента', 0, null) ;

CALL ImportField(30401068, 'Классификация ИВнФ(Ключ)', 'SourceIFS', 'Классификация ИВнФ(Ключ)', 'SourceIFS', 0, 304, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПлат', 0, null) ;

CALL ImportField(30401070, 'Район', 'SourceRegionCLS', 'Район', 'RegionCLS', 0, 304, 1, 0, 'Регион,РайонТрансферта', 0, null) ;

CALL ImportField(30401071, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401072, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 0, 304, 1, 0, '', 0, null) ;

CALL ImportField(30401101, 'Код дохода(Ключ)', 'SourceKD', 'Код дохода(Ключ)', 'SourceKD', 0, 304, 1, 1, 'КДКлюч', 0, null) ;

CALL ImportField(30401114, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 0, 304, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30401118, 'Источник образования', 'SourceFundsSource', 'Источник образования', 'SourceFundsSource', 0, 304, 1, 0, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(30401136, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401138, 'Код целевых средствКлюч', 'SourceTransfertCls', 'Код целевых средств (ссылка)', 'SourceTransfertCls', 0, 304, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(30401139, 'Код целевых средств', 'SourceTransfertClsCode', 'Код целевых средств', 'SourceTransfertClsValue', 0, 304, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(30401140, 'КЦСР(Классификация)', 'SourceKCSRCode', '', 'SourceKCSR', 0, 304, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(30401141, 'КВР(Классификация)', 'SOURCEKVRCode', '', 'SourceKVR', 0, 304, 1, 0, 'КВР', 0, null) ;

CALL ImportField(30401142, 'КВСР', 'SourceKVSRCode', 'КВСР', 'SourceKVSR', 0, 304, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(30401146, 'Код дохода(Классфикация)', 'SourceKDCode', 'Код дохода(Классфкация)', 'SourceKDCode', 0, 304, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(30401148, 'Код цели', 'TargetCls', 'Код цели', ' ', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401149, 'ИД контрактa', 'SourceBudgetPromiseSOID', 'ИД контракта', 'SourceBudgetPromiseSOID', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401150, 'Код записи', 'ID', 'Код записи', 'Id', 0, 304, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(30401151, 'Код записи в ФО', 'FUID', 'Код записи в ФО', 'FUID', 0, 304, 1, 1, '', 0, null) ;

CALL ImportField(30401152, 'Код субсидииКлюч', 'SourceSubsidyCls', 'Код субсидии (ссылка)', 'SourceSubsidyCls', 0, 304, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(30401153, 'Код субсидии', 'SourceSubsidyClsCode', 'Код субсидии', 'SourceSubsidyClsCode', 0, 304, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(30401154, 'Код бюджетного ассигнования', 'SourceBudAllocationClsCode', '', ' ', 0, 304, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(30401155, 'Код расходного обязательства', 'SourcePayPromiseClsCode', '', ' ', 0, 304, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(30401156, 'Код бюджетного ассигнования (ключ)', 'SourceBudAllocationCls', '', ' ', 0, 304, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(30401157, 'Код расходного обязательства (ключ)', 'SourcePayPromiseCls', '', ' ', 0, 304, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

-- Выбытия по чекам, Бюджет(1)
CALL ImportField(30410001, 'Вид операции', 'TYPEOPERATIONCLS', 'Тип операции', 'OperationTypeCls', 1, 304, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(30410002, 'Архив', 'ARHIVEDOC', 'Признак архивности', 'ARHIVEDOC', 1, 304, 0, 0, 'Архивные,ПризнакАрхивности', 0, 18961) ;

CALL ImportField(30410003, 'Номер заявки', 'BIDNUMBER', 'Номер заявки ПБС', 'BidNUMBER', 1, 304, 0, 0, 'НомерЗаявки', 0, 18993) ;

CALL ImportField(30410004, 'Период', 'PERIOD', 'Период', 'Period', 1, 304, 0, 0, 'Период', 0, 18965) ;

CALL ImportField(30410005, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бухгалтерская проводка', 'BUHPAYMENTCLS', 1, 304, 0, 0, 'БухПроводка', 0, 18968) ;

CALL ImportField(30410006, 'Дата проводки', 'ACCEPTDATE', 'Дата проводки', 'AcceptDate', 1, 304, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(30410007, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (текст)', 'RejectCause', 1, 304, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(30410008, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 304, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(30410009, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 1, 304, 0, 1, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(30410010, 'Сумма(руб)', 'SUMMA', 'Сумма', 'SUMMA', 1, 304, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(30410011, 'Номер доверенности', 'TRUSTNUMBER', 'Номер доверенности', 'TrustNumber', 1, 304, 0, 0, 'НомерДоверенности', 0, 18976) ;

CALL ImportField(30410012, 'Счет кассы(Банк)', 'ACC', 'Счет кассы', 'DestAccountName', 1, 304, 0, 0, '', 0, 17112) ;

CALL ImportField(30410013, 'Банк(Банк)', 'NAME', 'Банк', 'SourceBankFUID', 1, 304, 0, 0, '', 0, 16646) ;

CALL ImportField(30410014, 'КПП банка(Банк)', 'INN20', 'КПП банка', 'DestOrgKPP', 1, 304, 0, 0, '', 0, 16653) ;

CALL ImportField(30410015, 'ИНН банка(Банк)', 'INN', 'ИНН банка', 'DestOrgINN', 1, 304, 0, 0, '', 0, 16645) ;

CALL ImportField(30410016, 'Р/С плательщика (казначейский)', 'SOURCEACCOUNTNAME', 'Р/С плательщика (казначейский)', 'SourceAccountName', 1, 304, 0, 0, '', 0, 17112) ;

CALL ImportField(30410017, 'Л/с плательщика', 'SOURCEFACIALACC_CLS', 'Л/С плательщика', 'SourceFacialAccCls', 1, 304, 0, 0, 'ЛицевойСчет', 0, 18957) ;

CALL ImportField(30410018, 'Дата чека', 'DOCUMENTDATE', 'Дата чека', 'DocumentDate', 1, 304, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(30410019, '№ чека', 'DOCNUMBER', 'Номер чека', 'DocumentNumber', 1, 304, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(30410020, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 304, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(30410021, 'Отдел', 'DEPARTMENTCLS', 'Отдел', 'DEPARTMENTCLS', 1, 304, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(30410022, 'Номер реестра', 'REESTRNUMBER', 'Номер реестра', 'ReestrNumber', 1, 304, 0, 0, 'НомерРеестра', 0, 19090) ;

CALL ImportField(30410024, 'Л/с (РВС) ', 'DESTFACIALACC_CLS', 'Л/С получателя (РВС)', 'DestFacialAccCls', 1, 304, 0, 0, 'ЛицСчетПолучателя', 0, 18959) ;

CALL ImportField(30410025, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', ' ', 1, 304, 0, 0, '', 0, null) ;

CALL ImportField(30410026, 'Банк', 'ParentdestBank', 'Банк(группа)', ' ', 1, 304, 0, 0, '', 0, null) ;

CALL ImportField(30410027, 'Л/С плательщика в ФК', 'SourceFACIALCODE', 'Л\с Плательщика в ФК', ' ', 1, 304, 0, 0, '', 0, null) ;

CALL ImportField(30410028, 'Срок платежа', 'PayDate', 'Срок платежа', 'PayDate', 1, 304, 0, 1, 'СрокПлатежа', 0, 18951) ;

CALL ImportField(30410030, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 1, 304, 0, 1, 'ВидПлатежа', 0, 18963) ;

CALL ImportField(30410031, 'Очередность', 'PayPriority', 'Очередность', 'PayPriority', 1, 304, 0, 1, 'Очередность', 0, 18966) ;

CALL ImportField(30410032, 'Номер карточки', ' ', 'Номер карточки', 'CARDNUMBER', 1, 304, 0, 0, '', 1, null) ;

CALL ImportField(30410033, 'Код счета плательщика', 'SOURCEACCOUNT', 'Код счета плательщика', 'SOURCEACCOUNT', 1, 304, 0, 1, 'РСФО,СчетПлат', 0, 18956) ;

CALL ImportField(30410034, 'СостояниеДокумента', 'DocStateRef', 'Состояние документа', 'DocStateRef', 1, 304, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(30410035, 'Есть в Бюджете', ' ', 'Есть в Бюджете', 'IsInBudget', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410036, 'Признак зависания', ' ', 'Признак зависания', 'DocSuspended', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410037, 'Локальная виза', ' ', 'Локальная виза', 'IsVised', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410038, 'Ссылка на реестр заявок', 'ManagerBid', 'Локальный реестр', 'ManagerBid', 1, 304, 0, 1, 'ЛокальныйРеестр', 0, 18992) ;

CALL ImportField(30410039, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410040, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410043, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410044, 'Код реестра', 'Reestr_Ref', 'Код реестра', 'Reestr_Ref', 1, 304, 0, 1, 'КодРеестра', 0, 18971) ;

CALL ImportField(30410045, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 304, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(30410046, 'Мягкая причина отклонения', ' ', 'Мягкая причина отклонения', 'SoftRejectCls', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410047, 'Текст мягкой причины отклонения', ' ', 'Текст мягкой причины отклонения', 'SoftRejectCause', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410049, 'Номер заявки отдела', ' ', 'Номер заявки отдела', 'RequestNumber', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410050, 'Дата заявки отдела', ' ', 'Дата заявки отдела', 'RequestDate', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410051, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410052, 'Субсчет плательщика', ' ', 'Субсчет плательщика', 'SourceFKFacialCode', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410053, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410054, 'Ссылка на организацию ФО плательщика', ' ', 'Ссылка на организацию ФО плательщика', 'SourceOrgFUID', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410055, 'ИНН организации-плательщика', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410056, 'КПП организации-плательщика', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410057, 'Наименование организации-плательщика', ' ', 'Наименование организации-плательщика', 'SourceOrgName', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410058, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410059, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410060, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410061, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410062, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410063, 'л\с плательщика', ' ', 'л\с плательщика', 'SourceFacialAccClsName', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410064, 'Мнемокод л\с плательщика', ' ', 'Мнемокод л\с плательщика', 'SourceFacialAccClsFacialCode', 1, 304, 0, 0, '', 1, null) ;

CALL ImportField(30410065, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410066, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410067, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410068, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410069, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410070, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410071, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410073, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410074, 'Субсчет получателя', ' ', 'Субсчет получателя', 'DestFKFacialCode', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410075, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410076, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410079, 'Наименование организации-получателя', ' ', 'Наименование организации-получателя', 'DestOrgName', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410080, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410081, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410082, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410083, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410084, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410085, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410086, 'л\с получателя (РВС)', ' ', 'л\с получателя', 'DestFacialAccClsName', 1, 304, 0, 0, '', 1, null) ;

CALL ImportField(30410087, 'Мнемокод л\с получателя (РВС)', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 1, 304, 0, 0, '', 1, null) ;

CALL ImportField(30410088, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410089, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410090, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410091, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410092, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410093, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410094, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 1, 304, 0, 1, '', 1, null) ;

CALL ImportField(30410095, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 304, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(30410096, 'Направление операции', 'OperationDirection', 'Направление операции', 'OperationDirection', 1, 304, 0, 0, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(30410104, 'Тип классификации', 'ClsType', 'Вид классификации(расходная, источниковая, доходная)', 'CLSTYPE', 1, 304, 0, 0, 'ТипКлассификацииЗаголовок', 0, 19008) ;

CALL ImportField(30410105, 'Код документа', 'ID', 'Код документа', 'ID', 1, 304, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(30410106, 'Состояние казн. док', 'TreasuaryDocStateCLS', 'Состояние казн. док', ' ', 1, 304, 0, 1, 'СостояниеДокументаКазн,СоcтояниеКазнДок', 0, 18988) ;

CALL ImportField(30410108, 'Уточнение индекса данных', 'SubProgIndex', 'Уточнение индекса данных', ' ', 1, 304, 0, 1, 'УточнениеИндексаДанных', 0, 18984) ;

CALL ImportField(30410109, 'Федеральные cредства', 'FEDERALFUNDSREF', 'Федеральные cредства', ' ', 1, 304, 0, 1, 'ФедеральныеСредства', 0, 19004) ;

CALL ImportField(30410115, 'Код удаленного клиента', 'SENDERID', 'Код удаленного клиента', 'SenderID', 1, 304, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(30410116, 'Код УРМ документа', 'SENDERRECORDID', 'Код УРМ документа', 'SenderRecordID', 1, 304, 0, 1, 'КодУРМДокумента', 0, 18970) ;

CALL ImportField(30410119, 'Признак принятого реестра', 'Accepted', 'Признак принятого реестра', 'Accepted', 1, 304, 0, 1, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(30410121, '№(Локальный реестр)', 'ManagerBIDNUMBER', '№(Локальный реестр)', ' ', 1, 304, 0, 1, 'НомерЛокальногоРеестра', 0, 20507) ;

CALL ImportField(30410122, 'Персональная информация', 'CashierPersonalInfo', 'Персональная информация', 'CashierPersonalInfo', 1, 304, 0, 0, 'ПерсональнаяИнформация', 0, 24731) ;

CALL ImportField(30410124, 'Счетчик факсов', 'FaxDocCount', 'Счетчик факсов', ' ', 1, 304, 0, 1, '', 0, null) ;

CALL ImportField(30410125, 'Дата заявки', 'BidDate', 'Дата заявки', 'BIDDATE', 1, 304, 0, 0, 'ДатаЗаявки', 0, 24730) ;

CALL ImportField(30410126, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'Progindex', 1, 304, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(30410127, 'Номер л/с плательщика', 'SourceFacialCodeEx', '', ' ', 1, 304, 0, 0, '', 0, 26617) ;

CALL ImportField(30410128, 'Район бюджетного учреждения', 'RegionBudgetEst', 'Район бюджетного учреждения', 'RegionBudgetEst', 1, 304, 0, 1, 'РайонБУ', 0, null) ;

CALL ImportField(30411002, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 304, 1, 0, 'ПримечаниеДеталь', 0, 18876) ;

CALL ImportField(30411003, 'Номер БО плательщика(договора)', 'SOURCEBUDGETPROMISENUM', 'Номер БО плательщика(договора)', 'SOURCEBUDGETPROMISENUM', 1, 304, 1, 0, 'ДоговораБОНомер,БОНомер', 0, 20223) ;

CALL ImportField(30411004, '№ БO плательщика', 'SOURCEPROMISE', 'Номер бюджетного обязательства', 'SOURCEPROMISE', 1, 304, 1, 0, 'БюджОбяз', 0, 18905) ;

CALL ImportField(30411005, 'Кассовый символ', 'PAYSYMBOLCLS', 'Кассовый символ', 'PaySymbolCls', 1, 304, 1, 0, 'КассовыйСимвол', 0, 18874) ;

CALL ImportField(30411006, 'Сумма(руб)', 'SUMMA', 'Сумма', 'SUMMA', 1, 304, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(30411007, 'Тип документа', 'SOURCEDOCTYPE', 'Тип документа', 'SOURCEDOCTYPECLS', 1, 304, 1, 0, 'ТипДокумента', 0, 18894) ;

CALL ImportField(30411009, 'Источник финансирования', 'SOURCEFINSOURCE', 'Источник финансирования', 'SOURCEFINSOURCECLS', 1, 304, 1, 0, 'ИсточникФинансирования', 0, 18892) ;

CALL ImportField(30411011, 'КВСРКлюч', 'SOURCEKVSR', 'КВСР', 'SourceKVSRKey', 1, 304, 1, 1, 'КВСРКлюч', 0, 18886) ;

CALL ImportField(30411012, 'КЦСРКлюч', 'SOURCEKCSR', 'КЦСР', 'SourceKCSRKey', 1, 304, 1, 1, 'КЦСРКлюч', 0, 18887) ;

CALL ImportField(30411013, 'ФКР(Классификация)', 'SOURCEKFSR', 'КФСР', 'SourceKFSR', 1, 304, 1, 0, 'КФСР', 0, 18888) ;

CALL ImportField(30411014, 'ЭКР(Классификация)', 'SOURCEKESR', 'КЭСР', 'SourceKESR', 1, 304, 1, 0, 'КЭСР', 0, 18868) ;

CALL ImportField(30411015, 'КВРКлюч', 'SOURCEKVR', 'КВР', 'SourceKVRKey', 1, 304, 1, 1, 'КВРКлюч', 0, 18867) ;

CALL ImportField(30411016, 'Суб КОСГУ', 'SOURCESUBKESR', 'СубКЭСР', 'SOURCESUBKESR', 1, 304, 1, 0, 'СубКЭСР', 0, 18889) ;

CALL ImportField(30411017, 'Тип средств', 'SOURCEMEANSTYPE', 'Тип средств', 'SOURCEMEANSTYPECLS', 1, 304, 1, 0, 'ТипСредств', 0, 18891) ;

CALL ImportField(30411019, 'Классификация', 'TreeOwner0', 'Классификация(группа)', ' ', 1, 304, 1, 0, '', 0, null) ;

CALL ImportField(30411020, 'Вн. номер БО плательщика', 'SourceBudgetPromise', 'Ссылка на внутренний номер БО плательщика', 'SOURCEBUDGETPROMISE', 1, 304, 1, 1, 'ДоговораБО,БОВнутрНомер', 0, 18908) ;

CALL ImportField(30411021, 'Док. исполнения плательщика', 'SourceExecDocCollaps', 'Документ исполнения плательщика', ' ', 1, 304, 1, 0, '', 0, null) ;

CALL ImportField(30411022, 'Номер Д.И. плательщика ссылка', 'SourceExecDoc', 'Ссылка на документ исполнения плательщика', 'SourceExecDoc', 1, 304, 1, 1, 'ДокИсполнения', 0, 18917) ;

CALL ImportField(30411023, 'Номер(Док. исполнения плательщика)', 'SourceExecDocNum', 'Номер документа исполнения плательщика', 'SourceExecDocNum', 1, 304, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(30411024, 'Реестровый номер(Док. исполнения плательщика)', 'SourceExecDocReestr', 'Реестровый номер ДИ плательщика', 'SourceExecDocReestr', 1, 304, 1, 1, 'ДокИсполненияНомерРеестра', 0, 19756) ;

CALL ImportField(30411025, 'Дата(Док. исполнения плательщика)', 'SourceExecDocDate', 'Дата ДИ плательщика', 'SourceExecDocDate', 1, 304, 1, 1, 'ДокИсполненияДата', 0, 19740) ;

CALL ImportField(30411026, 'Тип(Док. исполнения плательщика)', 'SourceExecDocType', 'Тип ДИ плательщика', 'SourceExecDocType', 1, 304, 1, 1, 'ДокИсполненияТип', 0, 19738) ;

CALL ImportField(30411027, 'Сумма(Док. исполнения плательщика)', 'SourceExecDocSumma', 'Сумма по ДИ плательщика', 'SourceExecDocSumma', 1, 304, 1, 1, 'ДокИсполненияСумма', 0, 19744) ;

CALL ImportField(30411028, 'Назначение(Док. исполнения плательщика)', 'SourceExecDocNote', 'Примечание ДИ плательщика', 'SourceExecDocNote', 1, 304, 1, 1, 'ДокИсполненияПримечание', 0, 19762) ;

CALL ImportField(30411042, 'л\с плательщика', ' ', 'л\с плательщика', 'SourceFacialAccCls', 1, 304, 1, 0, '', 1, null) ;

CALL ImportField(30411043, 'Район трансферта', 'SourceRegionCLS', 'Район', 'SourceRegionCls', 1, 304, 1, 1, 'Регион,РайонТрансферта', 0, 18927) ;

CALL ImportField(30411044, 'Код Сметы', ' ', 'Код Сметы', 'StimateId', 1, 304, 1, 1, '', 1, null) ;

CALL ImportField(30411045, 'Операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 1, 304, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(30411046, 'Тип классификации', 'ClsType', 'Вид классификации(расходная, источниковая, доходная)', 'ClsType', 1, 304, 1, 1, 'ТипКлассификации', 0, 18922) ;

CALL ImportField(30411048, '№ бюдж. обязат-ва плательщика', 'SourceBudgetPromiseCollaps', 'Бюджетное обязательство плательщика', ' ', 1, 304, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30411049, 'Сумма БО(№ бюдж. обязат-ва плательщика)', 'SourceBudgetPromiseSumma', 'Сумма БО', 'SourceBudgetPromiseSumma', 1, 304, 1, 1, 'ДоговораБОСумма', 0, 20242) ;

CALL ImportField(30411050, 'Номер договора', 'SourceBudgetPromiseAgrNum', 'Номер договора', 'SourceBudgetPromiseAgrNum', 1, 304, 1, 1, 'ДоговораБОНомерДоговора', 0, null) ;

CALL ImportField(30411051, 'Дата договора', 'SourceBudgetPromiseAgrDate', 'Дата договора', 'SourceBudgetPromiseAgrDate', 1, 304, 1, 1, 'ДоговораБОДатаДоговора', 0, null) ;

CALL ImportField(30411052, 'Сумма договора', 'SourceBudgetPromiseAgrSumma', 'Сумма договора', 'SourceBudgetPromiseAgrSumma', 1, 304, 1, 1, '', 0, null) ;

CALL ImportField(30411053, 'Реестровый номер дог.', 'SourceBudgetPromiseAgrRNum', 'Реестровый номер дог.', 'SourceBudgetPromiseAgrReestrNum', 1, 304, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(30411054, 'Дог. примечание', 'SourceBudgetPromiseAgrNote', 'Дог. примечание', 'SourceBudgetPromiseAgrNote', 1, 304, 1, 1, 'ДоговораБОПримечаниеДоговора', 0, null) ;

CALL ImportField(30411055, 'Номер гос. контракта', 'SourceBudgetPromiseSONum', 'Номер гос. контракта', 'SourceBudgetPromiseAgrNum', 1, 304, 1, 1, 'ДоговораБОНомерКонтракта', 0, 19798) ;

CALL ImportField(30411056, 'Дата гос. контракта', 'SourceBudgetPromiseSODate', 'Дата гос. контракта', 'SourceBudgetPromiseAgrDate', 1, 304, 1, 1, 'ДоговораБОДатаКонтракта', 0, 19799) ;

CALL ImportField(30411057, 'Сумма гос. контракта', 'SourceBudgetPromiseSOSumma', 'Сумма гос. контракта', ' ', 1, 304, 1, 1, '', 0, null) ;

CALL ImportField(30411058, 'Реестровый номер гос. контр', 'SourceBudgetPromiseSORNum', 'Реестровый номер гос. контр', 'SourceBudgetPromiseAgrReestrNum', 1, 304, 1, 1, 'ДоговораБОРеестрНомерКонтракта', 0, 19830) ;

CALL ImportField(30411059, 'Прим. гос. контракта', 'SourceBudgetPromiseSONote', 'Прим. гос. контракта', 'SourceBudgetPromiseAgrNote', 1, 304, 1, 1, 'ДоговораБОПримечаниеКонтракта', 0, 19821) ;

CALL ImportField(30411077, 'ЭКИ(Классификация)', 'SourceIFS_KESR', 'ЭКИ (расходный источник)', ' ', 1, 304, 1, 0, '', 0, 17054) ;

CALL ImportField(30411078, 'Вид источника(Классификация)', 'SourceIFS_DescriptionCode', 'Вид источника (расходный источник)', 'SourceIFS_DescriptionCode', 1, 304, 1, 0, '', 0, 17050) ;

CALL ImportField(30411098, 'Вид дохода(Классификация)', 'SourceKD_DescriptionCode', 'Вид дохода(КД)', ' ', 1, 304, 1, 0, '', 0, 16831) ;

CALL ImportField(30411099, 'Подвид дохода(Классификация)', 'SourceKD_Program', 'Подвид дохода', ' ', 1, 304, 1, 0, '', 0, 16834) ;

CALL ImportField(30411100, 'ЭКД(Классификация)', 'SourceKD_KESR', 'ЭКД(КД)', ' ', 1, 304, 1, 0, '', 0, 16835) ;

CALL ImportField(30411103, 'Источник образования', 'SourceFundsSource', 'Источник образования', 'SourceFundsSource', 1, 304, 1, 0, 'ИсточникОбразованияСредств', 0, 18930) ;

CALL ImportField(30411110, 'Источниковая классификация', 'SourceIFS', 'Источниковая классификация', 'SourceIFS', 1, 304, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПлат', 0, 18920) ;

CALL ImportField(30411111, 'Код дохода', 'SourceKD', 'Код дохода', 'SourceKD', 1, 304, 1, 1, 'КДКлюч', 0, 18925) ;

CALL ImportField(30411112, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 304, 1, 1, '', 0, 18872) ;

CALL ImportField(30411113, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 304, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(30411114, 'Код записи', 'ID', 'Код записи', 'Id', 1, 304, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(30411120, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 304, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(30411122, 'Источниковая классификация', 'SourceIFS_FullID', 'SourceIFS_FullID(Источниковая классификация)', 'SOURCEIFS_DESCRIPTIONCODE', 1, 304, 1, 1, 'ИсточникВнутрФинансирования,ИсточникВнутрФинансированияПлат', 0, null) ;

CALL ImportField(30411123, 'Код дохода', 'SourceKD_Value', 'Код дохода', 'SourceKDValue', 1, 304, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(30411124, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'Progindex', 1, 304, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(30411127, 'Код целевых средствКлюч', 'SourceTransfertCls', 'Код целевых средств (ссылка)', 'SourceTransfertCls', 1, 304, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18935) ;

CALL ImportField(30411134, 'Код субсидииКлюч', 'SourceSubsidyCls', 'Код субсидии (ссылка)', 'SourceSubsidyCls', 1, 304, 1, 1, 'КодСубсидииКлюч', 0, 26626) ;

CALL ImportField(30411136, 'Наименование района трансферта', 'SourceRegionClsName', '', ' ', 1, 304, 1, 0, '', 0, null) ;

CALL ImportField(30411139, 'Код бюджетного ассигнованияКлюч', 'SourceBudAllocationCls', '', 'SourceBudAllocationCls', 1, 304, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27844) ;

CALL ImportField(30411140, 'Код расходного обязательстваКлюч', 'SourcePayPromiseCls', '', 'SourcePayPromiseCls', 1, 304, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27845) ;

-- Поступления по п\п, УРМ(0)
CALL ImportField(30500001, 'Код документа', 'ID', 'Код документа', 'ID', 0, 305, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30500002, 'Номер документа', 'DOCNUMBER', 'Номер документа', 'DocumentNumber', 0, 305, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(30500003, 'Код ФО документа', 'FUID', 'Код ФО документа', 'FUID', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500004, 'Код УРМ документа', ' ', 'Код УРМ документа', 'SenderRecordID', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500005, 'Код отправителя документа', ' ', 'Код отправителя документа', 'SenderID', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500006, 'Дата документа', 'DOCUMENTDATE', 'Дата документа', 'DocumentDate', 0, 305, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(30500007, 'Срок платежа', 'PAYDATE', 'Срок платежа', 'PayDate', 0, 305, 0, 0, 'СрокПлатежа', 0, null) ;

CALL ImportField(30500008, 'Дата проводки', 'ACCEPTDATE', 'Дата проводки', 'AcceptDate', 0, 305, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(30500009, 'Сумма', 'SUMMA', 'Сумма', 'SUMMA', 0, 305, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(30500010, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 305, 0, 1, 'ИндексыДанныхЗаголовок', 0, null) ;

CALL ImportField(30500011, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 0, 305, 0, 0, 'ВидПлатежа', 0, null) ;

CALL ImportField(30500012, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 0, 305, 0, 0, 'Примечание', 0, null) ;

CALL ImportField(30500013, 'Очередность ', 'PAYPRIORITY', 'Очередность ', 'PayPriority', 0, 305, 0, 0, 'Очередность', 0, null) ;

CALL ImportField(30500014, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 0, 305, 0, 0, 'ТипОперации', 0, null) ;

CALL ImportField(30500015, 'Бух. проводка', 'BUHPAYMENTCLS', 'Бух. проводка', 'BUHPAYMENTCLS', 0, 305, 0, 0, 'БухПроводка', 0, null) ;

CALL ImportField(30500016, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 0, 305, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(30500017, 'Текст причины отклонения', 'REJECTCAUSE', 'Текст причины отклонения', 'RejectCause', 0, 305, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(30500018, 'Ссылка на счет плательщика', 'SOURCEACCOUNT', 'Ссылка на счет плательщика', 'SOURCEACCOUNT', 0, 305, 0, 1, 'СчетПлат', 0, null) ;

CALL ImportField(30500019, 'л\с плательщика', 'SOURCEFACIALACC_CLS', 'л\с плательщика', 'SourceFacialAccCls', 0, 305, 0, 0, 'ЛицСчетПлательщика', 0, null) ;

CALL ImportField(30500020, 'Ссылка на счет организации-получателя', 'DESTACCOUNT', 'Ссылка на счет организации-получателя', 'DESTACCOUNT', 0, 305, 0, 1, 'РСФО,СчетПолуч', 0, null) ;

CALL ImportField(30500021, 'л\с получателя', 'DESTFACIALACC_CLS', 'л\с получателя', 'DestFacialAccCls', 0, 305, 0, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(30500022, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 305, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(30500024, 'Статус ЭЦП', ' ', 'Статус ЭЦП', 'CRYPTOSTATUS', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500025, 'р/с плательщика', 'Acc', 'р/с плательщика', 'SourceAccountName', 0, 305, 0, 0, '', 0, null) ;

CALL ImportField(30500026, 'Субсчет плательщика', ' ', 'Субсчет плательщика', 'SourceFKFacialCode', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500027, 'Счет получателя', 'DestAccountName', 'Счет получателя', 'DestAccountName', 0, 305, 0, 0, '', 0, null) ;

CALL ImportField(30500028, 'Субсчет получателя', 'DestFACIALCODE', 'Субсчет получателя', 'DestFKFacialCode', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500029, 'ИНН организации-получателя', ' ', 'ИНН организации-получателя', 'DestOrgINN', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500030, 'КПП организации-получателя', ' ', 'КПП организации-получателя', 'DestOrgKPP', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500031, 'Наименование организации-плательщика', 'Name', 'Наименование организации-плательщика', 'SourceOrgName', 0, 305, 0, 0, '', 0, null) ;

CALL ImportField(30500032, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500033, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500035, 'Номер заявки', ' ', 'Номер заявки', 'BidNumber', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500036, 'Локальный реестр', ' ', 'Локальный реестр', 'ManagerBid', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500037, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500040, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500041, 'Отдел', ' ', 'Отдел', 'DEPARTMENTCLS', 0, 305, 0, 0, '', 0, null) ;

CALL ImportField(30500042, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500043, 'Текст мягкой причины отклонения', 'SoftRejectCause', 'Текст мягкой причины отклонения', 'SoftRejectCause', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500044, 'Ссылка на р/c ФО плательщика', ' ', 'Ссылка на р/c ФО плательщика', 'SourceAccountFUID', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500045, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500046, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500047, 'Ссылка на организацию плательщика(для УРМ)', ' ', 'Ссылка на организацию плательщика(для УРМ)', 'SourceOrgFUID', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500048, 'ИНН организации-плательщика', 'INN', 'ИНН организации-плательщика', 'SourceOrgINN', 0, 305, 0, 0, '', 0, null) ;

CALL ImportField(30500049, 'КПП организации-плательщика', 'Inn20', 'КПП организации-плательщика', 'SourceOrgKPP', 0, 305, 0, 0, '', 0, null) ;

CALL ImportField(30500050, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500051, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500052, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500053, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500054, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500055, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500056, 'Имя л\с плательщика', ' ', 'Имя л\с плательщика', 'SourceFacialAccClsName', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500057, 'Мнемокод л\с плательщика', ' ', 'Мнемокод л\с плательщика', 'SourceFacialAccClsFacialCode', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500058, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500059, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500060, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500061, 'Организация ФК плательщика(код)', ' ', 'Организация ФК плательщика(код)', 'SourceFKOrgId', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500062, 'Организация ФК ФО плательщика', ' ', 'Организация ФК ФО плательщика', 'SourceFKOrgFUID', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500063, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500064, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500065, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500066, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500067, 'Ссылка на счет получателя ФО', ' ', 'Ссылка на счет получателя ФО', 'DestAccountFUID', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500068, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500069, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500070, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500071, 'Наименование организации-получателя', ' ', 'Наименование организации-получателя', 'DestOrgName', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500072, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500073, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500074, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500075, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500076, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500077, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500078, 'Имя л\с получателя', ' ', 'Имя л\с получателя', 'DestFacialAccClsName', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500079, 'мнемокод л\с получателя', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500080, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500081, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500082, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500083, 'Организация ФК получателя(код)', ' ', 'Организация ФК получателя(код)', 'DestFKOrgId', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500084, 'Организация ФК получателя ФО', ' ', 'Организация ФК получателя ФО', 'DestFKOrgFUID', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500085, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500086, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500087, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500088, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500089, 'Поле ссылки', ' ', 'Поле ссылки', 'LinkedDocument', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500090, 'Документ-основание получателя', ' ', 'Документ-основание получателя', 'DestDocBase', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500092, 'Номер федерального реестра получателя', ' ', 'Номер федерального реестра получателя', 'FEDERALFUNDSName', 0, 305, 0, 0, '', 0, null) ;

CALL ImportField(30500093, 'Ссылка на федеральный реестр', ' ', 'Ссылка на федеральный реестр', 'FEDERALFUNDSREF', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500094, 'НаправлениеОперации', ' ', 'Направление операции', 'НаправлениеОперации', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500117, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500121, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 305, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(30500138, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 0, 305, 0, 0, 'ТипКлассификацииЗаголовок', 0, null) ;

CALL ImportField(30500145, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500146, 'Наименование получателя', 'DestFacialAcc_ClsName', 'Наименование получателя', ' ', 0, 305, 0, 0, '', 0, null) ;

CALL ImportField(30500148, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 0, 305, 0, 0, '', 0, null) ;

CALL ImportField(30500149, 'Направление операции', 'OperationDirection', 'Направление операции', 'OperationDirection', 0, 305, 0, 0, 'НаправлениеОперации', 0, null) ;

CALL ImportField(30500150, 'Информация о налоговом платеже', 'TaxNote', 'Информация о налоговом платеже', 'TaxNote', 0, 305, 0, 0, 'ИнформацияОНалоге', 0, null) ;

CALL ImportField(30500159, 'Номер реестра', 'ReestrNumber', 'Номер реестра', 'ReestrNumber', 0, 305, 0, 0, '', 0, null) ;

CALL ImportField(30500160, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30500161, 'Район контрагента', 'RegionContractor', 'Район контрагента', 'RegionContractor', 0, 305, 0, 1, 'РайонКонтрагента', 0, null) ;

CALL ImportField(30500162, 'Район бюджетного учреждения', 'RegionBudgetEst', 'Район бюджетного учреждения', 'RegionBudgetEst', 0, 305, 0, 1, 'РайонБУ', 0, null) ;

CALL ImportField(30500163, 'Ссылка на обмен с банком', 'ElDocRef', 'Ссылка на обмен с банком', ' ', 0, 305, 0, 1, '', 0, null) ;

CALL ImportField(30501001, 'Код записи', 'ID', 'Код записи', 'Id', 0, 305, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(30501002, 'Код ФО записи', 'FUID', 'Код ФО записи', 'FUID', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501003, 'Код УРМ записи', ' ', 'Код УРМ записи', 'SenderRecordID', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501004, 'Код отправителя записи', ' ', 'Код отправителя записи', 'SenderID', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501005, 'Сумма', 'SUMMA', 'Сумма', 'SUMMA', 0, 305, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(30501006, 'Назначение платежа', ' ', 'Назначение платежа', 'NOTE', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501007, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 305, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(30501008, 'Ссылка на заголовок', 'RECORDINDEX', 'Ссылка на заголовок', 'RecordIndex', 0, 305, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30501009, 'Номер БО получателя', 'DESTPROMISE', 'Номер БО получателя', 'DestPROMISE', 0, 305, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(30501010, 'Номер БО получателя(договора)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', 'DestBudgetPROMISENum', 0, 305, 1, 0, 'ДоговораБОНомер,БОНомер', 0, null) ;

CALL ImportField(30501011, 'Договора БО получателя', 'DESTBUDGETPROMISE', 'Договора БО получателя', 'DestBUDGETPROMISE', 0, 305, 1, 1, 'ДоговораБО,БОВнутрНомер', 0, null) ;

CALL ImportField(30501012, 'л\с получателя', 'DestFacialAcc_Cls', 'л\с получателя', 'DestFacialAccCls', 0, 305, 1, 1, 'ЛицевойСчет', 0, null) ;

CALL ImportField(30501013, 'КВР (Ключ)', 'DESTKVR', 'КВР получателя', 'DestKVRKey', 0, 305, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(30501014, 'КЭСР получателя', 'DESTKESR', 'КЭСР получателя', 'DestKESR', 0, 305, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(30501015, 'КВСР (Ключ)', 'DestKVSR', 'КВСР (Ключ)', 'DestKVSRKey', 0, 305, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(30501016, 'КЦСР (Ключ)', 'DestKCSR', 'КЦСР получателя', 'DestKCSRKey', 0, 305, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(30501017, 'КФСР получателя', 'DestKFSR', 'КФСР получателя', 'DestKFSR', 0, 305, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(30501018, 'СубКЭСР получателя', 'DestSubKESR', 'СубКЭСР получателя', 'DestSUBKESR', 0, 305, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(30501020, 'Тип средств получателя', 'DestMeansType', 'Тип средств получателя', 'DestMEANSTYPECLS', 0, 305, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(30501021, 'Источник финансирования получателя', 'DestFinSource', 'Источник финансирования получателя', 'DestFINSOURCECLS', 0, 305, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(30501023, 'Тип документа получателя', 'DestDocType', 'Тип документа получателя', 'DestDOCTYPECLS', 0, 305, 1, 0, 'ТипДокумента', 0, null) ;

CALL ImportField(30501025, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501026, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', 'Док. исполнения получателя', 0, 305, 1, 0, 'ДокИсполненияГруппа', 0, null) ;

CALL ImportField(30501027, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Номер Д.И. получателя ссылка', 'DestExecDoc', 0, 305, 1, 1, 'ДокИсполнения', 0, null) ;

CALL ImportField(30501028, 'Номер', 'DestExecDocNum', 'Номер', 'DestExecDocNum', 0, 305, 1, 0, 'ДокИсполненияНомер', 0, null) ;

CALL ImportField(30501029, 'Реестровый номер', 'DestExecDocReestr', 'Реестровый номер', 'DestExecDocReestr', 0, 305, 1, 1, 'ДокИсполненияНомерРеестра', 0, null) ;

CALL ImportField(30501030, 'Дата', 'DestExecDocDate', 'Дата', 'DestExecDocDate', 0, 305, 1, 1, 'ДокИсполненияДата', 0, null) ;

CALL ImportField(30501031, 'Тип документа исполнения', 'DestExecDocType', 'Тип документа исполнения', 'DestExecDocType', 0, 305, 1, 1, 'ДокИсполненияТип', 0, null) ;

CALL ImportField(30501032, 'Сумма док. исполнения получателя', 'DestExecDocSumma', 'Сумма док. исполнения получателя', 'DestExecDocSumma', 0, 305, 1, 1, 'ДокИсполненияСумма', 0, null) ;

CALL ImportField(30501033, 'Назначение', 'DestExecDocNote', 'Назначение', 'DestExecDocNote', 0, 305, 1, 1, 'ДокИсполненияПримечание', 0, null) ;

CALL ImportField(30501034, 'Бух операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 0, 305, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(30501035, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'ClsType', 0, 305, 1, 1, 'ТипКлассификации,ТипКлассификацииПлат', 0, null) ;

CALL ImportField(30501036, 'Примечание договора получателя', 'DestBudgetPromiseDocNote', 'Примечание документа получателя', 'DestBudgetPromiseDocNote', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501037, 'Реестровый номер договора получателя', 'DestBudgetPromiseDocReestrNum', 'Реестровый номер документа получателя', 'DestBudgetPromiseDocReestrNum', 0, 305, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(30501038, 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 'Сумма документ получателя', 'DestBudgetPromiseDocSumma', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501039, 'Дата договора получателя', 'DestBudgetPromiseDocDate', 'Дата документа получателя', 'DestBudgetPromiseDocDate', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501040, 'Номер договора получателя', 'DestBudgetPromiseDocNumber', 'Номер документа получателя', 'DestBudgetPromiseDocNumber', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501041, 'Сумма БО получателя', 'DestBudgetPromiseSumma', 'Сумма БО получателя', 'DestBudgetPromiseSumma', 0, 305, 1, 1, 'ДоговораБОСумма', 0, null) ;

CALL ImportField(30501044, 'ИВФ (Ключ)', 'DestIFS', 'Ссылка на источник внутр. и внеш. фин-я', 'DestIFS', 0, 305, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПолуч', 0, null) ;

CALL ImportField(30501045, 'ИВФ', 'DestIFSCode', 'Вид источника(расходный источник)', 'DestIFS_DescriptionCode', 0, 305, 1, 0, '', 0, null) ;

CALL ImportField(30501105, 'Район', 'DestRegionCls', 'Район', ' ', 0, 305, 1, 0, 'Регион,РайонТрансферта', 0, null) ;

CALL ImportField(30501118, 'Классификация', 'TreeOwner0', 'Классификация(группа)', ' ', 0, 305, 1, 0, '', 0, null) ;

CALL ImportField(30501120, 'КД (Ключ)', 'DestKD', 'КД Ключ', 'DestKD', 0, 305, 1, 1, 'КДКлюч', 0, null) ;

CALL ImportField(30501122, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501139, 'Код целевых средств (Ключ)', 'DestTransfertCls', 'Код целевых средств (ссылка)', 'DestTransfertCls', 0, 305, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(30501140, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств', 'DestTransfertClsValue', 0, 305, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(30501141, 'КЦСР', 'DestKCSRCode', '', 'DestKCSR', 0, 305, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(30501142, 'КВР', 'DESTKVRCode', '', 'DestKVR', 0, 305, 1, 0, 'КВР', 0, null) ;

CALL ImportField(30501143, 'КВСР', 'DestKVSRCode', 'КВСР', 'DestKVSR', 0, 305, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(30501144, 'Источник образования', 'DestFundsSource', '', 'DestFundsSource', 0, 305, 1, 0, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(30501151, 'КД(Калссфикация)', 'DestKDCode', 'КД Классфикатор', 'DestKDValue', 0, 305, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(30501152, 'Бюджетное обязательство плательщика', 'DestBudgetPromiseCollaps', 'Бюджетное обязательство получателя', 'DestBudgetPromiseCollaps', 0, 305, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30501153, 'Дата гос. контракта', 'DestBudgetPromiseSODate', 'Дата гос. контракта', 'DestBudgetPromiseSODate', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501154, 'ИД контракта', 'DestBudgetPromiseSOID', '', ' ', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501155, 'Прим. гос. контракта', 'DestBudgetPromiseSONote', 'Прим. гос. контракта', 'DestBudgetPromiseSONote', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501156, 'Номер гос. контракта', 'DestBudgetPromiseSONum', 'Номер гос. контракта', 'DestBudgetPromiseSONum', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501157, 'Реестровый номер гос. контр', 'DestBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр', 'DestBudgetPromiseSOReestrNum', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501158, 'Сумма гос. контракта', 'DestBudgetPromiseSOSumma', 'Сумма гос. контракта', 'DestBudgetPromiseSOSumma', 0, 305, 1, 1, '', 0, null) ;

CALL ImportField(30501159, 'Код субсидииКлюч', 'DestSubsidyCls', 'Код субсидии (ссылка)', 'DestSubsidyCls ', 0, 305, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(30501160, 'Код субсидии', 'DestSubsidyClsCode', 'Код субсидии', 'DestSubsidyClsCode', 0, 305, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(30501161, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', ' ', 0, 305, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(30501162, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', ' ', 0, 305, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(30501163, 'Код расходного обязательства (ключ)', 'DestPayPromiseCls', '', ' ', 0, 305, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

CALL ImportField(30501164, 'Код бюджетного ассигнования (ключ)', 'DestBudAllocationCls', '', ' ', 0, 305, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

-- Поступления по п\п, Бюджет(1)
CALL ImportField(30510001, 'Код документа', 'ID', 'Код документа', 'ID', 1, 305, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(30510002, '№ п/п', 'DOCNUMBER', 'Номер документа', 'DocumentNumber', 1, 305, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(30510003, 'Код ФО документа', ' ', 'Код ФО документа', 'FUID', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510004, 'Код УРМ документа', 'SENDERRECORDID', 'Код УРМ документа', 'SenderRecordID', 1, 305, 0, 1, 'КодУРМДокумента', 0, 18970) ;

CALL ImportField(30510005, 'Код удаленного клиента', 'SENDERID', 'Код отправителя документа', 'SenderID', 1, 305, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(30510006, 'Дата п/п', 'DOCUMENTDATE', 'Дата документа', 'DocumentDate', 1, 305, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(30510007, 'Срок платежа', 'PAYDATE', 'Срок платежа', 'PayDate', 1, 305, 0, 0, 'СрокПлатежа', 0, 18951) ;

CALL ImportField(30510008, 'Дата проводки', 'ACCEPTDATE', 'Дата проводки', 'AcceptDate', 1, 305, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(30510009, 'Сумма(руб)', 'SUMMA', 'Сумма', 'SUMMA', 1, 305, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(30510011, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 1, 305, 0, 0, 'ВидПлатежа', 0, 18963) ;

CALL ImportField(30510012, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 305, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(30510013, 'Очередность', 'PAYPRIORITY', 'Очередность ', 'PayPriority', 1, 305, 0, 0, 'Очередность', 0, 18966) ;

CALL ImportField(30510014, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 1, 305, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(30510015, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', 'BUHPAYMENTCLS', 1, 305, 0, 0, 'БухПроводка', 0, 18968) ;

CALL ImportField(30510016, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 305, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(30510017, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Текст причины отклонения', 'RejectCause', 1, 305, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(30510018, 'Код счета плательщика', 'SOURCEACCOUNT', 'Код счета плательщика', 'SOURCEACCOUNT', 1, 305, 0, 1, 'СчетПлат', 0, 18956) ;

CALL ImportField(30510019, 'Л/с РВС', 'SOURCEFACIALACC_CLS', 'л\с плательщика', 'SourceFacialAccCls', 1, 305, 0, 0, 'ЛицСчетПлательщика', 0, 18957) ;

CALL ImportField(30510020, 'Ссылка на счет ФО', 'DESTACCOUNT', 'Ссылка на счет ФО', 'DESTACCOUNT', 1, 305, 0, 1, 'РСФО,СчетПолуч', 0, 18958) ;

CALL ImportField(30510021, 'Л/с получателя', 'DESTFACIALACC_CLS', 'л\с получателя', 'DestFacialAccCls', 1, 305, 0, 0, 'ЛицевойСчет', 0, 18959) ;

CALL ImportField(30510022, 'СостояниеДокумента', 'DocStateRef', 'Состояние документа', 'DocStateRef', 1, 305, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(30510023, 'Начальное состояние документа', ' ', 'Начальное состояние документа', 'BeginDocStateRef', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510024, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 305, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(30510025, 'р/с плательщика', 'SourceAccountName', 'р/с плательщика', 'SourceAccountName', 1, 305, 0, 0, '', 0, null) ;

CALL ImportField(30510026, 'Субсчет плательщика', 'SourceFACIALCODE', 'Субсчет плательщика', 'SourceFKFacialCode', 1, 305, 0, 1, '', 0, null) ;

CALL ImportField(30510027, 'Счет получателя', 'DestAccountName', 'Счет получателя', 'DestAccountName', 1, 305, 0, 0, '', 0, 17112) ;

CALL ImportField(30510028, 'Л/С получателя в ФК', 'DestFACIALCODE', 'Субсчет получателя', 'DestFKFacialCode', 1, 305, 0, 0, '', 0, null) ;

CALL ImportField(30510030, 'ИНН(Плательщик)', 'INN', 'ИНН организации-получателя', 'DestOrgINN', 1, 305, 0, 0, '', 0, 16645) ;

CALL ImportField(30510032, 'КПП(Плательщик)', 'INN20', 'КПП организации-получателя', 'DestOrgKPP', 1, 305, 0, 0, '', 0, 16653) ;

CALL ImportField(30510034, 'Имя(Плательщик)', 'NAME', 'Наименование организации-плательщика', 'SourceOrgName', 1, 305, 0, 0, '', 0, 16646) ;

CALL ImportField(30510035, 'Есть в Бюджете', ' ', 'Есть в Бюджете', 'IsInBudget', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510036, 'Признак зависания', ' ', 'Признак зависания', 'DocSuspended', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510037, 'Локальная виза', ' ', 'Локальная виза', 'IsVised', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510039, 'Локальный реестр', ' ', 'Локальный реестр', 'ManagerBid', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510040, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510043, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510044, 'Отдел', ' ', 'Отдел', 'DEPARTMENTCLS', 1, 305, 0, 0, '', 1, null) ;

CALL ImportField(30510045, 'Мягкая причина отклонения', ' ', 'Мягкая причина отклонения', 'SoftRejectCls', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510046, 'Текст мягкой причины отклонения', ' ', 'Текст мягкой причины отклонения', 'SoftRejectCause', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510047, 'Ссылка на р/c ФО плательщика', ' ', 'Ссылка на р/c ФО плательщика', 'SourceAccountFUID', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510048, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510049, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510050, 'Ссылка на организацию плательщика(для УРМ)', ' ', 'Ссылка на организацию плательщика(для УРМ)', 'SourceOrgFUID', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510051, 'ИНН организации-плательщика', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510052, 'КПП организации-плательщика', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510053, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510054, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510055, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510056, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510057, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510058, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510059, 'Имя л\с плательщика (РВС)', ' ', 'Имя л\с плательщика (РВС)', 'SourceFacialAccClsName', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510060, 'Мнемокод л\с плательщика (РВС)', ' ', 'Мнемокод л\с плательщика', 'SourceFacialAccClsFacialCode', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510061, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510062, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510063, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510064, 'Организация ФК плательщика(код)', ' ', 'Организация ФК плательщика(код)', 'SourceFKOrgId', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510065, 'Организация ФК ФО плательщика', ' ', 'Организация ФК ФО плательщика', 'SourceFKOrgFUID', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510066, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510067, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510068, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510069, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510070, 'Ссылка на счет получателя ФО', ' ', 'Ссылка на счет получателя ФО', 'DestAccountFUID', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510071, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510072, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510073, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510074, 'Наименование организации-получателя', ' ', 'Наименование организации-получателя', 'DestOrgName', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510075, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510076, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510077, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510078, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510079, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510080, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510081, 'Имя л\с получателя', ' ', 'Имя л\с получателя', 'DestFacialAccClsName', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510082, 'мнемокод л\с получателя', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510083, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510084, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510085, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510086, 'Организация ФК получателя(код)', ' ', 'Организация ФК получателя(код)', 'DestFKOrgId', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510087, 'Организация ФК получателя ФО', ' ', 'Организация ФК получателя ФО', 'DestFKOrgFUID', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510088, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510089, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510090, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510091, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 1, 305, 0, 1, '', 1, null) ;

CALL ImportField(30510096, 'Архив', 'ARHIVEDOC', 'Архив', 'ARHIVEDOC', 1, 305, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(30510097, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Номер федерального реестра получателя', ' ', 1, 305, 0, 0, '', 0, null) ;

CALL ImportField(30510098, 'Федеральные cредства', 'FEDERALFUNDSREF', 'Ссылка на федеральный реестр', ' ', 1, 305, 0, 1, 'ФедеральныеСредства', 0, 19004) ;

CALL ImportField(30510099, 'Направление операции', 'OperationDirection', 'Направление операции', 'OPERATIONDIRECTION', 1, 305, 0, 0, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(30510100, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 305, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(30510101, 'Счет(Плательщик)', 'ACC', 'Счет плательщика', ' ', 1, 305, 0, 0, '', 0, 17112) ;

CALL ImportField(30510107, 'Тип счета(Плательщик)', 'ACC_CLS', 'Тип счета', ' ', 1, 305, 0, 0, '', 0, 17113) ;

CALL ImportField(30510108, 'Информация для налогового платежа', 'TaxNote', 'Информация для налогового платежа', 'TaxNote', 1, 305, 0, 0, 'ИнформацияОНалоге', 0, 18991) ;

CALL ImportField(30510114, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 1, 305, 0, 0, 'ТипКлассификацииЗаголовок', 0, 19008) ;

CALL ImportField(30510121, 'Электронный документ', 'ElDocRef', 'Электронный документ', ' ', 1, 305, 0, 1, '', 0, 19006) ;

CALL ImportField(30510125, 'Уточнение индекса данных', 'SubProgIndex', 'Уточнение индекса данных', ' ', 1, 305, 0, 1, '', 0, null) ;

CALL ImportField(30510126, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'Progindex', 1, 305, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(30510134, 'Заблокировано(Состояние блокировки)', 'IsBlocked', 'Заблокировано', 'IsBlocked', 1, 305, 0, 0, 'ПризнакБлокировки', 0, 19012) ;

CALL ImportField(30510135, 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 'Причина блокировки', 'BLOCKEDCAUSE', 1, 305, 0, 0, 'ПричинаБлокировки', 0, 19013) ;

CALL ImportField(30510136, 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 'Дата разблокировки', 'UnBlockedDate', 1, 305, 0, 0, 'ДатаРазблокировки', 0, 19014) ;

CALL ImportField(30510137, 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 'Причина разблокировки', 'UnblockedCause', 1, 305, 0, 0, 'ПричинаРазблокировки', 0, 19015) ;

CALL ImportField(30510138, 'Район контрагента', 'RegionContractor', 'Район контрагента', 'RegionContractor', 1, 305, 0, 1, 'РайонКонтрагента', 0, null) ;

CALL ImportField(30510139, 'Район бюджетного учреждения', 'RegionBudgetEst', 'Район бюджетного учреждения', 'RegionBudgetEst', 1, 305, 0, 1, 'РайонБУ', 0, null) ;

CALL ImportField(30510140, 'Отдел', 'DepartmentCLS', '', 'DEPARTMENTCLS', 1, 305, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(30510141, 'Номер л/с получателя', 'DestFacialCodeEx', '', ' ', 1, 305, 0, 0, '', 0, 26617) ;

CALL ImportField(30510142, 'Плательщик', 'ParentSource', '', ' ', 1, 305, 0, 0, '', 0, null) ;

CALL ImportField(30510165, 'Номер карточки', 'CardRef', 'Код пластиковой карты', 'CardRef', 1, 305, 0, 1, 'КлючПластиковойКарты', 0, 31656) ;

CALL ImportField(30510166, 'Получатель(Хранимые реквизиты платежа)', 'DestStoredPaymentProps', '', 'DestStoredPaymentProps', 1, 305, 0, 0, 'РеквизитыПлатежаПолуч', 0, 31657) ;

CALL ImportField(30510167, 'Плательщик(Хранимые реквизиты платежа)', 'SourceStoredPaymentProps', '', 'SourceStoredPaymentProps', 1, 305, 0, 0, 'РеквизитыПлатежаПлат', 0, 31658) ;

CALL ImportField(30510168, 'Хранимые реквизиты платежа', 'StoredPaymentProps', '', ' ', 1, 305, 0, 0, '', 0, null) ;

CALL ImportField(30511001, 'Код записи', 'ID', 'Код записи', 'Id', 1, 305, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(30511002, 'Код ФО записи', ' ', 'Код ФО записи', 'FUID', 1, 305, 1, 1, '', 1, null) ;

CALL ImportField(30511003, 'Код УРМ записи', ' ', 'Код УРМ записи', 'SenderRecordID', 1, 305, 1, 1, '', 1, null) ;

CALL ImportField(30511004, 'Код отправителя записи', ' ', 'Код отправителя записи', 'SenderID', 1, 305, 1, 1, '', 1, null) ;

CALL ImportField(30511005, 'Сумма(руб)', 'SUMMA', 'Сумма', 'SUMMA', 1, 305, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(30511006, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 305, 1, 1, 'ПримечаниеДеталь', 0, 18876) ;

CALL ImportField(30511008, 'Код документа', 'RECORDINDEX', 'Ссылка на заголовок', 'RecordIndex', 1, 305, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(30511009, '№ БО получателя', 'DESTPROMISE', 'Номер БО получателя', 'DestPROMISE', 1, 305, 1, 0, 'БюджОбяз', 0, 18906) ;

CALL ImportField(30511010, 'Номер БО(№ бюдж. обязат-ва получателя)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', 'DestBudgetPROMISENum', 1, 305, 1, 0, 'ДоговораБОНомер,БОНомер', 0, 20223) ;

CALL ImportField(30511011, 'Вн. номер БО получателя', 'DESTBUDGETPROMISE', 'Договора БО получателя', 'DestBUDGETPROMISE', 1, 305, 1, 1, 'ДоговораБО,БОВнутрНомер', 0, 18909) ;

CALL ImportField(30511012, 'Лицевой счет', 'DestFacialAcc_Cls', 'л\с получателя', 'DestFacialAccCls', 1, 305, 1, 1, 'ЛицевойСчет', 0, 18869) ;

CALL ImportField(30511013, 'КВРКлюч', 'DESTKVR', 'КВР получателя', 'DestKVRKey', 1, 305, 1, 1, 'КВРКлюч', 0, 18870) ;

CALL ImportField(30511014, 'ЭКР(Классификация)', 'DESTKESR', 'КЭСР получателя', 'DestKESR', 1, 305, 1, 0, 'КЭСР', 0, 18871) ;

CALL ImportField(30511015, 'КВСРКлюч', 'DestKVSR', 'КВСР получателя', 'DestKVSRKey', 1, 305, 1, 1, 'КВСРКлюч', 0, 18895) ;

CALL ImportField(30511016, 'КЦСРКлюч', 'DestKCSR', 'КЦСР получателя', 'DestKCSRKey', 1, 305, 1, 1, 'КЦСРКлюч', 0, 18896) ;

CALL ImportField(30511017, 'ФКР(Классификация)', 'DestKFSR', 'КФСР получателя', 'DestKFSR', 1, 305, 1, 0, 'КФСР', 0, 18897) ;

CALL ImportField(30511018, 'Суб КОСГУ', 'DestSubKESR', 'СубКЭСР получателя', 'DestSUBKESR', 1, 305, 1, 0, 'СубКЭСР', 0, 18898) ;

CALL ImportField(30511020, 'Тип средств', 'DestMeansType', 'Тип средств получателя', 'DestMEANSTYPECLS', 1, 305, 1, 0, 'ТипСредств', 0, 18900) ;

CALL ImportField(30511021, 'Источник финансирования', 'DestFinSource', 'Источник финансирования получателя', 'DestFINSOURCECLS', 1, 305, 1, 0, 'ИсточникФинансирования', 0, 18901) ;

CALL ImportField(30511023, 'Тип документа', 'DestDocType', 'Тип документа получателя', 'DestDOCTYPECLS', 1, 305, 1, 0, 'ТипДокумента', 0, 18903) ;

CALL ImportField(30511025, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 1, 305, 1, 1, '', 1, null) ;

CALL ImportField(30511026, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', ' ', 1, 305, 1, 0, '', 0, null) ;

CALL ImportField(30511027, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Номер Д.И. получателя ссылка', 'DestExecDoc', 1, 305, 1, 1, 'ДокИсполнения', 0, 18918) ;

CALL ImportField(30511028, 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 'Номер', 'DestExecDocNum', 1, 305, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(30511029, 'Реестровый номер(Док. исполнения получателя)', 'DestExecDocReestr', 'Реестровый номер', 'DestExecDocReestr', 1, 305, 1, 1, 'ДокИсполненияНомерРеестра', 0, 19756) ;

CALL ImportField(30511030, 'Дата(Док. исполнения получателя)', 'DestExecDocDate', 'Дата', 'DestExecDocDate', 1, 305, 1, 1, 'ДокИсполненияДата', 0, 19740) ;

CALL ImportField(30511031, 'Тип(Док. исполнения получателя)', 'DestExecDocType', 'Тип документа исполнения', 'DestExecDocType', 1, 305, 1, 1, 'ДокИсполненияТип', 0, 19738) ;

CALL ImportField(30511032, 'Сумма(Док. исполнения получателя)', 'DestExecDocSumma', 'Сумма док. исполнения получателя', 'DestExecDocSumma', 1, 305, 1, 1, 'ДокИсполненияСумма', 0, 19744) ;

CALL ImportField(30511033, 'Назначение(Док. исполнения получателя)', 'DestExecDocNote', 'Назначение', 'DestExecDocNote', 1, 305, 1, 1, 'ДокИсполненияПримечание', 0, 19762) ;

CALL ImportField(30511034, 'Классификация', 'TreeOwner0', 'Классификация(группа)', ' ', 1, 305, 1, 0, '', 0, null) ;

CALL ImportField(30511035, 'Операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 1, 305, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(30511036, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'ClsType', 1, 305, 1, 1, 'ТипКлассификации,ТипКлассификацииПлат', 0, 18922) ;

CALL ImportField(30511037, 'Примечание договора получателя', 'DestBudgetPromiseAgrNote', 'Примечание договора получателя', 'DestBudgetPromiseAgrNote', 1, 305, 1, 1, 'ДоговораБОПримечаниеДоговора', 0, null) ;

CALL ImportField(30511038, 'Реестровый номер договора получателя', 'DestBudgetPromiseAgrRNum', 'Реестровый номер договора получателя', 'DestBudgetPromiseAgrReestrNum', 1, 305, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(30511039, 'Сумма договора получателя', 'DestBudgetPromiseAgrSumma', 'Сумма договора получателя', 'DestBudgetPromiseAgrSumma', 1, 305, 1, 1, '', 0, null) ;

CALL ImportField(30511040, 'Дата договора получателя', 'DestBudgetPromiseAgrDate', 'Дата договора получателя', 'DestBudgetPromiseAgrDate', 1, 305, 1, 1, 'ДоговораБОДатаДоговора', 0, null) ;

CALL ImportField(30511041, 'Номер договора получателя', 'DestBudgetPromiseAgrNum', 'Номер договора получателя', 'DestBudgetPromiseAgrNum', 1, 305, 1, 1, 'ДоговораБОНомерДоговора', 0, null) ;

CALL ImportField(30511042, 'Сумма БО получателя', 'DestBudgetPromiseSumma', 'Сумма БО получателя', 'DestBudgetPromiseSumma', 1, 305, 1, 1, 'ДоговораБОСумма', 0, 20242) ;

CALL ImportField(30511045, 'Источниковая классификация', 'DestIFS', 'Ссылка на источник внутр. и внеш. фин-я', 'DestIFS', 1, 305, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПолуч', 0, 18921) ;

CALL ImportField(30511046, 'Вид источника(Классификация)', 'DestIFS_DescriptionCode', 'Вид источника(расходный источник)', 'DestIFS_DescriptionCode', 1, 305, 1, 0, '', 0, 17050) ;

CALL ImportField(30511050, 'ЭКИ(Классификация)', 'DestIFS_KESR', 'ЭКИ(расходный источник)', ' ', 1, 305, 1, 0, '', 0, 17054) ;

CALL ImportField(30511104, 'Район трансферта', 'DestRegionCls', 'Район', 'DestRegionCls', 1, 305, 1, 0, 'Регион,РайонТрансферта', 0, 18928) ;

CALL ImportField(30511110, 'Вид дохода(Классификация)', 'DestKD_DescriptionCode', 'Вид дохода', ' ', 1, 305, 1, 0, '', 0, 16831) ;

CALL ImportField(30511111, 'Подвид дохода(Классификация)', 'DestKD_Program', 'Подвид дохода', ' ', 1, 305, 1, 0, '', 0, 16834) ;

CALL ImportField(30511112, 'ЭКД(Классификация)', 'DestKD_KESR', 'ЭКД', ' ', 1, 305, 1, 0, '', 0, 16835) ;

CALL ImportField(30511113, '№ бюдж. обязат-ва получателя', 'DestBudgetPromiseCollaps', '№ бюдж. обязат-ва получателя', ' ', 1, 305, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30511116, 'Код дохода', 'DestKD', 'Код дохода', 'DestKD', 1, 305, 1, 1, 'КДКлюч', 0, 18926) ;

CALL ImportField(30511117, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 305, 1, 1, '', 0, 18872) ;

CALL ImportField(30511122, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 305, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(30511123, 'Источниковая классификация', 'DestIFS_FullID', 'DestIFS_FullID(Источниковая классификация)', 'DestIFS_DescriptionCode', 1, 305, 1, 1, 'ИсточникВнутрФинансирования,ИсточникВнутрФинансированияПолуч', 0, null) ;

CALL ImportField(30511124, 'Код дохода', 'DestKD_Value', 'Код дохода', 'DestKDValue', 1, 305, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(30511125, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'Progindex', 1, 305, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(30511127, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств (ссылка)', 'DestTransfertCls', 1, 305, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18936) ;

CALL ImportField(30511134, 'Источник образования', 'DestFundsSource', 'Источник образования', 'DestFundsSource', 1, 305, 1, 0, 'ИсточникОбразованияСредств', 0, 18929) ;

CALL ImportField(30511135, 'Код субсидииКлюч', 'DestSubsidyCls', 'Код субсидии (ссылка)', 'DestSubsidyCls', 1, 305, 1, 1, 'КодСубсидииКлюч', 0, 26624) ;

CALL ImportField(30511137, 'Наименование района трансферта', 'DestRegionClsName', '', ' ', 1, 305, 1, 0, '', 0, null) ;

CALL ImportField(30511140, 'Код бюджетного ассигнованияКлюч', 'DestBudAllocationCls', '', 'DestBudAllocationCls', 1, 305, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27842) ;

CALL ImportField(30511141, 'Код расходного обязательстваКлюч', 'DestPayPromiseCls', '', 'DestPayPromiseCls', 1, 305, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27843) ;

-- Поступление по объявлениям, УРМ(0)
CALL ImportField(30600051, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 306, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(30600052, 'Л/с получателя', 'DESTFACIALACC_CLS', 'Л/с получателя', 'DESTFACIALACCCLS', 0, 306, 0, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(30600053, 'Казн. счет', 'DestAccountName', 'Казн. счет', 'DestAccountName', 0, 306, 0, 0, '', 0, null) ;

CALL ImportField(30600054, 'ИНН банка', 'INN', 'ИНН банка', 'SourceOrgINN', 0, 306, 0, 0, '', 0, null) ;

CALL ImportField(30600055, 'КПП банка', 'Inn20', 'КПП банка', 'SourceOrgKPP', 0, 306, 0, 0, '', 0, null) ;

CALL ImportField(30600056, 'Банк  плательщика', 'NAME', 'Банк  плательщика', 'SourceOrgNAME', 0, 306, 0, 0, '', 0, null) ;

CALL ImportField(30600057, 'Счет кассы', 'Acc', 'Счет кассы', 'SourceAccountName', 0, 306, 0, 0, '', 0, null) ;

CALL ImportField(30600058, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 0, 306, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(30600059, 'Назначение взноса', 'NOTE', 'Назначение взноса', 'NOTE', 0, 306, 0, 0, 'Примечание', 0, null) ;

CALL ImportField(30600060, 'Дата проводки', 'ACCEPTDATE', 'Дата проводки', 'ACCEPTDATE', 0, 306, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(30600061, 'Направление операции', 'OperationDirection', 'Направление операции', ' ', 0, 306, 0, 0, 'НаправлениеОперации', 0, null) ;

CALL ImportField(30600063, 'Дата объявления', 'DOCUMENTDATE', 'Дата объявления', 'DOCUMENTDATE', 0, 306, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(30600064, '№ объявления', 'DOCNUMBER', '№ объявления', 'DocumentNumber', 0, 306, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(30600077, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 306, 0, 0, '', 0, null) ;

CALL ImportField(30600078, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 306, 0, 0, '', 0, null) ;

CALL ImportField(30600089, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 0, 306, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(30600090, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (комментарий)', 'REJECTCAUSE', 0, 306, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(30600091, 'Бух. проводка', 'BUHPAYMENTCLS', 'Бух. проводка', 'BUHPAYMENTCLS', 0, 306, 0, 0, 'БухПроводка', 0, null) ;

CALL ImportField(30600092, 'Л/с (РВС)', 'SOURCEFACIALACC_CLS', 'Л/с (РВС)', 'SOURCEFACIALACCCLS', 0, 306, 0, 0, 'ЛицСчетПлательщика', 0, null) ;

CALL ImportField(30600093, 'Л/с ФК получ.', 'DestFacialCode', 'Л/с ФК получ.', 'DestFacialAccClsFacialCode', 0, 306, 0, 0, '', 0, null) ;

CALL ImportField(30600094, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OPERATIONTYPECLS', 0, 306, 0, 0, 'ТипОперации', 0, null) ;

CALL ImportField(30600128, 'Код документа', 'ID', 'Код документа', 'ID', 0, 306, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30600130, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', ' ', 0, 306, 0, 1, 'ИндексыДанныхЗаголовок', 0, null) ;

CALL ImportField(30600137, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 0, 306, 0, 0, 'ТипКлассификацииЗаголовок', 0, null) ;

CALL ImportField(30600143, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 306, 0, 1, '', 0, null) ;

CALL ImportField(30600144, 'Казн. счет (Ключ)', 'DESTACCOUNT', 'Казн. счет (Ключ)', 'DESTACCOUNT', 0, 306, 0, 1, 'РСФО,СчетПолуч', 0, null) ;

CALL ImportField(30600145, 'Ссылка на р/c плательщика', 'SOURCEACCOUNT', 'Ссылка на р/c плательщика', 'SOURCEACCOUNT', 0, 306, 0, 1, 'СчетПлат', 0, null) ;

CALL ImportField(30600147, 'Заблокировано(Состояние блокировки)', 'IsBlocked', 'Заблокировано', 'IsBlocked', 0, 306, 0, 0, 'ПризнакБлокировки', 0, null) ;

CALL ImportField(30600148, 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 'Причина блокировки', 'BLOCKEDCAUSE', 0, 306, 0, 0, 'ПричинаБлокировки', 0, null) ;

CALL ImportField(30600149, 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 'Дата разблокировки', 'UnBlockedDate', 0, 306, 0, 0, 'ДатаРазблокировки', 0, null) ;

CALL ImportField(30600150, 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 'Причина разблокировки', 'UnblockedCause', 0, 306, 0, 0, 'ПричинаРазблокировки', 0, null) ;

CALL ImportField(30600151, 'Заголовок для блокировки', 'BlockedCondition', 'Заголовок для блокировки', ' ', 0, 306, 0, 1, '', 0, null) ;

CALL ImportField(30600176, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 306, 0, 1, '', 0, null) ;

CALL ImportField(30600177, 'Код ФО документа', 'FUID', 'Код ФО документа', 'FUID', 0, 306, 0, 1, '', 0, null) ;

CALL ImportField(30600180, 'Состояние документа(код)', 'DocStateRef', 'Состояние документа(код)', 'DocStateRef', 0, 306, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(30600181, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 306, 0, 1, '', 0, null) ;

CALL ImportField(30600182, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 306, 0, 1, '', 0, null) ;

CALL ImportField(30600183, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 306, 0, 1, '', 0, null) ;

CALL ImportField(30600188, 'Персональная информация', 'CashierPersonalInfo', 'Персональная информация', 'CashierPersonalInfo', 0, 306, 0, 0, 'ПерсональнаяИнформация', 0, null) ;

CALL ImportField(30600189, 'Район бюджетного учреждения', 'RegionBudgetEst', 'Район бюджетного учреждения', 'RegionBudgetEst', 0, 306, 0, 1, '', 0, null) ;

CALL ImportField(30600192, 'Номер пластиковой карты(ключ)', 'CardRef', 'Ключ пластиковой карты', 'CardRef', 0, 306, 0, 1, 'КлючПластиковойКарты', 0, 31656) ;

CALL ImportField(30600193, 'Номер пластиковой карты', 'CardRefName', 'Номер пластиковой карты', 'CardRefName', 0, 306, 0, 0, 'НомерПластиковойКарты', 0, 18939) ;

CALL ImportField(30601065, 'Кассовый символ', 'PAYSYMBOLCLS', 'Кассовый символ', 'PAYSYMBOLCLS', 0, 306, 1, 0, 'КассовыйСимвол', 0, null) ;

CALL ImportField(30601066, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 0, 306, 1, 0, 'ПримечаниеДеталь', 0, null) ;

CALL ImportField(30601067, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 0, 306, 1, 0, '', 0, null) ;

CALL ImportField(30601068, 'КВСР (Ключ)', 'DestKVSR', 'КВСР (Ключ)', 'DestKVSRKey', 0, 306, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(30601069, 'КФСР', 'DestKFSR', 'КФСР', 'DestKFSR', 0, 306, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(30601070, 'КЦСР (Ключ)', 'DestKCSR', 'КЦСР (Ключ)', 'DestKCSRKey', 0, 306, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(30601071, 'КВР (Ключ)', 'DESTKVR', 'КВР', 'DestKVRKey', 0, 306, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(30601072, 'КЭСР', 'DESTKESR', 'КЭСР', 'DESTKESR', 0, 306, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(30601075, 'Источник внутр. и внеш. финанс. (Ключ)', 'DestIFS', 'Источник внутр. и внеш. финанс. (Ключ)', 'DestIFS', 0, 306, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПолуч', 0, null) ;

CALL ImportField(30601076, 'КД (Ключ)', 'DestKD', 'КД (Ключ)', 'DestKD', 0, 306, 1, 1, 'КДКлюч', 0, null) ;

CALL ImportField(30601080, 'Тип документа', 'DestDocType', 'Тип документа', 'DestDocTypeCls', 0, 306, 1, 0, 'ТипДокумента', 0, null) ;

CALL ImportField(30601081, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 0, 306, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(30601082, '№ БО получателя', 'DESTPROMISE', '№ БО получателя', 'DESTPROMISE', 0, 306, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(30601083, 'Номер БО получателя(договора)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', 'DESTBUDGETPROMISENUM', 0, 306, 1, 0, 'ДоговораБОНомер,БОНомер', 0, null) ;

CALL ImportField(30601084, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 0, 306, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(30601085, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'ClsType', 0, 306, 1, 1, 'ТипКлассификации,ТипКлассификацииПлат', 0, null) ;

CALL ImportField(30601086, 'Суб КЭСР', 'DestSubKESR', 'Суб КЭСР', 'DestSubKESR', 0, 306, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(30601087, 'Тип средств', 'DestMeansType', 'Тип средств', 'DestMeansTypeCls', 0, 306, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(30601088, 'Источник финансирования', 'DestFinSource', 'Источник финансирования', 'DestFinSourceCls', 0, 306, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(30601096, 'Район', 'DestRegionCls', 'Район', 'DestRegionCls', 0, 306, 1, 0, 'Регион,РайонТрансферта', 0, null) ;

CALL ImportField(30601118, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 0, 306, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30601122, 'Источник образования', 'DestFundsSource', 'Источник образования', 'DestFundsSource', 0, 306, 1, 0, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(30601129, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601138, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств (ссылка)', 'DestTransfertCls', 0, 306, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(30601139, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств', 'DestTransfertClsValue', 0, 306, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(30601140, 'КЦСР', 'DestKCSRCode', 'КЦСР', 'DestKCSR', 0, 306, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(30601141, 'КВР', 'DESTKVRCode', '', 'DestKVR', 0, 306, 1, 0, 'КВР', 0, null) ;

CALL ImportField(30601142, 'КВСР', 'DestKVSRCode', 'КВСР', 'DestKVSR', 0, 306, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(30601152, 'КД', 'DestKDCode', 'КД', 'DestKDValue', 0, 306, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(30601153, 'Источник внутр. и внеш. финанс.', 'DestIFSCode', 'Источник внутр. и внеш. финанс.', 'DestIFS_DescriptionCode', 0, 306, 1, 0, 'ИсточникВнутрФинансирования,ИсточникВнутрФинансированияПолуч', 0, null) ;

CALL ImportField(30601154, 'Договора БО получателя', 'DESTBUDGETPROMISE', 'Договора БО получателя', 'DestBUDGETPROMISE', 0, 306, 1, 1, 'ДоговораБО,БОВнутрНомер', 0, null) ;

CALL ImportField(30601155, 'Дата договора получателя', 'DestBudgetPromiseDocDate', 'Дата договора получателя', 'DestBudgetPromiseDocDate', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601156, 'Примечание договора получателя', 'DestBudgetPromiseDocNote', 'Примечание договора получателя', 'DestBudgetPromiseDocNote', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601157, 'Номер договора получателя', 'DestBudgetPromiseDocNumber', 'Номер договора получателя', 'DestBudgetPromiseDocNumber', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601158, 'Реестровый номер договора получателя', 'DestBudgetPromiseDocReestrNum', 'Реестровый номер договора получателя', 'DestBudgetPromiseDocReestrNum', 0, 306, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(30601159, 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601160, 'Бюджетное обязательство плательщика', 'DestBudgetPromiseCollaps', 'Бюджетное обязательство получателя', 'DestBudgetPromiseCollaps', 0, 306, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30601161, 'Дата гос. контракта', 'DestBudgetPromiseSODate', 'Дата гос. контракта', 'DestBudgetPromiseSODate', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601162, 'ИД контракта', 'DestBudgetPromiseSOID', '', ' ', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601163, 'Прим. гос. контракта', 'DestBudgetPromiseSONote', 'Прим. гос. контракта', 'DestBudgetPromiseSONote', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601164, 'Номер гос. контракта', 'DestBudgetPromiseSONum', 'Номер гос. контракта', 'DestBudgetPromiseSONum', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601165, 'Реестровый номер гос. контр', 'DestBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр', 'DestBudgetPromiseSOReestrNum', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601166, 'Сумма гос. контракта', 'DestBudgetPromiseSOSumma', 'Сумма гос. контракта', 'DestBudgetPromiseSOSumma', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601167, 'Сумма БО получателя', 'DestBudgetPromiseSumma', 'Сумма БО получателя', 'DestBudgetPromiseSumma', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601168, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Номер Д.И. получателя ссылка', 'DestExecDoc', 0, 306, 1, 1, 'ДокИсполнения', 0, null) ;

CALL ImportField(30601169, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', 'Док. исполнения получателя', 0, 306, 1, 0, 'ДокИсполненияГруппа', 0, null) ;

CALL ImportField(30601170, 'Дата', 'DestExecDocDate', 'Дата', 'DestExecDocDate', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601171, 'Назначение', 'DestExecDocNote', 'Назначение', 'DestExecDocNote', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601172, 'Номер', 'DestExecDocNum', 'Номер', 'DestExecDocNum', 0, 306, 1, 0, 'ДокИсполненияНомер', 0, null) ;

CALL ImportField(30601173, 'Реестровый номер', 'DestExecDocReestr', 'Реестровый номер', 'DestExecDocReestr', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601174, 'Сумма док. исполнения получателя', 'DestExecDocSumma', 'Сумма док. исполнения получателя', 'DestExecDocSumma', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601175, 'Тип документа исполнения', 'DestExecDocType', 'Тип документа исполнения', 'DestExecDocType', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601176, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', ' ', 0, 306, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(30601178, 'Код ФО записи', 'FUID', 'Код ФО записи', 'FUID', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601184, 'Л/с получателя', 'DestFacialAcc_Cls', 'Л/с получателя', ' ', 0, 306, 1, 1, '', 0, null) ;

CALL ImportField(30601185, 'Код записи', 'ID', 'Код записи', 'Id', 0, 306, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(30601186, 'Код субсидииКлюч', 'DestSubsidyCls', 'Код субсидии (ссылка)', 'DestSubsidyCls', 0, 306, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(30601187, 'Код субсидии', 'DestSubsidyClsCode', 'Код субсидии', 'DestSubsidyClsCode', 0, 306, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(30601188, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', ' ', 0, 306, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(30601189, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', ' ', 0, 306, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(30601190, 'Код бюджетного ассигнования (ключ)', 'DestBudAllocationCls', '', ' ', 0, 306, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(30601191, 'Код расходного обязательства (ключ)', 'DestPayPromiseCls', '', ' ', 0, 306, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

-- Поступление по объявлениям, Бюджет(1)
CALL ImportField(30610001, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 306, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(30610002, 'Л/с получателя', 'DESTFACIALACC_CLS', 'Л/с получателя', 'DestFacialAccCls', 1, 306, 0, 0, 'ЛицевойСчет', 0, 18959) ;

CALL ImportField(30610003, 'Казн. счет', 'DestAccountName', 'Казн. счет', ' ', 1, 306, 0, 0, '', 0, 17112) ;

CALL ImportField(30610004, 'ИНН банка(Банк)', 'INN', 'ИНН банка', ' ', 1, 306, 0, 0, '', 0, 16645) ;

CALL ImportField(30610005, 'КПП банка(Банк)', 'INN20', 'КПП банка', ' ', 1, 306, 0, 0, '', 0, 16653) ;

CALL ImportField(30610006, 'Банк(Банк)', 'NAME', 'Банк', ' ', 1, 306, 0, 0, '', 0, 16646) ;

CALL ImportField(30610007, 'Счет кассы(Банк)', 'ACC', 'Счет кассы', ' ', 1, 306, 0, 0, '', 0, 17112) ;

CALL ImportField(30610008, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 306, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(30610009, 'Назначение взноса', 'NOTE', 'Назначение взноса', 'NOTE', 1, 306, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(30610010, 'Дата проводки', 'ACCEPTDATE', 'Дата проводки', 'AcceptDate', 1, 306, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(30610011, 'Направление операции', 'OperationDirection', 'Направление операции', 'OPERATIONDIRECTION', 1, 306, 0, 0, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(30610012, 'Архив', 'ARHIVEDOC', 'Архив', 'ARHIVEDOC', 1, 306, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(30610013, 'Дата объявления', 'DOCUMENTDATE', 'Дата объявления', 'DocumentDate', 1, 306, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(30610014, '№ объявления', 'DOCNUMBER', '№ объявления', 'DocumentNumber', 1, 306, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(30610042, 'Банк', 'parentSourceBank', 'Банк', ' ', 1, 306, 0, 0, '', 0, null) ;

CALL ImportField(30610043, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 306, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(30610044, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (комментарий)', 'RejectCause', 1, 306, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(30610045, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', 'BUHPAYMENTCLS', 1, 306, 0, 0, 'БухПроводка', 0, 18968) ;

CALL ImportField(30610046, 'Л/с (РВС)', 'SOURCEFACIALACC_CLS', 'Л/с (РВС)', 'SourceFacialAccCls', 1, 306, 0, 0, 'ЛицСчетПлательщика', 0, 18957) ;

CALL ImportField(30610047, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', ' ', 1, 306, 0, 0, '', 0, null) ;

CALL ImportField(30610048, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 1, 306, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(30610097, 'Л/С получателя в ФК', 'DestFACIALCODE', 'Л/С получателя в ФК', ' ', 1, 306, 0, 0, '', 0, null) ;

CALL ImportField(30610101, 'Заблокировано(Состояние блокировки)', 'IsBlocked', 'Заблокировано', 'IsBlocked', 1, 306, 0, 0, 'ПризнакБлокировки', 0, 19012) ;

CALL ImportField(30610102, 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 'Причина блокировки', 'BLOCKEDCAUSE', 1, 306, 0, 0, 'ПричинаБлокировки', 0, 19013) ;

CALL ImportField(30610103, 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 'Дата разблокировки', 'UnBlockedDate', 1, 306, 0, 0, 'ДатаРазблокировки', 0, 19014) ;

CALL ImportField(30610104, 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 'Причина разблокировки', 'UnblockedCause', 1, 306, 0, 0, 'ПричинаРазблокировки', 0, 19015) ;

CALL ImportField(30610105, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 1, 306, 0, 0, 'ТипКлассификацииЗаголовок', 0, 19008) ;

CALL ImportField(30610107, 'Код документа', 'ID', 'Код документа', 'ID', 1, 306, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(30610108, 'Расч. cчет получателя', 'DESTACCOUNT', 'Расч. cчет получателя', 'DESTACCOUNT', 1, 306, 0, 1, 'РСФО,СчетПолуч', 0, 18958) ;

CALL ImportField(30610109, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 306, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(30610111, 'Федеральные cредства', 'FEDERALFUNDSREF', 'Федеральные cредства', ' ', 1, 306, 0, 1, 'ФедеральныеСредства', 0, 19004) ;

CALL ImportField(30610119, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 306, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(30610120, 'Код удаленного клиента', 'SENDERID', 'Код удаленного клиента', 'SenderID', 1, 306, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(30610121, 'Код УРМ документа', 'SENDERRECORDID', 'Код УРМ документа', 'SenderRecordID', 1, 306, 0, 1, 'КодУРМДокумента', 0, 18970) ;

CALL ImportField(30610124, 'Электронный документ', 'ElDocRef', 'Электронный документ', ' ', 1, 306, 0, 1, '', 0, 19006) ;

CALL ImportField(30610125, 'Р. счет плательщика', 'SOURCEACCOUNT', 'Р. счет плательщика', 'SOURCEACCOUNT', 1, 306, 0, 1, 'СчетПлат', 0, 18956) ;

CALL ImportField(30610126, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'ProgIndex', 1, 306, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(30610127, 'Персональная информация', 'CashierPersonalInfo', 'Персональная информация', 'CashierPersonalInfo', 1, 306, 0, 0, 'ПерсональнаяИнформация', 0, 24731) ;

CALL ImportField(30610128, 'Отдел', 'DepartmentCLS', '', 'DEPARTMENTCLS', 1, 306, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(30610129, 'Номер л/с получателя', 'DestFacialCodeEx', '', ' ', 1, 306, 0, 0, '', 0, 26617) ;

CALL ImportField(30611015, 'Кассовый символ', 'PAYSYMBOLCLS', 'Кассовый символ', 'PaySymbolCls', 1, 306, 1, 0, 'КассовыйСимвол', 0, 18874) ;

CALL ImportField(30611016, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 306, 1, 0, 'ПримечаниеДеталь', 0, 18876) ;

CALL ImportField(30611017, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 306, 1, 0, '', 0, null) ;

CALL ImportField(30611018, 'КВСРКлюч', 'DestKVSR', 'КВСР', 'DestKVSRKey', 1, 306, 1, 1, 'КВСРКлюч', 0, 18895) ;

CALL ImportField(30611019, 'ФКР(Классификация)', 'DestKFSR', 'КФСР', 'DestKFSR', 1, 306, 1, 0, 'КФСР', 0, 18897) ;

CALL ImportField(30611020, 'КЦСРКлюч', 'DestKCSR', 'КЦСР', 'DestKCSRKey', 1, 306, 1, 1, 'КЦСРКлюч', 0, 18896) ;

CALL ImportField(30611021, 'КВРКлюч', 'DESTKVR', 'КВР', 'DestKVRKey', 1, 306, 1, 1, 'КВРКлюч', 0, 18870) ;

CALL ImportField(30611022, 'ЭКР(Классификация)', 'DESTKESR', 'КЭСР', 'DestKESR', 1, 306, 1, 0, 'КЭСР', 0, 18871) ;

CALL ImportField(30611026, 'Вид источника(Классификация)', 'DestIFS_DescriptionCode', 'Вид источника', ' ', 1, 306, 1, 0, '', 0, 17050) ;

CALL ImportField(30611027, 'ЭКИ(Классификация)', 'DestIFS_KESR', 'ЭК', ' ', 1, 306, 1, 0, '', 0, 17054) ;

CALL ImportField(30611029, 'Вид дохода(Классификация)', 'DestKD_DescriptionCode', 'Вид дохода', ' ', 1, 306, 1, 0, '', 0, 16831) ;

CALL ImportField(30611030, 'Подвид дохода(Классификация)', 'DestKD_Program', 'Программа', ' ', 1, 306, 1, 0, '', 0, 16834) ;

CALL ImportField(30611031, 'ЭКД(Классификация)', 'DestKD_KESR', 'ЭКД', ' ', 1, 306, 1, 0, '', 0, 16835) ;

CALL ImportField(30611033, 'Тип документа', 'DestDocType', 'Тип документа', 'DestDOCTYPECLS', 1, 306, 1, 0, 'ТипДокумента', 0, 18903) ;

CALL ImportField(30611034, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 306, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(30611035, '№ БО получателя', 'DESTPROMISE', '№ БО получателя', 'DestPROMISE', 1, 306, 1, 0, 'БюджОбяз', 0, 18906) ;

CALL ImportField(30611036, 'Номер БО(№ бюдж. обязат-ва получателя)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', ' ', 1, 306, 1, 0, 'ДоговораБОНомер,БОНомер', 0, 20223) ;

CALL ImportField(30611037, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 306, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(30611038, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'ClsType', 1, 306, 1, 1, 'ТипКлассификации,ТипКлассификацииПлат', 0, 18922) ;

CALL ImportField(30611039, 'Суб КОСГУ', 'DestSubKESR', 'Суб КЭСР', 'DestSUBKESR', 1, 306, 1, 0, 'СубКЭСР', 0, 18898) ;

CALL ImportField(30611040, 'Тип средств', 'DestMeansType', 'Тип средств', 'DestMEANSTYPECLS', 1, 306, 1, 0, 'ТипСредств', 0, 18900) ;

CALL ImportField(30611041, 'Источник финансирования', 'DestFinSource', 'Источник финансирования', 'DestFINSOURCECLS', 1, 306, 1, 0, 'ИсточникФинансирования', 0, 18901) ;

CALL ImportField(30611050, 'Район трансферта', 'DestRegionCls', 'Район', 'DESTREGIONCLS', 1, 306, 1, 1, 'Регион,РайонТрансферта', 0, 18928) ;

CALL ImportField(30611098, '№ бюдж. обязат-ва получателя', 'DestBudgetPromiseCollaps', '№ бюдж. обязат-ва получателя', ' ', 1, 306, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30611099, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', ' ', 1, 306, 1, 0, '', 0, null) ;

CALL ImportField(30611100, 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 'Номер', 'DestExecDocNum', 1, 306, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(30611106, 'Источник образования', 'DestFundsSource', 'Источник образования', 'DestFundsSource', 1, 306, 1, 0, 'ИсточникОбразованияСредств', 0, 18929) ;

CALL ImportField(30611112, 'Вн. номер БО получателя', 'DESTBUDGETPROMISE', 'Вн. номер БО получателя', 'DestBUDGETPROMISE', 1, 306, 1, 1, 'ДоговораБО,БОВнутрНомер', 0, 18909) ;

CALL ImportField(30611113, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Номер Д.И. получателя ссылка', 'DestExecDoc', 1, 306, 1, 1, 'ДокИсполнения', 0, 18918) ;

CALL ImportField(30611114, 'Источниковая классификация', 'DestIFS', 'Источниковая классификация', 'DestIFS', 1, 306, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПолуч', 0, 18921) ;

CALL ImportField(30611115, 'Код дохода', 'DestKD', 'Код дохода', 'DESTKD', 1, 306, 1, 1, 'КДКлюч', 0, 18926) ;

CALL ImportField(30611116, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 306, 1, 1, '', 0, 18872) ;

CALL ImportField(30611117, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 306, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(30611118, 'Код записи', 'ID', 'Код записи', 'Id', 1, 306, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(30611126, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 306, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(30611127, 'Источниковая классификация', 'DestIFS_FullID', 'DestIFS_FullID(Источниковая классификация)', 'DestIFS_DescriptionCode', 1, 306, 1, 1, 'ИсточникВнутрФинансирования,ИсточникВнутрФинансированияПолуч', 0, null) ;

CALL ImportField(30611128, 'Код дохода', 'DestKD_Value', 'Код дохода', 'DESTKDVALUE', 1, 306, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(30611129, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'ProgIndex', 1, 306, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(30611130, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств (ссылка)', 'DestTransfertCls', 1, 306, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18936) ;

CALL ImportField(30611137, 'Код субсидииКлюч', 'DestSubsidyCls', 'Код субсидии (ссылка)', 'DestSubsidyCls', 1, 306, 1, 1, 'КодСубсидииКлюч', 0, 26624) ;

CALL ImportField(30611139, 'Наименование района трансферта', 'DestRegionClsName', '', ' ', 1, 306, 1, 0, '', 0, null) ;

CALL ImportField(30611142, 'Код бюджетного ассигнованияКлюч', 'DestBudAllocationCls', '', 'DestBudAllocationCls', 1, 306, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27842) ;

CALL ImportField(30611143, 'Код расходного обязательстваКлюч', 'DestPayPromiseCls', '', 'DestPayPromiseCls', 1, 306, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27843) ;

-- Реестры казначейства, Бюджет(1)
CALL ImportField(30710001, 'Принятие', 'Accepted', 'Принятие', 'Accepted', 1, 307, 0, 0, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(30710002, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 1, 307, 0, 1, '', 0, 19107) ;

CALL ImportField(30710003, 'Субсчет', 'FacialAcc_Cls', 'Субсчет', ' ', 1, 307, 0, 0, '', 0, null) ;

CALL ImportField(30710005, 'Примечание', 'Note', 'Примечание', ' ', 1, 307, 0, 0, 'Примечание', 0, 19103) ;

CALL ImportField(30710007, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 1, 307, 0, 0, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(30710008, 'Номер реестра', 'REESTRNUMBER', 'Номер реестра', 'REESTRNUMBER', 1, 307, 0, 0, 'НомерРеестра', 0, 19090) ;

CALL ImportField(30710009, 'Тип реестра', 'ReestrTypeEx', 'Тип реестра', 'ReestrTypeEx', 1, 307, 0, 0, 'ТипРеестра', 0, 19105) ;

CALL ImportField(30710010, 'Номер сессии', 'SESSIONNUMBER', 'Номер сессии', 'SessionNumber', 1, 307, 0, 1, 'НомерСессии', 0, 19094) ;

CALL ImportField(30710011, 'Сумма', 'Summa', 'Сумма', 'Summa', 1, 307, 0, 1, '', 0, 19102) ;

CALL ImportField(30710012, 'код записи', 'ID', 'Код реестра', 'ID', 1, 307, 0, 1, 'КодДокумента', 0, 19089) ;

CALL ImportField(30710013, 'Ссылка на связанный документ', ' ', 'Ссылка на заголовок', 'RecordIndex', 1, 307, 0, 1, '', 1, null) ;

CALL ImportField(30710014, 'Статус ЭЦП', 'CryptoStatus', 'Статус электронной цифровой подписи', 'CryptoStatus', 1, 307, 0, 1, '', 0, 19109) ;

CALL ImportField(30710015, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 307, 0, 0, 'КодБюджета', 0, 19095) ;

CALL ImportField(30710016, 'Отдел', 'DepartmentCls', '', 'DEPARTMENTCLS', 1, 307, 0, 0, '', 0, 30617) ;

CALL ImportField(30711016, 'Ссылка на документ обмена с банком', 'pdeRef', 'Ссылка на документ обмена с банком', ' ', 1, 307, 1, 1, '', 0, 17226) ;

CALL ImportField(30711017, 'Статус', 'Status', 'Статус', ' ', 1, 307, 1, 1, 'СтатусДетализация', 0, 17233) ;

-- Внутренние платежи, УРМ(0)
CALL ImportField(30800003, 'Лицевой счет плательщика в ФК', ' ', 'Лицевой счет плательщика в ФК', 'SourceFKFacialCode', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800004, 'Номер документа', 'DocNumber', 'Номер документа', 'DocumentNumber', 0, 308, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(30800005, 'Дата документа', 'DocumentDate', 'Дата документа', 'DocumentDate', 0, 308, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(30800006, 'Лицевой счет плательщика', 'SourceFacialAcc_Cls', 'Лицевой счет плательщика', 'SourceFacialAccCls', 0, 308, 0, 0, 'ЛицевойСчет,ЛицСчетПлательщика', 0, null) ;

CALL ImportField(30800007, 'Сумма (заголовок)', 'Summa', 'Сумма (заголовок)', 'SUMMA', 0, 308, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(30800008, 'Назначение платежа (заголовок)', 'Note', 'Назначение платежа (заголовок)', 'NOTE', 0, 308, 0, 0, 'Примечание', 0, null) ;

CALL ImportField(30800009, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 0, 308, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(30800010, 'Бухгалтерская операция', 'BuhPaymentCls', 'Бухгалтерская операция', 'BUHPAYMENTCLS', 0, 308, 0, 0, 'БухПроводка', 0, null) ;

CALL ImportField(30800011, 'Вид операции', 'TypeOperationCls', 'Вид операции', 'OperationTypeCls', 0, 308, 0, 0, 'ТипОперации', 0, null) ;

CALL ImportField(30800012, 'Причина отклонения', 'Reject_Cls', 'Причина отклонения', 'REJECTCLS', 0, 308, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(30800013, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 0, 308, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(30800014, 'Казначейский счет', 'SourceAccountName', 'Казначейский счет', 'SOURCEACCOUNTNAME', 0, 308, 0, 0, '', 0, null) ;

CALL ImportField(30800042, 'Код документа', 'ID', 'Код документа', 'ID', 0, 308, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30800043, 'Код ФО документа', 'FUID', 'Код ФО документа', 'FUID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800044, 'Код УРМ документа', ' ', 'Код УРМ документа', 'SenderRecordID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800045, 'Код отправителя документа', ' ', 'Код отправителя документа', 'SenderID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800046, 'Срок платежа', 'PayDate', 'Срок платежа', 'PayDate', 0, 308, 0, 0, '', 0, null) ;

CALL ImportField(30800047, 'Номер реестра', 'ReestrNumber', 'Номер реестра', 'ReestrNumber', 0, 308, 0, 1, 'НомерРеестра', 0, null) ;

CALL ImportField(30800048, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 0, 308, 0, 1, 'ДатаРеестра', 0, null) ;

CALL ImportField(30800049, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 308, 0, 1, 'ИндексыДанныхЗаголовок', 0, null) ;

CALL ImportField(30800050, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 0, 308, 0, 0, '', 0, null) ;

CALL ImportField(30800051, 'Очередность ', 'PayPriority', 'Очередность ', 'PayPriority', 0, 308, 0, 0, '', 0, null) ;

CALL ImportField(30800052, 'Номер карточки', ' ', 'Номер карточки', 'CARDNUMBER', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800053, 'Ссылка на р/c плательщика', 'SOURCEACCOUNT', 'Ссылка на р/c плательщика', 'SOURCEACCOUNT', 0, 308, 0, 1, 'СчетПлат,РСФО', 0, null) ;

CALL ImportField(30800054, 'Ссылка на счет организации-получателя', 'DESTACCOUNT', 'Ссылка на счет организации-получателя', 'DESTACCOUNT', 0, 308, 0, 1, 'СчетПолуч', 0, null) ;

CALL ImportField(30800055, 'л\с получателя', 'DESTFACIALACC_CLS', 'л\с получателя', 'DestFacialAccCls', 0, 308, 0, 0, 'ЛицСчетПолучЗаголовок', 0, null) ;

CALL ImportField(30800056, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 308, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(30800057, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800058, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800059, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800060, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800061, 'Номер заявки', 'BidNumber', 'Номер заявки', 'BidNumber', 0, 308, 0, 0, 'НомерЗаявки', 0, null) ;

CALL ImportField(30800062, 'Локальный реестр', ' ', 'Локальный реестр', 'ManagerBid', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800063, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800064, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800065, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800067, 'Статус ЭЦП', ' ', 'Статус ЭЦП', 'CRYPTOSTATUS', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800068, 'Отдел', ' ', 'Отдел', 'DEPARTMENTCLS', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800069, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800070, 'Текст мягкой причины отклонения', 'SoftRejectCause', 'Текст мягкой причины отклонения', 'SoftRejectCause', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800071, 'Ссылка на счет получателя ФО', ' ', 'Ссылка на счет получателя ФО', 'DestAccountFUID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800072, 'Счет получателя', ' ', 'Счет получателя', 'DestAccountName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800073, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800074, 'Субсчет получателя', ' ', 'Субсчет получателя', 'DestFKFacialCode', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800075, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800076, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800077, 'ИНН организации-получателя', ' ', 'ИНН организации-получателя', 'DestOrgINN', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800078, 'КПП организации-получателя', ' ', 'КПП организации-получателя', 'DestOrgKPP', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800079, 'Наименование организации-получателя', ' ', 'Наименование организации-получателя', 'DestOrgName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800080, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800081, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800082, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800083, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800084, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800085, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800086, 'Имя л\с получателя', ' ', 'Имя л\с получателя', 'DestFacialAccClsName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800087, 'мнемокод л\с получателя', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800088, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800089, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800090, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800091, 'Организация ФК получателя(код)', ' ', 'Организация ФК получателя(код)', 'DestFKOrgId', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800092, 'Организация ФК получателя ФО', ' ', 'Организация ФК получателя ФО', 'DestFKOrgFUID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800093, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800094, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800095, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800096, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800097, 'Ссылка на р/c ФО плательщика', ' ', 'Ссылка на р/c ФО плательщика', 'SourceAccountFUID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800098, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800099, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800100, 'Ссылка на организацию плательщика(для УРМ)', ' ', 'Ссылка на организацию плательщика(для УРМ)', 'SourceOrgFUID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800101, 'ИНН организации-плательщика', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800102, 'КПП организации-плательщика', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800103, 'Наименование организации-плательщика', ' ', 'Наименование организации-плательщика', 'SourceOrgName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800104, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800105, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800106, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800107, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800108, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800109, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800110, 'Плательщик', 'SourceFacialAccName', 'л\с плательщика', 'SourceFacialAccClsName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800111, 'Мнемокод л\с плательщика', 'SourceFacialCode', 'Мнемокод л\с плательщика', 'SourceFacialAccClsFacialCode', 0, 308, 0, 0, '', 0, null) ;

CALL ImportField(30800112, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800113, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800114, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800115, 'Организация ФК плательщика(код)', ' ', 'Организация ФК плательщика(код)', 'SourceFKOrgId', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800116, 'Организация ФК ФО плательщика', ' ', 'Организация ФК ФО плательщика', 'SourceFKOrgFUID', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800117, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800118, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800119, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800120, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800180, 'НаправлениеОперации', ' ', 'Направление операции', 'НаправлениеОперации', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800183, 'Направление операции', 'OperationDirection', 'Направление операции', ' ', 0, 308, 0, 0, 'НаправлениеОперации', 0, null) ;

CALL ImportField(30800188, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 308, 0, 1, '', 0, null) ;

CALL ImportField(30800190, 'Признак принятого реестра', 'Accepted', 'Признак принятого реестра', 'Accepted', 0, 308, 0, 1, 'ПринятиеРеестра', 0, null) ;

CALL ImportField(30800191, 'Код реестра', 'Reestr_Ref', 'Код реестра', 'Reestr_Ref', 0, 308, 0, 1, 'КодРеестра', 0, null) ;

CALL ImportField(30800193, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 308, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(30800194, 'Тип классификации', 'ClsType', 'Тип классификации', 'CLSTYPE', 0, 308, 0, 0, '', 0, null) ;

CALL ImportField(30800195, 'Классификация документа', 'ClsTypeText', 'Классификация документа', ' ', 0, 308, 0, 0, '', 0, null) ;

CALL ImportField(30800228, 'НДС(Информация о платеже)', 'NDS', '', 'NDS', 0, 308, 0, 0, 'НДС', 0, null) ;

CALL ImportField(30801015, 'Сумма по строке детализации', 'Summa', 'Сумма по строке детализации', 'SUMMA', 0, 308, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(30801016, 'КВР плат. (Ключ)', 'SourceKVR', 'КВР плат. (Ключ)', 'SourceKVRKey', 0, 308, 1, 1, 'КВРКлюч,КВРКлючПлат', 0, null) ;

CALL ImportField(30801017, 'КЭСР плательщика', 'SourceKESR', 'КЭСР плательщика', 'SourceKESR', 0, 308, 1, 0, 'КЭСР,КЭСРПлат', 0, null) ;

CALL ImportField(30801018, 'КФСР плательщика', 'SourceKFSR', 'КФСР плательщика', 'SourceKFSR', 0, 308, 1, 0, 'КФСР,КФСРПлат', 0, null) ;

CALL ImportField(30801019, 'КЦСР плат. (Ключ)', 'SourceKCSR', 'КЦСР плательщика', 'SourceKCSRKey', 0, 308, 1, 1, 'КЦСРКлюч,КЦСРКлючПлат', 0, null) ;

CALL ImportField(30801020, 'КВСР плат. (Ключ)', 'SourceKVSR', 'КВСР плат. (Ключ)', 'SourceKVSRKey', 0, 308, 1, 1, 'КВСРКлюч,КВСРКлючПлат', 0, null) ;

CALL ImportField(30801021, 'Суб. КЭСР плательщика', 'SourceSubKESR', 'Суб. КЭСР плательщика', 'SourceSUBKESR', 0, 308, 1, 0, 'СубКЭСР,СубКЭСРПлат', 0, null) ;

CALL ImportField(30801023, 'Тип средств плательщика', 'SourceMeansType', 'Тип средств плательщика', 'SourceMEANSTYPECLS', 0, 308, 1, 0, 'ТипСредств,ТипСредствПлат', 0, null) ;

CALL ImportField(30801025, 'Источник финансирования плательщика', 'SourceFinSource', 'Источник финансирования плательщика', 'SourceFINSOURCECLS', 0, 308, 1, 0, 'ИсточникФинансирования,ИсточникФинансированияПлат', 0, null) ;

CALL ImportField(30801027, 'Лицевой счет получателя в ФК', 'DestFacialCode', 'Лицевой счет получателя в ФК', 'DestFacialAccClsFacialCode', 0, 308, 1, 0, '', 0, null) ;

CALL ImportField(30801028, 'КВР получ. (Ключ)', 'DestKVR', 'КВР получателя', 'DestKVRKey', 0, 308, 1, 0, 'КВРКлючПолуч', 0, null) ;

CALL ImportField(30801029, 'КЭСР получателя', 'DestKESR', 'КЭСР получателя', 'DestKESR', 0, 308, 1, 0, 'КЭСРПолуч', 0, null) ;

CALL ImportField(30801030, 'КФСР получателя', 'DestKFSR', 'КФСР получателя', 'DestKFSR', 0, 308, 1, 0, 'КФСРПолуч', 0, null) ;

CALL ImportField(30801031, 'КЦСР получ. (Ключ)', 'DestKCSR', 'КЦСР получателя', 'DestKCSRKey', 0, 308, 1, 0, 'КЦСРКлючПолуч', 0, null) ;

CALL ImportField(30801032, 'КВСР получ. (Ключ)', 'DestKVSR', 'КВСР получ. (Ключ)', 'DestKVSRKey', 0, 308, 1, 1, 'КВСРКлючПолуч', 0, null) ;

CALL ImportField(30801033, 'Суб. КЭСР получателя', 'DestSubKESR', 'Суб. КЭСР получателя', 'DestSUBKESR', 0, 308, 1, 0, 'СубКЭСРПолуч', 0, null) ;

CALL ImportField(30801035, 'Тип средств получателя', 'DestMeansType', 'Тип средств получателя', 'DestMEANSTYPECLS', 0, 308, 1, 0, 'ТипСредствПолуч', 0, null) ;

CALL ImportField(30801037, 'Источник финансирования получателя', 'DestFinSource', 'Источник финансирования получателя', 'DestFINSOURCECLS', 0, 308, 1, 0, 'ИсточникФинансированияПолуч', 0, null) ;

CALL ImportField(30801038, 'Примечание по строке детализации', 'Note', 'Примечание по строке детализации', 'NOTE', 0, 308, 1, 0, 'ПримечаниеДеталь', 0, null) ;

CALL ImportField(30801039, 'Номер мем. ордера', 'MemOrderNum', 'Номер мем. ордера', 'MemOrderNum', 0, 308, 1, 0, 'НомерМемордера', 0, null) ;

CALL ImportField(30801040, 'Номер БО плательщика', 'SourcePromise', 'Номер БО плательщика', 'SOURCEPROMISE', 0, 308, 1, 0, 'БюджОбяз,БюджОбязПлат', 0, null) ;

CALL ImportField(30801041, 'Номер БО получателя', 'DestPromise', 'Номер БО получателя', 'DestPROMISE', 0, 308, 1, 0, 'БюджОбязПолуч', 0, null) ;

CALL ImportField(30801122, 'Номер БО плательщика(договора)', 'SourceBudgetPromiseNum', 'Номер БО плательщика(договора)', 'Номер БО плательщика', 0, 308, 1, 0, 'БОНомер,ДоговораБОНомер,ДоговораБОПлатНомер', 0, null) ;

CALL ImportField(30801123, 'Документ исполнения плательщика', 'SourceExecDocCollaps', 'Документ исполнения плательщика', 'Документ исполнения плательщика', 0, 308, 1, 0, 'ДокИсполненияГруппа,ДокИсполненияПлатГруппа', 0, null) ;

CALL ImportField(30801124, 'Ссылка на документ исполнения плательщика', 'SourceExecDoc', 'Ссылка на документ исполнения плательщика', 'Ссылка на документ исполнения плательщика', 0, 308, 1, 1, 'ДокИсполнения,ДокИсполненияПлат', 0, null) ;

CALL ImportField(30801125, 'Номер документа исполнения плательщика', 'SourceExecDocNum', 'Номер документа исполнения плательщика', 'Номер документа исполнения плательщика', 0, 308, 1, 0, 'ДокИсполненияНомер,ДокИсполненияПлатНомер', 0, null) ;

CALL ImportField(30801126, 'Реестровый номер ДИ плательщика', 'SourceExecDocReestr', 'Реестровый номер ДИ плательщика', 'Реестровый номер ДИ плательщика', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801127, 'Дата ДИ плательщика', 'SourceExecDocDate', 'Дата ДИ плательщика', 'Дата ДИ плательщика', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801128, 'Тип ДИ плательщика', 'SourceExecDocType', 'Тип ДИ плательщика', 'Тип ДИ плательщика', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801129, 'Сумма по ДИ плательщика', 'SourceExecDocSumma', 'Сумма по ДИ плательщика', 'Сумма по ДИ плательщика', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801130, 'Примечание ДИ плательщика', 'SourceExecDocNote', 'Примечание ДИ плательщика', 'Примечание ДИ плательщика', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801131, 'Ссылка на внутренний номер БО получателя', 'DestBudgetPromise', 'Ссылка на внутренний номер БО получателя', 'Ссылка на внутренний номер БО получателя', 0, 308, 1, 1, 'ДоговораБОПолуч', 0, null) ;

CALL ImportField(30801132, 'Номер БО получателя(договора)', 'DestBudgetPromiseNum', 'Номер БО получателя(договора)', 'Номер БО получателя', 0, 308, 1, 0, 'ДоговораБОПолучНомер', 0, null) ;

CALL ImportField(30801133, 'Документ исполнения получателя', 'DestExecDocCollaps', 'Документ исполнения получателя', 'Документ исполнения получателя', 0, 308, 1, 0, 'ДокИсполненияПолучГруппа', 0, null) ;

CALL ImportField(30801134, 'Ссылка на документ исполнения получателя', 'DestExecDoc', 'Ссылка на документ исполнения получателя', 'Ссылка на документ исполнения получателя', 0, 308, 1, 1, 'ДокИсполненияПолуч', 0, null) ;

CALL ImportField(30801135, 'Номер документа исполнения получателя', 'DestExecDocNum', 'Номер документа исполнения получателя', 'Номер документа исполнения получателя', 0, 308, 1, 0, 'ДокИсполненияПолучНомер', 0, null) ;

CALL ImportField(30801136, 'Реестровый номер ДИ получателя', 'DestExecDocReestr', 'Реестровый номер ДИ получателя', 'Реестровый номер ДИ получателя', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801137, 'Дата ДИ получателя', 'DestExecDocDate', 'Дата ДИ получателя', 'Дата ДИ получателя', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801138, 'Тип ДИ получателя', 'DestExecDocType', 'Тип ДИ получателя', 'Тип ДИ получателя', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801139, 'Сумма по ДИ получателя', 'DestExecDocSumma', 'Сумма по ДИ получателя', 'Сумма по ДИ получателя', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801140, 'Примечание ДИ получателя', 'DestExecDocNote', 'Примечание ДИ получателя', 'Примечание ДИ получателя', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801141, 'Бюджетное обязательство плательщика', 'SourceBudgetPromiseCollaps', 'Бюджетное обязательство плательщика', 'SourceBudgetPromiseCollaps', 0, 308, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30801142, 'Сумма БО плательщика', 'SourceBudgetPromiseSumma', 'Сумма БО плательщика', 'SourceBudgetPromiseSumma', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801143, 'Номер договора плательщика', 'SourceBudgetPromiseDocNumber', 'Номер договора плательщика', 'SourceBudgetPromiseDocNumber', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801144, 'Дата договора плательщика', 'SourceBudgetPromiseDocDate', 'Дата договора плательщика', 'SourceBudgetPromiseDocDate', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801145, 'Сумма договора плательщика', 'SourceBudgetPromiseDocSumma', 'Сумма договора плательщика', 'SourceBudgetPromiseDocSumma', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801146, 'Реестровый номер дог.', 'SourceBudgetPromiseDocReestrNum', 'Реестровый номер дог.', 'SourceBudgetPromiseDocReestrNum', 0, 308, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(30801147, 'Дог. примечание плательщика', 'SourceBudgetPromiseDocNote', 'Дог. примечание плательщика', 'SourceBudgetPromiseDocNote', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801148, 'Номер гос. контракта плательщика', 'SourceBudgetPromiseSONum', 'Номер гос. контракта плательщика', 'SourceBudgetPromiseSONum', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801149, 'Дата гос. контракта плательщика', 'SourceBudgetPromiseSODate', 'Дата гос. контракта плательщика', 'SourceBudgetPromiseSODate', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801150, 'Сумма гос. контракта плательщика', 'SourceBudgetPromiseSOSumma', 'Сумма гос. контракта плательщика', 'SourceBudgetPromiseSOSumma', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801151, 'Реестровый номер гос. контр плательщика', 'SourceBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр плательщика', 'SourceBudgetPromiseSOReestrNum', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801152, 'Прим. гос. контракта плательщика', 'SourceBudgetPromiseSONote', 'Прим. гос. контракта плательщика', 'SourceBudgetPromiseSONote', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801153, 'Бюджетное обязательство получателя', 'DestBudgetPromiseCollaps', 'Бюджетное обязательство получателя', 'DestBudgetPromiseCollaps', 0, 308, 1, 0, 'БОВнутрНомерГруппаПолуч', 0, null) ;

CALL ImportField(30801154, 'Сумма БО получателя', 'DestBudgetPromiseSumma', 'Сумма БО получателя', 'DestBudgetPromiseSumma', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801155, 'Номер договора  получателя', 'DestBudgetPromiseDocNumber', 'Номер договора получателя', 'DestBudgetPromiseDocNumber', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801156, 'Дата договора получателя', 'DestBudgetPromiseDocDate', 'Дата договора получателя', 'DestBudgetPromiseDocDate', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801157, 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801158, 'Реестровый номер дог получателя', 'DestBudgetPromiseDocReestrNum', 'Реестровый номер дог получателя', 'DestBudgetPromiseDocReestrNum', 0, 308, 1, 0, '', 0, null) ;

CALL ImportField(30801159, 'Дог. примечание получателя', 'DestBudgetPromiseDocNote', 'Дог. примечание получателя', 'DestBudgetPromiseDocNote', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801160, 'Номер гос. контракта получателя', 'DestBudgetPromiseSONum', 'Номер гос. контракта получателя', 'DestBudgetPromiseSONum', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801161, 'Дата гос. контракта получателя', 'DestBudgetPromiseSODate', 'Дата гос. контракта получателя', 'DestBudgetPromiseSODate', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801162, 'Сумма гос. контракта получателя', 'DestBudgetPromiseSOSumma', 'Сумма гос. контракта получателя', 'DestBudgetPromiseSOSumma', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801163, 'Реестровый номер гос. контр  получателя', 'DestBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр получателя', 'DestBudgetPromiseSOReestrNum', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801164, 'Прим. гос. контракта  получателя', 'DestBudgetPromiseSONote', 'Прим. гос. контракта получателя', 'DestBudgetPromiseSONote', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801165, 'Код записи', 'Id', 'Код записи', 'Id', 0, 308, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(30801166, 'Код ФО записи', 'FUID', 'Код ФО записи', 'FUID', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801167, 'Код УРМ записи', ' ', 'Код УРМ записи', 'SenderRecordID', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801168, 'Код отправителя записи', ' ', 'Код отправителя записи', 'SenderID', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801169, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 308, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(30801170, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 308, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30801171, 'Бух операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 0, 308, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(30801172, 'Тип классификации', 'ClsType', 'Признак классификации', 'ClsType', 0, 308, 1, 0, 'ТипКлассификации,ТипКлассификацииПлат', 0, null) ;

CALL ImportField(30801173, 'Тип документа получателя', 'DestDOCTYPE', 'Тип документа получателя', 'DestDOCTYPECLS', 0, 308, 1, 0, 'ТипДокументаПолуч', 0, null) ;

CALL ImportField(30801175, 'Договора БО плательщика', 'SourceBUDGETPROMISE', 'Договора БО плательщика', 'SourceBUDGETPROMISE', 0, 308, 1, 0, 'БОВнутрНомер,ДоговораБО,ДоговораБОПлат', 0, null) ;

CALL ImportField(30801177, 'Тип документа плательщика', 'SourceDOCTYPE', 'Тип документа плательщика', 'SourceDOCTYPECLS', 0, 308, 1, 0, 'ТипДокумента,ТипДокументаПлат', 0, null) ;

CALL ImportField(30801179, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801181, 'Классификация плательщика', 'TreeOwner0', 'Классификация плательщика', ' ', 0, 308, 1, 0, '', 0, null) ;

CALL ImportField(30801182, 'Классификация получателя', 'TreeOwner1', 'Классификация получателя', ' ', 0, 308, 1, 0, '', 0, null) ;

CALL ImportField(30801184, 'Район получателя', 'DestRegionCls', 'Район получателя', 'DestRegionCls', 0, 308, 1, 0, 'РегионПолуч,РайонТрансфертаПолуч', 0, null) ;

CALL ImportField(30801187, 'Район плательщика', 'SourceRegionCls', 'Район плательщика', 'SourceRegionCls', 0, 308, 1, 0, 'Регион,РегионПлат,РайонТрансферта,РайонТрансфертаПлат', 0, null) ;

CALL ImportField(30801194, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 308, 1, 1, 'КодБюджета', 0, null) ;

CALL ImportField(30801195, 'Получатель', 'DestFacialAccName', 'Получатель', ' ', 0, 308, 1, 0, '', 0, null) ;

CALL ImportField(30801196, 'КЦСР плат.', 'SourceKCSRCode', '', 'SourceKCSR', 0, 308, 1, 0, 'КЦСР,КЦСРПлат', 0, null) ;

CALL ImportField(30801197, 'КВР плат.', 'SOURCEKVRCode', 'КВР плат.', 'SourceKVR', 0, 308, 1, 0, 'КВР,КВРПлат', 0, null) ;

CALL ImportField(30801198, 'КВСР плат.', 'SourceKVSRCode', 'КВСР плат.', 'SourceKVSR', 0, 308, 1, 0, 'КВСР,КВСРПлат', 0, null) ;

CALL ImportField(30801199, 'Код цели', 'SourceTargetCLS', 'Код цели', ' ', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801200, 'Ист. образовния плат.', 'SourceFundsSource', 'Ист. образовния плат.', 'SourceFundsSource', 0, 308, 1, 0, 'ИсточникОбразованияСредств,ИсточникОбразованияСредствПлат', 0, null) ;

CALL ImportField(30801201, 'Тип классфикации получ.', 'DestClsType', 'Тип классфикации получ.', 'DestClsType', 0, 308, 1, 1, 'ТипКлассификацииПолуч', 0, null) ;

CALL ImportField(30801202, 'КЦСР получ.', 'DestKCSRCode', 'КЦСР получ.', 'DestKCSR', 0, 308, 1, 0, 'КЦСРПолуч', 0, null) ;

CALL ImportField(30801203, 'КВР получ.', 'DESTKVRCode', 'КВР получ.', 'DestKVR', 0, 308, 1, 0, 'КВРПолуч', 0, null) ;

CALL ImportField(30801204, 'КВСР получ.', 'DestKVSRCode', 'КВСР получ.', 'DestKVSR', 0, 308, 1, 0, 'КВСРПолуч', 0, null) ;

CALL ImportField(30801205, 'Код цели получ.', 'DestTargetCLS', 'Код цели получ.', ' ', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801206, 'Ист. образовния получ', 'DestFundsSource', 'Ист. образовния получ.', 'DestFundsSource', 0, 308, 1, 0, 'ИсточникОбразованияСредствПолуч', 0, null) ;

CALL ImportField(30801207, 'КД плат. (Ключ)', 'SourceKD', 'КД плат. (Ключ)', 'SOURCEKD', 0, 308, 1, 1, 'КДКлюч,КДКлючПлат', 0, null) ;

CALL ImportField(30801209, 'КД получ. (Ключ)', 'DestKD', 'КД получ. (Ключ)', 'DestKD', 0, 308, 1, 1, 'КДКлючПолуч', 0, null) ;

CALL ImportField(30801210, 'КД получ.', 'DestKDCode', 'КД получ.', 'DestKDValue', 0, 308, 1, 0, 'КодДоходаПолуч', 0, null) ;

CALL ImportField(30801211, 'Кассовый символ', 'PaySymbolCls', 'Кассовый символ', ' ', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801212, 'ИД контр. получ.', 'SourceBudgetPromiseSOID', '', ' ', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801213, 'ИД контр. плат.', 'DestBudgetPromiseSOID', 'ИД контр. плат.', ' ', 0, 308, 1, 1, '', 0, null) ;

CALL ImportField(30801214, 'Код бюджетного ассигнования получ-ля', 'DestBudAllocationClsCode', '', 'DestBudAllocationClsCode', 0, 308, 1, 0, 'КодБюджАссигнованияПолуч', 0, null) ;

CALL ImportField(30801215, 'Код расходного обязательства получ-ля', 'DestPayPromiseClsCode', '', 'DestPayPromiseClsCode', 0, 308, 1, 0, 'КодРасходногоОбязательстваПолуч', 0, null) ;

CALL ImportField(30801216, 'Код бюджетного ассигнования плат.', 'SourceBudAllocationClsCode', '', 'SourceBudAllocationClsCode', 0, 308, 1, 0, 'КодБюджАссигнованияПлат', 0, null) ;

CALL ImportField(30801217, 'Код расходного обязательства плат.', 'SourcePayPromiseClsCode', '', 'SourcePayPromiseClsCode', 0, 308, 1, 0, 'КодРасходногоОбязательстваПлат', 0, null) ;

CALL ImportField(30801218, 'Код субсидии получ-ляКлюч', 'DestSubsidyCls', '', 'DestSubsidyCls', 0, 308, 1, 1, 'КодСубсидииКлючПолуч', 0, null) ;

CALL ImportField(30801219, 'Код субсидии получ-ля', 'DestSubsidyClsCode', '', 'DestSubsidyClsCode', 0, 308, 1, 0, 'КодСубсидииПолуч', 0, null) ;

CALL ImportField(30801220, 'Код субсидии плат.Ключ', 'SourceSubsidyCls', '', 'SourceSubsidyCls', 0, 308, 1, 1, 'КодСубсидииКлюч,КодСубсидииКлючПлат', 0, null) ;

CALL ImportField(30801221, 'Код субсидии плат.', 'SourceSubsidyClsCode', '', 'SourceSubsidyClsCode', 0, 308, 1, 0, 'КодСубсидии,КодСубсидииПлат', 0, null) ;

CALL ImportField(30801222, 'Код бюджетного ассигнования получ-ля (ключ)', 'DestBudAllocationCls', '', 'DestBudAllocationCls', 0, 308, 1, 1, 'КодБюджАссигнованияКлючПолуч', 0, null) ;

CALL ImportField(30801223, 'Код расходного обязательства получ-ля (ключ)', 'DestPayPromiseCls', '', 'DestPayPromiseCls', 0, 308, 1, 1, 'КодРасходногоОбязательстваКлючПолуч', 0, null) ;

CALL ImportField(30801224, 'Код бюджетного ассигнования плат. (ключ)', 'SourceBudAllocationCls', '', 'SourceBudAllocationCls', 0, 308, 1, 1, 'КодБюджАссигнованияКлючПлат', 0, null) ;

CALL ImportField(30801225, 'Код расходного обязательства плат. (ключ)', 'SourcePayPromiseCls', '', 'SourcePayPromiseCls', 0, 308, 1, 1, 'КодРасходногоОбязательстваКлючПлат', 0, null) ;

-- Внутренние платежи, Бюджет(1)
CALL ImportField(30810001, 'Дата проводки', 'ACCEPTDATE', 'Дата проводки', 'AcceptDate', 1, 308, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(30810002, 'Архив', 'ARHIVEDOC', 'Архив', 'ARHIVEDOC', 1, 308, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(30810003, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 308, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(30810004, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Вид учета (старый)', 'BUHPAYMENTCLS', 1, 308, 0, 0, 'БухПроводка', 0, 18968) ;

CALL ImportField(30810005, 'Казн. cчет', 'DESTACCOUNT', 'Казн. cчет', 'DESTACCOUNT', 1, 308, 0, 1, 'СчетПолуч', 0, 18958) ;

CALL ImportField(30810006, '№ док.', 'DOCNUMBER', '№ док.', 'DocumentNumber', 1, 308, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(30810007, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 308, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(30810008, 'Дата документа', 'DOCUMENTDATE', 'Дата документа', 'DocumentDate', 1, 308, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(30810009, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', ' ', 1, 308, 0, 0, '', 0, null) ;

CALL ImportField(30810010, 'Федеральные cредства', 'FEDERALFUNDSREF', 'Федеральные cредства', 'FEDERALFUNDSREF', 1, 308, 0, 1, 'ФедеральныеСредства', 0, 19004) ;

CALL ImportField(30810011, 'Код документа', 'ID', 'Код документа', 'ID', 1, 308, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(30810012, 'Назначение платежа(Информация о платеже)', 'NOTE', 'Назначение платежа', 'NOTE', 1, 308, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(30810013, 'Направление операции', 'OperationDirection', 'Направление операции', 'OPERATIONDIRECTION', 1, 308, 0, 0, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(30810014, 'Код реестра', 'REESTR_REF', 'Код реестра', 'Reestr_Ref', 1, 308, 0, 1, 'КодРеестра', 0, 18971) ;

CALL ImportField(30810015, 'Номер реестра', 'REESTRNUMBER', 'Номер реестра', 'ReestrNumber', 1, 308, 0, 0, 'НомерРеестра', 0, 19090) ;

CALL ImportField(30810016, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 308, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(30810017, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (комментарий)', 'RejectCause', 1, 308, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(30810018, 'Казн. cчет (Мастер)', 'SOURCEACCOUNT', 'Казн. cчет (Мастер)', 'SOURCEACCOUNT', 1, 308, 0, 1, 'СчетПлат,РСФО', 0, 18956) ;

CALL ImportField(30810019, 'Казн. cчет', 'SourceAccountName', 'Казн. cчет', ' ', 1, 308, 0, 0, '', 0, 17112) ;

CALL ImportField(30810020, 'Л/с плательщика', 'SOURCEFACIALACC_CLS', 'Л/с плательщика', 'SourceFacialAccCls', 1, 308, 0, 0, 'ЛицевойСчет,ЛицСчетПлательщика', 0, 18957) ;

CALL ImportField(30810021, 'Л/С плательщика в ФК', 'SourceFACIALCODE', 'Л/С плательщика в ФК', ' ', 1, 308, 0, 0, '', 0, null) ;

CALL ImportField(30810022, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 308, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(30810023, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 1, 308, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(30810024, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 1, 308, 0, 1, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(30810056, 'Принятие реестра', 'Accepted', 'Признак принятости реестра', 'Accepted', 1, 308, 0, 1, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(30810057, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'ProgIndex', 1, 308, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(30810058, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 308, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(30810059, 'Отдел', 'DepartmentCLS', '', 'DEPARTMENTCLS', 1, 308, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(30810060, 'Номер л/с плательщика', 'SourceFacialCodeEx', '', ' ', 1, 308, 0, 0, '', 0, 26617) ;

CALL ImportField(30810061, 'Дата заявки', 'BidDate', '', 'BidDate', 1, 308, 0, 0, 'ДатаЗаявки', 0, 24730) ;

CALL ImportField(30810062, 'Номер заявки', 'BidNumber', '', 'BidNumber', 1, 308, 0, 0, 'НомерЗаявки', 0, 18993) ;

CALL ImportField(30810063, 'Тип классификации', 'ClsType', '', ' ', 1, 308, 0, 1, 'ТипКлассификацииПлат', 0, 19008) ;

CALL ImportField(30810064, 'Л/с получателя ', 'DESTFACIALACC_CLS', 'л/с получателя(заголовок)', 'DestFacialAccCls', 1, 308, 0, 0, 'ЛицСчетПолучЗаголовок', 0, 18959) ;

CALL ImportField(30810065, 'НДС(Информация о платеже)', 'NDS', '', 'NDS', 1, 308, 0, 0, 'НДС', 0, 18990) ;

CALL ImportField(30810066, 'Информация о платеже', 'PayNote', '', ' ', 1, 308, 0, 0, '', 0, null) ;

CALL ImportField(30810067, 'Классификация документа', 'DocumentCls', '', ' ', 1, 308, 0, 0, '', 0, null) ;

CALL ImportField(30810068, 'Номер л/с получателя', 'DestFacialCodeEx', '', ' ', 1, 308, 0, 0, '', 0, 26617) ;

CALL ImportField(30811001, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 308, 1, 1, 'КодБюджета', 0, 18872) ;

CALL ImportField(30811002, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 308, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(30811003, 'Тип классификации плательщика', 'ClsType', 'Тип классификации плат.', 'ClsType', 1, 308, 1, 1, 'ТипКлассификации,ТипКлассификацииПлат', 0, 18922) ;

CALL ImportField(30811004, 'Вн. номер БО получателя', 'DESTBUDGETPROMISE', 'Вн. номер БО получателя', 'DestBUDGETPROMISE', 1, 308, 1, 1, 'ДоговораБОПолуч', 0, 18909) ;

CALL ImportField(30811005, '№ бюдж. обязат-ва получателя', 'DestBudgetPromiseCollaps', '№ бюдж. обязат-ва получателя', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811006, 'Номер БО(№ бюдж. обязат-ва получателя)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(№ бюдж. обязат-ва получателя)', ' ', 1, 308, 1, 0, 'ДоговораБОПолучНомер', 0, 20223) ;

CALL ImportField(30811007, 'Тип классификации получателя', 'DestClsType', 'Тип классификации получ-ля', 'DestClsType', 1, 308, 1, 1, 'ТипКлассификацииПолуч', 0, 25179) ;

CALL ImportField(30811010, 'Тип документа получателя', 'DestDocType', 'Тип документа получ-ля', 'DestDOCTYPECLS', 1, 308, 1, 0, 'ТипДокументаПолуч', 0, 18903) ;

CALL ImportField(30811011, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Номер Д.И. получателя ссылка', 'DestExecDoc', 1, 308, 1, 1, 'ДокИсполненияПолуч', 0, 18918) ;

CALL ImportField(30811012, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811013, 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 1, 308, 1, 0, 'ДокИсполненияПолучНомер', 0, 19739) ;

CALL ImportField(30811014, 'Л/с получателя', 'DESTFACIALACC_CLS', 'Л/с получателя', 'DestFacialAccCls', 1, 308, 1, 1, 'ЛицСчетПолучателя', 0, 18869) ;

CALL ImportField(30811015, 'Л/С получателя в ФК', 'destfacialcode', 'Л/С получателя в ФК', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811017, 'Источник фин-я получателя', 'DestFinSource', 'Источник фин-я получ-ля', 'DestFINSOURCECLS', 1, 308, 1, 0, 'ИсточникФинансированияПолуч', 0, 18901) ;

CALL ImportField(30811020, 'Вид дохода получателя(Классификация получателя)', 'DestKD_DescriptionCode', 'Вид дохода получ-ля(Классификация получ-ля)', ' ', 1, 308, 1, 0, '', 0, 16831) ;

CALL ImportField(30811021, 'ЭКД получателя(Классификация получателя)', 'DestKD_KESR', 'ЭКД получ-ля(Классификация получ-ля)', ' ', 1, 308, 1, 0, '', 0, 16835) ;

CALL ImportField(30811023, 'Подвид дохода получателя(Классификация получателя)', 'DestKD_Program', 'Подвид дохода получ-ля(Классификация получ-ля)', ' ', 1, 308, 1, 0, '', 0, 16834) ;

CALL ImportField(30811024, 'Тип средств получателя', 'DestMeansType', 'Тип средств получ-ля', 'DestMEANSTYPECLS', 1, 308, 1, 0, 'ТипСредствПолуч', 0, 18900) ;

CALL ImportField(30811025, '№ БО получателя', 'DESTPROMISE', '№ БО получателя', 'DestPROMISE', 1, 308, 1, 0, 'БюджОбязПолуч', 0, 18906) ;

CALL ImportField(30811026, 'Район трансферта получателя', 'DestRegionCls', 'Район получ-ля', 'DESTREGIONCLS', 1, 308, 1, 1, 'РегионПолуч,РайонТрансфертаПолуч', 0, 18928) ;

CALL ImportField(30811027, 'Суб КОСГУ получателя', 'DestSubKESR', 'Суб КЭСР получ-ля', 'DestSUBKESR', 1, 308, 1, 0, 'СубКЭСРПолуч', 0, 18898) ;

CALL ImportField(30811028, 'Код записи', 'ID', 'Код записи', 'Id', 1, 308, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(30811029, '№ мем. ордера', 'MEMORDERNUM', '№ мем. ордера', 'MemOrderNum', 1, 308, 1, 1, 'НомерМемордера', 0, 18875) ;

CALL ImportField(30811030, 'Примечание', 'NOTE', 'Назначение платежа', 'NOTE', 1, 308, 1, 1, 'ПримечаниеДеталь', 0, 18876) ;

CALL ImportField(30811031, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 308, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(30811032, 'Вн. номер БО плательщика', 'SOURCEBUDGETPROMISE', 'Вн. номер БО плательщика', 'SourceBUDGETPROMISE', 1, 308, 1, 1, 'БОВнутрНомер,ДоговораБО,ДоговораБОПлат', 0, 18908) ;

CALL ImportField(30811033, '№ бюдж. обязат-ва плательщика', 'SourceBudgetPromiseCollaps', '№ бюдж. обязат-ва плательщика', ' ', 1, 308, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(30811034, 'Номер БО(№ бюдж. обязат-ва плательщика)', 'SOURCEBUDGETPROMISENUM', 'Номер БО плательщика(№ бюдж. обязат-ва плательщика)', ' ', 1, 308, 1, 0, 'БОНомер,ДоговораБОНомер,ДоговораБОПлатНомер', 0, 20223) ;

CALL ImportField(30811037, 'Тип документа плательщика', 'SourceDocType', 'Тип документа плат.', 'SourceDOCTYPECLS', 1, 308, 1, 0, 'ТипДокумента,ТипДокументаПлат', 0, 18894) ;

CALL ImportField(30811038, 'Номер Д.И. плательщика ссылка', 'SourceExecDoc', 'Номер Д.И. плательщика ссылка', 'SourceExecDoc', 1, 308, 1, 1, 'ДокИсполнения,ДокИсполненияПлат', 0, 18917) ;

CALL ImportField(30811039, 'Док. исполнения плательщика', 'SourceExecDocCollaps', 'Док. исполнения плательщика', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811040, 'Номер(Док. исполнения плательщика)', 'SourceExecDocNum', 'Номер(Док. исполнения плательщика)', 'SourceExecDocNum', 1, 308, 1, 0, 'ДокИсполненияНомер,ДокИсполненияПлатНомер', 0, 19739) ;

CALL ImportField(30811042, 'Источник фин-я плательщика', 'SourceFinSource', 'Источник фин-я плат.', 'SourceFINSOURCECLS', 1, 308, 1, 0, 'ИсточникФинансирования,ИсточникФинансированияПлат', 0, 18892) ;

CALL ImportField(30811044, 'КЦСР плательщикаКлюч', 'SourceKCSR', 'КЦСР плат.Ключ', 'SourceKCSRKey', 1, 308, 1, 1, 'КЦСРКлюч,КЦСРКлючПлат', 0, 18887) ;

CALL ImportField(30811045, 'ЭКР плательщика(Классификация плательщика)', 'SOURCEKESR', 'КЭСР плат.(Классификация плат.)', 'SourceKESR', 1, 308, 1, 0, 'КЭСР,КЭСРПлат', 0, 18868) ;

CALL ImportField(30811046, 'ФКР плательщика(Классификация плательщика)', 'SourceKFSR', 'КФСР плат.(Классификация плат.)', 'SourceKFSR', 1, 308, 1, 0, 'КФСР,КФСРПлат', 0, 18888) ;

CALL ImportField(30811047, 'КВР плательщикаКлюч', 'SOURCEKVR', 'КВР плат.Ключ', 'SourceKVRKey', 1, 308, 1, 1, 'КВРКлюч,КВРКлючПлат', 0, 18867) ;

CALL ImportField(30811048, 'КВСР плательщикаКлюч', 'SourceKVSR', 'КВСР плат.Ключ', 'SourceKVSRKey', 1, 308, 1, 1, 'КВСРКлюч,КВСРКлючПлат', 0, 18886) ;

CALL ImportField(30811049, 'Тип средств плательщика', 'SourceMeansType', 'Тип средств плат.', 'SourceMEANSTYPECLS', 1, 308, 1, 0, 'ТипСредств,ТипСредствПлат', 0, 18891) ;

CALL ImportField(30811050, '№ БО плательщика', 'SOURCEPROMISE', '№ БО плательщика', 'SourcePROMISE', 1, 308, 1, 0, 'БюджОбяз,БюджОбязПлат', 0, 18905) ;

CALL ImportField(30811051, 'Район трансферта плательщика', 'SourceRegionCls', 'Район плат.', 'SOURCEREGIONCLS', 1, 308, 1, 1, 'Регион,РегионПлат,РайонТрансферта,РайонТрансфертаПлат', 0, 18927) ;

CALL ImportField(30811052, 'Суб КОСГУ плательщика', 'SourceSubKESR', 'Суб КЭСР плат.', 'SourceSUBKESR', 1, 308, 1, 0, 'СубКЭСР,СубКЭСРПлат', 0, 18889) ;

CALL ImportField(30811053, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 308, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(30811054, 'Классификация плательщика', 'TreeOwner0', 'Классификация плат.', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811055, 'Классификация получателя', 'TreeOwner1', 'Классификация получ-ля', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811056, 'Источник образования получателя', 'DestFundsSource', 'Источник образования получ-ля', 'DestFundsSource', 1, 308, 1, 0, 'ИсточникОбразованияСредствПолуч', 0, 18929) ;

CALL ImportField(30811057, 'Источник образования плательщика', 'SourceFundsSource', 'Источник образования плат.', 'SourceFundsSource', 1, 308, 1, 0, 'ИсточникОбразованияСредств,ИсточникОбразованияСредствПлат', 0, 18930) ;

CALL ImportField(30811058, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'ProgIndex', 1, 308, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(30811063, 'Код целевых средствКлюч получ', 'DestTransfertCls', '', 'DestTransfertCls', 1, 308, 1, 1, 'КодЦелевыхСредствКлючПолуч', 0, 18936) ;

CALL ImportField(30811065, 'Код целевых средствКлюч плат', 'SourceTransfertCls', '', 'SourceTransfertCls', 1, 308, 1, 1, 'КодЦелевыхСредствКлюч,КодЦелевыхСредствКлючПлат', 0, 18935) ;

CALL ImportField(30811067, 'КЦСР получателяКлюч', 'DestKCSR', '', 'DestKCSRKey', 1, 308, 1, 1, 'КЦСРКлючПолуч', 0, 18896) ;

CALL ImportField(30811069, 'ЭКР получателя(Классификация получателя)', 'DESTKESR', '', 'DestKESR', 1, 308, 1, 0, 'КЭСРПолуч', 0, 18871) ;

CALL ImportField(30811070, 'ФКР получателя(Классификация получателя)', 'DestKFSR', '', 'DestKFSR', 1, 308, 1, 0, 'КФСРПолуч', 0, 18897) ;

CALL ImportField(30811071, 'КВР получателяКлюч', 'DESTKVR', '', 'DestKVRKey', 1, 308, 1, 1, 'КВРКлючПолуч', 0, 18870) ;

CALL ImportField(30811073, 'КВСР получателяКлюч', 'DestKVSR', '', 'DestKVSRKey', 1, 308, 1, 1, 'КВСРКлючПолуч', 0, 18895) ;

CALL ImportField(30811076, 'Вид дохода(Классификация плательщика)', 'SourceKD_DescriptionCode', '', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811077, 'ЭКД(Классификация плательщика)', 'SourceKD_KESR', '', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811078, 'Администратор(Классификация плательщика)', 'SourceKD_KVSRCode', '', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811079, 'Подвид дохода(Классификация плательщика)', 'SourceKD_Program', '', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811080, 'Номер л/с получателя', 'DestFacialCodeEx', '', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811081, 'Код субсидии получателяКлюч', 'DestSubsidyCls', '', 'DestSubsidyCls', 1, 308, 1, 1, 'КодСубсидииКлючПолуч', 0, 26624) ;

CALL ImportField(30811083, 'Код субсидии плательщикаКлюч', 'SourceSubsidyCls', '', 'SourceSubsidyCls', 1, 308, 1, 1, 'КодСубсидииКлюч,КодСубсидииКлючПлат', 0, 26626) ;

CALL ImportField(30811089, 'Код бюджетного ассигнования получателяКлюч', 'DestBudAllocationCls', '', 'DestBudAllocationCls', 1, 308, 1, 1, 'КодБюджАссигнованияКлючПолуч', 0, 27842) ;

CALL ImportField(30811090, 'Код расходного обязательства получателяКлюч', 'DestPayPromiseCls', '', 'DestPayPromiseCls', 1, 308, 1, 1, 'КодРасходногоОбязательстваКлючПолуч', 0, 27843) ;

CALL ImportField(30811091, 'Код бюджетного ассигнования плательщикаКлюч', 'SourceBudAllocationCls', '', 'SourceBudAllocationCls', 1, 308, 1, 1, 'КодБюджАссигнованияКлюч,КодБюджАссигнованияКлючПлат', 0, 27844) ;

CALL ImportField(30811092, 'Код расходного обязательства плательщикаКлюч', 'SourcePayPromiseCls', '', 'SourcePayPromiseCls', 1, 308, 1, 1, 'КодРасходногоОбязательстваКлюч,КодРасходногоОбязательстваКлючПлат', 0, 27845) ;

CALL ImportField(30811093, 'Код дохода получ-ля', 'DestKD_Value', 'Код дохода получ-ля', 'DestKDValue', 1, 308, 1, 1, 'КодДоходаПолуч', 0, 16836) ;

CALL ImportField(30811094, 'Источниковая классификация', 'DestIFS', '', 'DestIFS', 1, 308, 1, 1, 'ИсточникВнутрФинансированияКлючПолуч', 0, 18921) ;

CALL ImportField(30811095, 'Вид источника(Классификация получателя)', 'DestIFS_DescriptionCode', '', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811096, 'ЭКИ(Классификация получателя)', 'DestIFS_KESR', '', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811097, 'Администратор(Классификация получателя)', 'DestIFS_KVSRCode', '', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811098, 'Источниковая классификация', 'SourceIFS', '', 'SourceIFS', 1, 308, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПлат', 0, 18920) ;

CALL ImportField(30811099, 'Вид источника(Классификация плательщика)', 'SourceIFS_DescriptionCode', '', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811100, 'ЭКИ(Классификация плательщика)', 'SourceIFS_KESR', '', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811101, 'Администратор(Классификация плательщика)', 'SourceIFS_KVSRCode', '', ' ', 1, 308, 1, 0, '', 0, null) ;

-- Перечисление на счета наличности, УРМ(0)
CALL ImportField(31100072, 'Код документа', 'ID', 'Код документа', 'ID', 0, 311, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(31101034, 'Код документа', 'RECORDINDEX', 'Ссылка на заголовок', 'RECORDINDEX', 0, 311, 1, 1, 'КодДокумента', 0, null) ;

-- Перечисление на счета наличности, Бюджет(1)
CALL ImportField(31110001, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 311, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(31110002, '№ п/п', 'DOCNUMBER', '№ п/п', 'DocumentNumber', 1, 311, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(31110003, 'Номер реестра', 'REESTRNUMBER', 'Номер реестра', 'REESTRNUMBER', 1, 311, 0, 0, 'НомерРеестра', 0, 19090) ;

CALL ImportField(31110004, 'Ссылка на казн. cчет', 'SOURCEACCOUNT', 'Ссылка на казн. cчет', 'SOURCEACCOUNT', 1, 311, 0, 1, 'РСФО,СчетПлат', 0, 18956) ;

CALL ImportField(31110006, 'Ссылка на счет района', 'DESTACCOUNT', 'Ссылка на счет района', 'DESTACCOUNT', 1, 311, 0, 1, 'СчетПолуч', 0, 18958) ;

CALL ImportField(31110007, 'Л/с средств в пути', 'DESTFACIALACC_CLS', 'Л/с средств в пути', 'DestFacialAccCls', 1, 311, 0, 0, 'ЛицСчетПолучателя', 0, 18959) ;

CALL ImportField(31110008, 'Дата п/п', 'DOCUMENTDATE', 'Дата п/п', 'DOCUMENTDATE', 1, 311, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(31110009, 'Срок платежа', 'PAYDATE', 'Срок платежа', 'PAYDATE', 1, 311, 0, 0, 'СрокПлатежа', 0, 18951) ;

CALL ImportField(31110010, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 311, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(31110011, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (комментарий)', 'REJECTCAUSE', 1, 311, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(31110012, 'Дата проводки', 'ACCEPTDATE', 'Дата проводки', 'ACCEPTDATE', 1, 311, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(31110013, 'Архив', 'ARHIVEDOC', 'Архив', 'ARHIVEDOC', 1, 311, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(31110015, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 1, 311, 0, 0, 'ВидПлатежа', 0, 18963) ;

CALL ImportField(31110016, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 311, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(31110018, 'Очередность', 'PAYPRIORITY', 'Очередность', 'PAYPRIORITY', 1, 311, 0, 0, 'Очередность', 0, 18966) ;

CALL ImportField(31110019, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 1, 311, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(31110020, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', 'BUHPAYMENTCLS', 1, 311, 0, 0, 'БухПроводка', 0, 18968) ;

CALL ImportField(31110021, 'Казн. счет плательщика', 'SourceAccountName', 'Казн. счет плательщика', 'SourceAccountName', 1, 311, 0, 0, '', 0, 17112) ;

CALL ImportField(31110022, 'Казн. счет получателя', 'DestAccountName', 'Казн. счет получателя', 'DestAccountName', 1, 311, 0, 0, '', 0, 17112) ;

CALL ImportField(31110023, 'Признак принятости реестра', 'ACCEPTED', 'Признак принятости реестра', 'ACCEPTED', 1, 311, 0, 1, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(31110024, 'Код отправителя документа', 'SENDERID', 'Код удаленного клиента', 'SENDERID', 1, 311, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(31110025, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 1, 311, 0, 1, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(31110028, 'Ссылка на реестр фед. средств', 'FEDERALFUNDSREF', 'Ссылка на реестр федеральных средств', ' ', 1, 311, 0, 1, '', 0, null) ;

CALL ImportField(31110030, 'Плательщик', 'SourceFacial_accName', 'Плательщик', 'SourceFacialAccClsName', 1, 311, 0, 1, '', 0, null) ;

CALL ImportField(31110032, 'Счет', 'ACC', 'Счет', ' ', 1, 311, 0, 1, '', 0, null) ;

CALL ImportField(31110033, 'Получатель', '', 'Получатель', 'DestOrgNAME', 1, 311, 0, 1, '', 1, null) ;

CALL ImportField(31110034, 'ИНН получателя', '', 'ИНН получателя', 'DestOrgINN', 1, 311, 0, 1, '', 1, null) ;

CALL ImportField(31110035, 'КПП', '', 'КПП', 'DestOrgKPP', 1, 311, 0, 1, '', 1, null) ;

CALL ImportField(31110050, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 311, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(31110060, 'Направление операции', 'OperationDirection', 'Направление операции', 'OPERATIONDIRECTION', 1, 311, 0, 0, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(31110061, 'Информация для налогового платежа', 'TaxNote', 'Информация для налогового платежа', 'TAXNOTE', 1, 311, 0, 0, 'ИнформацияОНалоге', 0, 18991) ;

CALL ImportField(31110062, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 1, 311, 0, 0, 'ТипКлассификацииЗаголовок', 0, 19008) ;

CALL ImportField(31110064, 'Код документа', 'ID', 'Код документа', 'ID', 1, 311, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(31110065, 'Код реестра', 'REESTR_REF', 'Код реестра', 'Reestr_Ref', 1, 311, 0, 1, 'КодРеестра', 0, 18971) ;

CALL ImportField(31110066, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 311, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(31110070, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 311, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(31110071, 'Код УРМ документа', 'SENDERRECORDID', 'Код УРМ документа', 'SenderRecordID', 1, 311, 0, 1, 'КодУРМДокумента', 0, 18970) ;

CALL ImportField(31110072, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'ProgIndex', 1, 311, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(31110073, 'Статус', 'Status', 'Статус', ' ', 1, 311, 0, 1, 'Статус', 0, 17233) ;

CALL ImportField(31110074, 'Отдел', 'DepartmentCLS', '', 'DEPARTMENTCLS', 1, 311, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(31111001, 'Код записи', 'ID', 'Код записи', 'ID', 1, 311, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(31111002, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 311, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(31111003, 'Лицевой счет учреждения', 'SOURCEFACIALACC_CLS', 'Лицевой счет участника операции', 'SourceFacialAccCls', 1, 311, 1, 0, 'ЛицевойСчет', 0, 18866) ;

CALL ImportField(31111004, 'КВРКлюч', 'SOURCEKVR', 'КВР', 'SOURCEKVRKey', 1, 311, 1, 1, 'КВРКлюч', 0, 18867) ;

CALL ImportField(31111005, 'ЭКР(Классификация)', 'SOURCEKESR', 'КЭСР', 'SOURCEKESR', 1, 311, 1, 0, 'КЭСР', 0, 18868) ;

CALL ImportField(31111006, 'ФКР(Классификация)', 'SourceKFSR', 'КФСР', 'SourceKFSR', 1, 311, 1, 0, 'КФСР', 0, 18888) ;

CALL ImportField(31111007, 'КЦСРКлюч', 'SourceKCSR', 'КЦСР', 'SourceKCSRKey', 1, 311, 1, 1, 'КЦСРКлюч', 0, 18887) ;

CALL ImportField(31111008, 'КВСРКлюч', 'SourceKVSR', 'КВСР', 'SourceKVSRKey', 1, 311, 1, 1, 'КВСРКлюч', 0, 18886) ;

CALL ImportField(31111009, 'Суб КОСГУ', 'SourceSubKESR', 'Суб КЭСР', 'SourceSubKESR', 1, 311, 1, 0, 'СубКЭСР', 0, 18889) ;

CALL ImportField(31111012, 'Тип средств', 'SourceMeansType', 'Тип средств', 'SourceMeansTypeCls', 1, 311, 1, 0, 'ТипСредств', 0, 18891) ;

CALL ImportField(31111014, 'Тип документа', 'SourceDocType', 'Тип документа', 'SourceDocTypeCls', 1, 311, 1, 0, 'ТипДокумента', 0, 18894) ;

CALL ImportField(31111015, 'Источник финансирования', 'SourceFinSource', 'Источник финансирования', 'SourceFinSourceCls', 1, 311, 1, 0, 'ИсточникФинансирования', 0, 18892) ;

CALL ImportField(31111016, 'Лицевой счет', 'DESTFACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 311, 1, 1, 'ЛицСчетПолучателя', 0, 18869) ;

CALL ImportField(31111017, 'КВР получателя', 'DESTKVR', 'КВР получателя', 'DESTKVRKey', 1, 311, 1, 1, 'КВРКлючПолуч', 0, 18870) ;

CALL ImportField(31111018, 'КЭСР получателя', 'DESTKESR', 'КЭСР получателя', 'DESTKESR', 1, 311, 1, 1, 'КЭСРПолуч', 0, 18871) ;

CALL ImportField(31111019, 'КФСР получателя', 'DestKFSR', 'КФСР получателя', 'DestKFSR', 1, 311, 1, 1, 'КФСРПолуч', 0, 18897) ;

CALL ImportField(31111020, 'КЦСР получателя', 'DestKCSR', 'КЦСР получателя', 'DestKCSRKey', 1, 311, 1, 1, 'КЦСРКлючПолуч', 0, 18896) ;

CALL ImportField(31111021, 'КВСР получателя', 'DestKVSR', 'КВСР получателя', 'DestKVSRKey', 1, 311, 1, 1, 'КВСРКлючПолуч', 0, 18895) ;

CALL ImportField(31111022, 'Суб КЭСР получателя', 'DestSubKESR', 'Суб КЭСР получателя', 'DestSubKESR', 1, 311, 1, 1, 'СубКЭСРПолуч', 0, 18898) ;

CALL ImportField(31111025, 'Тип средств получателя', 'DestMeansType', 'Тип средств получателя', 'DestMeansTypeCls', 1, 311, 1, 1, 'ТипСредствПолуч', 0, 18900) ;

CALL ImportField(31111027, 'Тип документа получателя', 'DestDocType', 'Тип документа получателя', 'DestDocTypeCls', 1, 311, 1, 1, 'ТипДокументаПолуч', 0, 18903) ;

CALL ImportField(31111028, 'Источник финансирования получателя', 'DestFinSource', 'Источник финансирования получателя', 'DestFinSourceCls', 1, 311, 1, 1, 'ИсточникФинансированияПолуч', 0, 18901) ;

CALL ImportField(31111030, 'Назначение платежа', ' ', 'Назначение платежа', 'NOTE', 1, 311, 1, 1, '', 1, null) ;

CALL ImportField(31111032, '№ бюдж. обязат-ва', 'Promise', '№ бюдж. обязат-ва', 'PROMISE', 1, 311, 1, 1, 'БюджОбяз', 0, 18885) ;

CALL ImportField(31111033, 'Код документа', 'RECORDINDEX', 'Ссылка на заголовок', 'RECORDINDEX', 1, 311, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(31111035, 'Л/С плательщика в ФК', 'sourceFacialCode', 'Л/С плательщика в ФК', ' ', 1, 311, 1, 1, '', 0, null) ;

CALL ImportField(31111036, '№ БО плательщика', 'SOURCEPROMISE', '№ БО плательщика', 'SOURCEPROMISE', 1, 311, 1, 0, 'БюджОбяз', 0, 18905) ;

CALL ImportField(31111037, '№ БО получателя', 'DESTPROMISE', '№ БО получателя', 'DESTPROMISE', 1, 311, 1, 1, '', 0, null) ;

CALL ImportField(31111038, 'Номер БО(№ бюдж. обязат-ва плательщика)', 'SOURCEBUDGETPROMISENUM', 'Номер БО плательщика(договора)', 'SOURCEBUDGETPROMISENUM', 1, 311, 1, 0, 'ДоговораБОНомер', 0, 20223) ;

CALL ImportField(31111039, 'Вн. номер БО плательщика', 'SOURCEBUDGETPROMISE', 'Вн. номер БО плательщика', 'SOURCEBUDGETPROMISE', 1, 311, 1, 1, 'ДоговораБО', 0, 18908) ;

CALL ImportField(31111040, 'Номер БО получателя(договора)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', 'DESTBUDGETPROMISENUM', 1, 311, 1, 1, '', 0, null) ;

CALL ImportField(31111041, 'Вн. номер БО получателя', 'DESTBUDGETPROMISE', 'Вн. номер БО получателя', 'DESTBUDGETPROMISE', 1, 311, 1, 1, 'DESTBUDGETPROMISE', 0, null) ;

CALL ImportField(31111044, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 311, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(31111049, 'Классификация', 'TreeOwner0', 'Классификация(группа)', ' ', 1, 311, 1, 0, '', 0, null) ;

CALL ImportField(31111052, 'Вид источника(Классификация)', 'SourceIFS_DescriptionCode', 'Вид источника(ИВнФ)', ' ', 1, 311, 1, 0, '', 0, 17050) ;

CALL ImportField(31111053, 'ЭКИ(Классификация)', 'SourceIFS_KESR', 'ЭКИ', ' ', 1, 311, 1, 0, '', 0, 17054) ;

CALL ImportField(31111055, 'Вид дохода(Классификация)', 'SourceKD_DescriptionCode', 'Вид дохода', ' ', 1, 311, 1, 0, '', 0, 16831) ;

CALL ImportField(31111056, 'Подвид дохода(Классификация)', 'SourceKD_Program', 'Подвид дохода(КД)', ' ', 1, 311, 1, 0, '', 0, 16834) ;

CALL ImportField(31111057, 'ЭКД(Классификация)', 'SourceKD_KESR', 'ЭКД', ' ', 1, 311, 1, 0, '', 0, 16835) ;

CALL ImportField(31111058, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'ClsType', 1, 311, 1, 1, 'ТипКлассификации', 0, 18922) ;

CALL ImportField(31111059, 'Район трансферта', 'SourceRegionCls', 'Район', 'SOURCEREGIONCLS', 1, 311, 1, 1, 'Регион,РайонТрансферта', 0, 18927) ;

CALL ImportField(31111063, 'Источник образования', 'SourceFundsSource', 'Источник образования', ' ', 1, 311, 1, 0, 'ИсточникОбразованияСредств', 0, 18930) ;

CALL ImportField(31111067, 'Источниковая классификация', 'SourceIFS', 'Источниковая классификация', 'SourceIFS', 1, 311, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 18920) ;

CALL ImportField(31111068, 'Код дохода', 'SourceKD', 'Код дохода', 'SOURCEKD', 1, 311, 1, 1, 'КДКлюч', 0, 18925) ;

CALL ImportField(31111069, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 311, 1, 1, '', 0, 18872) ;

CALL ImportField(31111072, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 311, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(31111073, 'Код дохода', 'SourceKD_Value', 'Код дохода', 'SOURCEKDVALUE', 1, 311, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(31111074, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'ProgIndex', 1, 311, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(31111075, 'Код целевых средствКлюч', 'SourceTransfertCls', 'Код целевых средств (ссылка)', 'SourceTransfertCls', 1, 311, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18935) ;

CALL ImportField(31111076, 'Код целевых средств получателя(Ключ)', 'DestTransfertCls', 'Код целевых средств получателя (ссылка)', 'DestTransfertCls', 1, 311, 1, 1, 'КодЦелевыхСредствКлючПолуч', 0, null) ;

CALL ImportField(31111077, 'Код целевых средств получателя', 'DestTransfertClsCode', 'Код целевых средств получателя', 'DestTransfertClsValue', 1, 311, 1, 1, 'КодЦелевыхСредствПолуч', 0, null) ;

CALL ImportField(31111084, '№ бюдж. обязат-ва плательщика', 'SourceBudgetPromiseCollaps', '№ бюдж. обязат-ва плательщика', ' ', 1, 311, 1, 0, '', 0, null) ;

CALL ImportField(31111085, 'Док. исполнения плательщика', 'SourceExecDocCollaps', 'Док. исполнения плательщика', ' ', 1, 311, 1, 0, '', 0, null) ;

CALL ImportField(31111086, 'Номер(Док. исполнения плательщика)', 'SourceExecDocNum', 'Номер(Док. исполнения плательщика)', 'SourceExecDocNum', 1, 311, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(31111087, 'Номер Д.И. плательщика ссылка', 'SourceExecDoc', '', 'SourceExecDoc', 1, 311, 1, 1, 'ДокИсполнения', 0, 18917) ;

CALL ImportField(31111088, 'Код субсидииКлюч', 'SourceSubsidyCls', 'Код субсидии (ссылка)', 'SourceSubsidyCls', 1, 311, 1, 1, 'КодСубсидииКлюч', 0, 26626) ;

CALL ImportField(31111090, 'Наименование района трансферта', 'SourceRegionClsName', '', ' ', 1, 311, 1, 0, '', 0, null) ;

CALL ImportField(31111093, 'Код бюджетного ассигнованияКлюч', 'SourceBudAllocationCls', '', 'SourceBudAllocationCls', 1, 311, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27844) ;

CALL ImportField(31111094, 'Код расходного обязательстваКлюч', 'SourcePayPromiseCls', '', 'SourcePayPromiseCls', 1, 311, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27845) ;

CALL ImportField(31111095, 'Сумма БО плательщика', '', 'Сумма БО плательщика', 'SourceBudgetPromiseSumma', 1, 311, 1, 1, 'ДоговораБОПлатСумма', 0, null) ;

CALL ImportField(31111096, 'Реестровый номер договора плательщика', '', 'Реестровый номер договора плательщика', 'SourceBudgetPromiseAgrReestrNum', 1, 311, 1, 1, 'ДоговораБОПлатРеестрНомерДоговора', 0, null) ;

CALL ImportField(31111097, 'Дата договора плательщика', '', 'Дата договора плательщика', 'SourceBudgetPromiseAgrDate', 1, 311, 1, 1, 'ДоговораБОПлатДатаДоговора', 0, null) ;

CALL ImportField(31111098, 'Номер договора плательщика', '', 'Номер договора плательщика', 'SourceBudgetPromiseAgrNum', 1, 311, 1, 1, 'ДоговораБОПлатНомерДоговора', 0, null) ;

CALL ImportField(31111099, 'Сумма договора плательщика', '', 'Сумма договора плательщика', 'SourceBudgetPromiseAgrSumma', 1, 311, 1, 1, 'ДоговораБОПлатСуммаДоговора', 0, null) ;

-- Подтверждение перечисления на счета наличности, УРМ(0)
CALL ImportField(31200001, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200002, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 0, 312, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(31200003, 'Причина отклонения', 'Reject_Cls', 'Причина отклонения', 'REJECTCLS', 0, 312, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(31200004, 'Ссылка на Р/С получателя', 'DestAccount', 'Ссылка на Р/С получателя', 'DESTACCOUNT', 0, 312, 0, 1, 'РСФО,СчетПолуч', 0, null) ;

CALL ImportField(31200005, 'Лицевой счет получателя (заголовок)', 'DESTFACIALACC_CLS', 'Лицевой счет получателя', 'DestFacialAccCls', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200006, 'Лицевой счет плательщика(счет в пути)', 'SourceFacialAcc_Cls', 'Лицевой счет плательщика(счет в пути)', 'SourceFacialAccCls', 0, 312, 0, 0, 'ЛицСчетПлательщика', 0, null) ;

CALL ImportField(31200007, 'Номер карточки', 'CardNumber', 'Номер карточки', 'CARDNUMBER', 0, 312, 0, 0, '', 0, null) ;

CALL ImportField(31200008, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 0, 312, 0, 0, 'ВидПлатежа', 0, null) ;

CALL ImportField(31200009, 'Мягкая причина отклонения (комментарий)', 'SoftRejectCause', 'Мягкая причина отклонения (комментарий)', 'SoftRejectCause', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200010, 'Номер документа', 'DocNumber', 'Номер документа', 'DocumentNumber', 0, 312, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(31200011, 'Дата документа', 'DocumentDate', 'Дата документа', 'DocumentDate', 0, 312, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(31200012, 'Срок платежа', 'PAYDATE', 'Срок платежа', 'PayDate', 0, 312, 0, 0, 'СрокПлатежа', 0, null) ;

CALL ImportField(31200013, 'Тип операции', 'TypeOperationCls', 'Тип операции', 'OperationTypeCls', 0, 312, 0, 0, 'ТипОперации', 0, null) ;

CALL ImportField(31200014, 'Ссылка на Р/С плательщика', 'SourceAccount', 'Ссылка на Р/С плательщика', 'SOURCEACCOUNT', 0, 312, 0, 1, 'СчетПлат', 0, null) ;

CALL ImportField(31200015, 'Р/С плательщика (казначейский счет)', 'SourceAccountName', 'Р/С плательщика (казначейский счет)', 'SourceAccountName', 0, 312, 0, 0, '', 0, null) ;

CALL ImportField(31200016, 'Р/С получателя (казначейский счет)', 'DestAccountName', 'Р/С получателя (казначейский счет)', 'DestAccountName', 0, 312, 0, 0, '', 0, null) ;

CALL ImportField(31200017, 'Сумма', 'Summa', 'Сумма', 'Summa', 0, 312, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(31200018, 'Дата реестра', 'ReestrDate', 'Дата реестра', 'REESTRDATE', 0, 312, 0, 0, 'ДатаРеестра', 0, null) ;

CALL ImportField(31200019, 'Очередность платежа', 'PAYPRIORITY', 'Очередность платежа', 'PayPriority', 0, 312, 0, 0, 'Очередность', 0, null) ;

CALL ImportField(31200020, 'Дата принятия документа', 'AcceptDate', 'Дата принятия документа', 'AcceptDate', 0, 312, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(31200021, 'Бух. операция', 'BuhPaymentCls', 'Бух. операция', 'BuhPaymentCls', 0, 312, 0, 0, 'БухПроводка', 0, null) ;

CALL ImportField(31200022, 'Назначение платежа', 'Note', 'Назначение платежа', 'NOTE', 0, 312, 0, 0, 'Примечание', 0, null) ;

CALL ImportField(31200023, 'Код документа', 'ID', 'Код документа', 'ID', 0, 312, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(31200024, 'Код ФО документа', 'FUID', 'Код ФО документа', 'FUID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200025, 'Код УРМ документа', ' ', 'Код УРМ документа', 'SenderRecordID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200026, 'Код отправителя документа', ' ', 'Код отправителя документа', 'SenderID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200027, 'Номер реестра', 'ReestrNumber', 'Номер реестра', 'ReestrNumber', 0, 312, 0, 0, 'НомерРеестра', 0, null) ;

CALL ImportField(31200028, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 312, 0, 1, 'ИндексыДанныхЗаголовок', 0, null) ;

CALL ImportField(31200029, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 312, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(31200030, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200031, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200032, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200033, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200034, 'Номер заявки', ' ', 'Номер заявки', 'BidNumber', 0, 312, 0, 0, '', 0, null) ;

CALL ImportField(31200035, 'Локальный реестр', ' ', 'Локальный реестр', 'ManagerBid', 0, 312, 0, 0, '', 0, null) ;

CALL ImportField(31200036, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200037, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200040, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200041, 'Код реестра', ' ', 'Код реестра', 'Reestr_Ref', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200042, 'Статус ЭЦП', ' ', 'Статус ЭЦП', 'CRYPTOSTATUS', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200043, 'Отдел', ' ', 'Отдел', 'DEPARTMENTCLS', 0, 312, 0, 0, '', 0, null) ;

CALL ImportField(31200044, 'Ссылка на счет получателя ФО', ' ', 'Ссылка на счет получателя ФО', 'DestAccountFUID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200045, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200046, 'Субсчет получателя', ' ', 'Субсчет получателя', 'DestFKFacialCode', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200047, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200048, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200049, 'ИНН организации-получателя', ' ', 'ИНН организации-получателя', 'DestOrgINN', 0, 312, 0, 0, '', 0, null) ;

CALL ImportField(31200050, 'КПП организации-получателя', ' ', 'КПП организации-получателя', 'DestOrgKPP', 0, 312, 0, 0, '', 0, null) ;

CALL ImportField(31200051, 'Наименование организации-получателя', ' ', 'Наименование организации-получателя', 'DestOrgName', 0, 312, 0, 0, '', 0, null) ;

CALL ImportField(31200052, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200053, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200054, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200055, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200056, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200057, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200058, 'л\с получателя', ' ', 'л\с получателя', 'DestFacialAccClsName', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200059, 'мнемокод л\с получателя', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200060, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200061, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200062, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200063, 'Организация ФК получателя(код)', ' ', 'Организация ФК получателя(код)', 'DestFKOrgId', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200064, 'Организация ФК получателя ФО', ' ', 'Организация ФК получателя ФО', 'DestFKOrgFUID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200065, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200066, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200067, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200068, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200069, 'Ссылка на р/c ФО плательщика', ' ', 'Ссылка на р/c ФО плательщика', 'SourceAccountFUID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200070, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200071, 'Субсчет плательщика', ' ', 'Субсчет плательщика', 'SourceFKFacialCode', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200072, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200073, 'Ссылка на организацию плательщика(для УРМ)', ' ', 'Ссылка на организацию плательщика(для УРМ)', 'SourceOrgFUID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200074, 'ИНН организации-плательщика', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200075, 'КПП организации-плательщика', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200076, 'Наименование организации-плательщика', ' ', 'Наименование организации-плательщика', 'SourceOrgName', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200077, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200078, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200079, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200080, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200081, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200082, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200083, 'л\с плательщика(счет в пути)', ' ', 'л\с плательщика', 'SourceFacialAccClsName', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200084, 'Мнемокод л\с плательщика', ' ', 'Мнемокод л\с плательщика', 'SourceFacialAccClsFacialCode', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200085, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200086, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200087, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200088, 'Организация ФК плательщика(код)', ' ', 'Организация ФК плательщика(код)', 'SourceFKOrgId', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200089, 'Организация ФК ФО плательщика', ' ', 'Организация ФК ФО плательщика', 'SourceFKOrgFUID', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200090, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200091, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200092, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200093, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200115, 'Информация для налогового платежа', 'TaxNote', 'Информация для налогового платежа', 'TaxNote', 0, 312, 0, 1, 'ИнформацияОНалоге', 0, null) ;

CALL ImportField(31200116, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 312, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(31200130, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 0, 312, 0, 0, 'ТипКлассификацииЗаголовок', 0, null) ;

CALL ImportField(31200140, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31200141, 'Направление операции', 'OperationDirection', 'Направление операции', 'OperationDirection', 0, 312, 0, 0, 'НаправлениеОперации', 0, null) ;

CALL ImportField(31200145, 'Лицевой счет получателя в ФК (заг.)', 'DestFacialCode', 'Лицевой счет получателя в ФК', ' ', 0, 312, 0, 1, '', 0, null) ;

CALL ImportField(31201002, 'Лицевой счет получателя в ФК', 'DestFacialCode', 'Лицевой счет получателя в ФК (детализация)', 'DestFacialCode', 0, 312, 1, 0, '', 0, null) ;

CALL ImportField(31201004, 'Суб КЭСР', 'SourceSubKESR', 'Суб КЭСР', 'SOURCESUBKESR', 0, 312, 1, 1, 'СубКЭСРПлат', 0, null) ;

CALL ImportField(31201005, 'Номер БО', 'DestPromise', 'Номер БО', 'DestPromise', 0, 312, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(31201006, 'Номер мем. ордера', 'MemOrderNum', 'Номер мем. ордера', 'MemOrderNum', 0, 312, 1, 0, '', 0, null) ;

CALL ImportField(31201007, 'Примечание (детализация)', 'Note', 'Примечание (детализация)', 'Note', 0, 312, 1, 0, '', 0, null) ;

CALL ImportField(31201008, 'Сумма (детализация)', 'Summa', 'Сумма (детализация)', 'Summa', 0, 312, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(31201010, 'Источник финансирования', 'SourceFinSource', 'Источник финансирования', 'SOURCEFINSOURCECLS', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201011, 'Лицевой счет получателя', 'DestFacialAcc_Cls', 'Лицевой счет получателя (детализация)', 'DestFacialAccCls', 0, 312, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(31201013, 'КВСР плат. (Ключ)', 'SourceKVSR', 'КВСР плательщика', 'SourceKVSRKey', 0, 312, 1, 1, 'КВСРПлат', 0, null) ;

CALL ImportField(31201014, 'КЦСР плательщика', 'SourceKCSR', 'КЦСР плательщика', 'SourceKCSRKey', 0, 312, 1, 1, 'КЦСРПлат', 0, null) ;

CALL ImportField(31201015, 'КФСР', 'SourceKFSR', 'КФСР', 'SourceKFSR', 0, 312, 1, 1, 'КФСРПлат', 0, null) ;

CALL ImportField(31201016, 'КЭСР', 'SourceKESR', 'КЭСР', 'SourceKESR', 0, 312, 1, 1, 'КЭСРПлат', 0, null) ;

CALL ImportField(31201017, 'КВР плательщика', 'SourceKVR', 'КВР плательщика', 'SourceKVRKey', 0, 312, 1, 1, 'КВРПлат', 0, null) ;

CALL ImportField(31201029, 'Ссылка на внутренний номер БО получателя', 'DestBudgetPromise', 'Ссылка на внутренний номер БО получателя', 'Ссылка на внутренний номер БО получателя', 0, 312, 1, 1, 'ДоговораБОПолуч,БОВнутрНомер', 0, null) ;

CALL ImportField(31201030, 'Номер БО получателя(договора)', 'DestBudgetPromiseNum', 'Номер БО получателя(договора)', 'Номер БО получателя', 0, 312, 1, 0, 'ДоговораБОНомер,БОНомер', 0, null) ;

CALL ImportField(31201031, 'Документ исполнения получателя', 'DestExecDocCollaps', 'Документ исполнения получателя', 'Документ исполнения получателя', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201032, 'Ссылка на документ исполнения получателя', 'DestExecDoc', 'Ссылка на документ исполнения получателя', 'Ссылка на документ исполнения получателя', 0, 312, 1, 1, 'ДокИсполнения', 0, null) ;

CALL ImportField(31201033, 'Номер документа исполнения получателя', 'DestExecDocNum', 'Номер документа исполнения получателя', 'Номер документа исполнения получателя', 0, 312, 1, 0, 'ДокИсполненияНомер', 0, null) ;

CALL ImportField(31201034, 'Реестровый номер ДИ получателя', 'DestExecDocReestr', 'Реестровый номер ДИ получателя', 'Реестровый номер ДИ получателя', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201035, 'Дата ДИ получателя', 'DestExecDocDate', 'Дата ДИ получателя', 'Дата ДИ получателя', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201036, 'Тип ДИ получателя', 'DestExecDocType', 'Тип ДИ получателя', 'Тип ДИ получателя', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201037, 'Сумма по ДИ получателя', 'DestExecDocSumma', 'Сумма по ДИ получателя', 'Сумма по ДИ получателя', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201038, 'Примечание ДИ получателя', 'DestExecDocNote', 'Примечание ДИ получателя', 'Примечание ДИ получателя', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201051, 'Бюджетное обязательство получателя', 'DestBudgetPromiseCollaps', 'Бюджетное обязательство получателя', 'DestBudgetPromiseCollaps', 0, 312, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(31201052, 'Сумма БО получателя', 'DestBudgetPromiseSumma', 'Сумма БО получателя', 'DestBudgetPromiseSumma', 0, 312, 1, 1, 'ДоговораБОСумма', 0, null) ;

CALL ImportField(31201053, 'Номер договора получателя', 'DestBudgetPromiseDocNumber', 'Номер договора получателя', 'DestBudgetPromiseDocNumber', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201054, 'Дата договора получателя', 'DestBudgetPromiseDocDate', 'Дата договора получателя', 'DestBudgetPromiseDocDate', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201055, 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201056, 'Реестровый номер дог', 'DestBudgetPromiseDocReestrNum', 'Реестровый номер дог', 'DestBudgetPromiseDocReestrNum', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201057, 'Дог. примечание получателя', 'DestBudgetPromiseDocNote', 'Дог. примечание получателя', 'DestBudgetPromiseDocNote', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201058, 'Номер гос. контракта получателя', 'DestBudgetPromiseSONum', 'Номер гос. контракта получателя', 'DestBudgetPromiseSONum', 0, 312, 1, 1, 'ДоговораБОНомерКонтракта', 0, null) ;

CALL ImportField(31201059, 'Дата гос. контракта получателя', 'DestBudgetPromiseSODate', 'Дата гос. контракта получателя', 'DestBudgetPromiseSODate', 0, 312, 1, 1, 'ДоговораБОДатаКонтракта', 0, null) ;

CALL ImportField(31201060, 'Сумма гос. контракта получателя', 'DestBudgetPromiseSOSumma', 'Сумма гос. контракта получателя', 'DestBudgetPromiseSOSumma', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201061, 'Реестровый номер гос. контр получателя', 'DestBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр получателя', 'DestBudgetPromiseSOReestrNum', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201062, 'Прим. гос. контракта получателя', 'DestBudgetPromiseSONote', 'Прим. гос. контракта получателя', 'DestBudgetPromiseSONote', 0, 312, 1, 1, 'ДоговораБОПримечаниеКонтракта', 0, null) ;

CALL ImportField(31201063, 'Код записи', 'Id', 'Код записи', 'Id', 0, 312, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(31201064, 'Код ФО записи', 'FUID', 'Код ФО записи', 'FUID', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201065, 'Код УРМ записи', ' ', 'Код УРМ записи', 'SenderRecordID', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201066, 'Код отправителя записи', ' ', 'Код отправителя записи', 'SenderID', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201067, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 312, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(31201068, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 312, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(31201069, 'Бух операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 0, 312, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(31201070, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'ClsType', 0, 312, 1, 1, 'ТипКлассификации,ТипКлассификацииПлат', 0, null) ;

CALL ImportField(31201074, 'КВРКлюч', 'DestKVR', 'КВР получателя', 'DestKVRKey', 0, 312, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(31201075, 'КЭСР получателя', 'DestKESR', 'КЭСР получателя', 'DestKESR', 0, 312, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(31201076, 'КВСР (Ключ)', 'DestKVSR', 'КВСР получателя', 'DestKVSRKey', 0, 312, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(31201077, 'КЦСРКлюч', 'DestKCSR', 'КЦСР получателя', 'DestKCSRKey', 0, 312, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(31201078, 'КФСР получателя', 'DestKFSR', 'КФСР получателя', 'DestKFSR', 0, 312, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(31201079, 'СубКЭСР', 'DestSUBKESR', 'СубКЭСР получателя', 'DestSUBKESR', 0, 312, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(31201081, 'Тип средств', 'DestMEANSTYPE', 'Тип средств получателя', 'DestMEANSTYPECLS', 0, 312, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(31201082, 'Источник финансирования получателя', 'DestFINSOURCE', 'Источник финансирования получателя', 'DestFINSOURCECLS', 0, 312, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(31201084, 'Тип документа', ' ', 'Тип документа получателя', 'DestDOCTYPECLS', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201085, 'Источник внутр. и внеш. финанс. (Ключ)', 'DestIFS', 'Классификация', 'DestIFS_DescriptionCode', 0, 312, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, null) ;

CALL ImportField(31201089, 'Тип средств плательщика', 'SourceMEANSTYPE', 'Тип средств плательщика', 'SourceMEANSTYPECLS', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201093, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201102, 'КД (Ключ)', 'DestKD', 'Код дохода', 'DestKDValue', 0, 312, 1, 1, 'КДКлюч', 0, null) ;

CALL ImportField(31201104, 'Район', 'DestRegionCls', 'Район', 'DestRegionCls', 0, 312, 1, 0, 'Регион,РайонТрансферта', 0, null) ;

CALL ImportField(31201113, 'Источник образования', 'DestFundsSource', 'Источник образования', 'DestFundsSource', 0, 312, 1, 1, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(31201114, 'Классификация', 'TreeOwner0', 'Классификация(Группа)', ' ', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201117, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201132, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств получателя (ссылка)', 'DestTransfertCls', 0, 312, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(31201133, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств получателя', 'DestTransfertClsValue', 0, 312, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(31201134, 'КЦСР(Классификация)', 'DestKCSRCode', '', 'DestKCSR', 0, 312, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(31201135, 'КВР(Классификация)', 'DESTKVRCode', '', 'DestKVR', 0, 312, 1, 0, 'КВР', 0, null) ;

CALL ImportField(31201136, 'КВСР', 'DestKVSRCode', 'КВСР', 'DestKVSR', 0, 312, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(31201137, 'КЦСР Плат.(Классификация плат.)', 'SourceKCSRCode', '', 'SourceKCSR', 0, 312, 1, 0, '', 0, null) ;

CALL ImportField(31201138, 'КВР Плат.(Классификация плат.)', 'SourceKVRCode', '', 'SourceKVR', 0, 312, 1, 0, '', 0, null) ;

CALL ImportField(31201139, 'КВСР плат.', 'SourceKVSRCode', 'КВСР плат.', 'SourceKVSR', 0, 312, 1, 0, '', 0, null) ;

CALL ImportField(31201146, 'Источник внутр. и внеш. финанс.', 'DestIFSCode', 'Источник внутр. и внеш. финанс.', 'DestIFS_DescriptionCode', 0, 312, 1, 0, '', 0, null) ;

CALL ImportField(31201147, 'КД', 'DestKDCode', 'КД', 'DestKDValue', 0, 312, 1, 0, '', 0, null) ;

CALL ImportField(31201148, 'ИД контракта', 'DestBudgetPromiseSOID', '', ' ', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201150, 'Район получ.', 'SourceRegionCls', 'Район получ.', ' ', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201152, 'Код субсидииКлюч', 'DestSubsidyCls', 'Код субсидии (ссылка)', 'DestSubsidyCls', 0, 312, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(31201153, 'Код субсидии', 'DestSubsidyClsCode', 'Код субсидии', 'DestSubsidyClsCode', 0, 312, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(31201154, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', ' ', 0, 312, 1, 0, '', 0, null) ;

CALL ImportField(31201155, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', ' ', 0, 312, 1, 0, '', 0, null) ;

CALL ImportField(31201156, 'Код бюджетного ассигнования (ключ)', 'DestBudAllocationCls', '', ' ', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201157, 'Код расходного обязательства (ключ)', 'DestPayPromiseCls', '', ' ', 0, 312, 1, 1, '', 0, null) ;

CALL ImportField(31201158, 'Район бюджетного учреждения', 'RegionBudgetEst', 'Район бюджетного учреждения', 'RegionBudgetEst', 0, 312, 1, 1, '', 0, null) ;

-- Подтверждение перечисления на счета наличности, Бюджет(1)
CALL ImportField(31210003, 'Код ФО документа', ' ', 'Код ФО документа', 'FUID', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210024, 'л\с получателя', ' ', 'л\с получателя', 'DestFacialAccCls', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210026, 'Начальное состояние документа', ' ', 'Начальное состояние документа', 'BeginDocStateRef', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210027, 'Есть в Бюджете', ' ', 'Есть в Бюджете', 'IsInBudget', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210028, 'Признак зависания', ' ', 'Признак зависания', 'DocSuspended', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210030, 'Номер заявки', ' ', 'Номер заявки', 'BidNumber', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210031, 'Локальный реестр', ' ', 'Локальный реестр', 'ManagerBid', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210032, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210033, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210036, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210040, 'Мягкая причина отклонения', ' ', 'Мягкая причина отклонения', 'SoftRejectCls', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210041, 'Текст мягкой причины отклонения', ' ', 'Текст мягкой причины отклонения', 'SoftRejectCause', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210042, 'Ссылка на счет получателя ФО', ' ', 'Ссылка на счет получателя ФО', 'DestAccountFUID', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210044, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210045, 'Субсчет получателя', ' ', 'Субсчет получателя', 'DestFKFacialCode', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210046, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210047, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210048, 'ИНН организации-получателя', ' ', 'ИНН организации-получателя', 'DestOrgINN', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210049, 'КПП организации-получателя', ' ', 'КПП организации-получателя', 'DestOrgKPP', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210050, 'Наименование организации-получателя', ' ', 'Наименование организации-получателя', 'DestOrgName', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210051, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210052, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210053, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210054, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210055, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210056, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210057, 'Имя л\с получателя', ' ', 'Имя л\с получателя', 'DestFacialAccClsName', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210058, 'Мнемокод л\с получателя', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210059, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210060, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210061, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210062, 'Организация ФК получателя(код)', ' ', 'Организация ФК получателя(код)', 'DestFKOrgId', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210063, 'Организация ФК получателя ФО', ' ', 'Организация ФК получателя ФО', 'DestFKOrgFUID', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210064, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210065, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210066, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210067, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210068, 'Ссылка на р/c ФО плательщика', ' ', 'Ссылка на р/c ФО плательщика', 'SourceAccountFUID', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210070, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210071, 'Субсчет плательщика', ' ', 'Субсчет плательщика', 'SourceFKFacialCode', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210072, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210073, 'Ссылка на организацию плательщика(для УРМ)', ' ', 'Ссылка на организацию плательщика(для УРМ)', 'SourceOrgFUID', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210074, 'ИНН организации-плательщика', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210075, 'КПП организации-плательщика', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210076, 'Наименование организации-плательщика', ' ', 'Наименование организации-плательщика', 'SourceOrgName', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210077, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210078, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210079, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210080, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210081, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210082, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210083, 'Имя л\с плательщика(счет в пути)', ' ', 'Имя л\с плательщика(счет в пути)', 'SourceFacialAccClsName', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210084, 'Мнемокод л\с плательщика', ' ', 'Мнемокод л\с плательщика', 'SourceFacialAccClsFacialCode', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210085, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210086, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210087, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210088, 'Организация ФК плательщика(код)', ' ', 'Организация ФК плательщика(код)', 'SourceFKOrgId', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210089, 'Организация ФК ФО плательщика', ' ', 'Организация ФК ФО плательщика', 'SourceFKOrgFUID', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210090, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210091, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210092, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210093, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 1, 312, 0, 1, '', 1, null) ;

CALL ImportField(31210119, 'Электронный документ', 'ElDocRef', 'Электронный документ', ' ', 1, 312, 0, 1, '', 0, null) ;

CALL ImportField(31211002, 'Код ФО записи', ' ', 'Код ФО записи', 'FUID', 1, 312, 1, 1, '', 1, null) ;

CALL ImportField(31211003, 'Код УРМ записи', ' ', 'Код УРМ записи', 'SenderRecordID', 1, 312, 1, 1, '', 1, null) ;

CALL ImportField(31211004, 'Код отправителя записи', ' ', 'Код отправителя записи', 'SenderID', 1, 312, 1, 1, '', 1, null) ;

CALL ImportField(31211029, 'Номер БО плательщика', 'SourcePROMISE', 'Номер БО плательщика', 'SourcePROMISE', 1, 312, 1, 1, 'БюджОбязПлат', 0, null) ;

CALL ImportField(31211030, 'Номер БО плательщика(договора)', 'SourceBudgetPROMISENum', 'Номер БО плательщика(договора)', 'SourceBudgetPROMISENum', 1, 312, 1, 1, '', 0, null) ;

CALL ImportField(31211031, 'Документ исполнения', 'SourceExecDoc', 'Документ исполнения', 'SourceExecDoc', 1, 312, 1, 1, 'ДокИсполненияПлат', 0, null) ;

CALL ImportField(31211032, 'Договора БО плательщика', 'SourceBUDGETPROMISE', 'Договора БО плательщика', 'SourceBUDGETPROMISE', 1, 312, 1, 1, '', 0, null) ;

CALL ImportField(31211033, 'л\с плательщика(счет в пути)', ' ', 'л\с плательщика', 'SourceFacialAccCls', 1, 312, 1, 1, '', 1, null) ;

CALL ImportField(31211034, 'КВР плательщика', 'SourceKVR', 'КВР плательщика', 'SourceKVRKey', 1, 312, 1, 1, 'КВРПлат', 0, null) ;

CALL ImportField(31211035, 'КЭСР плательщика', 'SourceKESR', 'КЭСР плательщика', 'SourceKESR', 1, 312, 1, 1, 'КЭСРПлат', 0, null) ;

CALL ImportField(31211036, 'КВСР плательщика', 'SourceKVSR', 'КВСР плательщика', 'SourceKVSRKey', 1, 312, 1, 1, 'КВСРПлат', 0, null) ;

CALL ImportField(31211037, 'КЦСР плательщика', 'SourceKCSR', 'КЦСР плательщика', 'SourceKCSRKey', 1, 312, 1, 1, 'КЦСРПлат', 0, null) ;

CALL ImportField(31211038, 'КФСР плательщика', 'SourceKFSR', 'КФСР плательщика', 'SourceKFSR', 1, 312, 1, 1, 'КФСРПлат', 0, null) ;

CALL ImportField(31211039, 'СубКЭСР плательщика', 'SourceSUBKESR', 'СубКЭСР плательщика', 'SourceSUBKESR', 1, 312, 1, 1, 'СубКЭСРПлат', 0, null) ;

CALL ImportField(31211040, 'Мероприятие плательщика', ' ', 'Мероприятие плательщика', 'SourceFACTCLS', 1, 312, 1, 1, '', 1, null) ;

CALL ImportField(31211041, 'Тип средств плательщика', ' ', 'Тип средств плательщика', 'SourceMEANSTYPECLS', 1, 312, 1, 1, '', 1, null) ;

CALL ImportField(31211042, 'Источник финансирования плательщика', ' ', 'Источник финансирования плательщика', 'SourceFINSOURCECLS', 1, 312, 1, 1, '', 1, null) ;

CALL ImportField(31211043, 'Тип финансирования плательщика', ' ', 'Тип финансирования плательщика', 'SourceFINTYPECLS', 1, 312, 1, 1, '', 1, null) ;

CALL ImportField(31211044, 'Тип документа плательщика', ' ', 'Тип документа плательщика', 'SourceDOCTYPECLS', 1, 312, 1, 1, '', 1, null) ;

CALL ImportField(31211046, 'Источник внутреннего финансирования', ' ', 'Источник финансирования', 'SourceIFS_DescriptionCode', 1, 312, 1, 1, '', 1, null) ;

CALL ImportField(31211047, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 1, 312, 1, 1, '', 1, null) ;

CALL ImportField(31211062, 'Номер договора получателя', 'DestBudgetPromiseAgrNum', 'Номер договора получателя', 'DestBudgetPromiseAgrNum', 1, 312, 1, 1, 'ДоговораБОНомерДоговора', 0, null) ;

CALL ImportField(31211063, 'Дата договора получателя', 'DestBudgetPromiseAgrDate', 'Дата договора получателя', 'DestBudgetPromiseAgrDate', 1, 312, 1, 1, 'ДоговораБОДатаДоговора', 0, null) ;

CALL ImportField(31211064, 'Сумма договора получателя', 'DestBudgetPromiseAgrSumma', 'Сумма договора получателя', 'DestBudgetPromiseAgrSumma', 1, 312, 1, 1, '', 0, null) ;

CALL ImportField(31211065, 'Реестр. номер документа(№ бюдж. обязат-ва получателя)', 'DestBudgetPromiseAgrRNum', 'Реестровый номер дог', 'DestBudgetPromiseAgrReestrNum', 1, 312, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(31211066, 'Дог. примечание получателя', 'DestBudgetPromiseAgrNote', 'Дог. примечание получателя', 'DestBudgetPromiseAgrNote', 1, 312, 1, 1, 'ДоговораБОПримечаниеДоговора', 0, null) ;

CALL ImportField(31211069, 'Сумма гос. контракта получателя', 'DestBudgetPromiseSOSumma', 'Сумма гос. контракта получателя', ' ', 1, 312, 1, 1, '', 0, null) ;

CALL ImportField(31211072, 'Классификация', 'TreeOwner0', 'Классификация(Группа)', ' ', 1, 312, 1, 0, '', 0, null) ;

CALL ImportField(31211106, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', ' ', 1, 312, 1, 0, '', 0, null) ;

CALL ImportField(31211121, 'Код целевых средств плательщика(Ключ)', '', 'Код целевых средств плательщика (ссылка)', 'SourceTransfertCls', 1, 312, 1, 1, '', 0, null) ;

CALL ImportField(31211123, 'Код целевых средств плательщика', '', 'Код целевых средств плательщика', 'SourceTransfertClsValue', 1, 312, 1, 1, '', 0, null) ;

CALL ImportField(31211129, 'Код целевых средствКлюч', 'SourceTransfertCls', 'Код целевых средствКлюч', ' ', 1, 312, 1, 1, 'КодЦелевыхСредствКлючПлат', 0, null) ;

-- Возврат со счетов наличности, УРМ(0)
CALL ImportField(31400001, 'Бухгалтерская операция', 'BuhPaymentCls', 'Бухгалтерская операция', 'BUHPAYMENTCLS', 0, 314, 0, 0, 'БухПроводка', 0, null) ;

CALL ImportField(31400002, 'Назначение платежа', 'Note', 'Назначение платежа', 'NOTE', 0, 314, 0, 0, 'Примечание', 0, null) ;

CALL ImportField(31400003, 'Л/С средства в пути', 'DESTFACIALACC_CLS', 'Л/С средства в пути', 'DestFacialAccCls', 0, 314, 0, 0, 'ЛицСчетПолучателя', 0, null) ;

CALL ImportField(31400004, 'ссылка на Р/С получателя (казначейский)', 'DestAccount', 'ссылка на Р/С получателя (казначейский)', 'DESTACCOUNT', 0, 314, 0, 1, 'СчетПолуч', 0, null) ;

CALL ImportField(31400005, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 0, 314, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(31400006, 'Причина отклонения', 'Reject_Cls', 'Причина отклонения', 'REJECTCLS', 0, 314, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(31400007, 'Вид операции', 'TypeOperationCls', 'Вид операции', 'OperationTypeCls', 0, 314, 0, 0, 'ТипОперации', 0, null) ;

CALL ImportField(31400008, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 0, 314, 0, 0, 'ВидПлатежа', 0, null) ;

CALL ImportField(31400009, 'Очередность платежа', 'PAYPRIORITY', 'Очередность платежа', 'PayPriority', 0, 314, 0, 0, 'Очередность', 0, null) ;

CALL ImportField(31400010, 'Номер документа', 'DocNumber', 'Номер документа', 'DocumentNumber', 0, 314, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(31400011, 'Сумма', 'Summa', 'Сумма', 'SUMMA', 0, 314, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(31400012, 'Р/С получателя (казначейский)', 'DestAccountName', 'Р/С получателя (казначейский)', 'DestAccountName', 0, 314, 0, 0, '', 0, null) ;

CALL ImportField(31400013, 'Р/С плательщика (казначейский)', 'SourceAccountName', 'Р/С плательщика (казначейский)', 'SourceAccountName', 0, 314, 0, 0, '', 0, null) ;

CALL ImportField(31400014, 'ссылка на Р/С плательщика (казначейский)', 'SourceAccount', 'ссылка на Р/С плательщика (казначейский)', 'SOURCEACCOUNT', 0, 314, 0, 1, 'РСФО,СчетПлат', 0, null) ;

CALL ImportField(31400015, 'Срок платежа', 'PAYDATE', 'Срок платежа', 'PayDate', 0, 314, 0, 0, 'СрокПлатежа', 0, null) ;

CALL ImportField(31400016, 'Дата документа', 'DocumentDate', 'Дата документа', 'DocumentDate', 0, 314, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(31400017, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 0, 314, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(31400018, 'Код документа', 'ID', 'Код документа', 'ID', 0, 314, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(31400019, 'Код ФО документа', 'FUID', 'Код ФО документа', 'FUID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400020, 'Код УРМ документа', ' ', 'Код УРМ документа', 'SenderRecordID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400021, 'Код отправителя документа', ' ', 'Код отправителя документа', 'SenderID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400022, 'Номер реестра', 'ReestrNumber', 'Номер реестра', 'ReestrNumber', 0, 314, 0, 1, 'НомерРеестра', 0, null) ;

CALL ImportField(31400023, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 0, 314, 0, 1, 'ДатаРеестра', 0, null) ;

CALL ImportField(31400024, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 314, 0, 1, 'ИндексыДанныхЗаголовок', 0, null) ;

CALL ImportField(31400025, 'Номер карточки', 'CARDNUMBER', 'Номер карточки', 'CARDNUMBER', 0, 314, 0, 0, '', 0, null) ;

CALL ImportField(31400027, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 314, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(31400028, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400029, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400030, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400031, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400032, 'Номер заявки', ' ', 'Номер заявки', 'BidNumber', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400033, 'Локальный реестр', ' ', 'Локальный реестр', 'ManagerBid', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400034, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400035, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400038, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400039, 'Код реестра', ' ', 'Код реестра', 'Reestr_Ref', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400040, 'Статус ЭЦП', ' ', 'Статус ЭЦП', 'CRYPTOSTATUS', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400041, 'Отдел', ' ', 'Отдел', 'DEPARTMENTCLS', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400042, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400043, 'Текст мягкой причины отклонения', 'SoftRejectCause', 'Текст мягкой причины отклонения', 'SoftRejectCause', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400044, 'Ссылка на счет получателя ФО', ' ', 'Ссылка на счет получателя ФО', 'DestAccountFUID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400045, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400046, 'Субсчет получателя', ' ', 'Субсчет получателя', 'DestFKFacialCode', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400047, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400048, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400049, 'ИНН организации-получателя', ' ', 'ИНН организации-получателя', 'DestOrgINN', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400050, 'КПП организации-получателя', ' ', 'КПП организации-получателя', 'DestOrgKPP', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400051, 'Наименование организации-получателя', ' ', 'Наименование организации-получателя', 'DestOrgName', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400052, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400053, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400054, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400055, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400056, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400057, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400058, 'л\с получателя(счет в пути)', ' ', 'л\с получателя', 'DestFacialAccClsName', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400059, 'мнемокод л\с получателя', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400060, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400061, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400062, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400063, 'Организация ФК получателя(код)', ' ', 'Организация ФК получателя(код)', 'DestFKOrgId', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400064, 'Организация ФК получателя ФО', ' ', 'Организация ФК получателя ФО', 'DestFKOrgFUID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400065, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400066, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400067, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400068, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400069, 'Ссылка на р/c ФО плательщика', ' ', 'Ссылка на р/c ФО плательщика', 'SourceAccountFUID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400070, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400071, 'Субсчет плательщика', ' ', 'Субсчет плательщика', 'SourceFKFacialCode', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400072, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400073, 'Ссылка на организацию плательщика(для УРМ)', ' ', 'Ссылка на организацию плательщика(для УРМ)', 'SourceOrgFUID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400074, 'ИНН организации-плательщика', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400075, 'КПП организации-плательщика', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400076, 'Наименование организации-плательщика', ' ', 'Наименование организации-плательщика', 'SourceOrgName', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400077, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400078, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400079, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400080, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400081, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400082, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400083, 'Имя л\с плательщика', ' ', 'Имя л\с плательщика', 'SourceFacialAccClsName', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400084, 'Мнемокод л\с плательщика', ' ', 'Мнемокод л\с плательщика', 'SourceFacialAccClsFacialCode', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400085, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400086, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400087, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400088, 'Организация ФК плательщика(код)', ' ', 'Организация ФК плательщика(код)', 'SourceFKOrgId', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400089, 'Организация ФК ФО плательщика', ' ', 'Организация ФК ФО плательщика', 'SourceFKOrgFUID', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400090, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400091, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400092, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400093, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400115, 'Информация для налогового платежа', 'TaxNote', 'Информация для налогового платежа', 'TaxNote', 0, 314, 0, 0, 'ИнформацияОНалоге', 0, null) ;

CALL ImportField(31400116, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 314, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(31400129, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 0, 314, 0, 0, 'ТипКлассификацииЗаголовок', 0, null) ;

CALL ImportField(31400138, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 314, 0, 1, '', 0, null) ;

CALL ImportField(31400140, 'Направление операции', 'OperationDirection', 'Направление операции', 'OperationDirection', 0, 314, 0, 0, 'НаправлениеОперации', 0, null) ;

CALL ImportField(31401001, 'Тип средств', 'SourceMeansType', 'Тип средств плательщика', 'SourceMEANSTYPECLS', 0, 314, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(31401003, 'Лицевой счет ', 'SourceFacialAcc_Cls', 'Лицевой счет плательщика', 'SourceFacialAccCls', 0, 314, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(31401004, 'Лицевой счет плательщика в ФК', 'SourceFacialCode', 'Лицевой счет плательщика в ФК', 'SourceFacialAccClsFacialCode', 0, 314, 1, 0, '', 0, null) ;

CALL ImportField(31401005, 'КВРКлюч', 'SourceKVR', 'КВР плательщика', 'SourceKVRKey', 0, 314, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(31401006, 'КЭСР', 'SourceKESR', 'КЭСР плательщика', 'SourceKESR', 0, 314, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(31401007, 'КФСР', 'SourceKFSR', 'КФСР плательщика', 'SourceKFSR', 0, 314, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(31401008, 'КЦСРКлюч', 'SourceKCSR', 'КЦСР плательщика', 'SourceKCSRKey', 0, 314, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(31401009, 'КВСРКлюч', 'SourceKVSR', 'КВСР плательщика', 'SourceKVSRKey', 0, 314, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(31401012, 'Источник финансирования', 'SourceFinSource', 'Источник финансирования плательщика', 'SourceFINSOURCECLS', 0, 314, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(31401013, 'Сумма по строке детализации', 'Summa', 'Сумма по строке детализации', 'SUMMA', 0, 314, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(31401014, 'Примечание по строке детализации', 'Note', 'Примечание по строке детализации', 'NOTE', 0, 314, 1, 0, '', 0, null) ;

CALL ImportField(31401015, 'Номер БО плательщика', 'SourcePromise', 'Номер БО плательщика', 'SourcePROMISE', 0, 314, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(31401016, 'Суб. КЭСР плательщика', 'SourceSubKESR', 'Суб. КЭСР плательщика', 'SourceSUBKESR', 0, 314, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(31401017, 'Ссылка на внутренний номер БО плательщика', 'SourceBudgetPromise', 'Ссылка на внутренний номер БО плательщика', 'Ссылка на внутренний номер БО плательщика', 0, 314, 1, 1, 'ДоговораБО,БОВнутрНомер', 0, null) ;

CALL ImportField(31401018, 'Номер БО плательщика(договора)', 'SourceBudgetPromiseNum', 'Номер БО плательщика(договора)', 'Номер БО плательщика', 0, 314, 1, 0, 'ДоговораБОНомер,БОНомер', 0, null) ;

CALL ImportField(31401019, 'Документ исполнения плательщика', 'SourceExecDocCollaps', 'Документ исполнения плательщика', 'Документ исполнения плательщика', 0, 314, 1, 0, 'ДокИсполненияГруппа', 0, null) ;

CALL ImportField(31401020, 'Ссылка на документ исполнения плательщика', 'SourceExecDoc', 'Ссылка на документ исполнения плательщика', 'Ссылка на документ исполнения плательщика', 0, 314, 1, 1, 'ДокИсполнения', 0, null) ;

CALL ImportField(31401021, 'Номер документа исполнения плательщика', 'SourceExecDocNum', 'Номер документа исполнения плательщика', 'Номер документа исполнения плательщика', 0, 314, 1, 0, 'ДокИсполненияНомер', 0, null) ;

CALL ImportField(31401022, 'Реестровый номер ДИ плательщика', 'SourceExecDocReestr', 'Реестровый номер ДИ плательщика', 'Реестровый номер ДИ плательщика', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401023, 'Дата ДИ плательщика', 'SourceExecDocDate', 'Дата ДИ плательщика', 'Дата ДИ плательщика', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401024, 'Тип ДИ плательщика', 'SourceExecDocType', 'Тип ДИ плательщика', 'Тип ДИ плательщика', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401025, 'Сумма по ДИ плательщика', 'SourceExecDocSumma', 'Сумма по ДИ плательщика', 'Сумма по ДИ плательщика', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401026, 'Примечание ДИ плательщика', 'SourceExecDocNote', 'Примечание ДИ плательщика', 'Примечание ДИ плательщика', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401037, 'Бюджетное обязательство плательщика', 'SourceBudgetPromiseCollaps', 'Бюджетное обязательство плательщика', 'SourceBudgetPromiseCollaps', 0, 314, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(31401038, 'Сумма БО', 'SourceBudgetPromiseSumma', 'Сумма БО', 'SourceBudgetPromiseSumma', 0, 314, 1, 1, 'ДоговораБОСумма', 0, null) ;

CALL ImportField(31401039, 'Номер договора', 'SourceBudgetPromiseDocNumber', 'Номер договора', 'SourceBudgetPromiseDocNumber', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401040, 'Дата договора', 'SourceBudgetPromiseDocDate', 'Дата договора', 'SourceBudgetPromiseDocDate', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401041, 'Сумма договора', 'SourceBudgetPromiseDocSumma', 'Сумма договора', 'SourceBudgetPromiseDocSumma', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401042, 'Реестровый номер дог.', 'SourceBudgetPromiseDocReestrNum', 'Реестровый номер дог.', 'SourceBudgetPromiseDocReestrNum', 0, 314, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(31401043, 'Дог. примечание', 'SourceBudgetPromiseDocNote', 'Дог. примечание', 'SourceBudgetPromiseDocNote', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401044, 'Номер гос. контракта', 'SourceBudgetPromiseSONum', 'Номер гос. контракта', 'SourceBudgetPromiseSONum', 0, 314, 1, 1, 'ДоговораБОНомерКонтракта', 0, null) ;

CALL ImportField(31401045, 'Дата гос. контракта', 'SourceBudgetPromiseSODate', 'Дата гос. контракта', 'SourceBudgetPromiseSODate', 0, 314, 1, 1, 'ДоговораБОДатаКонтракта', 0, null) ;

CALL ImportField(31401046, 'Сумма гос. контракта', 'SourceBudgetPromiseSOSumma', 'Сумма гос. контракта', 'SourceBudgetPromiseSOSumma', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401047, 'Реестровый номер гос. контр', 'SourceBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр', 'SourceBudgetPromiseSOReestrNum', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401048, 'Прим. гос. контракта', 'SourceBudgetPromiseSONote', 'Прим. гос. контракта', 'SourceBudgetPromiseSONote', 0, 314, 1, 1, 'ДоговораБОПримечаниеКонтракта', 0, null) ;

CALL ImportField(31401061, 'Код записи', 'Id', 'Код записи', 'Id', 0, 314, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(31401062, 'Код ФО записи', 'FUID', 'Код ФО записи', 'FUID', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401063, 'Код УРМ записи', ' ', 'Код УРМ записи', 'SenderRecordID', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401064, 'Код отправителя записи', ' ', 'Код отправителя записи', 'SenderID', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401065, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 314, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(31401066, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 314, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(31401067, 'Бух операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 0, 314, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(31401068, 'Тип классификации', 'ClsType', 'Тип классификации(расходна, источниковая, доходная)', 'ClsType', 0, 314, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(31401074, 'КВР получателя', 'DestKVR', 'КВР получателя', 'DestKVRKey', 0, 314, 1, 1, 'КВРКлючПолуч', 0, null) ;

CALL ImportField(31401075, 'КЭСР получателя', 'DestKESR', 'КЭСР получателя', 'DestKESR', 0, 314, 1, 1, 'КЭСРПолуч', 0, null) ;

CALL ImportField(31401076, 'КВСР получателя', 'DestKVSR', 'КВСР получателя', 'DestKVSRKey', 0, 314, 1, 1, 'КВСРКлючПолуч', 0, null) ;

CALL ImportField(31401077, 'КЦСР получателя', 'DestKCSR', 'КЦСР получателя', 'DestKCSRKey', 0, 314, 1, 1, 'КЦСРКлючПолуч', 0, null) ;

CALL ImportField(31401078, 'КФСР получателя', 'DestKFSR', 'КФСР получателя', 'DestKFSR', 0, 314, 1, 1, 'КФСРПолуч', 0, null) ;

CALL ImportField(31401079, 'СубКЭСР получателя', 'DestSUBKESR', 'СубКЭСР получателя', 'DestSUBKESR', 0, 314, 1, 1, 'СубКЭСРПолуч', 0, null) ;

CALL ImportField(31401081, 'Тип средств получателя', 'DestMEANSTYPE', 'Тип средств получателя', 'DestMEANSTYPECLS', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401082, 'Источник финансирования получателя', 'DestFINSOURCE', 'Источник финансирования получателя', 'DestFINSOURCECLS', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401084, 'Тип документа получателя', ' ', 'Тип документа получателя', 'DestDOCTYPECLS', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401090, 'Тип документа плательщика', ' ', 'Тип документа плательщика', 'SourceDOCTYPECLS', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401091, 'Классификация', 'SourceIFS', 'Классификация', 'SourceIFS_DescriptionCode', 0, 314, 1, 0, 'ИсточникВнутрФинансированияКлюч', 0, null) ;

CALL ImportField(31401092, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401104, 'Район', 'SourceRegionCls', 'Район', 'SourceRegionCls', 0, 314, 1, 0, 'Регион,РайонТрансферта', 0, null) ;

CALL ImportField(31401113, 'Источник образования', 'SourceFundsSource', 'Источник образования', 'SourceFundsSource', 0, 314, 1, 0, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(31401114, 'Классификация', 'TreeOwner0', 'Классификация(Группа)', ' ', 0, 314, 1, 0, '', 0, null) ;

CALL ImportField(31401117, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401130, 'Код целевых средствКлюч', 'SourceTransfertCls', 'Код целевых средств плательщика (ссылка)', 'SourceTransfertCls', 0, 314, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(31401131, 'Код целевых средств', 'SourceTransfertClsCode', 'Код целевых средств плательщика', 'SourceTransfertClsValue', 0, 314, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(31401132, 'КЦСР(Классификация)', 'SourceKCSRCode', '', 'SourceKCSR', 0, 314, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(31401133, 'КВР(Классификация)', 'SOURCEKVRCode', '', 'SourceKVR', 0, 314, 1, 0, 'КВР', 0, null) ;

CALL ImportField(31401134, 'КВСР(Классификация)', 'SourceKVSRCode', '', 'SourceKVSR', 0, 314, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(31401135, 'КЦСР получ.(Классификация получ.)', 'DestKCSRCode', '', 'DestKCSR', 0, 314, 1, 0, '', 0, null) ;

CALL ImportField(31401136, 'КВР получ.(Классификация получ.)', 'DestKVRCode', '', 'DestKVR', 0, 314, 1, 0, '', 0, null) ;

CALL ImportField(31401137, 'КВСР получ.(Классификация получ.)', 'DestKVSRCode', '', 'DestKVSR', 0, 314, 1, 0, '', 0, null) ;

CALL ImportField(31401141, 'Классификация ИВнФ(Классифкатор)', 'SourceIFSCode', 'Классификация ИВнФ(Классифкатор)', 'SourceIFS_DescriptionCode', 0, 314, 1, 0, '', 0, null) ;

CALL ImportField(31401143, '', 'MemOrderNum', '', ' ', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401144, 'ИД контракта', 'SourceBudgetPromiseSOID', '', ' ', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401146, '', 'DestRegionCls', '', ' ', 0, 314, 1, 1, '', 0, null) ;

CALL ImportField(31401147, 'Код субсидииКлюч', 'SourceSubsidyCls', 'Код субсидии (ссылка)', 'SourceSubsidyCls', 0, 314, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(31401148, 'Код субсидии', 'SourceSubsidyClsCode', 'Код субсидии', 'SourceSubsidyClsCode', 0, 314, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(31401149, 'Код бюджетного ассигнования', 'SourceBudAllocationClsCode', '', ' ', 0, 314, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(31401150, 'Код расходного обязательства', 'SourcePayPromiseClsCode', '', ' ', 0, 314, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(31401151, 'Код бюджетного ассигнования (ключ)', 'SourceBudAllocationCls', '', ' ', 0, 314, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(31401152, 'Код расходного обязательства (ключ)', 'SourcePayPromiseCls', '', ' ', 0, 314, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

CALL ImportField(31401153, 'Район бюджетного учреждения', 'RegionBudgetEst', 'Район бюджетного учреждения', 'RegionBudgetEst', 0, 314, 1, 1, '', 0, null) ;

-- Возврат со счетов наличности, Бюджет(1)
CALL ImportField(31410001, 'Код документа', 'ID', 'Код документа', 'ID', 1, 314, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(31410002, '№ п/п', 'DocNumber', 'Номер документа', 'DocumentNumber', 1, 314, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(31410003, 'Код ФО документа', ' ', 'Код ФО документа', 'FUID', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410004, 'Код УРМ документа', 'SenderRecordID', 'Код УРМ документа', 'SenderRecordID', 1, 314, 0, 1, 'КодУРМДокумента', 0, 18970) ;

CALL ImportField(31410005, 'Код отправителя документа', 'SenderID', 'Код отправителя документа', 'SenderID', 1, 314, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(31410006, 'Дата п/п', 'DocumentDate', 'Дата документа', 'DocumentDate', 1, 314, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(31410007, 'Срок платежа', 'PayDate', 'Срок платежа', 'PayDate', 1, 314, 0, 0, 'СрокПлатежа', 0, 18951) ;

CALL ImportField(31410008, 'Дата проводки', 'AcceptDate', 'Дата проводки', 'AcceptDate', 1, 314, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(31410009, 'Номер реестра', 'ReestrNumber', 'Номер реестра', 'ReestrNumber', 1, 314, 0, 0, 'НомерРеестра', 0, 19090) ;

CALL ImportField(31410010, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 1, 314, 0, 1, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(31410011, 'Сумма(руб)', 'SUMMA', 'Сумма', 'SUMMA', 1, 314, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(31410013, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 1, 314, 0, 0, 'ВидПлатежа', 0, 18963) ;

CALL ImportField(31410014, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 314, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(31410015, 'Очередность', 'PayPriority', 'Очередность ', 'PayPriority', 1, 314, 0, 0, 'Очередность', 0, 18966) ;

CALL ImportField(31410016, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 1, 314, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(31410017, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', 'BUHPAYMENTCLS', 1, 314, 0, 0, 'БухПроводка', 0, 18968) ;

CALL ImportField(31410019, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 314, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(31410020, 'Причина отклонения (комментарий)', 'RejectCause', 'Текст причины отклонения', 'RejectCause', 1, 314, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(31410021, 'Ссылка на счет плательщика', 'SOURCEACCOUNT', 'Ссылка на счет плательщика', 'SOURCEACCOUNT', 1, 314, 0, 1, 'РСФО,СчетПлат', 0, 18956) ;

CALL ImportField(31410022, 'л\с плательщика', ' ', 'л\с плательщика', 'SourceFacialAccCls', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410023, 'Ссылка на счет получателя', 'DESTACCOUNT', 'Ссылка на счет получателя', 'DESTACCOUNT', 1, 314, 0, 1, 'СчетПолуч', 0, 18958) ;

CALL ImportField(31410024, 'Л/с средств в пути', 'DestFacialAcc_Cls', 'л\с получателя', 'DestFacialAccCls', 1, 314, 0, 0, 'ЛицСчетПолучателя', 0, 18959) ;

CALL ImportField(31410025, 'СостояниеДокумента', 'DocStateRef', 'Состояние документа', 'DocStateRef', 1, 314, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(31410026, 'Начальное состояние документа', ' ', 'Начальное состояние документа', 'BeginDocStateRef', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410027, 'Есть в Бюджете', ' ', 'Есть в Бюджете', 'IsInBudget', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410028, 'Признак зависания', ' ', 'Признак зависания', 'DocSuspended', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410029, 'Локальная виза', ' ', 'Локальная виза', 'IsVised', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410030, 'Номер заявки', ' ', 'Номер заявки', 'BidNumber', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410031, 'Локальный реестр', ' ', 'Локальный реестр', 'ManagerBid', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410032, 'Дата экстренного изменения', ' ', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410033, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410036, 'Локальный реестр ФО', ' ', 'Локальный реестр ФО', 'ManBidFuid', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410037, 'Код реестра', 'Reestr_Ref', 'Код реестра', 'Reestr_Ref', 1, 314, 0, 1, 'КодРеестра', 0, 18971) ;

CALL ImportField(31410038, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 314, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(31410040, 'Мягкая причина отклонения', ' ', 'Мягкая причина отклонения', 'SoftRejectCls', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410041, 'Текст мягкой причины отклонения', ' ', 'Текст мягкой причины отклонения', 'SoftRejectCause', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410042, 'Ссылка на счет получателя ФО', ' ', 'Ссылка на счет получателя ФО', 'DestAccountFUID', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410043, 'Счет получателя', 'DestAccountName', 'Счет получателя', 'DestAccountName', 1, 314, 0, 0, '', 0, 17112) ;

CALL ImportField(31410044, 'ОСБ получателя', ' ', 'ОСБ получателя', 'DestBankDepartmentNumber', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410045, 'Субсчет получателя', ' ', 'Субсчет получателя', 'DestFKFacialCode', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410046, 'Ссылка на организацию получателя', ' ', 'Ссылка на организацию получателя', 'DestOrgId', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410047, 'Ссылка на организацию получателя ФО', ' ', 'Ссылка на организацию получателя ФО', 'DestOrgFUID', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410048, 'ИНН организации-получателя', ' ', 'ИНН организации-получателя', 'DestOrgINN', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410049, 'КПП организации-получателя', ' ', 'КПП организации-получателя', 'DestOrgKPP', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410050, 'Наименование организации-получателя', ' ', 'Наименование организации-получателя', 'DestOrgName', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410051, 'Город организации-получателя', ' ', 'Город организации-получателя', 'DestOrgCity', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410052, 'Банк получателя', ' ', 'Банк получателя', 'DestBankFUID', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410053, 'Наименование банка получателя', ' ', 'Наименование банка получателя', 'DestBankName', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410054, 'БИК банка получателя', ' ', 'БИК банка получателя', 'DestBankBIK', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410055, 'Корр.счет банка получателя', ' ', 'Корр.счет банка получателя', 'DestBankCor', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410056, 'Город  банка получателя', ' ', 'Город  банка получателя', 'DestBankCity', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410057, 'л\с получателя(счет в пути)', ' ', 'л\с получателя', 'DestFacialAccClsName', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410058, 'мнемокод л\с получателя', ' ', 'мнемокод л\с получателя', 'DestFacialAccClsFacialCode', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410059, 'ИНН организации-владельца л\с получателя', ' ', 'ИНН организации-владельца л\с получателя', 'DestFacialAccClsOrgINN', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410060, 'КПП организации-владельца л\с получателя', ' ', 'КПП организации-владельца л\с получателя', 'DestFacialAccClsOrgKPP', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410061, 'Имя организации владельца л\с получателя', ' ', 'Имя организации владельца л\с получателя', 'DestFacialAccClsOrgName', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410062, 'Организация ФК получателя(код)', ' ', 'Организация ФК получателя(код)', 'DestFKOrgId', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410063, 'Организация ФК получателя ФО', ' ', 'Организация ФК получателя ФО', 'DestFKOrgFUID', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410064, 'ИНН организации ФК получателя', ' ', 'ИНН организации ФК получателя', 'DestFKOrgINN', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410065, 'КПП организации ФК получателя', ' ', 'КПП организации ФК получателя', 'DestFKOrgKPP', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410066, 'Организация ФК получателя', ' ', 'Организация ФК получателя', 'DestFKOrgName', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410067, 'Город организации ФК получателя', ' ', 'Город организации ФК получателя', 'DestFKOrgCity', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410068, 'Ссылка на р/c ФО плательщика', ' ', 'Ссылка на р/c ФО плательщика', 'SourceAccountFUID', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410069, 'р/с плательщика', 'SourceAccountName', 'р/с плательщика', 'SourceAccountName', 1, 314, 0, 0, '', 0, 17112) ;

CALL ImportField(31410070, 'ОСБ плательщика', ' ', 'ОСБ плательщика', 'SourceBankDepartmentNumber', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410071, 'Субсчет плательщика', ' ', 'Субсчет плательщика', 'SourceFKFacialCode', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410072, 'Ссылка на организацию плательщика', ' ', 'Ссылка на организацию плательщика', 'SourceOrgId', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410073, 'Ссылка на организацию плательщика(для УРМ)', ' ', 'Ссылка на организацию плательщика(для УРМ)', 'SourceOrgFUID', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410074, 'ИНН', ' ', 'ИНН организации-плательщика', 'SourceOrgINN', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410075, 'КПП', ' ', 'КПП организации-плательщика', 'SourceOrgKPP', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410076, 'Наименование плательщика', ' ', 'Наименование организации-плательщика', 'SourceOrgName', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410077, 'Город организации-плательщика', ' ', 'Город организации-плательщика', 'SourceOrgCity', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410078, 'Банк плательщика', ' ', 'Банк плательщика', 'SourceBankFUID', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410079, 'Наименование банка плательщика', ' ', 'Наименование банка плательщика', 'SourceBankName', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410080, 'БИК банка плательщика', ' ', 'БИК банка плательщика', 'SourceBankBIK', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410081, 'Корр.счет банка плательщика', ' ', 'Корр.счет банка плательщика', 'SourceBankCor', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410082, 'Город  банка плательщика', ' ', 'Город  банка плательщика', 'SourceBankCity', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410083, 'Имя л\с плательщика', ' ', 'Имя л\с плательщика', 'SourceFacialAccClsName', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410084, 'Мнемокод л\с плательщика', ' ', 'Мнемокод л\с плательщика', 'SourceFacialAccClsFacialCode', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410085, 'ИНН организации-владельца л\с плательщика', ' ', 'ИНН организации-владельца л\с плательщика', 'SourceFacialAccClsOrgINN', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410086, 'КПП организации-владельца л\с плательщика', ' ', 'КПП организации-владельца л\с плательщика', 'SourceFacialAccClsOrgKPP', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410087, 'Имя организации-владельца л\с плательщика', ' ', 'Имя организации-владельца л\с плательщика', 'SourceFacialAccClsOrgName', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410088, 'Организация ФК плательщика(код)', ' ', 'Организация ФК плательщика(код)', 'SourceFKOrgId', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410089, 'Организация ФК ФО плательщика', ' ', 'Организация ФК ФО плательщика', 'SourceFKOrgFUID', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410090, 'ИНН организации ФК плательщика', ' ', 'ИНН организации ФК плательщика', 'SourceFKOrgINN', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410091, 'КПП организации ФК плательщика', ' ', 'КПП организации ФК плательщика', 'SourceFKOrgKPP', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410092, 'Организация ФК плательщика', ' ', 'Организация ФК плательщика', 'SourceFKOrgName', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410093, 'Город организации ФК плательщика', ' ', 'Город организации ФК плательщика', 'SourceFKOrgCity', 1, 314, 0, 1, '', 1, null) ;

CALL ImportField(31410094, 'Архив', 'ARHIVEDOC', 'Архив', 'ARHIVEDOC', 1, 314, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(31410095, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 314, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(31410100, 'Направление операции', 'OperationDirection', 'Направление операции', 'OperationDirection', 1, 314, 0, 0, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(31410105, 'Информация для налогового платежа', 'TaxNote', 'Информация для налогового платежа', 'TaxNote', 1, 314, 0, 0, 'ИнформацияОНалоге', 0, 18991) ;

CALL ImportField(31410108, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 1, 314, 0, 0, 'ТипКлассификацииЗаголовок', 0, 19008) ;

CALL ImportField(31410116, 'Признак принятости реестра', 'Accepted', 'Признак принятости реестра', ' ', 1, 314, 0, 1, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(31410117, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'Progindex', 1, 314, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(31410118, 'Статус', 'Status', 'Статус', ' ', 1, 314, 0, 1, 'Статус', 0, 17233) ;

CALL ImportField(31410119, 'Отдел', 'DepartmentCLS', '', 'DEPARTMENTCLS', 1, 314, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(31410120, 'Номер карточки', 'CardRefName', '', ' ', 1, 314, 0, 1, '', 0, 18939) ;

CALL ImportField(31411001, 'Код записи', 'Id', 'Код записи', 'Id', 1, 314, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(31411002, 'Код ФО записи', ' ', 'Код ФО записи', 'FUID', 1, 314, 1, 1, '', 1, null) ;

CALL ImportField(31411003, 'Код УРМ записи', ' ', 'Код УРМ записи', 'SenderRecordID', 1, 314, 1, 1, '', 1, null) ;

CALL ImportField(31411004, 'Код отправителя записи', ' ', 'Код отправителя записи', 'SenderID', 1, 314, 1, 1, '', 1, null) ;

CALL ImportField(31411005, 'Сумма(руб)', 'SUMMA', 'Сумма', 'SUMMA', 1, 314, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(31411008, 'Код документа', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 1, 314, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(31411009, 'Операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 1, 314, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(31411010, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'ClsType', 1, 314, 1, 1, 'ТипКлассификации', 0, 18922) ;

CALL ImportField(31411011, '№ БО получателя', 'DestPROMISE', 'Номер БО получателя', 'DestPROMISE', 1, 314, 1, 1, 'БюджОбязПолуч', 0, 18906) ;

CALL ImportField(31411012, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Документ исполнения получателя', 'DestExecDoc', 1, 314, 1, 1, 'ДокИсполненияПолуч', 0, 18918) ;

CALL ImportField(31411013, 'Номер БО получателя(договора)', 'DestBudgetPROMISENum', 'Номер БО получателя(договора)', 'DestBudgetPROMISENum', 1, 314, 1, 1, '', 0, null) ;

CALL ImportField(31411014, 'Вн. номер БО получателя', 'DestBUDGETPROMISE', 'Договора БО получателя', 'DestBUDGETPROMISE', 1, 314, 1, 1, 'ДоговораБОПолуч', 0, 18909) ;

CALL ImportField(31411015, 'л\с получателя', ' ', 'л\с получателя', 'DestFacialAccCls', 1, 314, 1, 1, '', 1, null) ;

CALL ImportField(31411016, 'КВР получателя', 'DestKVR', 'КВР получателя', 'DestKVRKey', 1, 314, 1, 1, 'КВРКлючПолуч', 0, 18870) ;

CALL ImportField(31411017, 'КЭСР получателя', 'DestKESR', 'КЭСР получателя', 'DestKESR', 1, 314, 1, 1, 'КЭСРПолуч', 0, 18871) ;

CALL ImportField(31411018, ' получателя', 'DestKVSR', 'КВСР получателя', 'DestKVSRKey', 1, 314, 1, 1, 'КВСРКлючПолуч', 0, 18895) ;

CALL ImportField(31411019, 'КЦСР получателя', 'DestKCSR', 'КЦСР получателя', 'DestKCSRKey', 1, 314, 1, 1, 'КЦСРКлючПолуч', 0, 18896) ;

CALL ImportField(31411020, 'КФСР получателя', 'DestKFSR', 'КФСР получателя', 'DestKFSR', 1, 314, 1, 1, 'КФСРПолуч', 0, 18897) ;

CALL ImportField(31411021, 'СубКЭСР получателя', 'DestSUBKESR', 'СубКЭСР получателя', 'DestSUBKESR', 1, 314, 1, 1, 'СубКЭСРПолуч', 0, 18898) ;

CALL ImportField(31411022, 'Мероприятие получателя', ' ', 'Мероприятие получателя', 'DestFACTCLS', 1, 314, 1, 1, '', 1, null) ;

CALL ImportField(31411023, 'Тип средств получателя', ' ', 'Тип средств получателя', 'DestMEANSTYPECLS', 1, 314, 1, 1, '', 1, null) ;

CALL ImportField(31411024, 'Источник финансирования получателя', ' ', 'Источник финансирования получателя', 'DestFINSOURCECLS', 1, 314, 1, 1, '', 1, null) ;

CALL ImportField(31411025, 'Тип финансирования получателя', ' ', 'Тип финансирования получателя', 'DestFINTYPECLS', 1, 314, 1, 1, '', 1, null) ;

CALL ImportField(31411026, 'Тип документа получателя', 'DestDOCTYPE', 'Тип документа получателя', 'DestDOCTYPECLS', 1, 314, 1, 1, 'ТипДокументаПолуч', 0, 18903) ;

CALL ImportField(31411028, 'ИВФ получателя', ' ', 'Источник внутреннего финансирования дефицита бюджета получателя', 'DestIFS_DescriptionCode', 1, 314, 1, 1, '', 1, null) ;

CALL ImportField(31411029, '№ БО плательщика', 'SourcePROMISE', 'Номер БО плательщика', 'SourcePROMISE', 1, 314, 1, 0, 'БюджОбяз', 0, 18905) ;

CALL ImportField(31411030, 'Номер Д.И. плательщика ссылка', 'SourceExecDoc', 'Документ исполнения', 'SourceExecDoc', 1, 314, 1, 1, 'ДокИсполнения', 0, 18917) ;

CALL ImportField(31411031, 'Номер БО плательщика(договора)', 'SourceBudgetPROMISENum', 'Номер БО плательщика(договора)', 'SourceBudgetPROMISENum', 1, 314, 1, 0, 'ДоговораБОНомер,БОНомер', 0, 20223) ;

CALL ImportField(31411032, 'Вн. номер БО плательщика', 'SourceBUDGETPROMISE', 'Договора БО плательщика', 'SourceBUDGETPROMISE', 1, 314, 1, 1, 'ДоговораБО,БОВнутрНомер', 0, 18908) ;

CALL ImportField(31411033, 'Лицевой счет плательщика', 'SourceFacialAcc_Cls', 'л\с плательщика', 'SourceFacialAccCls', 1, 314, 1, 0, 'ЛицевойСчет', 0, 18866) ;

CALL ImportField(31411034, 'КВРКлюч', 'SourceKVR', 'КВР плательщика', 'SourceKVRKey', 1, 314, 1, 1, 'КВРКлюч', 0, 18867) ;

CALL ImportField(31411035, 'ЭКР(Классификация)', 'SourceKESR', 'КЭСР плательщика', 'SourceKESR', 1, 314, 1, 0, 'КЭСР', 0, 18868) ;

CALL ImportField(31411036, 'КВСРКлюч', 'SourceKVSR', 'КВСР плательщика', 'SourceKVSRKey', 1, 314, 1, 1, 'КВСРКлюч', 0, 18886) ;

CALL ImportField(31411037, 'КЦСРКлюч', 'SourceKCSR', 'КЦСР плательщика', 'SourceKCSRKey', 1, 314, 1, 1, 'КЦСРКлюч', 0, 18887) ;

CALL ImportField(31411038, 'ФКР(Классификация)', 'SourceKFSR', 'КФСР плательщика', 'SourceKFSR', 1, 314, 1, 0, 'КФСР', 0, 18888) ;

CALL ImportField(31411039, 'Суб КОСГУ', 'SourceSUBKESR', 'СубКЭСР плательщика', 'SourceSUBKESR', 1, 314, 1, 0, 'СубКЭСР', 0, 18889) ;

CALL ImportField(31411041, 'Тип средств', 'SourceMEANSTYPE', 'Тип средств плательщика', 'SourceMEANSTYPECLS', 1, 314, 1, 0, 'ТипСредств', 0, 18891) ;

CALL ImportField(31411042, 'Источник финансирования', 'SourceFINSOURCE', 'Источник финансирования плательщика', 'SourceFINSOURCECLS', 1, 314, 1, 0, 'ИсточникФинансирования', 0, 18892) ;

CALL ImportField(31411044, 'Тип документа', 'SourceDOCTYPE', 'Тип документа плательщика', 'SourceDOCTYPECLS', 1, 314, 1, 0, 'ТипДокумента', 0, 18894) ;

CALL ImportField(31411047, 'Код Сметы', ' ', 'Код Сметы', 'StimateID', 1, 314, 1, 1, '', 1, null) ;

CALL ImportField(31411048, '№ бюдж. обязат-ва плательщика', 'SourceBudgetPromiseCollaps', 'Бюджетное обязательство плательщика', ' ', 1, 314, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(31411049, 'Сумма БО(№ бюдж. обязат-ва плательщика)', 'SourceBudgetPromiseSumma', 'Сумма БО плательщика', 'SourceBudgetPromiseSumma', 1, 314, 1, 1, 'ДоговораБОСумма', 0, 20242) ;

CALL ImportField(31411050, '№ документа(№ бюдж. обязат-ва плательщика)', 'SourceBudgetPromiseAgrNum', 'Номер договора плательщика', 'SourceBudgetPromiseAgrNum', 1, 314, 1, 1, 'ДоговораБОНомерДоговора', 0, null) ;

CALL ImportField(31411051, 'Дата документа(№ бюдж. обязат-ва плательщика)', 'SourceBudgetPromiseAgrDate', 'Дата договора', 'SourceBudgetPromiseAgrDate', 1, 314, 1, 1, 'ДоговораБОДатаДоговора', 0, null) ;

CALL ImportField(31411052, 'Сумма договора плательщика', 'SourceBudgetPromiseAgrSumma', 'Сумма договора плательщика', 'SourceBudgetPromiseAgrSumma', 1, 314, 1, 1, '', 0, null) ;

CALL ImportField(31411053, 'Реестр. номер документа(№ бюдж. обязат-ва плательщика)', 'SourceBudgetPromiseAgrRNum', 'Реестровый номер дог.', 'SourceBudgetPromiseAgrReestrNum', 1, 314, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(31411054, 'Примечание документа(№ бюдж. обязат-ва плательщика)', 'SourceBudgetPromiseAgrNote', 'Дог. примечание', 'SourceBudgetPromiseAgrNote', 1, 314, 1, 1, 'ДоговораБОПримечаниеДоговора', 0, null) ;

CALL ImportField(31411055, 'Номер гос. контракта плательщика', 'SourceBudgetPromiseSONum', 'Номер гос. контракта плательщика', 'SourceBudgetPromiseAgrNum', 1, 314, 1, 1, 'ДоговораБОНомерКонтракта', 0, 19798) ;

CALL ImportField(31411056, 'Дата гос. контракта', 'SourceBudgetPromiseSODate', 'Дата гос. контракта', 'SourceBudgetPromiseAgrDate', 1, 314, 1, 1, 'ДоговораБОДатаКонтракта', 0, 19799) ;

CALL ImportField(31411057, 'Сумма гос. контракта плательщика', 'SourceBudgetPromiseSOSumma', 'Сумма гос. контракта плательщика', ' ', 1, 314, 1, 1, '', 0, null) ;

CALL ImportField(31411058, 'Реестровый номер гос. контр плательщика', 'SourceBudgetPromiseSORNum', 'Реестровый номер гос. контр плательщика', 'SourceBudgetPromiseAgrReestrNum', 1, 314, 1, 1, 'ДоговораБОРеестрНомерКонтракта', 0, 19830) ;

CALL ImportField(31411059, 'Прим. гос. контракта плательщика', 'SourceBudgetPromiseSONote', 'Прим. гос. контракта плательщика', 'SourceBudgetPromiseAgrNote', 1, 314, 1, 1, 'ДоговораБОПримечаниеКонтракта', 0, 19821) ;

CALL ImportField(31411072, 'Классификация', 'TreeOwner0', 'Классификация(группа)', ' ', 1, 314, 1, 0, '', 0, null) ;

CALL ImportField(31411074, 'ЭКИ(Классификация)', 'SourceIFS_KESR', 'ЭКИ(ИВнФ)', ' ', 1, 314, 1, 0, '', 0, 17054) ;

CALL ImportField(31411097, 'Вид дохода(Классификация)', 'SourceKD_DescriptionCode', 'Вид дохода(КД)', ' ', 1, 314, 1, 0, '', 0, 16831) ;

CALL ImportField(31411098, 'Подвид дохода(Классификация)', 'SourceKD_Program', 'Программа(КД)', ' ', 1, 314, 1, 0, '', 0, 16834) ;

CALL ImportField(31411099, 'ЭКД(Классификация)', 'SourceKD_KESR', 'ЭКД(КД)', ' ', 1, 314, 1, 0, '', 0, 16835) ;

CALL ImportField(31411101, 'Район трансферта', 'SourceRegionCls', 'Район', 'SourceRegionCls', 1, 314, 1, 1, 'Регион,РайонТрансферта', 0, 18927) ;

CALL ImportField(31411106, 'Док. исполнения плательщика', 'SourceExecDocCollaps', 'Док. исполнения плательщика', ' ', 1, 314, 1, 0, '', 0, null) ;

CALL ImportField(31411107, 'Номер(Док. исполнения плательщика)', 'SourceExecDocNum', 'Номер', 'SourceExecDocNum', 1, 314, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(31411109, 'Источник образования', 'SourceFundsSource', 'Источник образования', 'SourceFundsSource', 1, 314, 1, 0, 'ИсточникОбразованияСредств', 0, 18930) ;

CALL ImportField(31411110, 'Источниковая классификация', 'SourceIFS', 'Источниковая классификация', 'SourceIFS', 1, 314, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 18920) ;

CALL ImportField(31411111, 'Код дохода', 'SourceKD', 'Код дохода', 'SourceKD', 1, 314, 1, 1, 'КДКлюч', 0, 18925) ;

CALL ImportField(31411112, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 314, 1, 1, '', 0, 18872) ;

CALL ImportField(31411117, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 314, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(31411119, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'Progindex', 1, 314, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(31411120, 'Код целевых средствКлюч', 'SourceTransfertCls', 'Код целевых средств плательщика (ссылка)', 'SourceTransfertCls', 1, 314, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18935) ;

CALL ImportField(31411121, 'Код целевых средств получателя(Ключ)', '', 'Код целевых средств получателя (ссылка)', 'DestTransfertCls', 1, 314, 1, 1, '', 0, null) ;

CALL ImportField(31411122, 'Код целевых средств получателя', '', 'Код целевых средств получателя', 'DestTransfertClsValue', 1, 314, 1, 1, '', 0, null) ;

CALL ImportField(31411129, 'Код субсидииКлюч', 'SourceSubsidyCls', 'Код субсидии (ссылка)', 'SourceSubsidyCls', 1, 314, 1, 1, 'КодСубсидииКлюч', 0, 26626) ;

CALL ImportField(31411131, 'Наименование района трансферта', 'SourceRegionClsName', '', ' ', 1, 314, 1, 0, '', 0, null) ;

CALL ImportField(31411134, 'Код бюджетного ассигнованияКлюч', 'SourceBudAllocationCls', '', 'SourceBudAllocationCls', 1, 314, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27844) ;

CALL ImportField(31411135, 'Код расходного обязательстваКлюч', 'SourcePayPromiseCls', '', 'SourcePayPromiseCls', 1, 314, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27845) ;

-- Подтверждение возврата со счетов для наличности, Бюджет(1)
CALL ImportField(31510001, '№ п/п', 'DOCNUMBER', '№ п/п', 'DocumentNumber', 1, 315, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(31510002, 'Дата п/п', 'DOCUMENTDATE', 'Дата п/п', 'DocumentDate', 1, 315, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(31510003, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 315, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(31510004, 'Л/с средств в пути', 'SOURCEFACIALACC_CLS', 'Л/с средств в пути', 'SourceFacialAccCls', 1, 315, 0, 0, 'ЛицСчетПлательщика', 0, 18957) ;

CALL ImportField(31510005, 'Казн. счет плательщика', 'SourceAccountName', 'Казн. счет плательщика', ' ', 1, 315, 0, 0, '', 0, 17112) ;

CALL ImportField(31510006, 'Казн. счет получателя', 'DestAccountName', 'Казн. счет получателя', ' ', 1, 315, 0, 0, '', 0, 17112) ;

CALL ImportField(31510007, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 315, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(31510008, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 315, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(31510009, 'Очередность', 'PAYPRIORITY', 'Очередность', 'PayPriority', 1, 315, 0, 0, 'Очередность', 0, 18966) ;

CALL ImportField(31510010, 'Дата проводки', 'ACCEPTDATE', 'Дата проводки', 'AcceptDate', 1, 315, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(31510011, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', 'BUHPAYMENTCLS', 1, 315, 0, 0, 'БухПроводка', 0, 18968) ;

CALL ImportField(31510012, 'Архив', 'ARHIVEDOC', 'Архив', 'ARHIVEDOC', 1, 315, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(31510013, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 1, 315, 0, 0, 'ВидПлатежа', 0, 18963) ;

CALL ImportField(31510038, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 315, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(31510039, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (комментарий)', 'RejectCause', 1, 315, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(31510040, 'Направление операции', 'OperationDirection', 'Направление операции', 'OPERATIONDIRECTION', 1, 315, 0, 0, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(31510041, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 1, 315, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(31510042, 'Срок платежа', 'PAYDATE', 'Срок платежа', 'PayDate', 1, 315, 0, 0, 'СрокПлатежа', 0, 18951) ;

CALL ImportField(31510048, 'Информация для налогового платежа', 'TaxNote', 'Информация для налогового платежа', 'TaxNote', 1, 315, 0, 0, 'ИнформацияОНалоге', 0, 18991) ;

CALL ImportField(31510056, 'Заблокировано(Состояние блокировки)', 'IsBlocked', 'Заблокировано', ' ', 1, 315, 0, 0, 'ПризнакБлокировки', 0, 19012) ;

CALL ImportField(31510057, 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 'Причина блокировки', ' ', 1, 315, 0, 0, 'ПричинаБлокировки', 0, 19013) ;

CALL ImportField(31510058, 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 'Дата разблокировки', ' ', 1, 315, 0, 0, 'ДатаРазблокировки', 0, 19014) ;

CALL ImportField(31510059, 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 'Причина разблокировки', ' ', 1, 315, 0, 0, 'ПричинаРазблокировки', 0, 19015) ;

CALL ImportField(31510060, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 1, 315, 0, 0, 'ТипКлассификацииЗаголовок', 0, 19008) ;

CALL ImportField(31510062, 'Код документа', 'ID', 'Код документа', 'ID', 1, 315, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(31510063, 'cчет Dest', 'DESTACCOUNT', 'cчет Dest', 'DESTACCOUNT', 1, 315, 0, 1, 'РСФО,СчетПолуч', 0, 18958) ;

CALL ImportField(31510064, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 315, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(31510065, 'Казн. cчет(Мастер)', 'SOURCEACCOUNT', 'Казн. cчет(Мастер)', 'SOURCEACCOUNT', 1, 315, 0, 1, 'СчетПлат', 0, 18956) ;

CALL ImportField(31510075, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', ' ', 1, 315, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(31510076, 'Дата реестра', 'REESTRDATE', 'Дата реестра', ' ', 1, 315, 0, 1, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(31510077, 'Код отправителя документа', 'SENDERID', 'Код отправителя документа', 'SenderID', 1, 315, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(31510078, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'ProgIndex', 1, 315, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(31510079, 'Статус', 'Status', 'Статус', ' ', 1, 315, 0, 1, 'Статус', 0, null) ;

CALL ImportField(31510080, 'Электронный документ', 'ElDocRef', 'Электронный документ', ' ', 1, 315, 0, 1, '', 0, null) ;

CALL ImportField(31510081, 'Отдел', 'DepartmentCLS', '', 'DEPARTMENTCLS', 1, 315, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(31510082, 'Информация из ЭО', 'ElInfo', '', ' ', 1, 315, 0, 0, '', 0, null) ;

CALL ImportField(31510083, 'Назначение платежа(Информация из ЭО)', 'ElNote', '', ' ', 1, 315, 0, 0, 'ЭЛНазначениеПлатежа', 0, 19302) ;

CALL ImportField(31510084, 'Плательщик(Информация из ЭО)', 'ElPayer', '', ' ', 1, 315, 0, 0, '', 0, null) ;

CALL ImportField(31510085, 'Счет(Информация из ЭО\Плательщик)', 'ElPayerAcc', '', ' ', 1, 315, 0, 0, 'ЭЛСчетПлат', 0, 19320) ;

CALL ImportField(31510086, 'Банк(Информация из ЭО\Плательщик)', 'ElPayerBank', '', ' ', 1, 315, 0, 0, 'ЭЛИмяБанкаПлательщика', 0, 19380) ;

CALL ImportField(31510087, 'БИК(Информация из ЭО\Плательщик)', 'ElPayerBIK', '', ' ', 1, 315, 0, 0, 'ЭЛБИКБанкаПлательщика', 0, 19319) ;

CALL ImportField(31510088, 'ИНН(Информация из ЭО\Плательщик)', 'ElPayerINN', '', ' ', 1, 315, 0, 0, 'ЭЛИННОргПлательщика', 0, 19333) ;

CALL ImportField(31510089, 'КПП(Информация из ЭО\Плательщик)', 'ElPayerKPP', '', ' ', 1, 315, 0, 0, 'ЭЛКППОргПлательщика', 0, 19350) ;

CALL ImportField(31510090, 'Наименование плательщика(Информация из ЭО\Плательщик)', 'ElPayerName', '', ' ', 1, 315, 0, 0, 'ЭЛИмяОргПлательщика', 0, 19304) ;

CALL ImportField(31510091, 'Номер карточки', 'CardRefName', '', ' ', 1, 315, 0, 0, '', 0, 18939) ;

CALL ImportField(31511014, 'Лицевой счет участника операции', 'DESTFACIALACC_CLS', 'Лицевой счет участника операции', 'DestFacialAccCls', 1, 315, 1, 0, 'ЛицевойСчет', 0, 18869) ;

CALL ImportField(31511015, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 315, 1, 0, '', 0, null) ;

CALL ImportField(31511016, 'КВСРКлюч', 'DestKVSR', 'КВСР', 'DestKVSRKey', 1, 315, 1, 1, 'КВСРКлюч', 0, 18895) ;

CALL ImportField(31511017, 'ФКР(Классификация)', 'DestKFSR', 'КФСР', 'DestKFSR', 1, 315, 1, 0, 'КФСР', 0, 18897) ;

CALL ImportField(31511018, 'КЦСРКлюч', 'DestKCSR', 'КЦСР', 'DestKCSRKey', 1, 315, 1, 1, 'КЦСРКлюч', 0, 18896) ;

CALL ImportField(31511019, 'КВРКлюч', 'DESTKVR', 'КВР', 'DestKVRKey', 1, 315, 1, 1, 'КВРКлюч', 0, 18870) ;

CALL ImportField(31511020, 'ЭКР(Классификация)', 'DESTKESR', 'КЭСР', 'DestKESR', 1, 315, 1, 0, 'КЭСР', 0, 18871) ;

CALL ImportField(31511024, 'Вид источника(Классификация)', 'DestIFS_DescriptionCode', 'Вид источника', ' ', 1, 315, 1, 0, '', 0, 17050) ;

CALL ImportField(31511025, 'ЭКИ(Классификация)', 'DestIFS_KESR', 'ЭК', ' ', 1, 315, 1, 0, '', 0, 17054) ;

CALL ImportField(31511027, 'Вид дохода(Классификация)', 'DestKD_DescriptionCode', 'Вид дохода', ' ', 1, 315, 1, 0, '', 0, 16831) ;

CALL ImportField(31511028, 'Подвид дохода(Классификация)', 'DestKD_Program', 'Программа', ' ', 1, 315, 1, 0, '', 0, 16834) ;

CALL ImportField(31511029, 'ЭКД(Классификация)', 'DestKD_KESR', 'ЭКД', ' ', 1, 315, 1, 0, '', 0, 16835) ;

CALL ImportField(31511030, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'ClsType', 1, 315, 1, 1, 'ТипКлассификации', 0, 18922) ;

CALL ImportField(31511031, 'Суб КОСГУ', 'DestSubKESR', 'Суб КЭСР', 'DestSUBKESR', 1, 315, 1, 0, 'СубКЭСР', 0, 18898) ;

CALL ImportField(31511032, 'Тип документа', 'DestDocType', 'Тип документа', 'DestDOCTYPECLS', 1, 315, 1, 0, 'ТипДокумента', 0, 18903) ;

CALL ImportField(31511033, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 315, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(31511034, '№ мем. ордера', 'MEMORDERNUM', '№ мем. ордера', ' ', 1, 315, 1, 0, 'НомерМемордера', 0, null) ;

CALL ImportField(31511035, '№ БО получателя', 'DESTPROMISE', '№ БО получателя', 'DestPROMISE', 1, 315, 1, 0, 'БюджОбяз', 0, 18906) ;

CALL ImportField(31511036, 'Номер БО(№ бюдж. обязат-ва получателя)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', ' ', 1, 315, 1, 0, 'ДоговораБОНомер', 0, 20223) ;

CALL ImportField(31511037, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 315, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(31511043, 'Тип средств', 'DestMeansType', 'Тип средств', 'DestMEANSTYPECLS', 1, 315, 1, 0, 'ТипСредств', 0, 18900) ;

CALL ImportField(31511044, 'Район трансферта', 'DestRegionCls', 'Район', 'DestRegionCls', 1, 315, 1, 1, 'Регион,РайонТрансферта', 0, 18928) ;

CALL ImportField(31511046, 'Источник финансирования', 'DestFinSource', 'Источник финансирования', 'DestFINSOURCECLS', 1, 315, 1, 0, 'ИсточникФинансирования', 0, 18901) ;

CALL ImportField(31511049, '№ бюдж. обязат-ва получателя', 'DestBudgetPromiseCollaps', '№ бюдж. обязат-ва получателя', ' ', 1, 315, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(31511050, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', ' ', 1, 315, 1, 0, '', 0, null) ;

CALL ImportField(31511051, 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 'Номер', 'DestExecDocNum', 1, 315, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(31511052, 'Заблокировано(Состояние блокировки)', 'IsBlocked', 'Заблокировано', ' ', 1, 315, 1, 0, 'ПризнакБлокировки', 0, 18931) ;

CALL ImportField(31511053, 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 'Причина блокировки', ' ', 1, 315, 1, 0, 'ПричинаБлокировки', 0, 18932) ;

CALL ImportField(31511054, 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 'Дата разблокировки', ' ', 1, 315, 1, 0, 'ДатаРазблокировки', 0, 18933) ;

CALL ImportField(31511055, 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 'Причина разблокировки', ' ', 1, 315, 1, 0, 'ПричинаРазблокировки', 0, 18934) ;

CALL ImportField(31511061, 'Источник образования', 'DestFundsSource', 'Источник образования', 'DestFundsSource', 1, 315, 1, 0, 'ИсточникОбразованияСредств', 0, 18929) ;

CALL ImportField(31511066, 'Вн. номер БО получателя', 'DESTBUDGETPROMISE', 'Вн. номер БО получателя', 'DestBUDGETPROMISE', 1, 315, 1, 1, 'ДоговораБО', 0, 18909) ;

CALL ImportField(31511067, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Номер Д.И. получателя ссылка', 'DestExecDoc', 1, 315, 1, 1, 'ДокИсполнения', 0, 18918) ;

CALL ImportField(31511068, 'Источниковая классификация', 'DestIFS', 'Источниковая классификация', ' ', 1, 315, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 18921) ;

CALL ImportField(31511069, 'Код дохода', 'DestKD', 'Код дохода', ' ', 1, 315, 1, 1, 'КДКлюч', 0, 18926) ;

CALL ImportField(31511070, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 315, 1, 1, '', 0, 18872) ;

CALL ImportField(31511072, 'Код записи', 'ID', 'Код записи', 'Id', 1, 315, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(31511077, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 315, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(31511078, 'Код дохода', 'DestKD_Value', 'Код дохода', ' ', 1, 315, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(31511079, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'ProgIndex', 1, 315, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(31511080, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств (ссылка)', ' ', 1, 315, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18936) ;

CALL ImportField(31511087, 'Код субсидииКлюч', 'DestSubsidyCls', 'Код субсидии (ссылка)', 'DestSubsidyCls', 1, 315, 1, 1, 'КодСубсидииКлюч', 0, 26624) ;

CALL ImportField(31511089, 'Наименование района трансферта', 'DestRegionClsName', '', ' ', 1, 315, 1, 0, '', 0, null) ;

CALL ImportField(31511092, 'Код бюджетного ассигнованияКлюч', 'DestBudAllocationCls', '', ' ', 1, 315, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27842) ;

CALL ImportField(31511093, 'Код расходного обязательстваКлюч', 'DestPayPromiseCls', '', ' ', 1, 315, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27843) ;

-- Учет кассовых выплат, УРМ(0)
CALL ImportField(32201080, 'Код целевых средствКлюч', 'SourceTransfertCls', 'Код целевых средств (ссылка)', ' ', 0, 322, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(32201081, 'Код целевых средств', 'SourceTransfertClsCode', 'Код целевых средств', ' ', 0, 322, 1, 0, '', 0, null) ;

-- Учет кассовых выплат, Бюджет(1)
CALL ImportField(32210001, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', ' ', 1, 322, 0, 0, 'ВидПлатежа', 0, 18963) ;

CALL ImportField(32210002, '№ п/п', 'DOCNUMBER', '№ п/п', ' ', 1, 322, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(32210003, 'Дата п/п', 'DOCUMENTDATE', 'Дата п/п', ' ', 1, 322, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(32210004, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 322, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(32210005, 'Л/с плательщика', 'SOURCEFACIALACC_CLS', 'Л/с плательщика', ' ', 1, 322, 0, 0, 'ЛицевойСчет', 0, 18957) ;

CALL ImportField(32210006, 'Р/с бюджета', 'SourceAccountName', 'Р/с бюджета', ' ', 1, 322, 0, 0, '', 0, 17112) ;

CALL ImportField(32210007, 'Имя(Получатель)', 'NAME', 'Имя', ' ', 1, 322, 0, 0, '', 0, 16646) ;

CALL ImportField(32210008, 'ИНН(Получатель)', 'INN', 'ИНН', ' ', 1, 322, 0, 0, '', 0, 16645) ;

CALL ImportField(32210009, 'КПП(Получатель)', 'INN20', 'КПП', ' ', 1, 322, 0, 0, '', 0, 16653) ;

CALL ImportField(32210010, 'Счет(Получатель)', 'ACC', 'Счет', ' ', 1, 322, 0, 0, '', 0, 17112) ;

CALL ImportField(32210011, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', ' ', 1, 322, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(32210012, 'Назначение платежа(Информация о платеже)', 'NOTE', 'Назначение платежа', ' ', 1, 322, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(32210013, 'НДС(Информация о платеже)', 'NDS', 'НДС', ' ', 1, 322, 0, 0, 'НДС', 0, 18990) ;

CALL ImportField(32210014, 'Информация для налогового платежа(Информация о платеже)', 'TaxNote', 'Информация для налогового платежа', ' ', 1, 322, 0, 0, 'ИнформацияОНалоге', 0, 18991) ;

CALL ImportField(32210015, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', ' ', 1, 322, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(32210016, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (комментарий)', ' ', 1, 322, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(32210017, 'Очередность', 'PAYPRIORITY', 'Очередность', ' ', 1, 322, 0, 0, 'Очередность', 0, 18966) ;

CALL ImportField(32210018, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', ' ', 1, 322, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(32210019, 'Архив', 'ARHIVEDOC', 'Архив', ' ', 1, 322, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(32210020, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 322, 0, 0, 'БухОперацияЗаголовок', 0, 19007) ;

CALL ImportField(32210021, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 322, 0, 0, 'ТипКлассификации', 0, 19008) ;

CALL ImportField(32210036, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', ' ', 1, 322, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(32210037, 'Лиц. счет (РВС) ', 'DESTFACIALACC_CLS', 'Лиц. счет (РВС) ', ' ', 1, 322, 0, 0, 'ЛицСчетПолучателя', 0, 18959) ;

CALL ImportField(32210038, 'Срок платежа', 'PAYDATE', 'Срок платежа', ' ', 1, 322, 0, 0, 'СрокПлатежа', 0, 18951) ;

CALL ImportField(32210048, 'Получатель', 'ParentSource', 'Получатель', ' ', 1, 322, 0, 0, '', 0, null) ;

CALL ImportField(32210049, 'Информация о платеже', 'ParentNoteTax', 'Информация о платеже', ' ', 1, 322, 0, 0, '', 0, null) ;

CALL ImportField(32210053, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', ' ', 1, 322, 0, 1, 'БухПроводка', 0, 18968) ;

CALL ImportField(32210054, 'Код документа', 'ID', 'Код документа', ' ', 1, 322, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(32210055, 'Направление операции', 'OperationDirection', 'Направление операции', ' ', 1, 322, 0, 0, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(32210056, 'Отдел', 'DepartmentCls', 'Отдел', ' ', 1, 322, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(32210057, 'Казн. cчет(Мастер)', 'SOURCEACCOUNT', 'Казн. cчет(Мастер)', ' ', 1, 322, 0, 1, 'РСФО,СчетПлат', 0, 18956) ;

CALL ImportField(32210058, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', ' ', 1, 322, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(32210066, 'Признак принятости реестра', 'Accepted', 'Признак принятости реестра', ' ', 1, 322, 0, 1, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(32210068, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', ' ', 1, 322, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(32210070, 'Уточнение индекса данных', 'SubProgIndex', 'Уточнение индекса данных', ' ', 1, 322, 0, 1, '', 0, null) ;

CALL ImportField(32210071, 'Счетчик факсов', 'FaxDocCount', 'Счетчик факсов', ' ', 1, 322, 0, 1, '', 0, null) ;

CALL ImportField(32210072, 'Ссылка на сводное ПП', 'IntegratedDocRef', 'Ссылка на сводное ПП', ' ', 1, 322, 0, 1, '', 0, null) ;

CALL ImportField(32210073, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', ' ', 1, 322, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(32210074, 'Обмен с УФК', 'ParentElBank', 'Обмен с УФК', ' ', 1, 322, 0, 0, '', 0, null) ;

CALL ImportField(32210075, 'Статус(Обмен с УФК)', 'Status', 'Статус(Обмен с УФК)', ' ', 1, 322, 0, 1, 'Статус', 0, 17233) ;

CALL ImportField(32210076, 'Номер л/с плательщика', 'SourceFacialCodeEx', '', ' ', 1, 322, 0, 0, '', 0, 26617) ;

CALL ImportField(32211022, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 322, 1, 0, '', 0, null) ;

CALL ImportField(32211023, 'КВСРКлюч', 'SourceKVSR', 'КВСР', ' ', 1, 322, 1, 1, 'КВСРКлюч', 0, 18886) ;

CALL ImportField(32211024, 'ФКР(Классификация)', 'SourceKFSR', 'КФСР', ' ', 1, 322, 1, 0, 'КФСР', 0, 18888) ;

CALL ImportField(32211025, 'КЦСРКлюч', 'SourceKCSR', 'КЦСР', ' ', 1, 322, 1, 1, 'КЦСРКлюч', 0, 18887) ;

CALL ImportField(32211026, 'КВРКлюч', 'SOURCEKVR', 'КВР', ' ', 1, 322, 1, 1, 'КВРКлюч', 0, 18867) ;

CALL ImportField(32211027, 'ЭКР(Классификация)', 'SOURCEKESR', 'КЭСР', ' ', 1, 322, 1, 0, 'КЭСР', 0, 18868) ;

CALL ImportField(32211031, 'Вид источника(Классификация)', 'SourceIFS_DescriptionCode', 'Вид источника', ' ', 1, 322, 1, 0, '', 0, 17050) ;

CALL ImportField(32211032, 'ЭКИ(Классификация)', 'SourceIFS_KESR', 'ЭКИ', ' ', 1, 322, 1, 0, '', 0, 17054) ;

CALL ImportField(32211033, 'Тип средств', 'SourceMeansType', 'Тип средств', ' ', 1, 322, 1, 0, 'ТипСредств', 0, 18891) ;

CALL ImportField(32211034, 'Сумма (руб)', 'SUMMA', 'Сумма (руб)', ' ', 1, 322, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(32211039, 'Суб КОСГУ', 'SourceSubKESR', 'Суб КЭСР', ' ', 1, 322, 1, 0, 'СубКЭСР', 0, 18889) ;

CALL ImportField(32211040, 'Район трансферта', 'SourceRegionCls', 'Район', ' ', 1, 322, 1, 0, 'Регион,РайонТрансферта', 0, 18927) ;

CALL ImportField(32211041, 'Источник финансирования', 'SourceFinSource', 'Источник финансирования', ' ', 1, 322, 1, 0, 'ИсточникФинансирования', 0, 18892) ;

CALL ImportField(32211043, 'Тип документа', 'SourceDocType', 'Тип документа', ' ', 1, 322, 1, 0, 'ТипДокумента', 0, 18894) ;

CALL ImportField(32211045, '№ БО плательщика', 'SOURCEPROMISE', '№ БО плательщика', ' ', 1, 322, 1, 0, 'БюджОбяз', 0, 18905) ;

CALL ImportField(32211046, 'Номер БО(№ бюдж. обязат-ва плательщика)', 'SOURCEBUDGETPROMISENUM', 'Номер БО плательщика(договора)', ' ', 1, 322, 1, 0, 'ДоговораБОНомер', 0, 20223) ;

CALL ImportField(32211047, 'Операция', 'BuhOperationCLS', 'Бухгалтерская операция', ' ', 1, 322, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(32211050, '№ бюдж. обязат-ва плательщика', 'SourceBudgetPromiseCollaps', '№ бюдж. обязат-ва плательщика', ' ', 1, 322, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(32211051, 'Док. исполнения плательщика', 'SourceExecDocCollaps', 'Док. исполнения плательщика', ' ', 1, 322, 1, 0, '', 0, null) ;

CALL ImportField(32211052, 'Номер(Док. исполнения плательщика)', 'SourceExecDocNum', 'Номер', ' ', 1, 322, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(32211060, 'Вн. номер БО плательщика', 'SOURCEBUDGETPROMISE', 'Вн. номер БО плательщика', ' ', 1, 322, 1, 1, 'ДоговораБО', 0, 18908) ;

CALL ImportField(32211061, 'Номер Д.И. плательщика ссылка', 'SourceExecDoc', 'Номер Д.И. плательщика ссылка', ' ', 1, 322, 1, 1, 'ДокИсполнения', 0, 18917) ;

CALL ImportField(32211062, 'Источниковая классификация', 'SourceIFS', 'Источниковая классификация', ' ', 1, 322, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 18920) ;

CALL ImportField(32211063, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 322, 1, 1, '', 0, 18872) ;

CALL ImportField(32211064, 'Код документа', 'RECORDINDEX', 'Код документа', ' ', 1, 322, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(32211065, 'Код записи', 'ID', 'Код записи', ' ', 1, 322, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(32211069, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 322, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(32211070, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', ' ', 1, 322, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(32211074, 'Код целевых средствКлюч', 'SourceTransfertCls', 'Код целевых средств (ссылка)', ' ', 1, 322, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18935) ;

CALL ImportField(32211082, 'Код бюджетного ассигнованияКлюч', 'SourceBudAllocationCls', '', ' ', 1, 322, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27844) ;

CALL ImportField(32211083, 'Код расходного обязательстваКлюч', 'SourcePayPromiseCls', '', ' ', 1, 322, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27845) ;

CALL ImportField(32211084, 'Код субсидииКлюч', 'SourceSubsidyCls', '', ' ', 1, 322, 1, 1, 'КодСубсидииКлюч', 0, 26626) ;

-- Утверждение ОФ, УРМ(0)
CALL ImportField(32300069, '№ док.', 'DOCNUMBER', '№ док.', 'DocNumber', 0, 323, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(32300070, 'Дата документа', 'DOCUMENTDATE', 'Дата документа', 'DocumentDate', 0, 323, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(32300071, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 323, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(32300072, 'Р/с бюджета', 'SourceAccountName', 'Р/с бюджета', ' ', 0, 323, 0, 0, '', 0, null) ;

CALL ImportField(32300073, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 0, 323, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(32300074, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 0, 323, 0, 0, 'Примечание', 0, null) ;

CALL ImportField(32300075, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', 'AcceptDate', 0, 323, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(32300076, 'Операция', 'BuhOperationCLS', 'Операция', 'BUHOPERATIONCLS', 0, 323, 0, 0, 'БухОперацияЗаголовок', 0, null) ;

CALL ImportField(32300077, 'Тип классификации', 'ClsType', 'Тип классификации', 'CLSTYPE', 0, 323, 0, 0, 'ТипКлассификации,ТипКлассификацииПлат', 0, null) ;

CALL ImportField(32300095, 'Номер реестра', 'REESTRNUMBER', 'Номер реестра', 'ReestrNumber', 0, 323, 0, 0, 'НомерРеестра', 0, null) ;

CALL ImportField(32300096, 'Л/с(НРС) ', 'SOURCEFACIALACC_CLS', 'Л/с(НРС) ', 'SourceFacialAccCls', 0, 323, 0, 0, 'ЛицСчетПлательщика', 0, null) ;

CALL ImportField(32300116, 'Статус ЭЦП', 'CryptoStatus', '', ' ', 0, 323, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(32300117, 'Дата реестра', 'REESTRDATE', 'Дата реестра', ' ', 0, 323, 0, 1, 'ДатаРеестра', 0, null) ;

CALL ImportField(32300120, 'Бух. проводка', 'BUHPAYMENTCLS', 'Бух. проводка', 'DestType', 0, 323, 0, 1, 'БухПроводка', 0, null) ;

CALL ImportField(32300121, 'Код документа', 'ID', 'Код документа', 'ID', 0, 323, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(32300123, 'Направление операции', 'OperationDirection', 'Направление операции', 'OPERATIONDIRECTION', 0, 323, 0, 0, 'НаправлениеОперации', 0, null) ;

CALL ImportField(32300124, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 0, 323, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(32300125, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (комментарий)', 'RejectCause', 0, 323, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(32300126, 'Казн. cчет', 'DESTACCOUNT', 'Казн. cчет', 'DESTACCOUNT', 0, 323, 0, 1, 'СчетПолуч', 0, null) ;

CALL ImportField(32300127, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 0, 323, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(32300128, 'Казн. cчет(Мастер)', 'SOURCEACCOUNT', 'Казн. cчет(Мастер)', 'SourceBankCity', 0, 323, 0, 1, 'РСФО,СчетПлат', 0, null) ;

CALL ImportField(32300135, 'Срок платежа', 'PayDate', 'Срок платежа', 'PayDate', 0, 323, 0, 0, 'СрокПлатежа', 0, null) ;

CALL ImportField(32300150, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300151, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300154, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 0, 323, 0, 0, 'ТипОперации', 0, null) ;

CALL ImportField(32300157, 'Мягкая причина отклонения (текст)', 'SoftRejectCause', 'Мягкая причина отклонения (текст)', 'SoftRejectCause', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300158, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300159, 'Казн. счет получ.', 'DestAccountName', 'Казн. счет получ.', ' ', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300161, 'Л/с ФК получ. (заг.)', 'DestFacialCode', 'Л/c ФК получ. заг.', ' ', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300183, 'Кассовый символ', 'PaySymbolCls', '', ' ', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300184, 'Вид платежа', 'PayTypeCls', '', ' ', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300186, 'Код ФО документа', 'FUID', 'Код ФО документа', 'FUID', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300188, 'Максимальная дата принятия в детализации', 'DetAcceptDate', '', ' ', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300190, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300191, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300192, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 323, 0, 1, '', 0, null) ;

CALL ImportField(32300193, 'Прогиндекс', 'ProgIndex', 'Прогиндекс', ' ', 0, 323, 0, 1, 'ИндексыДанныхЗаголовок', 0, null) ;

CALL ImportField(32301079, 'Л/с получателя', 'DESTFACIALACC_CLS', 'Л/с получателя', 'DestFacialAccCls', 0, 323, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(32301080, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 0, 323, 1, 0, '', 0, null) ;

CALL ImportField(32301081, 'КВСРКлюч', 'DestKVSR', 'КВСР', 'DestKVSRKey', 0, 323, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(32301082, 'КФСР(Классификация)', 'DestKFSR', 'КФСР', 'DestKFSR', 0, 323, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(32301083, 'КЦСРКлюч', 'DestKCSR', 'КЦСР', 'DestKCSRKey', 0, 323, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(32301084, 'КВР Ключ', 'DESTKVR', 'КВР ', 'DestKVRKey', 0, 323, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(32301085, 'КЭСР(Классификация)', 'DESTKESR', 'КЭСР', 'DestKESR', 0, 323, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(32301091, 'Тип средств', 'DestMeansType', 'Тип средств', 'DestMEANSTYPECLS', 0, 323, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(32301092, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 0, 323, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(32301093, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 0, 323, 1, 0, 'ПримечаниеДеталь', 0, null) ;

CALL ImportField(32301098, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'ACCEPTDATE', 0, 323, 1, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(32301099, 'Суб КЭСР', 'DestSubKESR', 'Суб КЭСР', 'DestSUBKESR', 0, 323, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(32301100, 'Район', 'DestRegionCls', 'Район', 'DESTREGIONCLS', 0, 323, 1, 0, 'Регион,РайонТрансферта', 0, null) ;

CALL ImportField(32301101, 'Источник финансирования', 'DestFinSource', 'Источник финансирования', 'DestFINSOURCECLS', 0, 323, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(32301103, 'Тип документа', 'DestDocType', 'Тип документа', 'DestDOCTYPECLS', 0, 323, 1, 0, 'ТипДокумента', 0, null) ;

CALL ImportField(32301105, '№ мем. ордера', 'MEMORDERNUM', '№ мем. ордера', 'MemOrderNum', 0, 323, 1, 0, 'НомерМемордера', 0, null) ;

CALL ImportField(32301106, '№ бюдж. обязат-ва', 'DestPromise', '№ бюдж. обязат-ва', 'DestPROMISE', 0, 323, 1, 0, '', 0, null) ;

CALL ImportField(32301107, 'Номер БО получателя(№ бюдж. обязат-ва получателя)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', ' ', 0, 323, 1, 0, 'БОНомер,ДоговораБОНомер', 0, null) ;

CALL ImportField(32301108, 'Л/с получателя в ФК', 'DestFacialCode', 'Л/с получателя в ФК', ' ', 0, 323, 1, 0, '', 0, null) ;

CALL ImportField(32301109, '№ бюдж. обязат-ва получателя', 'DestBudgetPromiseCollaps', '№ бюдж. обязат-ва получателя', ' ', 0, 323, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(32301110, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', ' ', 0, 323, 1, 0, '', 0, null) ;

CALL ImportField(32301111, 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 'Номер', 'DestExecDocNum', 0, 323, 1, 0, 'ДокИсполненияНомер', 0, null) ;

CALL ImportField(32301129, 'Вн. номер БО получателя', 'DESTBUDGETPROMISE', 'Вн. номер БО получателя', 'DestBUDGETPROMISE', 0, 323, 1, 1, 'БОВнутрНомер,ДоговораБО', 0, null) ;

CALL ImportField(32301130, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Номер Д.И. получателя ссылка', 'DestExecDoc', 0, 323, 1, 1, 'ДокИсполнения', 0, null) ;

CALL ImportField(32301131, 'Источниковая классификация', 'DestIFS', 'Источниковая классификация', 'DestIFS', 0, 323, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПолуч', 0, null) ;

CALL ImportField(32301132, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301133, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 0, 323, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(32301134, 'Код записи', 'ID', 'Код записи', 'Id', 0, 323, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(32301145, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств (ссылка)', 'DestTransfertCls', 0, 323, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(32301146, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств', 'DestTransfertClsValue', 0, 323, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(32301147, 'КЦСР(Классификация)', 'DestKCSRCode', '', 'DestKCSR', 0, 323, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(32301148, 'КВР (Классификация)', 'DESTKVRCode', '', 'DestKVR', 0, 323, 1, 0, 'КВР', 0, null) ;

CALL ImportField(32301149, 'КВСР(Классификация)', 'DestKVSRCode', '', 'DestKVSR', 0, 323, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(32301162, 'Получатель', 'DestFacialAccName', 'Получатель', ' ', 0, 323, 1, 0, '', 0, null) ;

CALL ImportField(32301163, 'Распрорядитель получателя', 'DestGeneralOrg', 'Распрорядитель получателя', ' ', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301164, 'Источник внутр. и внеш. финанс.', 'DestIFSCode', 'Источник внутр. и внеш. финанс.', 'DestIFS_DescriptionCode', 0, 323, 1, 0, 'ИсточникВнутрФинансирования,ИсточникВнутрФинансированияПолуч', 0, null) ;

CALL ImportField(32301165, 'Дата договора получателя', 'DestBudgetPromiseDocDate', 'Дата договора получателя', 'DestBudgetPromiseDocDate', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301166, 'Примечание договора получателя', 'DestBudgetPromiseDocNote', 'Примечание договора получателя', 'DestBudgetPromiseDocNote', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301167, 'Номер договора получателя', 'DestBudgetPromiseDocNumber', 'Номер договора получателя', 'DestBudgetPromiseDocNumber', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301168, 'Реестровый номер договора получателя', 'DestBudgetPromiseDocReestrNum', 'Реестровый номер договора получателя', 'DestBudgetPromiseDocReestrNum', 0, 323, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(32301169, 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301170, 'Дата гос. контракта', 'DestBudgetPromiseSODate', 'Дата гос. контракта', 'DestBudgetPromiseSODate', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301171, 'ИД контракта', 'DestBudgetPromiseSOID', '', ' ', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301172, 'Прим. гос. контракта', 'DestBudgetPromiseSONote', 'Прим. гос. контракта', 'DestBudgetPromiseSONote', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301173, 'Номер гос. контракта', 'DestBudgetPromiseSONum', 'Номер гос. контракта', 'DestBudgetPromiseSONum', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301174, 'Реестровый номер гос. контр', 'DestBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр', 'DestBudgetPromiseSOReestrNum', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301175, 'Сумма гос. контракта', 'DestBudgetPromiseSOSumma', 'Сумма гос. контракта', 'DestBudgetPromiseSOSumma', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301176, 'Сумма БО получателя', 'DestBudgetPromiseSumma', 'Сумма БО получателя', 'DestBudgetPromiseSumma', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301177, 'Дата', 'DestExecDocDate', 'Дата', 'DestExecDocDate', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301178, 'Назначение', 'DestExecDocNote', 'Назначение', 'DestExecDocNote', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301179, 'Реестровый номер', 'DestExecDocReestr', 'Реестровый номер', 'DestExecDocReestr', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301180, 'Сумма док. исполнения получателя', 'DestExecDocSumma', 'Сумма док. исполнения получателя', 'DestExecDocSumma', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301181, 'Тип документа исполнения', 'DestExecDocType', 'Тип документа исполнения', 'DestExecDocType', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301182, 'Вид ассигнование получ.', 'DestAssignmentKind', 'Вид ассигнование получ.', 'DestAssignmentKind', 0, 323, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(32301187, 'Код ФО записи', 'FUID', 'Код ФО записи', 'FUID', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301194, 'Кассовый символ', 'PaySymbolCls', '', ' ', 0, 323, 1, 0, '', 0, null) ;

CALL ImportField(32301196, 'Код цели', 'TargetCls', 'Код цели', ' ', 0, 323, 1, 1, '', 0, null) ;

CALL ImportField(32301197, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', ' ', 0, 323, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(32301198, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', ' ', 0, 323, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(32301199, 'Код субсидииКлюч', 'DestSubsidyCls', '', ' ', 0, 323, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(32301200, 'Код субсидии', 'DestSubsidyClsCode', '', ' ', 0, 323, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(32301201, 'Код бюджетного ассигнования (ключ)', 'DestBudAllocationCls', '', ' ', 0, 323, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(32301202, 'Код расходного обязательства (ключ)', 'DestPayPromiseCls', '', ' ', 0, 323, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

CALL ImportField(32301203, 'Район бюджетного учреждения', 'RegionBudgetEst', 'Район бюджетного учреждения', 'RegionBudgetEst', 0, 323, 1, 1, '', 0, null) ;

-- Утверждение ОФ, Бюджет(1)
CALL ImportField(32310001, '№ док.', 'DOCNUMBER', '№ док.', 'DocNumber', 1, 323, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(32310002, 'Дата документа', 'DOCUMENTDATE', 'Дата документа', 'DocumentDate', 1, 323, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(32310003, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 323, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(32310004, 'Р/с бюджета', 'SourceAccountName', 'Р/с бюджета', ' ', 1, 323, 0, 0, '', 0, 17112) ;

CALL ImportField(32310005, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 323, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(32310006, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 323, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(32310007, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', 'AcceptDate', 1, 323, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(32310008, 'Операция', 'BuhOperationCLS', 'Операция', 'BUHOPERATIONCLS', 1, 323, 0, 0, 'БухОперацияЗаголовок', 0, 19007) ;

CALL ImportField(32310009, 'Тип классификации', 'ClsType', 'Тип классификации', 'CLSTYPE', 1, 323, 0, 0, 'ТипКлассификации,ТипКлассификацииПлат', 0, 19008) ;

CALL ImportField(32310010, 'Архив', 'ARHIVEDOC', 'Архив', 'ARHIVEDOC', 1, 323, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(32310027, 'Номер реестра', 'REESTRNUMBER', 'Номер реестра', 'ReestrNumber', 1, 323, 0, 0, 'НомерРеестра', 0, 19090) ;

CALL ImportField(32310028, 'Л/с(НРС) ', 'SOURCEFACIALACC_CLS', 'Л/с(НРС) ', 'SourceFacialAccCls', 1, 323, 0, 0, 'ЛицСчетПлательщика', 0, 18957) ;

CALL ImportField(32310029, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 1, 323, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(32310044, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', 'DestType', 1, 323, 0, 1, 'БухПроводка', 0, 18968) ;

CALL ImportField(32310045, 'Код документа', 'ID', 'Код документа', 'ID', 1, 323, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(32310046, 'Код реестра', 'REESTR_REF', 'Код реестра', 'Reestr_Ref', 1, 323, 0, 1, 'КодРеестра', 0, 18971) ;

CALL ImportField(32310047, 'Направление операции', 'OperationDirection', 'Направление операции', 'OPERATIONDIRECTION', 1, 323, 0, 1, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(32310048, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 323, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(32310049, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (комментарий)', 'RejectCause', 1, 323, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(32310050, 'Казн. cчет', 'DESTACCOUNT', 'Казн. cчет', 'DESTACCOUNT', 1, 323, 0, 1, 'СчетПолуч', 0, 18958) ;

CALL ImportField(32310051, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 323, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(32310052, 'Казн. cчет(Мастер)', 'SOURCEACCOUNT', 'Казн. cчет(Мастер)', 'SourceBankCity', 1, 323, 0, 1, 'РСФО,СчетПлат', 0, 18956) ;

CALL ImportField(32310059, 'Код удаленного клиента', 'SENDERID', 'Код отправителя документа', 'SenderID', 1, 323, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(32310060, 'Код УРМ документа', 'SENDERRECORDID', 'Код УРМ документа', 'SenderRecordID', 1, 323, 0, 1, 'КодУРМДокумента', 0, 18970) ;

CALL ImportField(32310061, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', 'FEDERALFUNDSREESTR', 1, 323, 0, 0, '', 0, null) ;

CALL ImportField(32310062, 'Федеральные cредства', 'FEDERALFUNDSREF', 'Федеральные cредства', 'FEDERALFUNDSREF', 1, 323, 0, 1, 'ФедеральныеСредства', 0, 19004) ;

CALL ImportField(32310063, 'Признак принятости реестра', 'Accepted', 'Признак принятости реестра', 'Accepted', 1, 323, 0, 1, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(32310065, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 323, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(32310066, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 1, 323, 0, 1, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(32310136, 'Срок платежа', 'PayDate', 'Срок платежа', 'PayDate', 1, 323, 0, 1, 'СрокПлатежа', 0, 18951) ;

CALL ImportField(32310137, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'ProgIndex', 1, 323, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(32310138, 'Л/с получ. (заг.)', 'DestFacialAcc_Cls', 'Л/c получ. заг.', 'DestFacialAccCls', 1, 323, 0, 0, 'ЛицевойСчет', 0, 18959) ;

CALL ImportField(32310139, 'Отдел', 'DepartmentCLS', '', ' ', 1, 323, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(32311012, 'Л/с получателя', 'DESTFACIALACC_CLS', 'Л/с получателя', 'DestFacialAccCls', 1, 323, 1, 0, 'ЛицевойСчет', 0, 18869) ;

CALL ImportField(32311013, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 323, 1, 0, '', 0, null) ;

CALL ImportField(32311014, 'КВСРКлюч', 'DestKVSR', 'КВСР', 'DestKVSRKey', 1, 323, 1, 1, 'КВСРКлюч', 0, 18895) ;

CALL ImportField(32311015, 'ФКР(Классификация)', 'DestKFSR', 'КФСР', 'DestKFSR', 1, 323, 1, 0, 'КФСР', 0, 18897) ;

CALL ImportField(32311016, 'КЦСРКлюч', 'DestKCSR', 'КЦСР', 'DestKCSRKey', 1, 323, 1, 1, 'КЦСРКлюч', 0, 18896) ;

CALL ImportField(32311017, 'КВР Ключ', 'DESTKVR', 'КВР ', 'DestKVRKey', 1, 323, 1, 1, 'КВРКлюч', 0, 18870) ;

CALL ImportField(32311018, 'ЭКР(Классификация)', 'DESTKESR', 'КЭСР', 'DestKESR', 1, 323, 1, 0, 'КЭСР', 0, 18871) ;

CALL ImportField(32311022, 'Вид источника(Классификация)', 'DestIFS_DescriptionCode', 'Вид источника', ' ', 1, 323, 1, 0, '', 0, 17050) ;

CALL ImportField(32311023, 'ЭКИ(Классификация)', 'DestIFS_KESR', 'ЭК', ' ', 1, 323, 1, 0, '', 0, 17054) ;

CALL ImportField(32311024, 'Тип средств', 'DestMeansType', 'Тип средств', 'DestMEANSTYPECLS', 1, 323, 1, 0, 'ТипСредств', 0, 18900) ;

CALL ImportField(32311025, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 323, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(32311026, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 323, 1, 0, 'ПримечаниеДеталь', 0, 18876) ;

CALL ImportField(32311030, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'ACCEPTDATE', 1, 323, 1, 0, 'ДатаПринятия', 0, 18924) ;

CALL ImportField(32311031, 'Суб КОСГУ', 'DestSubKESR', 'Суб КЭСР', 'DestSUBKESR', 1, 323, 1, 0, 'СубКЭСР', 0, 18898) ;

CALL ImportField(32311032, 'Район трансферта', 'DestRegionCls', 'Район', 'DESTREGIONCLS', 1, 323, 1, 0, 'Регион,РайонТрансферта', 0, 18928) ;

CALL ImportField(32311033, 'Источник финансирования', 'DestFinSource', 'Источник финансирования', 'DestFINSOURCECLS', 1, 323, 1, 0, 'ИсточникФинансирования', 0, 18901) ;

CALL ImportField(32311035, 'Тип документа', 'DestDocType', 'Тип документа', 'DestDOCTYPECLS', 1, 323, 1, 0, 'ТипДокумента', 0, 18903) ;

CALL ImportField(32311037, '№ мем. ордера', 'MEMORDERNUM', '№ мем. ордера', 'MemOrderNum', 1, 323, 1, 0, 'НомерМемордера', 0, 18875) ;

CALL ImportField(32311039, 'Номер БО(№ бюдж. обязат-ва получателя)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', ' ', 1, 323, 1, 0, 'БОНомер,ДоговораБОНомер', 0, 20223) ;

CALL ImportField(32311040, 'Л/с получателя в ФК', 'destfacialcode', 'Л/с получателя в ФК', ' ', 1, 323, 1, 0, '', 0, null) ;

CALL ImportField(32311041, '№ бюдж. обязат-ва получателя', 'DestBudgetPromiseCollaps', '№ бюдж. обязат-ва получателя', ' ', 1, 323, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(32311042, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', ' ', 1, 323, 1, 0, '', 0, null) ;

CALL ImportField(32311043, 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 'Номер', 'DestExecDocNum', 1, 323, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(32311053, 'Вн. номер БО получателя', 'DESTBUDGETPROMISE', 'Вн. номер БО получателя', 'DestBUDGETPROMISE', 1, 323, 1, 1, 'БОВнутрНомер,ДоговораБО', 0, 18909) ;

CALL ImportField(32311054, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Номер Д.И. получателя ссылка', 'DestExecDoc', 1, 323, 1, 1, 'ДокИсполнения', 0, 18918) ;

CALL ImportField(32311055, 'Источниковая классификация', 'DestIFS', 'Источниковая классификация', 'DestIFS', 1, 323, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПолуч', 0, 18921) ;

CALL ImportField(32311056, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 323, 1, 1, '', 0, 18872) ;

CALL ImportField(32311057, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 323, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(32311058, 'Код записи', 'ID', 'Код записи', 'Id', 1, 323, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(32311067, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 323, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(32311068, 'Источниковая классификация', 'DestIFS_FullID', 'DestIFS_FullID(Источниковая классификация)', 'DestIFS_DescriptionCode', 1, 323, 1, 1, 'ИсточникВнутрФинансирования,ИсточникВнутрФинансированияПолуч', 0, null) ;

CALL ImportField(32311137, 'Вид ассигнований', 'DestAssignmentKind', 'Вид ассигнований', 'DestAssignmentKind', 1, 323, 1, 0, 'ВидАссигнований', 0, 25178) ;

CALL ImportField(32311138, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'ProgIndex', 1, 323, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(32311139, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств (ссылка)', 'DestTransfertCls', 1, 323, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18936) ;

CALL ImportField(32311145, 'Номер л/с получателя', 'DestFacialCodeEx', '', ' ', 1, 323, 1, 0, '', 0, 26617) ;

CALL ImportField(32311146, 'Наименование района трансферта', 'DestRegionClsName', '', ' ', 1, 323, 1, 0, '', 0, null) ;

CALL ImportField(32311149, 'Код субсидииКлюч', 'DestSubsidyCls', '', 'DestSubsidyCls', 1, 323, 1, 1, 'КодСубсидииКлюч', 0, 26624) ;

CALL ImportField(32311151, 'Код бюджетного ассигнованияКлюч', 'DestBudAllocationCls', '', 'DestBudAllocationCls', 1, 323, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27842) ;

CALL ImportField(32311152, 'Код расходного обязательстваКлюч', 'DestPayPromiseCls', '', 'DestPayPromiseCls', 1, 323, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27843) ;

-- Распределение ОФ, УРМ(0)
CALL ImportField(32400088, '№ док.', 'DOCNUMBER', '№ док.', ' ', 0, 324, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(32400089, 'Дата документа', 'DOCUMENTDATE', 'Дата документа', ' ', 0, 324, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(32400090, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 324, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(32400092, 'Р/с бюджета', 'SourceAccountName', 'Р/с бюджета', ' ', 0, 324, 0, 0, '', 0, null) ;

CALL ImportField(32400093, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', ' ', 0, 324, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(32400094, 'Назначение платежа', 'NOTE', 'Назначение платежа', ' ', 0, 324, 0, 0, 'Примечание', 0, null) ;

CALL ImportField(32400095, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', 'ACCEPTDATE', 0, 324, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(32400096, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 0, 324, 0, 0, 'БухОперация', 0, null) ;

CALL ImportField(32400097, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 0, 324, 0, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(32400118, 'Номер реестра', 'REESTRNUMBER', 'Номер реестра', ' ', 0, 324, 0, 1, 'НомерРеестра', 0, null) ;

CALL ImportField(32400131, 'Л/С плательщика в ФК', 'SourceFACIALCODE', 'Л/С плательщика в ФК', ' ', 0, 324, 0, 0, '', 0, null) ;

CALL ImportField(32400152, 'Дата реестра', 'REESTRDATE', 'Дата реестра', ' ', 0, 324, 0, 1, 'ДатаРеестра', 0, null) ;

CALL ImportField(32400154, 'Бух. проводка', 'BUHPAYMENTCLS', 'Бух. проводка', ' ', 0, 324, 0, 1, 'БухПроводка', 0, null) ;

CALL ImportField(32400155, 'Код документа', 'ID', 'Код документа', ' ', 0, 324, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(32400157, 'Направление операции', 'OperationDirection', 'Направление операции', ' ', 0, 324, 0, 0, 'НаправлениеОперации', 0, null) ;

CALL ImportField(32400158, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 0, 324, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(32400159, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (комментарий)', 'REJECTCAUSE', 0, 324, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(32400160, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', ' ', 0, 324, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(32400163, 'Срок платежа', 'PayDate', 'Срок платежа', 'PayDate', 0, 324, 0, 0, '', 0, null) ;

CALL ImportField(32400191, 'Вид операции', 'TypeOperationCls', 'Вид операции', 'TypeOperationCls', 0, 324, 0, 0, 'ТипОперации', 0, null) ;

CALL ImportField(32400193, 'Л/с получателя заг.', 'DestFacialCode', 'Л/с получателя заг.', ' ', 0, 324, 0, 1, '', 0, null) ;

CALL ImportField(32400215, 'Код ФО документа', 'FUID', 'Код ФО документа', 'FUID', 0, 324, 0, 1, '', 0, null) ;

CALL ImportField(32400217, 'Максимальная дата принятия в детализации', 'DetAcceptDate', '', ' ', 0, 324, 0, 1, '', 0, null) ;

CALL ImportField(32400218, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 324, 0, 1, '', 0, null) ;

CALL ImportField(32400219, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 324, 0, 1, '', 0, null) ;

CALL ImportField(32400220, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 324, 0, 1, '', 0, null) ;

CALL ImportField(32400239, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 324, 0, 1, '', 0, null) ;

CALL ImportField(32400240, 'Казн. счет получ.', 'DestAccountName', 'Казн. счет получ.', ' ', 0, 324, 0, 1, '', 0, null) ;

CALL ImportField(32400242, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 324, 0, 1, '', 0, null) ;

CALL ImportField(32400243, 'Мягкая причина отклонения (текст)', 'SoftRejectCause', 'Мягкая причина отклонения (текст)', 'SoftRejectCause', 0, 324, 0, 1, '', 0, null) ;

CALL ImportField(32400244, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 324, 0, 1, '', 0, null) ;

CALL ImportField(32400245, 'Прогиндекс', 'ProgIndex', 'Прогиндекс', ' ', 0, 324, 0, 1, 'ИндексыДанныхЗаголовок', 0, null) ;

CALL ImportField(32401099, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 0, 324, 1, 0, '', 0, null) ;

CALL ImportField(32401111, 'Л/с получателя', 'DESTFACIALACC_CLS', 'Л/с получателя', ' ', 0, 324, 1, 0, 'ЛицСчетПолучателя,DestFacialACCCLS', 0, null) ;

CALL ImportField(32401112, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', ' ', 0, 324, 1, 0, 'СуммаЗаписи', 0, null) ;

CALL ImportField(32401113, 'Назначение платежа', 'NOTE', 'Назначение платежа', ' ', 0, 324, 1, 0, 'ПримечаниеДеталь', 0, null) ;

CALL ImportField(32401114, 'Номер БО плательщика(№ бюдж. обязат-ва плательщика)', 'SOURCEBUDGETPROMISENUM', 'Номер БО плательщика', ' ', 0, 324, 1, 0, 'БОНомер,ДоговораБОПлатНомер', 0, null) ;

CALL ImportField(32401115, 'Номер БО получателя(№ бюдж. обязат-ва получателя)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', ' ', 0, 324, 1, 0, 'БОНомер,ДоговораБОПолучНомер', 0, null) ;

CALL ImportField(32401120, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 0, 324, 1, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(32401127, 'Район получ-ля', 'DestRegionCls', 'Район получ-ля', ' ', 0, 324, 1, 0, 'DestRegionCls,РегионПолуч,РайонТрансферта', 0, null) ;

CALL ImportField(32401128, '№ мем. ордера', 'MEMORDERNUM', '№ мем. ордера', ' ', 0, 324, 1, 0, 'НомерМемордера', 0, null) ;

CALL ImportField(32401129, '№ БО плательщика', 'SOURCEPROMISE', '№ БО плательщика', ' ', 0, 324, 1, 0, 'БюджОбяз,БюджОбязПлат', 0, null) ;

CALL ImportField(32401130, '№ БО получателя', 'DESTPROMISE', '№ БО получателя', ' ', 0, 324, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(32401132, 'Л/С получателя в ФК', 'destfacialcode', 'Л/С получателя в ФК', ' ', 0, 324, 1, 0, '', 0, null) ;

CALL ImportField(32401133, '№ бюдж. обязат-ва плательщика', 'SourceBudgetPromiseCollaps', '№ бюдж. обязат-ва плательщика', ' ', 0, 324, 1, 0, '', 0, null) ;

CALL ImportField(32401134, '№ бюдж. обязат-ва получателя', 'DestBudgetPromiseCollaps', '№ бюдж. обязат-ва получателя', ' ', 0, 324, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(32401135, 'Док. исполнения плательщика', 'SourceExecDocCollaps', 'Док. исполнения плательщика', ' ', 0, 324, 1, 0, '', 0, null) ;

CALL ImportField(32401136, 'Номер(Док. исполнения плательщика)', 'SourceExecDocNum', 'Номер док исполнения плательщика', ' ', 0, 324, 1, 0, 'ДокИсполненияПлатНомер', 0, null) ;

CALL ImportField(32401137, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', ' ', 0, 324, 1, 0, '', 0, null) ;

CALL ImportField(32401138, 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 'Номер док исполнения получателя', ' ', 0, 324, 1, 0, 'ДокИсполненияПолучНомер', 0, null) ;

CALL ImportField(32401141, 'Источник фин-я получ-ля', 'DestFinSource', 'Источник фин-я получ-ля', ' ', 0, 324, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(32401143, 'КЦСРКлюч', 'DestKCSR', 'КЦСР получ-ля', 'DestKCSRKey', 0, 324, 1, 1, 'КЦСРКлюч,КЦСРКлючПолуч', 0, null) ;

CALL ImportField(32401146, 'КВРКлюч', 'DESTKVR', 'КВР получ-ля', 'DestKVRKey', 0, 324, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(32401147, 'КВСРКлюч', 'DestKVSR', 'КВСР получ-ля', 'DestKVSRKey', 0, 324, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(32401148, 'Тип средств получ-ля', 'DestMeansType', 'Тип средств получ-ля', ' ', 0, 324, 1, 0, 'ТипСредств,ТипСредствПолуч', 0, null) ;

CALL ImportField(32401149, 'Суб КЭСР получ-ля', 'DestSubKESR', 'Суб КЭСР получ-ля', ' ', 0, 324, 1, 0, 'СубКЭСР,СубКЭСРПолуч', 0, null) ;

CALL ImportField(32401150, 'Тип документа получ-ля', 'DestDocType', 'Тип документа получ-ля', ' ', 0, 324, 1, 0, 'ТипДокумента,ТипДокументаПолуч', 0, null) ;

CALL ImportField(32401163, 'Вн. номер БО плательщика', 'SOURCEBUDGETPROMISE', 'Вн. номер БО плательщика', ' ', 0, 324, 1, 1, 'БОВнутрНомер,ДоговораБОПлат', 0, null) ;

CALL ImportField(32401164, 'Вн. номер БО получателя', 'DESTBUDGETPROMISE', 'Вн. номер БО получателя', ' ', 0, 324, 1, 1, 'БОВнутрНомер,ДоговораБОПолуч', 0, null) ;

CALL ImportField(32401165, 'Номер Д.И. плательщика ссылка', 'SourceExecDoc', 'Номер Д.И. плательщика ссылка', ' ', 0, 324, 1, 1, 'ДокИсполненияПлат', 0, null) ;

CALL ImportField(32401166, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Номер Д.И. получателя ссылка', ' ', 0, 324, 1, 1, 'ДокИсполненияПолуч', 0, null) ;

CALL ImportField(32401168, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401169, 'Код документа', 'RECORDINDEX', 'Код документа', ' ', 0, 324, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(32401170, 'Код записи', 'ID', 'Код записи', ' ', 0, 324, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(32401186, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств получателя (ссылка)', 'DestTransfertCls', 0, 324, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(32401187, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств получателя', 'DestTransfertClsValue', 0, 324, 1, 0, 'КодЦелевыхСредств,КодЦелевыхСредствПолуч', 0, null) ;

CALL ImportField(32401188, 'КЦСР(Классификация)', 'DestKCSRCode', '', 'DestKCSR', 0, 324, 1, 0, 'КЦСР,КЦСРПолуч', 0, null) ;

CALL ImportField(32401189, 'КВР(Классификация)', 'DESTKVRCode', '', 'DestKVR', 0, 324, 1, 0, 'КВР', 0, null) ;

CALL ImportField(32401190, 'КВСР(Классификация)', 'DestKVSRCode', '', 'DestKVSR', 0, 324, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(32401194, 'Получатель', 'DestFacialAccName', 'Получатель', ' ', 0, 324, 1, 0, '', 0, null) ;

CALL ImportField(32401195, 'Распрорядитель получателя', 'DestGeneralOrg', 'Распрорядитель получателя', ' ', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401196, 'Источник внутр. и внеш. финанс.', 'DestIFSCode', 'Источник внутр. и внеш. финанс.', 'DestIFS_DescriptionCode', 0, 324, 1, 0, 'ИсточникВнутрФинансирования', 0, null) ;

CALL ImportField(32401197, 'Дата договора получателя', 'DestBudgetPromiseDocDate', 'Дата договора получателя', 'DestBudgetPromiseDocDate', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401198, 'Примечание договора получателя', 'DestBudgetPromiseDocNote', 'Примечание договора получателя', 'DestBudgetPromiseDocNote', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401199, 'Номер договора получателя', 'DestBudgetPromiseDocNumber', 'Номер договора получателя', 'DestBudgetPromiseDocNumber', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401200, 'Реестровый номер договора получателя', 'DestBudgetPromiseDocReestrNum', 'Реестровый номер договора получателя', 'DestBudgetPromiseDocReestrNum', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401201, 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 'Сумма договора получателя', 'DestBudgetPromiseDocSumma', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401202, 'Дата гос. контракта', 'DestBudgetPromiseSODate', 'Дата гос. контракта', 'DestBudgetPromiseSODate', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401203, 'ИД контракта', 'DestBudgetPromiseSOID', '', ' ', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401204, 'Прим. гос. контракта', 'DestBudgetPromiseSONote', 'Прим. гос. контракта', 'DestBudgetPromiseSONote', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401205, 'Номер гос. контракта', 'DestBudgetPromiseSONum', 'Номер гос. контракта', 'DestBudgetPromiseSONum', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401206, 'Реестровый номер гос. контр', 'DestBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр', 'DestBudgetPromiseSOReestrNum', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401207, 'Сумма гос. контракта', 'DestBudgetPromiseSOSumma', 'Сумма гос. контракта', 'DestBudgetPromiseSOSumma', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401208, 'Сумма БО получателя', 'DestBudgetPromiseSumma', 'Сумма БО получателя', 'DestBudgetPromiseSumma', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401209, 'Дата', 'DestExecDocDate', 'Дата', 'DestExecDocDate', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401210, 'Назначение', 'DestExecDocNote', 'Назначение', 'DestExecDocNote', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401211, 'Реестровый номер', 'DestExecDocReestr', 'Реестровый номер', 'DestExecDocReestr', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401212, 'Сумма док. исполнения получателя', 'DestExecDocSumma', 'Сумма док. исполнения получателя', 'DestExecDocSumma', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401213, 'Тип документа исполнения', 'DestExecDocType', 'Тип документа исполнения', 'DestExecDocType', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401214, 'Вид ассигнование получ.', 'DestAssignmentKind', 'Вид ассигнование получ.', 'DestAssignmentKind', 0, 324, 1, 0, 'ВидАссигнований,ВидАссигнованийПолуч', 0, null) ;

CALL ImportField(32401216, 'Код ФО записи', 'FUID', 'Код ФО записи', 'FUID', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401221, 'Дата ДИ плательщика', 'SourceExecDocDate', 'Дата ДИ плательщика', ' ', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401222, 'Примечание ДИ плательщика', 'SourceExecDocNote', 'Примечание ДИ плательщика', ' ', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401223, 'Реестровый номер ДИ плательщика', 'SourceExecDocReestr', 'Реестровый номер ДИ плательщика', ' ', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401224, 'Сумма по ДИ плательщика', 'SourceExecDocSumma', 'Сумма по ДИ плательщика', ' ', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401225, 'Тип ДИ плательщика', 'SourceExecDocType', 'Тип ДИ плательщика', ' ', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401226, 'Дата договора', 'SourceBudgetPromiseDocDate', 'Дата договора', 'SourceBudgetPromiseDocDate', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401227, 'Дог. примечание', 'SourceBudgetPromiseDocNote', 'Дог. примечание', 'SourceBudgetPromiseDocNote', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401228, 'Номер договора', 'SourceBudgetPromiseDocNumber', 'Номер договора', 'SourceBudgetPromiseDocNumber', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401229, 'Реестровый номер дог.', 'SourceBudgetPromiseDocReestrNum', 'Реестровый номер дог.', 'SourceBudgetPromiseDocReestrNum', 0, 324, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(32401230, 'Сумма договора', 'SourceBudgetPromiseDocSumma', 'Сумма договора', 'SourceBudgetPromiseDocSumma', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401231, 'Дата гос. контракта', 'SourceBudgetPromiseSODate', 'Дата гос. контракта', 'SourceBudgetPromiseSODate', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401232, 'ИД контракта', 'SourceBudgetPromiseSOID', '', ' ', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401233, 'Прим. гос. контракта', 'SourceBudgetPromiseSONote', 'Прим. гос. контракта', 'SourceBudgetPromiseSONote', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401234, 'Номер гос. контракта', 'SourceBudgetPromiseSONum', 'Номер гос. контракта', 'SourceBudgetPromiseSONum', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401235, 'Реестровый номер гос. контр', 'SourceBudgetPromiseSOReestrNum', 'Реестровый номер гос. контр', 'SourceBudgetPromiseSOReestrNum', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401236, 'Сумма гос. контракта', 'SourceBudgetPromiseSOSumma', 'Сумма гос. контракта', 'SourceBudgetPromiseSOSumma', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401237, 'Сумма БО', 'SourceBudgetPromiseSumma', 'Сумма БО', 'SourceBudgetPromiseSumma', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401238, 'Код цели', 'TargetCls', 'Код цели', ' ', 0, 324, 1, 1, '', 0, null) ;

CALL ImportField(32401241, 'Источник внутр. и внеш. финанс. (Ключ)', 'DestIFS', 'Источник внутр. и внеш. финанс. (Ключ)', 'DestIFS', 0, 324, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, null) ;

CALL ImportField(32401242, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', ' ', 0, 324, 1, 0, 'КодБюджАссигнованияПолуч', 0, null) ;

CALL ImportField(32401243, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', ' ', 0, 324, 1, 0, 'КодРасходногоОбязательстваПолуч', 0, null) ;

CALL ImportField(32401244, 'Код субсидииКлюч', 'DestSubsidyCls', '', ' ', 0, 324, 1, 1, 'КодСубсидииКлюч,КодСубсидииКлючПолуч', 0, null) ;

CALL ImportField(32401245, 'Код субсидии', 'DestSubsidyClsCode', '', ' ', 0, 324, 1, 0, 'КодСубсидии,КодСубсидииПолуч', 0, null) ;

CALL ImportField(32401246, 'Код бюджетного ассигнования (ключ)', 'DestBudAllocationCls', '', ' ', 0, 324, 1, 1, 'КодБюджАссигнованияКлюч,КодБюджАссигнованияКлючПолуч', 0, null) ;

CALL ImportField(32401247, 'Код расходного обязательства (ключ)', 'DestPayPromiseCls', '', ' ', 0, 324, 1, 1, 'КодРасходногоОбязательстваКлюч,КодРасходногоОбязательстваКлючПолуч', 0, null) ;

CALL ImportField(32401248, 'Район бюджетного учреждения', 'RegionBudgetEst', 'Район бюджетного учреждения', 'RegionBudgetEst', 0, 324, 1, 1, 'РайонБУ', 0, null) ;

-- Распределение ОФ, Бюджет(1)
CALL ImportField(32410002, '№ док.', 'DOCNUMBER', '№ док.', 'DocNumber', 1, 324, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(32410003, 'Дата документа', 'DOCUMENTDATE', 'Дата документа', 'DocumentDate', 1, 324, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(32410004, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 324, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(32410005, 'Л/с плательщика', 'SOURCEFACIALACC_CLS', 'Л/с плательщика', 'SourceFacialAccCls', 1, 324, 0, 0, 'ЛицевойСчет,ЛицСчетПлательщика', 0, 18957) ;

CALL ImportField(32410006, 'Р/с бюджета', 'SourceAccountName', 'Р/с бюджета', ' ', 1, 324, 0, 0, '', 0, 17112) ;

CALL ImportField(32410007, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 324, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(32410008, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 324, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(32410009, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', 'AcceptDate', 1, 324, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(32410010, 'Операция', 'BuhOperationCLS', 'Операция', 'BUHOPERATIONCLS', 1, 324, 0, 0, 'БухОперация', 0, 19007) ;

CALL ImportField(32410011, 'Тип классификации', 'ClsType', 'Тип классификации', 'CLSTYPE', 1, 324, 0, 0, 'ТипКлассификации,ТипКлассификацииПлат', 0, 19008) ;

CALL ImportField(32410012, 'Архив', 'ARHIVEDOC', 'Архив', 'ARHIVEDOC', 1, 324, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(32410031, 'Номер реестра', 'REESTRNUMBER', 'Номер реестра', 'ReestrNumber', 1, 324, 0, 0, 'НомерРеестра', 0, 19090) ;

CALL ImportField(32410032, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 1, 324, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(32410044, 'Л/С плательщика в ФК', 'SourceFACIALCODE', 'Л/С плательщика в ФК', ' ', 1, 324, 0, 0, '', 0, null) ;

CALL ImportField(32410052, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', 'BUHPAYMENTCLS', 1, 324, 0, 1, 'БухПроводка', 0, 18968) ;

CALL ImportField(32410053, 'Код документа', 'ID', 'Код документа', 'ID', 1, 324, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(32410054, 'Код реестра', 'REESTR_REF', 'Код реестра', 'Reestr_Ref', 1, 324, 0, 1, 'КодРеестра', 0, 18971) ;

CALL ImportField(32410055, 'Направление операции', 'OperationDirection', 'Направление операции', 'OPERATIONDIRECTION', 1, 324, 0, 1, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(32410056, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'RejectCLS', 1, 324, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(32410057, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (комментарий)', 'RejectCause', 1, 324, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(32410058, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 324, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(32410059, 'Казн. cчет (Мастер)', 'SOURCEACCOUNT', 'Казн. cчет (Мастер)', 'SOURCEACCOUNT', 1, 324, 0, 1, 'РСФО,СчетПлат', 0, 18956) ;

CALL ImportField(32410060, 'Казн. cчет', 'DESTACCOUNT', 'Казн. cчет', 'DESTACCOUNT', 1, 324, 0, 1, 'СчетПолуч', 0, 18958) ;

CALL ImportField(32410069, 'Признак принятости реестра', 'Accepted', 'Признак принятости реестра', 'Accepted', 1, 324, 0, 1, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(32410071, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 324, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(32410085, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 1, 324, 0, 1, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(32410171, 'Срок платежа', 'PayDate', 'Срок платежа', 'PayDate', 1, 324, 0, 1, 'СрокПлатежа', 0, 18951) ;

CALL ImportField(32410172, 'Код удаленного клиента', 'SENDERID', 'Код удаленного клиента', 'SenderID', 1, 324, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(32410173, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'ProgIndex', 1, 324, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(32410174, 'Л/c получателя заг.', 'DestFacialAcc_Cls', 'Л/с получателя заг.', 'DestFacialAccCls', 1, 324, 0, 0, 'ЛицСчетПолучателя', 0, 18959) ;

CALL ImportField(32410175, 'Отдел', 'DepartmentCLS', '', ' ', 1, 324, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(32410176, 'Номер л/с плательщика', 'SourceFacialCodeEx', '', ' ', 1, 324, 0, 0, '', 0, 26617) ;

CALL ImportField(32411014, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 324, 1, 0, '', 0, null) ;

CALL ImportField(32411020, 'Мероприятие плат.', 'SourceFact', 'Мероприятие', 'SOURCEFACT', 1, 324, 1, 1, 'МероприятиеПлат', 0, 18890) ;

CALL ImportField(32411026, 'Л/с получателя', 'DESTFACIALACC_CLS', 'Л/с получателя', 'DestFacialAccCls', 1, 324, 1, 0, 'ЛицСчетПолучателя,DestFacialACCCLS', 0, 18869) ;

CALL ImportField(32411027, 'Сумма(руб)', 'SUMMA', 'Сумма(руб)', 'SUMMA', 1, 324, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(32411028, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 324, 1, 0, 'ПримечаниеДеталь', 0, 18876) ;

CALL ImportField(32411030, 'Номер БО(№ бюдж. обязат-ва получателя)', 'DESTBUDGETPROMISENUM', 'Номер БО получателя(договора)', ' ', 1, 324, 1, 0, 'БОНомер,ДоговораБОПолучНомер', 0, 20223) ;

CALL ImportField(32411033, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'ACCEPTDATE', 1, 324, 1, 0, 'ДатаПринятия', 0, 18924) ;

CALL ImportField(32411040, 'Район трансферта', 'DestRegionCls', 'Район получ-ля', 'DESTREGIONCLS', 1, 324, 1, 0, 'DestRegionCls,РегионПолуч,РайонТрансферта', 0, 18928) ;

CALL ImportField(32411041, '№ мем. ордера', 'MEMORDERNUM', '№ мем. ордера', 'MemOrderNum', 1, 324, 1, 0, 'НомерМемордера', 0, 18875) ;

CALL ImportField(32411043, '№ бюдж. обязат-ва', 'DESTPROMISE', '№ БО получателя', 'DestPROMISE', 1, 324, 1, 0, 'БюджОбяз', 0, 18906) ;

CALL ImportField(32411045, 'Л/С получателя в ФК', 'destfacialcode', 'Л/С получателя в ФК', ' ', 1, 324, 1, 0, '', 0, null) ;

CALL ImportField(32411047, '№ бюдж. обязат-ва получателя', 'DestBudgetPromiseCollaps', '№ бюдж. обязат-ва получателя', ' ', 1, 324, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(32411050, 'Док. исполнения получателя', 'DestExecDocCollaps', 'Док. исполнения получателя', ' ', 1, 324, 1, 0, '', 0, null) ;

CALL ImportField(32411051, 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 'Номер док исполнения получателя', 'DestExecDocNum', 1, 324, 1, 0, 'ДокИсполненияПолучНомер', 0, 19739) ;

CALL ImportField(32411062, 'Вн. номер БО получателя', 'DESTBUDGETPROMISE', 'Вн. номер БО получателя', 'DestBUDGETPROMISE', 1, 324, 1, 1, 'БОВнутрНомер,ДоговораБОПолуч', 0, 18909) ;

CALL ImportField(32411064, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Номер Д.И. получателя ссылка', 'DestExecDoc', 1, 324, 1, 1, 'ДокИсполненияПолуч', 0, 18918) ;

CALL ImportField(32411066, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 324, 1, 1, '', 0, 18872) ;

CALL ImportField(32411067, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 324, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(32411068, 'Код записи', 'ID', 'Код записи', 'Id', 1, 324, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(32411073, 'Источник фин-я', 'DestFinSource', 'Источник фин-я получ-ля', 'DestFINSOURCECLS', 1, 324, 1, 0, 'ИсточникФинансирования', 0, 18901) ;

CALL ImportField(32411075, 'КЦСРКлюч', 'DestKCSR', 'КЦСР получ-ля', 'DestKCSRKey', 1, 324, 1, 1, 'КЦСРКлюч,КЦСРКлючПолуч', 0, 18896) ;

CALL ImportField(32411076, 'ЭКР(Классификация)', 'DESTKESR', 'КЭСР получ-ля', 'DestKESR', 1, 324, 1, 0, 'КЭСР,КЭСРПолуч', 0, 18871) ;

CALL ImportField(32411077, 'ФКР(Классификация)', 'DestKFSR', 'КФСР получ-ля', 'DestKFSR', 1, 324, 1, 0, 'КФСР,КФСРПолуч', 0, 18897) ;

CALL ImportField(32411078, 'КВРКлюч', 'DESTKVR', 'КВР получ-ля', 'DestKVRKey', 1, 324, 1, 1, 'КВРКлюч', 0, 18870) ;

CALL ImportField(32411079, 'КВСРКлюч', 'DestKVSR', 'КВСР получ-ля', 'DestKVSRKey', 1, 324, 1, 1, 'КВСРКлюч', 0, 18895) ;

CALL ImportField(32411080, 'Тип средств', 'DestMeansType', 'Тип средств получ-ля', 'DestMEANSTYPECLS', 1, 324, 1, 0, 'ТипСредств,ТипСредствПолуч', 0, 18900) ;

CALL ImportField(32411081, 'Суб КОСГУ', 'DestSubKESR', 'Суб КЭСР получ-ля', 'DestSUBKESR', 1, 324, 1, 0, 'СубКЭСР,СубКЭСРПолуч', 0, 18898) ;

CALL ImportField(32411083, 'Тип документа', 'DestDocType', 'Тип документа получ-ля', 'DestDOCTYPECLS', 1, 324, 1, 0, 'ТипДокумента,ТипДокументаПолуч', 0, 18903) ;

CALL ImportField(32411086, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 324, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(32411088, 'Источниковая классификация', 'DestIFS', 'Источниковая классификация', 'DestIFS', 1, 324, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 18921) ;

CALL ImportField(32411089, 'Вид источника(Классификация)', 'DestIFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 324, 1, 0, '', 0, 17050) ;

CALL ImportField(32411090, 'ЭКИ(Классификация)', 'DestIFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 324, 1, 0, '', 0, 17054) ;

CALL ImportField(32411173, 'Вид ассигнований плат.', 'SourceAssignmentKind', 'Вид ассигнований', 'SourceAssignmentKind', 1, 324, 1, 1, 'ВидАссигнованийПлат', 0, null) ;

CALL ImportField(32411175, 'Вид ассигнований', 'DestAssignmentKind', 'Вид ассигнований получ-ля', 'DestAssignmentKind', 1, 324, 1, 0, 'ВидАссигнований,ВидАссигнованийПолуч', 0, 25178) ;

CALL ImportField(32411176, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'ProgIndex', 1, 324, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(32411178, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств получателя (ссылка)', 'DestTransfertCls', 1, 324, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18936) ;

CALL ImportField(32411186, 'Номер л/с получателя', 'DestFacialCodeEx', '', ' ', 1, 324, 1, 0, '', 0, 26617) ;

CALL ImportField(32411187, 'Наименование района трансферта', 'DestRegionClsName', '', ' ', 1, 324, 1, 0, '', 0, null) ;

CALL ImportField(32411190, 'Код субсидииКлюч', 'DestSubsidyCls', '', 'DestSubsidyCls', 1, 324, 1, 1, 'КодСубсидииКлюч,КодСубсидииКлючПолуч', 0, 26624) ;

CALL ImportField(32411192, 'Код бюджетного ассигнованияКлюч', 'DestBudAllocationCls', '', 'DestBudAllocationCls', 1, 324, 1, 1, 'КодБюджАссигнованияКлюч,КодБюджАссигнованияКлючПолуч', 0, 27842) ;

CALL ImportField(32411193, 'Код расходного обязательстваКлюч', 'DestPayPromiseCls', '', 'DestPayPromiseCls', 1, 324, 1, 1, 'КодРасходногоОбязательстваКлюч,КодРасходногоОбязательстваКлючПолуч', 0, 27843) ;

-- Кредиты от кредитных организаций, Бюджет(1)
CALL ImportField(40110001, 'Дата договора', 'DATEINPUT', 'Дата договора', ' ', 1, 401, 0, 0, 'ДатаДокумента', 0, 17962) ;

CALL ImportField(40110002, '№ документа', 'NUMBER', '№ документа', ' ', 1, 401, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(40110003, 'Тип договора', 'ContractType', 'Тип договора', ' ', 1, 401, 0, 0, 'ВидДоговора', 0, 17969) ;

CALL ImportField(40110004, 'Счет ФО', 'DFACCOUNTName', 'Счет ФО', ' ', 1, 401, 0, 0, '', 0, 17112) ;

CALL ImportField(40110005, 'Счет возврата основного долга', 'ACCNAME', 'Счет возврата основного долга', ' ', 1, 401, 0, 0, '', 0, 17112) ;

CALL ImportField(40110006, 'Счет уплаты процентов', 'AddAccName', 'Счет уплаты процентов', ' ', 1, 401, 0, 0, '', 0, 17112) ;

CALL ImportField(40110007, 'Сумма', 'SUMMA', 'Сумма', ' ', 1, 401, 0, 0, 'СуммаЗаголовка', 0, 17964) ;

CALL ImportField(40110008, 'Вид заимствования', 'DebtType', 'Вид заимствования', ' ', 1, 401, 0, 0, 'ВидКредита', 0, 17983) ;

CALL ImportField(40110009, 'Кредитор', 'Creditor', 'Кредитор', ' ', 1, 401, 0, 0, '', 0, null) ;

CALL ImportField(40110010, 'ИНН(Кредитор)', 'INN', 'ИНН', ' ', 1, 401, 0, 0, '', 0, 16645) ;

CALL ImportField(40110011, 'Имя организации(Кредитор)', 'NAME', 'Имя организации', ' ', 1, 401, 0, 0, '', 0, 16646) ;

CALL ImportField(40110012, 'КПП(Кредитор)', 'INN20', 'КПП', ' ', 1, 401, 0, 0, '', 0, 16653) ;

CALL ImportField(40110013, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 401, 0, 0, 'Примечание', 0, 17968) ;

CALL ImportField(40110014, 'Тип года', 'YearType', 'Тип года', ' ', 1, 401, 0, 0, 'ТипГода', 0, 17978) ;

CALL ImportField(40110015, 'Процент(Доли от ставок ЦБ)', 'CBPercentRate', 'Процент', ' ', 1, 401, 0, 0, '', 0, 17986) ;

CALL ImportField(40110016, 'Пеня осн.(Доли от ставок ЦБ)', 'CBFineRate', 'Пеня осн.', ' ', 1, 401, 0, 0, '', 0, 17987) ;

CALL ImportField(40110017, 'Пеня проц.(Доли от ставок ЦБ)', 'CBFinePercentRate', 'Пеня проц.', ' ', 1, 401, 0, 0, '', 0, 17988) ;

CALL ImportField(40110018, 'Район', 'RegionCLS', 'Район', ' ', 1, 401, 0, 0, 'Район', 0, 17979) ;

CALL ImportField(40110020, 'Дата(Погашение осн. долга)', 'ReturnStartDate', 'Дата', ' ', 1, 401, 0, 0, '', 0, 17991) ;

CALL ImportField(40110021, 'Периодичность(Погашение осн. долга)', 'ReturnPeriodLength', 'Периодичность', ' ', 1, 401, 0, 0, '', 0, 17992) ;

CALL ImportField(40110022, 'Лицевой счет', 'FacialAcc_CLS', 'Лицевой счет', ' ', 1, 401, 0, 0, 'ЛицевойСчет', 0, 17981) ;

CALL ImportField(40110023, 'Тип валюты', 'CurrencyCLS', 'Тип валюты', ' ', 1, 401, 0, 0, '', 0, 17985) ;

CALL ImportField(40110024, 'Сумма в валюте', 'CurrencySumma', 'Сумма в валюте', ' ', 1, 401, 0, 0, 'СуммаДоговораВВалюте', 0, 17984) ;

CALL ImportField(40110025, 'Дата(Начисление процентов)', 'PeriodStart', 'Дата', ' ', 1, 401, 0, 0, '', 0, 17970) ;

CALL ImportField(40110026, 'Периодичность(Начисление процентов)', 'PeriodLength', 'Периодичность', ' ', 1, 401, 0, 0, '', 0, 17971) ;

CALL ImportField(40110027, 'Периодичность(Уплата процентов)', 'PayPercentPeriodLength', 'Периодичность', ' ', 1, 401, 0, 0, 'ПериодичностьУплатыПроцентов', 0, 17994) ;

CALL ImportField(40110028, 'Дата(Уплата процентов)', 'PayPercentStartDate', 'Дата', ' ', 1, 401, 0, 0, '', 0, 17993) ;

CALL ImportField(40110029, 'Дата окончания договора(Дата закрытия)', 'DATEAMORTIZATION', 'Дата окончания договора', ' ', 1, 401, 0, 0, 'ДатаОкончанияПлан', 0, 17963) ;

CALL ImportField(40110030, 'Дата пролонгирования(Дата закрытия)', 'LongDate', 'Дата пролонгирования', ' ', 1, 401, 0, 0, 'ДатаПролонгирования', 0, 17976) ;

CALL ImportField(40110031, 'Дата погашения (факт)(Дата закрытия)', 'AcceptDate', 'Дата погашения (факт)', ' ', 1, 401, 0, 0, 'ДатаПринятия', 0, 17977) ;

CALL ImportField(40110032, 'Основание', 'DocBaseParent', 'Основание', ' ', 1, 401, 0, 0, '', 0, null) ;

CALL ImportField(40110033, 'Основание(Основание)', 'DocumentBaseName', 'Основание', ' ', 1, 401, 0, 0, '', 0, 16978) ;

CALL ImportField(40110035, 'Количество облигаций(Информация об облигациях)', 'BondCount', 'Количество облигаций', ' ', 1, 401, 0, 0, 'КолвоОблигацийПоДоговору', 0, 18003) ;

CALL ImportField(40110036, 'Номинальная цена(Информация об облигациях)', 'BondCost', 'Номинальная цена', ' ', 1, 401, 0, 0, 'НомЦенаОблигации', 0, 18004) ;

CALL ImportField(40110217, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 401, 0, 0, '', 0, 17966) ;

CALL ImportField(40110218, 'Счет кредитора', 'AccRef', 'AccRef', ' ', 1, 401, 0, 1, 'СчетКредитора', 0, 18000) ;

CALL ImportField(40110219, 'Код документа', 'ID', 'ID', ' ', 1, 401, 0, 1, 'КодДокумента', 0, 17960) ;

CALL ImportField(40110220, 'Организация', 'Org_Ref', 'Org_Ref', ' ', 1, 401, 0, 1, 'Организация', 0, 17967) ;

CALL ImportField(40111037, 'Дата получения', 'ACCEPTDATE', 'Дата получения', ' ', 1, 401, 1, 0, 'Дата', 0, 19187) ;

CALL ImportField(40111038, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 401, 1, 0, 'ДатаУчета', 0, 19188) ;

CALL ImportField(40111039, 'Плановая дата', 'PlanDate', 'Плановая дата', ' ', 1, 401, 1, 0, '', 0, 19189) ;

CALL ImportField(40111040, 'Счет ФО', 'DFACCOUNTName', 'Счет ФО', ' ', 1, 401, 1, 0, '', 0, 17112) ;

CALL ImportField(40111041, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 401, 1, 0, 'БухПроводка', 0, 19208) ;

CALL ImportField(40111042, 'Сумма', 'Credit', 'Сумма', ' ', 1, 401, 1, 0, '', 0, 19192) ;

CALL ImportField(40111043, 'Счет', 'ACC', 'Счет', ' ', 1, 401, 1, 0, '', 0, 17112) ;

CALL ImportField(40111044, 'Источники внутреннего и внешнего финансирования', 'FinSourceValue', 'Источники внутреннего и внешнего финансирования', ' ', 1, 401, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(40111046, 'Вид источника(Источники внутреннего и внешнего финансирования)', 'DescriptionCode', 'Вид источника', ' ', 1, 401, 1, 0, '', 0, 17050) ;

CALL ImportField(40111047, 'ЭКИ(Источники внутреннего и внешнего финансирования)', 'IFSKESR', 'ЭКИ', ' ', 1, 401, 1, 0, '', 0, 17054) ;

CALL ImportField(40111048, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 401, 1, 0, 'ПримечаниеДет', 0, 19200) ;

CALL ImportField(40111049, 'Тип валюты', 'CURRENCYCLS', 'Тип валюты', ' ', 1, 401, 1, 0, 'КодВалюты', 0, 19206) ;

CALL ImportField(40111050, 'Сумма в валюте', 'CURRENCYSUMMA', 'Сумма в валюте', ' ', 1, 401, 1, 0, 'СуммаВВалюте', 0, 19207) ;

CALL ImportField(40111051, 'Субкод', 'SUBKD', 'Субкод', ' ', 1, 401, 1, 0, 'СубКД', 0, 19196) ;

CALL ImportField(40111052, 'Район', 'REGIONCLS', 'Район', ' ', 1, 401, 1, 0, 'РайонИзДетали', 0, 19199) ;

CALL ImportField(40111053, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 401, 1, 0, 'ТипДокумента', 0, 19197) ;

CALL ImportField(40111054, '№ документа', 'SourceDocNumber', '№ документа', ' ', 1, 401, 1, 0, 'НомерЗаписи', 0, 19198) ;

CALL ImportField(40111055, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 401, 1, 0, '', 0, 19217) ;

CALL ImportField(40111056, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 401, 1, 0, '', 0, 19218) ;

CALL ImportField(40111057, 'Количество облигаций', 'BondCount', 'Количество облигаций', ' ', 1, 401, 1, 0, 'КолвоОблигаций', 0, 19220) ;

CALL ImportField(40111221, 'Счет получателя', 'AcceptorAccRef', 'AcceptorAccRef', ' ', 1, 401, 1, 1, 'СчетПолучателя', 0, 19194) ;

CALL ImportField(40111222, 'Счет кредитора', 'AccRef', 'AccRef', ' ', 1, 401, 1, 1, 'СчетКредитора', 0, 19193) ;

CALL ImportField(40111223, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 401, 1, 1, 'РСФО', 0, 19190) ;

CALL ImportField(40111224, 'Код записи', 'ID', 'ID', ' ', 1, 401, 1, 1, 'КодЗаписи', 0, 19183) ;

CALL ImportField(40111225, 'ИВФ', 'IFS', 'ИВФ', ' ', 1, 401, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 19195) ;

CALL ImportField(40112058, 'Дата', 'PLANDATE', 'Дата', ' ', 1, 401, 2, 0, '', 0, 19225) ;

CALL ImportField(40112059, 'Сумма', 'Summa', 'Сумма', ' ', 1, 401, 2, 0, '', 0, 19226) ;

CALL ImportField(40112060, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 401, 2, 0, 'ПримечаниеДет', 0, 19227) ;

CALL ImportField(40112061, 'Сумма в валюте', 'CurrencySumma', 'Сумма в валюте', ' ', 1, 401, 2, 0, 'СуммаВВалюте', 0, 19233) ;

CALL ImportField(40112062, 'Тип валюты', 'CurrencyCLS', 'Тип валюты', ' ', 1, 401, 2, 0, 'КодВалюты', 0, 19232) ;

CALL ImportField(40112226, 'Код записи', 'ID', 'ID', ' ', 1, 401, 2, 1, 'КодЗаписи', 0, 19222) ;

CALL ImportField(40113063, 'Дата уплаты', 'ACCEPTDATE', 'Дата уплаты', ' ', 1, 401, 3, 0, 'Дата', 0, 19187) ;

CALL ImportField(40113064, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 401, 3, 0, 'ДатаУчета', 0, 19188) ;

CALL ImportField(40113065, 'Плановая дата', 'PlanDate', 'Плановая дата', ' ', 1, 401, 3, 0, '', 0, 19189) ;

CALL ImportField(40113066, 'Счет ФО', 'DFACCOUNTName', 'Счет ФО', ' ', 1, 401, 3, 0, '', 0, 17112) ;

CALL ImportField(40113067, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 401, 3, 0, 'БухПроводка', 0, 19208) ;

CALL ImportField(40113068, 'Сумма', 'Debit', 'Сумма', ' ', 1, 401, 3, 0, '', 0, 19191) ;

CALL ImportField(40113069, 'Счет', 'ACC', 'Счет', ' ', 1, 401, 3, 0, '', 0, 17112) ;

CALL ImportField(40113070, 'Источники внутреннего и внешнего финансирования', 'FinSourceValue', 'Источники внутреннего и внешнего финансирования', ' ', 1, 401, 3, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(40113072, 'Вид источника(Источники внутреннего и внешнего финансирования)', 'DescriptionCode', 'Вид источника', ' ', 1, 401, 3, 0, '', 0, 17050) ;

CALL ImportField(40113073, 'ЭКИ(Источники внутреннего и внешнего финансирования)', 'IFSKESR', 'ЭКИ', ' ', 1, 401, 3, 0, '', 0, 17054) ;

CALL ImportField(40113074, 'Информация для налогового платежа', 'TAXNOTE', 'Информация для налогового платежа', ' ', 1, 401, 3, 0, '', 0, 19212) ;

CALL ImportField(40113075, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 401, 3, 0, 'ПримечаниеДет', 0, 19200) ;

CALL ImportField(40113076, 'Тип валюты', 'CURRENCYCLS', 'Тип валюты', ' ', 1, 401, 3, 0, 'КодВалюты', 0, 19206) ;

CALL ImportField(40113077, 'Сумма в валюте', 'CURRENCYSUMMA', 'Сумма в валюте', ' ', 1, 401, 3, 0, 'СуммаВВалюте', 0, 19207) ;

CALL ImportField(40113078, 'Субкод', 'SUBKD', 'Субкод', ' ', 1, 401, 3, 0, 'СубКД', 0, 19196) ;

CALL ImportField(40113079, 'Район', 'REGIONCLS', 'Район', ' ', 1, 401, 3, 0, 'РайонИзДетали', 0, 19199) ;

CALL ImportField(40113080, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 401, 3, 0, 'ТипДокумента', 0, 19197) ;

CALL ImportField(40113081, '№ документа', 'SourceDocNumber', '№ документа', ' ', 1, 401, 3, 0, 'НомерЗаписи', 0, 19198) ;

CALL ImportField(40113082, 'Реестр федеральных средств', 'FederalFundsName', 'Реестр федеральных средств', ' ', 1, 401, 3, 0, '', 0, null) ;

CALL ImportField(40113083, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 401, 3, 0, '', 0, 19217) ;

CALL ImportField(40113084, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 401, 3, 0, '', 0, 19218) ;

CALL ImportField(40113085, 'Количество облигаций', 'BondCount', 'Количество облигаций', ' ', 1, 401, 3, 0, 'КолвоОблигаций', 0, 19220) ;

CALL ImportField(40113227, 'Счет получателя', 'AcceptorAccRef', 'AcceptorAccRef', ' ', 1, 401, 3, 1, 'СчетПолучателя', 0, 19194) ;

CALL ImportField(40113228, 'Счет кредитора', 'AccRef', 'AccRef', ' ', 1, 401, 3, 1, 'СчетКредитора', 0, 19193) ;

CALL ImportField(40113229, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 401, 3, 1, 'РСФО', 0, 19190) ;

CALL ImportField(40113230, 'Реестр федеральных средств', 'FederalFundsRef', 'Реестр федеральных средств', ' ', 1, 401, 3, 1, 'ФедеральныеСредства', 0, null) ;

CALL ImportField(40113231, 'Код записи', 'ID', 'ID', ' ', 1, 401, 3, 1, 'КодЗаписи', 0, 19183) ;

CALL ImportField(40113232, 'ИВФ', 'IFS', 'ИВФ', ' ', 1, 401, 3, 1, 'ИсточникВнутрФинансированияКлюч', 0, 19195) ;

CALL ImportField(40114086, 'Дата начисления', 'ACCEPTDATE', 'Дата начисления', ' ', 1, 401, 4, 0, 'Дата', 0, 18125) ;

CALL ImportField(40114087, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 401, 4, 0, 'ДатаУчета', 0, 18138) ;

CALL ImportField(40114088, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 401, 4, 0, 'БухПроводка', 0, 18128) ;

CALL ImportField(40114089, 'Начало периода', 'PeriodStart', 'Начало периода', ' ', 1, 401, 4, 0, 'НачалоПериода', 0, 18130) ;

CALL ImportField(40114090, 'Конец периода', 'PeriodEnd', 'Конец периода', ' ', 1, 401, 4, 0, 'КонецПериода', 0, 18131) ;

CALL ImportField(40114091, 'Сумма', 'SUMMA', 'Сумма', ' ', 1, 401, 4, 0, '', 0, 18126) ;

CALL ImportField(40114092, 'Тип', 'ProgIndex', 'Тип', ' ', 1, 401, 4, 0, 'ИндексыДанных', 0, 18133) ;

CALL ImportField(40114093, 'Дата уплаты (план)', 'PayPercentDate', 'Дата уплаты (план)', ' ', 1, 401, 4, 0, '', 0, 18132) ;

CALL ImportField(40114094, 'Субкод', 'SUBKD', 'Субкод', ' ', 1, 401, 4, 0, 'СубКД', 0, 18127) ;

CALL ImportField(40114095, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 401, 4, 0, 'ПримечаниеДет', 0, 18129) ;

CALL ImportField(40114096, 'Тип валюты', 'CURRENCYCLS', 'Тип валюты', ' ', 1, 401, 4, 0, 'КодВалюты', 0, 18139) ;

CALL ImportField(40114097, 'Сумма в валюте', 'CURRENCYSUMMA', 'Сумма в валюте', ' ', 1, 401, 4, 0, 'СуммаВВалюте', 0, 18140) ;

CALL ImportField(40114098, 'Счет ФО', 'DFACCOUNTName', 'Счет ФО', ' ', 1, 401, 4, 0, '', 0, 17112) ;

CALL ImportField(40114099, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 401, 4, 0, '', 0, null) ;

CALL ImportField(40114100, 'КВСР(Классификация)', 'KVSR', 'КВСР', ' ', 1, 401, 4, 0, '', 0, null) ;

CALL ImportField(40114101, 'ФКР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 401, 4, 0, '', 0, 18148) ;

CALL ImportField(40114102, 'КЦСР(Классификация)', 'KCSR', 'КЦСР', ' ', 1, 401, 4, 0, '', 0, null) ;

CALL ImportField(40114103, 'КВР(Классификация)', 'KVR', 'КВР', ' ', 1, 401, 4, 0, '', 0, null) ;

CALL ImportField(40114104, 'ЭКР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 401, 4, 0, '', 0, 18151) ;

CALL ImportField(40114105, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 401, 4, 0, '', 0, 18145) ;

CALL ImportField(40114106, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 401, 4, 0, '', 0, 18142) ;

CALL ImportField(40114233, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 401, 4, 1, 'РСФО', 0, 18141) ;

CALL ImportField(40114234, 'Код записи', 'ID', 'ID', ' ', 1, 401, 4, 1, 'КодЗаписи', 0, 18123) ;

CALL ImportField(40115107, 'Дата', 'PLANDATE', 'Дата', ' ', 1, 401, 5, 0, '', 0, 19225) ;

CALL ImportField(40115108, 'Сумма', 'Summa', 'Сумма', ' ', 1, 401, 5, 0, '', 0, 19226) ;

CALL ImportField(40115109, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 401, 5, 0, 'ПримечаниеДет', 0, 19227) ;

CALL ImportField(40115110, 'Сумма в валюте', 'CurrencySumma', 'Сумма в валюте', ' ', 1, 401, 5, 0, 'СуммаВВалюте', 0, 19233) ;

CALL ImportField(40115111, 'Тип валюты', 'CurrencyCLS', 'Тип валюты', ' ', 1, 401, 5, 0, 'КодВалюты', 0, 19232) ;

CALL ImportField(40115235, 'Код записи', 'ID', 'ID', ' ', 1, 401, 5, 1, 'КодЗаписи', 0, 19222) ;

CALL ImportField(40116112, 'Дата уплаты', 'ACCEPTDATE', 'Дата уплаты', ' ', 1, 401, 6, 0, 'Дата', 0, 17838) ;

CALL ImportField(40116113, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 401, 6, 0, 'ДатаУчета', 0, 17861) ;

CALL ImportField(40116114, '№ распоряжения', 'SourceDocNum', '№ распоряжения', ' ', 1, 401, 6, 0, 'НомерЗаписи', 0, 17847) ;

CALL ImportField(40116115, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 401, 6, 0, 'БухПроводка', 0, 17858) ;

CALL ImportField(40116116, 'Счет ФО', 'DFACCOUNTName', 'Счет ФО', ' ', 1, 401, 6, 0, '', 0, 17112) ;

CALL ImportField(40116117, 'Кредит', 'Credit', 'Кредит', ' ', 1, 401, 6, 0, '', 0, 17843) ;

CALL ImportField(40116118, 'Дебeт', 'Debit', 'Дебeт', ' ', 1, 401, 6, 0, '', 0, 17844) ;

CALL ImportField(40116119, 'Тип', 'ProgIndex', 'Тип', ' ', 1, 401, 6, 0, 'ИндексыДанных', 0, 17848) ;

CALL ImportField(40116120, 'Классификация', 'TreeOwner1', 'Классификация', ' ', 1, 401, 6, 0, '', 0, null) ;

CALL ImportField(40116121, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 401, 6, 1, 'КВСР', 0, 17825) ;

CALL ImportField(40116122, 'ФКР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 401, 6, 0, 'КФСР', 0, 17823) ;

CALL ImportField(40116123, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 401, 6, 1, 'КЦСР', 0, 17824) ;

CALL ImportField(40116124, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 401, 6, 1, 'КВР', 0, 17826) ;

CALL ImportField(40116125, 'ЭКР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 401, 6, 0, 'КЭСР', 0, 17827) ;

CALL ImportField(40116129, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 401, 6, 0, 'ТипСредств', 0, 17835) ;

CALL ImportField(40116130, 'Счет', 'ACC', 'Счет', ' ', 1, 401, 6, 0, '', 0, 17112) ;

CALL ImportField(40116131, 'Информация о налоговом платеже', 'TAXNOTE', 'Информация о налоговом платеже', ' ', 1, 401, 6, 0, '', 0, 17864) ;

CALL ImportField(40116132, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 401, 6, 0, 'ПримечаниеДет', 0, 17845) ;

CALL ImportField(40116133, 'Плановая дата', 'PlanDate', 'Плановая дата', ' ', 1, 401, 6, 0, '', 0, 17839) ;

CALL ImportField(40116134, 'Тип валюты', 'CURRENCYCLS', 'Тип валюты', ' ', 1, 401, 6, 0, 'КодВалюты', 0, 17834) ;

CALL ImportField(40116135, 'Сумма в валюте', 'CURRENCYSUMMA', 'Сумма в валюте', ' ', 1, 401, 6, 0, 'СуммаВВалюте', 0, 17842) ;

CALL ImportField(40116136, 'Район', 'REGIONCLS', 'Район', ' ', 1, 401, 6, 0, 'Район', 0, 17831) ;

CALL ImportField(40116137, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', ' ', 1, 401, 6, 0, 'ЛицевойСчет', 0, 17855) ;

CALL ImportField(40116138, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 401, 6, 0, 'ТипДокумента', 0, 17832) ;

CALL ImportField(40116139, 'СубКОСГУ', 'SUBKESR', 'СубКЭСР', ' ', 1, 401, 6, 0, 'СубКЭСР', 0, 17828) ;

CALL ImportField(40116140, 'Источник', 'FINSOURCE', 'Источник', ' ', 1, 401, 6, 0, 'ИсточникФинансирования', 0, 17830) ;

CALL ImportField(40116141, 'Реестр федеральных средств', 'FederalFundsName', 'Реестр федеральных средств', ' ', 1, 401, 6, 0, '', 0, null) ;

CALL ImportField(40116142, 'Номер документа', 'DocNumber', 'Номер документа', ' ', 1, 401, 6, 0, '', 0, 17870) ;

CALL ImportField(40116143, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 401, 6, 0, '', 0, 17871) ;

CALL ImportField(40116236, 'Счет получателя', 'AcceptorAccRef', 'AcceptorAccRef', ' ', 1, 401, 6, 1, 'СчетПолучателя', 0, 17854) ;

CALL ImportField(40116237, 'Счет кредитора', 'AccountRef', 'AccountRef', ' ', 1, 401, 6, 1, 'СчетКредитора', 0, 17837) ;

CALL ImportField(40116238, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 401, 6, 1, 'РСФО', 0, 17836) ;

CALL ImportField(40116239, 'Реестр федеральных средств', 'FederalFundsRef', 'Реестр федеральных средств', ' ', 1, 401, 6, 1, 'ФедеральныеСредства', 0, null) ;

CALL ImportField(40116240, 'Код записи', 'ID', 'ID', ' ', 1, 401, 6, 1, 'КодЗаписи', 0, 17822) ;

CALL ImportField(40117144, 'Дата начисления', 'ACCEPTDATE', 'Дата начисления', ' ', 1, 401, 7, 0, '', 0, 19112) ;

CALL ImportField(40117145, 'Процентная ставка', 'Percent', 'Процентная ставка', ' ', 1, 401, 7, 0, '', 0, 19113) ;

CALL ImportField(40117146, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 401, 7, 0, '', 0, 19116) ;

CALL ImportField(40117147, 'Тип', 'ProgIndex', 'Тип', ' ', 1, 401, 7, 0, '', 0, 19114) ;

CALL ImportField(40118148, 'Дата', 'ACCEPTDATE', 'Дата', ' ', 1, 401, 8, 0, 'Дата', 0, 19187) ;

CALL ImportField(40118149, 'Дата учета', 'RECORDDATE', 'Дата учета', ' ', 1, 401, 8, 0, 'ДатаУчета', 0, 19188) ;

CALL ImportField(40118150, 'Тип', 'PROGINDEX', 'Тип', ' ', 1, 401, 8, 0, 'ИндексыДанных', 0, 19185) ;

CALL ImportField(40118151, 'Суб. код дохода', 'SubKD', 'Суб. код дохода', ' ', 1, 401, 8, 0, 'СубКД', 0, 19196) ;

CALL ImportField(40118152, 'Счет ФО', 'DFAccountName', 'Счет ФО', ' ', 1, 401, 8, 0, '', 0, 17112) ;

CALL ImportField(40118153, 'Кредит', 'Credit', 'Кредит', ' ', 1, 401, 8, 0, '', 0, 19192) ;

CALL ImportField(40118154, 'Дебет', 'Debit', 'Дебет', ' ', 1, 401, 8, 0, '', 0, 19191) ;

CALL ImportField(40118155, 'Источники внутреннего и внешнего финансирования', 'FinSourceValue', 'Источники внутреннего и внешнего финансирования', ' ', 1, 401, 8, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(40118157, 'Вид источника(Источники внутреннего и внешнего финансирования)', 'DescriptionCode', 'Вид источника', ' ', 1, 401, 8, 0, '', 0, 17050) ;

CALL ImportField(40118158, 'ЭКИ(Источники внутреннего и внешнего финансирования)', 'IFSKESR', 'ЭКИ', ' ', 1, 401, 8, 0, '', 0, 17054) ;

CALL ImportField(40118159, 'Тек. обменный курс', 'Exchange', 'Тек. обменный курс', ' ', 1, 401, 8, 0, '', 0, 19912) ;

CALL ImportField(40118160, 'Изменение курса', 'Delta', 'Изменение курса', ' ', 1, 401, 8, 0, '', 0, 19913) ;

CALL ImportField(40118161, 'Проводка', 'BuhPaymentCLS', 'Проводка', ' ', 1, 401, 8, 0, 'БухПроводка', 0, 19208) ;

CALL ImportField(40118162, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 401, 8, 0, 'ПримечаниеДет', 0, 19200) ;

CALL ImportField(40118163, 'Документ', 'DocType', 'Документ', ' ', 1, 401, 8, 0, 'ТипДокумента', 0, 19197) ;

CALL ImportField(40118164, 'Номер документа', 'SourceDocNumber', 'Номер документа', ' ', 1, 401, 8, 0, 'НомерЗаписи', 0, 19198) ;

CALL ImportField(40118165, 'Валюта', 'CurrencyCLS', 'Валюта', ' ', 1, 401, 8, 0, 'КодВалюты', 0, 19206) ;

CALL ImportField(40118166, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 401, 8, 0, '', 0, 19217) ;

CALL ImportField(40118167, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 401, 8, 0, '', 0, 19218) ;

CALL ImportField(40118168, 'Администратор(Источники внутреннего и внешнего финансирования)', 'IFSKVSRCodeCode', 'Администратор', ' ', 1, 401, 8, 0, '', 0, null) ;

CALL ImportField(40119168, 'Наименование обеспечения', 'Name', 'Наименование обеспечения', ' ', 1, 401, 9, 0, '', 0, 20488) ;

CALL ImportField(40119169, 'Тип обеспечения', 'CollateralType', 'Тип обеспечения', ' ', 1, 401, 9, 0, '', 0, 20485) ;

CALL ImportField(40119170, 'Реальная стоимость', 'NominalSumma', 'Реальная стоимость', ' ', 1, 401, 9, 0, '', 0, 20487) ;

CALL ImportField(40119171, 'Сумма обеспечения', 'Summa', 'Сумма обеспечения', ' ', 1, 401, 9, 0, '', 0, 20486) ;

CALL ImportField(40119172, 'Код валюты', 'CurrencyCLS', 'Код валюты', ' ', 1, 401, 9, 0, '', 0, 20496) ;

CALL ImportField(40119173, 'Сумма в валюте', 'CurrencySumma', 'Сумма в валюте', ' ', 1, 401, 9, 0, '', 0, 20495) ;

CALL ImportField(40119174, 'ИНН', 'INN', 'ИНН', ' ', 1, 401, 9, 0, '', 0, 16645) ;

CALL ImportField(40119175, 'КПП', 'INN20', 'КПП', ' ', 1, 401, 9, 0, '', 0, 16653) ;

CALL ImportField(40119176, 'Организация', 'OName', 'Организация', ' ', 1, 401, 9, 0, '', 0, 16646) ;

CALL ImportField(40119177, 'Примечание', 'Note', 'Примечание', ' ', 1, 401, 9, 0, '', 0, 20490) ;

CALL ImportField(40110178, 'Счет ФО', 'DFACCOUNTName', 'Счет ФО', ' ', 1, 401, 10, 0, '', 0, 17112) ;

CALL ImportField(40110179, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', ' ', 1, 401, 10, 0, 'Дата', 0, 17838) ;

CALL ImportField(40110180, 'Сумма', 'Credit', 'Сумма', ' ', 1, 401, 10, 0, '', 0, 17843) ;

CALL ImportField(40110181, '№ документа', 'SourceDocNum', '№ документа', ' ', 1, 401, 10, 0, 'НомерЗаписи', 0, 17847) ;

CALL ImportField(40110182, 'Тип документа', 'DOCTYPE', 'Тип документа', ' ', 1, 401, 10, 0, 'ТипДокумента', 0, 17832) ;

CALL ImportField(40110183, 'Счет', 'ACC', 'Счет', ' ', 1, 401, 10, 0, '', 0, 17112) ;

CALL ImportField(40110184, 'Организация', 'Name', 'Организация', ' ', 1, 401, 10, 0, '', 0, 16646) ;

CALL ImportField(40110185, 'ИНН', 'INN', 'ИНН', ' ', 1, 401, 10, 0, '', 0, 16645) ;

CALL ImportField(40110186, 'КПП', 'INN20', 'КПП', ' ', 1, 401, 10, 0, '', 0, 16653) ;

CALL ImportField(40110187, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 401, 10, 0, 'БухПроводка', 0, 17858) ;

CALL ImportField(40110188, 'Информация о налоговом платеже', 'TAXNOTE', 'Информация о налоговом платеже', ' ', 1, 401, 10, 0, '', 0, 17864) ;

CALL ImportField(40110189, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 401, 10, 0, 'ПримечаниеДет', 0, 17845) ;

CALL ImportField(40110191, 'Классификация', 'TreeOwner2', 'Классификация', ' ', 1, 401, 10, 0, '', 0, null) ;

CALL ImportField(40110192, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 401, 10, 1, 'КВСР', 0, 17825) ;

CALL ImportField(40110193, 'ФКР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 401, 10, 0, 'КФСР', 0, 17823) ;

CALL ImportField(40110194, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 401, 10, 1, 'КЦСР', 0, 17824) ;

CALL ImportField(40110195, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 401, 10, 1, 'КВР', 0, 17826) ;

CALL ImportField(40110196, 'ЭКР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 401, 10, 0, 'КЭСР', 0, 17827) ;

CALL ImportField(40110199, 'Сумма в валюте', 'CURRENCYSUMMA', 'Сумма в валюте', ' ', 1, 401, 10, 0, 'СуммаВВалюте', 0, 17842) ;

CALL ImportField(40110200, 'Район', 'REGIONCLS', 'Район', ' ', 1, 401, 10, 0, 'Район', 0, 17831) ;

CALL ImportField(40110201, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', ' ', 1, 401, 10, 0, 'ЛицевойСчет', 0, 17855) ;

CALL ImportField(40110202, 'СубКОСГУ', 'SUBKESR', 'СубКЭСР', ' ', 1, 401, 10, 0, 'СубКЭСР', 0, 17828) ;

CALL ImportField(40110203, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 401, 10, 0, 'ДатаУчета', 0, 17861) ;

CALL ImportField(40110204, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 401, 10, 0, 'ТипСредств', 0, 17835) ;

CALL ImportField(40110205, 'Источник финансирования', 'FINSOURCE', 'Источник финансирования', ' ', 1, 401, 10, 0, 'ИсточникФинансирования', 0, 17830) ;

CALL ImportField(40110206, 'Тип валюты', 'CURRENCYCLS', 'Тип валюты', ' ', 1, 401, 10, 0, 'КодВалюты', 0, 17834) ;

CALL ImportField(40110207, 'Реестр федеральных средств', 'FederalFundsName', 'Реестр федеральных средств', ' ', 1, 401, 10, 0, '', 0, null) ;

CALL ImportField(40110208, 'Номер документа', 'DocNumber', 'Номер документа', ' ', 1, 401, 10, 0, '', 0, 17870) ;

CALL ImportField(40110209, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 401, 10, 0, '', 0, 17871) ;

CALL ImportField(40110241, 'Счет получателя', 'AcceptorAccRef', 'AcceptorAccRef', ' ', 1, 401, 10, 1, 'СчетПолучателя', 0, 17854) ;

CALL ImportField(40110242, 'Cчет', 'AccountRef', 'Cчет', ' ', 1, 401, 10, 1, 'СчетКредитора', 0, 17837) ;

CALL ImportField(40110243, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 401, 10, 1, 'РСФО', 0, 17836) ;

CALL ImportField(40110244, 'Реестр федеральных средств', 'FederalFundsRef', 'Реестр федеральных средств', ' ', 1, 401, 10, 1, 'ФедеральныеСредства', 0, null) ;

CALL ImportField(40110245, 'Код записи', 'ID', 'ID', ' ', 1, 401, 10, 1, 'КодЗаписи', 0, 17822) ;

CALL ImportField(40111210, 'Номер', 'CONTRACTNUMBER', 'Номер', ' ', 1, 401, 11, 0, '', 0, 22297) ;

CALL ImportField(40111211, 'Дата договора', 'CONTRACTDATE', 'Дата договора', ' ', 1, 401, 11, 0, '', 0, 22298) ;

CALL ImportField(40111212, 'Дата окончания', 'ENDDATE', 'Дата окончания', ' ', 1, 401, 11, 0, '', 0, 22299) ;

CALL ImportField(40111213, 'Тип договора', 'CONTRACTTYPE', 'Тип договора', ' ', 1, 401, 11, 0, '', 0, 22300) ;

CALL ImportField(40111214, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 401, 11, 0, '', 0, 22301) ;

-- Ссуды юридическим лицам, Бюджет(1)
CALL ImportField(50110001, 'Дата ввода', 'DATEINPUT', 'Дата ввода', ' ', 1, 501, 0, 0, 'ДатаДокумента', 0, 17962) ;

CALL ImportField(50110002, '№ документа', 'NUMBER', '№ документа', ' ', 1, 501, 0, 0, 'НомерДокумента,НомерЗаголовка', 0, null) ;

CALL ImportField(50110003, 'Счет ФО', 'DFACCOUNTName', 'Счет ФО', ' ', 1, 501, 0, 0, '', 0, 17112) ;

CALL ImportField(50110004, 'Получатель', 'Debitor', 'Получатель', ' ', 1, 501, 0, 0, '', 0, null) ;

CALL ImportField(50110005, 'ИНН(Получатель)', 'INN', 'ИНН', ' ', 1, 501, 0, 0, '', 0, 16645) ;

CALL ImportField(50110006, 'КПП(Получатель)', 'INN20', 'КПП', ' ', 1, 501, 0, 0, '', 0, 16653) ;

CALL ImportField(50110007, 'Имя организации(Получатель)', 'NAME', 'Имя организации', ' ', 1, 501, 0, 0, '', 0, 16646) ;

CALL ImportField(50110008, 'Сумма', 'SUMMA', 'Сумма', ' ', 1, 501, 0, 0, 'СуммаЗаголовка', 0, 17964) ;

CALL ImportField(50110009, 'Доли от ставок ЦБ', 'Rates', 'Доли от ставок ЦБ', ' ', 1, 501, 0, 0, '', 0, null) ;

CALL ImportField(50110010, 'Процент(Доли от ставок ЦБ)', 'CBPercentRate', 'Процент', ' ', 1, 501, 0, 0, 'ДоляСтавкиЦБПроц,Процент', 0, 17986) ;

CALL ImportField(50110011, 'Пеня осн.(Доли от ставок ЦБ)', 'CBFineRate', 'Пеня осн.', ' ', 1, 501, 0, 0, 'ДоляСтавкиЦБПениОсн,ПеняОсн', 0, 17987) ;

CALL ImportField(50110012, 'Пеня проц.(Доли от ставок ЦБ)', 'CBFinePercentRate', 'Пеня проц.', ' ', 1, 501, 0, 0, 'ДоляСтавкиЦБПениПроц,ПеняПроцент', 0, 17988) ;

CALL ImportField(50110013, 'Дата(Погашение осн. долга)', 'ReturnStartDate', 'Дата', ' ', 1, 501, 0, 0, 'ДатаНачалаПогашения', 0, 17991) ;

CALL ImportField(50110014, 'Периодичность(Погашение осн. долга)', 'ReturnPeriodLength', 'Периодичность', ' ', 1, 501, 0, 0, 'ПериодичностьПогашения', 0, 17992) ;

CALL ImportField(50110015, 'Дата(Начисление процентов)', 'PeriodStart', 'Дата', ' ', 1, 501, 0, 0, 'ДатаНачалаПериода,НачалоПериода', 0, 17970) ;

CALL ImportField(50110016, 'Периодичность(Начисление процентов)', 'PeriodLength', 'Периодичность', ' ', 1, 501, 0, 0, 'ДлитПериода', 0, 17971) ;

CALL ImportField(50110017, 'Дата(Уплата процентов)', 'PayPercentStartDate', 'Дата', ' ', 1, 501, 0, 0, 'ДатаНачалаУплатыПроцентов,ДатаНачалаУплаты', 0, 17993) ;

CALL ImportField(50110018, 'Периодичность(Уплата процентов)', 'PayPercentPeriodLength', 'Периодичность', ' ', 1, 501, 0, 0, 'ДлитУплаты', 0, 17994) ;

CALL ImportField(50110019, 'Дата погашения (план)(Дата закрытия)', 'DATEAMORTIZATION', 'Дата погашения (план)', ' ', 1, 501, 0, 0, 'ДатаПогашенияПлан', 0, 17963) ;

CALL ImportField(50110020, 'Дата пролонгирования(Дата закрытия)', 'LongDate', 'Дата пролонгирования', ' ', 1, 501, 0, 0, 'ДатаПролонгирования', 0, 17976) ;

CALL ImportField(50110021, 'Дата погашения (факт)(Дата закрытия)', 'AcceptDate', 'Дата погашения (факт)', ' ', 1, 501, 0, 0, 'ДатаПринятия', 0, 17977) ;

CALL ImportField(50110022, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 501, 0, 0, 'Примечание', 0, 17968) ;

CALL ImportField(50110023, 'Тип года', 'YearType', 'Тип года', ' ', 1, 501, 0, 0, 'ТипГода', 0, 17978) ;

CALL ImportField(50110024, 'Район', 'RegionCLS', 'Район', ' ', 1, 501, 0, 0, 'Район,Регион', 0, 17979) ;

CALL ImportField(50110026, 'Лицевой счет', 'FacialAcc_CLS', 'Лицевой счет', ' ', 1, 501, 0, 0, 'ЛицевойСчет', 0, 17981) ;

CALL ImportField(50110027, 'Вид ссуды', 'LoanType', 'Вид ссуды', ' ', 1, 501, 0, 0, 'ВидСсуды', 0, 17982) ;

CALL ImportField(50110028, 'Основание', 'DocBaseParent', 'Основание', ' ', 1, 501, 0, 0, '', 0, null) ;

CALL ImportField(50110030, 'Основание(Основание)', 'DocumentBaseName', 'Основание', ' ', 1, 501, 0, 0, 'Основание', 0, 16978) ;

CALL ImportField(50110152, 'Бюджет', 'BudgetRef', 'Бюджет', ' ', 1, 501, 0, 0, 'КодБюджета', 0, 17966) ;

CALL ImportField(50110153, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 501, 0, 1, 'РСФО', 0, 17999) ;

CALL ImportField(50110154, 'Код документа', 'ID', 'ID', ' ', 1, 501, 0, 1, 'КодДокумента', 0, 17960) ;

CALL ImportField(50110155, 'Получатель/Имя организации', 'Org_Ref', 'Получатель/Имя организации', ' ', 1, 501, 0, 1, 'Организация,ЗаголовокОрг', 0, 17967) ;

CALL ImportField(50111031, 'Дата выдачи', 'ACCEPTDATE', 'Дата выдачи', ' ', 1, 501, 1, 0, 'ДатаПринятия', 0, 17838) ;

CALL ImportField(50111032, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 501, 1, 0, 'ДатаУчета', 0, 17861) ;

CALL ImportField(50111033, '№ распоряжения', 'SourceDocNum', '№ распоряжения', ' ', 1, 501, 1, 0, 'НомерРаспоряжения', 0, 17847) ;

CALL ImportField(50111034, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 501, 1, 0, 'БухПроводка', 0, 17858) ;

CALL ImportField(50111035, 'Счет ФО', 'DFACCOUNTName', 'Счет ФО', ' ', 1, 501, 1, 0, '', 0, 17112) ;

CALL ImportField(50111036, 'Кредит', 'CREDIT', 'Кредит', ' ', 1, 501, 1, 0, 'Кредит', 0, 17843) ;

CALL ImportField(50111037, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 501, 1, 0, '', 0, null) ;

CALL ImportField(50111038, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 501, 1, 1, 'КВСР', 0, 17825) ;

CALL ImportField(50111039, 'КФСР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 501, 1, 0, 'КФСР', 0, 17823) ;

CALL ImportField(50111040, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 501, 1, 1, 'КЦСР', 0, 17824) ;

CALL ImportField(50111041, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 501, 1, 1, 'КВР', 0, 17826) ;

CALL ImportField(50111042, 'КЭСР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 501, 1, 0, 'КЭСР', 0, 17827) ;

CALL ImportField(50111045, 'СубКЭСР', 'SUBKESR', 'СубКЭСР', ' ', 1, 501, 1, 0, 'СубКЭСР', 0, 17828) ;

CALL ImportField(50111046, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 501, 1, 0, 'ТипДокумента', 0, 17832) ;

CALL ImportField(50111047, 'Источник', 'FINSOURCE', 'Источник', ' ', 1, 501, 1, 0, 'ИсточникФинансирования', 0, 17830) ;

CALL ImportField(50111049, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 501, 1, 0, 'ТипСредств', 0, 17835) ;

CALL ImportField(50111050, 'Счет', 'ACC', 'Счет', ' ', 1, 501, 1, 0, '', 0, 17112) ;

CALL ImportField(50111051, 'Счет(*)', 'AccA', 'Счет(*)', ' ', 1, 501, 1, 0, '', 0, null) ;

CALL ImportField(50111052, 'ИНН(*)', 'INNA', 'ИНН(*)', ' ', 1, 501, 1, 0, '', 0, null) ;

CALL ImportField(50111053, 'КПП(*)', 'KPPA', 'КПП(*)', ' ', 1, 501, 1, 0, '', 0, null) ;

CALL ImportField(50111054, 'Организация(*)', 'OrgNameA', 'Организация(*)', ' ', 1, 501, 1, 0, '', 0, null) ;

CALL ImportField(50111055, 'Тип счета', 'ACC_CLS', 'Тип счета', ' ', 1, 501, 1, 0, '', 0, 17113) ;

CALL ImportField(50111056, 'Информация о налоговом платеже', 'TAXNOTE', 'Информация о налоговом платеже', ' ', 1, 501, 1, 0, '', 0, 17864) ;

CALL ImportField(50111057, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 501, 1, 0, 'ПримечаниеДет,Примечание', 0, 17845) ;

CALL ImportField(50111058, 'Район', 'REGIONCLS', 'Район', ' ', 1, 501, 1, 0, 'РегионФин', 0, 17831) ;

CALL ImportField(50111059, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', ' ', 1, 501, 1, 0, 'ЛицевойСчетФин', 0, 17855) ;

CALL ImportField(50111060, 'Реестр федеральных средств', 'FederalFundsName', 'Реестр федеральных средств', ' ', 1, 501, 1, 0, '', 0, null) ;

CALL ImportField(50111061, 'Номер', 'DocNumber', 'Номер', ' ', 1, 501, 1, 0, '', 0, 17870) ;

CALL ImportField(50111062, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 501, 1, 0, 'БухОперация', 0, 17871) ;

CALL ImportField(50111157, 'Счет(*)', 'AcceptorAccRef', 'Счет(*)', ' ', 1, 501, 1, 1, 'СчетПолучателя,СчетПолуч', 0, 17854) ;

CALL ImportField(50111158, 'Счет', 'ACCOUNTREF', 'Счет', ' ', 1, 501, 1, 1, 'СчетРаспорядителя', 0, 17837) ;

CALL ImportField(50111159, 'Дебет', 'DEBIT', 'Дебет', ' ', 1, 501, 1, 1, 'Дебет', 0, 17844) ;

CALL ImportField(50111160, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 501, 1, 1, 'РСФО', 0, 17836) ;

CALL ImportField(50111161, 'Код записи', 'ID', 'ID', ' ', 1, 501, 1, 1, 'КодЗаписи', 0, 17822) ;

CALL ImportField(50111175, 'Реестр федеральных средств', 'FederalFundsRef', 'Реестр федеральных средств', ' ', 1, 501, 1, 1, 'ФедеральныеСредства', 0, null) ;

CALL ImportField(50111177, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 501, 1, 0, '', 0, 17050) ;

CALL ImportField(50111178, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 501, 1, 0, '', 0, 17054) ;

CALL ImportField(50111179, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 501, 1, 0, '', 0, 17874) ;

CALL ImportField(50112063, 'Дата', 'PLANDATE', 'Дата', ' ', 1, 501, 2, 0, 'Дата', 0, 19225) ;

CALL ImportField(50112064, 'Сумма', 'SUMMA', 'Сумма', ' ', 1, 501, 2, 0, 'Кредит', 0, 19226) ;

CALL ImportField(50112065, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 501, 2, 0, 'ПримечаниеДет', 0, 19227) ;

CALL ImportField(50112162, 'Код записи', 'ID', 'ID', ' ', 1, 501, 2, 1, 'КодЗаписи', 0, 19222) ;

CALL ImportField(50113066, 'Дата погашения', 'ACCEPTDATE', 'Дата погашения', ' ', 1, 501, 3, 0, 'ДатаПринятия', 0, 17838) ;

CALL ImportField(50113067, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 501, 3, 0, 'ДатаУчета', 0, 17861) ;

CALL ImportField(50113068, 'Реестр федеральных средств', 'FederalFundsName', 'Реестр федеральных средств', ' ', 1, 501, 3, 0, '', 0, null) ;

CALL ImportField(50113069, '№ распоряжения', 'SourceDocNum', '№ распоряжения', ' ', 1, 501, 3, 0, 'НомерРаспоряжения', 0, 17847) ;

CALL ImportField(50113070, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 501, 3, 0, 'БухПроводка', 0, 17858) ;

CALL ImportField(50113071, 'Счет ФО', 'DFACCOUNTName', 'Счет ФО', ' ', 1, 501, 3, 0, '', 0, 17112) ;

CALL ImportField(50113072, 'Дебет', 'DEBIT', 'Дебет', ' ', 1, 501, 3, 0, 'Дебет', 0, 17844) ;

CALL ImportField(50113073, 'Классификация', 'TreeOwner1', 'Классификация', ' ', 1, 501, 3, 0, '', 0, null) ;

CALL ImportField(50113074, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 501, 3, 1, 'КВСР', 0, 17825) ;

CALL ImportField(50113075, 'КФСР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 501, 3, 0, 'КФСР', 0, 17823) ;

CALL ImportField(50113076, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 501, 3, 1, 'КЦСР', 0, 17824) ;

CALL ImportField(50113077, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 501, 3, 1, 'КВР', 0, 17826) ;

CALL ImportField(50113078, 'КЭСР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 501, 3, 0, 'КЭСР', 0, 17827) ;

CALL ImportField(50113081, 'СубКЭСР', 'SUBKESR', 'СубКЭСР', ' ', 1, 501, 3, 0, 'СубКЭСР', 0, 17828) ;

CALL ImportField(50113082, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 501, 3, 0, 'ТипДокумента', 0, 17832) ;

CALL ImportField(50113083, 'Источник', 'FINSOURCE', 'Источник', ' ', 1, 501, 3, 0, 'ИсточникФинансирования', 0, 17830) ;

CALL ImportField(50113085, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 501, 3, 0, 'ТипСредств', 0, 17835) ;

CALL ImportField(50113086, 'Счет', 'ACC', 'Счет', ' ', 1, 501, 3, 0, '', 0, 17112) ;

CALL ImportField(50113087, 'Тип счета', 'ACC_CLS', 'Тип счета', ' ', 1, 501, 3, 0, '', 0, 17113) ;

CALL ImportField(50113088, 'Счет(*)', 'AccA', 'Счет(*)', ' ', 1, 501, 3, 0, '', 0, null) ;

CALL ImportField(50113089, 'ИНН(*)', 'INNA', 'ИНН(*)', ' ', 1, 501, 3, 0, '', 0, null) ;

CALL ImportField(50113090, 'КПП(*)', 'KPPA', 'КПП(*)', ' ', 1, 501, 3, 0, '', 0, null) ;

CALL ImportField(50113091, 'Организация(*)', 'OrgNameA', 'Организация(*)', ' ', 1, 501, 3, 0, '', 0, null) ;

CALL ImportField(50113092, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 501, 3, 0, 'ПримечаниеДет', 0, 17845) ;

CALL ImportField(50113093, 'Район', 'REGIONCLS', 'Район', ' ', 1, 501, 3, 0, 'РегионФин', 0, 17831) ;

CALL ImportField(50113094, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', ' ', 1, 501, 3, 0, 'ЛицевойСчетФин', 0, 17855) ;

CALL ImportField(50113095, 'Номер', 'DocNumber', 'Номер', ' ', 1, 501, 3, 0, '', 0, 17870) ;

CALL ImportField(50113096, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 501, 3, 0, 'БухОперация', 0, 17871) ;

CALL ImportField(50113163, 'Счет(*)', 'AcceptorAccRef', 'Счет(*)', ' ', 1, 501, 3, 1, 'СчетПолучателя,СчетПолуч', 0, 17854) ;

CALL ImportField(50113164, 'Счет', 'ACCOUNTREF', 'Счет', ' ', 1, 501, 3, 1, 'СчетРаспорядителя', 0, 17837) ;

CALL ImportField(50113165, 'Кредит', 'CREDIT', 'Кредит', ' ', 1, 501, 3, 1, 'Кредит', 0, 17843) ;

CALL ImportField(50113166, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 501, 3, 1, 'РСФО', 0, 17836) ;

CALL ImportField(50113167, 'Код записи', 'ID', 'ID', ' ', 1, 501, 3, 1, 'КодЗаписи', 0, 17822) ;

CALL ImportField(50113181, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 501, 3, 0, '', 0, 17050) ;

CALL ImportField(50113182, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 501, 3, 0, '', 0, 17054) ;

CALL ImportField(50113183, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 501, 3, 0, '', 0, 17874) ;

CALL ImportField(50114097, 'Дата начисления', 'ACCEPTDATE', 'Дата начисления', ' ', 1, 501, 4, 0, 'Дата', 0, 18125) ;

CALL ImportField(50114098, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 501, 4, 0, 'ТипСредств', 0, 18145) ;

CALL ImportField(50114099, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 501, 4, 0, 'ДатаУчета', 0, 18138) ;

CALL ImportField(50114100, 'Счет ФО', 'DFACCOUNTName', 'Счет ФО', ' ', 1, 501, 4, 0, '', 0, 17112) ;

CALL ImportField(50114101, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 501, 4, 0, 'БухПроводка', 0, 18128) ;

CALL ImportField(50114102, 'Сумма', 'SUMMA', 'Сумма', ' ', 1, 501, 4, 0, 'Кредит', 0, 18126) ;

CALL ImportField(50114103, 'Код дохода', 'KDValue', 'Код дохода', ' ', 1, 501, 4, 0, 'КодДохода', 0, 16836) ;

CALL ImportField(50114104, 'КВСР(Код дохода)', 'KVSR', 'КВСР', ' ', 1, 501, 4, 0, '', 0, null) ;

CALL ImportField(50114105, 'Вид дохода(Код дохода)', 'DescriptionCodeKD', 'Вид дохода', ' ', 1, 501, 4, 0, '', 0, 16831) ;

CALL ImportField(50114106, 'Программа(Код дохода)', 'ProgramCode', 'Программа', ' ', 1, 501, 4, 0, '', 0, 16834) ;

CALL ImportField(50114107, 'ЭКД(Код дохода)', 'KESR', 'ЭКД', ' ', 1, 501, 4, 0, '', 0, 16835) ;

CALL ImportField(50114108, 'Начало периода', 'PeriodStart', 'Начало периода', ' ', 1, 501, 4, 0, 'ДатаНачалаПериода', 0, 18130) ;

CALL ImportField(50114109, 'Конец периода', 'PeriodEnd', 'Конец периода', ' ', 1, 501, 4, 0, 'ДатаКонцаПериода', 0, 18131) ;

CALL ImportField(50114110, 'Дата уплаты(план)', 'PayPercentDate', 'Дата уплаты(план)', ' ', 1, 501, 4, 0, 'ДатаУплатыПроцПлан', 0, 18132) ;

CALL ImportField(50114111, 'Субкод', 'SUBKD', 'Субкод', ' ', 1, 501, 4, 0, 'СубКД', 0, 18127) ;

CALL ImportField(50114112, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 501, 4, 0, 'ПримечаниеДет', 0, 18129) ;

CALL ImportField(50114113, 'Тип', 'ProgIndex', 'Тип', ' ', 1, 501, 4, 0, 'ИндексыДанных', 0, 18133) ;

CALL ImportField(50114114, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 501, 4, 0, 'БухОперация', 0, 18142) ;

CALL ImportField(50114168, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 501, 4, 1, 'РСФО', 0, 18141) ;

CALL ImportField(50114169, 'Код записи', 'ID', 'ID', ' ', 1, 501, 4, 1, 'КодЗаписи', 0, 18123) ;

CALL ImportField(50115115, 'Дата', 'PlanDate', 'Дата', ' ', 1, 501, 5, 0, 'Дата', 0, 19225) ;

CALL ImportField(50115116, 'Сумма', 'SUMMA', 'Сумма', ' ', 1, 501, 5, 0, 'Кредит', 0, 19226) ;

CALL ImportField(50115117, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 501, 5, 0, 'ПримечаниеДет', 0, 19227) ;

CALL ImportField(50116118, 'Дата уплаты', 'IDATE', 'Дата уплаты', ' ', 1, 501, 6, 0, 'Дата', 0, 17672) ;

CALL ImportField(50116119, 'Дата учета', 'RecordDate', 'Дата учета', ' ', 1, 501, 6, 0, 'ДатаУчета', 0, 17701) ;

CALL ImportField(50116120, 'Проводка', 'BUHPAYMENTCLS', 'Проводка', ' ', 1, 501, 6, 0, 'БухПроводка', 0, 17700) ;

CALL ImportField(50116121, 'Счет', 'AccountName', 'Счет', ' ', 1, 501, 6, 0, '', 0, 17112) ;

CALL ImportField(50116123, 'Кредит', 'CREDIT', 'Кредит', ' ', 1, 501, 6, 0, 'Кредит', 0, 17674) ;

CALL ImportField(50116124, 'Код дохода', 'KDValue', 'Код дохода', ' ', 1, 501, 6, 0, 'КодДохода', 0, 16836) ;

CALL ImportField(50116125, 'КВСР(Код дохода)', 'KVSR', 'КВСР', ' ', 1, 501, 6, 0, '', 0, null) ;

CALL ImportField(50116126, 'Вид дохода(Код дохода)', 'DescriptionCOde', 'Вид дохода', ' ', 1, 501, 6, 0, '', 0, 16831) ;

CALL ImportField(50116127, 'Программа(Код дохода)', 'ProgramCode', 'Программа', ' ', 1, 501, 6, 0, '', 0, 16834) ;

CALL ImportField(50116128, 'ЭКД(Код дохода)', 'KESR', 'ЭКД', ' ', 1, 501, 6, 0, '', 0, 16835) ;

CALL ImportField(50116129, 'Субкод', 'SUBKD', 'Субкод', ' ', 1, 501, 6, 0, 'СубКД', 0, 17681) ;

CALL ImportField(50116130, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 501, 6, 0, 'ТипДокумента', 0, 17675) ;

CALL ImportField(50116131, '№ документа', 'DOCNUM', '№ документа', ' ', 1, 501, 6, 0, 'НомерРаспоряжения', 0, 17707) ;

CALL ImportField(50116132, 'Слой', 'ACCOUNTINDEX', 'Слой', ' ', 1, 501, 6, 0, '', 0, 17678) ;

CALL ImportField(50116133, 'ГосНИ', 'GosNI', 'ГосНИ', ' ', 1, 501, 6, 0, '', 0, 17683) ;

CALL ImportField(50116134, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 501, 6, 0, 'ПримечаниеДет', 0, 17692) ;

CALL ImportField(50116135, 'Тип', 'PROGINDEX', 'Тип', ' ', 1, 501, 6, 0, 'ИндексыДанных', 0, 17685) ;

CALL ImportField(50116136, 'Район', 'RegionCLS', 'Район', ' ', 1, 501, 6, 0, 'Район', 0, 17682) ;

CALL ImportField(50116137, 'Лицевой счет', 'FacialAcc_CLS', 'Лицевой счет', ' ', 1, 501, 6, 0, 'ЛицевойСчет', 0, 17697) ;

CALL ImportField(50116138, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 501, 6, 0, 'ТипСредств', 0, 17699) ;

CALL ImportField(50116139, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 501, 6, 0, 'БухОперация', 0, 17720) ;

CALL ImportField(50116170, 'Счет', 'AccountRef', 'Счет', ' ', 1, 501, 6, 1, 'СчетРаспорядителя', 0, 17679) ;

CALL ImportField(50116171, 'Дебет', 'DEBIT', 'Дебет', ' ', 1, 501, 6, 1, 'Дебет', 0, 17673) ;

CALL ImportField(50116172, 'Код записи', 'ID', 'ID', ' ', 1, 501, 6, 1, 'КодЗаписи', 0, 17669) ;

CALL ImportField(50116173, 'На счет ФО', 'INCACCOUNT', 'На счет ФО', ' ', 1, 501, 6, 1, 'РСФО', 0, 17684) ;

CALL ImportField(50116174, 'Код дохода', 'KD', 'Код дохода', ' ', 1, 501, 6, 1, 'КДКлюч', 0, 17680) ;

CALL ImportField(50117140, 'Дата начисления', 'ACCEPTDATE', 'Дата начисления', ' ', 1, 501, 7, 0, 'ДатаПринятия', 0, 19112) ;

CALL ImportField(50117141, 'Процентная ставка', 'Percent', 'Процентная ставка', ' ', 1, 501, 7, 0, '', 0, 19113) ;

CALL ImportField(50117142, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 501, 7, 0, '', 0, 19116) ;

CALL ImportField(50117143, 'Тип', 'PROGINDEX', 'Тип', ' ', 1, 501, 7, 0, '', 0, 19114) ;

CALL ImportField(50118144, 'Имя обеспечения', 'Name', 'Имя обеспечения', ' ', 1, 501, 8, 0, '', 0, 20488) ;

CALL ImportField(50118145, 'Тип обеспечения', 'CollateralType', 'Тип обеспечения', ' ', 1, 501, 8, 0, '', 0, 20485) ;

CALL ImportField(50118146, 'Реальная стоимость', 'NominalSumma', 'Реальная стоимость', ' ', 1, 501, 8, 0, '', 0, 20487) ;

CALL ImportField(50118147, 'Сумма обеспечения', 'Summa', 'Сумма обеспечения', ' ', 1, 501, 8, 0, '', 0, 20486) ;

CALL ImportField(50118148, 'ИНН', 'INN', 'ИНН', ' ', 1, 501, 8, 0, '', 0, 16645) ;

CALL ImportField(50118149, 'КПП', 'INN20', 'КПП', ' ', 1, 501, 8, 0, '', 0, 16653) ;

CALL ImportField(50118150, 'Организация', 'OName', 'Организация', ' ', 1, 501, 8, 0, '', 0, 16646) ;

CALL ImportField(50118151, 'Примечание', 'Note', 'Примечание', ' ', 1, 501, 8, 0, '', 0, 20490) ;

-- Распоряжения на финансирование, Бюджет(1)
CALL ImportField(70110001, 'Номер', 'NUMBER', 'Номер', ' ', 1, 701, 0, 0, 'НомерЗаголовка', 0, null) ;

CALL ImportField(70110002, 'Дата создания', 'MAKEDATE', 'Дата создания', ' ', 1, 701, 0, 0, 'ДатаВвода,ДатаРеестра', 0, 17879) ;

CALL ImportField(70110003, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', ' ', 1, 701, 0, 0, 'ДатаПринятия', 0, 17880) ;

CALL ImportField(70110004, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 701, 0, 0, 'КодБюджета', 0, 17889) ;

CALL ImportField(70110005, 'Примечание', 'USERNOTE', 'Примечание', ' ', 1, 701, 0, 0, 'ПримечаниеЗаголовка', 0, 17881) ;

CALL ImportField(70110045, 'Счет ФО', 'DFAccountName', 'Счет ФО', ' ', 1, 701, 0, 0, '', 0, 17112) ;

CALL ImportField(70110051, 'Электронный пакет', 'ElPacketName', 'Электронный пакет', ' ', 1, 701, 0, 1, 'ИмяПакета', 0, 17890) ;

CALL ImportField(70110052, 'Код документа', 'ID', 'ID', ' ', 1, 701, 0, 1, 'КодДокумента', 0, 17877) ;

CALL ImportField(70110053, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 701, 0, 1, 'СчетПлат,РСФО', 0, 17882) ;

CALL ImportField(70110054, 'Описание счета', 'DFAccountComment', 'Описание счета', ' ', 1, 701, 0, 0, '', 0, null) ;

CALL ImportField(70111006, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 701, 1, 0, '', 0, null) ;

CALL ImportField(70111007, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 701, 1, 1, 'КВСРКлюч', 0, 17825) ;

CALL ImportField(70111008, 'ФКР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 701, 1, 0, 'КФСР', 0, 17823) ;

CALL ImportField(70111009, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 701, 1, 1, 'КЦСРКлюч', 0, 17824) ;

CALL ImportField(70111010, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 701, 1, 1, 'КВРКлюч', 0, 17826) ;

CALL ImportField(70111011, 'ЭКР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 701, 1, 0, 'КЭСР', 0, 17827) ;

CALL ImportField(70111015, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника', ' ', 1, 701, 1, 0, '', 0, 17050) ;

CALL ImportField(70111016, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭК', ' ', 1, 701, 1, 0, '', 0, 17054) ;

CALL ImportField(70111017, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 701, 1, 0, 'ТипКлассификации', 0, 17874) ;

CALL ImportField(70111018, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', ' ', 1, 701, 1, 0, 'СубКЭСР', 0, 17828) ;

CALL ImportField(70111019, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', ' ', 1, 701, 1, 0, 'ЛицевойСчет', 0, 17855) ;

CALL ImportField(70111020, 'Источник', 'FINSOURCE', 'Источник', ' ', 1, 701, 1, 0, 'ИсточникФинансирования', 0, 17830) ;

CALL ImportField(70111022, 'Район', 'REGIONCLS', 'Район', ' ', 1, 701, 1, 0, 'Регион', 0, 17831) ;

CALL ImportField(70111023, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 701, 1, 0, 'ТипДокумента', 0, 17832) ;

CALL ImportField(70111024, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 701, 1, 0, 'ТипСредств', 0, 17835) ;

CALL ImportField(70111025, 'Кредит', 'CREDIT', 'Кредит', ' ', 1, 701, 1, 0, '', 0, 17843) ;

CALL ImportField(70111026, 'Дебет', 'DEBIT', 'Дебет', ' ', 1, 701, 1, 0, '', 0, 17844) ;

CALL ImportField(70111027, 'Распорядитель', 'ManagerOwner', 'Распорядитель', ' ', 1, 701, 1, 0, '', 0, null) ;

CALL ImportField(70111028, 'ИНН(Распорядитель)', 'INN', 'ИНН', ' ', 1, 701, 1, 0, '', 0, 16645) ;

CALL ImportField(70111029, 'КПП(Распорядитель)', 'KPP', 'КПП', ' ', 1, 701, 1, 0, '', 0, 16653) ;

CALL ImportField(70111030, 'Наименование(Распорядитель)', 'NAME', 'Наименование', ' ', 1, 701, 1, 0, '', 0, 16646) ;

CALL ImportField(70111031, 'Тип организации(Распорядитель)', 'ORG_CLS', 'Тип организации', ' ', 1, 701, 1, 0, '', 0, 16652) ;

CALL ImportField(70111032, 'Счет(Распорядитель)', 'ACC', 'Счет', ' ', 1, 701, 1, 0, '', 0, 17112) ;

CALL ImportField(70111033, 'Тип счета(Распорядитель)', 'ACC_CLS', 'Тип счета', ' ', 1, 701, 1, 0, 'ТипСчета', 0, 17113) ;

CALL ImportField(70111034, 'Назначение платежа', 'NOTE', 'Назначение платежа', ' ', 1, 701, 1, 0, 'Примечание', 0, 17845) ;

CALL ImportField(70111035, 'Получатель(*)', 'AcceptorOwner', 'Получатель(*)', ' ', 1, 701, 1, 0, '', 0, null) ;

CALL ImportField(70111036, 'ИНН(Получатель(*))', 'INNA', 'ИНН', ' ', 1, 701, 1, 0, '', 0, 16645) ;

CALL ImportField(70111037, 'КПП(Получатель(*))', 'KPPA', 'КПП', ' ', 1, 701, 1, 0, '', 0, 16653) ;

CALL ImportField(70111038, 'Наименование(Получатель(*))', 'NAMEA', 'Наименование', ' ', 1, 701, 1, 0, '', 0, 16646) ;

CALL ImportField(70111039, 'Счет(Получатель(*))', 'ACCA', 'Счет', ' ', 1, 701, 1, 0, '', 0, 17112) ;

CALL ImportField(70111040, '№Бюджетного обязательства', 'Promise', '№Бюджетного обязательства', ' ', 1, 701, 1, 0, 'БюджОбяз', 0, 17857) ;

CALL ImportField(70111041, 'Л/С ФК', 'FacialCode', 'Л/С ФК', ' ', 1, 701, 1, 0, '', 0, null) ;

CALL ImportField(70111043, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', ' ', 1, 701, 1, 0, '', 0, null) ;

CALL ImportField(70111044, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 701, 1, 0, 'БухОперация', 0, 17871) ;

CALL ImportField(70111046, 'Номер', 'DocNumber', 'Номер', ' ', 1, 701, 1, 0, 'НомерДокумента', 0, 17870) ;

CALL ImportField(70111047, 'Код валюты', 'CURRENCYCLS', 'Код валюты', ' ', 1, 701, 1, 0, 'КодВалюты', 0, 17834) ;

CALL ImportField(70111048, 'Сумма в валюте', 'CURRENCYSUMMA', 'Сумма в валюте', ' ', 1, 701, 1, 0, '', 0, 17842) ;

CALL ImportField(70111049, 'Информация о налоговом платеже', 'taxNote', 'Информация о налоговом платеже', ' ', 1, 701, 1, 0, 'ИнформацияОНалоге', 0, 17864) ;

CALL ImportField(70111054, 'Бух. проводка', 'BuhPaymentCls', 'Бух. проводка', ' ', 1, 701, 1, 1, 'БухПроводка', 0, 17858) ;

CALL ImportField(70111055, 'Индекс заявки', 'RequestsIndex', 'Индекс заявки', ' ', 1, 701, 1, 1, 'Заявка', 0, 17859) ;

CALL ImportField(70111056, 'Источниковая классификация', 'IFS', 'Источниковая классификация', ' ', 1, 701, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17872) ;

CALL ImportField(70111057, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 701, 1, 1, '', 0, 17840) ;

CALL ImportField(70111058, 'Код документа', 'RECORDINDEX', 'RECORDINDEX', ' ', 1, 701, 1, 1, 'КодДокумента', 0, 17849) ;

CALL ImportField(70111059, 'Код записи', 'ID', 'ID', ' ', 1, 701, 1, 1, 'КодЗаписи', 0, 17822) ;

CALL ImportField(70111060, 'Счет', 'ACCEPTORACCREF', 'Счет', ' ', 1, 701, 1, 1, 'СчетПолуч', 0, 17854) ;

CALL ImportField(70111061, 'Счет распорядителя', 'ACCOUNTREF', 'ACCOUNTREF', ' ', 1, 701, 1, 1, 'СчетРаспорядителя', 0, 17837) ;

CALL ImportField(70111062, 'Федеральные cредства', 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', ' ', 1, 701, 1, 1, 'ФедеральныеСредства', 0, 17865) ;

CALL ImportField(70111063, 'ElDocRef', 'ElDocRef', 'ElDocRef', ' ', 1, 701, 1, 1, '', 0, 17868) ;

CALL ImportField(70111064, 'Источниковая классификация', 'IFS_FullID', 'IFS_FullID(Источниковая классификация)', ' ', 1, 701, 1, 1, 'ИсточникВнутрФинансирования', 0, 17055) ;

-- Банковские платежные поручения, Бюджет(1)
CALL ImportField(70210001, 'Номер', 'Number', 'Номер', ' ', 1, 702, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(70210002, 'Дата ввода', 'InputDate', 'Дата ввода', ' ', 1, 702, 0, 0, 'ДатаВвода', 0, 17167) ;

CALL ImportField(70210003, 'Сумма', 'Credit', 'Сумма', ' ', 1, 702, 0, 0, '', 0, 17197) ;

CALL ImportField(70210004, 'Сумма инкассового', 'Debit', 'Сумма инкассового', ' ', 1, 702, 0, 0, '', 0, 17198) ;

CALL ImportField(70210005, 'Дата проведения', 'AcceptDate', 'Дата проведения', ' ', 1, 702, 0, 0, 'ДатаПринятия', 0, 17169) ;

CALL ImportField(70210006, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 702, 0, 0, 'КодБюджета', 0, 17203) ;

CALL ImportField(70210007, 'Плательщик', 'PayerOwner', 'Плательщик', ' ', 1, 702, 0, 0, '', 0, null) ;

CALL ImportField(70210008, 'Наименование(Плательщик)', 'PayerName', 'Наименование', ' ', 1, 702, 0, 0, '', 0, 16646) ;

CALL ImportField(70210009, 'ИНН(Плательщик)', 'PayerINN', 'ИНН', ' ', 1, 702, 0, 0, '', 0, 16645) ;

CALL ImportField(70210010, 'КПП(Плательщик)', 'PayerINN20', 'КПП', ' ', 1, 702, 0, 0, '', 0, 16653) ;

CALL ImportField(70210011, 'Счет(Плательщик)', 'PayerAcc', 'Счет', ' ', 1, 702, 0, 0, '', 0, 17112) ;

CALL ImportField(70210012, 'Получатель', 'AcceptorOwner', 'Получатель', ' ', 1, 702, 0, 0, '', 0, null) ;

CALL ImportField(70210013, 'Наименование(Получатель)', 'AcceptorName', 'Наименование', ' ', 1, 702, 0, 0, '', 0, 16646) ;

CALL ImportField(70210014, 'ИНН(Получатель)', 'AcceptorINN', 'ИНН', ' ', 1, 702, 0, 0, '', 0, 16645) ;

CALL ImportField(70210015, 'КПП(Получатель)', 'AcceptorINN20', 'КПП', ' ', 1, 702, 0, 0, '', 0, 16653) ;

CALL ImportField(70210016, 'Счет(Получатель)', 'AcceptorAcc', 'Счет', ' ', 1, 702, 0, 0, '', 0, 17112) ;

CALL ImportField(70210017, 'Вид платежа', 'SendBy', 'Вид платежа', ' ', 1, 702, 0, 0, 'ВидПлатежа', 0, 17172) ;

CALL ImportField(70210018, 'Дата платежа', 'PayDate', 'Дата платежа', ' ', 1, 702, 0, 0, '', 0, 17176) ;

CALL ImportField(70210019, 'Очередность платежа', 'PayQueue', 'Очередность платежа', ' ', 1, 702, 0, 0, 'Очередность', 0, 17177) ;

CALL ImportField(70210020, 'Примечание', 'TextNote', 'Примечание', ' ', 1, 702, 0, 0, 'Примечание', 0, 17178) ;

CALL ImportField(70210021, 'Код валюты', 'Currency', 'Код валюты', ' ', 1, 702, 0, 0, 'КодВалюты', 0, 17175) ;

CALL ImportField(70210022, 'Сумма в валюте', 'CurSum', 'Сумма в валюте', ' ', 1, 702, 0, 0, '', 0, 17174) ;

CALL ImportField(70210024, 'Тип документа', 'DocType', 'Тип документа', ' ', 1, 702, 0, 0, '', 0, 17190) ;

CALL ImportField(70210025, 'Информация о налоговом платеже', 'TaxNote', 'Информация о налоговом платеже', ' ', 1, 702, 0, 0, 'ИнформацияОНалоге', 0, 17192) ;

CALL ImportField(70210026, 'Причина отклонения', 'Reject_Cls', 'Причина отклонения', ' ', 1, 702, 0, 0, 'ПричинаОтклонКод', 0, 17193) ;

CALL ImportField(70210027, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', ' ', 1, 702, 0, 0, 'ПричинаОтклонТекст', 0, 17194) ;

CALL ImportField(70210058, 'Лицевой счет плательщика', 'SourceFacialAcc_Cls', 'Лицевой счет плательщика', ' ', 1, 702, 0, 1, 'ЛицСчетПлательщика', 0, null) ;

CALL ImportField(70210059, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет получателя', ' ', 1, 702, 0, 0, '', 0, 17188) ;

CALL ImportField(70210060, 'Условие оплаты', 'PaymentCondition', 'Условие оплаты', ' ', 1, 702, 0, 0, 'УсловиеОплаты', 0, 17202) ;

CALL ImportField(70210064, 'Автор(Авторизация)', 'CreaterUser', 'Автор(Авторизация)', ' ', 1, 702, 0, 1, 'Автор', 0, 17181) ;

CALL ImportField(70210065, 'Код документа', 'Id', 'Id', ' ', 1, 702, 0, 1, 'КодДокумента', 0, 17165) ;

CALL ImportField(70210066, 'Номер распоряжения', 'SourceDocNumber', 'Номер распоряжения', ' ', 1, 702, 0, 1, 'НомерРеестра', 0, 17186) ;

CALL ImportField(70210067, 'Счет плательщика', 'PayerAttrRef', 'Счет плательщика', ' ', 1, 702, 0, 1, 'РСФО', 0, 17170) ;

CALL ImportField(70210068, 'Счет получателя', 'AcceptorAttrRef', 'Счет получателя', ' ', 1, 702, 0, 1, 'СчетПолуч', 0, 17171) ;

CALL ImportField(70210069, 'Счет распорядителя', 'AccountRef', 'AccountRef', ' ', 1, 702, 0, 1, 'СчетРаспорядителя', 0, 17189) ;

CALL ImportField(70210077, 'Индекс записи', 'RecordIndex', 'Индекс записи', ' ', 1, 702, 0, 1, 'ИндЗаписи', 0, null) ;

CALL ImportField(70210078, 'Количество дочерних', 'ChildCount', 'Количестов дочерних документов', ' ', 1, 702, 0, 1, 'КолвоДочерних', 0, null) ;

CALL ImportField(70210079, 'Номер пакета(заголовок)', 'PacketNumber', 'Номер пакета записи заголовка', ' ', 1, 702, 0, 0, 'Заголовок№пакета', 0, null) ;

CALL ImportField(70210080, 'Статус(Обмен с банком)(Заголовок)', 'Status', 'Статус заголовка', ' ', 1, 702, 0, 0, 'СтатусЗаголовка', 0, null) ;

CALL ImportField(70210081, 'Сумма', 'Summa', 'Сумма', ' ', 1, 702, 0, 0, 'Сумма', 0, null) ;

CALL ImportField(70210082, 'Прогиндекс', 'ProgIndex', 'Прогиндекс', ' ', 1, 702, 0, 0, '', 0, null) ;

CALL ImportField(70211028, 'Номер', 'Number', 'Номер', ' ', 1, 702, 1, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(70211029, 'Дата ввода', 'InputDate', 'Дата ввода', ' ', 1, 702, 1, 0, 'ДатаВвода', 0, 17167) ;

CALL ImportField(70211030, 'Сумма', 'Credit', 'Сумма', ' ', 1, 702, 1, 0, '', 0, 17197) ;

CALL ImportField(70211031, 'Сумма инкассового', 'Debit', 'Сумма инкассового', ' ', 1, 702, 1, 0, '', 0, 17198) ;

CALL ImportField(70211032, 'Плательщик', 'PayerOwner', 'Плательщик', ' ', 1, 702, 1, 0, '', 0, null) ;

CALL ImportField(70211033, 'Наименование(Плательщик)', 'PayerName', 'Наименование', ' ', 1, 702, 1, 0, '', 0, 16646) ;

CALL ImportField(70211034, 'ИНН(Плательщик)', 'PayerINN', 'ИНН', ' ', 1, 702, 1, 0, '', 0, 16645) ;

CALL ImportField(70211035, 'КПП(Плательщик)', 'PayerINN20', 'КПП', ' ', 1, 702, 1, 0, '', 0, 16653) ;

CALL ImportField(70211036, 'Счет(Плательщик)', 'PayerAcc', 'Счет', ' ', 1, 702, 1, 0, '', 0, 17112) ;

CALL ImportField(70211037, 'Получатель', 'AcceptorOwner', 'Получатель', ' ', 1, 702, 1, 0, '', 0, null) ;

CALL ImportField(70211038, 'Наименование(Получатель)', 'AcceptorName', 'Наименование', ' ', 1, 702, 1, 0, '', 0, 16646) ;

CALL ImportField(70211039, 'ИНН(Получатель)', 'AcceptorINN', 'ИНН', ' ', 1, 702, 1, 0, '', 0, 16645) ;

CALL ImportField(70211040, 'КПП(Получатель)', 'AcceptorINN20', 'КПП', ' ', 1, 702, 1, 0, '', 0, 16653) ;

CALL ImportField(70211041, 'Счет(Получатель)', 'AcceptorAcc', 'Счет', ' ', 1, 702, 1, 0, '', 0, 17112) ;

CALL ImportField(70211042, 'Вид платежа', 'SendBy', 'Вид платежа', ' ', 1, 702, 1, 0, 'ВидПлатежа', 0, 17172) ;

CALL ImportField(70211043, 'Дата платежа', 'PayDate', 'Дата платежа', ' ', 1, 702, 1, 0, '', 0, 17176) ;

CALL ImportField(70211044, 'Очередность платежа', 'PayQueue', 'Очередность платежа', ' ', 1, 702, 1, 0, 'Очередность', 0, 17177) ;

CALL ImportField(70211045, 'Примечание', 'TextNote', 'Примечание', ' ', 1, 702, 1, 0, 'Примечание', 0, 17178) ;

CALL ImportField(70211046, 'Код валюты', 'Currency', 'Код валюты', ' ', 1, 702, 1, 0, 'КодВалюты', 0, 17175) ;

CALL ImportField(70211047, 'Сумма в валюте', 'CurSum', 'Сумма в валюте', ' ', 1, 702, 1, 0, '', 0, 17174) ;

CALL ImportField(70211048, 'Номер распоряжения', 'SourceDocNumber', 'Номер распоряжения', ' ', 1, 702, 1, 0, 'НомерРеестра', 0, 17186) ;

CALL ImportField(70211049, 'Распорядитель кредитов', 'ManagerOwner', 'Распорядитель кредитов', ' ', 1, 702, 1, 0, '', 0, null) ;

CALL ImportField(70211050, 'Наименование(Распорядитель кредитов)', 'ManagerName', 'Наименование', ' ', 1, 702, 1, 0, '', 0, 16646) ;

CALL ImportField(70211051, 'ИНН(Распорядитель кредитов)', 'ManagerINN', 'ИНН', ' ', 1, 702, 1, 0, '', 0, 16645) ;

CALL ImportField(70211052, 'КПП(Распорядитель кредитов)', 'ManagerInn20', 'КПП', ' ', 1, 702, 1, 0, '', 0, 16653) ;

CALL ImportField(70211053, 'Счет(Распорядитель кредитов)', 'ManagerAcc', 'Счет', ' ', 1, 702, 1, 0, '', 0, 17112) ;

CALL ImportField(70211054, 'Тип документа', 'DocType', 'Тип документа', ' ', 1, 702, 1, 0, '', 0, 17190) ;

CALL ImportField(70211055, 'Информация о налоговом платеже', 'TaxNote', 'Информация о налоговом платеже', ' ', 1, 702, 1, 0, 'ИнформацияОНалоге', 0, 17192) ;

CALL ImportField(70211056, 'Причина отклонения', 'Reject_Cls', 'Причина отклонения', ' ', 1, 702, 1, 0, 'ПричинаОтклонКод', 0, 17193) ;

CALL ImportField(70211057, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', ' ', 1, 702, 1, 0, 'ПричинаОтклонТекст', 0, 17194) ;

CALL ImportField(70211061, 'Лицевой счет плательщика', 'SourceFacialAcc_Cls', 'Лицевой счет плательщика', ' ', 1, 702, 1, 0, '', 0, 17191) ;

CALL ImportField(70211062, 'Лицевой счет получателя', 'FacialAcc_Cls', 'Лицевой счет получателя', ' ', 1, 702, 1, 0, '', 0, 17188) ;

CALL ImportField(70211063, 'Статус(Обмен с банком)', 'Status', 'Статус', ' ', 1, 702, 1, 0, 'Статус', 0, 17233) ;

CALL ImportField(70211070, 'Обмен с банком', 'BankOwner', 'Обмен с банком', ' ', 1, 702, 1, 0, '', 0, null) ;

CALL ImportField(70211071, 'Имя файла эл. пакета(Обмен с банком)', 'PacketNumber', 'Имя файла эл. пакета(Обмен с банком)', ' ', 1, 702, 1, 0, 'НомерПакета', 0, 17227) ;

CALL ImportField(70211072, '№ эл докум.(Обмен с банком)', 'ExchangeDocNumber', '№ эл докум.(Обмен с банком)', ' ', 1, 702, 1, 0, 'НомерЭлектронногоДокумента', 0, 17228) ;

CALL ImportField(70211073, 'Дата отправления(Обмен с банком)', 'SendDate', 'Дата отправления(Обмен с банком)', ' ', 1, 702, 1, 0, 'ДатаОтправки', 0, 17229) ;

CALL ImportField(70211074, 'Код ошибки(Обмен с банком)', 'Error', 'Код ошибки(Обмен с банком)', ' ', 1, 702, 1, 0, '', 0, 17230) ;

CALL ImportField(70211075, 'Содерж. ошибки(Обмен с банком)', 'ExchangeNote', 'Содерж. ошибки(Обмен с банком)', ' ', 1, 702, 1, 0, 'ПримечаниеЭлДок', 0, 17231) ;

CALL ImportField(70211076, 'Время постановки в очередь(Обмен с банком)', 'QueueTime', 'Время постановки в очередь(Обмен с банком)', ' ', 1, 702, 1, 0, 'ДатаУведомления', 0, 17234) ;

-- Свободное финансирование, Бюджет(1)
CALL ImportField(70310001, '№ документа', 'SOURCEDOCNUM', '№ документа', ' ', 1, 703, 0, 0, 'НомерРеестра', 0, 17847) ;

CALL ImportField(70310002, 'Дата принятия', 'AcceptDate', 'Дата принятия', ' ', 1, 703, 0, 0, 'ДатаПринятия', 0, 17838) ;

CALL ImportField(70310003, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 703, 0, 0, '', 0, null) ;

CALL ImportField(70310004, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 703, 0, 1, 'КВСРКлюч', 0, 17825) ;

CALL ImportField(70310005, 'ФКР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 703, 0, 0, 'КФСР', 0, 17823) ;

CALL ImportField(70310006, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 703, 0, 1, 'КЦСРКлюч', 0, 17824) ;

CALL ImportField(70310007, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 703, 0, 1, 'КВРКлюч', 0, 17826) ;

CALL ImportField(70310008, 'ЭКР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 703, 0, 0, 'КЭСР', 0, 17827) ;

CALL ImportField(70310012, 'Вид источника(Классификация)', 'SourceIFS_DescriptionCode', 'Вид источника', ' ', 1, 703, 0, 0, '', 0, 17050) ;

CALL ImportField(70310013, 'ЭКИ(Классификация)', 'SourceIFS_KESR', 'ЭК', ' ', 1, 703, 0, 0, '', 0, 17054) ;

CALL ImportField(70310014, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 703, 0, 0, 'ТипКлассификации', 0, 17874) ;

CALL ImportField(70310015, 'Суб КОСГУ', 'SUBKESR', 'Суб КЭСР', ' ', 1, 703, 0, 0, 'СубКЭСР', 0, 17828) ;

CALL ImportField(70310016, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 703, 0, 0, 'КодБюджета', 0, 17840) ;

CALL ImportField(70310017, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', ' ', 1, 703, 0, 0, 'ЛицевойСчет', 0, 17855) ;

CALL ImportField(70310018, 'Л/С ФК', 'FacialCode', 'Л/С ФК', ' ', 1, 703, 0, 0, '', 0, 17149) ;

CALL ImportField(70310019, 'Источник', 'FINSOURCE', 'Источник', ' ', 1, 703, 0, 0, 'ИсточникФинансирования', 0, 17830) ;

CALL ImportField(70310021, 'Район', 'REGIONCLS', 'Район', ' ', 1, 703, 0, 0, 'Регион', 0, 17831) ;

CALL ImportField(70310022, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 703, 0, 0, 'ТипДокумента', 0, 17832) ;

CALL ImportField(70310023, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 703, 0, 0, 'ТипСредств', 0, 17835) ;

CALL ImportField(70310024, 'Дебет', 'DEBIT', 'Дебет', ' ', 1, 703, 0, 0, '', 0, 17844) ;

CALL ImportField(70310025, 'Кредит', 'CREDIT', 'Кредит', ' ', 1, 703, 0, 0, '', 0, 17843) ;

CALL ImportField(70310026, 'ИНН', 'INN', 'ИНН', ' ', 1, 703, 0, 0, '', 0, 16645) ;

CALL ImportField(70310027, 'КПП', 'KPP', 'КПП', ' ', 1, 703, 0, 0, '', 0, 16653) ;

CALL ImportField(70310028, 'Наименование', 'NAME', 'Наименование', ' ', 1, 703, 0, 0, '', 0, 16646) ;

CALL ImportField(70310029, 'Тип организации', 'ORG_CLS', 'Тип организации', ' ', 1, 703, 0, 0, '', 0, 16652) ;

CALL ImportField(70310030, 'Счет', 'ACC', 'Счет', ' ', 1, 703, 0, 0, '', 0, 17112) ;

CALL ImportField(70310031, 'Тип счета', 'ACC_CLS', 'Тип счета', ' ', 1, 703, 0, 0, 'ТипСчета', 0, 17113) ;

CALL ImportField(70310032, 'Назначение платежа', 'NOTE', 'Назначение платежа', ' ', 1, 703, 0, 0, 'Примечание', 0, 17845) ;

CALL ImportField(70310033, 'ИНН (*)', 'INNA', 'ИНН (*)', ' ', 1, 703, 0, 0, '', 0, 16645) ;

CALL ImportField(70310034, 'КПП (*)', 'KPPA', 'КПП (*)', ' ', 1, 703, 0, 0, '', 0, 16653) ;

CALL ImportField(70310035, 'Наименование (*)', 'NAMEA', 'Наименование (*)', ' ', 1, 703, 0, 0, '', 0, 16646) ;

CALL ImportField(70310036, 'Счет (*)', 'ACCA', 'Счет (*)', ' ', 1, 703, 0, 0, '', 0, 17112) ;

CALL ImportField(70310037, 'Счет ФО', 'AccName', 'Счет ФО', ' ', 1, 703, 0, 0, '', 0, 17112) ;

CALL ImportField(70310038, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Реестр федеральных средств', ' ', 1, 703, 0, 0, '', 0, null) ;

CALL ImportField(70310039, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 703, 0, 0, 'БухОперация', 0, 17871) ;

CALL ImportField(70310040, 'Номер', 'DocNumber', 'Номер', ' ', 1, 703, 0, 0, 'НомерДокумента', 0, 17870) ;

CALL ImportField(70310041, 'Источниковая классификация', 'SourceIFS', 'Источниковая классификация', ' ', 1, 703, 0, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17872) ;

CALL ImportField(70310042, 'Код документа', 'RECORDINDEX', 'RECORDINDEX', ' ', 1, 703, 0, 1, 'КодДокумента', 0, 17849) ;

CALL ImportField(70310043, 'Код записи', 'ID', 'ID', ' ', 1, 703, 0, 1, 'КодЗаписи', 0, 17822) ;

CALL ImportField(70310045, 'Счет ФО', 'DFACCOUNT', 'Счет ФО', ' ', 1, 703, 0, 1, 'СчетПлат', 0, 17836) ;

CALL ImportField(70310046, 'Счет получателя', 'ACCEPTORACCREF', 'ACCEPTORACCREF', ' ', 1, 703, 0, 1, 'СчетПолуч', 0, 17854) ;

CALL ImportField(70310047, 'Счет распорядителя', 'ACCOUNTREF', 'ACCOUNTREF', ' ', 1, 703, 0, 1, 'СчетРаспорядителя', 0, 17837) ;

CALL ImportField(70310048, 'Федеральные cредства', 'FEDERALFUNDSREF', 'FEDERALFUNDSREF', ' ', 1, 703, 0, 1, 'ФедеральныеСредства', 0, 17865) ;

-- Объемы финансирования, УРМ(0)
CALL ImportField(80100001, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 0, 801, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(80100002, 'Принятая сумма', 'AcceptSumma', 'Принятая сумма', 'AcceptSumma', 0, 801, 0, 0, 'СуммаЗаголовка', 0, null) ;

CALL ImportField(80100003, 'Бюджет', ' ', 'Бюджет', 'BUDGETREF', 0, 801, 0, 0, '', 0, null) ;

CALL ImportField(80100004, 'Статус ЭЦП', ' ', 'Статус ЭЦП', 'CryptoStatus', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100005, 'Ссылка на счет ФО', 'DFACCOUNT', 'Ссылка на счет ФО', 'DFACCOUNT', 0, 801, 0, 1, 'РСФО', 0, null) ;

CALL ImportField(80100007, 'Счет ФО', 'DFAccountName', 'Счет ФО', 'DFAccountName', 0, 801, 0, 0, '', 0, null) ;

CALL ImportField(80100008, 'Статус', 'DocStateName', 'Статус', 'DocStateName', 0, 801, 0, 0, '', 0, null) ;

CALL ImportField(80100009, 'Состояние', 'DOCSTATEREF', 'Состояние', 'DOCSTATEREF', 0, 801, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(80100010, 'Статус документа', ' ', 'Статус документа', 'DOCUMENTSTATE', 0, 801, 0, 0, '', 0, null) ;

CALL ImportField(80100011, 'СубСчет', 'SourceFacialAcc', 'СубСчет', 'SourceFacialAccCls', 0, 801, 0, 0, 'ЛицСчетПлательщика,СубСчет', 0, null) ;

CALL ImportField(80100012, 'Источник финансирования', 'FINSOURCE', 'Источник финансирования', 'FinSourceCls', 0, 801, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(80100013, 'Код документа', 'ID', 'Код документа', 'ID', 0, 801, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(80100014, 'Идентификатор импорта', ' ', 'Идентификатор импорта', 'ImportID', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100015, 'Дата ввода', 'INPUTDATE', 'Дата ввода', 'INPUTDATE', 0, 801, 0, 0, 'ДатаВвода', 0, null) ;

CALL ImportField(80100016, 'Месяц', 'AMONTH', 'Месяц', 'MONTH', 0, 801, 0, 0, '', 0, null) ;

CALL ImportField(80100017, 'Номер уведомления', 'ANUMBER', 'Номер уведомления', 'NUMBER', 0, 801, 0, 0, 'НомерДокументаУвед,НомерДокумента', 0, null) ;

CALL ImportField(80100018, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 801, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(80100019, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'RejectCls', 0, 801, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(80100020, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 0, 801, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(80100021, 'Версия записи', ' ', 'Версия записи', 'RVersion', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100022, 'Код отославшего', ' ', 'Код отославшего', 'SenderID', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100023, 'ИНН отославшего', ' ', 'ИНН отославшего', 'SenderINN', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100024, 'Код записи у отославшего', ' ', 'Код записи у отославшего', 'SenderRecordID', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100025, 'Год', 'AYEAR', 'Год', 'YEAR', 0, 801, 0, 0, '', 0, null) ;

CALL ImportField(80100027, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100028, 'Ид. в БД Бюджета', 'FUID', 'Ид. в БД Бюджета', 'FUID', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100045, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100046, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100047, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100048, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100049, 'Признак зависания', 'DocSuspended', 'Признак зависания', ' ', 0, 801, 0, 1, '', 0, null) ;

CALL ImportField(80100052, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 801, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(80101003, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 0, 801, 1, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(80101004, 'Принятая сумма', 'AcceptSumma', 'Принятая сумма', 'AcceptSumma', 0, 801, 1, 0, '', 0, null) ;

CALL ImportField(80101005, 'Бюджет', ' ', 'Бюджет', 'BUDGETREF', 0, 801, 1, 0, '', 0, null) ;

CALL ImportField(80101007, 'Тип документа', 'DocTypes', 'Тип документа', 'DocTypeCls', 0, 801, 1, 0, 'ТипДокумента', 0, null) ;

CALL ImportField(80101008, 'Лицевой счет', 'FACIALACC', 'Лицевой счет', 'FACIALACCCls', 0, 801, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(80101009, 'Лицевой счет в ФК', 'FACIALCode', 'Лицевой счет в ФК', 'DestFacialAccClsFacialCode', 0, 801, 1, 0, '', 0, null) ;

CALL ImportField(80101011, 'Источник финансирования', 'FINSOURCE', 'Источник финансирования', 'FINSOURCECls', 0, 801, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(80101013, 'Код документа ', 'ID', 'Код документа ', 'ID', 0, 801, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(80101014, 'Идентификатор импорта', ' ', 'Идентификатор импорта', 'ImportID', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101015, 'ИНН', 'INN', 'ИНН', 'DestOrgInn', 0, 801, 1, 0, '', 0, null) ;

CALL ImportField(80101016, 'КПП', 'INN20', 'КПП', 'DestOrgKpp', 0, 801, 1, 0, '', 0, null) ;

CALL ImportField(80101017, 'КЦСРКлюч', 'KCSR', 'КЦСР', 'KCSRKey', 0, 801, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(80101018, 'КЭСР', 'KESR', 'КЭСР', 'KESR', 0, 801, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(80101019, 'КФСР', 'KFSR', 'КФСР', 'KFSR', 0, 801, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(80101020, 'КВРКлюч', 'KVR', 'КВР', 'KVRKey', 0, 801, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(80101021, 'КВСРКлюч', 'KVSR', 'КВСР', 'KVSRKey', 0, 801, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(80101022, 'Тип средств', 'MEANSTYPE', 'Тип средств', 'MEANSTYPECls', 0, 801, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(80101023, 'Месяц', 'AMONTH', 'Месяц', 'MONTH', 0, 801, 1, 0, '', 0, null) ;

CALL ImportField(80101024, 'Наименование организации', 'NAME', 'Наименование организации', 'DestOrgName', 0, 801, 1, 0, '', 0, null) ;

CALL ImportField(80101025, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 801, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(80101026, 'Ссылка на организацию', ' ', 'Ссылка на организацию', 'DestOrgId', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101027, 'Индекс Данных', 'PROGINDEX', 'Индекс Данных', 'PROGINDEX', 0, 801, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(80101028, 'Ссылка на заголовок', 'RECORDINDEX', 'Ссылка на заголовок', 'RECORDINDEX', 0, 801, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(80101029, 'Район', 'REGIONCLS', 'Район', 'REGIONCLS', 0, 801, 1, 0, 'Регион', 0, null) ;

CALL ImportField(80101030, 'Принятие', 'REQUESTFLAG', 'Принятие', 'REQUESTFLAG', 0, 801, 1, 0, 'Принятие', 0, null) ;

CALL ImportField(80101031, 'Версия записи', ' ', 'Версия записи', 'RVersion', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101032, 'СубКЭСР', 'SUBKESR', 'СубКЭСР', 'SUBKESR', 0, 801, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(80101033, 'Классификация(группа)', 'TreeOwner0', 'Классификация(группа)', ' ', 0, 801, 1, 0, '', 0, null) ;

CALL ImportField(80101034, 'Год', 'AYEAR', 'Год', 'YEAR', 0, 801, 1, 0, '', 0, null) ;

CALL ImportField(80101035, 'Ссылка на счет ФО', 'DFACCOUNT', 'Ссылка на счет ФО', 'SourceAccount', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101036, 'Операция', 'BuhOperationCls', 'Операция', 'BuhOperationCls', 0, 801, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(80101037, 'Источник внутр. и внеш. финанс.', 'IFS', 'Источник внутр. и внеш. финанс.', 'IFS', 0, 801, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, null) ;

CALL ImportField(80101038, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 0, 801, 1, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(80101039, 'Статус', ' ', 'Статус', 'DocStateName', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101040, 'Состояние', 'DOCSTATEREF', 'Состояние', 'DOCSTATEREF', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101041, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101042, 'Ид. в БД Бюджета', 'FUID', 'Ид. в БД Бюджета', 'FUID', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101051, 'СубСчет', 'SourceFacialAcc', 'СубСчет', 'SourceFacialAccCls', 0, 801, 1, 1, 'ЛицСчетПлательщика', 0, null) ;

CALL ImportField(80101053, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101063, 'КЦСР(Классификация)', 'KCSRCode', '', 'KCSR', 0, 801, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(80101064, 'КВР(Классификация)', 'KVRCode', '', 'KVR', 0, 801, 1, 0, 'КВР', 0, null) ;

CALL ImportField(80101065, 'КВСР(Классификация)', 'KVSRCode', '', 'KVSR', 0, 801, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(80101068, 'Классификация ИВнФ(Классифкатор)', 'IFSCode', 'Классификация ИВнФ(Классифкатор)', 'SourceIFS_DescriptionCode', 0, 801, 1, 0, 'ИсточникВнутрФинансирования', 0, null) ;

CALL ImportField(80101069, 'Код цели', 'TargetCls', '', ' ', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101070, 'Имя орагнизации', 'OrgName', '', ' ', 0, 801, 1, 0, '', 0, null) ;

CALL ImportField(80101071, 'Лицевой счет', 'SourceFacialCode', 'Лицевой счет ФК', ' ', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101072, 'Счет ФО', 'DFAccountName', 'Счет ФО', ' ', 0, 801, 1, 1, '', 0, null) ;

CALL ImportField(80101073, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 801, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(80101074, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 801, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(80101075, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 801, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(80101078, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 0, 801, 1, 1, 'КодСубсидииКлюч', 0, null) ;

-- Объемы финансирования, Бюджет(1)
CALL ImportField(80110001, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 1, 801, 0, 0, 'ДатаПринятия', 0, 18736) ;

CALL ImportField(80110002, 'Принятая сумма', 'AcceptSumma', 'Принятая сумма', 'AcceptSumma', 1, 801, 0, 0, 'СуммаЗаголовка', 0, 18756) ;

CALL ImportField(80110003, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 801, 0, 0, 'КодБюджета', 0, 18744) ;

CALL ImportField(80110004, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CryptoStatus', 1, 801, 0, 1, 'КриптоСтатус', 0, 18751) ;

CALL ImportField(80110005, 'Счет ФО', 'DFACCOUNT', 'Ссылка на счет ФО', 'SourceAccount', 1, 801, 0, 1, 'РСФО', 0, 18747) ;

CALL ImportField(80110007, 'Счет ФО', 'DFAccountName', 'Счет ФО', ' ', 1, 801, 0, 0, '', 0, 17112) ;

CALL ImportField(80110009, 'СостояниеДокумента', 'DOCSTATEREF', 'DOCSTATEREF', 'DOCSTATEREF', 1, 801, 0, 1, 'СостояниеДокумента', 0, 18758) ;

CALL ImportField(80110012, 'Источник финансирования', 'FINSOURCE', 'Источник финансирования', 'FinSourceCls', 1, 801, 0, 0, 'ИсточникФинансирования', 0, 18739) ;

CALL ImportField(80110013, 'Код документа', 'ID', 'Код документа', 'ID', 1, 801, 0, 1, 'КодДокумента', 0, 18733) ;

CALL ImportField(80110015, 'Дата ввода', 'INPUTDATE', 'Дата ввода', 'INPUTDATE', 1, 801, 0, 0, 'ДатаВвода', 0, 18735) ;

CALL ImportField(80110016, 'Месяц', 'MONTH', 'Месяц', 'MONTH', 1, 801, 0, 0, 'Месяц', 0, null) ;

CALL ImportField(80110017, 'Номер уведомления', 'NUMBER', 'Номер уведомления', 'NUMBER', 1, 801, 0, 0, 'НомерДокументаУвед,НомерДокумента', 0, null) ;

CALL ImportField(80110018, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 801, 0, 0, 'ВидПлана', 0, 18757) ;

CALL ImportField(80110019, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'RejectCls', 1, 801, 0, 0, 'ПричинаОтклонКод', 0, 18749) ;

CALL ImportField(80110020, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 801, 0, 0, 'ПричинаОтклонТекст', 0, 18750) ;

CALL ImportField(80110021, 'Версия записи', 'RVersion', 'Версия записи', ' ', 1, 801, 0, 1, '', 0, null) ;

CALL ImportField(80110022, 'Код удалённого клиента', 'SenderID', 'Код отправителя документа', 'SenderID', 1, 801, 0, 1, 'КодОтправителяДокумента', 0, 18752) ;

CALL ImportField(80110024, 'Код УРМ документа', 'SenderRecordID', 'Код УРМ документа', 'SenderRecordID', 1, 801, 0, 1, 'КодУРМДокумента', 0, 18753) ;

CALL ImportField(80110025, 'СубСчет', 'SourceFacialAcc', 'СубСчет', 'SourceFacialAccCls', 1, 801, 0, 0, 'ЛицСчетПлательщика,СубСчет', 0, 18748) ;

CALL ImportField(80110026, 'Локальная виза', ' ', 'Локальная виза', 'UsersVisa', 1, 801, 0, 1, '', 1, null) ;

CALL ImportField(80110027, 'Год', 'YEAR', 'Год', 'YEAR', 1, 801, 0, 0, 'Год', 0, null) ;

CALL ImportField(80110043, 'Лицевой счет', 'FacialAccCLS', 'Лицевой счет распорядителя', 'FACIALACCCLS', 1, 801, 0, 0, 'ЛицСчетПолучателя,ЛСЗаголовка', 0, 18761) ;

CALL ImportField(80110044, 'Номер заявки', 'BidNumber', 'Номер заявки', ' ', 1, 801, 0, 0, '', 0, 18762) ;

CALL ImportField(80110045, 'Описание счета', 'DFAccountComment', 'Описание счета', ' ', 1, 801, 0, 0, '', 0, null) ;

CALL ImportField(80111001, 'Счет(Организация)', 'ACC', 'Счет', ' ', 1, 801, 1, 1, '', 0, null) ;

CALL ImportField(80111002, 'Тип счета(Организация)', 'ACC_CLS', 'Тип счета', ' ', 1, 801, 1, 1, '', 0, null) ;

CALL ImportField(80111003, 'Расчетный счет', 'ACC_REF', 'Ссылка на расчетный счет', 'DestAccount', 1, 801, 1, 1, 'СчетПолуч,СчетРаспорядителя', 0, 18657) ;

CALL ImportField(80111004, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 1, 801, 1, 1, 'ДатаПринятия', 0, 18639) ;

CALL ImportField(80111005, 'Принятая сумма', 'AcceptSumma', 'Принятая сумма', 'AcceptSumma', 1, 801, 1, 0, '', 0, 18641) ;

CALL ImportField(80111006, 'Бюджет', 'BUDGETREF', 'Бюджет(детализация)', 'BUDGETREF', 1, 801, 1, 1, 'КодБюджета', 0, 18631) ;

CALL ImportField(80111007, 'Счет ФО', 'DFACCOUNT', 'Ссылка на счет ФО', 'SourceAccount', 1, 801, 1, 1, '', 0, 18658) ;

CALL ImportField(80111010, 'Тип документа', 'DocTypes', 'Тип документа', 'DocTypeCLS', 1, 801, 1, 0, 'ТипДокумента', 0, 18650) ;

CALL ImportField(80111011, 'Лицевой счет', 'FACIALACC', 'Лицевой счет', 'DestFacialAccCls', 1, 801, 1, 0, 'ЛицевойСчет', 0, 18632) ;

CALL ImportField(80111016, 'Источник финансирования', 'FINSOURCE', 'Источник финансирования', 'FinSourceCLS', 1, 801, 1, 0, 'ИсточникФинансирования', 0, 18633) ;

CALL ImportField(80111018, 'Код записи', 'ID', 'Код записи', 'ID', 1, 801, 1, 1, 'КодЗаписи', 0, 18628) ;

CALL ImportField(80111022, 'КЦСРКлюч', 'KCSR', 'КЦСР', 'KCSRKey', 1, 801, 1, 1, 'КЦСРКлюч', 0, 18652) ;

CALL ImportField(80111023, 'ЭКР(Классификация)', 'KESR', 'КЭСР', 'KESR', 1, 801, 1, 0, 'КЭСР', 0, 18630) ;

CALL ImportField(80111024, 'ФКР(Классификация)', 'KFSR', 'КФСР', 'KFSR', 1, 801, 1, 0, 'КФСР', 0, 18653) ;

CALL ImportField(80111025, 'КВРКлюч', 'KVR', 'КВР', 'KVRKey', 1, 801, 1, 1, 'КВРКлюч', 0, 18629) ;

CALL ImportField(80111026, 'КВСРКлюч', 'KVSR', 'КВСР', 'KVSRKey', 1, 801, 1, 1, 'КВСРКлюч', 0, 18651) ;

CALL ImportField(80111027, 'Тип средств', 'MEANSTYPE', 'Тип средств', 'MeansTypeCLS', 1, 801, 1, 0, 'ТипСредств', 0, 18656) ;

CALL ImportField(80111028, 'Месяц', 'MONTH', 'Месяц', 'MONTH', 1, 801, 1, 1, 'Месяц', 0, null) ;

CALL ImportField(80111029, 'Наименование организации(Организация)', 'NAME', 'Наименование организации', ' ', 1, 801, 1, 0, '', 0, null) ;

CALL ImportField(80111030, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 801, 1, 0, 'Примечание', 0, 18642) ;

CALL ImportField(80111032, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 801, 1, 0, '', 0, null) ;

CALL ImportField(80111033, 'Индексы данных', 'PROGINDEX', 'Индекс данных', 'PROGINDEX', 1, 801, 1, 1, 'ИндексыДанных', 0, 18645) ;

CALL ImportField(80111034, 'Код документа', 'RECORDINDEX', 'Ссылка на заголовок', 'RECORDINDEX', 1, 801, 1, 1, 'КодДокумента', 0, 18644) ;

CALL ImportField(80111035, 'Район', 'REGIONCLS', 'Район', 'REGIONCLS', 1, 801, 1, 0, 'Регион', 0, 18672) ;

CALL ImportField(80111036, 'Принятие', 'REQUESTFLAG', 'Принятие', 'REQUESTFLAG', 1, 801, 1, 0, 'Принятие', 0, 18643) ;

CALL ImportField(80111037, 'Версия записи', 'RVersion', 'Версия записи', ' ', 1, 801, 1, 1, '', 0, null) ;

CALL ImportField(80111039, 'Лицевой счет', 'SourceFacialAcc', 'Лицевой счет', 'SourceFacialAccCls', 1, 801, 1, 1, 'ЛицСчетПлательщика', 0, 18659) ;

CALL ImportField(80111040, 'СубКОСГУ', 'SUBKESR', 'СубКЭСР', 'SUBKESR', 1, 801, 1, 0, 'СубКЭСР', 0, 18635) ;

CALL ImportField(80111041, 'Классификация', 'TreeOwner0', 'Классификация(группа)', ' ', 1, 801, 1, 0, '', 0, null) ;

CALL ImportField(80111042, 'Год', 'YEAR', 'Год', 'YEAR', 1, 801, 1, 1, 'Год', 0, null) ;

CALL ImportField(80111046, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(ИВнФ)', ' ', 1, 801, 1, 0, '', 0, 17050) ;

CALL ImportField(80111047, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(ИВнФ)', ' ', 1, 801, 1, 0, '', 0, 17054) ;

CALL ImportField(80111048, 'Операция', 'BuhOperationCls', 'Операция', 'BuhOperationCls', 1, 801, 1, 0, 'БухОперация', 0, 18665) ;

CALL ImportField(80111050, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFS', 1, 801, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 18666) ;

CALL ImportField(80111052, 'Тип классификации', 'CLSType', 'Тип классификации', 'CLSType', 1, 801, 1, 0, 'ТипКлассификации', 0, 18667) ;

CALL ImportField(80111053, 'Источниковая классификация', 'IFS_FullID', 'IFS_FullID(Источниковая классификация)', 'IFS_DESCRIPTIONCODE', 1, 801, 1, 1, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(80111054, 'Источник образования средств', 'FundsSource', 'Источник образования средств', ' ', 1, 801, 1, 0, '', 0, 18670) ;

CALL ImportField(80111055, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 801, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18671) ;

CALL ImportField(80111077, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 801, 1, 1, 'КодСубсидииКлюч', 0, 27704) ;

CALL ImportField(80111078, 'Наименование р/к', 'FClsName', '', ' ', 1, 801, 1, 0, '', 0, null) ;

CALL ImportField(80111079, 'Код цели', 'TargetCLS', '', ' ', 1, 801, 1, 0, '', 0, null) ;

-- Объемы финансирования (линейно), Бюджет(1)
CALL ImportField(80210001, 'Месяц', 'MONTH', 'Месяц', ' ', 1, 802, 0, 0, 'Месяц', 0, null) ;

CALL ImportField(80210002, 'Год', 'YEAR', 'Год', ' ', 1, 802, 0, 0, 'Год', 0, null) ;

CALL ImportField(80210003, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 802, 0, 0, 'КодБюджета', 0, 18631) ;

CALL ImportField(80210004, 'Лицевой счет', 'FACIALACC', 'Лицевой счет', ' ', 1, 802, 0, 0, 'ЛицевойСчет', 0, 18632) ;

CALL ImportField(80210005, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 802, 0, 0, '', 0, null) ;

CALL ImportField(80210006, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 802, 0, 1, 'КВСРКлюч', 0, 18651) ;

CALL ImportField(80210007, 'КФСР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 802, 0, 0, 'КФСР', 0, 18653) ;

CALL ImportField(80210008, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 802, 0, 1, 'КЦСРКлюч', 0, 18652) ;

CALL ImportField(80210009, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 802, 0, 1, 'КВРКлюч', 0, 18629) ;

CALL ImportField(80210010, 'КЭСР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 802, 0, 0, 'КЭСР', 0, 18630) ;

CALL ImportField(80210013, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор', ' ', 1, 802, 0, 0, '', 0, null) ;

CALL ImportField(80210014, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника', ' ', 1, 802, 0, 0, '', 0, null) ;

CALL ImportField(80210015, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭК', ' ', 1, 802, 0, 0, '', 0, null) ;

CALL ImportField(80210016, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 802, 0, 0, 'ТипКлассификации', 0, 18667) ;

CALL ImportField(80210017, 'Суб.КЭСР', 'SUBKESR', 'Суб.КЭСР', ' ', 1, 802, 0, 0, 'СубКЭСР', 0, 18635) ;

CALL ImportField(80210018, 'Источник', 'FINSOURCE', 'Источник', ' ', 1, 802, 0, 0, 'ИсточникФинансирования', 0, 18633) ;

CALL ImportField(80210019, 'Тип документа', 'DocTypes', 'Тип документа', ' ', 1, 802, 0, 0, 'ТипДокумента', 0, 18650) ;

CALL ImportField(80210020, 'Сумма', 'SUMMA', 'Сумма', ' ', 1, 802, 0, 0, '', 0, 18640) ;

CALL ImportField(80210021, 'Прин. сумма', 'ACCEPTSUMMA', 'Прин. сумма', ' ', 1, 802, 0, 0, '', 0, 18641) ;

CALL ImportField(80210022, 'Принятие', 'REQUESTFLAG', 'Принятие', ' ', 1, 802, 0, 0, 'Принятие', 0, 18643) ;

CALL ImportField(80210023, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 802, 0, 0, 'Примечание', 0, 18642) ;

CALL ImportField(80210024, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 802, 0, 0, 'БухОперация', 0, 18665) ;

CALL ImportField(80210025, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 802, 0, 0, 'ТипСредств', 0, 18656) ;

CALL ImportField(80210027, 'ИНН', 'INN', 'ИНН', ' ', 1, 802, 0, 0, '', 0, null) ;

CALL ImportField(80210028, 'КПП', 'INN20', 'КПП', ' ', 1, 802, 0, 0, '', 0, null) ;

CALL ImportField(80210029, 'Наименование организации', 'Name', 'Наименование организации', ' ', 1, 802, 0, 0, '', 0, null) ;

CALL ImportField(80210030, 'Счет', 'ACC', 'Счет', ' ', 1, 802, 0, 0, '', 0, 17112) ;

CALL ImportField(80210031, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', ' ', 1, 802, 0, 1, 'ДатаПринятия', 0, 18639) ;

CALL ImportField(80210032, 'Источниковая классификация', 'IFS', 'Источниковая классификация', ' ', 1, 802, 0, 1, 'ИсточникВнутрФинансированияКлюч', 0, 18666) ;

CALL ImportField(80210033, 'Код записи', 'ID', 'Код записи', ' ', 1, 802, 0, 1, 'КодЗаписи', 0, 18628) ;

CALL ImportField(80210034, 'Район', 'RegionCLS', 'Район', ' ', 1, 802, 0, 0, 'Регион', 0, null) ;

CALL ImportField(80210035, 'Расчетный счет', 'ACC_REF', 'Расчетный счет', ' ', 1, 802, 0, 1, 'СчетПолуч', 0, 18657) ;

-- Заявки на выделение объемов финансирования, Бюджет(1)
CALL ImportField(80310001, 'Номер заявки', 'NUMBER', 'Номер заявки', ' ', 1, 803, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(80310002, 'Дата ввода', 'INPUTDATE', 'Дата ввода', ' ', 1, 803, 0, 0, '', 0, 18719) ;

CALL ImportField(80310003, 'Месяц', 'MONTH', 'Месяц', ' ', 1, 803, 0, 0, 'Месяц', 0, null) ;

CALL ImportField(80310004, 'Год', 'YEAR', 'Год', ' ', 1, 803, 0, 0, 'Год', 0, null) ;

CALL ImportField(80310005, 'Счет ФО', 'DFAccountName', 'Счет ФО', ' ', 1, 803, 0, 0, '', 0, 17112) ;

CALL ImportField(80310007, 'Сумма лимита', 'Summa', 'Сумма лимита', ' ', 1, 803, 0, 0, '', 0, 18729) ;

CALL ImportField(80310008, 'Принятие к рассмотрению', 'State', 'Принятие к рассмотрению', ' ', 1, 803, 0, 0, '', 0, 18730) ;

CALL ImportField(80310009, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 803, 0, 0, 'КодБюджета', 0, 18726) ;

CALL ImportField(80310034, 'Субсчет', 'SourceFacialAcc', 'Субсчет', ' ', 1, 803, 0, 0, 'ЛицСчетПлательщика', 0, 18728) ;

CALL ImportField(80310038, 'Счет ФО', 'DFAccount', 'Счет ФО', ' ', 1, 803, 0, 1, 'РСФО', 0, 18727) ;

CALL ImportField(80310039, 'Описание счета', 'DFAccountComment', 'Описание счета', ' ', 1, 803, 0, 0, '', 0, null) ;

CALL ImportField(80311010, 'Лицевой счет', 'FACIALACC', 'Лицевой счет', ' ', 1, 803, 1, 0, 'ЛицевойСчет', 0, 18632) ;

CALL ImportField(80311011, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 803, 1, 0, '', 0, null) ;

CALL ImportField(80311012, 'КФСР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 803, 1, 0, 'КФСР', 0, 18653) ;

CALL ImportField(80311013, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 803, 1, 1, 'КЦСРКлюч', 0, 18652) ;

CALL ImportField(80311014, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 803, 1, 1, 'КВРКлюч', 0, 18629) ;

CALL ImportField(80311015, 'КЭСР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 803, 1, 0, 'КЭСР', 0, 18630) ;

CALL ImportField(80311018, 'Вид источника(Классификация)', 'SourceIFS_DescriptionCode', 'Вид источника', ' ', 1, 803, 1, 0, '', 0, 17050) ;

CALL ImportField(80311019, 'ЭКИ(Классификация)', 'SourceIFS_KESR', 'ЭК', ' ', 1, 803, 1, 0, '', 0, 17054) ;

CALL ImportField(80311020, 'Принятая сумма', 'ACCEPTSUMMA', 'Принятая сумма', ' ', 1, 803, 1, 0, '', 0, 18641) ;

CALL ImportField(80311021, 'Принятие', 'REQUESTFLAG', 'Принятие', ' ', 1, 803, 1, 0, 'Принятие', 0, 18643) ;

CALL ImportField(80311022, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 803, 1, 0, 'Примечание', 0, 18642) ;

CALL ImportField(80311023, 'Наименование организации', 'Name', 'Наименование организации', ' ', 1, 803, 1, 0, '', 0, 16646) ;

CALL ImportField(80311024, 'Счет', 'ACC', 'Счет', ' ', 1, 803, 1, 0, '', 0, 17112) ;

CALL ImportField(80311025, 'ИНН', 'INN', 'ИНН', ' ', 1, 803, 1, 0, '', 0, 16645) ;

CALL ImportField(80311026, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 803, 1, 0, 'ТипКлассификации', 0, 18667) ;

CALL ImportField(80311027, 'Тип документа', 'DocTypes', 'Тип документа', ' ', 1, 803, 1, 0, 'ТипДокумента', 0, 18650) ;

CALL ImportField(80311029, 'СубКЭСР', 'SUBKESR', 'СубКЭСР', ' ', 1, 803, 1, 0, 'СубКЭСР', 0, 18635) ;

CALL ImportField(80311030, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 803, 1, 0, 'ТипСредств', 0, 18656) ;

CALL ImportField(80311031, 'Источник финансирования', 'FinSource', 'Источник финансирования', ' ', 1, 803, 1, 0, 'ИсточникФинансирования', 0, 18633) ;

CALL ImportField(80311032, 'Сумма заявки', 'SUMMA', 'Сумма заявки', ' ', 1, 803, 1, 0, '', 0, 18640) ;

CALL ImportField(80311033, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 803, 1, 0, 'БухОперация', 0, 18665) ;

CALL ImportField(80311035, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 803, 1, 1, 'КВСРКлюч', 0, 18651) ;

CALL ImportField(80311037, 'КПП', 'INN20', 'КПП', ' ', 1, 803, 1, 0, '', 0, 16653) ;

CALL ImportField(80311039, 'Год', 'Year', 'Год', ' ', 1, 803, 1, 1, 'Год', 0, null) ;

CALL ImportField(80311040, 'Индексы данных', 'PROGINDEX', 'Индексы данных', ' ', 1, 803, 1, 1, 'ИндексыДанных', 0, 18645) ;

CALL ImportField(80311041, 'Источниковая классификация', 'SourceIFS', 'Источниковая классификация', ' ', 1, 803, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 18666) ;

CALL ImportField(80311042, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 803, 1, 1, '', 0, 18631) ;

CALL ImportField(80311043, 'Код документа', 'RECORDINDEX', 'Код документа', ' ', 1, 803, 1, 1, 'КодДокумента', 0, 18644) ;

CALL ImportField(80311044, 'Код записи', 'ID', 'Код записи', ' ', 1, 803, 1, 1, 'КодЗаписи', 0, 18628) ;

CALL ImportField(80311045, 'СубСчет', 'SourceFacialAcc', 'СубСчет', ' ', 1, 803, 1, 1, 'ЛицСчетПлательщика', 0, 18659) ;

CALL ImportField(80311046, 'Месяц', 'Month', 'Месяц', ' ', 1, 803, 1, 1, 'Месяц', 0, null) ;

CALL ImportField(80311047, 'Счет ФО', 'DFAccount', 'Счет ФО', ' ', 1, 803, 1, 1, 'РСФО', 0, 18658) ;

CALL ImportField(80311048, 'Расчетный счет', 'ACC_REF', 'Расчетный счет', ' ', 1, 803, 1, 1, 'СчетПолуч', 0, 18657) ;

-- Принятие объемов финансирования, Бюджет(1)
CALL ImportField(80410001, 'Месяц', 'MONTH', 'Месяц', ' ', 1, 804, 0, 0, 'Месяц', 0, null) ;

CALL ImportField(80410002, 'Год', 'YEAR', 'Год', ' ', 1, 804, 0, 0, 'Год', 0, null) ;

CALL ImportField(80410003, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', ' ', 1, 804, 0, 0, 'ДатаПринятия', 0, 18769) ;

CALL ImportField(80410004, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 804, 0, 0, 'КодБюджета', 0, 18766) ;

-- Доходы, Бюджет(1)
CALL ImportField(90011001, 'Тип классификации', '{РусПоле("ТипКлассификации")}', 'Тип классификации', ' ', 1, 900, 1, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(90011002, 'Код целевых средств (ключ)', '{РусПоле("КодЦелевыхСредствКлюч")}', 'Код целевых средств (ключ)', ' ', 1, 900, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(90011003, 'Код целевых средств', '{РусПоле("КодЦелевыхСредств")}', 'Код целевых средств', ' ', 1, 900, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(90011004, 'КДКлюч', '{РусПоле("КДКлюч")}', 'Код дохода (ключ)', ' ', 1, 900, 1, 1, 'КДКлюч', 0, null) ;

CALL ImportField(90011005, 'Код дохода', '{РусПоле("КодДохода")}', 'Код дохода', ' ', 1, 900, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(90011006, 'ИВВФКлюч', '{РусПоле("ИсточникВнутрФинансированияКлюч")}', 'Ключ источника внутреннего финансирования', ' ', 1, 900, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, null) ;

CALL ImportField(90011007, 'ИВВФ', '{РусПоле("ИсточникВнутрФинансирования")}', 'Источник внутреннего и внешнего финансирования', ' ', 1, 900, 1, 0, 'ИсточникВнутрФинансирования', 0, null) ;

-- Распоряжение на возврат доходов, Бюджет(1)
CALL ImportField(90110001, 'Дата ввода', 'BUILDDATE', 'Дата ввода', ' ', 1, 901, 0, 0, 'ДатаВвода', 0, 17645) ;

CALL ImportField(90110002, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', ' ', 1, 901, 0, 0, 'ДатаПринятия', 0, 17646) ;

CALL ImportField(90110003, 'Номер документа', 'DOCNUMBER', 'Номер документа', ' ', 1, 901, 0, 0, 'НомерДокументаЗаголовка,НомерРеестра', 0, 17648) ;

CALL ImportField(90110004, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 901, 0, 0, 'КодБюджета', 0, 17649) ;

CALL ImportField(90110005, 'Счет ФО', 'DFAccountName', 'Счет ФО', ' ', 1, 901, 0, 0, '', 0, 17112) ;

CALL ImportField(90110038, 'Код документа', 'ID', 'Код документа', 'ID', 1, 901, 0, 1, 'КодДокумента', 0, 17644) ;

CALL ImportField(90110039, 'Счет ФО', 'INCACCOUNT', 'Счет ФО', ' ', 1, 901, 0, 1, 'РСФО', 0, 17647) ;

CALL ImportField(90110040, 'Описание счета', 'DFAccountComment', 'Описание счета', ' ', 1, 901, 0, 0, '', 0, null) ;

CALL ImportField(90111006, 'Реестр федеральных средств', 'FederalFundsName', 'Реестр федеральных средств', ' ', 1, 901, 1, 0, '', 0, null) ;

CALL ImportField(90111007, 'Код дохода', 'KDValue', 'Код дохода', ' ', 1, 901, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(90111009, 'Вид дохода(Код дохода)', 'DescriptionCode', 'Вид дохода', ' ', 1, 901, 1, 0, '', 0, null) ;

CALL ImportField(90111010, 'Программа(Код дохода)', 'ProgramCode', 'Программа', ' ', 1, 901, 1, 0, '', 0, null) ;

CALL ImportField(90111011, 'КЭСР(Код дохода)', 'KDKESR', 'КЭСР', ' ', 1, 901, 1, 0, '', 0, null) ;

CALL ImportField(90111012, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', ' ', 1, 901, 1, 0, 'ЛицевойСчет', 0, 17697) ;

CALL ImportField(90111013, 'Субкод дохода', 'SUBKD', 'Субкод дохода', ' ', 1, 901, 1, 0, 'СубКД', 0, 17681) ;

CALL ImportField(90111015, 'Дебет', 'DEBIT', 'Дебет', ' ', 1, 901, 1, 0, 'СуммаДебет', 0, 17673) ;

CALL ImportField(90111016, 'Район', 'REGIONCLS', 'Район', ' ', 1, 901, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17682) ;

CALL ImportField(90111017, 'ИНН', 'INN', 'ИНН', ' ', 1, 901, 1, 0, '', 0, 16645) ;

CALL ImportField(90111018, 'КПП', 'KPP', 'КПП', ' ', 1, 901, 1, 0, '', 0, 16653) ;

CALL ImportField(90111020, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 901, 1, 0, 'ТипСредств', 0, 17699) ;

CALL ImportField(90111021, 'Организация', 'OrgName', 'Организация', ' ', 1, 901, 1, 0, '', 0, 16646) ;

CALL ImportField(90111022, 'Счет', 'ACC', 'Счет', ' ', 1, 901, 1, 0, '', 0, 17112) ;

CALL ImportField(90111023, 'ГосНИ', 'GOSNI', 'ГосНИ', ' ', 1, 901, 1, 0, 'ГосНИ', 0, 17683) ;

CALL ImportField(90111024, 'ИНН(Расп.)(Распорядитель платежа)', 'PayerINN', 'ИНН(Расп.)', ' ', 1, 901, 1, 0, '', 0, 16645) ;

CALL ImportField(90111025, 'КПП(Расп.)(Распорядитель платежа)', 'PayerKPP', 'КПП(Расп.)', ' ', 1, 901, 1, 0, '', 0, 16653) ;

CALL ImportField(90111026, 'Распорядитель платежа', 'PayerOrgName', 'Организация(Расп.)', ' ', 1, 901, 1, 0, '', 0, 16646) ;

CALL ImportField(90111027, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 901, 1, 0, 'ПримечаниеДеталь', 0, 17692) ;

CALL ImportField(90111028, 'Дата проведения', 'IDate', 'Дата проведения', ' ', 1, 901, 1, 1, '', 0, 17672) ;

CALL ImportField(90111029, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', ' ', 1, 901, 1, 0, 'БухПроводка', 0, 17700) ;

CALL ImportField(90111030, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 901, 1, 0, 'БухОперация', 0, 17720) ;

CALL ImportField(90111031, 'Кредит', 'CREDIT', 'Кредит', ' ', 1, 901, 1, 0, 'СуммаКредит', 0, 17674) ;

CALL ImportField(90111032, 'Тип документа', 'DocType', 'Тип документа', ' ', 1, 901, 1, 0, 'ТипДокумента', 0, 17675) ;

CALL ImportField(90111033, 'Информация для налогового платежа', 'TaxNote', 'Информация для налогового платежа', ' ', 1, 901, 1, 0, 'ИнформацияОНалоге', 0, 17705) ;

CALL ImportField(90111034, 'Распорядитель платежа', 'Payer', 'Распорядитель платежа', ' ', 1, 901, 1, 0, '', 0, null) ;

CALL ImportField(90111035, 'Источник образования', 'FundsSource', 'Источник образования', ' ', 1, 901, 1, 0, 'ИсточникОбразованияСредств', 0, 17732) ;

CALL ImportField(90111036, 'Код причины отклонения', 'RejectCLS', 'Код причины отклонения', ' ', 1, 901, 1, 0, 'ПричинаОтклонКод', 0, 17730) ;

CALL ImportField(90111037, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', ' ', 1, 901, 1, 0, 'ПричинаОтклонТекст', 0, 17731) ;

CALL ImportField(90111040, 'Доходная классификация', 'KD', 'KD', ' ', 1, 901, 1, 1, 'КДКлюч', 0, 17680) ;

CALL ImportField(90111041, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 901, 1, 1, '', 0, 17687) ;

CALL ImportField(90111042, 'Код записи', 'ID', 'Код записи', ' ', 1, 901, 1, 1, 'КодЗаписи', 0, 17669) ;

CALL ImportField(90111043, 'Номер документа', 'DOCNUM', 'Номер документа', ' ', 1, 901, 1, 0, 'НомерДокумента', 0, 17707) ;

CALL ImportField(90111044, 'Организация', 'ORG_REF', 'Организация', ' ', 1, 901, 1, 1, 'Организация', 0, 17677) ;

CALL ImportField(90111045, 'REcordIndex', 'RecordIndex', 'REcordIndex', 'RecordIndex', 1, 901, 1, 1, 'СсылкаНаДеталь', 0, 17686) ;

CALL ImportField(90111046, 'Счет', 'ACCOUNTREF', 'Счет', ' ', 1, 901, 1, 1, 'СчетПлат', 0, 17679) ;

CALL ImportField(90111047, 'Реестр федеральных средств', 'FederalFundsRef', 'Реестр федеральных средств', ' ', 1, 901, 1, 1, 'ФедеральныеСредства', 0, 17719) ;

CALL ImportField(90111048, 'Классификация', 'TreeOwner', 'Классификация', ' ', 1, 901, 1, 0, '', 0, null) ;

CALL ImportField(90111050, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 901, 1, 0, '', 0, 17050) ;

CALL ImportField(90111051, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 901, 1, 0, '', 0, 17054) ;

CALL ImportField(90111052, 'Тип классификации', 'CLSType', 'Тип классификации', ' ', 1, 901, 1, 0, 'ТипКлассификации', 0, 17723) ;

CALL ImportField(90111054, 'Источниковая классификация', 'IFS', 'ИВВФ', ' ', 1, 901, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17721) ;

CALL ImportField(90111055, 'Вид дохода(Классификация)', 'KD_DescriptionCode', 'Вид дохода(Классификация)', ' ', 1, 901, 1, 0, '', 0, 16831) ;

CALL ImportField(90111056, 'ЭКД(Классификация)', 'KD_KESR', 'ЭКД(Классификация)', ' ', 1, 901, 1, 0, '', 0, 16835) ;

CALL ImportField(90111058, 'Подвид дохода(Классификация)', 'KD_ProgramCode', 'Подвид дохода', ' ', 1, 901, 1, 0, '', 0, 16834) ;

CALL ImportField(90111059, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 901, 1, 0, '', 0, null) ;

CALL ImportField(90111060, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 1, 901, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17739) ;

CALL ImportField(90111064, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 901, 1, 1, 'КодСубсидииКлюч', 0, 26627) ;

-- Внутренние операции (доходы), УРМ(0)
CALL ImportField(90200048, 'С кода целевых средств(Ключ)', 'TransfertClsFrom', 'С кода целевых средств (ссылка)', ' ', 0, 902, 0, 0, 'TransfertClsFrom,КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(90200049, 'На Код целевых средствКлюч', 'TransfertClsTo', 'На код целевых средств (ссылка)', ' ', 0, 902, 0, 1, '', 0, null) ;

CALL ImportField(90200050, 'С Кода целевых средств', 'TransfertClsFromCode', '', ' ', 0, 902, 0, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(90200051, 'На Код целевых средств', 'TransfertClsToCode', '', ' ', 0, 902, 0, 0, '', 0, null) ;

-- Внутренние операции (доходы), Бюджет(1)
CALL ImportField(90210001, 'Дата', 'IDATE', 'Дата', ' ', 1, 902, 0, 0, 'ДатаПринятия', 0, 17672) ;

CALL ImportField(90210002, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 902, 0, 0, 'КодБюджета', 0, 17687) ;

CALL ImportField(90210003, 'С Кода дохода', 'KDValueFrom', 'С Кода дохода', ' ', 1, 902, 0, 0, 'СКодаДохода', 0, 16836) ;

CALL ImportField(90210005, 'Вид дохода(С Кода дохода)', 'DescriptionCodeFrom', 'Вид дохода', ' ', 1, 902, 0, 0, '', 0, 16831) ;

CALL ImportField(90210006, 'Подвид(С Кода дохода)', 'ProgramCodeFrom', 'Программа', ' ', 1, 902, 0, 0, '', 0, 16834) ;

CALL ImportField(90210007, 'ЭКД(С Кода дохода)', 'KDKESRFrom', 'ЭКД', ' ', 1, 902, 0, 0, '', 0, 16835) ;

CALL ImportField(90210008, 'C Типа средств', 'MeansTypeFrom', 'C Типа средств', ' ', 1, 902, 0, 0, 'MeansTypeFrom,ТипСредств', 0, 17699) ;

CALL ImportField(90210009, 'C Субкода', 'SUBKDFROM', 'C Субкода', ' ', 1, 902, 0, 0, 'SubKDFrom,ССубКД,СубКД', 0, 17681) ;

CALL ImportField(90210010, 'С Района контрагента (плат.)', 'REGIONCLSFrom', 'С Района', ' ', 1, 902, 0, 0, 'RegionCLSFrom,СРегиона,Регион', 0, 17682) ;

CALL ImportField(90210011, 'C Лицевого счета', 'FacialAcc_CLSFrom', 'C Лицевого счета', ' ', 1, 902, 0, 0, 'FacialAcc_CLSFrom,СЛицевогоСчета,ЛицевойСчет', 0, 17697) ;

CALL ImportField(90210012, 'Л/с ФК', 'facialcodeFrom', 'Л/с ФК', ' ', 1, 902, 0, 0, '', 0, null) ;

CALL ImportField(90210013, 'На Код дохода', 'KDValueTo', 'На Код дохода', ' ', 1, 902, 0, 0, 'НаКодДохода', 0, 16836) ;

CALL ImportField(90210015, 'Вид дохода(На Код дохода)', 'DescriptionCodeTo', 'Вид дохода', ' ', 1, 902, 0, 0, '', 0, 16831) ;

CALL ImportField(90210016, 'Подвид(На Код дохода)', 'ProgramCodeTo', 'Программа', ' ', 1, 902, 0, 0, '', 0, 16834) ;

CALL ImportField(90210017, 'ЭКД(На Код дохода)', 'KDKESRTo', 'ЭКД', ' ', 1, 902, 0, 0, '', 0, 16835) ;

CALL ImportField(90210018, 'На Тип средств', 'MeansTypeTo', 'На Тип средств', ' ', 1, 902, 0, 0, 'MeansTypeTo', 0, 17699) ;

CALL ImportField(90210019, 'На Субкод', 'SUBKDTO', 'На Субкод', ' ', 1, 902, 0, 0, 'НаСубКД', 0, 17681) ;

CALL ImportField(90210020, 'На Район контрагента (плат.)', 'REGIONCLSTo', 'На Район', ' ', 1, 902, 0, 0, 'НаРегион', 0, 17682) ;

CALL ImportField(90210021, 'Сумма (на код)', 'Credit', 'Сумма (на код)', ' ', 1, 902, 0, 0, 'СуммаКредит', 0, 17674) ;

CALL ImportField(90210022, 'На Лицевой счет', 'FacialAcc_CLSTo', 'На Лицевой счет', ' ', 1, 902, 0, 0, 'НаЛицевойСчет', 0, 17697) ;

CALL ImportField(90210023, 'Л/с ФК', 'facialcodeTo', 'Л/с ФК', ' ', 1, 902, 0, 0, '', 0, null) ;

CALL ImportField(90210024, 'Счет ФО', 'DFAccountName', 'Счет ФО', ' ', 1, 902, 0, 0, '', 0, 17112) ;

CALL ImportField(90210025, 'ИНН', 'INN', 'ИНН', ' ', 1, 902, 0, 0, '', 0, 16645) ;

CALL ImportField(90210026, 'КПП', 'INN20', 'КПП', ' ', 1, 902, 0, 0, '', 0, 16653) ;

CALL ImportField(90210027, 'Наименование', 'NAME', 'Наименование', ' ', 1, 902, 0, 0, '', 0, 16646) ;

CALL ImportField(90210028, 'ГосНИ', 'GOSNI', 'ГосНИ', ' ', 1, 902, 0, 0, 'ГосНИ', 0, 17683) ;

CALL ImportField(90210029, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 902, 0, 0, 'ТипДокумента', 0, 17675) ;

CALL ImportField(90210030, 'Номер', 'DOCNUM', 'Номер', ' ', 1, 902, 0, 0, 'НомерДокумента', 0, 17707) ;

CALL ImportField(90210031, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 902, 0, 0, 'Примечание', 0, 17692) ;

CALL ImportField(90210032, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 902, 0, 0, 'БухОперация', 0, 17720) ;

CALL ImportField(90210035, 'На КД', 'KDTo', 'На КД', ' ', 1, 902, 0, 1, '', 0, 17680) ;

CALL ImportField(90210036, 'Код записи', 'ID', 'Код записи', ' ', 1, 902, 0, 1, 'КодЗаписи', 0, 17669) ;

CALL ImportField(90210037, 'Организация', 'ORG_REF', 'Организация', ' ', 1, 902, 0, 1, 'Организация', 0, 17677) ;

CALL ImportField(90210038, 'Счет ФО', 'INCACCOUNT', 'Счет ФО', ' ', 1, 902, 0, 1, 'РСФО', 0, 17684) ;

CALL ImportField(90210039, 'Дебет (на код)', 'Debit', 'Дебет (на код)', ' ', 1, 902, 0, 1, 'СуммаДебет', 0, 17673) ;

CALL ImportField(90210040, 'Кол-во док.', 'DOCCOUNT', 'Кол-во док.', ' ', 1, 902, 0, 1, 'КоличествоДокументов', 0, 17671) ;

CALL ImportField(90210041, 'С КД', 'KDFrom', 'С КД', ' ', 1, 902, 0, 1, 'KDFrom,КДКлюч', 0, 17680) ;

CALL ImportField(90210042, 'С кода целевых средств(Ключ)', 'TransfertClsFrom', 'С кода целевых средств (ссылка)', ' ', 1, 902, 0, 0, 'TransfertClsFrom,КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(90210043, 'На Код целевых средствКлюч', 'TransfertClsTo', 'На код целевых средств (ссылка)', ' ', 1, 902, 0, 1, '', 0, 17739) ;

CALL ImportField(90210048, 'Номер л/с', 'FacialCodeExFrom', '', ' ', 1, 902, 0, 0, '', 0, 26617) ;

CALL ImportField(90210049, 'Номер л/с', 'FacialCodeExTo', '', ' ', 1, 902, 0, 0, '', 0, 26617) ;

-- Выписка по доходам, УРМ(0)
CALL ImportField(90300001, 'Статус', 'GeneralDocFeatures', 'Статус', ' ', 0, 903, 0, 0, '', 0, null) ;

CALL ImportField(90300003, 'Дата ввода', 'BuildDate', 'Дата ввода', 'BuildDate', 0, 903, 0, 0, 'ДатаВвода', 0, null) ;

CALL ImportField(90300004, 'Номер документа', 'DocNumber', 'Номер документа', 'DocNumber', 0, 903, 0, 0, 'НомерДокументаЗаголовка', 0, null) ;

CALL ImportField(90300005, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 0, 903, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(90300006, 'Счет ФО', 'IncAccountName', 'Счет ФО', ' ', 0, 903, 0, 0, '', 0, null) ;

CALL ImportField(90300007, 'Счет ФО (Описание)', 'IncAccountComment', 'Описание счета', ' ', 0, 903, 0, 0, '', 0, null) ;

CALL ImportField(90300008, 'Вид операции', 'TypeOperationCls', 'Вид операции', ' ', 0, 903, 0, 0, 'ТипОперации', 0, null) ;

CALL ImportField(90300009, 'Причина отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 0, 903, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(90300010, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 0, 903, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(90300011, 'Системный сбой', 'SoftRejectCls', 'Системный сбой', 'МягкаяПричинаОтклонКод', 0, 903, 0, 0, '', 0, null) ;

CALL ImportField(90300012, 'Причина сбоя', 'SoftRejectCause', 'Причина сбоя', 'МягкаяПричинаОтклонТекст', 0, 903, 0, 0, '', 0, null) ;

CALL ImportField(90300013, 'Дата реестра', 'ReestrDate', 'Дата реестра', ' ', 0, 903, 0, 0, 'ДатаФедРеестра', 0, null) ;

CALL ImportField(90300014, 'Номер реестра', 'ReestrNumber', 'Номер реестра', ' ', 0, 903, 0, 0, 'НомерРеестра', 0, null) ;

CALL ImportField(90300015, 'Сумма', 'Summa', 'Сумма заголовка выписки из банка', 'Summa', 0, 903, 0, 0, '', 0, null) ;

CALL ImportField(90300016, 'Дата создания', 'CreateDate', 'Дата создания', ' ', 0, 903, 0, 0, '', 0, null) ;

CALL ImportField(90300017, 'Дата изменений', 'UpdateDate', 'Дата изменений', ' ', 0, 903, 0, 0, '', 0, null) ;

CALL ImportField(90300018, 'Состояние', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 903, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(90300021, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 903, 0, 1, '', 0, null) ;

CALL ImportField(90300036, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 903, 0, 1, '', 0, null) ;

CALL ImportField(90300037, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 903, 0, 1, '', 0, null) ;

CALL ImportField(90300038, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 903, 0, 1, '', 0, null) ;

CALL ImportField(90300056, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 903, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(90300057, 'Л/с ФК', 'FacialCode', 'Л/с ФК', ' ', 0, 903, 0, 0, '', 0, null) ;

CALL ImportField(90300058, 'Счет ФО (ссылка)', 'IncAccount', 'Счет ФО (ссылка)', 'IncAccount', 0, 903, 0, 1, 'РСФО', 0, null) ;

CALL ImportField(90300059, 'Индексы данных', 'ProgIndex', '', ' ', 0, 903, 0, 1, '', 0, null) ;

CALL ImportField(90300124, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 903, 0, 1, '', 0, null) ;

CALL ImportField(90300130, 'Код документа', 'ID', 'Код документа', 'Id', 0, 903, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(90301009, 'КВСР (Ключ)', 'KVSR', 'КВСР (Ключ)', 'KVSRKey', 0, 903, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(90301010, 'КВРКлюч', 'KVR', 'КВР', 'KVRKey', 0, 903, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(90301011, 'КЦСРКлюч', 'KCSR', 'КЦСР', 'KCSRKey', 0, 903, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(90301019, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'FacialAcc_Cls', 0, 903, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(90301020, 'Л/с ФК', 'facialcode', 'Л/с ФК', ' ', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301021, 'Тип классификации', 'ClsType', 'Признак классификации (расходная/источниковая)', 'ClsType', 0, 903, 1, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(90301022, 'КД (Ключ)', 'KD', 'Ссылка на код дохода', 'KD', 0, 903, 1, 1, 'КДКлюч', 0, null) ;

CALL ImportField(90301023, 'ИВВФ (Ключ)', 'IFS', 'Ключ источника внутреннего финансирования', 'IFS', 0, 903, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, null) ;

CALL ImportField(90301024, 'Дебет', 'Debit', 'Сумма доходов по дебету за период (возврат)', 'Debit', 0, 903, 1, 0, 'СуммаДебет', 0, null) ;

CALL ImportField(90301025, 'Кредит', 'Credit', 'Сумма доходов по кредиту за период', 'Credit', 0, 903, 1, 0, 'СуммаКредит', 0, null) ;

CALL ImportField(90301026, 'Операция', 'BuhOperationCls', 'Классификатор бухгалтерских операций по 70н', 'BuhOperationCLS', 0, 903, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(90301027, 'Тип средств', 'MeansType', 'Классификатор типа средств', 'MeansType', 0, 903, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(90301028, 'Код цели', 'TargetCls', 'Код цели в классификаторе типа средств', ' ', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301029, 'ИНН', 'INN', 'ИНН', ' ', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301030, 'КПП', 'INN20', 'КПП', ' ', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301031, 'Наименование', 'Name', 'Наименование', ' ', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301032, 'Счет', 'Acc', 'Счет', ' ', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301033, 'Номер', 'DOCNUM', 'Номер документа', 'DocNum', 0, 903, 1, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(90301034, 'Примечание', 'Note', 'Примечание', 'Note', 0, 903, 1, 0, 'ПримечаниеДеталь', 0, null) ;

CALL ImportField(90301035, 'НДС', 'NDS', 'Сумма НДС', 'NDS', 0, 903, 1, 0, 'СуммаНДС', 0, null) ;

CALL ImportField(90301036, 'Район', 'RegionCls', 'Классификатор районов', 'RegionCLS', 0, 903, 1, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, null) ;

CALL ImportField(90301037, 'Тип документа', 'DocType', 'Классификатор типа документа', 'DocType', 0, 903, 1, 0, 'ТипДокумента', 0, null) ;

CALL ImportField(90301038, 'Субкод дохода', 'SubKD', 'Классификатор субкода дохода', 'SubKD', 0, 903, 1, 0, 'СубКД', 0, null) ;

CALL ImportField(90301039, 'ГосНИ', 'GosNI', 'ГосНИ', 'GosNI', 0, 903, 1, 0, 'ГосНИ', 0, null) ;

CALL ImportField(90301040, 'Бух. проводка', 'BuhPaymentCls', 'Бухгалтерская проводка', ' ', 0, 903, 1, 0, 'БухПроводка', 0, null) ;

CALL ImportField(90301041, 'Слой', 'AccountIndex', 'Слой доходов', 'AccountIndex', 0, 903, 1, 0, 'Слой', 0, null) ;

CALL ImportField(90301042, 'КЭСР', 'KESR', 'Экономическая статья', 'KESR', 0, 903, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(90301043, 'КФСР', 'KFSR', 'Функциональная статья', 'KFSR', 0, 903, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(90301046, 'Дата документа', 'DocDate', 'Дата документа', 'DocDate', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301047, 'Номер эл. пакета', 'ELPACKETNUM', 'Номер эл. пакета', ' ', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301048, 'Номер эл. документа', 'ELNUM', 'Номер эл. документа', ' ', 0, 903, 1, 0, 'ЭлНомерДокумента', 0, null) ;

CALL ImportField(90301049, 'Назначение эл. документа', 'NOTEEX', 'Назначение эл. документа', ' ', 0, 903, 1, 0, 'Назначение', 0, null) ;

CALL ImportField(90301050, 'ОКАТО', 'OKATO', 'ОКАТО', 'OKATO', 0, 903, 1, 0, 'ОКАТО', 0, null) ;

CALL ImportField(90301051, 'Уточнение ОКАТО', 'AddOKATO', 'Уточнение ОКАТО', 'AddOKATO', 0, 903, 1, 0, 'УточнениеОКАТО', 0, null) ;

CALL ImportField(90301052, 'Дата создания (детализация)', 'CREATEDATE', 'Дата создания', ' ', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301053, 'Дата изменения (детализация)', 'UPDATEDATE', 'Дата изменения', ' ', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301054, 'Организация', 'Org_Ref', 'Организация', 'Org_ref', 0, 903, 1, 0, 'Организация', 0, null) ;

CALL ImportField(90301057, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 903, 1, 1, '', 0, null) ;

CALL ImportField(90301080, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 0, 903, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(90301081, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 0, 903, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(90301125, 'Источник образования', 'FundsSource', 'Источник образования', 'FundsSource', 0, 903, 1, 0, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(90301147, 'КЦСР(Классификация)', 'KCSRCode', '', 'KCSR', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301148, 'КВР(Классификация)', 'KVRCode', '', 'KVR', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301149, 'КВСР', 'KVSRCode', 'КВСР', 'KVSR', 0, 903, 1, 0, '', 0, null) ;

CALL ImportField(90301150, 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 'Причина разблокировки', 'UnblockedCause', 0, 903, 1, 0, 'ПричинаРазблокировки', 0, null) ;

CALL ImportField(90301151, 'Заголовок для блокировки', 'BlockedCondition', 'Заголовок для блокировки', ' ', 0, 903, 1, 1, '', 0, null) ;

CALL ImportField(90301158, 'Код записи', 'ID', 'Код записи', 'ID', 0, 903, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(90301159, 'КД', 'KDCode', 'КД', 'KDValue', 0, 903, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(90301160, 'ИВВФ', 'IFSCode', 'ИВВФ', 'FinSourceValue', 0, 903, 1, 0, 'ИсточникВнутрФинансирования', 0, null) ;

CALL ImportField(90301161, 'Индексы данных (дет.)', 'ProgIndex', 'Индексы данных (дет.)', ' ', 0, 903, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(90301162, 'Ссылка на обмен с банком', 'ElDocRef', 'Ссылка на обмен с банком', ' ', 0, 903, 1, 1, '', 0, null) ;

CALL ImportField(90301163, 'Ссылка на заголовок', 'RECORDINDEX', 'Ссылка на заголовок', ' ', 0, 903, 1, 1, 'СсылкаНаДеталь', 0, null) ;

CALL ImportField(90301164, 'Заблокировано(Состояние блокировки)', 'IsBlocked', 'Заблокировано', 'IsBlocked', 0, 903, 1, 0, 'ПризнакБлокировки', 0, null) ;

CALL ImportField(90301165, 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 'Причина блокировки', 'BLOCKEDCAUSE', 0, 903, 1, 0, 'ПричинаБлокировки', 0, null) ;

CALL ImportField(90301166, 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 'Дата разблокировки', 'UnBlockedDate', 0, 903, 1, 0, 'ДатаРазблокировки', 0, null) ;

CALL ImportField(90301167, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 0, 903, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(90301168, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 903, 1, 0, 'КодСубсидии', 0, null) ;

-- Выписка по доходам, Бюджет(1)
CALL ImportField(90310001, 'Дата ввода', 'BUILDDATE', 'Дата ввода', 'BuildDate', 1, 903, 0, 0, 'ДатаВвода', 0, 17645) ;

CALL ImportField(90310002, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', 'AcceptDate', 1, 903, 0, 0, 'ДатаПринятия', 0, 17646) ;

CALL ImportField(90310003, 'Счет ФО', 'DFAccountName', 'Счет ФО', 'IncAccountName', 1, 903, 0, 0, '', 0, 17112) ;

CALL ImportField(90310006, 'Дата реестра(Федеральные средства)', 'ReestrDate', 'Дата реестра', ' ', 1, 903, 0, 1, 'ДатаФедРеестра', 0, 17657) ;

CALL ImportField(90310007, 'Номер реестра(Федеральные средства)', 'ReestrNumber', 'Номер реестра', ' ', 1, 903, 0, 1, 'НомерРеестра', 0, 17658) ;

CALL ImportField(90310008, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 1, 903, 0, 0, 'КодБюджета', 0, 17649) ;

CALL ImportField(90310009, 'Код причины отклонения', 'RejectCls', 'Код причины отклонения', 'RejectCls', 1, 903, 0, 0, 'ПричинаОтклонКод', 0, 17663) ;

CALL ImportField(90310010, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 903, 0, 0, 'ПричинаОтклонТекст', 0, 17664) ;

CALL ImportField(90310011, 'Номер документа', 'DocNumber', 'Номер документа', 'DocNumber', 1, 903, 0, 0, 'НомерДокументаЗаголовка', 0, 17648) ;

CALL ImportField(90310043, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', ' ', 1, 903, 0, 0, 'ТипОперации', 0, 17656) ;

CALL ImportField(90310059, 'Код документа', 'ID', 'Код документа', 'ID', 1, 903, 0, 1, 'КодДокумента', 0, 17644) ;

CALL ImportField(90310060, 'Лицевой счет(заголовок)', 'FacialAccCLS', 'Лицевой счет заголовка', ' ', 1, 903, 0, 1, 'ЛицСчетАдм', 0, 17662) ;

CALL ImportField(90310061, 'Счет ФО(ссылка)', 'INCACCOUNT', 'Счет ФО', 'IncAccount', 1, 903, 0, 1, 'РСФО', 0, 17647) ;

CALL ImportField(90310071, 'Криптостатус', 'CryptoStatus', 'Криптостатус', ' ', 1, 903, 0, 1, '', 0, 17665) ;

CALL ImportField(90310072, 'Сумма (Кредит-Дебет)', 'Summa', 'Сумма (Кредит-Дебет)', 'Summa', 1, 903, 0, 0, '', 0, null) ;

CALL ImportField(90310073, 'Код клиента УРМ', 'SenderID', 'Код клиента УРМ', 'SenderID', 1, 903, 0, 1, 'КодОтправителяДокумента', 0, 17660) ;

CALL ImportField(90310074, 'Описание счета', 'DFAccountComment', 'Описание счета', ' ', 1, 903, 0, 0, '', 0, null) ;

CALL ImportField(90310075, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 1, 903, 0, 1, 'СостояниеДокумента', 0, 25481) ;

CALL ImportField(90310076, 'Отдел', 'DepartmentCls', 'Принадлежность к отделу, обрабатывающему документ', 'DepartmentCls', 1, 903, 0, 0, 'Отдел', 0, 27626) ;

CALL ImportField(90311013, 'Вид дохода(Классификация)', 'DescriptionCode', 'Вид дохода', ' ', 1, 903, 1, 0, '', 0, 16831) ;

CALL ImportField(90311014, 'Подвид дохода(Классификация)', 'ProgramCode', 'Программа', ' ', 1, 903, 1, 0, '', 0, 16834) ;

CALL ImportField(90311015, 'ЭКД(Классификация)', 'KDKESR', 'ЭКД', ' ', 1, 903, 1, 0, '', 0, 16835) ;

CALL ImportField(90311017, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника', ' ', 1, 903, 1, 0, '', 0, 17050) ;

CALL ImportField(90311018, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ', ' ', 1, 903, 1, 0, '', 0, 17054) ;

CALL ImportField(90311020, 'ГосНИ', 'GOSNI', 'ГосНИ', 'GosNI', 1, 903, 1, 0, 'ГосНИ', 0, 17683) ;

CALL ImportField(90311021, 'КПП', 'INN20', 'КПП плательщика', 'Org_refKPP', 1, 903, 1, 0, '', 0, 16653) ;

CALL ImportField(90311022, 'ИНН', 'INN', 'ИНН плательщика', 'Org_refINN', 1, 903, 1, 0, '', 0, 16645) ;

CALL ImportField(90311023, 'Номер', 'DOCNUM', 'Номер', 'DocNum', 1, 903, 1, 0, 'НомерДокумента', 0, 17707) ;

CALL ImportField(90311024, 'Суб.код дохода', 'SUBKD', 'Суб.код дохода', 'SubKD', 1, 903, 1, 0, 'СубКД', 0, 17681) ;

CALL ImportField(90311025, 'НДС', 'NDS', 'НДС', 'NDS', 1, 903, 1, 0, 'СуммаНДС', 0, 17698) ;

CALL ImportField(90311026, 'Тип средств', 'MeansType', 'Тип средств', 'MeansType', 1, 903, 1, 0, 'ТипСредств', 0, 17699) ;

CALL ImportField(90311027, 'Счет плательщика', 'ACC', 'Наименование счета плательщика', 'AccountRefName', 1, 903, 1, 0, '', 0, 17112) ;

CALL ImportField(90311028, 'Дата документа', 'DocDate', 'Дата документа', 'DocDate', 1, 903, 1, 0, '', 0, 17708) ;

CALL ImportField(90311029, 'Лицевой счет', 'facialAcc_Cls', 'Лицевой счет', 'FacialAcc_Cls', 1, 903, 1, 0, 'ЛицевойСчет', 0, 17697) ;

CALL ImportField(90311033, 'Дебет', 'Debit', 'Дебет', 'Debit', 1, 903, 1, 0, 'СуммаДебет', 0, 17673) ;

CALL ImportField(90311035, 'Тип классификации', 'CLSType', 'Тип классификации', 'ClsType', 1, 903, 1, 0, 'ТипКлассификации', 0, 17723) ;

CALL ImportField(90311036, 'Кредит', 'Credit', 'Кредит', 'Credit', 1, 903, 1, 0, 'СуммаКредит', 0, 17674) ;

CALL ImportField(90311037, 'Наименование', 'Name', 'Наименование организации-плательщика', 'Org_refName', 1, 903, 1, 0, '', 0, 16646) ;

CALL ImportField(90311038, 'Документ', 'DOCTYPE', 'Документ', 'DocType', 1, 903, 1, 0, 'ТипДокумента', 0, 17675) ;

CALL ImportField(90311039, 'Примечание', 'Note', 'Примечание', 'Note', 1, 903, 1, 0, 'ПримечаниеДеталь', 0, 17692) ;

CALL ImportField(90311040, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 903, 1, 0, 'БухОперация', 0, 17720) ;

CALL ImportField(90311045, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCLS', 1, 903, 1, 0, 'Регион,РайонТрансферта', 0, 17682) ;

CALL ImportField(90311046, 'Вид учёта (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', ' ', 1, 903, 1, 0, 'БухПроводка', 0, 17700) ;

CALL ImportField(90311047, 'Слой', 'ACCOUNTINDEX', 'Слой', 'AccountIndex', 1, 903, 1, 0, 'Слой', 0, 17678) ;

CALL ImportField(90311050, 'Л/с ФК', 'facialcode', 'Л/с ФК', ' ', 1, 903, 1, 0, '', 0, null) ;

CALL ImportField(90311051, 'Классификация', 'TreeOwner', 'Классификация', ' ', 1, 903, 1, 0, '', 0, null) ;

CALL ImportField(90311052, 'Заблокирован(Состояние блокировки)', 'IsBlocked', 'Заблокировано', 'IsBlocked', 1, 903, 1, 0, 'ПризнакБлокировки', 0, 17734) ;

CALL ImportField(90311053, 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 'Причина блокировки', 'BlockedCause', 1, 903, 1, 0, 'ПричинаБлокировки', 0, 17735) ;

CALL ImportField(90311054, 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 'Дата разблокировки', 'UnBlockedDate', 1, 903, 1, 0, 'ДатаРазблокировки', 0, 17736) ;

CALL ImportField(90311055, 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 'Причина разблокировки', 'UnblockedCause', 1, 903, 1, 0, 'ПричинаРазблокировки', 0, 17737) ;

CALL ImportField(90311056, 'Источник образования', 'FundsSource', 'Источник образования', 'FundsSource', 1, 903, 1, 0, 'ИсточникОбразованияСредств', 0, 17732) ;

CALL ImportField(90311058, 'Информация о налоговом платеже', 'taxnote', 'Информация о налоговом платеже', 'TaxNote', 1, 903, 1, 0, 'ИнформацияОНалоге', 0, 17705) ;

CALL ImportField(90311062, 'Индексы данных', 'PROGINDEX', 'Индексы данных', 'ProgIndex', 1, 903, 1, 1, 'ИндексыДанных', 0, 17685) ;

CALL ImportField(90311063, 'ИВВФ(Ключ)', 'IFS', 'Ключ источника внутреннего финансирования', 'IFS', 1, 903, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17721) ;

CALL ImportField(90311064, 'КД(ключ)', 'KD', 'Ссылка на код дохода', 'KD', 1, 903, 1, 1, 'КДКлюч', 0, 17680) ;

CALL ImportField(90311065, 'Бюджет', 'BudgetRef', 'Бюджет', ' ', 1, 903, 1, 1, '', 0, 17687) ;

CALL ImportField(90311066, 'Код записи', 'ID', 'Код записи', 'Id', 1, 903, 1, 1, 'КодЗаписи', 0, 17669) ;

CALL ImportField(90311067, 'Ссылка на организацию', 'ORG_REF', 'Наименование', 'Org_ref', 1, 903, 1, 1, 'Организация', 0, 17677) ;

CALL ImportField(90311069, 'REcordIndex', 'RECORDINDEX', 'REcordIndex', 'RecordIndex', 1, 903, 1, 1, 'СсылкаНаДеталь', 0, 17686) ;

CALL ImportField(90311070, 'Счет плательщика(ссылка)', 'ACC_REF', 'Счет плательщика(ссылка)', 'AccountRef', 1, 903, 1, 1, 'СчетПлат', 0, 17679) ;

CALL ImportField(90311072, 'Ссылка на электронную копию', 'ElDocRef', 'Ссылка на электронную копию документа', ' ', 1, 903, 1, 1, '', 0, 17717) ;

CALL ImportField(90311073, 'Назначение эл. документа', 'NOTEEX', 'Назначение эл. документа', ' ', 1, 903, 1, 1, 'Назначение', 0, 17696) ;

CALL ImportField(90311074, 'Номер эл. документа(Информация из ЭО)', 'ELNUM', 'Номер эл. документа', 'EL_DocNumber', 1, 903, 1, 1, 'ЭлНомерДокумента', 0, 19317) ;

CALL ImportField(90311075, 'Код целевых средств (ключ)', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 903, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17739) ;

CALL ImportField(90311078, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 903, 1, 0, '', 0, null) ;

CALL ImportField(90311079, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 903, 1, 1, 'КодСубсидииКлюч', 0, 26627) ;

CALL ImportField(90311081, 'Код дохода', 'KDValue', 'Код дохода', 'KDValue', 1, 903, 1, 0, 'КодДохода', 0, 16836) ;

CALL ImportField(90311082, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 903, 1, 0, '', 0, 26617) ;

CALL ImportField(90311083, 'ИВВФ', 'IFS_FullID', 'ИВВФ', ' ', 1, 903, 1, 1, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(90311084, 'Плательщик(Информация из ЭО)', 'ElPayer', '', ' ', 1, 903, 1, 0, '', 0, null) ;

CALL ImportField(90311085, 'Район контрагента (плат.)', 'RegionContractor', 'Район контрагента', 'RegionContractor', 1, 903, 1, 0, 'РайонКонтрагента', 0, null) ;

-- Суммы в пути, УРМ(0)
CALL ImportField(90500036, 'Код целевых средств(Ключ)', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 0, 905, 0, 0, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(90500037, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 0, 905, 0, 0, '', 0, null) ;

-- Суммы в пути, Бюджет(1)
CALL ImportField(90510001, 'Дата поступления', 'IDATE', 'Дата зачисления ', ' ', 1, 905, 0, 0, 'ДатаПринятия', 0, 17672) ;

CALL ImportField(90510002, 'Дата поступления ', 'ODATE', 'Дата поступления ', ' ', 1, 905, 0, 0, '', 0, null) ;

CALL ImportField(90510003, 'Счет сумм в пути', 'BUHACCOUNT', 'Счет сумм в пути', ' ', 1, 905, 0, 0, '', 0, null) ;

CALL ImportField(90510004, 'Код дохода', 'KDValue', 'Код дохода', ' ', 1, 905, 0, 0, 'КодДохода', 0, 16836) ;

CALL ImportField(90510006, 'Вид дохода(Классификация)', 'DescriptionCode', 'Вид дохода', ' ', 1, 905, 0, 0, '', 0, 16831) ;

CALL ImportField(90510007, 'Подвид дохода(Классификация)', 'ProgramCode', 'Программа', ' ', 1, 905, 0, 0, '', 0, 16834) ;

CALL ImportField(90510008, 'ЭКД(Классификация)', 'KDKESR', 'ЭКД', ' ', 1, 905, 0, 0, '', 0, 16835) ;

CALL ImportField(90510009, 'Суб. код дохода', 'SUBKD', 'Суб. код дохода', ' ', 1, 905, 0, 0, 'СубКД', 0, 17681) ;

CALL ImportField(90510010, 'Сумма', 'CREDIT', 'Сумма', ' ', 1, 905, 0, 0, 'СуммаКредит', 0, 17674) ;

CALL ImportField(90510011, 'Счет ФО', 'DFACCOUNTNAME', 'Счет ФО', ' ', 1, 905, 0, 0, '', 0, 17112) ;

CALL ImportField(90510012, 'Счёт', 'Account', 'Счёт', ' ', 1, 905, 0, 0, '', 0, 17112) ;

CALL ImportField(90510013, 'ИНН', 'INN', 'ИНН', ' ', 1, 905, 0, 0, '', 0, 16645) ;

CALL ImportField(90510014, 'КПП', 'INN20', 'КПП', ' ', 1, 905, 0, 0, '', 0, 16653) ;

CALL ImportField(90510015, 'Наименование', 'Name', 'Наименование', ' ', 1, 905, 0, 0, '', 0, 16646) ;

CALL ImportField(90510016, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 905, 0, 0, 'ТипСредств', 0, 17699) ;

CALL ImportField(90510017, 'Район', 'REGIONCLS', 'Район', ' ', 1, 905, 0, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17682) ;

CALL ImportField(90510018, 'ГосНИ', 'GOSNI', 'ГосНИ', ' ', 1, 905, 0, 0, 'ГосНИ', 0, 17683) ;

CALL ImportField(90510019, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 905, 0, 0, 'ТипДокумента', 0, 17675) ;

CALL ImportField(90510020, '№документа', 'DOCNUM', '№документа', ' ', 1, 905, 0, 0, 'НомерДокумента', 0, 17707) ;

CALL ImportField(90510021, 'НДС', 'NDS', 'НДС', ' ', 1, 905, 0, 0, 'СуммаНДС', 0, 17698) ;

CALL ImportField(90510022, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 905, 0, 0, 'Примечание', 0, 17692) ;

CALL ImportField(90510023, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 905, 0, 0, 'КодБюджета', 0, 17687) ;

CALL ImportField(90510024, 'Лицевой счет', 'FacialAcc_CLS', 'Лицевой счет', ' ', 1, 905, 0, 0, 'ЛицевойСчет', 0, 17697) ;

CALL ImportField(90510026, 'Операция поступления', 'BuhOperationCLS', 'Операция зачисления', ' ', 1, 905, 0, 0, 'БухОперация', 0, 17720) ;

CALL ImportField(90510028, 'Операция перечисления', 'BuhOperationClsCorr', 'Операция поступления', ' ', 1, 905, 0, 0, '', 0, 17750) ;

CALL ImportField(90510029, 'Тип классификации', 'clstype', 'Тип классификации', ' ', 1, 905, 0, 0, 'ТипКлассификации', 0, 17723) ;

CALL ImportField(90510030, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 905, 0, 0, '', 0, null) ;

CALL ImportField(90510031, 'Дата перечисления', 'RecordDate', 'Дата перечисления', ' ', 1, 905, 0, 0, 'ДатаДокумента', 0, 17701) ;

CALL ImportField(90510033, 'Код целевых средств(Ключ)', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 1, 905, 0, 0, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(90510037, 'Вид источника(Классификация)', 'IFS_DescriptionCode', '', ' ', 1, 905, 0, 0, '', 0, 17050) ;

CALL ImportField(90510038, 'ЭКИ(Классификация)', 'IFS_KESR', '', ' ', 1, 905, 0, 0, '', 0, 17054) ;

-- Невыясненные поступления (устарел), УРМ(0)
CALL ImportField(90600079, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 0, 906, 0, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(90600081, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 0, 906, 0, 0, '', 0, null) ;

CALL ImportField(90601080, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 0, 906, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(90601082, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 0, 906, 1, 0, '', 0, null) ;

-- Невыясненные поступления (устарел), Бюджет(1)
CALL ImportField(90610001, '№ документа', 'DOCNUM', '№ документа', ' ', 1, 906, 0, 0, 'НомерДокумента', 0, 17707) ;

CALL ImportField(90610002, 'Дата проведения', 'IDATE', 'Дата ввода', ' ', 1, 906, 0, 0, 'ДатаПринятия', 0, 17672) ;

CALL ImportField(90610003, 'Суб. код дохода', 'SUBKD', 'Суб. код дохода', ' ', 1, 906, 0, 0, 'СубКД', 0, 17681) ;

CALL ImportField(90610004, 'Код дохода', 'KDValue', 'Код дохода', ' ', 1, 906, 0, 0, 'КодДохода', 0, 16836) ;

CALL ImportField(90610006, 'Вид дохода(Код дохода)', 'DescriptionCode', 'Вид дохода', ' ', 1, 906, 0, 0, '', 0, 16831) ;

CALL ImportField(90610007, 'Подвид(Код дохода)', 'ProgramCode', 'Программа', ' ', 1, 906, 0, 0, '', 0, 16834) ;

CALL ImportField(90610008, 'ЭКД(Код дохода)', 'KDKESR', 'ЭКД', ' ', 1, 906, 0, 0, '', 0, 16835) ;

CALL ImportField(90610009, 'Сумма', 'CREDIT', 'Сумма', ' ', 1, 906, 0, 0, 'СуммаКредит', 0, 17674) ;

CALL ImportField(90610010, 'Район контрагента (плат.)', 'REGIONCLS', 'Район', ' ', 1, 906, 0, 0, 'НаРегион', 0, 17682) ;

CALL ImportField(90610011, 'ГосНИ', 'GOSNI', 'ГосНИ', ' ', 1, 906, 0, 0, 'ГосНИ', 0, 17683) ;

CALL ImportField(90610012, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 906, 0, 0, 'КодБюджета', 0, 17687) ;

CALL ImportField(90610013, 'Лицевой счет', 'FacialAcc_CLS', 'Лицевой счет', ' ', 1, 906, 0, 0, 'ЛицевойСчет', 0, 17697) ;

CALL ImportField(90610014, 'ИНН', 'INN', 'ИНН', ' ', 1, 906, 0, 0, '', 0, 16645) ;

CALL ImportField(90610015, 'КПП', 'INN20', 'КПП', ' ', 1, 906, 0, 0, '', 0, 16653) ;

CALL ImportField(90610016, 'Наименование', 'NAME', 'Наименование', ' ', 1, 906, 0, 0, '', 0, 16646) ;

CALL ImportField(90610017, 'Счет ФО', 'DFAccountName', 'Счет ФО', ' ', 1, 906, 0, 0, '', 0, 17112) ;

CALL ImportField(90610018, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 906, 0, 0, 'ТипДокумента', 0, 17675) ;

CALL ImportField(90610019, 'Л/с ФК', 'facialcode', 'Л/с ФК', ' ', 1, 906, 0, 0, '', 0, 17149) ;

CALL ImportField(90610020, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 906, 0, 0, 'Примечание', 0, 17692) ;

CALL ImportField(90610021, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 906, 0, 0, 'ТипСредств', 0, 17699) ;

CALL ImportField(90610022, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 906, 0, 0, 'БухОперация', 0, 17720) ;

CALL ImportField(90610046, 'Счет', 'ACC', 'Счет', ' ', 1, 906, 0, 0, '', 0, 17112) ;

CALL ImportField(90610057, 'КД', 'KD', 'КД', ' ', 1, 906, 0, 1, 'КДКлюч', 0, 17680) ;

CALL ImportField(90610058, 'Код записи', 'ID', 'Код записи', ' ', 1, 906, 0, 1, 'КодЗаписи', 0, 17669) ;

CALL ImportField(90610059, 'Наименование', 'ORG_REF', 'Наименование', ' ', 1, 906, 0, 1, 'Организация', 0, 17677) ;

CALL ImportField(90610060, 'Счет ФО', 'INCACCOUNT', 'Счет ФО', ' ', 1, 906, 0, 1, 'РСФО', 0, 17684) ;

CALL ImportField(90610061, 'REcordIndex', 'RECORDINDEX', 'REcordIndex', ' ', 1, 906, 0, 1, 'СсылкаНаДеталь', 0, 17686) ;

CALL ImportField(90610062, 'Дебет', 'DEBIT', 'Дебет', ' ', 1, 906, 0, 1, 'СуммаДебет', 0, 17673) ;

CALL ImportField(90610063, 'Счет плательщика', 'ACC_REF', 'Счет плательщика', ' ', 1, 906, 0, 1, 'СчетПлат', 0, 17679) ;

CALL ImportField(90610064, 'Дата документа', 'DocDate', 'Дата документа', ' ', 1, 906, 0, 0, '', 0, 17708) ;

CALL ImportField(90610073, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 1, 906, 0, 1, 'КодЦелевыхСредствКлюч', 0, 17739) ;

CALL ImportField(90611023, '№ документа', 'DOCNUM', '№ документа', ' ', 1, 906, 1, 0, 'НомерДокумента', 0, 17707) ;

CALL ImportField(90611024, 'Дата проведения', 'IDATE', 'Дата проведения', ' ', 1, 906, 1, 0, 'ДатаПринятия', 0, 17672) ;

CALL ImportField(90611025, 'Дата документа', 'DOCDATE', 'Дата ввода', ' ', 1, 906, 1, 0, '', 0, 17708) ;

CALL ImportField(90611026, 'Код дохода', 'KDValue', 'Код дохода', ' ', 1, 906, 1, 0, 'КодДохода', 0, 16836) ;

CALL ImportField(90611028, 'Вид дохода(Код дохода)', 'DescriptionCode', 'Вид дохода', ' ', 1, 906, 1, 0, '', 0, 16831) ;

CALL ImportField(90611029, 'Подвид(Код дохода)', 'ProgramCode', 'Программа', ' ', 1, 906, 1, 0, '', 0, 16834) ;

CALL ImportField(90611030, 'ЭКД(Код дохода)', 'KDKESR', 'ЭКД', ' ', 1, 906, 1, 0, '', 0, 16835) ;

CALL ImportField(90611031, 'Суб. код дохода', 'SubKD', 'Суб. код дохода', ' ', 1, 906, 1, 0, 'СубКД', 0, 17681) ;

CALL ImportField(90611032, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 906, 1, 0, 'ТипСредств', 0, 17699) ;

CALL ImportField(90611033, 'Дебет', 'DEBIT', 'Дебет', ' ', 1, 906, 1, 0, 'СуммаДебет', 0, 17673) ;

CALL ImportField(90611034, 'Кредит', 'CREDIT', 'Кредит', ' ', 1, 906, 1, 0, 'СуммаКредит', 0, 17674) ;

CALL ImportField(90611035, 'Лицевой счет', 'FacialAcc_CLS', 'Лицевой счет', ' ', 1, 906, 1, 0, 'ЛицевойСчет', 0, 17697) ;

CALL ImportField(90611036, 'Л/с ФК', 'facialcode', 'Л/с ФК', ' ', 1, 906, 1, 0, '', 0, null) ;

CALL ImportField(90611037, 'ИНН', 'INN', 'ИНН', ' ', 1, 906, 1, 0, '', 0, 16645) ;

CALL ImportField(90611038, 'КПП', 'INN20', 'КПП', ' ', 1, 906, 1, 0, '', 0, 16653) ;

CALL ImportField(90611039, 'Наименование', 'NAME', 'Наименование', ' ', 1, 906, 1, 0, '', 0, 16646) ;

CALL ImportField(90611040, 'Счет', 'ACC', 'Счет', ' ', 1, 906, 1, 0, '', 0, 17112) ;

CALL ImportField(90611041, 'Район контрагента (плат.)', 'REGIONCLS', 'Район', ' ', 1, 906, 1, 0, 'НаРегион', 0, 17682) ;

CALL ImportField(90611042, 'ГосНИ', 'GOSNI', 'ГосНИ', ' ', 1, 906, 1, 0, 'ГосНИ', 0, 17683) ;

CALL ImportField(90611043, 'Документ', 'DOCTYPE', 'Документ', ' ', 1, 906, 1, 0, 'ТипДокумента', 0, 17675) ;

CALL ImportField(90611044, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 906, 1, 0, 'ПримечаниеДеталь', 0, 17692) ;

CALL ImportField(90611045, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 906, 1, 0, 'БухОперация', 0, 17720) ;

CALL ImportField(90611048, 'Код причины отклонения', 'RejectCLS', 'Код причины отклонения', ' ', 1, 906, 1, 0, 'ПричинаОтклонКод', 0, 17730) ;

CALL ImportField(90611049, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', ' ', 1, 906, 1, 0, 'ПричинаОтклонТекст', 0, 17731) ;

CALL ImportField(90611050, 'Информация для налогового платежа', 'TaxNote', 'Информация для налогового платежа', ' ', 1, 906, 1, 0, 'ИнформацияОНалоге', 0, 17705) ;

CALL ImportField(90611051, 'Заблокировано(Состояние блокировки)', 'IsBlocked', 'Заблокировано', ' ', 1, 906, 1, 0, 'ПризнакБлокировки', 0, 17734) ;

CALL ImportField(90611052, 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 'Причина блокировки', ' ', 1, 906, 1, 0, 'ПричинаБлокировки', 0, 17735) ;

CALL ImportField(90611053, 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 'Дата разблокировки', ' ', 1, 906, 1, 0, 'ДатаРазблокировки', 0, 17736) ;

CALL ImportField(90611054, 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 'Причина разблокировки', ' ', 1, 906, 1, 0, 'ПричинаРазблокировки', 0, 17737) ;

CALL ImportField(90611056, 'Источник образования', 'FundsSource', 'Источник образования', ' ', 1, 906, 1, 0, 'ИсточникОбразованияСредств', 0, 17732) ;

CALL ImportField(90611064, 'Индексы данных', 'PROGINDEX', 'Индексы данных', ' ', 1, 906, 1, 1, 'ИндексыДанных', 0, 17685) ;

CALL ImportField(90611065, 'КД', 'KD', 'КД', ' ', 1, 906, 1, 1, 'КДКлюч', 0, 17680) ;

CALL ImportField(90611066, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 906, 1, 1, '', 0, 17687) ;

CALL ImportField(90611067, 'Код записи', 'ID', 'Код записи', ' ', 1, 906, 1, 1, 'КодЗаписи', 0, 17669) ;

CALL ImportField(90611068, 'Наименование', 'ORG_REF', 'Наименование', ' ', 1, 906, 1, 1, 'Организация', 0, 17677) ;

CALL ImportField(90611069, 'р\с финоргана', 'INCACCOUNT_Detail', 'р\с финоргана', ' ', 1, 906, 1, 1, 'РСФО', 0, 17684) ;

CALL ImportField(90611070, 'REcordIndex', 'RECORDINDEX', 'REcordIndex', ' ', 1, 906, 1, 1, 'СсылкаНаДеталь', 0, 17686) ;

CALL ImportField(90611071, 'Счет плательщика', 'ACC_REF', 'Счет плательщика', ' ', 1, 906, 1, 1, 'СчетПлат', 0, 17679) ;

CALL ImportField(90611072, 'Признак классификации', 'clstype', 'clstype', ' ', 1, 906, 1, 1, 'ТипКлассификации', 0, 17723) ;

CALL ImportField(90611074, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 1, 906, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17739) ;

CALL ImportField(90611079, 'Номер л/c', 'FacialCodeEx', '', ' ', 1, 906, 1, 0, '', 0, 26617) ;

CALL ImportField(90611080, 'Код субсидииКлюч', 'SubsidyCls', '', ' ', 1, 906, 1, 1, 'КодСубсидииКлюч', 0, 26627) ;

-- Оперативные данные (доходы), УРМ(0)
CALL ImportField(90700050, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 0, 907, 0, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(90700051, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 0, 907, 0, 0, '', 0, null) ;

-- Оперативные данные (доходы), Бюджет(1)
CALL ImportField(90710001, 'Дата', 'IDATE', 'Дата', ' ', 1, 907, 0, 0, 'ДатаПринятия', 0, 17672) ;

CALL ImportField(90710002, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 907, 0, 0, 'ТипСредств', 0, 17699) ;

CALL ImportField(90710003, 'Код дохода', 'KDValue', 'Код дохода', ' ', 1, 907, 0, 0, 'КодДохода', 0, 16836) ;

CALL ImportField(90710005, 'Вид дохода(Классификация)', 'DescriptionCode', 'Вид дохода', ' ', 1, 907, 0, 0, '', 0, 16831) ;

CALL ImportField(90710006, 'Подвид дохода(Классификация)', 'ProgramCode', 'Программа', ' ', 1, 907, 0, 0, '', 0, 16834) ;

CALL ImportField(90710007, 'ЭКД(Классификация)', 'KDKESR', 'ЭКД', ' ', 1, 907, 0, 0, '', 0, 16835) ;

CALL ImportField(90710008, 'Суб.код дохода', 'SubKD', 'Суб.код дохода', ' ', 1, 907, 0, 0, 'СубКД', 0, 17681) ;

CALL ImportField(90710009, 'Дебет', 'Debit', 'Дебет', ' ', 1, 907, 0, 0, 'СуммаДебет', 0, 17673) ;

CALL ImportField(90710010, 'Кредит', 'Credit', 'Кредит', ' ', 1, 907, 0, 0, 'СуммаКредит', 0, 17674) ;

CALL ImportField(90710011, 'ИНН', 'INN', 'ИНН', ' ', 1, 907, 0, 0, '', 0, 16645) ;

CALL ImportField(90710012, 'КПП', 'INN20', 'КПП', ' ', 1, 907, 0, 0, '', 0, 16653) ;

CALL ImportField(90710014, 'Наименование', 'NAME', 'Наименование', ' ', 1, 907, 0, 0, '', 0, 16646) ;

CALL ImportField(90710015, 'Бюджет', 'BudgetRef', 'Бюджет', ' ', 1, 907, 0, 0, 'КодБюджета', 0, 17687) ;

CALL ImportField(90710016, 'Район', 'RegionCLS', 'Район', ' ', 1, 907, 0, 0, 'Регион,РайонТрансферта,РайонКонтрагента', 0, 17682) ;

CALL ImportField(90710017, 'ГосНИ', 'GosNI', 'ГосНИ', ' ', 1, 907, 0, 0, 'ГосНИ', 0, 17683) ;

CALL ImportField(90710018, 'Счет ФО', 'DFACCNAME', 'Счет ФО', ' ', 1, 907, 0, 0, '', 0, 17112) ;

CALL ImportField(90710019, 'Слой', 'AccountIndex', 'Слой', ' ', 1, 907, 0, 0, 'Слой', 0, 17678) ;

CALL ImportField(90710020, 'Документ', 'DocType', 'Документ', ' ', 1, 907, 0, 0, 'ТипДокумента', 0, 17675) ;

CALL ImportField(90710021, '№  документа', 'DOCNUM', '№  документа', ' ', 1, 907, 0, 0, 'НомерДокумента', 0, 17707) ;

CALL ImportField(90710022, '№ договора', 'DogNum', '№ договора', ' ', 1, 907, 0, 0, '', 0, 17725) ;

CALL ImportField(90710023, 'НДС', 'NDS', 'НДС', ' ', 1, 907, 0, 0, 'СуммаНДС', 0, 17698) ;

CALL ImportField(90710024, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 907, 0, 0, 'Примечание', 0, 17692) ;

CALL ImportField(90710025, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 907, 0, 0, 'БухОперация', 0, 17720) ;

CALL ImportField(90710026, 'Лицевой счет', 'FacialAcc_CLS', 'Лицевой счет', ' ', 1, 907, 0, 0, 'ЛицевойСчет', 0, 17697) ;

CALL ImportField(90710027, 'ОКАТО', 'OKATO', 'OKATO', ' ', 1, 907, 0, 0, 'ОКАТО', 0, 17728) ;

CALL ImportField(90710028, 'Уточнение ОКАТО', 'ADDOKATO', 'Уточнение ОКАТО', ' ', 1, 907, 0, 0, '', 0, null) ;

CALL ImportField(90710029, 'Источник данных', 'ProgIndex', 'Источник данных', ' ', 1, 907, 0, 1, 'ИндексыДанных', 0, 17685) ;

CALL ImportField(90710030, 'ИВВФ', 'IFS', 'ИВВФ', ' ', 1, 907, 0, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17721) ;

CALL ImportField(90710031, 'Источник образования', 'FundsSource', 'Источник образования', ' ', 1, 907, 0, 0, 'ИсточникОбразованияСредств', 0, 17732) ;

CALL ImportField(90710032, 'КД', 'KD', 'КД', ' ', 1, 907, 0, 1, 'КДКлюч', 0, 17680) ;

CALL ImportField(90710033, 'Код записи', 'ID', 'Код записи', ' ', 1, 907, 0, 1, 'КодЗаписи', 0, 17669) ;

CALL ImportField(90710034, 'Организация', 'ORG_REF', 'Организация', ' ', 1, 907, 0, 1, 'Организация', 0, 17677) ;

CALL ImportField(90710035, 'Счет ФО', 'IncAccount', 'Счет ФО', ' ', 1, 907, 0, 1, 'РСФО', 0, 17684) ;

CALL ImportField(90710036, 'Тип классификации', 'CLSType', 'Тип классификации', ' ', 1, 907, 0, 0, 'ТипКлассификации', 0, 17723) ;

CALL ImportField(90710037, 'Классификация', 'TreeOwner', 'Классификация', ' ', 1, 907, 0, 0, '', 0, null) ;

CALL ImportField(90710038, 'Администратор(Классификация)', 'IFS_KVSR', 'Администратор(Классификация)', ' ', 1, 907, 0, 0, '', 0, null) ;

CALL ImportField(90710039, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 907, 0, 0, '', 0, 17050) ;

CALL ImportField(90710040, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 907, 0, 0, '', 0, 17054) ;

CALL ImportField(90710041, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 907, 0, 0, '', 0, null) ;

CALL ImportField(90710043, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 1, 907, 0, 1, 'КодЦелевыхСредствКлюч', 0, 17739) ;

CALL ImportField(90710047, 'Счет плательщика', 'acc', 'Счет плательщика', ' ', 1, 907, 0, 0, '', 0, 17112) ;

CALL ImportField(90710048, 'Счет плательщика', 'acc_ref', 'Счет плательщика', ' ', 1, 907, 0, 1, 'СчетПлат', 0, 17679) ;

CALL ImportField(90710051, 'Код субсидииКлюч', 'SubsidyCls', '', ' ', 1, 907, 0, 1, 'КодСубсидииКлюч', 0, 26627) ;

-- Закрытие года, Бюджет(1)
CALL ImportField(120110001, 'Дата проводки', 'DateAccept', 'Дата', ' ', 1, 1201, 0, 0, 'ДатаПринятия', 0, 17357) ;

CALL ImportField(120110002, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 1201, 0, 0, 'КодБюджета', 0, 17327) ;

CALL ImportField(120110003, 'Счет ФО', 'AccName', 'Счет ФО', ' ', 1, 1201, 0, 0, '', 0, 17112) ;

CALL ImportField(120110004, 'Прямая классификация', 'TreeOwner0', 'Классификация кредит', ' ', 1, 1201, 0, 0, '', 0, null) ;

CALL ImportField(120110005, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 1201, 0, 1, 'КВСРКлюч', 0, 17341) ;

CALL ImportField(120110006, 'ФКР(Прямая классификация)', 'KFSR', 'КФСР', ' ', 1, 1201, 0, 0, 'КФСР', 0, 17342) ;

CALL ImportField(120110007, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 1201, 0, 1, 'КЦСРКлюч', 0, 17345) ;

CALL ImportField(120110008, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 1201, 0, 1, 'КВРКлюч', 0, 17344) ;

CALL ImportField(120110009, 'ЭКР(Прямая классификация)', 'KESR', 'КЭСР', ' ', 1, 1201, 0, 0, 'КЭСР', 0, 17343) ;

CALL ImportField(120110011, 'Вид источника(Прямая классификация)', 'IFS_DescriptionCode', 'Вид источника', ' ', 1, 1201, 0, 0, '', 0, 17050) ;

CALL ImportField(120110012, 'ЭКИ(Прямая классификация)', 'IFS_KESR', 'ЭК', ' ', 1, 1201, 0, 0, '', 0, 17054) ;

CALL ImportField(120110014, 'Вид дохода(Прямая классификация)', 'DescriptionCode', 'Вид дохода', ' ', 1, 1201, 0, 0, '', 0, 16831) ;

CALL ImportField(120110015, 'Подвид дохода(Прямая классификация)', 'ProgramCode', 'Программа', ' ', 1, 1201, 0, 0, '', 0, 16834) ;

CALL ImportField(120110016, 'ЭКД(Прямая классификация)', 'KDKESR', 'ЭКД', ' ', 1, 1201, 0, 0, '', 0, 16835) ;

CALL ImportField(120110017, 'Тип прямой классификации', 'clstype', 'Тип классификации кредит', ' ', 1, 1201, 0, 0, 'ТипКлассификации', 0, 17346) ;

CALL ImportField(120110018, 'Корреспондирующая классификация', 'TreeOwner1', 'Классификация дебет', ' ', 1, 1201, 0, 0, '', 0, null) ;

CALL ImportField(120110019, 'КВСР Ключ', 'KVSR_corr', 'КВСР ', ' ', 1, 1201, 0, 1, 'КВСРКлючНовый', 0, 17347) ;

CALL ImportField(120110020, 'ФКР(Корреспондирующая классификация)', 'KFSR_corr', 'КФСР', ' ', 1, 1201, 0, 0, 'КФСРНовый', 0, 17348) ;

CALL ImportField(120110021, 'КЦСРКлюч', 'KCSR_corr', 'КЦСР', ' ', 1, 1201, 0, 1, 'КЦСРКлючНовый', 0, 17351) ;

CALL ImportField(120110022, 'КВРКлюч', 'KVR_corr', 'КВР', ' ', 1, 1201, 0, 1, 'КВРКлючНовый', 0, 17350) ;

CALL ImportField(120110023, 'ЭКР(Корреспондирующая классификация)', 'KESR_corr', 'КЭСР', ' ', 1, 1201, 0, 0, 'КЭСРНовый', 0, 17349) ;

CALL ImportField(120110025, 'Вид источника(Корреспондирующая классификация)', 'IFS_corr_DescriptionCode', 'Вид источника', ' ', 1, 1201, 0, 0, '', 0, null) ;

CALL ImportField(120110026, 'ЭКИ(Корреспондирующая классификация)', 'IFS_corr_KESR', 'ЭК', ' ', 1, 1201, 0, 0, '', 0, null) ;

CALL ImportField(120110028, 'Вид дохода(Корреспондирующая классификация)', 'DescriptionCode_corr', 'Вид дохода', ' ', 1, 1201, 0, 0, '', 0, 16831) ;

CALL ImportField(120110029, 'Подвид дохода(Корреспондирующая классификация)', 'ProgramCode_corr', 'Программа', ' ', 1, 1201, 0, 0, '', 0, 16834) ;

CALL ImportField(120110030, 'ЭКД(Корреспондирующая классификация)', 'KDKESR_corr', 'ЭКД', ' ', 1, 1201, 0, 0, '', 0, 16835) ;

CALL ImportField(120110031, 'Тип корреспондирующей классификации', 'clstype_corr', 'Тип классификации дебет', ' ', 1, 1201, 0, 0, 'ТипКлассификацииКор', 0, 17352) ;

CALL ImportField(120110032, 'Сумма', 'SUMMA', 'Сумма', ' ', 1, 1201, 0, 0, '', 0, 17328) ;

CALL ImportField(120110033, 'Район трансферта', 'RegionCLS', 'Район', ' ', 1, 1201, 0, 1, 'Регион', 0, 17326) ;

CALL ImportField(120110035, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 1201, 0, 0, 'БухОперация', 0, 17338) ;

CALL ImportField(120110036, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 1201, 0, 0, 'Примечание', 0, 17330) ;

CALL ImportField(120110037, 'ИВВФ', 'IFS', 'Источниковая классификация', ' ', 1, 1201, 0, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17355) ;

CALL ImportField(120110038, 'ИВВФ', 'IFS_corr', 'Источниковая классификация', ' ', 1, 1201, 0, 1, 'ИсточникВнутрФинансированияКлючНовый', 0, 17339) ;

CALL ImportField(120110039, 'Код дохода (кредит)', 'kd', 'Код дохода (кредит)', ' ', 1, 1201, 0, 1, 'КодДоходаКлюч', 0, 17353) ;

CALL ImportField(120110040, 'Код дохода (дебет)', 'kd_corr', 'Код дохода (дебет)', ' ', 1, 1201, 0, 1, 'КодДоходаКлючНовый', 0, 17354) ;

CALL ImportField(120110041, 'Код записи', 'ID', 'ID', ' ', 1, 1201, 0, 1, 'КодЗаписи', 0, 17322) ;

CALL ImportField(120110042, 'Счет ФО', 'AccountRef', 'Счет ФО', ' ', 1, 1201, 0, 1, 'РСФО', 0, 17333) ;

CALL ImportField(120110043, 'Администратор(Корреспондирующая классификация)', 'IFS_corr_KVSRCode', 'Администратор', ' ', 1, 1201, 0, 0, '', 0, null) ;

CALL ImportField(120110055, 'Тип документа', 'DocType', 'Тип документа', ' ', 1, 1201, 0, 1, 'ТипДокумента', 0, 17383) ;

CALL ImportField(120110056, 'Тип документа', 'DocType_corr', 'Тип документа', ' ', 1, 1201, 0, 1, 'ТипДокументаНовый', 0, 17384) ;

CALL ImportField(120110059, 'Источник финансирования', 'FinSource', 'Источник финансирования', ' ', 1, 1201, 0, 1, 'ИсточникФинансирования', 0, 17376) ;

CALL ImportField(120110060, 'Источник финансирования', 'FinSource_corr', 'Источник финансирования', ' ', 1, 1201, 0, 1, 'ИсточникФинансированияНовый', 0, 17377) ;

CALL ImportField(120110063, 'Вид источника(Корреспондирующая классификация)', 'IFS_DescriptionCode_corr', 'Вид источника(Корреспондирующая классификация)', ' ', 1, 1201, 0, 0, '', 0, 17050) ;

CALL ImportField(120110064, 'ЭКИ(Корреспондирующая классификация)', 'IFS_KESR_corr', 'ЭКИ(Корреспондирующая классификация)', ' ', 1, 1201, 0, 0, '', 0, 17054) ;

CALL ImportField(120110067, 'Район', 'RegionCls_corr', 'Район', ' ', 1, 1201, 0, 0, '', 0, null) ;

CALL ImportField(120110068, 'СубКОСГУ', 'SubKESR', 'СубКЭСР', ' ', 1, 1201, 0, 1, 'СубКЭСР', 0, 17387) ;

CALL ImportField(120110069, 'СубКОСГУ', 'SubKESR_corr', 'СубКЭСР', ' ', 1, 1201, 0, 1, 'СубКЭСРНовый', 0, 17388) ;

CALL ImportField(120110070, 'Дата ввода', 'DAT', '', ' ', 1, 1201, 0, 0, '', 0, 17323) ;

CALL ImportField(120110071, 'Код дохода', 'KDValue', '', ' ', 1, 1201, 0, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(120110072, 'Код дохода', 'KDValue_corr', '', ' ', 1, 1201, 0, 1, 'КодДоходаНовый', 0, 16836) ;

-- Оперативные данные, Бюджет(1)
CALL ImportField(150110001, 'Дата', 'AcceptDate', 'Дата', ' ', 1, 1501, 0, 0, 'ДатаПринятия', 0, 18389) ;

CALL ImportField(150110002, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 1501, 0, 0, '', 0, null) ;

CALL ImportField(150110003, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 1501, 0, 1, 'КВСРКлюч', 0, 18381) ;

CALL ImportField(150110004, 'ФКР(Классификация)', 'KFSR', 'КФСР', ' ', 1, 1501, 0, 0, 'КФСР', 0, 18379) ;

CALL ImportField(150110005, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 1501, 0, 1, 'КЦСРКлюч', 0, 18380) ;

CALL ImportField(150110006, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 1501, 0, 1, 'КВРКлюч', 0, 18382) ;

CALL ImportField(150110007, 'ЭКР(Классификация)', 'KESR', 'КЭСР', ' ', 1, 1501, 0, 0, 'КЭСР', 0, 18383) ;

CALL ImportField(150110010, 'СубКОСГУ', 'SUBKESR', 'СубКЭСР', ' ', 1, 1501, 0, 0, 'СубКЭСР', 0, 18384) ;

CALL ImportField(150110011, 'СубКЦСР', 'SubKCSR', 'СубКЦСР', ' ', 1, 1501, 0, 0, 'СубКЦСР', 0, 18411) ;

CALL ImportField(150110012, 'Район', 'REGIONCLS', 'Район', ' ', 1, 1501, 0, 0, 'Регион', 0, 18385) ;

CALL ImportField(150110013, 'Группа', 'GROUPINF', 'Группа', ' ', 1, 1501, 0, 0, 'ГруппаИнформации', 0, 18393) ;

CALL ImportField(150110014, 'Источник', 'FINSOURCE', 'Источник', ' ', 1, 1501, 0, 0, 'ИсточникФинансирования', 0, 18386) ;

CALL ImportField(150110016, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 1501, 0, 0, 'ТипСредств', 0, 18408) ;

CALL ImportField(150110018, 'Месяц', 'MONTHREPORT', 'Месяц', ' ', 1, 1501, 0, 0, 'Месяц', 0, 18391) ;

CALL ImportField(150110019, 'Распорядитель', 'ManagerOwner', 'Распорядитель', ' ', 1, 1501, 0, 0, '', 0, null) ;

CALL ImportField(150110020, 'ИНН(Распорядитель)', 'INN', 'ИНН', ' ', 1, 1501, 0, 0, '', 0, 16645) ;

CALL ImportField(150110021, 'КПП(Распорядитель)', 'INN20', 'КПП', ' ', 1, 1501, 0, 0, '', 0, 16653) ;

CALL ImportField(150110022, 'Наименование(Распорядитель)', 'NAME', 'Наименование', ' ', 1, 1501, 0, 0, '', 0, 16646) ;

CALL ImportField(150110023, 'Счет(Распорядитель)', 'ACC', 'Счет', ' ', 1, 1501, 0, 0, '', 0, 17112) ;

CALL ImportField(150110024, 'Тип счета(Распорядитель)', 'ACC_CLS', 'Тип счета', ' ', 1, 1501, 0, 0, '', 0, 17113) ;

CALL ImportField(150110025, 'Сумма', 'SUMMA', 'Сумма', ' ', 1, 1501, 0, 0, 'ОперДанныеСумма', 0, 18392) ;

CALL ImportField(150110026, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 1501, 0, 0, 'Примечание', 0, 18394) ;

CALL ImportField(150110027, 'Год', 'YEARREPORT', 'Год', ' ', 1, 1501, 0, 0, 'Год', 0, 18390) ;

CALL ImportField(150110028, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', ' ', 1, 1501, 0, 0, 'ЛицевойСчет', 0, 18406) ;

CALL ImportField(150110029, 'Заявка', 'SUMMA1', 'Заявка', ' ', 1, 1501, 0, 0, 'ОперДанныеЗаявка', 0, 18401) ;

CALL ImportField(150110030, 'Квартал 1', 'QUARTER1', 'Квартал 1', ' ', 1, 1501, 0, 0, 'ОперДанныеКвартал1', 0, 18402) ;

CALL ImportField(150110031, 'Квартал 2', 'QUARTER2', 'Квартал 2', ' ', 1, 1501, 0, 0, 'ОперДанныеКвартал2', 0, 18403) ;

CALL ImportField(150110032, 'Квартал 3', 'QUARTER3', 'Квартал 3', ' ', 1, 1501, 0, 0, 'ОперДанныеКвартал3', 0, 18404) ;

CALL ImportField(150110033, 'Квартал 4', 'QUARTER4', 'Квартал 4', ' ', 1, 1501, 0, 0, 'ОперДанныеКвартал4', 0, 18405) ;

CALL ImportField(150110034, 'Получатель(*)', 'AcceptorOwner', 'Получатель(*)', ' ', 1, 1501, 0, 0, '', 0, null) ;

CALL ImportField(150110035, 'ИНН(Получатель(*))', 'INNA', 'ИНН', ' ', 1, 1501, 0, 0, '', 0, 16645) ;

CALL ImportField(150110036, 'КПП(Получатель(*))', 'KPPA', 'КПП', ' ', 1, 1501, 0, 0, '', 0, 16653) ;

CALL ImportField(150110037, 'Наименование(Получатель(*))', 'NAMEA', 'Наименование', ' ', 1, 1501, 0, 0, '', 0, 16646) ;

CALL ImportField(150110038, 'Счет(Получатель(*))', 'ACCA', 'Счет', ' ', 1, 1501, 0, 0, '', 0, 17112) ;

CALL ImportField(150110039, 'ID', 'ID', 'ID', ' ', 1, 1501, 0, 1, 'КодДокумента', 0, 18378) ;

CALL ImportField(150110040, 'AccountRef', 'AccountRef', 'AccountRef', ' ', 1, 1501, 0, 1, 'СчетРаспорядителя', 0, 18388) ;

CALL ImportField(150110044, 'Источник внутреннего финансирования(ключ)', 'IFS', 'Источник внутреннего финансирования(ключ)', ' ', 1, 1501, 0, 1, 'ИсточникВнутрФинансированияКлюч', 0, 18410) ;

CALL ImportField(150110045, 'Источник внутреннего финансирования', 'IFSValue', 'Источник внутреннего финансирования', ' ', 1, 1501, 0, 0, 'ИсточникВнутрФинансирования', 0, null) ;

CALL ImportField(150110046, 'Тип классификации', 'ClsType', '', ' ', 1, 1501, 0, 0, '', 0, 26637) ;

CALL ImportField(150110047, 'Вид источника(Классификация)', 'DescriptionCode', '', ' ', 1, 1501, 0, 0, '', 0, 17050) ;

CALL ImportField(150110048, 'ЭКИ(Классификация)', 'IFS_KESR', '', ' ', 1, 1501, 0, 0, '', 0, 17054) ;

CALL ImportField(150110050, 'Код целевых средствКлюч', 'TransfertCLS', '', ' ', 1, 1501, 0, 1, 'КодЦелевыхСредствКлюч', 0, 27017) ;

-- Бюджетные обязательства, УРМ(0)
CALL ImportField(160100001, '№ Внутреннего учета', 'ANUMBER', '№ Внутреннего учета', ' ', 0, 1601, 0, 0, 'УчетныйНомер', 0, null) ;

CALL ImportField(160100002, 'Дата принятия/отклонения', 'ACCEPTDATE', 'Дата принятия/отклонения', 'ACCEPTDATE', 0, 1601, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(160100003, 'Принят/Отклонен', 'ACCEPTED_REVERTED', 'Принят/Отклонен', 'ACCEPTED_REVERTED', 0, 1601, 0, 0, 'ПринятыеНепринятые', 0, null) ;

CALL ImportField(160100004, 'Тип документа', 'AGREEMENT_TYPE', 'Тип документа', ' ', 0, 1601, 0, 0, 'ТипОбязательства', 0, null) ;

CALL ImportField(160100005, '№ Договора', 'AGREEMENT_NUM', '№ Договора', ' ', 0, 1601, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(160100006, 'Дата договора', 'AGREEMENT_DATE', 'Дата договора', ' ', 0, 1601, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(160100007, 'Дата завершения договора', 'AGREEMENT_END', 'Дата завершения договора', ' ', 0, 1601, 0, 0, 'ДатаЗавершения', 0, null) ;

CALL ImportField(160100008, 'Краткое содержание договора', 'AGREEMENT_NOTE', 'Краткое содержание договора', ' ', 0, 1601, 0, 0, 'Примечание,СодержаниеДоговора', 0, null) ;

CALL ImportField(160100009, 'Наименование(Поставщик услуг)', 'Supplier_Name', 'Наименование', ' ', 0, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160100010, 'ИНН(Поставщик услуг)', 'Supplier_INN', 'ИНН', ' ', 0, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160100011, 'КПП(Поставщик услуг)', 'Supplier_INN20', 'КПП', ' ', 0, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160100012, 'Сумма договора', 'Agreement_Summa', 'Сумма договора', ' ', 0, 1601, 0, 0, 'ОбязСуммаДоговора', 0, null) ;

CALL ImportField(160100013, 'Сумма на год', 'TOTALSUMM', 'Сумма на год', ' ', 0, 1601, 0, 0, 'ОбязОбщаяСуммаЗаПериод', 0, null) ;

CALL ImportField(160100014, 'Наименование(Бюджетное учреждение)', 'BudgetOrg_Name', 'Наименование', ' ', 0, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160100046, 'Условия поставки', 'DELIVERY_RULES', 'Условия поставки', ' ', 0, 1601, 0, 0, 'УсловиеПоставки', 0, null) ;

CALL ImportField(160100047, 'КПП(Бюджетное учреждение)', 'BudgetOrg_INN20', 'КПП', ' ', 0, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160100048, 'ИНН(Бюджетное учреждение)', 'BudgetOrg_INN', 'ИНН', ' ', 0, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160100049, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 0, 1601, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(160100050, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 0, 1601, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(160100059, 'Код документа', 'ID', 'Код документа', ' ', 0, 1601, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(160100063, 'CryptoStatus', 'CryptoStatus', 'CryptoStatus', ' ', 0, 1601, 0, 1, '', 0, null) ;

CALL ImportField(160100071, 'Счет(Поставщик услуг)', 'Supplier_Acc', '', ' ', 0, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160100082, 'Лицевой счет в ФК', 'FACIALCode', 'Лицевой счет в ФК', ' ', 0, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160100084, 'Статус', 'DocStateName', 'Статус', 'DocStateName', 0, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160100085, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 1601, 0, 1, '', 0, null) ;

CALL ImportField(160100086, 'Состояние', 'DOCSTATEREF', 'Состояние', 'DOCSTATEREF', 0, 1601, 0, 1, '', 0, null) ;

CALL ImportField(160100087, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 1601, 0, 1, '', 0, null) ;

CALL ImportField(160100088, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 1601, 0, 1, '', 0, null) ;

CALL ImportField(160100090, 'Ид. в БД Бюджета', 'FUID', 'Ид. в БД Бюджета', 'FUID', 0, 1601, 0, 1, '', 0, null) ;

CALL ImportField(160100091, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 1601, 0, 1, '', 0, null) ;

CALL ImportField(160100092, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 1601, 0, 1, '', 0, null) ;

CALL ImportField(160100093, 'Признак зависания', 'DocSuspended', 'Признак зависания', ' ', 0, 1601, 0, 1, '', 0, null) ;

CALL ImportField(160100097, 'Номер сведения', 'InfoNumber', 'Номер сведения', 'InfoNumber', 0, 1601, 0, 0, 'НомерСведения', 0, null) ;

CALL ImportField(160100098, 'Сумма аванса', 'AdvanceSumma', 'Сумма авансового платежа', 'AdvanceSumma', 0, 1601, 0, 0, 'ОбязСуммаАванса', 0, null) ;

CALL ImportField(160101017, '№ Уточняемого обязательства', 'PARENT_PROMISE', '№ Уточняемого обязательства', 'PARENT_PROMISE', 0, 1601, 1, 0, 'НомерУточняемогоБО', 0, null) ;

CALL ImportField(160101018, '№ Обязательства', 'REGISTRNUMBER', '№ Обязательства', 'REGISTRNUMBER', 0, 1601, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(160101020, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 0, 1601, 1, 0, '', 0, null) ;

CALL ImportField(160101021, 'КВСРКлюч', 'KVSR', 'КВСР', 'KVSRKey', 0, 1601, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(160101022, 'КФСР(Классификация)', 'KFSR', 'КФСР', 'KFSR', 0, 1601, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(160101023, 'КЦСРКлюч', 'KCSR', 'КЦСР', 'KCSRKey', 0, 1601, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(160101024, 'КВРКлюч', 'KVR', 'КВР', 'KVRKey', 0, 1601, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(160101025, 'КЭСР(Классификация)', 'KESR', 'КЭСР', 'KESR', 0, 1601, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(160101027, 'Тип средств', 'MeansType', 'Тип средств', 'MeansType', 0, 1601, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(160101029, 'Источник финансирования', 'FinSource', 'Источник финансирования', ' ', 0, 1601, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(160101030, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 0, 1601, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(160101031, 'Сумма бюджетных обязательств за год', 'SUMMA', 'Сумма', 'SUMMA', 0, 1601, 1, 1, 'ОбязСуммаНаГод', 0, null) ;

CALL ImportField(160101032, 'Январь', 'MONTH01', 'Январь', ' ', 0, 1601, 1, 0, 'ОбязЯнварь', 0, null) ;

CALL ImportField(160101033, 'Февраль', 'MONTH02', 'Февраль', ' ', 0, 1601, 1, 0, 'ОбязФевраль', 0, null) ;

CALL ImportField(160101034, 'Март', 'MONTH03', 'Март', ' ', 0, 1601, 1, 0, 'ОбязМарт', 0, null) ;

CALL ImportField(160101035, 'Апрель', 'MONTH04', 'Апрель', ' ', 0, 1601, 1, 0, 'ОбязАпрель', 0, null) ;

CALL ImportField(160101036, 'Май', 'MONTH05', 'Май', ' ', 0, 1601, 1, 0, 'ОбязМай', 0, null) ;

CALL ImportField(160101037, 'Июнь', 'MONTH06', 'Июнь', ' ', 0, 1601, 1, 0, 'ОбязИюнь', 0, null) ;

CALL ImportField(160101038, 'Июль', 'MONTH07', 'Июль', ' ', 0, 1601, 1, 0, 'ОбязИюль', 0, null) ;

CALL ImportField(160101039, 'Август', 'MONTH08', 'Август', ' ', 0, 1601, 1, 0, 'ОбязАвгуст', 0, null) ;

CALL ImportField(160101040, 'Сентябрь', 'MONTH09', 'Сентябрь', ' ', 0, 1601, 1, 0, 'ОбязСентябрь', 0, null) ;

CALL ImportField(160101041, 'Октябрь', 'MONTH10', 'Октябрь', ' ', 0, 1601, 1, 0, 'ОбязОктябрь', 0, null) ;

CALL ImportField(160101042, 'Ноябрь', 'MONTH11', 'Ноябрь', ' ', 0, 1601, 1, 0, 'ОбязНоябрь', 0, null) ;

CALL ImportField(160101043, 'Декабрь', 'MONTH12', 'Декабрь', ' ', 0, 1601, 1, 0, 'ОбязДекабрь', 0, null) ;

CALL ImportField(160101044, 'Суб КЭСР', 'SubKESR', 'Суб КЭСР', 'SubKESR', 0, 1601, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(160101045, 'Район', 'RegionCls', 'Район', 'RegionCls', 0, 1601, 1, 0, 'Регион', 0, null) ;

CALL ImportField(160101053, 'Тип документа', 'DocType', 'Тип документа', ' ', 0, 1601, 1, 0, 'ТипДокумента', 0, null) ;

CALL ImportField(160101054, 'Дата уточнения', 'CloseDate', 'Дата уточнения', 'CloseDate', 0, 1601, 1, 1, 'ДатаУточнения', 0, null) ;

CALL ImportField(160101055, '№ уточнения', 'Child_Promise', '№ уточнения', 'Child_Promise', 0, 1601, 1, 1, 'НомерУточняющегоБО', 0, null) ;

CALL ImportField(160101061, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 1601, 1, 1, '', 0, null) ;

CALL ImportField(160101062, 'Код записи', 'ID', 'Код записи', 'ID', 0, 1601, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(160101064, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', ' ', 0, 1601, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(160101065, 'Первый год', 'SUMMAYEAR1', 'Первый год', ' ', 0, 1601, 1, 1, 'ОбязНаПервыйГод', 0, null) ;

CALL ImportField(160101066, 'Второй плановый год', 'SUMMAYEAR2', 'Второй плановый год', ' ', 0, 1601, 1, 0, 'ОбязНаВторойГод', 0, null) ;

CALL ImportField(160101067, 'Третий плановый год', 'SUMMAYEAR3', 'Третий плановый год', ' ', 0, 1601, 1, 0, 'ОбязНаТретийГод', 0, null) ;

CALL ImportField(160101074, 'КЦСР(Классификация)', 'KCSRCode', '', 'KCSR', 0, 1601, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(160101075, 'КВР(Классификация)', 'KVRCode', '', 'KVR', 0, 1601, 1, 0, 'КВР', 0, null) ;

CALL ImportField(160101076, 'КВСР(Классификация)', 'KVSRCode', '', 'KVSR', 0, 1601, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(160101077, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 0, 1601, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(160101078, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 0, 1601, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(160101083, 'Код цели', 'TargetCls', '', ' ', 0, 1601, 1, 1, '', 0, null) ;

CALL ImportField(160101089, 'Ссылка на заголовок', 'Title_Ref', 'Ссылка на заголовок', 'RECORDINDEX', 0, 1601, 1, 1, '', 0, null) ;

CALL ImportField(160101094, 'Ид. в БД Бюджета', 'FUID', 'Ид. в БД Бюджета', 'FUID', 0, 1601, 1, 1, '', 0, null) ;

CALL ImportField(160101095, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 1601, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(160101096, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 0, 1601, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(160101097, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 0, 1601, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(160101098, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 0, 1601, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(160101099, 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', '', ' ', 0, 1601, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(160101100, 'Код расходного обязательства (ключ)', 'PayPromiseCls', '', ' ', 0, 1601, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

-- Бюджетные обязательства, Бюджет(1)
CALL ImportField(160110001, '№ Внутреннего учета', 'NUMBER', '№ Внутреннего учета', 'Number', 1, 1601, 0, 0, 'УчетныйНомер', 0, null) ;

CALL ImportField(160110002, 'Дата принятия/отклонения', 'ACCEPTDATE', 'Дата принятия/отклонения', 'ACCEPTDATE', 1, 1601, 0, 0, 'ДатаПринятия', 0, 17586) ;

CALL ImportField(160110003, 'Принят/Отклонен', 'ACCEPTED_REVERTED', 'Принят/Отклонен', 'ACCEPTED_REVERTED', 1, 1601, 0, 0, 'ПринятыеНепринятые', 0, 17587) ;

CALL ImportField(160110004, 'Тип документа', 'AGREEMENT_TYPE', 'Тип документа', 'Agreement_Type', 1, 1601, 0, 0, 'ТипОбязательства', 0, 17592) ;

CALL ImportField(160110005, '№ Договора', 'AGREEMENT_NUM', '№ Договора', 'Agreement_Num', 1, 1601, 0, 0, 'НомерДокумента', 0, 17588) ;

CALL ImportField(160110006, 'Дата договора', 'AGREEMENT_DATE', 'Дата договора', 'Agreement_Date', 1, 1601, 0, 0, 'ДатаДокумента', 0, 17589) ;

CALL ImportField(160110007, 'Дата завершения договора', 'AGREEMENT_END', 'Дата завершения договора', 'Agreement_End', 1, 1601, 0, 0, 'ДатаЗавершения', 0, 17590) ;

CALL ImportField(160110008, 'Краткое содержание договора', 'AGREEMENT_NOTE', 'Краткое содержание договора', 'Agreement_Note', 1, 1601, 0, 0, 'Примечание,СодержаниеДоговора', 0, 17591) ;

CALL ImportField(160110009, 'Наименование(Поставщик услуг)', 'SUP_NAME', 'Наименование', ' ', 1, 1601, 0, 0, '', 0, 16646) ;

CALL ImportField(160110010, 'ИНН(Поставщик услуг)', 'SUP_INN', 'ИНН', ' ', 1, 1601, 0, 0, '', 0, 16645) ;

CALL ImportField(160110011, 'КПП(Поставщик услуг)', 'SUP_INN20', 'КПП', ' ', 1, 1601, 0, 0, '', 0, 16653) ;

CALL ImportField(160110012, 'Сумма договора', 'Agreement_Summa', 'Сумма договора', 'Agreement_Summa', 1, 1601, 0, 0, 'ОбязСуммаДоговора', 0, 17593) ;

CALL ImportField(160110013, 'Сумма на год', 'TOTALSUMM', 'Сумма на год', 'TotalSumm', 1, 1601, 0, 0, 'ОбязОбщаяСуммаЗаПериод', 0, 17596) ;

CALL ImportField(160110014, 'Наименование(Бюджетное учреждение)', 'B_NAME', 'Наименование', ' ', 1, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160110015, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'FacialAccCls', 1, 1601, 0, 0, 'ЛСЗаголовка', 0, 17598) ;

CALL ImportField(160110016, 'Номер заявки', 'BidNumber', 'Номер заявки', ' ', 1, 1601, 0, 0, 'НомерЗаявки', 0, 17614) ;

CALL ImportField(160110046, 'Условия поставки', 'DELIVERY_RULES', 'Условия поставки', 'Delivery_Rules', 1, 1601, 0, 0, 'УсловиеПоставки', 0, 17595) ;

CALL ImportField(160110047, 'КПП(Бюджетное учреждение)', 'B_INN20', 'КПП', ' ', 1, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160110048, 'ИНН(Бюджетное учреждение)', 'B_INN', 'ИНН', ' ', 1, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160110049, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 1601, 0, 0, 'КодБюджета', 0, 17599) ;

CALL ImportField(160110050, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 1601, 0, 0, 'ПричинаОтклонТекст', 0, 17605) ;

CALL ImportField(160110051, 'Причина отклонения', 'Reject_Cls', 'Причина отклонения', 'Reject_Cls', 1, 1601, 0, 0, 'ПричинаОтклонКод', 0, 17604) ;

CALL ImportField(160110056, 'Поставщик услуг', 'Supplier', 'Поставщик услуг', ' ', 1, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160110057, 'Бюджетное учреждение', 'BudgOrg', 'Бюджетное учреждение', ' ', 1, 1601, 0, 0, '', 0, null) ;

CALL ImportField(160110058, 'Учреждение', 'BUDGETORG_REF', 'Бюджетное учреждение', 'BudgetOrg_Ref', 1, 1601, 0, 1, 'БюджетнаяОрганизация', 0, 17597) ;

CALL ImportField(160110059, 'Код документа', 'ID', 'Код документа', 'ID', 1, 1601, 0, 1, 'КодДокумента', 0, 17584) ;

CALL ImportField(160110060, 'Поставщик услуг', 'SUPPLIER_REF', 'Поставщик услуг', 'Supplier_Ref', 1, 1601, 0, 1, 'ОрганизацияПоставщик', 0, 17594) ;

CALL ImportField(160110063, 'CryptoStatus', 'CryptoStatus', 'CryptoStatus', ' ', 1, 1601, 0, 1, '', 0, 17606) ;

CALL ImportField(160110068, 'Номер БО', 'Promise_Number', 'Номер БО', ' ', 1, 1601, 0, 1, '', 0, null) ;

CALL ImportField(160110069, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderID', 1, 1601, 0, 1, 'КодОтправителяДокумента', 0, 17607) ;

CALL ImportField(160110070, 'Номер БО в казначействе', 'SourcePromise', 'Номер БО в казначействе', ' ', 1, 1601, 0, 0, 'НомерБоКазн', 0, null) ;

CALL ImportField(160110071, 'Счет(Поставщик услуг)', 'Acc', 'Счет(Поставщик услуг)', ' ', 1, 1601, 0, 0, '', 0, 17112) ;

CALL ImportField(160110080, 'Р/с поставщика', 'SUPPLIER_ACC_REF', 'Расчетный счет поставщика', ' ', 1, 1601, 0, 0, 'РСчетПоставщика', 0, null) ;

CALL ImportField(160110081, 'Р/с поставщика', 'Acc_Ref', 'Р/с поставщика', ' ', 1, 1601, 0, 1, 'СчетПоставщик', 0, 25479) ;

CALL ImportField(160110082, 'DocStateRef', 'DocStateRef', '', 'DocStateRef', 1, 1601, 0, 1, 'СостояниеДокумента', 0, 17612) ;

CALL ImportField(160110099, 'Сумма аванса', 'AdvanceSumma', 'Сумма авансового платежа', 'AdvanceSumma', 1, 1601, 0, 0, 'ОбязСуммаАванса', 0, 27858) ;

CALL ImportField(160110100, '№ сведения', 'InfoNumber', 'Номер сведения', 'InfoNumber', 1, 1601, 0, 0, 'НомерСведения', 0, 27859) ;

CALL ImportField(160111017, '№ Уточняемого обязательства', 'PARENT_PROMISE', '№ Уточняемого обязательства', 'PARENT_PROMISE', 1, 1601, 1, 0, 'НомерУточняемогоБО', 0, 19019) ;

CALL ImportField(160111018, '№ Обязательства', 'REGISTRNUMBER', '№ Обязательства', 'REGISTRNUMBER', 1, 1601, 1, 0, 'БюджОбяз', 0, 19034) ;

CALL ImportField(160111019, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'FacialAccCls', 1, 1601, 1, 0, 'ЛицевойСчет', 0, 19026) ;

CALL ImportField(160111020, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 1601, 1, 0, '', 0, null) ;

CALL ImportField(160111021, 'КВСРКлюч', 'KVSR', 'КВСР', 'KVSRKey', 1, 1601, 1, 1, 'КВСРКлюч', 0, 19021) ;

CALL ImportField(160111022, 'ФКР(Классификация)', 'KFSR', 'КФСР', 'KFSR', 1, 1601, 1, 0, 'КФСР', 0, 19020) ;

CALL ImportField(160111023, 'КЦСРКлюч', 'KCSR', 'КЦСР', 'KCSRKey', 1, 1601, 1, 1, 'КЦСРКлюч', 0, 19022) ;

CALL ImportField(160111024, 'КВРКлюч', 'KVR', 'КВР', 'KVRKey', 1, 1601, 1, 1, 'КВРКлюч', 0, 19023) ;

CALL ImportField(160111025, 'ЭКР(Классификация)', 'KESR', 'КЭСР', 'KESR', 1, 1601, 1, 0, 'КЭСР', 0, 19024) ;

CALL ImportField(160111027, 'Тип средств', 'MeansType', 'Тип средств', 'MeansTypeCls', 1, 1601, 1, 0, 'ТипСредств', 0, 19027) ;

CALL ImportField(160111029, 'Источник финансирования', 'FinSource', 'Источник финансирования', 'FinSourceCls', 1, 1601, 1, 0, 'ИсточникФинансирования', 0, 19030) ;

CALL ImportField(160111030, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 1601, 1, 0, 'БухОперация', 0, 19058) ;

CALL ImportField(160111031, 'Сумма бюджетных обязательств за год', 'SUMMA', 'Сумма', 'SUMMA', 1, 1601, 1, 1, 'ОбязСуммаНаГод', 0, 19033) ;

CALL ImportField(160111032, 'Январь', 'MONTH01', 'Январь', 'Month01', 1, 1601, 1, 0, 'ОбязЯнварь', 0, 19037) ;

CALL ImportField(160111033, 'Февраль', 'MONTH02', 'Февраль', 'Month02', 1, 1601, 1, 0, 'ОбязФевраль', 0, 19038) ;

CALL ImportField(160111034, 'Март', 'MONTH03', 'Март', 'Month03', 1, 1601, 1, 0, 'ОбязМарт', 0, 19039) ;

CALL ImportField(160111035, 'Апрель', 'MONTH04', 'Апрель', 'Month04', 1, 1601, 1, 0, 'ОбязАпрель', 0, 19040) ;

CALL ImportField(160111036, 'Май', 'MONTH05', 'Май', 'Month05', 1, 1601, 1, 0, 'ОбязМай', 0, 19041) ;

CALL ImportField(160111037, 'Июнь', 'MONTH06', 'Июнь', 'Month06', 1, 1601, 1, 0, 'ОбязИюнь', 0, 19042) ;

CALL ImportField(160111038, 'Июль', 'MONTH07', 'Июль', 'Month07', 1, 1601, 1, 0, 'ОбязИюль', 0, 19043) ;

CALL ImportField(160111039, 'Август', 'MONTH08', 'Август', 'Month08', 1, 1601, 1, 0, 'ОбязАвгуст', 0, 19044) ;

CALL ImportField(160111040, 'Сентябрь', 'MONTH09', 'Сентябрь', 'Month09', 1, 1601, 1, 0, 'ОбязСентябрь', 0, 19045) ;

CALL ImportField(160111041, 'Октябрь', 'MONTH10', 'Октябрь', 'Month10', 1, 1601, 1, 0, 'ОбязОктябрь', 0, 19046) ;

CALL ImportField(160111042, 'Ноябрь', 'MONTH11', 'Ноябрь', 'Month11', 1, 1601, 1, 0, 'ОбязНоябрь', 0, 19047) ;

CALL ImportField(160111043, 'Декабрь', 'MONTH12', 'Декабрь', 'Month12', 1, 1601, 1, 0, 'ОбязДекабрь', 0, 19048) ;

CALL ImportField(160111044, 'Суб КЭСР', 'SubKESR', 'Суб КЭСР', 'SubKESR', 1, 1601, 1, 0, 'СубКЭСР', 0, 19031) ;

CALL ImportField(160111053, 'Тип документа', 'DocType', 'Тип документа', 'DocTypeCls', 1, 1601, 1, 0, 'ТипДокумента', 0, 19028) ;

CALL ImportField(160111054, 'Дата уточнения', 'CloseDate', 'Дата уточнения', 'CloseDate', 1, 1601, 1, 1, 'ДатаУточнения', 0, 19035) ;

CALL ImportField(160111055, '№ уточнения', 'Child_Promise', '№ уточнения', 'Child_Promise', 1, 1601, 1, 1, 'НомерУточняющегоБО', 0, 19036) ;

CALL ImportField(160111061, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 1601, 1, 1, '', 0, 19049) ;

CALL ImportField(160111062, 'Код записи', 'ID', 'Код записи', 'ID', 1, 1601, 1, 1, 'КодЗаписи', 0, 19017) ;

CALL ImportField(160111064, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'AssignmentKind', 1, 1601, 1, 0, 'ВидАссигнований', 0, 19078) ;

CALL ImportField(160111065, 'Первый год', 'SUMMAYEAR1', 'Первый год', 'SummaYear1', 1, 1601, 1, 1, 'ОбязНаПервыйГод', 0, 19072) ;

CALL ImportField(160111066, 'Второй плановый год', 'SUMMAYEAR2', 'Второй плановый год', 'SummaYear2', 1, 1601, 1, 0, 'ОбязНаВторойГод', 0, 19073) ;

CALL ImportField(160111067, 'Третий плановый год', 'SUMMAYEAR3', 'Третий плановый год', 'SummaYear3', 1, 1601, 1, 0, 'ОбязНаТретийГод', 0, 19074) ;

CALL ImportField(160111071, 'Наличие платёжки по БО', 'ExistPayment', 'Наличие платёжки по БО', ' ', 1, 1601, 1, 0, '', 0, null) ;

CALL ImportField(160111072, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 1601, 1, 1, 'КодЦелевыхСредствКлюч', 0, 25480) ;

CALL ImportField(160111078, 'Код субсидийКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 1601, 1, 1, 'КодСубсидииКлюч', 0, 27705) ;

CALL ImportField(160111080, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 1601, 1, 0, '', 0, 26617) ;

CALL ImportField(160111081, 'л/с в ФК', 'FCAccountName', '', ' ', 1, 1601, 1, 0, '', 0, 17112) ;

CALL ImportField(160111083, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 1601, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27860) ;

CALL ImportField(160111084, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayPromiseCls', 1, 1601, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27861) ;

-- БО.Обязательства - линейно, УРМ(0)
CALL ImportField(160200038, 'Код целевых средств(Ключ)', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 0, 1602, 0, 0, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(160200039, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 0, 1602, 0, 0, '', 0, null) ;

-- БО.Обязательства - линейно, Бюджет(1)
CALL ImportField(160210001, '№ Обязательства', 'REGISTRNUMBER', '№ Обязательства', ' ', 1, 1602, 0, 0, 'БюджОбяз', 0, 19034) ;

CALL ImportField(160210002, '№ Уточняемого обязательства', 'PARENT_PROMISE', '№ Уточняемого обязательства', ' ', 1, 1602, 0, 0, 'НомерУточняемогоБО', 0, 19019) ;

CALL ImportField(160210003, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', ' ', 1, 1602, 0, 0, 'ЛицевойСчет', 0, 19026) ;

CALL ImportField(160210004, '№ Внутреннего учета', 'NUMBER', '№ Внутреннего учета', ' ', 1, 1602, 0, 0, 'УчетныйНомер', 0, null) ;

CALL ImportField(160210005, 'Дата принятия/отклонения', 'ACCEPTDATE', 'Дата принятия/отклонения', ' ', 1, 1602, 0, 0, 'ДатаПринятия', 0, 17586) ;

CALL ImportField(160210006, '№ Договора', 'AGREEMENT_NUM', '№ Договора', ' ', 1, 1602, 0, 0, 'НомерДокумента', 0, 17588) ;

CALL ImportField(160210007, 'Дата договора', 'AGREEMENT_DATE', 'Дата договора', ' ', 1, 1602, 0, 0, 'ДатаДокумента', 0, 17589) ;

CALL ImportField(160210008, 'Тип документа', 'AGREEMENT_TYPE', 'Тип документа', ' ', 1, 1602, 0, 0, 'ТипОбязательства', 0, 17592) ;

CALL ImportField(160210009, 'Дата завершения договора', 'AGREEMENT_END', 'Дата завершения договора', ' ', 1, 1602, 0, 0, 'ДатаЗавершения', 0, 17590) ;

CALL ImportField(160210010, 'Краткое содержание договора', 'AGREEMENT_NOTE', 'Краткое содержание договора', ' ', 1, 1602, 0, 0, 'Примечание', 0, 17591) ;

CALL ImportField(160210011, 'ФКР', 'KFSR', 'КФСР', ' ', 1, 1602, 0, 0, 'КФСР', 0, 19020) ;

CALL ImportField(160210012, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 1602, 0, 1, 'КВСРКлюч', 0, 19021) ;

CALL ImportField(160210013, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 1602, 0, 1, 'КЦСРКлюч', 0, 19022) ;

CALL ImportField(160210014, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 1602, 0, 1, 'КВРКлюч', 0, 19023) ;

CALL ImportField(160210015, 'ЭКР', 'KESR', 'КЭСР', ' ', 1, 1602, 0, 0, 'КЭСР', 0, 19024) ;

CALL ImportField(160210018, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 1602, 0, 0, 'БухОперация', 0, 19058) ;

CALL ImportField(160210019, 'Дата уточнения', 'CloseDate', 'Дата уточнения', ' ', 1, 1602, 0, 0, 'ДатаУточнения', 0, 19035) ;

CALL ImportField(160210020, '№ уточнения', 'Child_Promise', '№ уточнения', ' ', 1, 1602, 0, 0, 'НомерУточняющегоБО', 0, 19036) ;

CALL ImportField(160210021, 'Район', 'RegionCls', 'Район', ' ', 1, 1602, 0, 0, 'РайонТрансферта', 0, 19032) ;

CALL ImportField(160210022, 'Суб КЭСР', 'SubKESR', 'Суб КЭСР', ' ', 1, 1602, 0, 0, 'СубКЭСР', 0, 19031) ;

CALL ImportField(160210024, 'Источник финансирования', 'FinSource', 'Источник финансирования', ' ', 1, 1602, 0, 0, 'ИсточникФинансирования', 0, 19030) ;

CALL ImportField(160210026, 'Тип документа', 'DocType', 'Тип документа', ' ', 1, 1602, 0, 0, 'ТипДокумента', 0, 19028) ;

CALL ImportField(160210027, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 1602, 0, 0, 'ТипСредств', 0, 19027) ;

CALL ImportField(160210028, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 1602, 0, 0, 'КодБюджета', 0, 19049) ;

CALL ImportField(160210029, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', ' ', 1, 1602, 0, 0, 'ВидАссигнований', 0, 19078) ;

CALL ImportField(160210030, 'Первый год', 'SUMMAYEAR1', 'Первый год', ' ', 1, 1602, 0, 1, 'ОбязНаПервыйГод', 0, 19072) ;

CALL ImportField(160210033, 'Код целевых средств(Ключ)', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 1, 1602, 0, 0, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(160210038, 'Сумма аванса', 'AdvanceSumma', '', ' ', 1, 1602, 0, 0, 'ОбязСуммаАванса', 0, 27858) ;

CALL ImportField(160210040, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 1602, 0, 0, '', 0, 26617) ;

CALL ImportField(160210041, 'л/с в ФК', 'FCAccountName', '', ' ', 1, 1602, 0, 0, '', 0, 17112) ;

CALL ImportField(160210042, '№ сведения', 'InfoNumber', '', ' ', 1, 1602, 0, 0, 'НомерСведения', 0, 27859) ;

-- Заявки, Бюджет(1)
CALL ImportField(170110001, 'Начальное состояние документа', ' ', 'Начальное состояние документа', 'BEGINDOCSTATEREF', 1, 1701, 0, 1, '', 1, null) ;

CALL ImportField(170110002, 'Вид учета (старый)', 'BuhPaymentCls', 'Бух операция', 'BuhPaymentCls', 1, 1701, 0, 0, 'БухПроводка', 0, 19143) ;

CALL ImportField(170110003, 'Дата создания(Авторизация)', 'CREATEDATE', 'Дата и время создания', ' ', 1, 1701, 0, 1, 'ДатаВремяСоздания', 0, 19153) ;

CALL ImportField(170110004, 'Автор(Авторизация)', 'CREATERUSER', 'Автор', ' ', 1, 1701, 0, 1, 'Автор', 0, 19152) ;

CALL ImportField(170110005, 'Ссылка на счет получателя', 'DESTACCOUNT', 'Ссылка на счет получателя', 'DESTACCOUNT', 1, 1701, 0, 1, 'СчетПолуч', 0, 19138) ;

CALL ImportField(170110006, 'Счет ФО', 'dfAccName', 'Имя РСФО', 'dfAccName', 1, 1701, 0, 0, '', 0, 17112) ;

CALL ImportField(170110007, 'Счет ФО', 'DFACCOUNT', 'Ссылка на РСФО', 'DFACCOUNT', 1, 1701, 0, 1, 'РСФО', 0, 19159) ;

CALL ImportField(170110009, 'СостояниеДокумента', 'DOCSTATEREF', 'Состояние документа', 'DOCSTATEREF', 1, 1701, 0, 1, 'СостояниеДокумента', 0, 19175) ;

CALL ImportField(170110010, 'Вид документа', 'DOCTYPE', 'Тип документа', 'DOCTYPE', 1, 1701, 0, 0, 'ТипДокумента', 0, 19144) ;

CALL ImportField(170110012, 'Р/С получателя(Получатель)', 'DstACC', 'Счет Получателя', ' ', 1, 1701, 0, 0, '', 0, 17112) ;

CALL ImportField(170110013, 'ИНН получателя(Получатель)', 'DstINN', 'ИНН Получателя', ' ', 1, 1701, 0, 0, '', 0, 16645) ;

CALL ImportField(170110014, 'КПП получателя(Получатель)', 'DstKPP', 'КПП Получателя', ' ', 1, 1701, 0, 0, '', 0, 16653) ;

CALL ImportField(170110015, 'Получатель', 'DstNameAndAcc', 'Получатель', ' ', 1, 1701, 0, 0, '', 0, null) ;

CALL ImportField(170110016, 'Имя получателя(Получатель)', 'DstOrgName', 'Имя Получателя', ' ', 1, 1701, 0, 0, '', 0, 16646) ;

CALL ImportField(170110017, 'Лицевой счет', 'FACIALACC_CLS', 'ЛицевойСчет', 'FACIALACC_CLS', 1, 1701, 0, 0, 'ЛицевойСчет', 0, 19136) ;

CALL ImportField(170110019, 'Реестр федеральных средств', 'FEDERALFUNDSName', 'Федеральные средства', ' ', 1, 1701, 0, 0, '', 0, null) ;

CALL ImportField(170110020, 'Источник финансирования', 'FINSOURCE', 'ИсточникФинансирования', 'FINSOURCE', 1, 1701, 0, 0, 'ИсточникФинансирования', 0, 19140) ;

CALL ImportField(170110022, 'Код документа', 'ID', 'Код документа', 'ID', 1, 1701, 0, 1, 'КодДокумента', 0, 19124) ;

CALL ImportField(170110026, 'Дата ввода', 'INPUTDATE', 'Дата ввода', 'INPUTDATE', 1, 1701, 0, 0, 'ДатаВвода', 0, 19158) ;

CALL ImportField(170110027, 'КЦСРКлюч', 'KCSR', 'КЦСР', 'KCSRKey', 1, 1701, 0, 1, 'КЦСРКлюч', 0, 19129) ;

CALL ImportField(170110029, 'КЭСР(Классификация)', 'KESR', 'КЭСР', 'KESR', 1, 1701, 0, 0, 'КЭСР', 0, 19131) ;

CALL ImportField(170110030, 'КФСР(Классификация)', 'KFSR', 'КФСР', 'KFSR', 1, 1701, 0, 0, 'КФСР', 0, 19127) ;

CALL ImportField(170110031, 'КВРКлюч', 'KVR', 'КВР', 'KVRKey', 1, 1701, 0, 1, 'КВРКлюч', 0, 19130) ;

CALL ImportField(170110032, 'КВСРКлюч', 'KVSR', 'КВСР', 'KVSRKey', 1, 1701, 0, 1, 'КВСРКлюч', 0, 19128) ;

CALL ImportField(170110033, 'Тип средств', 'MEANSTYPE', 'Тип средств', 'MEANSTYPE', 1, 1701, 0, 0, 'ТипСредств', 0, 19150) ;

CALL ImportField(170110034, 'Месяц', 'MONTH', 'Месяц', 'MONTH', 1, 1701, 0, 0, 'Месяц', 0, null) ;

CALL ImportField(170110035, 'Номер', 'NUMBER', 'Номер документа', 'NUMBER', 1, 1701, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(170110037, 'Срок платежа', 'PayDate', 'Срок платежа', 'PayDate', 1, 1701, 0, 0, 'СрокПлатежа', 0, 19145) ;

CALL ImportField(170110038, 'Очередность платежа', 'PayPriority', 'Очередность', 'PayPriority', 1, 1701, 0, 0, 'Очередность', 0, 19146) ;

CALL ImportField(170110039, 'Кассовый символ', 'PaySymbolCls', 'Кассовый символ', 'PaySymbolCls', 1, 1701, 0, 0, 'КассовыйСимвол', 0, 19151) ;

CALL ImportField(170110040, '№ бюджетного обязательства', 'Promise', 'Номер бюджетного обязательства', 'Promise', 1, 1701, 0, 0, 'БюджОбяз', 0, 19156) ;

CALL ImportField(170110041, 'Район', 'REGIONCLS', 'Регион', 'REGIONCLS', 1, 1701, 0, 0, 'Регион', 0, 19142) ;

CALL ImportField(170110043, 'Р/С распорядителя(Распорядитель)', 'SrcAcc', 'Ссылка на счет распорядителя', ' ', 1, 1701, 0, 0, '', 0, null) ;

CALL ImportField(170110044, 'ИНН распорядителя(Распорядитель)', 'SrcInn', 'ИНН Распорядителя', ' ', 1, 1701, 0, 0, '', 0, null) ;

CALL ImportField(170110045, 'КПП распорядителя(Распорядитель)', 'SrcKPP', 'КПП Распорядителя', ' ', 1, 1701, 0, 0, '', 0, null) ;

CALL ImportField(170110046, 'Распорядитель', 'SrcNameAndAcc', 'Распорядитель', ' ', 1, 1701, 0, 0, '', 0, null) ;

CALL ImportField(170110047, 'Имя распорядителя(Распорядитель)', 'SrcOrgName', 'Имя распорядителя', ' ', 1, 1701, 0, 0, '', 0, null) ;

CALL ImportField(170110048, 'Суб. код дохода', 'SUBKD', 'СубКД', 'SUBKD', 1, 1701, 0, 0, 'СубКД', 0, 19166) ;

CALL ImportField(170110049, 'Суб КЭСР', 'SUBKESR', 'СубКЭСР', 'SUBKESR', 1, 1701, 0, 0, 'СубКЭСР', 0, 19132) ;

CALL ImportField(170110050, 'Сумма заявки', 'SUMMAREQUESTED', 'Сумма заявки', 'SUMMAREQUESTED', 1, 1701, 0, 0, '', 0, 19147) ;

CALL ImportField(170110051, 'Сумма к исполнению', 'SUMMATOFINANCE', 'Сумма к исполнению', 'SUMMATOFINANCE', 1, 1701, 0, 0, '', 0, 19148) ;

CALL ImportField(170110052, 'Информация о налоговом платеже', 'TaxNote', 'Информация о налоге', 'TaxNote', 1, 1701, 0, 0, 'ИнформацияОНалоге', 0, 19171) ;

CALL ImportField(170110053, 'Классификация', 'TreeOwner0', 'Классификация(группа)', ' ', 1, 1701, 0, 0, '', 0, null) ;

CALL ImportField(170110054, 'Дата и время изменения', 'UPDATEDATE', 'Дата и время изменения', ' ', 1, 1701, 0, 1, '', 0, null) ;

CALL ImportField(170110055, 'Примечание', 'USERNOTE', 'Примечание', 'USERNOTE', 1, 1701, 0, 0, 'Примечание', 0, 19135) ;

CALL ImportField(170110056, 'Год', 'YEAR', 'Год', 'YEAR', 1, 1701, 0, 0, 'Год', 0, null) ;

CALL ImportField(170110057, 'Операция', 'BuhOperationCls', 'Операция', 'BuhOperationCls', 1, 1701, 0, 0, 'БухОперация', 0, 19178) ;

CALL ImportField(170110058, 'Бюджет', 'BUDGET', 'Бюджет', 'BUDGETREF', 1, 1701, 0, 0, 'КодБюджета', 0, 19126) ;

CALL ImportField(170110060, 'Вид источника(Классификация)', 'FSDescriptionCode', 'Вид источника(ИВнФ)', ' ', 1, 1701, 0, 0, '', 0, 17050) ;

CALL ImportField(170110061, 'ЭКИ(Классификация)', 'FSKESR', 'ЭКИ', ' ', 1, 1701, 0, 0, '', 0, 17054) ;

CALL ImportField(170110063, 'Вид дохода(Код дохода)', 'KDDescriptionCode', 'Вид дохода(КД)', ' ', 1, 1701, 0, 0, '', 0, 16831) ;

CALL ImportField(170110064, 'Программа(Код дохода)', 'KDProgram', 'Программа(КД)', ' ', 1, 1701, 0, 0, '', 0, 16834) ;

CALL ImportField(170110065, 'ЭКД(Код дохода)', 'KDKESR', 'ЭКД', ' ', 1, 1701, 0, 0, '', 0, 16835) ;

CALL ImportField(170110066, 'Состояние', 'RequestsDocState', 'Состояние', 'REQUESTSDOCSTATE', 1, 1701, 0, 0, 'СостояниеЗаявки', 0, 19170) ;

CALL ImportField(170110067, 'Тип классификации', 'ClsType', 'Тип классификации', 'CLSTYPE', 1, 1701, 0, 0, 'ТипКлассификации', 0, 19180) ;

CALL ImportField(170110068, 'Тип исполнения заявки', 'ProgIndex2', 'Тип исполнения заявки', 'ProgIndex2', 1, 1701, 0, 0, 'НовыйСпособИсполнения', 0, 19161) ;

CALL ImportField(170110069, 'Плановая дата', 'PLANDATE', 'Плановая дата', 'PLANDATE', 1, 1701, 0, 0, 'ПлановаяДата', 0, 19167) ;

CALL ImportField(170110071, 'Дата реестра', 'ReestrDate', 'Дата реестра', 'REESTRDATE', 1, 1701, 0, 0, 'ДатаРеестра', 0, 19181) ;

CALL ImportField(170110072, 'Лицевой счет в ФК', 'FACIALCODE', 'Лицевой счет в ФК', ' ', 1, 1701, 0, 0, '', 0, 17149) ;

CALL ImportField(170110073, 'ИндексЗаявки', 'RecordIndex', 'ИндексЗаявки', 'RecordIndex', 1, 1701, 0, 1, 'ИндексЗаявки', 0, 19162) ;

CALL ImportField(170110074, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 1701, 0, 1, 'ИндексыДанных', 0, 19160) ;

CALL ImportField(170110075, 'Источниковая классификация', 'FinSourceMaster', 'Источниковая классификация', 'INNERFINSOURCE', 1, 1701, 0, 1, 'ИсточникВнутрФинансированияКлюч', 0, 19163) ;

CALL ImportField(170110076, 'КД', 'KDMaster', 'КД', 'KD', 1, 1701, 0, 1, 'КДКлюч', 0, 19165) ;

CALL ImportField(170110077, 'Тип валюты', 'CurrencyCls', 'Тип валюты', 'CurrencyCLS', 1, 1701, 0, 1, 'КодВалюты', 0, 19168) ;

CALL ImportField(170110078, 'Федеральные cредства', 'FederalFundsRef', 'Федеральные cредства', 'federalFundsRef', 1, 1701, 0, 1, 'ФедеральныеСредства', 0, 19177) ;

CALL ImportField(170110079, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 1701, 0, 1, 'КриптоСтатус', 0, 19176) ;

CALL ImportField(170110085, 'Код субсидииКлюч', 'SubsidyCls', '', 'SUBSIDYCLSKEY', 1, 1701, 0, 1, 'КодСубсидииКлюч', 0, 27706) ;

CALL ImportField(170110087, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCLS', '', 'BudAllocationCLSKey', 1, 1701, 0, 1, 'КодБюджАссигнованияКлюч', 0, 29948) ;

CALL ImportField(170110089, 'Код расходного обязательстваКлюч', 'PayPromiseCLS', '', 'PayPromiseCLSKey', 1, 1701, 0, 1, 'КодРасходногоОбязательстваКлюч', 0, 29949) ;

CALL ImportField(170110090, 'Код целевых средствКлюч', 'TransfertCLS', '', 'TransfertCLSKey', 1, 1701, 0, 1, 'КодЦелевыхСредствКлюч', 0, 29950) ;

CALL ImportField(170111070, 'Сумма', 'Summa', 'Сумма', ' ', 1, 1701, 1, 0, '', 0, null) ;

CALL ImportField(170111080, 'RECORDINDEX', 'RECORDINDEX', 'Ссылка на заголовок', 'RECORDINDEX', 1, 1701, 1, 1, 'КодДокумента', 0, null) ;

-- Заявки(старые), Бюджет(1)
CALL ImportField(170210001, 'Лицевой счет в ФК', 'FACIALCODE', 'Лицевой счет в ФК', ' ', 1, 1702, 0, 0, '', 0, 17149) ;

CALL ImportField(170210002, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 1702, 0, 0, '', 0, null) ;

CALL ImportField(170210003, 'Распорядитель (министерство)', 'SrcOrgName', 'Плательщик', ' ', 1, 1702, 0, 0, '', 0, 16646) ;

CALL ImportField(170210004, 'ИНН плательщика', 'SrcINN', 'ИНН плательщика', ' ', 1, 1702, 0, 0, '', 0, 16645) ;

CALL ImportField(170210005, 'КПП плательщика', 'SrcKPP', 'КПП плательщика', ' ', 1, 1702, 0, 0, '', 0, 16653) ;

CALL ImportField(170210006, 'Счет распорядителя', 'SrcAcc', 'Р/С плательщика', ' ', 1, 1702, 0, 0, '', 0, 17112) ;

CALL ImportField(170210007, 'Получатель (подведомственная)', 'DstOrgName', 'Получатель', ' ', 1, 1702, 0, 0, '', 0, 16646) ;

CALL ImportField(170210008, 'ИНН получателя', 'DstINN', 'ИНН получателя', ' ', 1, 1702, 0, 0, '', 0, 16645) ;

CALL ImportField(170210009, 'КПП получателя', 'DstKPP', 'КПП получателя', ' ', 1, 1702, 0, 0, '', 0, 16653) ;

CALL ImportField(170210010, 'Счет получателя', 'DstAcc', 'Р/С получателя', ' ', 1, 1702, 0, 0, '', 0, 17112) ;

CALL ImportField(170210011, 'Сумма заявки', 'SummaRequested', 'Сумма заявки', ' ', 1, 1702, 0, 0, '', 0, 19147) ;

CALL ImportField(170210012, 'Сумма к исполнению', 'SummaToFinance', 'Сумма к исполнению', ' ', 1, 1702, 0, 0, '', 0, 19148) ;

CALL ImportField(170210013, 'Счет ФО', 'dfAccName', 'Счет ФО', ' ', 1, 1702, 0, 0, '', 0, 17112) ;

CALL ImportField(170210014, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', ' ', 1, 1702, 0, 1, 'Автор', 0, 19152) ;

CALL ImportField(170210015, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 1702, 0, 0, 'БухОперация', 0, 19178) ;

CALL ImportField(170210016, 'Бух. операция', 'BuhPaymentCls', 'Бух. операция', ' ', 1, 1702, 0, 0, 'БухПроводка', 0, 19143) ;

CALL ImportField(170210017, '№ бюджетного обязательства', 'PROMISE', '№ бюджетного обязательства', ' ', 1, 1702, 0, 0, 'БюджОбяз', 0, 19156) ;

CALL ImportField(170210018, 'Год', 'YEAR', 'Год', ' ', 1, 1702, 0, 0, 'Год', 0, null) ;

CALL ImportField(170210019, 'Дата ввода', 'Inputdate', 'Дата ввода', ' ', 1, 1702, 0, 0, 'ДатаВвода', 0, 19158) ;

CALL ImportField(170210020, 'Индексы данных', 'ProgIndex', 'Индексы данных', ' ', 1, 1702, 0, 1, 'ИндексыДанных', 0, 19160) ;

CALL ImportField(170210021, 'Информация о налоговом платеже', 'TAXNOTE', 'Информация о налоговом платеже', ' ', 1, 1702, 0, 0, 'ИнформацияОНалоге', 0, 19171) ;

CALL ImportField(170210022, 'Источник финансирования', 'FinSource', 'Источник финансирования', ' ', 1, 1702, 0, 0, 'ИсточникФинансирования', 0, 19140) ;

CALL ImportField(170210023, 'Кассовый символ', 'PaySymbolCls', 'Кассовый символ', ' ', 1, 1702, 0, 0, 'КассовыйСимвол', 0, 19151) ;

CALL ImportField(170210024, 'КВРКлюч', 'KVR', 'КВР(Классификация)', ' ', 1, 1702, 0, 1, 'КВРКлюч', 0, 19130) ;

CALL ImportField(170210025, 'КВСРКлюч', 'KVSR', 'КВСР(Классификация)', ' ', 1, 1702, 0, 1, 'КВСРКлюч', 0, 19128) ;

CALL ImportField(170210026, 'Бюджет', 'BUDGET', 'Бюджет', ' ', 1, 1702, 0, 0, 'КодБюджета', 0, 19126) ;

CALL ImportField(170210027, 'Код документа', 'ID', 'Код документа', ' ', 1, 1702, 0, 1, 'КодДокумента', 0, 19124) ;

CALL ImportField(170210028, 'КФСР(Классификация)', 'KFSR', 'КФСР(Классификация)', ' ', 1, 1702, 0, 0, 'КФСР', 0, 19127) ;

CALL ImportField(170210029, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', ' ', 1, 1702, 0, 1, 'КЦСРКлюч', 0, 19129) ;

CALL ImportField(170210030, 'КЭСР(Классификация)', 'KESR', 'КЭСР(Классификация)', ' ', 1, 1702, 0, 0, 'КЭСР', 0, 19131) ;

CALL ImportField(170210031, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', ' ', 1, 1702, 0, 0, 'ЛицевойСчет', 0, 19136) ;

CALL ImportField(170210033, 'Месяц', 'MONTH', 'Месяц', ' ', 1, 1702, 0, 0, 'Месяц', 0, null) ;

CALL ImportField(170210035, 'Номер свод. реестра', 'NUMBER', 'Номер', ' ', 1, 1702, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(170210036, 'Очередность платежа', 'PAYPRIORITY', 'Очередность платежа', ' ', 1, 1702, 0, 0, 'Очередность', 0, 19146) ;

CALL ImportField(170210037, 'Примечание', 'USERNOTE', 'Примечание', ' ', 1, 1702, 0, 0, 'Примечание', 0, 19135) ;

CALL ImportField(170210038, 'Район', 'RegionCls', 'Район', ' ', 1, 1702, 0, 0, 'Регион', 0, 19142) ;

CALL ImportField(170210039, 'Счет ФО', 'dfAccount', 'Счет ФО', ' ', 1, 1702, 0, 1, 'РСФО', 0, 19159) ;

CALL ImportField(170210040, 'Состояние', 'RequestsDocState', 'Состояние', ' ', 1, 1702, 0, 0, 'СостояниеЗаявки', 0, 19170) ;

CALL ImportField(170210041, 'Способ исполнения', 'RequestType', 'Способ исполнения', ' ', 1, 1702, 0, 0, 'СпособИсполнения', 0, 19149) ;

CALL ImportField(170210042, 'Срок платежа', 'PayDate', 'Срок платежа', ' ', 1, 1702, 0, 0, 'СрокПлатежа', 0, 19145) ;

CALL ImportField(170210043, 'СубКЭСР', 'SubKESR', 'СубКЭСР', ' ', 1, 1702, 0, 0, 'СубКЭСР', 0, 19132) ;

CALL ImportField(170210044, 'Тип документа-основания', 'DocumentBaseType', 'Тип документа-основания', ' ', 1, 1702, 0, 0, 'ТипДокОснования', 0, 19157) ;

CALL ImportField(170210045, 'Вид документа', 'DocType', 'Вид документа', ' ', 1, 1702, 0, 0, 'ТипДокумента', 0, 19144) ;

CALL ImportField(170210046, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 1702, 0, 0, 'ТипСредств', 0, 19150) ;

CALL ImportField(170210048, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 1702, 0, 0, 'КЦСР', 0, null) ;

CALL ImportField(170210049, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 1702, 0, 0, 'КВР', 0, null) ;

CALL ImportField(170210050, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 1702, 0, 0, 'КВСР', 0, null) ;

-- Буферный интерфейс поступлений, Бюджет(1)
CALL ImportField(180510002, 'CODBCLAS', 'CODBCLAS', 'CODBCLAS', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510003, 'CODOKATO', 'CODOKATO', 'CODOKATO', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510004, 'D_OTMET', 'D_OTMET', 'D_OTMET', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510005, 'D_PL', 'D_PL', 'D_PL', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510006, 'DAV', 'DAV', 'DAV', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510008, 'DDNAL', 'DDNAL', 'DDNAL', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510009, 'Банк(Поля получателя)', 'DestBank', 'Банк(Поля получателя)', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510011, 'Поля получателя', 'DestField', 'Поля получателя', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510013, 'DFA', 'DFA', 'DFA', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510014, 'DK', 'DK', 'DK', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510015, 'DKART', 'DKART', 'DKART', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510018, 'DPPL', 'DPPL', 'DPPL', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510019, 'DSPL', 'DSPL', 'DSPL', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510020, 'DV', 'DV', 'DV', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510021, 'DVV', 'DVV', 'DVV', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510023, 'ELNUMS', 'ELNUMS', 'ELNUMS', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510026, 'importdocref', 'importdocref', 'importdocref', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510027, 'ИНН получателя(Поля получателя)', 'INNMF', 'ИНН получателя(Поля получателя)', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510028, 'ИНН плательщика(Поля плательщика)', 'INNMFKB', 'ИНН плательщика(Поля плательщика)', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510029, 'КПП плательщика(Поля плательщика)', 'KPPA', 'КПП плательщика(Поля плательщика)', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510031, 'KR', 'KR', 'KR', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510032, 'KRKB', 'KRKB', 'KRKB', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510033, 'LS_ERR', 'LS_ERR', 'LS_ERR', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510037, 'MFFIL', 'MFFIL', 'MFFIL', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510039, 'MFKBFIL', 'MFKBFIL', 'MFKBFIL', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510040, 'N_CH_PL', 'N_CH_PL', 'N_CH_PL', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510041, 'N_PLDOK', 'N_PLDOK', 'N_PLDOK', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510042, 'NA', 'NA', 'NA', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510043, 'NALPER', 'NALPER', 'NALPER', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510044, 'NALPLAT', 'NALPLAT', 'NALPLAT', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510045, 'NAMKL', 'NAMKL', 'NAMKL', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510048, 'NDNAL', 'NDNAL', 'NDNAL', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510049, 'NKOR1', 'NKOR1', 'NKOR1', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510050, 'NKOR2', 'NKOR2', 'NKOR2', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510051, 'NKOR3', 'NKOR3', 'NKOR3', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510052, 'NKOR4', 'NKOR4', 'NKOR4', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510055, 'PAROL', 'PAROL', 'PAROL', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510058, 'PR_DOC', 'PR_DOC', 'PR_DOC', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510059, 'Очередность платежа', 'PRIOR', 'Очередность платежа', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510064, 'Sender', 'Sender', 'Sender', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510065, 'SHIFR', 'SHIFR', 'SHIFR', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510066, 'Банк(Поля плательщика)', 'SourceBank', 'Банк(Поля плательщика)', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510068, 'Поля плательщика', 'SourceField', 'Поля плательщика', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510070, 'SS', 'SS', 'SS', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510071, 'SSTATUS', 'SSTATUS', 'SSTATUS', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510073, 'SU_OST', 'SU_OST', 'SU_OST', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510074, 'SUB_ID', 'SUB_ID', 'SUB_ID', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510075, 'T_CLOCK', 'T_CLOCK', 'T_CLOCK', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510077, 'TYPNAL', 'TYPNAL', 'TYPNAL', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510082, 'Отдел', 'DepartmentCLS', 'Отдел', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510083, 'Автор', 'CreaterUser', 'Автор', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510084, 'Изменил', 'UpdaterUser', 'Изменил', ' ', 1, 1805, 0, 0, '', 0, null) ;

-- Буферный интерфейс выбытий, Бюджет(1)
CALL ImportField(181010006, 'Поля плательщика ', 'SourceField', 'Поля плательщика ', ' ', 1, 1810, 0, 0, '', 0, null) ;

CALL ImportField(181010016, 'Банк(Поля плательщика )', 'Bank', 'Банк(Поля плательщика )', ' ', 1, 1810, 0, 0, '', 0, null) ;

CALL ImportField(181010020, 'Поля получателя', 'DestField', 'Поля получателя', ' ', 1, 1810, 0, 0, '', 0, null) ;

CALL ImportField(181010028, 'Банк(Поля получателя)', 'DestBank', 'Банк(Поля получателя)', ' ', 1, 1810, 0, 0, '', 0, null) ;

CALL ImportField(181010044, 'Источник документа', 'DocSource', 'Источник документа', ' ', 1, 1810, 0, 0, '', 0, null) ;

CALL ImportField(181010046, 'Последний', 'IsLastVersion', 'Последний', ' ', 1, 1810, 0, 0, '', 0, null) ;

CALL ImportField(181010049, 'Отдел', 'DepartmentCLS', 'Отдел', ' ', 1, 1810, 0, 0, '', 0, null) ;

CALL ImportField(181010050, 'Автор', 'CreaterUser', 'Автор', ' ', 1, 1810, 0, 0, '', 0, null) ;

CALL ImportField(181010051, 'Изменил', 'UpdaterUser', 'Изменил', ' ', 1, 1810, 0, 0, '', 0, null) ;

-- Буферный интерфейс уведомлений, Бюджет(1)
CALL ImportField(181210017, 'Отдел', 'departmentcls', 'Отдел', ' ', 1, 1812, 0, 0, '', 0, null) ;

CALL ImportField(181210026, 'Автор', 'CreaterUser', 'Автор', ' ', 1, 1812, 0, 0, '', 0, null) ;

CALL ImportField(181210027, 'Изменил', 'UpdaterUser', 'Изменил', ' ', 1, 1812, 0, 0, '', 0, null) ;

CALL ImportField(181211018, 'Дата заявки', 'date_zr', 'Дата заявки', ' ', 1, 1812, 1, 0, '', 0, null) ;

-- Все плановые документы(источники), Бюджет(1)
CALL ImportField(190010001, 'Дата принятия', '{РусПоле("ДатаПринятия")}', 'Дата принятия(проведения) документа', ' ', 1, 1900, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(190010002, 'Код причины отклонения', '{РусПоле("ПричинаОтклонКод")}', 'Код причины отклонения документа', ' ', 1, 1900, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(190010003, 'Причина отклонения (комментарий)', '{РусПоле("ПричинаОтклонТекст")}', 'Причина отклонения (комментарий)', ' ', 1, 1900, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(190010004, 'Код удалённого клиента', '{РусПоле("КодОтправителяДокумента")}', 'Код удалённого клиента(отправителя документа)', ' ', 1, 1900, 0, 0, 'КодОтправителяДокумента', 0, null) ;

CALL ImportField(190010005, 'Автор документа', '{РусПоле("АвторДокумента")}', 'Автор документа', ' ', 1, 1900, 0, 0, 'АвторДокумента', 0, null) ;

CALL ImportField(190010006, 'Состояние документа', '{РусПоле("СостояниеДокумента")}', 'Состояние документа', ' ', 1, 1900, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(190010007, 'Бюджет', '{РусПоле("КодБюджета")}', 'Бюджет документа', ' ', 1, 1900, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(190010008, 'Лицевой счет(заголовок)', '{РусПоле("ЛицевойСчетЗаголовок")}', 'Лицевой счет из заголовка', ' ', 1, 1900, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(190010009, 'Код записи', '{РусПоле("КодЗаписи")}', 'Код записи', ' ', 1, 1900, 0, 0, 'КодЗаписи', 0, null) ;

CALL ImportField(190010010, 'Статус ЭЦП', '{РусПоле("КриптоСтатус")}', 'Статус ЭЦП', ' ', 1, 1900, 0, 0, 'КриптоСтатус', 0, null) ;

CALL ImportField(190010011, 'Вариант росписи', '{РусПоле("ВариантРосписи")}', 'Вариант учета планового документа', ' ', 1, 1900, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(190010012, 'Вид плана', '{РусПоле("ВидПлана")}', 'Вид плана', ' ', 1, 1900, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(190011001, 'Тип классификации', '{РусПоле("ТипКлассификации")}', 'Тип классификации', ' ', 1, 1900, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(190011002, 'Код целевых средств (ключ)', '{РусПоле("КодЦелевыхСредствКлюч")}', 'Код целевых средств (ключ)', ' ', 1, 1900, 1, 0, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(190011003, 'Лицевой счет', '{РусПоле("ЛицевойСчет")}', 'Лицевой счет из детализации', ' ', 1, 1900, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(190011013, 'Операция', '{РусПоле("БухОперация")}', 'Операция', ' ', 1, 1900, 1, 0, 'БухОперация', 0, null) ;

-- СБР (источники), УРМ(0)
CALL ImportField(190100021, 'Состояние', 'DocStateName', 'Состояние', 'DocStateName', 0, 1901, 0, 0, '', 0, null) ;

CALL ImportField(190100084, 'Код документа', 'ID', 'ID', 'Id', 0, 1901, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(190100088, 'Отнесение к БА, ЛБО', 'Ba_Lbo_Flag', 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 0, 1901, 0, 0, 'ПринадлежностьБА_ЛБО', 0, null) ;

CALL ImportField(190100093, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 1901, 0, 1, '', 0, null) ;

CALL ImportField(190100094, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 1901, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(190100095, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 0, 1901, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(190100141, 'Вариант', 'Variant', 'Вариант', 'Variant', 0, 1901, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(190100142, 'Источник финансирования', 'NotifyType', 'Источник финансирования', 'NotifyType', 0, 1901, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(190100143, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 0, 1901, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(190100145, 'Дата документа', 'DocDat', 'Дата перв. документа', 'DocDat', 0, 1901, 0, 0, 'ДатаДокОснования', 0, null) ;

CALL ImportField(190100146, 'Номер документа', 'DocNumber', 'Номер перв. документа', 'DocNumber', 0, 1901, 0, 0, 'НомерДокОснования', 0, null) ;

CALL ImportField(190100147, 'Дополнительная информация', 'Note1', 'Дополнительная информация', 'Note1', 0, 1901, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(190100148, 'По вопросу', 'Note2', 'По вопросу', 'Note2', 0, 1901, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(190100151, 'Номер', 'ANumber', 'Номер', 'Number', 0, 1901, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(190100152, 'Причина отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 0, 1901, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(190100153, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 1901, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(190100154, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 1901, 0, 1, '', 0, null) ;

CALL ImportField(190100155, 'Код документа в БД ФО', 'FUId', 'Код документа в БД ФО', 'FUId', 0, 1901, 0, 1, '', 0, null) ;

CALL ImportField(190100156, 'Признак зависания', 'DocSuspended', '*Признак зависания', 'DocSuspended', 0, 1901, 0, 1, '', 0, null) ;

CALL ImportField(190100158, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 0, 1901, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(190100159, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 1901, 0, 1, '', 0, null) ;

CALL ImportField(190100160, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 1901, 0, 1, '', 0, null) ;

CALL ImportField(190100161, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 1901, 0, 1, '', 0, null) ;

CALL ImportField(190100162, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', 'DestOrgName', 0, 1901, 0, 0, '', 0, null) ;

CALL ImportField(190100163, 'Основание', 'Note', 'Основание', 'Note', 0, 1901, 0, 0, 'Основание', 0, null) ;

CALL ImportField(190100164, 'Период', 'KPPERIOD', '', 'KPPERIOD', 0, 1901, 0, 0, '', 0, null) ;

CALL ImportField(190100165, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'AssignmentSource', 0, 1901, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(190100166, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 1901, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(190100178, 'Тип классфикации (заг.)', 'ClsType', 'Тип классфикации', 'ClsType', 0, 1901, 0, 1, '', 0, null) ;

CALL ImportField(190100179, 'Л/c ФК', 'FacialCode', 'Л/c ФК', ' ', 0, 1901, 0, 0, '', 0, null) ;

CALL ImportField(190100183, 'Индексы данных (заг.)', 'ProgIndex', '', ' ', 0, 1901, 0, 1, '', 0, null) ;

CALL ImportField(190101062, 'Код документа', 'RECORDINDEX', 'RECORDINDEX', 'RecordIndex', 0, 1901, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(190101089, '1-й месяц квартала', 'CurMonth1', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101090, '2-й месяц квартала', 'CurMonth2', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101091, '3-й месяц квартала', 'CurMonth3', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101092, 'Сумма на квартал', 'CurQuarter', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101096, 'КФСР', 'Kfsr', 'КФСР', 'DestKfsr', 0, 1901, 1, 0, '', 0, null) ;

CALL ImportField(190101097, 'КЭСР', 'Kesr', 'КЭСР', 'DestKesr', 0, 1901, 1, 0, '', 0, null) ;

CALL ImportField(190101098, 'КЦСР', 'KCSR', 'КЦСР', 'DestKcsr', 0, 1901, 1, 0, '', 0, null) ;

CALL ImportField(190101099, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'DestFacialAccCls', 0, 1901, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(190101100, 'КВСР', 'Kvsr', 'КВСР', 'DestKvsr', 0, 1901, 1, 0, '', 0, null) ;

CALL ImportField(190101101, 'КВР', 'Kvr', 'КВР', 'DestKvr', 0, 1901, 1, 0, '', 0, null) ;

CALL ImportField(190101102, 'ЛС в ФК', 'FacialCode', 'ЛС в ФК', 'DestFacialAccClsFacialCode', 0, 1901, 1, 0, '', 0, null) ;

CALL ImportField(190101103, 'Код записи', 'Id', '*Код записи', 'Id', 0, 1901, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(190101104, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 0, 1901, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(190101105, 'Ссылка на рс получ.', 'Acc_ref', 'Ссылка на рс получ.', 'DestAccount', 0, 1901, 1, 1, 'СчетРаспорядителя,СчетПолуч', 0, null) ;

CALL ImportField(190101106, 'Регион', 'RegionCls', 'Регион', 'RegionCls', 0, 1901, 1, 0, 'Регион', 0, null) ;

CALL ImportField(190101109, 'Счет', 'Acc', 'Счет', 'DestAccountName', 0, 1901, 1, 0, '', 0, null) ;

CALL ImportField(190101113, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 1901, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(190101114, 'СубКЭСР', 'SubKESR', 'СубКЭСР', 'DestSubKesr', 0, 1901, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(190101116, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 0, 1901, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(190101117, 'Код записи в БД ФО', 'FUId', 'Код записи в БД ФО', 'FUId', 0, 1901, 1, 0, '', 0, null) ;

CALL ImportField(190101119, 'Январь', 'Month01', 'Январь', 'Month01', 0, 1901, 1, 0, 'РоспЯнварь', 0, null) ;

CALL ImportField(190101120, 'Февраль', 'Month02', 'Февраль', 'Month02', 0, 1901, 1, 0, 'РоспФевраль', 0, null) ;

CALL ImportField(190101121, 'Март', 'Month03', 'Март', 'Month03', 0, 1901, 1, 0, 'РоспМарт', 0, null) ;

CALL ImportField(190101122, 'Апрель', 'Month04', 'Апрель', 'Month04', 0, 1901, 1, 0, 'РоспАпрель', 0, null) ;

CALL ImportField(190101123, 'Май', 'Month05', 'Май', 'Month05', 0, 1901, 1, 0, 'РоспМай', 0, null) ;

CALL ImportField(190101124, 'Июнь', 'Month06', 'Июнь', 'Month06', 0, 1901, 1, 0, 'РоспИюнь', 0, null) ;

CALL ImportField(190101125, 'Июль', 'Month07', 'Июль', 'Month07', 0, 1901, 1, 0, 'РоспИюль', 0, null) ;

CALL ImportField(190101126, 'Август', 'Month08', 'Август', 'Month08', 0, 1901, 1, 0, 'РоспАвгуст', 0, null) ;

CALL ImportField(190101127, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 0, 1901, 1, 0, 'РоспСентябрь', 0, null) ;

CALL ImportField(190101128, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 0, 1901, 1, 0, 'РоспОктябрь', 0, null) ;

CALL ImportField(190101129, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 0, 1901, 1, 0, 'РоспНоябрь', 0, null) ;

CALL ImportField(190101130, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 0, 1901, 1, 0, 'РоспДекабрь', 0, null) ;

CALL ImportField(190101131, 'Квартал4', 'Quarter4', 'Квартал4', 'Quarter4', 0, 1901, 1, 0, 'РоспКвартал4', 0, null) ;

CALL ImportField(190101132, 'Квартал1', 'Quarter1', 'Квартал1', 'Quarter1', 0, 1901, 1, 0, 'РоспКвартал1', 0, null) ;

CALL ImportField(190101133, 'Квартал2', 'Quarter2', 'Квартал2', 'Quarter2', 0, 1901, 1, 0, 'РоспКвартал2', 0, null) ;

CALL ImportField(190101134, 'Квартал3', 'Quarter3', 'Квартал3', 'Quarter3', 0, 1901, 1, 0, 'РоспКвартал3', 0, null) ;

CALL ImportField(190101135, 'Роспись на первый год', 'SummaYear1', 'Роспись на первый год', 'SummaYear1', 0, 1901, 1, 0, 'СБРНаПервыйГод', 0, null) ;

CALL ImportField(190101136, 'Роспись на второй год', 'SummaYear2', 'Роспись на второй год', 'SummaYear2', 0, 1901, 1, 0, 'СБРНаВторойГод', 0, null) ;

CALL ImportField(190101137, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'AssignmentKind', 0, 1901, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(190101138, 'Корреспондирующий ЭКР', 'KESRCorr', 'Корреспондирующий ЭКР', 'KESRCorr', 0, 1901, 1, 0, '', 0, null) ;

CALL ImportField(190101139, 'Роспись на третий год', 'SummaYear3', 'Роспись на третий год', 'SummaYear3', 0, 1901, 1, 0, 'СБРНаТретийГод', 0, null) ;

CALL ImportField(190101140, 'Источник образования средств', 'FundsSource', 'Источник образования средств', 'FUNDSSOURCE', 0, 1901, 1, 1, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(190101167, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101181, '<Не используется>', 'KDCode', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101182, '<Не используется>', 'SubKD', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101184, '<Не используется>', 'KVSRCode', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101185, '<Не используется>', 'KCSRCode', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101186, '<Не используется>', 'KVRCode', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101187, '<Не используется>', 'KD', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101189, 'Сумма за год', 'ONYEAR', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101190, 'Поступление', 'OnYearIncome', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101191, 'Погашение', 'OnYearCharges', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101193, 'Индексы данных (дет.)', 'ProgIndex', '', ' ', 0, 1901, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(190101194, 'Тип классфикации (дет.)', 'ClsType', '', ' ', 0, 1901, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(190101195, 'Код цели', 'TargetCls', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101196, 'Сумма на 3 года', 'On3Year', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101197, 'Сумма на 3 года (погашение)', 'On3YearCharges', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101198, 'Сумма на 3 года (поступление)', 'On3YearIncome', '', ' ', 0, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190101200, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 1901, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(190101201, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 1901, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(190101202, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 0, 1901, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(190101203, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 0, 1901, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(190101204, 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', '', ' ', 0, 1901, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(190101205, 'Код расходного обязательства (ключ)', 'PayPromiseCls', '', ' ', 0, 1901, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

CALL ImportField(190101206, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 0, 1901, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(190101207, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 0, 1901, 1, 0, 'КодСубсидии', 0, null) ;

-- СБР (источники), Бюджет(1)
CALL ImportField(190110001, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 1901, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(190110002, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 1901, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(190110003, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 1901, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(190110004, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 1901, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(190110005, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 1901, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(190110006, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 1901, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(190110008, 'По вопросу(Основание)', 'NOTE2', 'По вопросу', 'Note2', 1, 1901, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(190110009, 'Основание(Основание)', 'NOTE', 'Основание', 'Note', 1, 1901, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(190110013, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 1901, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(190110014, 'Главный администратор', 'OrgName', 'Главный распорядитель', ' ', 1, 1901, 0, 0, '', 0, 16646) ;

CALL ImportField(190110049, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 1, 1901, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(190110050, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 1901, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(190110051, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 1901, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(190110055, 'Код документа', 'ID', 'ID', 'Id', 1, 1901, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(190110056, 'Статус ЭЦП', 'CryptoStatus', 'CryptoStatus', 'CryptoStatus', 1, 1901, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(190110057, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 1901, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(190110058, 'СостояниеДокумента', 'DocStateRef', 'DocStateRef', 'DocStateRef', 1, 1901, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(190110069, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'ASSIGNMENTSOURCE', 1, 1901, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(190110074, 'Индексы данных', 'ProgIndex', 'ProgIndex', ' ', 1, 1901, 0, 1, '', 0, 17493) ;

CALL ImportField(190110081, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 1901, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(190110082, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderId', 1, 1901, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(190110084, 'Отнесение к БА, ЛБО', 'Ba_Lbo_Flag', 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 1, 1901, 0, 0, 'ПринадлежностьБА_ЛБО', 0, 17502) ;

CALL ImportField(190110085, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 1901, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(190111017, 'Вид источника(Источники финансирования дефицита)', 'IFS_DescriptionCode', 'Вид источника', ' ', 1, 1901, 1, 0, '', 0, 17050) ;

CALL ImportField(190111018, 'ЭКИ(Источники финансирования дефицита)', 'IFS_KESR', 'ЭКИ', ' ', 1, 1901, 1, 0, '', 0, 17054) ;

CALL ImportField(190111022, 'Лицевой счет ГРБС', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 1901, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(190111025, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 1901, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(190111031, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 1901, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(190111032, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'Quarter1', 1, 1901, 1, 0, 'РоспКвартал1', 0, 17421) ;

CALL ImportField(190111033, 'Январь', 'Month01', 'Январь', 'Month01', 1, 1901, 1, 0, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(190111034, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 1901, 1, 0, 'РоспФевраль', 0, 17437) ;

CALL ImportField(190111035, 'Март', 'Month03', 'Март', 'Month03', 1, 1901, 1, 0, 'РоспМарт', 0, 17438) ;

CALL ImportField(190111036, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'Quarter2', 1, 1901, 1, 0, 'РоспКвартал2', 0, 17422) ;

CALL ImportField(190111037, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 1901, 1, 0, 'РоспАпрель', 0, 17439) ;

CALL ImportField(190111038, 'Май', 'Month05', 'Май', 'Month05', 1, 1901, 1, 0, 'РоспМай', 0, 17440) ;

CALL ImportField(190111039, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 1901, 1, 0, 'РоспИюнь', 0, 17441) ;

CALL ImportField(190111040, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'Quarter3', 1, 1901, 1, 0, 'РоспКвартал3', 0, 17423) ;

CALL ImportField(190111041, 'Июль', 'Month07', 'Июль', 'Month07', 1, 1901, 1, 0, 'РоспИюль', 0, 17442) ;

CALL ImportField(190111042, 'Август', 'Month08', 'Август', 'Month08', 1, 1901, 1, 0, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(190111043, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 1901, 1, 0, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(190111044, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'Quarter4', 1, 1901, 1, 0, 'РоспКвартал4', 0, 17424) ;

CALL ImportField(190111045, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 1901, 1, 0, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(190111046, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 1901, 1, 0, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(190111047, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 1901, 1, 0, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(190111048, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 1901, 1, 0, 'БухОперация', 0, 17451) ;

CALL ImportField(190111052, 'л/с ФК', 'FACIALCODE', 'л/с ФК', 'DestFacialAccClsFacialCode', 1, 1901, 1, 0, '', 0, null) ;

CALL ImportField(190111059, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFS', 1, 1901, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(190111060, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 1901, 1, 1, '', 0, 17410) ;

CALL ImportField(190111061, 'Код документа', 'RECORDINDEX', 'RECORDINDEX', 'RecordIndex', 1, 1901, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(190111062, 'Код записи', 'ID', 'ID', 'Id', 1, 1901, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(190111063, 'Организация', 'Org_ref', 'Org_ref', 'Org_Ref_Det', 1, 1901, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(190111066, 'Второй плановый год', 'SUMMAYEAR2', 'Роспись на второй плановый год', 'SUMMAYEAR2', 1, 1901, 1, 0, 'СБРНаВторойГод', 0, 17458) ;

CALL ImportField(190111067, 'Третий плановый год', 'SUMMAYEAR3', 'Роспись на третий плановый год', 'SUMMAYEAR3', 1, 1901, 1, 0, 'СБРНаТретийГод', 0, 17459) ;

CALL ImportField(190111068, 'Первый год', 'SUMMAYEAR1', 'Роспись на первый плановый год', 'SUMMAYEAR1', 1, 1901, 1, 0, 'СБРНаПервыйГод', 0, 17457) ;

CALL ImportField(190111070, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'ASSIGNMENTKIND', 1, 1901, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(190111075, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 1901, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(190111083, 'Код отправителя записи', 'SenderID', 'Код отправителя записи', 'SenderId', 1, 1901, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(190111084, '1-й месяц квартала', 'CurMonth1', '1-й месяц квартала', ' ', 1, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190111085, '2-й месяц квартала', 'CurMonth2', '2-й месяц квартала', ' ', 1, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190111086, '3-й месяц квартала', 'CurMonth3', '3-й месяц квартала', ' ', 1, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190111087, 'Сумма на квартал', 'CurQuarter', 'Сумма на квартал', ' ', 1, 1901, 1, 1, '', 0, null) ;

CALL ImportField(190111088, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 1901, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(190111090, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 1901, 1, 0, '', 0, null) ;

CALL ImportField(190111091, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средствКлюч', 'TransfertCls', 1, 1901, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(190111092, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 1901, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(190111093, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 1901, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(190111094, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 1901, 1, 0, '', 0, 26617) ;

CALL ImportField(190111097, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 1, 1901, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(190111099, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 1901, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(190111100, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 1901, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

CALL ImportField(190111101, 'Отдел', 'DepartmentCls', 'Отдел', 'DepartmentCls', 1, 1901, 1, 0, 'Отдел', 0, 30005) ;

-- Роспись по АИФ (источники), УРМ(0)
CALL ImportField(190200021, 'Состояние', 'DocStateName', 'Состояние', 'DocStateName', 0, 1902, 0, 0, '', 0, null) ;

CALL ImportField(190200083, 'Код документа', 'ID', 'Код документа', 'Id', 0, 1902, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(190200087, 'Отнесение к БА, ЛБО', 'Ba_Lbo_Flag', 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 0, 1902, 0, 0, 'ПринадлежностьБА_ЛБО', 0, null) ;

CALL ImportField(190200091, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 0, 1902, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(190200151, 'Вариант', 'Variant', 'Вариант', 'Variant', 0, 1902, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(190200152, 'Источник финансирования', 'NotifyType', 'Источник финансирования', 'NotifyType', 0, 1902, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(190200153, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 0, 1902, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(190200154, 'Дата документа', 'DocDat', 'Дата перв. документа', 'DocDat', 0, 1902, 0, 0, 'ДатаДокОснования', 0, null) ;

CALL ImportField(190200155, 'Номер документа', 'DocNumber', 'Номер перв. документа', 'DocNumber', 0, 1902, 0, 0, 'НомерДокОснования', 0, null) ;

CALL ImportField(190200156, 'Дополнительная информация', 'Note1', 'Дополнительная информация', 'Note1', 0, 1902, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(190200157, 'По вопросу', 'Note2', 'По вопросу', 'Note2', 0, 1902, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(190200160, 'Номер', 'ANumber', 'Номер', 'Number', 0, 1902, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(190200161, 'Причина отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 0, 1902, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(190200162, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 1902, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(190200163, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 1902, 0, 1, '', 0, null) ;

CALL ImportField(190200164, 'Код документа в БД ФО', 'FUId', 'Код документа в БД ФО', 'FUId', 0, 1902, 0, 1, '', 0, null) ;

CALL ImportField(190200165, 'Признак зависания', 'DocSuspended', '*Признак зависания', 'DocSuspended', 0, 1902, 0, 1, '', 0, null) ;

CALL ImportField(190200166, 'Причина отклонения(текст)', 'RejectNote', 'Причина отклонения(текст)', 'RejectCause', 0, 1902, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(190200167, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 0, 1902, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(190200168, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 1902, 0, 1, '', 0, null) ;

CALL ImportField(190200169, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 1902, 0, 1, '', 0, null) ;

CALL ImportField(190200170, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 1902, 0, 1, '', 0, null) ;

CALL ImportField(190200171, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', 'DestOrgName', 0, 1902, 0, 0, '', 0, null) ;

CALL ImportField(190200172, 'Основание', 'Note', 'Основание', 'Note', 0, 1902, 0, 0, 'Основание', 0, null) ;

CALL ImportField(190200173, 'Период', 'KPPERIOD', '', 'KPPERIOD', 0, 1902, 0, 0, '', 0, null) ;

CALL ImportField(190200174, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'AssignmentSource', 0, 1902, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(190200175, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 1902, 0, 1, '', 0, null) ;

CALL ImportField(190200176, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 1902, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(190200177, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 1902, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(190200178, 'Тип классфикации (заг.)', 'ClsType', 'Тип классфикации', 'ClsType', 0, 1902, 0, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(190200179, 'Л/c ФК', 'FacialCode', 'Л/c ФК', ' ', 0, 1902, 0, 0, '', 0, null) ;

CALL ImportField(190200183, 'Индексы данных (заг.)', 'ProgIndex', '', ' ', 0, 1902, 0, 1, '', 0, null) ;

CALL ImportField(190201031, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 0, 1902, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(190201088, '1-й месяц квартала', 'CurMonth1', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201090, '3-й месяц квартала', 'CurMonth3', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201092, 'КФСР', 'Kfsr', 'КФСР', 'DestKfsr', 0, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190201093, 'КЭСР', 'Kesr', 'КЭСР', 'DestKesr', 0, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190201094, 'КЦСР', 'KCSR', 'КЦСР', 'DestKcsr', 0, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190201096, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'DestFacialAccCls', 0, 1902, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(190201097, 'КВСР', 'Kvsr', 'КВСР', 'DestKvsr', 0, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190201098, 'КВР', 'Kvr', 'КВР', 'DestKvr', 0, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190201108, '2-й месяц квартала', 'CurMonth2', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201110, 'Сумма на квартал', 'CurQuarter', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201111, 'ЛС в ФК', 'FacialCode', 'ЛС в ФК', 'DestFacialAccClsFacialCode', 0, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190201112, 'Код записи', 'Id', '*Код записи', 'Id', 0, 1902, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(190201113, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 0, 1902, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(190201114, 'Ссылка на рс получ.', 'Acc_ref', 'Ссылка на рс получ.', 'DestAccount', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201115, 'Регион', 'RegionCls', 'Регион', 'RegionCls', 0, 1902, 1, 0, 'Регион', 0, null) ;

CALL ImportField(190201119, 'Счет', 'Acc', 'Счет', 'DestAccountName', 0, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190201124, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 1902, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(190201125, 'СубКЭСР', 'SubKESR', 'СубКЭСР', 'DestSubKesr', 0, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190201127, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 0, 1902, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(190201128, 'Код записи в БД ФО', 'FUId', 'Код записи в БД ФО', 'FUId', 0, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190201129, 'Январь', 'Month01', 'Январь', 'Month01', 0, 1902, 1, 0, 'РоспЯнварь', 0, null) ;

CALL ImportField(190201130, 'Февраль', 'Month02', 'Февраль', 'Month02', 0, 1902, 1, 0, 'РоспФевраль', 0, null) ;

CALL ImportField(190201131, 'Март', 'Month03', 'Март', 'Month03', 0, 1902, 1, 0, 'РоспМарт', 0, null) ;

CALL ImportField(190201132, 'Апрель', 'Month04', 'Апрель', 'Month04', 0, 1902, 1, 0, 'РоспАпрель', 0, null) ;

CALL ImportField(190201133, 'Май', 'Month05', 'Май', 'Month05', 0, 1902, 1, 0, 'РоспМай', 0, null) ;

CALL ImportField(190201134, 'Июнь', 'Month06', 'Июнь', 'Month06', 0, 1902, 1, 0, 'РоспИюнь', 0, null) ;

CALL ImportField(190201135, 'Июль', 'Month07', 'Июль', 'Month07', 0, 1902, 1, 0, 'РоспИюль', 0, null) ;

CALL ImportField(190201136, 'Август', 'Month08', 'Август', 'Month08', 0, 1902, 1, 0, 'РоспАвгуст', 0, null) ;

CALL ImportField(190201137, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 0, 1902, 1, 0, 'РоспСентябрь', 0, null) ;

CALL ImportField(190201138, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 0, 1902, 1, 0, 'РоспОктябрь', 0, null) ;

CALL ImportField(190201139, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 0, 1902, 1, 0, 'РоспНоябрь', 0, null) ;

CALL ImportField(190201140, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 0, 1902, 1, 0, 'РоспДекабрь', 0, null) ;

CALL ImportField(190201141, 'Квартал4', 'Quarter4', 'Квартал4', 'Quarter4', 0, 1902, 1, 0, 'РоспКвартал4', 0, null) ;

CALL ImportField(190201142, 'Квартал1', 'Quarter1', 'Квартал1', 'Quarter1', 0, 1902, 1, 0, 'РоспКвартал1', 0, null) ;

CALL ImportField(190201143, 'Квартал2', 'Quarter2', 'Квартал2', 'Quarter2', 0, 1902, 1, 0, 'РоспКвартал2', 0, null) ;

CALL ImportField(190201144, 'Квартал3', 'Quarter3', 'Квартал3', 'Quarter3', 0, 1902, 1, 0, 'РоспКвартал3', 0, null) ;

CALL ImportField(190201145, 'Роспись на первый год', 'SummaYear1', 'Роспись на первый год', 'SummaYear1', 0, 1902, 1, 0, 'РоспНаПервыйГод', 0, null) ;

CALL ImportField(190201146, 'Роспись на второй год', 'SummaYear2', 'Роспись на второй год', 'SummaYear2', 0, 1902, 1, 0, 'РоспНаВторойГод', 0, null) ;

CALL ImportField(190201147, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'AssignmentKind', 0, 1902, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(190201148, 'Корреспондирующий ЭКР', 'KESRCorr', 'Корреспондирующий ЭКР', 'KESRCorr', 0, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190201149, 'Роспись на третий год', 'SummaYear3', 'Роспись на третий год', 'SummaYear3', 0, 1902, 1, 0, 'РоспНаТретийГод', 0, null) ;

CALL ImportField(190201150, 'Источник образования средств', 'FundsSource', 'Источник образования средств', 'FUNDSSOURCE', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201178, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201181, '<Не используется>', 'KDCode', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201182, '<Не используется>', 'SubKD', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201184, '<Не используется>', 'KVSRCode', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201185, '<Не используется>', 'KCSRCode', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201186, '<Не используется>', 'KVRCode', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201187, '<Не используется>', 'KD', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201189, 'Сумма за год', 'ONYEAR', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201190, 'Поступление', 'OnYearIncome', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201191, 'Погашение', 'OnYearCharges', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201193, 'Индексы данных (дет.)', 'ProgIndex', '', ' ', 0, 1902, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(190201194, 'Тип классфикации (дет.)', 'ClsType', '', ' ', 0, 1902, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(190201195, 'Код цели', 'TargetCls', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201196, 'Сумма на 3 года', 'On3Year', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201197, 'Сумма на 3 года (погашение)', 'On3YearCharges', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201198, 'Сумма на 3 года (поступление)', 'On3YearIncome', '', ' ', 0, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190201200, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 1902, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(190201201, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 1902, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(190201202, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 0, 1902, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(190201203, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 0, 1902, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(190201204, 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', '', ' ', 0, 1902, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(190201205, 'Код расходного обязательства (ключ)', 'PayPromiseCls', '', ' ', 0, 1902, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

CALL ImportField(190201206, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 0, 1902, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(190201207, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 0, 1902, 1, 0, 'КодСубсидии', 0, null) ;

-- Роспись по АИФ (источники), Бюджет(1)
CALL ImportField(190210001, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 1902, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(190210002, 'Главный администратор', 'OrgName', 'Главный администратор', ' ', 1, 1902, 0, 0, '', 0, 16646) ;

CALL ImportField(190210013, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 1902, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(190210015, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 1902, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(190210016, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 1902, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(190210018, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 1902, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(190210019, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 1902, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(190210020, 'Индексы данных', 'ProgIndex', 'ProgIndex', ' ', 1, 1902, 0, 1, '', 0, 17493) ;

CALL ImportField(190210024, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 1902, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(190210027, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 1902, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(190210029, 'Код документа', 'ID', 'Код документа', 'Id', 1, 1902, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(190210033, 'Статус ЭЦП', 'CryptoStatus', 'CryptoStatus', 'CryptoStatus', 1, 1902, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(190210038, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 1902, 0, 1, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(190210043, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 1902, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(190210044, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'Note', 1, 1902, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(190210045, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'Note2', 1, 1902, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(190210047, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 1, 1902, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(190210048, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 1902, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(190210049, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 1902, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(190210070, 'СостояниеДокумента', 'DocStateRef', 'DocStateRef', 'DocStateRef', 1, 1902, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(190210081, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderId', 1, 1902, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(190210083, 'Отнесение к БА, ЛБО', 'Ba_Lbo_Flag', 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 1, 1902, 0, 0, 'ПринадлежностьБА_ЛБО', 0, 17502) ;

CALL ImportField(190210084, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 1902, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(190211005, 'Вид источника(Источники финансирования дефицита)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 1902, 1, 0, '', 0, 17050) ;

CALL ImportField(190211006, 'ЭКИ(Источники финансирования дефицита)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 1902, 1, 0, '', 0, 17054) ;

CALL ImportField(190211007, 'л/с ФК', 'FACIALCODE', 'л/с ФК', 'DestFacialAccClsFacialCode', 1, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190211012, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 1902, 1, 0, 'БухОперация', 0, 17451) ;

CALL ImportField(190211014, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 1902, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(190211021, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 1902, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(190211022, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFS', 1, 1902, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(190211028, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 1902, 1, 1, '', 0, 17410) ;

CALL ImportField(190211030, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 1902, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(190211031, 'Код записи', 'ID', 'Код записи', 'Id', 1, 1902, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(190211037, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет ГРБС', 'DestFacialAccCls', 1, 1902, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(190211042, 'Организация', 'Org_ref', 'Org_ref', 'Org_Ref_Det', 1, 1902, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(190211046, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 1902, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(190211051, 'Август', 'Month08', 'Август', 'Month08', 1, 1902, 1, 0, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(190211052, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 1902, 1, 0, 'РоспАпрель', 0, 17439) ;

CALL ImportField(190211053, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 1902, 1, 0, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(190211054, 'Июль', 'Month07', 'Июль', 'Month07', 1, 1902, 1, 0, 'РоспИюль', 0, 17442) ;

CALL ImportField(190211055, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 1902, 1, 0, 'РоспИюнь', 0, 17441) ;

CALL ImportField(190211060, 'Май', 'Month05', 'Май', 'Month05', 1, 1902, 1, 0, 'РоспМай', 0, 17440) ;

CALL ImportField(190211061, 'Март', 'Month03', 'Март', 'Month03', 1, 1902, 1, 0, 'РоспМарт', 0, 17438) ;

CALL ImportField(190211062, 'Второй плановый год', 'SUMMAYEAR2', 'Второй плановый год', 'SUMMAYEAR2', 1, 1902, 1, 0, 'РоспНаВторойГод', 0, 17458) ;

CALL ImportField(190211063, 'Первый год', 'SUMMAYEAR1', 'Первый год', 'SUMMAYEAR1', 1, 1902, 1, 0, 'РоспНаПервыйГод', 0, 17457) ;

CALL ImportField(190211064, 'Третий плановый год', 'SUMMAYEAR3', 'Третий плановый год', 'SUMMAYEAR3', 1, 1902, 1, 0, 'РоспНаТретийГод', 0, 17459) ;

CALL ImportField(190211065, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 1902, 1, 0, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(190211066, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 1902, 1, 0, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(190211067, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 1902, 1, 0, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(190211068, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 1902, 1, 0, 'РоспФевраль', 0, 17437) ;

CALL ImportField(190211069, 'Январь', 'Month01', 'Январь', 'Month01', 1, 1902, 1, 0, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(190211075, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 1902, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(190211082, 'Код отправителя записи', 'SenderID', 'Код отправителя записи', 'SenderId', 1, 1902, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(190211083, '1-й месяц квартала', 'CurMonth1', '1-й месяц квартала', ' ', 1, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190211084, '2-й месяц квартала', 'CurMonth2', '2-й месяц квартала', ' ', 1, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190211085, '3-й месяц квартала', 'CurMonth3', '3-й месяц квартала', ' ', 1, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190211086, 'Сумма на квартал', 'CurQuarter', 'Сумма на квартал', ' ', 1, 1902, 1, 1, '', 0, null) ;

CALL ImportField(190211087, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 1902, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(190211089, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 1902, 1, 0, '', 0, null) ;

CALL ImportField(190211090, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средствКлюч', 'TransfertCls', 1, 1902, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(190211091, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 1902, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(190211092, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 1902, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(190211093, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 1902, 1, 0, '', 0, 26617) ;

CALL ImportField(190211096, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 1, 1902, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(190211098, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 1902, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(190211099, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 1902, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

-- Кассовый план (источники), УРМ(0)
CALL ImportField(190300085, 'Код документа', 'ID', 'Код документа', 'Id', 0, 1903, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(190300101, 'Номер', 'ANUMBER', 'Номер', 'Number', 0, 1903, 0, 0, '', 0, null) ;

CALL ImportField(190300102, 'Главный администратор', 'OrgName', 'Главный администратор', 'DestOrgName', 0, 1903, 0, 0, '', 0, null) ;

CALL ImportField(190300111, 'Вариант', 'Variant', 'Вариант', 'Variant', 0, 1903, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(190300113, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 0, 1903, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(190300114, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 1903, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(190300117, 'Дата перв. документа(Основание)', 'DOCDAT', 'Дата перв. документа(Основание)', 'DocDat', 0, 1903, 0, 0, 'ДатаДокОснования', 0, null) ;

CALL ImportField(190300118, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 0, 1903, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(190300119, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 0, 1903, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(190300120, 'Индексы данных', 'ProgIndex', 'ProgIndex', ' ', 0, 1903, 0, 1, '', 0, null) ;

CALL ImportField(190300122, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 0, 1903, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(190300123, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 1903, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(190300128, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 0, 1903, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(190300131, 'Номер перв. документа(Основание)', 'DOCNUMBER', 'Номер перв. документа(Основание)', 'DocNumber', 0, 1903, 0, 0, 'НомерДокОснования', 0, null) ;

CALL ImportField(190300134, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'Note', 0, 1903, 0, 0, 'Основание', 0, null) ;

CALL ImportField(190300135, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'Note2', 0, 1903, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(190300137, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 0, 1903, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(190300138, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 0, 1903, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(190300139, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 0, 1903, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(190300157, 'СостояниеДокумента', 'DocStateRef', 'DocStateRef', 'DocStateRef', 0, 1903, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(190300168, 'Период', 'KPPERIOD', 'Период', 'KPPeriod', 0, 1903, 0, 1, 'ПериодКП', 0, null) ;

CALL ImportField(190301030, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 0, 1903, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(190301103, 'л/с ФК', 'FACIALCODE', 'л/с ФК', 'DestFacialAccClsFacialCode', 0, 1903, 1, 0, '', 0, null) ;

CALL ImportField(190301110, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 0, 1903, 1, 1, 'БухОперация', 0, null) ;

CALL ImportField(190301112, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 0, 1903, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(190301121, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 1903, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(190301124, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 0, 1903, 1, 1, '', 0, null) ;

CALL ImportField(190301125, 'Код записи', 'ID', 'Код записи', 'Id', 0, 1903, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(190301127, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 0, 1903, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(190301136, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 1903, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(190301140, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 0, 1903, 1, 0, 'Регион', 0, null) ;

CALL ImportField(190301141, 'Август', 'Month08', 'Август', 'Month08', 0, 1903, 1, 0, 'РоспАвгуст', 0, null) ;

CALL ImportField(190301142, 'Апрель', 'Month04', 'Апрель', 'Month04', 0, 1903, 1, 0, 'РоспАпрель', 0, null) ;

CALL ImportField(190301143, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 0, 1903, 1, 0, 'РоспДекабрь', 0, null) ;

CALL ImportField(190301144, 'Июль', 'Month07', 'Июль', 'Month07', 0, 1903, 1, 0, 'РоспИюль', 0, null) ;

CALL ImportField(190301145, 'Июнь', 'Month06', 'Июнь', 'Month06', 0, 1903, 1, 0, 'РоспИюнь', 0, null) ;

CALL ImportField(190301146, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'Quarter1', 0, 1903, 1, 0, 'РоспКвартал1', 0, null) ;

CALL ImportField(190301147, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'Quarter2', 0, 1903, 1, 0, 'РоспКвартал2', 0, null) ;

CALL ImportField(190301148, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'Quarter3', 0, 1903, 1, 0, 'РоспКвартал3', 0, null) ;

CALL ImportField(190301149, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'Quarter4', 0, 1903, 1, 0, 'РоспКвартал4', 0, null) ;

CALL ImportField(190301150, 'Май', 'Month05', 'Май', 'Month05', 0, 1903, 1, 0, 'РоспМай', 0, null) ;

CALL ImportField(190301151, 'Март', 'Month03', 'Март', 'Month03', 0, 1903, 1, 0, 'РоспМарт', 0, null) ;

CALL ImportField(190301152, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 0, 1903, 1, 0, 'РоспНоябрь', 0, null) ;

CALL ImportField(190301153, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 0, 1903, 1, 0, 'РоспОктябрь', 0, null) ;

CALL ImportField(190301154, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 0, 1903, 1, 0, 'РоспСентябрь', 0, null) ;

CALL ImportField(190301155, 'Февраль', 'Month02', 'Февраль', 'Month02', 0, 1903, 1, 0, 'РоспФевраль', 0, null) ;

CALL ImportField(190301156, 'Январь', 'Month01', 'Январь', 'Month01', 0, 1903, 1, 0, 'РоспЯнварь', 0, null) ;

CALL ImportField(190301159, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 0, 1903, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(190301169, '1-й месяц квартала', 'CurMonth1', '1-й месяц квартала', ' ', 0, 1903, 1, 1, '', 0, null) ;

CALL ImportField(190301170, '2-й месяц квартала', 'CurMonth2', '2-й месяц квартала', ' ', 0, 1903, 1, 1, '', 0, null) ;

CALL ImportField(190301171, '3-й месяц квартала', 'CurMonth3', '3-й месяц квартала', ' ', 0, 1903, 1, 1, '', 0, null) ;

CALL ImportField(190301172, 'Сумма на квартал', 'CurQuarter', 'Сумма на квартал', ' ', 0, 1903, 1, 1, '', 0, null) ;

CALL ImportField(190301176, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средствКлюч', 'TransfertCls', 0, 1903, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(190301177, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 0, 1903, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(190301178, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 0, 1903, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(190301180, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 0, 1903, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(190301181, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 0, 1903, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(190301182, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 0, 1903, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(190301183, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 0, 1903, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(190301184, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 0, 1903, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(190301185, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayPromiseCls', 0, 1903, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

-- Кассовый план (источники), Бюджет(1)
CALL ImportField(190310001, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 1903, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(190310002, 'Главный администратор', 'OrgName', 'Главный администратор', ' ', 1, 1903, 0, 0, '', 0, 16646) ;

CALL ImportField(190310011, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 1903, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(190310013, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 1903, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(190310014, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 1903, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(190310018, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 1903, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(190310019, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 1903, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(190310020, 'Индексы данных', 'ProgIndex', 'ProgIndex', ' ', 1, 1903, 0, 1, '', 0, 17493) ;

CALL ImportField(190310023, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 1903, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(190310026, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 1903, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(190310028, 'Код документа', 'ID', 'Код документа', 'Id', 1, 1903, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(190310032, 'Статус ЭЦП', 'CryptoStatus', 'CryptoStatus', 'CryptoStatus', 1, 1903, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(190310037, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 1903, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(190310042, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 1903, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(190310043, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'Note', 1, 1903, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(190310044, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'Note2', 1, 1903, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(190310046, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 1, 1903, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(190310047, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 1903, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(190310048, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 1903, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(190310069, 'СостояниеДокумента', 'DocStateRef', 'DocStateRef', 'DocStateRef', 1, 1903, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(190310083, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderId', 1, 1903, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(190310084, 'Период', 'KPPERIOD', 'Период', 'KPPeriod', 1, 1903, 0, 1, 'ПериодКП', 0, 24700) ;

CALL ImportField(190310085, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 1903, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(190311003, 'л/с ФК', 'FACIALCODE', 'л/с ФК', 'DestFacialAccClsFacialCode', 1, 1903, 1, 0, '', 0, null) ;

CALL ImportField(190311008, 'Автор(Авторизация)', 'CREATERUSER', 'Автор', 'CREATERUSER_DET', 1, 1903, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(190311009, 'Изменил(Авторизация)', 'UpdaterUser', 'Изменил', 'UpdaterUser_det', 1, 1903, 1, 1, 'АвторИзменений', 0, 17430) ;

CALL ImportField(190311010, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 1903, 1, 1, 'БухОперация', 0, 17451) ;

CALL ImportField(190311012, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 1903, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(190311015, 'Дата изменения(Авторизация)', 'UpdateDate', 'Дата изменения', 'UpdateDate_Det', 1, 1903, 1, 1, 'ДатаВремяИзменения', 0, 17429) ;

CALL ImportField(190311016, 'Дата создания(Авторизация)', 'CreateDate', 'Дата создания', 'CreateDate_Det', 1, 1903, 1, 1, 'ДатаВремяСоздания', 0, 17428) ;

CALL ImportField(190311021, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 1903, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(190311027, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 1903, 1, 1, '', 0, 17410) ;

CALL ImportField(190311029, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 1903, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(190311030, 'Код записи', 'ID', 'Код записи', 'Id', 1, 1903, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(190311036, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 1903, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(190311041, 'Организация', 'Org_ref', 'Org_ref', 'Org_Ref_Det', 1, 1903, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(190311045, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 1903, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(190311050, 'Август', 'Month08', 'Август', 'Month08', 1, 1903, 1, 0, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(190311051, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 1903, 1, 0, 'РоспАпрель', 0, 17439) ;

CALL ImportField(190311052, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 1903, 1, 0, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(190311053, 'Июль', 'Month07', 'Июль', 'Month07', 1, 1903, 1, 0, 'РоспИюль', 0, 17442) ;

CALL ImportField(190311054, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 1903, 1, 0, 'РоспИюнь', 0, 17441) ;

CALL ImportField(190311055, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'Quarter1', 1, 1903, 1, 0, 'РоспКвартал1', 0, 17421) ;

CALL ImportField(190311056, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'Quarter2', 1, 1903, 1, 0, 'РоспКвартал2', 0, 17422) ;

CALL ImportField(190311057, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'Quarter3', 1, 1903, 1, 0, 'РоспКвартал3', 0, 17423) ;

CALL ImportField(190311058, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'Quarter4', 1, 1903, 1, 0, 'РоспКвартал4', 0, 17424) ;

CALL ImportField(190311059, 'Май', 'Month05', 'Май', 'Month05', 1, 1903, 1, 0, 'РоспМай', 0, 17440) ;

CALL ImportField(190311060, 'Март', 'Month03', 'Март', 'Month03', 1, 1903, 1, 0, 'РоспМарт', 0, 17438) ;

CALL ImportField(190311064, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 1903, 1, 0, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(190311065, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 1903, 1, 0, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(190311066, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 1903, 1, 0, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(190311067, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 1903, 1, 0, 'РоспФевраль', 0, 17437) ;

CALL ImportField(190311068, 'Январь', 'Month01', 'Январь', 'Month01', 1, 1903, 1, 0, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(190311074, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 1903, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(190311077, 'ЭКИ(Источники финансирования дефицита)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 1903, 1, 0, '', 0, 17054) ;

CALL ImportField(190311078, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFS', 1, 1903, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(190311079, 'Вид источника(Источники финансирования дефицита)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 1903, 1, 0, '', 0, 17050) ;

CALL ImportField(190311084, 'Код отправителя записи', 'SenderID', 'Код отправителя записи', 'SenderId', 1, 1903, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(190311085, '1-й месяц квартала', 'CurMonth1', '1-й месяц квартала', ' ', 1, 1903, 1, 1, '', 0, null) ;

CALL ImportField(190311086, '2-й месяц квартала', 'CurMonth2', '2-й месяц квартала', ' ', 1, 1903, 1, 1, '', 0, null) ;

CALL ImportField(190311087, '3-й месяц квартала', 'CurMonth3', '3-й месяц квартала', ' ', 1, 1903, 1, 1, '', 0, null) ;

CALL ImportField(190311088, 'Сумма на квартал', 'CurQuarter', 'Сумма на квартал', ' ', 1, 1903, 1, 1, '', 0, null) ;

CALL ImportField(190311090, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 1903, 1, 0, '', 0, null) ;

CALL ImportField(190311091, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средствКлюч', 'TransfertCls', 1, 1903, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(190311093, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 1903, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(190311094, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 1903, 1, 0, '', 0, 26617) ;

CALL ImportField(190311097, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 1, 1903, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(190311099, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 1903, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(190311100, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 1903, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

-- ПОФ по АИФ (источники), УРМ(0)
CALL ImportField(190600087, 'Код документа', 'ID', 'Код документа', 'Id', 0, 1906, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(190601031, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 0, 1906, 1, 1, 'КодДокумента', 0, null) ;

-- ПОФ по АИФ (источники), Бюджет(1)
CALL ImportField(190610001, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 1906, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(190610002, 'Главный администратор', 'OrgName', 'Главный администратор', ' ', 1, 1906, 0, 0, '', 0, 16646) ;

CALL ImportField(190610012, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 1906, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(190610014, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 1906, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(190610015, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 1906, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(190610019, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 1906, 0, 0, 'ДатаДокумента', 0, 17483) ;

CALL ImportField(190610020, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 1906, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(190610021, 'Индексы данных', 'ProgIndex', 'ProgIndex', ' ', 1, 1906, 0, 1, '', 0, 17493) ;

CALL ImportField(190610024, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 1906, 0, 0, 'ИсточникФинансирования', 0, 17471) ;

CALL ImportField(190610027, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 1906, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(190610029, 'Код документа', 'ID', 'Код документа', 'Id', 1, 1906, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(190610033, 'Статус ЭЦП', 'CryptoStatus', 'CryptoStatus', 'CryptoStatus', 1, 1906, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(190610038, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 1906, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(190610043, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 1906, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(190610044, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'Note', 1, 1906, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(190610045, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'Note2', 1, 1906, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(190610047, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'Note1', 1, 1906, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(190610048, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 1906, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(190610049, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 1906, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(190610070, 'СостояниеДокумента', 'DocStateRef', 'DocStateRef', 'DocStateRef', 1, 1906, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(190610085, 'Код удалённого клиента', 'SenderID', 'Код удалённого клиента', 'SenderId', 1, 1906, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(190610086, 'Период', 'KPPERIOD', 'Период', 'KPPeriod', 1, 1906, 0, 1, 'ПериодКП', 0, 24700) ;

CALL ImportField(190610087, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 1906, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(190611003, 'л/с ФК', 'FACIALCODE', 'л/с ФК', 'DestFacialAccClsFacialCode', 1, 1906, 1, 0, '', 0, null) ;

CALL ImportField(190611009, 'Автор(Авторизация)', 'CREATERUSER', 'Автор', 'CREATERUSER_DET', 1, 1906, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(190611010, 'Изменил(Авторизация)', 'UpdaterUser', 'Изменил', 'UpdaterUser_det', 1, 1906, 1, 1, 'АвторИзменений', 0, 17430) ;

CALL ImportField(190611011, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 1906, 1, 1, 'БухОперация', 0, 17451) ;

CALL ImportField(190611013, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 1906, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(190611016, 'Дата изменения(Авторизация)', 'UpdateDate', 'Дата изменения', 'UpdateDate_Det', 1, 1906, 1, 1, 'ДатаВремяИзменения', 0, 17429) ;

CALL ImportField(190611017, 'Дата создания(Авторизация)', 'CreateDate', 'Дата создания', 'CreateDate_Det', 1, 1906, 1, 1, 'ДатаВремяСоздания', 0, 17428) ;

CALL ImportField(190611022, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 1906, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(190611028, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 1906, 1, 1, '', 0, 17410) ;

CALL ImportField(190611030, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 1906, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(190611031, 'Код записи', 'ID', 'Код записи', 'Id', 1, 1906, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(190611037, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 1906, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(190611042, 'Организация', 'Org_ref', 'Org_ref', 'Org_Ref_Det', 1, 1906, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(190611046, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 1906, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(190611051, 'Август', 'Month08', 'Август', 'Month08', 1, 1906, 1, 0, 'РоспАвгуст', 0, 17443) ;

CALL ImportField(190611052, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 1906, 1, 0, 'РоспАпрель', 0, 17439) ;

CALL ImportField(190611053, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 1906, 1, 0, 'РоспДекабрь', 0, 17447) ;

CALL ImportField(190611054, 'Июль', 'Month07', 'Июль', 'Month07', 1, 1906, 1, 0, 'РоспИюль', 0, 17442) ;

CALL ImportField(190611055, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 1906, 1, 0, 'РоспИюнь', 0, 17441) ;

CALL ImportField(190611056, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'Quarter1', 1, 1906, 1, 0, 'РоспКвартал1', 0, 17421) ;

CALL ImportField(190611057, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'Quarter2', 1, 1906, 1, 0, 'РоспКвартал2', 0, 17422) ;

CALL ImportField(190611058, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'Quarter3', 1, 1906, 1, 0, 'РоспКвартал3', 0, 17423) ;

CALL ImportField(190611059, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'Quarter4', 1, 1906, 1, 0, 'РоспКвартал4', 0, 17424) ;

CALL ImportField(190611060, 'Май', 'Month05', 'Май', 'Month05', 1, 1906, 1, 0, 'РоспМай', 0, 17440) ;

CALL ImportField(190611061, 'Март', 'Month03', 'Март', 'Month03', 1, 1906, 1, 0, 'РоспМарт', 0, 17438) ;

CALL ImportField(190611065, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 1906, 1, 0, 'РоспНоябрь', 0, 17446) ;

CALL ImportField(190611066, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 1906, 1, 0, 'РоспОктябрь', 0, 17445) ;

CALL ImportField(190611067, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 1906, 1, 0, 'РоспСентябрь', 0, 17444) ;

CALL ImportField(190611068, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 1906, 1, 0, 'РоспФевраль', 0, 17437) ;

CALL ImportField(190611069, 'Январь', 'Month01', 'Январь', 'Month01', 1, 1906, 1, 0, 'РоспЯнварь', 0, 17436) ;

CALL ImportField(190611075, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 1906, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(190611078, 'ЭКИ(Источники финансирования дефицита)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 1906, 1, 0, '', 0, 17054) ;

CALL ImportField(190611079, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFS', 1, 1906, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(190611080, 'Вид источника(Источники финансирования дефицита)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 1906, 1, 0, '', 0, 17050) ;

CALL ImportField(190611086, 'Код отправителя записи', 'SenderID', 'Код отправителя записи', 'SenderId', 1, 1906, 1, 1, 'КодОтправителяЗаписи', 0, 17434) ;

CALL ImportField(190611087, '1-й месяц квартала', 'CurMonth1', '1-й месяц квартала', ' ', 1, 1906, 1, 1, '', 0, null) ;

CALL ImportField(190611088, '2-й месяц квартала', 'CurMonth2', '2-й месяц квартала', ' ', 1, 1906, 1, 1, '', 0, null) ;

CALL ImportField(190611089, '3-й месяц квартала', 'CurMonth3', '3-й месяц квартала', ' ', 1, 1906, 1, 1, '', 0, null) ;

CALL ImportField(190611090, 'Сумма на квартал', 'CurQuarter', 'Сумма на квартал', ' ', 1, 1906, 1, 1, '', 0, null) ;

CALL ImportField(190611092, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 1906, 1, 0, '', 0, null) ;

CALL ImportField(190611093, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средствКлюч', 'TransfertCls', 1, 1906, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(190611094, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 1906, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(190611095, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 1906, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(190611096, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 1906, 1, 0, '', 0, 26617) ;

CALL ImportField(190611099, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 1, 1906, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

CALL ImportField(190611101, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 1906, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(190611102, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayParomiseCls', 1, 1906, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

-- Все плановые документы(доходы), Бюджет(1)
CALL ImportField(220010001, 'Дата принятия', '{РусПоле("ДатаПринятия")}', 'Дата принятия(проведения) документа', ' ', 1, 2200, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(220010002, 'Код причины отклонения', '{РусПоле("ПричинаОтклонКод")}', 'Код причины отклонения документа', ' ', 1, 2200, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(220010003, 'Причина отклонения (комментарий)', '{РусПоле("ПричинаОтклонТекст")}', 'Причина отклонения (комментарий)', ' ', 1, 2200, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(220010004, 'Код удалённого клиента', '{РусПоле("КодОтправителяДокумента")}', 'Код удалённого клиента(отправителя документа)', ' ', 1, 2200, 0, 0, 'КодОтправителяДокумента', 0, null) ;

CALL ImportField(220010005, 'Автор документа', '{РусПоле("АвторДокумента")}', 'Автор документа', ' ', 1, 2200, 0, 0, 'АвторДокумента', 0, null) ;

CALL ImportField(220010006, 'Состояние документа', '{РусПоле("СостояниеДокумента")}', 'Состояние документа', ' ', 1, 2200, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(220010007, 'Бюджет', '{РусПоле("КодБюджета")}', 'Бюджет документа', ' ', 1, 2200, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(220010008, 'Лицевой счет', '{РусПоле("ЛицевойСчет")}', 'Лицевой счет', ' ', 1, 2200, 0, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(220010010, 'Статус ЭЦП', '{РусПоле("КриптоСтатус")}', 'Статус ЭЦП', ' ', 1, 2200, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(220010011, 'Вариант росписи', '{РусПоле("ВариантРосписи")}', 'Вариант учета планового документа', ' ', 1, 2200, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(220010012, 'Вид плана', '{РусПоле("ВидПлана")}', 'Вид плана', ' ', 1, 2200, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(220011009, 'Код записи', '{РусПоле("КодЗаписи")}', 'код записи (детализация)', ' ', 1, 2200, 1, 1, 'КодЗаписи', 0, null) ;

-- Кассовый план (доходы), УРМ(0)
CALL ImportField(220100001, 'Период', 'KPPERIOD', '', 'KPPERIOD', 0, 2201, 0, 0, '', 0, null) ;

CALL ImportField(220100002, 'Основание', 'Note', 'Основание', 'Note', 0, 2201, 0, 0, 'Основание', 0, null) ;

CALL ImportField(220100003, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 0, 2201, 0, 0, 'ДатаВвода', 0, null) ;

CALL ImportField(220100004, 'Вариант', 'Variant', 'Вариант', 'Variant', 0, 2201, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(220100005, 'Причина отклонения', 'RejectCls', 'Причина отклонения', 'RejectCls', 0, 2201, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(220100006, 'Источник финансирования', 'NotifyType', 'Источник финансирования', 'NotifyType', 0, 2201, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(220100007, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 0, 2201, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(220100008, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 0, 2201, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(220100009, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 2201, 0, 1, '', 0, null) ;

CALL ImportField(220100010, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 2201, 0, 1, '', 0, null) ;

CALL ImportField(220100011, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 0, 2201, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(220100012, 'Дата документа', 'DocDat', 'Дата перв. документа', 'DocDat', 0, 2201, 0, 0, 'ДатаДокОснования', 0, null) ;

CALL ImportField(220100013, 'Код документа в БД ФО', 'FUId', 'Код документа в БД ФО', 'FUId', 0, 2201, 0, 1, '', 0, null) ;

CALL ImportField(220100014, 'Код документа', 'Id', 'Код документа', 'Id', 0, 2201, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(220100015, 'Признак зависания', 'DocSuspended', '*Признак зависания', 'DocSuspended', 0, 2201, 0, 1, '', 0, null) ;

CALL ImportField(220100016, 'Начальное состояние', 'BeginDocStateRef', 'Начальное состояние', 'BeginDocStateRef', 0, 2201, 0, 1, '', 0, null) ;

CALL ImportField(220100017, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 'Мягкая причина отклонения(текст)', 'SoftRejectCause', 0, 2201, 0, 1, '', 0, null) ;

CALL ImportField(220100018, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'AssignmentSource', 0, 2201, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(220100019, 'Номер документа', 'DocNumber', 'Номер перв. документа', 'DocNumber', 0, 2201, 0, 0, 'НомерДокОснования', 0, null) ;

CALL ImportField(220100020, 'Дополнительная информация', 'Note1', 'Дополнительная информация', 'Note1', 0, 2201, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(220100021, 'По вопросу', 'Note2', 'По вопросу', 'Note2', 0, 2201, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(220100022, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 0, 2201, 0, 0, 'СостояниеДокумента', 0, null) ;

CALL ImportField(220100023, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 2201, 0, 1, '', 0, null) ;

CALL ImportField(220100026, 'Номер', 'ANumber', 'Номер', 'Number', 0, 2201, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(220100028, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', 'DestOrgName', 0, 2201, 0, 0, '', 0, null) ;

CALL ImportField(220100097, 'Состояние', 'DocStateName', 'Состояние', 'DocStateName', 0, 2201, 0, 0, '', 0, null) ;

CALL ImportField(220100108, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 2201, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(220100123, '<Не используется>', 'ProgIndex', '', ' ', 0, 2201, 0, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(220100162, '<Не используется>', 'Ba_Lbo_Flag', '', ' ', 0, 2201, 0, 1, '', 0, null) ;

CALL ImportField(220100163, 'Тип классфикации (заг.)', 'ClsType', '', ' ', 0, 2201, 0, 1, '', 0, null) ;

CALL ImportField(220100165, 'Л/c ФК', 'FacialCode', '', ' ', 0, 2201, 0, 1, '', 0, null) ;

CALL ImportField(220101056, 'Суб.код дохода', 'SUBKD', 'Суб.код дохода', 'SubKd', 0, 2201, 1, 0, 'СубКД', 0, null) ;

CALL ImportField(220101057, 'Код дохода (ключ)', 'KD', 'Код дохода (ключ)', 'KD', 0, 2201, 1, 1, 'КДКлюч', 0, null) ;

CALL ImportField(220101058, 'Сумма на квартал', 'CurQuarter', '', ' ', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101059, '1-й месяц квартала', 'CurMonth1', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101060, '2-й месяц квартала', 'CurMonth2', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101061, '3-й месяц квартала', 'CurMonth3', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101063, 'Квартал4', 'Quarter4', 'Квартал4', 'Quarter4', 0, 2201, 1, 0, 'ПланДоходовКвартал4', 0, null) ;

CALL ImportField(220101065, 'Роспись на первый год', 'SummaYear1', 'Роспись на первый год', 'SummaYear1', 0, 2201, 1, 0, 'ПланДоходовБюджетНаПервыйГод', 0, null) ;

CALL ImportField(220101066, 'Роспись на второй год', 'SummaYear2', 'Роспись на второй год', 'SummaYear2', 0, 2201, 1, 0, 'ПланДоходовБюджетНаВторойГод', 0, null) ;

CALL ImportField(220101067, 'Код записи в БД ФО', 'FUId', 'Код записи в БД ФО', 'FUId', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101068, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 0, 2201, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(220101069, 'Ссылка на рс получ.', 'Acc_ref', 'Ссылка на рс получ.', 'DestAccount', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101070, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 2201, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(220101071, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'AssignmentKind', 0, 2201, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(220101072, 'Код записи', 'Id', '*Код записи', 'Id', 0, 2201, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(220101073, 'Корреспондирующий ЭКР', 'KESRCorr', 'Корреспондирующий ЭКР', 'KESRCorr', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101074, 'Ссылка на заголовок', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 0, 2201, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(220101075, 'Регион', 'RegionCls', 'Регион', 'RegionCls', 0, 2201, 1, 0, 'Регион', 0, null) ;

CALL ImportField(220101076, 'Квартал1', 'Quarter1', 'Квартал1', 'Quarter1', 0, 2201, 1, 0, 'ПланДоходовКвартал1', 0, null) ;

CALL ImportField(220101077, 'Роспись на третий год', 'SummaYear3', 'Роспись на третий год', 'SummaYear3', 0, 2201, 1, 0, 'ПланДоходовБюджетНаТретийГод', 0, null) ;

CALL ImportField(220101078, 'Квартал2', 'Quarter2', 'Квартал2', 'Quarter2', 0, 2201, 1, 0, 'ПланДоходовКвартал2', 0, null) ;

CALL ImportField(220101079, 'Квартал3', 'Quarter3', 'Квартал3', 'Quarter3', 0, 2201, 1, 0, 'ПланДоходовКвартал3', 0, null) ;

CALL ImportField(220101080, 'КФСР', 'Kfsr', 'КФСР', 'DestKfsr', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101081, 'КЭСР', 'Kesr', 'КЭСР', 'DestKesr', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101082, 'КЦСР', 'KCSR', 'КЦСР', 'DestKcsr', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101083, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'DestFacialAccCls', 0, 2201, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(220101084, 'КВСР', 'Kvsr', 'КВСР', 'DestKvsr', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101085, 'КВР', 'Kvr', 'КВР', 'DestKvr', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101086, 'СубКЭСР', 'SubKESR', 'СубКЭСР', 'DestSubKesr', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101090, 'Счет', 'Acc', 'Счет', 'DestAccountName', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101094, 'ЛС в ФК', 'FacialCode', 'ЛС в ФК', 'DestFacialAccClsFacialCode', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101095, 'Источник образования средств', 'FundsSource', 'Источник образования средств', 'FUNDSSOURCE', 0, 2201, 1, 1, 'ИсточникОбразованияСредств', 0, null) ;

CALL ImportField(220101096, 'Январь', 'Month01', 'Январь', 'Month01', 0, 2201, 1, 0, 'ПланДоходовЯнварь', 0, null) ;

CALL ImportField(220101097, 'Февраль', 'Month02', 'Февраль', 'Month02', 0, 2201, 1, 0, 'ПланДоходовФевраль', 0, null) ;

CALL ImportField(220101098, 'Март', 'Month03', 'Март', 'Month03', 0, 2201, 1, 0, 'ПланДоходовМарт', 0, null) ;

CALL ImportField(220101099, 'Апрель', 'Month04', 'Апрель', 'Month04', 0, 2201, 1, 0, 'ПланДоходовАпрель', 0, null) ;

CALL ImportField(220101100, 'Май', 'Month05', 'Май', 'Month05', 0, 2201, 1, 0, 'ПланДоходовМай', 0, null) ;

CALL ImportField(220101101, 'Июнь', 'Month06', 'Июнь', 'Month06', 0, 2201, 1, 0, 'ПланДоходовИюнь', 0, null) ;

CALL ImportField(220101102, 'Июль', 'Month07', 'Июль', 'Month07', 0, 2201, 1, 0, 'ПланДоходовИюль', 0, null) ;

CALL ImportField(220101103, 'Август', 'Month08', 'Август', 'Month08', 0, 2201, 1, 0, 'ПланДоходовАвгуст', 0, null) ;

CALL ImportField(220101104, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 0, 2201, 1, 0, 'ПланДоходовСентябрь', 0, null) ;

CALL ImportField(220101105, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 0, 2201, 1, 0, 'ПланДоходовОктябрь', 0, null) ;

CALL ImportField(220101106, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 0, 2201, 1, 0, 'ПланДоходовНоябрь', 0, null) ;

CALL ImportField(220101107, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 0, 2201, 1, 0, 'ПланДоходовДекабрь', 0, null) ;

CALL ImportField(220101109, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101110, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 0, 2201, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(220101111, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 0, 2201, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(220101180, 'Источник внутр. и внеш. финанс. (Ключ)', 'IFS', 'Источниковая классификация', 'DestIFS', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101183, 'Источник внутр. и внеш. финанс.', 'IFSCode', 'Источник внутр. и внеш. финанс.', 'DestIFS_DescriptionCode', 0, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220101186, 'Код цели', 'TargetCls', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101187, '<Не используется>', 'OnYearIncome', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101188, '<Не используется>', 'On3Year', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101189, '<Не используется>', 'On3YearCharges', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101190, '<Не используется>', 'On3YearIncome', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101192, '<Не используется>', 'OnYearCharges', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101195, 'Тип классфикации (дет.)', 'ClsType', '', ' ', 0, 2201, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(220101196, 'Сумма за год', 'ONYEAR', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101197, 'КВР', 'KVRCode', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101198, 'КЦСР', 'KCSRCode', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101199, 'КВСР', 'KVSRCode', '', ' ', 0, 2201, 1, 1, '', 0, null) ;

CALL ImportField(220101201, 'Индексы данных', 'ProgIndex', '', ' ', 0, 2201, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(220101202, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 0, 2201, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(220101203, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 0, 2201, 1, 0, 'КодСубсидии', 0, null) ;

-- Кассовый план (доходы), Бюджет(1)
CALL ImportField(220110002, 'Вариант', 'VARIANT', 'Вариант', 'Variant', 1, 2201, 0, 0, 'ВариантРосписи', 0, 17474) ;

CALL ImportField(220110003, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 2201, 0, 0, 'НомерДокумента', 0, 17499) ;

CALL ImportField(220110004, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 2201, 0, 0, 'ДатаВвода', 0, 17483) ;

CALL ImportField(220110005, 'Дата принятия', 'Dat', 'Дата принятия', 'Dat', 1, 2201, 0, 0, 'ДатаПринятия', 0, 17465) ;

CALL ImportField(220110006, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 2201, 0, 0, 'КодБюджета', 0, 17472) ;

CALL ImportField(220110008, 'Основание(Основание)', 'NOTE', 'Основание', 'Note', 1, 2201, 0, 0, 'Основание', 0, 17468) ;

CALL ImportField(220110041, 'Код причины отклонения', 'REJECTCLS', 'Причина отклонения', 'RejectCls', 1, 2201, 0, 0, 'ПричинаОтклонКод', 0, 17485) ;

CALL ImportField(220110042, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения(комментарий)', 'RejectCause', 1, 2201, 0, 0, 'ПричинаОтклонТекст', 0, 17486) ;

CALL ImportField(220110043, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 2201, 0, 0, 'ВидПлана', 0, 17487) ;

CALL ImportField(220110045, 'Код документа', 'ID', 'ID', 'Id', 1, 2201, 0, 1, 'КодДокумента', 0, 17464) ;

CALL ImportField(220110052, 'Вид изменений', 'AssignmentSource', 'Классификатор видов изменений', 'ASSIGNMENTSOURCE', 1, 2201, 0, 0, 'ВидИзменений', 0, 17501) ;

CALL ImportField(220110055, 'Код удалённого клиента', 'SENDERID', 'Код удаленного клиента', 'SenderId', 1, 2201, 0, 1, 'КодОтправителяДокумента', 0, 17475) ;

CALL ImportField(220110056, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 2201, 0, 0, 'ЛицевойСчетЗаголовок', 0, 17494) ;

CALL ImportField(220110057, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'note1', 1, 2201, 0, 0, 'ПримечаниеДокумент', 0, 17469) ;

CALL ImportField(220110058, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'note2', 1, 2201, 0, 0, 'ПоВопросу', 0, 17470) ;

CALL ImportField(220110060, 'Главный администратор', 'OrgName', 'Главный администратор', ' ', 1, 2201, 0, 0, '', 0, 16646) ;

CALL ImportField(220110061, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 2201, 0, 1, 'ИндексыДанных', 0, 17493) ;

CALL ImportField(220110062, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_CPT', 1, 2201, 0, 1, 'АвторДокумента', 0, 17477) ;

CALL ImportField(220110067, 'CryptoStatus', 'CryptoStatus', 'CryptoStatus', 'CRYPTOSTATUS', 1, 2201, 0, 1, 'КриптоСтатус', 0, 17490) ;

CALL ImportField(220110068, 'DocStateRef', 'DocStateRef', 'DocStateRef', 'DocStateRef', 1, 2201, 0, 1, 'СостояниеДокумента', 0, 17492) ;

CALL ImportField(220110069, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 2201, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(220111012, 'Код дохода', 'KDValue', 'Код дохода', 'KDValue', 1, 2201, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(220111014, 'Вид дохода(Классификация)', 'DescriptionCode', 'Вид дохода', 'DescriptionCode', 1, 2201, 1, 0, '', 0, 16831) ;

CALL ImportField(220111015, 'Подвид дохода(Классификация)', 'ProgramCode', 'Программа', 'ProgramCode', 1, 2201, 1, 0, '', 0, 16834) ;

CALL ImportField(220111016, 'ЭКД(Классификация)', 'KDKESR', 'ЭКД', 'KDKESR', 1, 2201, 1, 0, '', 0, 16835) ;

CALL ImportField(220111018, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCLS', 1, 2201, 1, 0, 'Регион', 0, 17417) ;

CALL ImportField(220111019, 'Лицевой счет', 'Facialacc_Cls', 'Лицевой cчет', 'DestFacialAccCls', 1, 2201, 1, 0, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(220111020, 'л/с ФК', 'facialcode', 'Мнемокод', 'DestFacialAccClsFacialCode', 1, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220111021, 'Тип средств', 'MeansType', 'Тип cредств', 'DestMeansTypeCls', 1, 2201, 1, 0, 'ТипСредств', 0, 17426) ;

CALL ImportField(220111023, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'Quarter1', 1, 2201, 1, 0, 'ПланДоходовКвартал1', 0, 17421) ;

CALL ImportField(220111024, 'Январь', 'Month01', 'Январь', 'Month01', 1, 2201, 1, 0, 'ПланДоходовЯнварь', 0, 17436) ;

CALL ImportField(220111025, 'Февраль', 'Month02', 'Февраль', 'Month02', 1, 2201, 1, 0, 'ПланДоходовФевраль', 0, 17437) ;

CALL ImportField(220111026, 'Март', 'Month03', 'Март', 'Month03', 1, 2201, 1, 0, 'ПланДоходовМарт', 0, 17438) ;

CALL ImportField(220111027, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'Quarter2', 1, 2201, 1, 0, 'ПланДоходовКвартал2', 0, 17422) ;

CALL ImportField(220111028, 'Апрель', 'Month04', 'Апрель', 'Month04', 1, 2201, 1, 0, 'ПланДоходовАпрель', 0, 17439) ;

CALL ImportField(220111029, 'Май', 'Month05', 'Май', 'Month05', 1, 2201, 1, 0, 'ПланДоходовМай', 0, 17440) ;

CALL ImportField(220111030, 'Июнь', 'Month06', 'Июнь', 'Month06', 1, 2201, 1, 0, 'ПланДоходовИюнь', 0, 17441) ;

CALL ImportField(220111031, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'Quarter3', 1, 2201, 1, 0, 'ПланДоходовКвартал3', 0, 17423) ;

CALL ImportField(220111032, 'Июль', 'Month07', 'Июль', 'Month07', 1, 2201, 1, 0, 'ПланДоходовИюль', 0, 17442) ;

CALL ImportField(220111033, 'Август', 'Month08', 'Август', 'Month08', 1, 2201, 1, 0, 'ПланДоходовАвгуст', 0, 17443) ;

CALL ImportField(220111034, 'Сентябрь', 'Month09', 'Сентябрь', 'Month09', 1, 2201, 1, 0, 'ПланДоходовСентябрь', 0, 17444) ;

CALL ImportField(220111035, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'Quarter4', 1, 2201, 1, 0, 'ПланДоходовКвартал4', 0, 17424) ;

CALL ImportField(220111036, 'Октябрь', 'Month10', 'Октябрь', 'Month10', 1, 2201, 1, 0, 'ПланДоходовОктябрь', 0, 17445) ;

CALL ImportField(220111037, 'Ноябрь', 'Month11', 'Ноябрь', 'Month11', 1, 2201, 1, 0, 'ПланДоходовНоябрь', 0, 17446) ;

CALL ImportField(220111038, 'Декабрь', 'Month12', 'Декабрь', 'Month12', 1, 2201, 1, 0, 'ПланДоходовДекабрь', 0, 17447) ;

CALL ImportField(220111039, 'Примечание', 'NOTE', 'Примечание', 'Note', 1, 2201, 1, 0, 'Примечание', 0, 17431) ;

CALL ImportField(220111046, 'Код дохода(ключ)', 'KD', 'Код дохода (ключ)', 'KD', 1, 2201, 1, 1, 'КДКлюч', 0, 25270) ;

CALL ImportField(220111047, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 2201, 1, 1, '', 0, 17410) ;

CALL ImportField(220111048, 'Код записи', 'ID', 'ID', 'Id', 1, 2201, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(220111053, 'Вид ассигнований', 'AssignmentKind', 'Классификатор видов ассигнований', 'ASSIGNMENTKIND', 1, 2201, 1, 0, 'ВидАссигнований', 0, 17462) ;

CALL ImportField(220111054, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 2201, 1, 1, 'ИндексыДанных', 0, 17432) ;

CALL ImportField(220111060, 'Классификация', 'TreeOwner0', 'Код дохода', ' ', 1, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220111061, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 2201, 1, 1, 'ТипКлассификации', 0, 17453) ;

CALL ImportField(220111062, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 2201, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(220111063, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 2201, 1, 1, 'Автор', 0, 17427) ;

CALL ImportField(220111064, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 2201, 1, 1, 'КодЦелевыхСредствКлюч', 0, 17460) ;

CALL ImportField(220111066, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 2201, 1, 0, '', 0, null) ;

CALL ImportField(220111070, 'Организация', 'Org_ref', 'Ссылка на орг. получ.', 'Org_Ref_Det', 1, 2201, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(220111071, 'Номер л/с', 'FacialCodeEx', '', ' ', 1, 2201, 1, 0, '', 0, 26617) ;

CALL ImportField(220111072, 'Код субсидииКлюч', 'SubsidyCls', '', 'SubsidyCls', 1, 2201, 1, 1, 'КодСубсидииКлюч', 0, 26542) ;

-- Государственные контракты, УРМ+Бюджет(2)
CALL ImportField(250110015, 'Район заказчика', 'Region', '', 'Region', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110019, 'Основание по закону', 'ProtocolReasonText', 'Основание по закону', 'ProtocolReason', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110020, 'Протокол (+)', 'ProtocolNumberTop', '', 'ProtocolNumberTop', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110023, 'Вид документа', 'protocolDocTypeText', 'Вид документа', 'ProtocolDocType', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110024, 'Вид документа', 'protocolDocType', 'Вид документа', 'protocolDocType', 2, 2501, 0, 1, '', 0, null) ;

CALL ImportField(250110034, 'Лицевой счет УФК заказчика', 'FacialCode', '', 'FacialCode', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110039, 'Исполнитель (+)', 'Executer', '', 'Executer', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110046, 'Заказчик (+)', 'ClientAll', '', 'ClientAll', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110047, 'Организация (+)', 'Client', '', 'Client', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110050, 'Тип соглашения', 'AgreementType', '', 'AgreementType', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110051, 'Сумма контракта (+)', 'AgreementSumms', '', 'AgreementSumms', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110058, 'Аванс', 'Advance', '', 'Advance', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110059, 'Номер уточняемого контракта', 'ADJUSTMENTDOCNUMBER', '', 'ADJUSTMENTDOCNUMBER', 2, 2501, 0, 1, '', 0, null) ;

CALL ImportField(250110067, 'Executer_Ref', 'Executer_Ref', '', 'Executer_Ref', 2, 2501, 0, 1, '', 0, null) ;

CALL ImportField(250110068, 'Client_Ref', 'Client_Ref', '', 'Client_Ref', 2, 2501, 0, 1, '', 0, null) ;

CALL ImportField(250110069, 'EXECUTERACCREF', 'EXECUTERACCREF', '', 'EXECUTERACCREF', 2, 2501, 0, 1, '', 0, null) ;

CALL ImportField(250111004, 'Район', 'RegionCls', '', 'RegionCls', 2, 2501, 1, 0, '', 0, null) ;

CALL ImportField(250111006, 'Код продукции', 'ProductCode', '', 'ProductCode', 2, 2501, 1, 0, '', 0, null) ;

CALL ImportField(250111007, 'Продукция (+)', 'Product', '', 'Product', 2, 2501, 1, 0, '', 0, null) ;

CALL ImportField(250111010, 'Код продукции по ОКДП', 'OKDP', '', 'OKDP', 2, 2501, 1, 0, '', 0, null) ;

CALL ImportField(250111012, 'Единица измерения продукции', 'MeasurementName', '', 'MeasurementName', 2, 2501, 1, 0, '', 0, null) ;

CALL ImportField(250111017, 'Наименование получателя', 'ClientName', '', 'ClientName', 2, 2501, 1, 0, '', 0, null) ;

CALL ImportField(250111018, 'КПП получателя', 'ClientKPP', '', 'ClientKPP', 2, 2501, 1, 0, '', 0, null) ;

CALL ImportField(250111019, 'ИНН получателя', 'ClientINN', '', 'ClientINN', 2, 2501, 1, 0, '', 0, null) ;

CALL ImportField(250111020, 'Получатель (+)', 'ClientAll', '', 'ClientAll', 2, 2501, 1, 0, '', 0, null) ;

CALL ImportField(250112005, 'КВР', 'KVR', 'КВР', 'KVR', 2, 2501, 2, 1, '', 0, null) ;

CALL ImportField(250112006, 'КЦСР', 'KCSR', 'КЦСР', 'KCSR', 2, 2501, 2, 1, '', 0, null) ;

CALL ImportField(250112007, 'КВСР', 'KVSR', 'КВСР', 'KVSR', 2, 2501, 2, 1, '', 0, null) ;

-- Договора, УРМ+Бюджет(2)
CALL ImportField(250210007, 'Район', 'Region', '', 'Region', 2, 2502, 0, 0, '', 0, null) ;

CALL ImportField(250210018, 'Исполнитель (+)', 'Executer', '', 'Executer', 2, 2502, 0, 0, '', 0, null) ;

CALL ImportField(250210021, 'Документ закрытия (+)', 'CloseDocTop', '', 'CloseDocTop', 2, 2502, 0, 0, '', 0, null) ;

CALL ImportField(250210027, 'Заказчик (+)', 'ClientAll', '', 'ClientAll', 2, 2502, 0, 0, '', 0, null) ;

CALL ImportField(250210028, 'Организация (+)', 'Client', '', 'Client', 2, 2502, 0, 0, '', 0, null) ;

CALL ImportField(250210031, 'Тип соглашения', 'AgreementType', '', 'AgreementType', 2, 2502, 0, 1, '', 0, null) ;

CALL ImportField(250210032, 'Сумма договора (+)', 'AgreementSumms', '', 'AgreementSumms', 2, 2502, 0, 0, '', 0, null) ;

CALL ImportField(250210039, 'Аванс договора', 'Advance', '', 'Advance', 2, 2502, 0, 0, '', 0, null) ;

CALL ImportField(250210050, 'Executer_Ref', 'Executer_Ref', '', 'Executer_Ref', 2, 2502, 0, 1, '', 0, null) ;

CALL ImportField(250210051, 'Client_Ref', 'Client_Ref', '', 'Client_Ref', 2, 2502, 0, 1, '', 0, null) ;

CALL ImportField(250210052, 'EXECUTERACCREF', 'EXECUTERACCREF', '', 'EXECUTERACCREF', 2, 2502, 0, 1, '', 0, null) ;

CALL ImportField(250210054, 'Ссылка на уточняемый документ', 'AdjustmentRef', '', 'AdjustmentRef', 2, 2502, 0, 1, '', 1, null) ;

CALL ImportField(250211007, 'Документ закрытия (+)', 'CloseDocTop', '', 'CloseDocTop', 2, 2502, 1, 0, '', 0, null) ;

-- Документы исполнения , УРМ+Бюджет(2)
CALL ImportField(250310009, 'Первичный документ исполнения', 'ReturnDoc', '', 'ReturnDoc', 2, 2503, 0, 1, '', 0, null) ;

CALL ImportField(250310010, 'Вид учета', 'Ret_RegistrationType', '', 'Ret_RegistrationType', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310011, 'Реестровый номер документа исполнения', 'Ret_ReestrNumber', '', 'Ret_ReestrNumber', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310012, 'Дата документа исполнения', 'Ret_DocumentDate', '', 'Ret_DocumentDate', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310013, 'Номер документа исполнения', 'Ret_DocNumber', '', 'Ret_DocNumber', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310016, 'Вид учета', 'RegistrationType', '', 'RegistrationType', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310021, 'Расчетный счет получателя', 'RecipientAcc', '', 'RecipientAcc', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310022, 'Номер первичного договора', 'PrimaryAgreementNumber', '', 'PrimaryAgreementNumber', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310023, 'Поставщик', 'OrgSupplier', '', 'OrgSupplier', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310024, 'Получатель', 'OrgRecipient', '', 'OrgRecipient', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310032, 'Этап генерального договора', 'Binding', '', 'Binding', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310033, 'Договор', 'AgreementNumberRest', '', 'AgreementNumberRest', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310035, 'Дата договора', 'AgreementDate', '', 'AgreementDate', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310037, 'Счет поставщика расширенный', 'SupplierAccExpanded', 'Счет поставщика расширенный', 'SupplierAccExpanded', 2, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310038, 'Ссылка на уточняемый документ', 'AdjustmentRef', '', 'AdjustmentRef', 2, 2503, 0, 1, '', 1, null) ;

CALL ImportField(250311006, 'Код продукции', 'ProductCode', '', 'ProductCode', 2, 2503, 1, 0, '', 0, null) ;

CALL ImportField(250311009, 'Код продукции по ОКДП', 'OKDP', '', 'OKDP', 2, 2503, 1, 0, '', 0, null) ;

CALL ImportField(250311010, 'Единица измерения', 'MeasurementClsName', '', 'MeasurementClsName', 2, 2503, 1, 0, '', 0, null) ;

CALL ImportField(250312006, 'Л/с ФК', 'FacialCode', '', 'FacialCode', 2, 2503, 2, 0, '', 0, null) ;

CALL ImportField(250312028, 'Номер уточняемого обязательства', 'ParentNumber', '', 'ParentNumber', 2, 2503, 2, 1, '', 0, null) ;

CALL ImportField(250312036, 'Сумма', 'Summa', '', 'Summa', 2, 2503, 2, 0, '', 0, null) ;

CALL ImportField(250312040, 'Классификация (+)', 'TreeOwner0', '', 'TreeOwner0', 2, 2503, 2, 0, '', 0, null) ;

-- Муниципальные контракты, УРМ+Бюджет(2)
CALL ImportField(250410016, 'Район', 'Region', '', 'Region', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410019, 'Название вида размещения заказа', 'protocolSaleTypeName', 'Название вида размещения заказа', 'protocolSaleTypeName', 2, 2504, 0, 1, '', 0, null) ;

CALL ImportField(250410022, 'Основание по закону', 'ProtocolReasonText', 'Основание по закону', 'ProtocolReason', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410027, 'Вид документа', 'protocolDocTypeText', 'Вид документа', 'ProtocolDocType', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410029, 'Вид документа', 'protocolDocType', 'Вид документа', 'protocolDocType', 2, 2504, 0, 1, '', 0, null) ;

CALL ImportField(250410034, 'Наименование ППО', 'fsOrganName', 'Наименование ППО', 'fsOrganName', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410035, 'Код наименования ППО', 'fsOrganCode', 'Код наименования ППО', 'fsOrganCode', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410045, 'Л/с ФК', 'FacialCode', '', 'FacialCode', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410056, 'Исполнитель (+)', 'Executer', '', 'Executer', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410064, 'Документ закрытия', 'CloseDocTop', '', 'CloseDocTop', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410070, 'Заказчик (+)', 'ClientAll', '', 'ClientAll', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410078, 'Организация (+)', 'Client', '', 'Client', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410087, 'Аванс договора', 'Advance', '', 'Advance', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410089, 'Executer_Ref', 'Executer_Ref', '', 'Executer_Ref', 2, 2504, 0, 1, '', 0, null) ;

CALL ImportField(250410090, 'Client_Ref', 'Client_Ref', '', 'Client_Ref', 2, 2504, 0, 1, '', 0, null) ;

CALL ImportField(250410091, 'EXECUTERACCREF', 'EXECUTERACCREF', '', 'EXECUTERACCREF', 2, 2504, 0, 1, '', 0, null) ;

CALL ImportField(250410093, 'Ссылка на уточняемый документ', 'AdjustmentRef', '', 'AdjustmentRef', 2, 2504, 0, 1, '', 1, null) ;

CALL ImportField(250411006, 'Документ закрытия (+)', 'CloseDocTop', '', 'CloseDocTop', 2, 2504, 1, 0, '', 0, null) ;

CALL ImportField(250414001, 'Классификация (+)', 'TreeOwner0', '', 'TreeOwner0', 2, 2504, 4, 0, '', 0, null) ;

CALL ImportField(250414002, 'Сумма', 'SUMMA', 'Сумма', 'SUMMA', 2, 2504, 4, 0, '', 0, null) ;

CALL ImportField(250414003, 'Примечание', 'Note', 'Примечание', 'Note', 2, 2504, 4, 0, '', 0, null) ;

CALL ImportField(250414004, 'Тип средств', 'MEANSTYPE', 'Тип средств', 'MEANSTYPE', 2, 2504, 4, 0, '', 0, null) ;

CALL ImportField(250414005, 'КВСР', 'KVSRCode', 'КВСР', 'KVSR', 2, 2504, 4, 0, '', 0, null) ;

CALL ImportField(250414006, 'КВСР', 'KVSR', 'КВСР', 'KVSR', 2, 2504, 4, 1, '', 0, null) ;

CALL ImportField(250414007, 'КВР', 'KVRCode', 'КВР', 'KVR', 2, 2504, 4, 0, '', 0, null) ;

CALL ImportField(250414008, 'КВР', 'KVR', 'КВР', 'KVR', 2, 2504, 4, 1, '', 0, null) ;

CALL ImportField(250414009, 'КФСР', 'KFSR', 'КФСР', 'KFSR', 2, 2504, 4, 0, '', 0, null) ;

CALL ImportField(250414010, 'КЭСР', 'KESR', 'КЭСР', 'KESR', 2, 2504, 4, 0, '', 0, null) ;

CALL ImportField(250414011, 'КЦСР', 'KCSRCode', 'КЦСР', 'KCSR', 2, 2504, 4, 0, '', 0, null) ;

CALL ImportField(250414012, 'КЦСР', 'KCSR', 'КЦСР', 'KCSR', 2, 2504, 4, 1, '', 0, null) ;

CALL ImportField(250414013, 'Год', 'FinYear', 'Год', 'FinYear', 2, 2504, 4, 0, '', 0, null) ;

-- Операции со счетами через распоряжение на финансирование, Бюджет(1)
CALL ImportField(280110001, '№ документа', 'DocNumber', '№ документа', ' ', 1, 2801, 0, 0, 'НомерДокумента', 0, 17303) ;

CALL ImportField(280110002, 'Дата ввода', 'BuildDate', 'Дата ввода', ' ', 1, 2801, 0, 0, 'ДатаВвода', 0, 17306) ;

CALL ImportField(280110003, 'Примечание', 'Note', 'Примечание', ' ', 1, 2801, 0, 0, 'Примечание', 0, 17304) ;

CALL ImportField(280110018, 'Код документа', 'id', 'id', ' ', 1, 2801, 0, 1, 'КодДокумента', 0, 17302) ;

CALL ImportField(280110022, 'Бюджет', 'BudgetRef', 'Бюджет', ' ', 1, 2801, 0, 0, 'КодБюджета', 0, 17305) ;

CALL ImportField(280111004, 'Со счета', 'PayerAcc', 'Со счета', ' ', 1, 2801, 1, 0, '', 0, 17112) ;

CALL ImportField(280111008, 'На счет', 'AcceptorAcc', 'На счет', ' ', 1, 2801, 1, 0, '', 0, 17112) ;

CALL ImportField(280111012, 'Дата ввода', 'InputDate', 'Дата ввода', ' ', 1, 2801, 1, 0, '', 0, 17167) ;

CALL ImportField(280111014, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 2801, 1, 0, 'ТипСредств', 0, 17201) ;

CALL ImportField(280111015, 'Сумма', 'Summa', 'Сумма', ' ', 1, 2801, 1, 0, '', 0, 17173) ;

CALL ImportField(280111016, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 2801, 1, 0, 'БухОперация', 0, 17200) ;

CALL ImportField(280111017, 'Примечание', 'TextNote', 'Примечание', ' ', 1, 2801, 1, 0, 'ПримечаниеДеталь', 0, 17178) ;

CALL ImportField(280111019, 'Счет получателя', 'AcceptorAttrRef', 'AcceptorAttrRef', ' ', 1, 2801, 1, 1, 'СчетПолуч', 0, 17171) ;

CALL ImportField(280111020, 'Код записи', 'id', 'id', ' ', 1, 2801, 1, 1, 'КодЗаписи', 0, 17165) ;

CALL ImportField(280111021, 'Счет плательщика', 'PayerAttrRef', 'PayerAttrRef', ' ', 1, 2801, 1, 1, 'СчетПлат', 0, 17170) ;

CALL ImportField(280111022, 'Код целевых средствКлюч', 'TransfertCLS', '', ' ', 1, 2801, 1, 1, 'КодЦелевыхСредствКлюч', 0, 26638) ;

-- Операции со счетами, УРМ(0)
CALL ImportField(280200017, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 0, 2802, 0, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(280200018, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 2802, 0, 0, '', 0, null) ;

-- Операции со счетами, Бюджет(1)
CALL ImportField(280210001, 'Дата', 'ACCEPTDATE', 'Дата', ' ', 1, 2802, 0, 0, 'ДатаПринятия', 0, 17288) ;

CALL ImportField(280210002, 'Район', 'RegionCLS', 'Район', ' ', 1, 2802, 0, 0, 'Регион', 0, 17291) ;

CALL ImportField(280210003, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 2802, 0, 0, 'КодБюджета', 0, 17292) ;

CALL ImportField(280210004, 'Со счета', 'SourceAcc', 'Со счета', ' ', 1, 2802, 0, 0, '', 0, 17112) ;

CALL ImportField(280210005, 'На счет', 'DestAcc', 'На счет', ' ', 1, 2802, 0, 0, '', 0, 17112) ;

CALL ImportField(280210006, 'Сумма', 'Summa', 'Сумма', ' ', 1, 2802, 0, 0, '', 0, 17293) ;

CALL ImportField(280210007, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 2802, 0, 0, 'ТипСредств', 0, 17298) ;

CALL ImportField(280210008, 'Операция', 'BuhOperationCLS', 'Операция', ' ', 1, 2802, 0, 0, 'БухОперация', 0, 17297) ;

CALL ImportField(280210009, 'Примечание', 'Note', 'Примечание', ' ', 1, 2802, 0, 0, 'Примечание', 0, 17294) ;

CALL ImportField(280210010, 'Источник образования', 'FundsSource', 'Источник образования', ' ', 1, 2802, 0, 0, 'ИсточникОбразованияСредств', 0, 17300) ;

CALL ImportField(280210011, 'Код документа', 'ID', 'ID', ' ', 1, 2802, 0, 1, 'КодДокумента', 0, 17287) ;

CALL ImportField(280210012, 'Со счета', 'SDFACCOUNT', 'Со счета', ' ', 1, 2802, 0, 1, 'СчетПлат', 0, 17289) ;

CALL ImportField(280210013, 'На счет', 'DDFACCOUNT', 'На счет', ' ', 1, 2802, 0, 1, 'СчетПолуч', 0, 17290) ;

CALL ImportField(280210015, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 1, 2802, 0, 1, 'КодЦелевыхСредствКлюч', 0, 25296) ;

-- Заявка на закупку продукции, УРМ+Бюджет(2)
CALL ImportField(300110002, 'Фин-ие за год', 'YearSumma', 'Фин-ие за год', 'YearSumma', 2, 3001, 0, 0, '', 0, null) ;

CALL ImportField(300110010, 'Итого', 'SUMMA', 'Итого', 'SUMMA', 2, 3001, 0, 0, '', 0, null) ;

CALL ImportField(300110011, 'Форма и размер обеспечения исполнения контракта', 'Security', '', 'Security', 2, 3001, 0, 0, '', 0, null) ;

CALL ImportField(300110016, 'Размер предоставленного преимущества организаций (%)', 'PreferenceSize', '', 'PreferenceSize', 2, 3001, 0, 0, '', 0, null) ;

CALL ImportField(300110017, 'Преимущества организаций', 'Preference', '', 'Preference', 2, 3001, 0, 0, '', 0, null) ;

CALL ImportField(300110023, 'Организация - Заказчик (+)', 'FacialAccClsCol', 'Организация - Заказчик', 'FacialAccClsCol', 2, 3001, 0, 0, '', 0, null) ;

CALL ImportField(300111001, 'Сумма НДС', 'VatSumma', '', 'VatSumma', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111003, 'Классификация (+)', 'TreeOwner0', '', 'TreeOwner0', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111005, 'Сумма', 'TotalSumma', '', 'TotalSumma', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111006, 'Предмет заявки', 'TenderObjectCls', 'Предмет заявки', 'TenderObjectCls', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111007, 'Стоимость', 'Summa', 'Стоимость', 'Summa', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111010, 'Стоимость', 'Quarter4', 'Стоимость', 'Quarter4', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111011, 'Стоимость', 'Quarter3', 'Стоимость', 'Quarter3', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111012, 'Стоимость', 'Quarter2', 'Стоимость', 'Quarter2', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111013, 'Стоимость', 'Quarter1', 'Стоимость', 'Quarter1', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111015, 'Продукция', 'ProductCollaps', '', 'ProductCollaps', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111016, 'Код продукции', 'ProductCode', '', 'ProductCode', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111018, 'Цена', 'Price', 'Цена', 'Price', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111019, 'ОКДП', 'OKDP', 'ОКДП', 'OKDP', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111023, 'Стоимость', 'Month12', 'Стоимость', 'Month12', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111024, 'Стоимость', 'Month11', 'Стоимость', 'Month11', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111025, 'Стоимость', 'Month10', 'Стоимость', 'Month10', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111026, 'Стоимость', 'Month09', 'Стоимость', 'Month09', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111027, 'Стоимость', 'Month08', 'Стоимость', 'Month08', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111028, 'Стоимость', 'Month07', 'Стоимость', 'Month07', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111029, 'Стоимость', 'Month06', 'Стоимость', 'Month06', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111030, 'Стоимость', 'Month05', 'Стоимость', 'Month05', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111031, 'Стоимость', 'Month04', 'Стоимость', 'Month04', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111032, 'Стоимость', 'Month03', 'Стоимость', 'Month03', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111033, 'Стоимость', 'Month02', 'Стоимость', 'Month02', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111034, 'Стоимость', 'Month01', 'Стоимость', 'Month01', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111037, 'Лот', 'LotCol', 'Лот', 'LotCol', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111038, 'КВСР', 'KVSR', 'КВСР', 'KVSR', 2, 3001, 1, 1, '', 0, null) ;

CALL ImportField(300111039, 'КВР', 'KVR', 'КВР', 'KVR', 2, 3001, 1, 1, '', 0, null) ;

CALL ImportField(300111042, 'КЦСР', 'KCSR', 'КЦСР', 'KCSR', 2, 3001, 1, 1, '', 0, null) ;

CALL ImportField(300111046, 'Условие финансирования', 'FinSpec', 'Условие финансирования', 'FinSpec', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111050, 'Организация - Заказчик (+)', 'FacialAccClsCol', 'Организация - Заказчик', 'FacialAccClsCol', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111055, 'Условие поставки', 'DeliverySpec', 'Условие поставки', 'DeliverySpec', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111057, 'Периодичность поставки', 'DeliveryPeriod', 'Периодичность поставки', 'DeliveryPeriod', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111062, 'Объем разовой поставки', 'DeliveryAmount', 'Объем разовой поставки', 'DeliveryAmount', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111063, 'Стоимость по цене', 'Cost', '', 'Cost', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300111064, 'Количество', 'Amount', 'Количество', 'Amount', 2, 3001, 1, 0, '', 0, null) ;

CALL ImportField(300112001, 'Название', 'ORGNAME', 'Название', 'ORGNAME', 2, 3001, 2, 0, '', 0, null) ;

CALL ImportField(300112002, 'Местоположение', 'ORG_CITY', 'Местоположение', 'ORG_CITY', 2, 3001, 2, 0, '', 0, null) ;

CALL ImportField(300112003, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 2, 3001, 2, 0, '', 0, null) ;

CALL ImportField(300113001, 'Условия поставки. Текст', 'TermsOfDeliveryNote', 'Условия поставки. Текст', 'TermsOfDeliveryNote', 2, 3001, 3, 1, '', 0, null) ;

CALL ImportField(300113002, 'Условия поставки. ИНКОТЕРМС', 'TermsOfDelivery', 'Условия поставки. ИНКОТЕРМС', 'TermsOfDelivery', 2, 3001, 3, 1, '', 0, null) ;

CALL ImportField(300113003, 'Срок заключения контракта', 'StretchContract', 'Срок заключения контракта', 'StretchContract', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113004, 'Обеспечение заявки на участие в размещении заказа', 'SecurityTNote', 'Обеспечение заявки на участие в размещении заказа', 'SecurityTNote', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113005, 'Обеспечение исполнения контракта', 'SecurityANote', 'Обеспечение исполнения контракта', 'SecurityANote', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113006, 'Преимущества для учреждений УИС (%)', 'PreferencePrison', 'Преимущества для учреждений УИС (%)', 'PreferencePrison', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113007, 'Предоставляемые преимущества', 'PreferenceNote', 'Предоставляемые преимущества', 'PreferenceNote', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113008, 'Преимущества для организаций инвалидов (%)', 'PreferenceCripple', 'Преимущества для организаций инвалидов (%)', 'PreferenceCripple', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113009, 'Место поставки. Текст', 'OKATONote', 'Место поставки. Текст', 'OKATONote', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113010, 'Место поставки. ОКАТО', 'OKATO', 'Место поставки. ОКАТО', 'OKATO', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113011, 'Номер лота', 'LotNumber', 'Номер лота', 'LotNumber', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113012, 'Наименование лота', 'LotNote', 'Наименование лота', 'LotNote', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113013, 'Сроки и объем предоставляемых гарантий (объем)', 'GuarantySize', 'Сроки и объем предоставляемых гарантий (объем)', 'GuarantySize', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113014, 'Сроки и объем предоставляемых гарантий', 'Guaranty', 'Сроки и объем предоставляемых гарантий', 'Guaranty', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113015, 'Сведения о расходах, включенных в цену товара, работы, услуги', 'FinNote', 'Сведения о расходах, включенных в цену товара, работы, услуги', 'FinNote', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113016, 'Условия (текст)', 'DeliverySpecNote', '', 'DeliverySpecNote', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113017, 'Условия поставки товара, выполнения работ, оказания услуг (+)', 'DeliverySpecCol', '', 'DeliverySpecCol', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113018, 'Код условия поставки', 'DeliverySpec', '', 'DeliverySpec', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113019, 'Сроки поставки. Текст', 'DeliveryNote', 'Сроки поставки. Текст', 'DeliveryNote', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113020, 'Форма, сроки и порядок оплаты продукции, работ, услуг', 'DeliveryFormNote', 'Форма, сроки и порядок оплаты продукции, работ, услуг', 'DeliveryFormNote', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113021, 'Сроки поставки. Дата окончания поставки', 'DeliveryEndDate', 'Сроки поставки. Дата окончания поставки', 'DeliveryEndDate', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113022, 'Сроки поставки. Дата начала поставки', 'DeliveryDate', 'Сроки поставки. Дата начала поставки', 'DeliveryDate', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113023, 'Размер обеспечения на участие', 'SecurityTSize', 'Размер обеспечения на участие', 'SecurityTSize', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300113024, 'Размер обеспечения исполнения', 'SecurityASize', 'Размер обеспечения исполнения', 'SecurityASize', 2, 3001, 3, 0, '', 0, null) ;

CALL ImportField(300114001, 'Тип критерия/требования', 'YardStickType', '', 'YardStickType', 2, 3001, 4, 0, '', 0, null) ;

CALL ImportField(300114002, 'Примечание к критерию / условию', 'YardstickNote', 'Примечание к критерию / условию', 'YardstickNote', 2, 3001, 4, 0, '', 0, null) ;

CALL ImportField(300114003, 'Критерий/требование', 'YardStickName', '', 'YardStickName', 2, 3001, 4, 0, '', 0, null) ;

CALL ImportField(300114004, 'Примечание критерия', 'YardNote', '', 'YardNote', 2, 3001, 4, 0, '', 0, null) ;

CALL ImportField(300114006, 'Подкритерий / подусловие', 'UYardstick', 'Подкритерий / подусловие', 'UYardstick', 2, 3001, 4, 0, '', 0, null) ;

CALL ImportField(300114009, 'Код продукции', 'ProductCode', 'Код продукции', 'ProductCode', 2, 3001, 4, 0, '', 0, null) ;

CALL ImportField(300114010, 'Продукция', 'Product', 'Продукция', 'Product', 2, 3001, 4, 0, '', 0, null) ;

CALL ImportField(300114011, 'Коэффициент весомости', 'Ponderability', 'Коэффициент весомости', 'Ponderability', 2, 3001, 4, 0, '', 0, null) ;

CALL ImportField(300115001, 'Контактное лицо', 'PersonCollaps', '', 'PersonCollaps', 2, 3001, 5, 0, '', 0, null) ;

CALL ImportField(300115002, 'ФИО контактного лица', 'Name', '', 'Name', 2, 3001, 5, 0, '', 0, null) ;

CALL ImportField(300115003, 'Статус контактного лица', 'Status', 'Статус контактного лица', 'Status', 2, 3001, 5, 0, '', 0, null) ;

CALL ImportField(300116001, 'Примечание', 'Note', '', 'Note', 2, 3001, 6, 0, '', 0, null) ;

CALL ImportField(300116002, 'Тип документа', 'DocTypeCls', '', 'DocTypeCls', 2, 3001, 6, 0, '', 0, null) ;

CALL ImportField(300117001, 'Условие допуска', 'TermsLimitName', '', 'TermsLimitName', 2, 3001, 7, 0, '', 0, null) ;

CALL ImportField(300117002, 'Начальное значение', 'StartValue', 'Начальное значение', 'StartValue', 2, 3001, 7, 0, '', 0, null) ;

CALL ImportField(300117003, 'Наименование продукции', 'ProductName', 'Наименование продукции', 'ProductName', 2, 3001, 7, 0, '', 0, null) ;

CALL ImportField(300117004, 'Код продукции', 'ProductCode', 'Код продукции', 'ProductCode', 2, 3001, 7, 0, '', 0, null) ;

CALL ImportField(300117005, 'Продукция', 'Product', 'Продукция', 'Product', 2, 3001, 7, 0, '', 0, null) ;

CALL ImportField(300117007, 'Номер лота', 'LotNumber', 'Номер лота', 'LotNumber', 2, 3001, 7, 0, '', 0, null) ;

CALL ImportField(300117008, 'Наименование лота', 'LotNote', 'Наименование лота', 'LotNote', 2, 3001, 7, 0, '', 0, null) ;

CALL ImportField(300117009, 'Лот', 'Lot', 'Лот', 'Lot', 2, 3001, 7, 0, '', 0, null) ;

CALL ImportField(300117010, 'Требование', 'DemandName', 'Требование', 'DemandName', 2, 3001, 7, 0, '', 0, null) ;

CALL ImportField(300118002, 'Требование', 'SDDemandName', 'Требование', 'SDDemandName', 2, 3001, 8, 0, '', 0, null) ;

CALL ImportField(300118003, 'Продукция', 'ProductName', 'Продукция', 'ProductName', 2, 3001, 8, 0, '', 0, null) ;

CALL ImportField(300118006, 'Лот', 'LotNote', 'Лот', 'LotNote', 2, 3001, 8, 0, '', 0, null) ;

CALL ImportField(300118007, 'Тип', 'DocTypeName', 'Тип', 'DocTypeName', 2, 3001, 8, 0, '', 0, null) ;

-- Итоги конкурса, УРМ+Бюджет(2)
CALL ImportField(300310003, 'Сумма с учетом НДС', 'TotalSumma', '', 'TotalSumma', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310004, 'Цена с НДС', 'TotalPrice', '', 'TotalPrice', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310005, 'Сумма заявки', 'TenderSumma', '', 'TenderSumma', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310006, 'Наименование продукции', 'TenderObjectName', '', 'TenderObjectName', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310007, 'Код продукции', 'TenderObjectCode', '', 'TenderObjectCode', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310008, 'Лицевой счет', 'TenderFacialAccCls', '', 'TenderFacialAccCls', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310009, 'Номер заявки', 'TenderDocNumber', '', 'TenderDocNumber', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310010, 'Поставщик', 'SupplierName', '', 'SupplierName', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310011, 'КПП поставщика', 'SupplierKPP', '', 'SupplierKPP', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310013, 'Поставщик (заголовок)', 'SupplierCollaps', '', 'SupplierCollaps', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310017, 'Сумма заявки за год', 'RestSumma', '', 'RestSumma', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310020, 'Причина отмены конкурса (текст)', 'REASONTEXT', '', 'REASONTEXT', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310021, 'Причина отмены конкурса', 'REASONCODE', '', 'REASONCODE', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310022, 'Основание по закону', 'ProtocolReasonText', '', 'ProtocolReasonText', 2, 3003, 0, 0, '', 0, null) ;

CALL ImportField(300310024, 'Вид документа', 'ProtocolDocTypeText', '', 'ProtocolDocTypeText', 2, 3003, 0, 0, '', 0, null) ;

CALL ImportField(300310029, 'Сумма заявки утв.', 'PaymentScheduleSumma', '', 'PaymentScheduleSumma', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310030, 'Код продукции по ОКДП', 'OKDP', '', 'OKDP', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310032, 'Единица измерения', 'MeasurementName', '', 'MeasurementName', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310033, 'Дата документа', 'DocumentDate', '', 'DocumentDate', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310034, 'Номер контракта', 'ContractNumber', '', 'ContractNumber', 2, 3003, 0, 0, '', 0, null) ;

CALL ImportField(300310035, 'Дата контракта', 'ContractDate', '', 'ContractDate', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310036, 'Контракт (заголовок)', 'ContractCollaps', '', 'ContractCollaps', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310039, 'Реестровый номер договора', 'AgreementReestrNumber', '', 'AgreementReestrNumber', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310040, '№ договора', 'AgreementDocNumber', '', 'AgreementDocNumber', 2, 3003, 0, 0, '', 0, null) ;

CALL ImportField(300310041, 'Дата договора', 'AgreementDate', '', 'AgreementDate', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310042, 'Договор (заголовок)', 'AgreementCollaps', '', 'AgreementCollaps', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310043, 'Дата принятия ФО', 'AcceptDateFO', '', 'AcceptDateFO', 2, 3003, 0, 1, '', 0, null) ;

CALL ImportField(300310045, 'Закупаемое количество', 'AcceptAmount', '', 'AcceptAmount', 2, 3003, 0, 1, '', 0, null) ;

-- План-график, УРМ+Бюджет(2)
CALL ImportField(300610011, 'Организация', 'Org_Name', '', 'Org_Name', 2, 3006, 0, 0, '', 0, null) ;

CALL ImportField(300610013, 'Организация - Заказчик (+)', 'FacialAccClsCol', '', 'FacialAccClsCol', 2, 3006, 0, 0, '', 0, null) ;

CALL ImportField(300610021, 'Основание по закону', 'ProtocolReason', '', 'ProtocolReason', 2, 3006, 0, 1, '', 0, null) ;

CALL ImportField(300610022, 'Основание по закону', 'ProtocolReasonText', '', 'ProtocolReasonText', 2, 3006, 0, 0, '', 0, null) ;

CALL ImportField(300611001, 'Процент НДС', 'VATPercent', '', 'VATPercent', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611004, 'Организация', 'Org_Name', '', 'Org_Name', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611007, 'Единица измерения', 'Measurement_Name', '', 'Measurement_Name', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611009, 'КЦСР', 'KCSR', '', 'KCSR', 2, 3006, 1, 1, '', 0, null) ;

CALL ImportField(300611011, 'Организация - Заказчик (+)', 'FacialAccClsCol', '', 'FacialAccClsCol', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611013, 'Сумма НДС', 'AcceptVATSumma', '', 'AcceptVATSumma', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611020, 'Цена без налогов', 'AcceptPrice', '', 'AcceptPrice', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611033, 'Стоимость без НДС', 'AcceptCost', '', 'AcceptCost', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611035, 'Бюджетная классификация (+)', 'TreeOwner0', 'Бюджетная классификация', 'TreeOwner0', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611036, 'КВСР', 'KVSR', 'КВСР', 'KVSR', 2, 3006, 1, 1, '', 0, null) ;

CALL ImportField(300611038, 'КВР', 'KVR', 'КВР', 'KVR', 2, 3006, 1, 1, '', 0, null) ;

CALL ImportField(300611040, 'Характеристика продукции', 'TenderObjectAttr', 'Характеристика продукции', 'TenderObjectAttr', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300612001, 'Контакное лицо (+)', 'PersonCollaps', '', 'PersonCollaps', 2, 3006, 2, 0, '', 0, null) ;

-- Консолидация бюджетной отчетности, УРМ(0)
CALL ImportField(361000001, 'ДатаОтчета', 'ReportDate', 'Дата отчета', 'ДатаОтчета', 0, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361000002, 'Месяц', 'ReportMonth', 'Месяц', 'Месяц', 0, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361000004, 'Год', 'ReportYear', 'Год', 'Год', 0, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361000005, 'НомерДокумента', 'DocNumber', 'Номер документа', 'НомерДокумента', 0, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361000006, 'Регион', 'RegionCLS', 'Регион', 'Регион', 0, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361000008, 'Вид деятельности', 'ActivityKind', 'Вид деятельности', 'ВидДеятельности', 0, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361000009, 'Причина отклонения', 'RejectCLS', 'Причина отклонения', 'ПричинаОтклонения', 0, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361000010, 'Причина отклонения комментарий', 'RejectCause', 'Причина отклонения комментарий', 'ПричинаОтклоненияКомментарий', 0, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361000011, 'Примечание документа', 'Note', 'Примечание документа', 'ПримечаниеДокумента', 0, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361000012, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'ДатаПринятия', 0, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361000013, 'Информация об ошибках', 'ERROR', 'Информация об ошибках', 'ERROR', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000014, 'МДК', 'ClientsType', 'МДК', 'МДК', 0, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361000016, 'Вышестоящая организация', 'HigherOrgRef', 'Вышестоящая организация', ' ', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000017, 'Код формы ввода', 'TYPEDFORM', 'Код формы ввода', ' ', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000019, 'Файл шаблона формы ввода', 'TYPEDFORMTMPLT', 'Файл шаблона формы ввода', ' ', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000020, 'Период', 'PERIOD', 'Период', ' ', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000021, 'Имя отчета', 'TypedFormName', 'Имя отчета', ' ', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000022, 'Индекс группы', 'GroupIndex', 'Индекс группы', ' ', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000023, 'Состояние документа', 'DocStateName', 'Состояние документа', 'DocStateName', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000024, 'Мягкая причина отклонения (текст)', 'SoftRejectCause', 'Мягкая причина отклонения (текст)', 'SoftRejectCause', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000025, 'Мягкая причина отклонения', 'SoftRejectCls', 'Мягкая причина отклонения', 'SoftRejectCls', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000026, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000027, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000028, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000029, 'Код документа', 'ID', 'Код документа', 'Id', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000030, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000031, 'Состояние документа(код)', 'DocStateRef', 'Состояние документа(код)', 'DocStateRef', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000032, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 3610, 0, 1, '', 0, null) ;

CALL ImportField(361000193, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 0, 3610, 0, 0, 'КодБюджета', 0, null) ;

-- Консолидация бюджетной отчетности, Бюджет(1)
CALL ImportField(361010001, 'Дата ввода', 'ReportDate', 'Дата отчета', 'ДатаОтчета', 1, 3610, 0, 0, 'ДатаОтчета', 0, null) ;

CALL ImportField(361010002, 'Месяц', 'ReportMonth', 'Месяц', 'Месяц', 1, 3610, 0, 0, 'Месяц', 0, null) ;

CALL ImportField(361010003, 'Квартал', 'QUARTER', 'Квартал', 'QUARTER', 1, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361010004, 'Год', 'ReportYear', 'Год', 'Год', 1, 3610, 0, 0, 'Год', 0, null) ;

CALL ImportField(361010005, 'Номер документа', 'DocNumber', 'Номер документа', 'НомерДокумента', 1, 3610, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(361010006, 'Регион', 'RegionCLS', 'Регион', 'Регион', 1, 3610, 0, 0, 'Регион', 0, null) ;

CALL ImportField(361010008, 'Вид деятельности', 'ActivityKind', 'Вид деятельности', 'ВидДеятельности', 1, 3610, 0, 0, 'ВидДеятельности', 0, null) ;

CALL ImportField(361010009, 'Код причины отклонения', 'RejectCLS', 'Причина отклонения', 'ПричинаОтклонения', 1, 3610, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(361010010, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения комментарий', 'ПричинаОтклоненияКомментарий', 1, 3610, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(361010011, 'Примечание', 'Note', 'Примечание документа', 'ПримечаниеДокумента', 1, 3610, 0, 0, 'ПримечаниеДокумента', 0, null) ;

CALL ImportField(361010012, 'Принят', 'AcceptDate', 'Дата принятия', 'ДатаПринятия', 1, 3610, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(361010013, 'ERROR', 'ERROR', 'Информация об ошибках', 'ERROR', 1, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361010014, 'ТипКлиентов', 'ClientsType', 'Тип клиентов (Принадлежность)', 'ТипКлиентов', 1, 3610, 0, 0, 'ТипКлиентов', 0, null) ;

CALL ImportField(361010015, 'КатегорияОтчета', 'DataMode', 'Категория отчета (Вид отчета)', 'КатегорияОтчета', 1, 3610, 0, 0, 'КатегорияОтчета', 0, null) ;

CALL ImportField(361010348, 'Состояние', 'UCONSICON', 'Состояние', ' ', 1, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361010349, 'Дата сдачи', 'ESTIMDATE', 'Дата сдачи', ' ', 1, 3610, 0, 0, 'ДатаСдачи', 0, null) ;

CALL ImportField(361010350, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 3610, 0, 0, 'Бюджет', 0, null) ;

CALL ImportField(361010351, 'Код клиента', 'ConsClient', 'Код клиента', ' ', 1, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361010352, 'Л/с получателя', 'MasterFacialAcc', 'Л/с получателя', ' ', 1, 3610, 0, 0, '', 0, null) ;

CALL ImportField(361010353, 'Код формы ввода', 'TYPEDFORM', 'Код формы ввода', ' ', 1, 3610, 0, 0, 'КодФормы', 0, null) ;

CALL ImportField(361010354, 'Период', 'PERIOD', '', ' ', 1, 3610, 0, 0, 'Период', 0, null) ;

CALL ImportField(361010355, 'Код документа', 'ID', 'Код документа', 'id', 1, 3610, 0, 1, 'КодДокумента', 0, null) ;

-- Каталогизация продукции, УРМ+Бюджет(2)
CALL ImportField(370110012, 'КЭСР', 'KESR', '', 'KESR', 2, 3701, 0, 0, '', 0, null) ;

CALL ImportField(370110016, 'Код', 'Code', '', 'Code', 2, 3701, 0, 0, '', 0, null) ;

-- Расходные расписания, УРМ(0)
CALL ImportField(440100001, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', 'AcceptDate', 0, 4401, 0, 0, 'ДатаПринятия', 0, 21688) ;

CALL ImportField(440100003, 'Код бюджета', 'BUDGETREF', 'Код бюджета', 'BudgetRef', 0, 4401, 0, 1, 'КодБюджета', 0, 21683) ;

CALL ImportField(440100004, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CryptoStatus', 0, 4401, 0, 1, 'КриптоСтатус', 0, 21700) ;

CALL ImportField(440100005, 'Ссылка на р\с финоргана', 'DFACCOUNT', 'Ссылка на р\с финоргана', 'DFAccount', 0, 4401, 0, 1, 'РСФО', 0, 21687) ;

CALL ImportField(440100006, 'Номер документа', 'DocNumber', 'Номер документа', 'DocNumber', 0, 4401, 0, 0, 'НомерДокумента', 0, 21684) ;

CALL ImportField(440100007, 'Состояние документа', 'DOCSTATEREF', 'Состояние документа', 'DocStateRef', 0, 4401, 0, 1, 'СостояниеДокумента', 0, 21701) ;

CALL ImportField(440100008, 'Формат документа', 'DOCUMENTFORMAT', 'Формат документа', 'DocumentFormat', 0, 4401, 0, 1, 'ФорматДокумента', 0, 21692) ;

CALL ImportField(440100009, 'Лицевой счет', 'FACIALACCCLS', 'Лицевой счет', 'FacialAccCLS', 0, 4401, 0, 1, 'ЛицевойСчет', 0, 21691) ;

CALL ImportField(440100012, 'Дата формирования', 'InputDate', 'Дата ввода', 'InputDate', 0, 4401, 0, 1, 'ДатаВвода', 0, 21686) ;

CALL ImportField(440100016, 'Приложение', 'Note', 'Приложение', 'Note', 0, 4401, 0, 0, 'Приложение', 0, 21695) ;

CALL ImportField(440100017, 'Порядковый номер документа по распорядителю', 'NotifyNumber', 'Порядковый номер документа по распорядителю', 'NotifyNumber', 0, 4401, 0, 0, 'НомерДокументаРаспорядителя', 0, 21685) ;

CALL ImportField(440100018, 'Уровень', 'NotifyType', 'Тип уведомления', 'NotifyType', 0, 4401, 0, 1, 'ТипСводногоУведомления', 0, 21694) ;

CALL ImportField(440100019, 'Индексы данных', 'PROGINDEX', 'Индексы данных', 'ProgIndex', 0, 4401, 0, 1, 'ИндексыДанных', 0, 21690) ;

CALL ImportField(440100020, 'Код отправителя документа', 'SENDERID', 'Код отправителя документа', 'SenderID', 0, 4401, 0, 1, 'КодОтправителяДокумента', 0, 21698) ;

CALL ImportField(440100021, 'Код УРМ документа', 'SENDERRECORDID', 'Код УРМ документа', 'SenderRecordID', 0, 4401, 0, 1, 'КодУРМДокумента', 0, 21699) ;

CALL ImportField(440100022, 'Специальные указания', 'SpecialNote', 'Специальные указания', 'SpecialNote', 0, 4401, 0, 1, 'СпециальныеУказания', 0, 21697) ;

CALL ImportField(440100033, 'Код документа', 'ID', 'Код документа', 'ID', 0, 4401, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(440100039, 'Причина отклонения', 'RejectCLS', 'Причина отклонения', 'REJECTCLS', 0, 4401, 0, 0, 'ПричинаОтклонКод', 0, 21707) ;

CALL ImportField(440100040, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'REJECTCAUSE', 0, 4401, 0, 0, 'ПричинаОтклонТекст', 0, 21708) ;

CALL ImportField(440100041, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CreaterUser', 0, 4401, 0, 1, 'АвторДокумента', 0, 21703) ;

CALL ImportField(440100042, 'Изменил(Авторизация)', 'UPDATERUSER', 'Изменил(Авторизация)', 'UpdaterUser', 0, 4401, 0, 1, 'АвторИзмененийДокумента', 0, 21705) ;

CALL ImportField(440100043, 'Дата изменения(Авторизация)', 'UPDATEDATE', 'Дата изменения(Авторизация)', 'UpdateDate', 0, 4401, 0, 1, 'ДатаВремяИзмененияДокумента', 0, 21706) ;

CALL ImportField(440100044, 'Дата создания(Авторизация)', 'CREATEDATE', 'Дата создания(Авторизация)', 'CreateDate', 0, 4401, 0, 1, 'ДатаВремяСозданияДокумента', 0, 21704) ;

CALL ImportField(440100045, 'Организация', 'Org_Ref', 'Org_Ref', 'Организация', 0, 4401, 0, 1, 'Организация', 0, 21693) ;

CALL ImportField(440100046, 'Дата заявки на кассовый расход', 'DATE_PP', 'Дата заявки на кассовый расход', 'DATE_PP', 0, 4401, 0, 1, 'ДатаЗаявкиНаКР', 0, 25050) ;

CALL ImportField(440100047, 'ассигнований(Дата введения в действие)', 'DATE_UTV_BA', 'ассигнований(Дата введение в действие)', 'DATE_UTV_BA', 0, 4401, 0, 0, 'ДатаВДБА', 0, 25051) ;

CALL ImportField(440100048, 'ЛБО(Дата введения в действие)', 'DATE_UTV_LBO', 'ЛБО(Дата введение в действие)', 'DATE_UTV_LBO', 0, 4401, 0, 0, 'ДатаВДЛБО', 0, 25052) ;

CALL ImportField(440100049, 'ПОФ(Дата введения в действие)', 'DATE_UTV_POF', 'ПОФ(Дата введение в действие)', 'DATE_UTV_POF', 0, 4401, 0, 0, 'ДатаВДОФ', 0, 25053) ;

CALL ImportField(440100050, 'расходного расписания(Дата введения в действие)', 'DATE_UTV_PP', 'расходного расписания(Дата введение в действие)', 'DATE_UTV_PP', 0, 4401, 0, 0, 'ДатаВДРР', 0, 25054) ;

CALL ImportField(440100051, 'Дата введения в действие реестра(Реестр)', 'Date_UTV_Reestr', 'Дата введения в действие реестра(Реестр)', 'DATE_UTV_Reestr', 0, 4401, 0, 1, 'ДатаВДРеестра', 0, 25055) ;

CALL ImportField(440100052, 'Номер заявки на кассовый расход', 'NOM_PP', 'Номер заявки на кассовый расход', 'NOM_PP', 0, 4401, 0, 1, 'НомерЗаявкиНаКР', 0, 25057) ;

CALL ImportField(440100053, 'Дата реестра(Реестр)', 'ReestrDate', 'Дата реестра(Реестр)', 'REESTRDATE', 0, 4401, 0, 1, 'ДатаРеестра', 0, 25058) ;

CALL ImportField(440100054, 'Номер реестра(Реестр)', 'ReestrNumber', 'Номер реестра(Реестр)', 'REESTRNUMBER', 0, 4401, 0, 1, 'НомерРеестра', 0, 25059) ;

CALL ImportField(440100055, 'Код специальных указаний', 'SpecialNoteCode', 'Код специальных указаний', 'SpecialNoteCode', 0, 4401, 0, 0, 'КодСпецУказаний', 0, 25060) ;

CALL ImportField(440100056, 'Тип расходного расписания', 'TIP_RR', 'Тип расходного расписания', 'TIP_RR', 0, 4401, 0, 0, 'ТипРасхРасписания', 0, 25062) ;

CALL ImportField(440100058, 'Статус(Обмен с УФК)', 'Status', 'Статус документа при обмене с УФК', 'Status', 0, 4401, 0, 1, 'Статус', 0, 17233) ;

CALL ImportField(440101023, 'Вид деятельности', 'ActivityKind', 'Вид деятельности', 'ACTIVITYKIND', 0, 4401, 1, 1, 'ВидДеятельности', 0, 21718) ;

CALL ImportField(440101024, 'Код записи', 'ID', 'Код записи', 'ID', 0, 4401, 1, 1, 'КодЗаписи', 0, 21710) ;

CALL ImportField(440101025, 'КЦСРКлюч', 'KCSR', 'КЦСР', 'KCSR', 0, 4401, 1, 1, 'КЦСРКлюч', 0, 21713) ;

CALL ImportField(440101026, 'ЭКР(Классификация)', 'KESR', 'КЭСР', 'KESR', 0, 4401, 1, 1, 'КЭСР', 0, 21716) ;

CALL ImportField(440101027, 'ФКР(Классификация)', 'KFSR', 'КФСР', 'KFSR', 0, 4401, 1, 1, 'КФСР', 0, 21714) ;

CALL ImportField(440101028, 'КВРКлюч', 'KVR', 'КВР', 'KVR', 0, 4401, 1, 1, 'КВРКлюч', 0, 21715) ;

CALL ImportField(440101029, 'КВСРКлюч', 'KVSR', 'КВСР', 'KVSR', 0, 4401, 1, 1, 'КВСРКлюч', 0, 21712) ;

CALL ImportField(440101030, 'Примечание', 'NOTE', 'Примечание', 'Note', 0, 4401, 1, 0, 'Примечание', 0, 21721) ;

CALL ImportField(440101031, 'Код отправителя записи', 'SENDERID', 'Код отправителя записи', 'SenderID', 0, 4401, 1, 1, 'КодОтправителяЗаписи', 0, 21729) ;

CALL ImportField(440101032, 'Код УРМ записи', 'SENDERRECORDID', 'Код УРМ записи', 'SenderRecordID', 0, 4401, 1, 1, 'КодУРМЗаписи', 0, 21730) ;

CALL ImportField(440101035, 'Предельные объемы финансирования', 'SUMMAFIN', 'Объемы финансирования', 'SUMMAFIN', 0, 4401, 1, 1, 'РРСуммаПОФ', 0, 21724) ;

CALL ImportField(440101038, 'Код цели', 'TargetCLS', 'Код цели', 'TargetCLS', 0, 4401, 1, 1, 'КодЦели', 0, 21719) ;

CALL ImportField(440101046, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CreaterUser', 0, 4401, 1, 1, 'Автор', 0, 21732) ;

CALL ImportField(440101047, 'Изменил(Авторизация)', 'UPDATERUSER', 'Изменил(Авторизация)', 'UpdaterUser', 0, 4401, 1, 1, 'АвторИзменений', 0, 21734) ;

CALL ImportField(440101048, 'Дата изменения(Авторизация)', 'UPDATEDATE', 'Дата изменения(Авторизация)', 'UpdateDate', 0, 4401, 1, 1, 'ДатаВремяИзменения', 0, 21735) ;

CALL ImportField(440101049, 'Дата создания(Авторизация)', 'CREATEDATE', 'Дата создания(Авторизация)', 'CreateDate', 0, 4401, 1, 1, 'ДатаВремяСоздания', 0, 21733) ;

CALL ImportField(440101050, 'Источник внутреннего финансирования(ключ)', 'IFS', 'IFS', 'IFS', 0, 4401, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 21717) ;

CALL ImportField(440101052, 'Код документа', 'RECORDINDEX', 'RECORDINDEX', 'RecordIndex', 0, 4401, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(440101053, 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 0, 4401, 1, 1, 'ПринадлежностьБА_ЛБО', 0, 25357) ;

CALL ImportField(440101054, 'Операция', 'BUHOPERATIONCLS', 'Операция', ' ', 0, 4401, 1, 0, 'БухОперация', 0, 25358) ;

CALL ImportField(440101055, 'Сумма ассигнований на первый год', 'SummaYear1', 'Сумма ассигнований на первый год', 'SummaYear1', 0, 4401, 1, 1, 'РРСуммаБАЛБОПервыйгод', 0, 25365) ;

CALL ImportField(440101056, 'Сумма ассигнований на второй год', 'SummaYear2', 'Сумма ассигнований на второй год', 'SummaYear2', 0, 4401, 1, 1, 'РРСуммаБАЛБОВторойгод', 0, 25366) ;

CALL ImportField(440101057, 'Сумма ассигнований на второй год', 'SummaYear3', 'Сумма ассигнований на второй год', 'SummaYear3', 0, 4401, 1, 1, 'РРСуммаБАЛБОТретийгод', 0, 25367) ;

CALL ImportField(440101060, 'Тип средств', 'MeansType', '', ' ', 0, 4401, 1, 1, 'ТипСредств', 0, 25361) ;

CALL ImportField(440101061, 'Район', 'RegionCLS', '', ' ', 0, 4401, 1, 1, 'РайонТрансферта', 0, 25362) ;

CALL ImportField(440101062, 'Суб КОСГУ', 'SubKESR', '', ' ', 0, 4401, 1, 1, 'СубКЭСР', 0, 25364) ;

CALL ImportField(440101063, 'Код субсидииКлюч', 'SubsidyCls', '', ' ', 0, 4401, 1, 1, 'КодСубсидииКлюч', 0, 27636) ;

CALL ImportField(440101064, 'Код целевых средствКлюч', 'TransfertCls', '', ' ', 0, 4401, 1, 1, 'КодЦелевыхСредствКлюч', 0, 27637) ;

CALL ImportField(440101065, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCLS', '', ' ', 0, 4401, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27930) ;

CALL ImportField(440101066, 'Код расходного обязательстваКлюч', 'PayPromiseCLS', '', ' ', 0, 4401, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27931) ;

CALL ImportField(440101067, 'Тип классификации', 'CLSTYPE', 'Тип классификации', ' ', 0, 4401, 1, 1, 'ТипКлассификации', 0, 21720) ;

-- Расходные расписания, Бюджет(1)
CALL ImportField(440110001, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', 'AcceptDate', 1, 4401, 0, 0, 'ДатаПринятия', 0, 21688) ;

CALL ImportField(440110003, 'Код бюджета', 'BUDGETREF', 'Код бюджета', 'BudgetRef', 1, 4401, 0, 1, 'КодБюджета', 0, 21683) ;

CALL ImportField(440110004, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CryptoStatus', 1, 4401, 0, 1, 'КриптоСтатус', 0, 21700) ;

CALL ImportField(440110005, 'Ссылка на р\с финоргана', 'DFACCOUNT', 'Ссылка на р\с финоргана', 'DFAccount', 1, 4401, 0, 1, 'РСФО', 0, 21687) ;

CALL ImportField(440110006, 'Номер документа', 'DocNumber', 'Номер документа', 'DocNumber', 1, 4401, 0, 0, 'НомерДокумента', 0, 21684) ;

CALL ImportField(440110007, 'Состояние документа', 'DOCSTATEREF', 'Состояние документа', 'DocStateRef', 1, 4401, 0, 1, 'СостояниеДокумента', 0, 21701) ;

CALL ImportField(440110008, 'Формат документа', 'DOCUMENTFORMAT', 'Формат документа', 'DocumentFormat', 1, 4401, 0, 1, 'ФорматДокумента', 0, 21692) ;

CALL ImportField(440110009, 'Лицевой счет', 'FACIALACCCLS', 'Лицевой счет', 'FacialAccCLS', 1, 4401, 0, 1, 'ЛицевойСчет', 0, 21691) ;

CALL ImportField(440110010, 'Код документа', 'ID', 'Код документа', 'ID', 1, 4401, 0, 1, 'КодДокумента', 0, 21682) ;

CALL ImportField(440110016, 'Приложение', 'Note', 'Приложение', 'Note', 1, 4401, 0, 0, 'Приложение', 0, 21695) ;

CALL ImportField(440110017, 'Порядковый номер документа по распорядителю', 'NotifyNumber', 'Порядковый номер документа по распорядителю', 'NotifyNumber', 1, 4401, 0, 0, 'НомерДокументаРаспорядителя', 0, 21685) ;

CALL ImportField(440110018, 'Уровень', 'NotifyType', 'Тип уведомления', 'NotifyType', 1, 4401, 0, 1, 'ТипСводногоУведомления', 0, 21694) ;

CALL ImportField(440110019, 'Индексы данных', 'PROGINDEX', 'Индексы данных', 'ProgIndex', 1, 4401, 0, 1, 'ИндексыДанных', 0, 21690) ;

CALL ImportField(440110020, 'Код отправителя документа', 'SENDERID', 'Код отправителя документа', 'SenderID', 1, 4401, 0, 1, 'КодОтправителяДокумента', 0, 21698) ;

CALL ImportField(440110021, 'Код УРМ документа', 'SENDERRECORDID', 'Код УРМ документа', 'SenderRecordID', 1, 4401, 0, 1, 'КодУРМДокумента', 0, 21699) ;

CALL ImportField(440110022, 'Специальные указания', 'SpecialNote', 'Специальные указания', 'SpecialNote', 1, 4401, 0, 1, 'СпециальныеУказания', 0, 21697) ;

CALL ImportField(440110039, 'Причина отклонения', 'RejectCLS', 'Причина отклонения', 'REJECTCLS', 1, 4401, 0, 0, 'ПричинаОтклонКод', 0, 21707) ;

CALL ImportField(440110040, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'REJECTCAUSE', 1, 4401, 0, 0, 'ПричинаОтклонТекст', 0, 21708) ;

CALL ImportField(440110041, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CreaterUser', 1, 4401, 0, 1, 'АвторДокумента', 0, 21703) ;

CALL ImportField(440110042, 'Изменил(Авторизация)', 'UPDATERUSER', 'Изменил(Авторизация)', 'UpdaterUser', 1, 4401, 0, 1, 'АвторИзмененийДокумента', 0, 21705) ;

CALL ImportField(440110043, 'Дата изменения(Авторизация)', 'UPDATEDATE', 'Дата изменения(Авторизация)', 'UpdateDate', 1, 4401, 0, 1, 'ДатаВремяИзмененияДокумента', 0, 21706) ;

CALL ImportField(440110044, 'Дата создания(Авторизация)', 'CREATEDATE', 'Дата создания(Авторизация)', 'CreateDate', 1, 4401, 0, 1, 'ДатаВремяСозданияДокумента', 0, 21704) ;

CALL ImportField(440110045, 'Организация', 'Org_Ref', 'Org_Ref', 'Организация', 1, 4401, 0, 1, 'Организация', 0, 21693) ;

CALL ImportField(440110046, 'Дата заявки на кассовый расход', 'DATE_PP', 'Дата заявки на кассовый расход', 'DATE_PP', 1, 4401, 0, 1, 'ДатаЗаявкиНаКР', 0, 25050) ;

CALL ImportField(440110047, 'ассигнований(Дата введения в действие)', 'DATE_UTV_BA', 'ассигнований(Дата введение в действие)', 'DATE_UTV_BA', 1, 4401, 0, 0, 'ДатаВДБА', 0, 25051) ;

CALL ImportField(440110048, 'ЛБО(Дата введения в действие)', 'DATE_UTV_LBO', 'ЛБО(Дата введение в действие)', 'DATE_UTV_LBO', 1, 4401, 0, 0, 'ДатаВДЛБО', 0, 25052) ;

CALL ImportField(440110049, 'ПОФ(Дата введения в действие)', 'DATE_UTV_POF', 'ПОФ(Дата введение в действие)', 'DATE_UTV_POF', 1, 4401, 0, 0, 'ДатаВДОФ', 0, 25053) ;

CALL ImportField(440110050, 'расходного расписания(Дата введения в действие)', 'DATE_UTV_PP', 'расходного расписания(Дата введение в действие)', 'DATE_UTV_PP', 1, 4401, 0, 0, 'ДатаВДРР', 0, 25054) ;

CALL ImportField(440110051, 'Дата введения в действие реестра(Реестр)', 'Date_UTV_Reestr', 'Дата введения в действие реестра(Реестр)', 'DATE_UTV_Reestr', 1, 4401, 0, 1, 'ДатаВДРеестра', 0, 25055) ;

CALL ImportField(440110052, 'Номер заявки на кассовый расход', 'NOM_PP', 'Номер заявки на кассовый расход', 'NOM_PP', 1, 4401, 0, 1, 'НомерЗаявкиНаКР', 0, 25057) ;

CALL ImportField(440110053, 'Дата реестра(Реестр)', 'ReestrDate', 'Дата реестра(Реестр)', 'REESTRDATE', 1, 4401, 0, 1, 'ДатаРеестра', 0, 25058) ;

CALL ImportField(440110054, 'Номер реестра(Реестр)', 'ReestrNumber', 'Номер реестра(Реестр)', 'REESTRNUMBER', 1, 4401, 0, 1, 'НомерРеестра', 0, 25059) ;

CALL ImportField(440110055, 'Код специальных указаний', 'SpecialNoteCode', 'Код специальных указаний', 'SpecialNoteCode', 1, 4401, 0, 0, 'КодСпецУказаний', 0, 25060) ;

CALL ImportField(440110056, 'Тип расходного расписания', 'TIP_RR', 'Тип расходного расписания', 'TIP_RR', 1, 4401, 0, 0, 'ТипРасхРасписания', 0, 25062) ;

CALL ImportField(440110058, 'Статус(Обмен с УФК)', 'Status', 'Статус документа при обмене с УФК', 'Status', 1, 4401, 0, 1, 'Статус', 0, 17233) ;

CALL ImportField(440111023, 'Вид деятельности', 'ActivityKind', 'Вид деятельности', 'ACTIVITYKIND', 1, 4401, 1, 1, 'ВидДеятельности', 0, 21718) ;

CALL ImportField(440111024, 'Код записи', 'ID', 'Код записи', 'ID', 1, 4401, 1, 1, 'КодЗаписи', 0, 21710) ;

CALL ImportField(440111025, 'КЦСРКлюч', 'KCSR', 'КЦСР', 'KCSR', 1, 4401, 1, 1, 'КЦСРКлюч', 0, 21713) ;

CALL ImportField(440111026, 'ЭКР(Классификация)', 'KESR', 'КЭСР', 'KESR', 1, 4401, 1, 1, 'КЭСР', 0, 21716) ;

CALL ImportField(440111027, 'ФКР(Классификация)', 'KFSR', 'КФСР', 'KFSR', 1, 4401, 1, 1, 'КФСР', 0, 21714) ;

CALL ImportField(440111028, 'КВРКлюч', 'KVR', 'КВР', 'KVR', 1, 4401, 1, 1, 'КВРКлюч', 0, 21715) ;

CALL ImportField(440111029, 'КВСРКлюч', 'KVSR', 'КВСР', 'KVSR', 1, 4401, 1, 1, 'КВСРКлюч', 0, 21712) ;

CALL ImportField(440111030, 'Примечание', 'NOTE', 'Примечание', 'Note', 1, 4401, 1, 0, 'Примечание', 0, 21721) ;

CALL ImportField(440111031, 'Код отправителя записи', 'SENDERID', 'Код отправителя записи', 'SenderID', 1, 4401, 1, 1, 'КодОтправителяЗаписи', 0, 21729) ;

CALL ImportField(440111032, 'Код УРМ записи', 'SENDERRECORDID', 'Код УРМ записи', 'SenderRecordID', 1, 4401, 1, 1, 'КодУРМЗаписи', 0, 21730) ;

CALL ImportField(440111035, 'Предельные объемы финансирования', 'SUMMAFIN', 'Объемы финансирования', 'SUMMAFIN', 1, 4401, 1, 1, 'РРСуммаПОФ', 0, 21724) ;

CALL ImportField(440111038, 'Код цели', 'TargetCLS', 'Код цели', 'TargetCLS', 1, 4401, 1, 1, 'КодЦели', 0, 21719) ;

CALL ImportField(440111046, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CreaterUser', 1, 4401, 1, 1, 'Автор', 0, 21732) ;

CALL ImportField(440111047, 'Изменил(Авторизация)', 'UPDATERUSER', 'Изменил(Авторизация)', 'UpdaterUser', 1, 4401, 1, 1, 'АвторИзменений', 0, 21734) ;

CALL ImportField(440111048, 'Дата изменения(Авторизация)', 'UPDATEDATE', 'Дата изменения(Авторизация)', 'UpdateDate', 1, 4401, 1, 1, 'ДатаВремяИзменения', 0, 21735) ;

CALL ImportField(440111049, 'Дата создания(Авторизация)', 'CREATEDATE', 'Дата создания(Авторизация)', 'CreateDate', 1, 4401, 1, 1, 'ДатаВремяСоздания', 0, 21733) ;

CALL ImportField(440111050, 'Источник внутреннего финансирования(ключ)', 'IFS', 'IFS', 'IFS', 1, 4401, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 21717) ;

CALL ImportField(440111051, 'Код документа', 'RECORDINDEX', 'RECORDINDEX', 'RecordIndex', 1, 4401, 1, 1, 'КодДокумента', 0, 21711) ;

CALL ImportField(440111052, 'Тип классификации', 'CLSTYPE', 'Тип классификации', ' ', 1, 4401, 1, 1, 'ТипКлассификации', 0, 21720) ;

CALL ImportField(440111053, 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 1, 4401, 1, 1, 'ПринадлежностьБА_ЛБО', 0, 25357) ;

CALL ImportField(440111054, 'Операция', 'BUHOPERATIONCLS', 'Операция', ' ', 1, 4401, 1, 0, 'БухОперация', 0, 25358) ;

CALL ImportField(440111055, 'Сумма ассигнований на первый год', 'SummaYear1', 'Сумма ассигнований на первый год', 'SummaYear1', 1, 4401, 1, 1, 'РРСуммаБАЛБОПервыйгод', 0, 25365) ;

CALL ImportField(440111056, 'Сумма ассигнований на второй год', 'SummaYear2', 'Сумма ассигнований на второй год', 'SummaYear2', 1, 4401, 1, 1, 'РРСуммаБАЛБОВторойгод', 0, 25366) ;

CALL ImportField(440111057, 'Сумма ассигнований на второй год', 'SummaYear3', 'Сумма ассигнований на второй год', 'SummaYear3', 1, 4401, 1, 1, 'РРСуммаБАЛБОТретийгод', 0, 25367) ;

CALL ImportField(440111060, 'Тип средств', 'MeansType', '', ' ', 1, 4401, 1, 1, 'ТипСредств', 0, 25361) ;

CALL ImportField(440111061, 'Район', 'RegionCLS', '', ' ', 1, 4401, 1, 1, 'РайонТрансферта', 0, 25362) ;

CALL ImportField(440111062, 'Суб КОСГУ', 'SubKESR', '', ' ', 1, 4401, 1, 1, 'СубКЭСР', 0, 25364) ;

CALL ImportField(440111063, 'Код субсидииКлюч', 'SubsidyCls', '', ' ', 1, 4401, 1, 1, 'КодСубсидииКлюч', 0, 27636) ;

CALL ImportField(440111064, 'Код целевых средствКлюч', 'TransfertCls', '', ' ', 1, 4401, 1, 1, 'КодЦелевыхСредствКлюч', 0, 27637) ;

CALL ImportField(440111065, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCLS', '', ' ', 1, 4401, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27930) ;

CALL ImportField(440111066, 'Код расходного обязательстваКлюч', 'PayPromiseCLS', '', ' ', 1, 4401, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27931) ;

-- Внутренние КУ,РР, УРМ(0)
CALL ImportField(440300033, 'Код документа', 'ID', 'Код документа', ' ', 0, 4403, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(440301052, 'RECORDINDEX', 'RECORDINDEX', 'RECORDINDEX', ' ', 0, 4403, 1, 1, 'КодДокумента', 0, null) ;

-- Внутренние КУ,РР, Бюджет(1)
CALL ImportField(440310001, 'Дата принятия', 'ACCEPTDATE', 'Дата принятия', 'AcceptDate', 1, 4403, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(440310003, 'Код Бюджета', 'BUDGETREF', 'Код Бюджета', 'BudgetRef', 1, 4403, 0, 1, 'КодБюджета', 0, null) ;

CALL ImportField(440310004, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 4403, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(440310005, 'Ссылка на р\с финоргана', 'DFACCOUNT', 'Ссылка на р\с финоргана', 'DFAccount', 1, 4403, 0, 1, 'РСФО', 0, null) ;

CALL ImportField(440310006, 'Номер документа', 'DocNumber', 'Номер документа', 'DocNumber', 1, 4403, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(440310007, 'Состояние документа', 'DOCSTATEREF', 'Состояние документа', 'DocStateRef', 1, 4403, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(440310008, 'Формат документа', 'DOCUMENTFORMAT', 'Формат документа', 'DocumentFormat', 1, 4403, 0, 1, 'ФорматДокумента', 0, null) ;

CALL ImportField(440310009, 'Лицевой счет', 'FACIALACCCLS', 'Лицевой счет', 'FacialAccCls', 1, 4403, 0, 1, 'ЛицевойСчет', 0, null) ;

CALL ImportField(440310010, 'Код документа', 'ID', 'Код документа', 'ID', 1, 4403, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(440310012, 'Дата формирования', 'InputDate', 'Дата ввода', 'InputDate', 1, 4403, 0, 1, 'ДатаВвода', 0, null) ;

CALL ImportField(440310016, 'Приложение', 'Note', 'Приложение', 'Note', 1, 4403, 0, 0, 'Приложение', 0, null) ;

CALL ImportField(440310017, 'Порядковый номер документа по распорядителю', 'NotifyNumber', 'Порядковый номер документа по распорядителю', 'NotifyNumber', 1, 4403, 0, 0, 'НомерДокументаРаспорядителя', 0, null) ;

CALL ImportField(440310018, 'Уровень', 'NotifyType', 'Тип уведомления', 'NotifyType', 1, 4403, 0, 1, 'ТипСводногоУведомления', 0, null) ;

CALL ImportField(440310019, 'Индексы данных', 'PROGINDEX', 'Индексы данных', 'ProgIndex', 1, 4403, 0, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(440310020, 'Код отправителя документа', 'SENDERID', 'Код отправителя документа', 'SenderID', 1, 4403, 0, 1, 'КодОтправителяДокумента', 0, null) ;

CALL ImportField(440310021, 'Код УРМ документа', 'SENDERRECORDID', 'Код УРМ документа', 'SenderRecordID', 1, 4403, 0, 1, 'КодУРМДокумента', 0, null) ;

CALL ImportField(440310022, 'Специальные указания', 'SpecialNote', 'Специальные указания', 'SpecialNote', 1, 4403, 0, 0, 'СпециальныеУказания', 0, null) ;

CALL ImportField(440310039, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', ' ', 1, 4403, 0, 1, 'АвторДокумента', 0, null) ;

CALL ImportField(440310040, 'Изменил(Авторизация)', 'UPDATERUSER', 'Изменил(Авторизация)', ' ', 1, 4403, 0, 1, 'АвторИзмененийДокумента', 0, null) ;

CALL ImportField(440310041, 'Дата изменения(Авторизация)', 'UPDATEDATE', 'Дата изменения(Авторизация)', ' ', 1, 4403, 0, 1, 'ДатаВремяИзмененияДокумента', 0, null) ;

CALL ImportField(440310042, 'Дата создания(Авторизация)', 'CREATEDATE', 'Дата создания(Авторизация)', ' ', 1, 4403, 0, 1, 'ДатаВремяСозданияДокумента', 0, null) ;

CALL ImportField(440310043, 'Организация', 'Org_Ref', 'Org_Ref', 'OrgCity', 1, 4403, 0, 1, 'Организация', 0, null) ;

CALL ImportField(440310044, 'Причина отклонения', 'RejectCLS', 'Причина отклонения', 'RejectCls', 1, 4403, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(440310045, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 4403, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(440310046, 'Дата заявки на кассовый расход', 'DATE_PP', 'Дата заявки на кассовый расход', ' ', 1, 4403, 0, 1, 'ДатаЗаявкиНаКР', 0, null) ;

CALL ImportField(440310047, 'ассигнований(Дата введение в действие)', 'DATE_UTV_BA', 'ассигнований(Дата введение в действие)', ' ', 1, 4403, 0, 0, 'ДатаВДБА', 0, null) ;

CALL ImportField(440310048, 'ЛБО(Дата введение в действие)', 'DATE_UTV_LBO', 'ЛБО(Дата введение в действие)', ' ', 1, 4403, 0, 0, 'ДатаВДЛБО', 0, null) ;

CALL ImportField(440310049, 'ПОФ(Дата введение в действие)', 'DATE_UTV_POF', 'ПОФ(Дата введение в действие)', ' ', 1, 4403, 0, 0, 'ДатаВДОФ', 0, null) ;

CALL ImportField(440310050, 'расходного расписания(Дата введение в действие)', 'DATE_UTV_PP', 'расходного расписания(Дата введение в действие)', ' ', 1, 4403, 0, 0, 'ДатаВДРР', 0, null) ;

CALL ImportField(440310051, 'Дата введения в действие реестра(Реестр)', 'Date_UTV_Reestr', 'Дата введения в действие реестра(Реестр)', ' ', 1, 4403, 0, 1, 'ДатаВДРеестра', 0, null) ;

CALL ImportField(440310052, 'Номер заявки на кассовый расход', 'NOM_PP', 'Номер заявки на кассовый расход', ' ', 1, 4403, 0, 1, 'НомерЗаявкиНаКР', 0, null) ;

CALL ImportField(440310053, 'Дата реестра(Реестр)', 'ReestrDate', 'Дата реестра(Реестр)', ' ', 1, 4403, 0, 1, 'ДатаРеестра', 0, null) ;

CALL ImportField(440310054, 'Номер реестра(Реестр)', 'ReestrNumber', 'Номер реестра(Реестр)', ' ', 1, 4403, 0, 1, 'НомерРеестра', 0, null) ;

CALL ImportField(440310055, 'Код специальных указаний', 'SpecialNoteCode', 'Код специальных указаний', ' ', 1, 4403, 0, 1, 'КодСпецУказаний', 0, null) ;

CALL ImportField(440310056, 'Тип расходного расписания', 'TIP_RR', 'Тип расходного расписания', ' ', 1, 4403, 0, 0, 'ТипРасхРасписания', 0, null) ;

CALL ImportField(440311023, 'Вид деятельности', 'ActivityKind', 'Вид деятельности', 'ACTIVITYKIND', 1, 4403, 1, 1, 'ВидДеятельности', 0, null) ;

CALL ImportField(440311024, 'Код записи', 'ID', 'Код записи', 'ID', 1, 4403, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(440311025, 'КЦСРКлюч', 'KCSR', 'КЦСР', 'KCSRKey', 1, 4403, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(440311026, 'ЭКР(Классификация)', 'KESR', 'КЭСР', 'KESR', 1, 4403, 1, 1, 'КЭСР', 0, null) ;

CALL ImportField(440311027, 'ФКР(Классификация)', 'KFSR', 'КФСР', 'KFSR', 1, 4403, 1, 1, 'КФСР', 0, null) ;

CALL ImportField(440311028, 'КВРКлюч', 'KVR', 'КВР', 'KVRKey', 1, 4403, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(440311029, 'КВСРКлюч', 'KVSR', 'КВСР', 'KVSRKey', 1, 4403, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(440311030, 'Примечание', 'NOTE', 'Примечание', 'Note', 1, 4403, 1, 0, 'Примечание', 0, null) ;

CALL ImportField(440311031, 'Код отправителя записи', 'SENDERID', 'Код отправителя записи', 'SenderID', 1, 4403, 1, 1, 'КодОтправителяЗаписи', 0, null) ;

CALL ImportField(440311032, 'Код УРМ записи', 'SENDERRECORDID', 'Код УРМ записи', 'SenderRecordID', 1, 4403, 1, 1, 'КодУРМЗаписи', 0, null) ;

CALL ImportField(440311035, 'Предельные объемы финансирования', 'SUMMAFIN', 'Объемы финансирования', ' ', 1, 4403, 1, 1, 'РРСуммаПОФ', 0, null) ;

CALL ImportField(440311038, 'Код цели', 'TargetCLS', 'Код цели', 'TargetCLS', 1, 4403, 1, 1, 'КодЦели', 0, null) ;

CALL ImportField(440311046, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', ' ', 1, 4403, 1, 1, 'Автор', 0, null) ;

CALL ImportField(440311047, 'Изменил(Авторизация)', 'UPDATERUSER', 'Изменил(Авторизация)', ' ', 1, 4403, 1, 1, 'АвторИзменений', 0, null) ;

CALL ImportField(440311048, 'Дата изменения(Авторизация)', 'UPDATEDATE', 'Дата изменения(Авторизация)', ' ', 1, 4403, 1, 1, 'ДатаВремяИзменения', 0, null) ;

CALL ImportField(440311049, 'Дата создания(Авторизация)', 'CREATEDATE', 'Дата создания(Авторизация)', ' ', 1, 4403, 1, 1, 'ДатаВремяСоздания', 0, null) ;

CALL ImportField(440311050, 'Источник внутреннего финансирования(ключ)', 'IFS', 'IFS', 'IFS', 1, 4403, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, null) ;

CALL ImportField(440311051, 'Код документа', 'RECORDINDEX', 'RECORDINDEX', ' ', 1, 4403, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(440311052, 'Тип классификации', 'CLSTYPE', 'Тип классификации', 'ClsType', 1, 4403, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(440311053, 'Отнесение к БА, ЛБО', 'BA_LBO_FLAG', 'Отнесение к БА, ЛБО', ' ', 1, 4403, 1, 1, 'ПринадлежностьБА_ЛБО', 0, null) ;

CALL ImportField(440311054, 'Операция', 'BUHOPERATIONCLS', 'Операция', ' ', 1, 4403, 1, 0, 'БухОперация', 0, null) ;

CALL ImportField(440311055, 'Сумма ассигнований на первый год', 'SummaYear1', 'Сумма ассигнований на первый год', ' ', 1, 4403, 1, 1, 'РРСуммаБАЛБОПервыйгод', 0, null) ;

CALL ImportField(440311056, 'Сумма ассигнований на второй год', 'SummaYear2', 'Сумма ассигнований на второй год', ' ', 1, 4403, 1, 1, 'РРСуммаБАЛБОВторойгод', 0, null) ;

CALL ImportField(440311057, 'Сумма ассигнований на второй год', 'SummaYear3', 'Сумма ассигнований на второй год', ' ', 1, 4403, 1, 1, 'РРСуммаБАЛБОТретийгод', 0, null) ;

CALL ImportField(440311060, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 4403, 1, 1, 'ТипСредств', 0, null) ;

CALL ImportField(440311061, 'Район', 'RegionCls', 'Район', ' ', 1, 4403, 1, 1, 'РайонТрансферта', 0, null) ;

CALL ImportField(440311062, 'Суб КОСГУ', 'SubKESR', 'Суб КЭСР', ' ', 1, 4403, 1, 1, 'СубКЭСР', 0, null) ;

CALL ImportField(440311063, 'Код субсидииКлюч', 'SubsidyCls', '', ' ', 1, 4403, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(440311064, 'Код целевых средствКлюч', 'TransfertCls', '', ' ', 1, 4403, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

-- Обуславливающие документы, УРМ(0)
CALL ImportField(480100012, 'Начальное состояние документа', 'BeginDocStateRef', '', 'BeginDocStateRef', 0, 4801, 0, 1, 'НачальноеСостояниеДокумента', 0, null) ;

CALL ImportField(480100018, 'Есть в Бюджете', 'IsInBudget', '', 'IsInBudget', 0, 4801, 0, 1, 'ЕстьВБюджете', 0, null) ;

CALL ImportField(480100023, 'Код ФО документа', 'FUID', '', 'FUID', 0, 4801, 0, 1, 'КодФОДокумента', 0, null) ;

CALL ImportField(480100025, 'Мягкая причина отклонения', 'SoftRejectCls', '', 'SoftRejectCls', 0, 4801, 0, 1, 'МягкаяПричинаОтклонКод', 0, null) ;

CALL ImportField(480100026, 'Мягкая причина отклонения(текст)', 'SoftRejectCause', '', 'SoftRejectCause', 0, 4801, 0, 1, 'МягкаяПричинаОтклонТекст', 0, null) ;

CALL ImportField(480100027, 'Признак зависания', 'DocSuspended', '', 'DocSuspended', 0, 4801, 0, 1, 'ПризнакЗависания', 0, null) ;

CALL ImportField(480101024, 'Код ФО записи', 'FUID', '', 'FUID', 0, 4801, 1, 1, 'КодФОЗаписи', 0, null) ;

-- Обуславливающие документы, Бюджет(1)
CALL ImportField(480110013, 'Крипто статус', 'CryptoStatus', '', 'CryptoStatus', 1, 4801, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(480110019, 'Код отправителя документа', 'SenderId', '', 'SenderId', 1, 4801, 0, 1, 'КодОтправителяДокумента', 0, null) ;

CALL ImportField(480110021, 'Код УРМ документа', 'SenderRecordId', '', 'SenderRecordId', 1, 4801, 0, 1, 'КодУРМДокумента', 0, null) ;

CALL ImportField(480111020, 'Код отправителя записи', 'SenderID', '', 'SenderID', 1, 4801, 1, 1, 'КодОтправителяЗаписи', 0, null) ;

CALL ImportField(480111022, 'Код УРМ записи', 'SenderRecordId', '', 'SenderRecordId', 1, 4801, 1, 1, 'КодУРМЗаписи', 0, null) ;

-- Обуславливающие документы, УРМ+Бюджет(2)
CALL ImportField(480110003, 'Дата экстренного изменения', ' ', '', 'LastExtrChange', 2, 4801, 0, 1, '', 1, null) ;

CALL ImportField(480110005, 'Категория документа(ключ)', 'ArchiveDocType', 'Категория архивного документа(ключ)', 'ArchiveDocTypeKey', 2, 4801, 0, 1, 'КатегорияДокументаКлюч', 0, null) ;

CALL ImportField(480110010, 'Индексы данных', 'ProgIndex', '', 'ProgIndex', 2, 4801, 0, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(480110011, 'Код документа', 'ID', '', 'ID', 2, 4801, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(480110017, 'Состояние документа', 'DocStateRef', '', 'DocStateRef', 2, 4801, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(480110029, 'Область применения', 'GeneralDocFacialList', 'Список лицевых счетов', ' ', 2, 4801, 0, 0, '', 0, null) ;

CALL ImportField(480111014, 'Код записи', '', '', 'ID', 2, 4801, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(480111028, 'Лицевой счет', '', '', 'FacialAccCls', 2, 4801, 1, 1, 'ЛицевойСчет', 0, null) ;

CALL ImportField(480111032, 'Ссылка на заголовок', 'RecordIndex', '', 'RecordIndex', 2, 4801, 1, 1, '', 0, null) ;

-- Пакеты документов для УРМ, Бюджет(1)
CALL ImportField(490110001, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'FacialAcc_Cls', 1, 4901, 0, 1, 'ЛицевойСчет', 0, 22471) ;

CALL ImportField(490110002, 'Код', 'ID', 'Код', 'ID', 1, 4901, 0, 1, 'КодДокумента', 0, 22469) ;

CALL ImportField(490110003, 'Примечания', 'Note', 'Примечания', 'Note', 1, 4901, 0, 0, 'Примечание', 0, 22485) ;

CALL ImportField(490110004, 'Дата создания пакета', 'PacketCreateDate', 'Дата создания пакета', 'PacketCreateDate', 1, 4901, 0, 1, 'ДатаСоздания', 0, null) ;

CALL ImportField(490110005, 'Дата доставки пакета', 'PacketDeliveryDate', 'Дата доставки пакета', 'PacketDeliveryDate', 1, 4901, 0, 1, 'ДатаДоставкиПакета', 0, null) ;

CALL ImportField(490110006, 'Код пакета', 'PacketID', 'Код пакета', 'PacketID', 1, 4901, 0, 1, 'КодПакета', 0, null) ;

CALL ImportField(490110007, 'Тип пакета', 'PacketTypeCls', 'Тип пакета', 'PacketTypeCls', 1, 4901, 0, 1, 'ТипПакета', 0, 22470) ;

CALL ImportField(490110008, 'Дата отклонения', 'RejectDate', 'Дата отклонения', 'RejectDate', 1, 4901, 0, 0, 'ДатаОтклонения', 0, 22477) ;

CALL ImportField(490110009, 'Дата доставки отклонения', 'RejectDeliveryDate', 'Дата доставки отклонения', 'RejectDeliveryDate', 1, 4901, 0, 1, 'ДатаДоставкиОтклонения', 0, null) ;

CALL ImportField(490110010, 'Дата', 'ReportDate', 'Дата', 'ReportDate', 1, 4901, 0, 1, 'ДатаПакета', 0, 22476) ;

CALL ImportField(490110011, 'Статус подписи', 'EDSStatus', 'Статус подписи', ' ', 1, 4901, 0, 1, '', 0, null) ;

CALL ImportField(490110012, 'Состояние пакета', 'PacketState', 'Состояние пакета', 'PacketState', 1, 4901, 0, 0, 'СостояниеПакета', 0, 24707) ;

CALL ImportField(490110013, 'Код удаленного клиента', 'ClientCode', 'Код удаленного клиента', 'ClientCode', 1, 4901, 0, 1, 'КодКлиента', 0, 22472) ;

CALL ImportField(490110014, 'Статус ЭЦП', 'CryptoStatus', 'Криптостатус', 'CryptoStatus', 1, 4901, 0, 1, 'КриптоСтатус', 0, 22488) ;

CALL ImportField(490110015, 'СостояниеДокумента', 'DocStateRef', 'Код состояния', 'DocStateRef', 1, 4901, 0, 1, 'СостояниеДокумента', 0, 27617) ;

CALL ImportField(490110016, 'Код получателя', 'RecipientCode', 'Код получателя', 'RecipientCode', 1, 4901, 0, 1, 'КодПолучателя', 0, null) ;

CALL ImportField(490110017, 'Дата создания(Авторизация)', 'CreateDate', '', ' ', 1, 4901, 0, 1, 'ДатаВремяСозданияДокумента', 0, 22480) ;

CALL ImportField(490110018, 'Автор(Авторизация)', 'CreaterUser', '', ' ', 1, 4901, 0, 1, 'АвторДокумента', 0, 22482) ;

CALL ImportField(490110019, 'Дата изменения(Авторизация)', 'UpdateDate', '', ' ', 1, 4901, 0, 1, 'ДатаВремяИзмененияДокумента', 0, 22481) ;

CALL ImportField(490110020, 'Изменил(Авторизация)', 'UpdaterUser', '', ' ', 1, 4901, 0, 1, 'АвторИзмененийДокумента', 0, 22483) ;

-- Электронный архив, Бюджет(1)
CALL ImportField(490310001, 'Размер сжатого документа', 'BinaryDataSize', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310002, 'Бюджет', 'BudgetName', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310003, 'Номер документа', 'DocNumber', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310004, 'Категория архивного документа', 'DocTypeCode', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310005, 'Лицевой счет', 'FacialAcc_Cls', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310006, 'Наименование', 'Name', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310007, 'Примечания', 'Note', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310008, 'Дата ввода пакета', 'PacketCreateDate', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310009, 'Причина отклонения', 'RejectCause', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310010, 'Дата отклонения', 'RejectDate', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310011, 'Дата', 'ReportDate', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310012, 'РСФО', 'RSFOName', '', ' ', 1, 4903, 0, 0, '', 0, null) ;

CALL ImportField(490310013, 'Состояние пакета', 'PacketState', '', ' ', 1, 4903, 0, 1, '', 0, null) ;

CALL ImportField(490310014, 'Код схемы подписания', 'DocTypeScheme', '', ' ', 1, 4903, 0, 1, '', 0, null) ;

CALL ImportField(490310015, 'Подписание завершено', 'ISSIGNEND', '', ' ', 1, 4903, 0, 1, '', 0, null) ;

CALL ImportField(490310016, 'Индекс данных', 'ProgIndex', '', ' ', 1, 4903, 0, 1, '', 0, null) ;

CALL ImportField(490311001, 'Сведения об авторе операции', 'CreaterInfo', '', ' ', 1, 4903, 1, 0, '', 0, null) ;

CALL ImportField(490311002, 'Код состояния', 'DocStateRef', '', ' ', 1, 4903, 1, 0, '', 0, null) ;

CALL ImportField(490311003, 'Дата операции', 'OpDate', '', ' ', 1, 4903, 1, 0, '', 0, null) ;

CALL ImportField(490311004, 'Тип операции', 'OpType', '', ' ', 1, 4903, 1, 0, '', 0, null) ;

CALL ImportField(490311005, 'Автор', 'OpUser', '', ' ', 1, 4903, 1, 0, '', 0, null) ;

-- Исполнительные листы, УРМ(0)
CALL ImportField(520100001, 'Код записи', 'id', 'Код записи', 'id', 0, 5201, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(520100002, 'Дата выдачи исполнительного документа', 'ISSUEDATE', 'Дата выдачи исполнительного документа', 'ISSUEDATE', 0, 5201, 0, 0, 'ИспЛистДатаВыдачи', 0, null) ;

CALL ImportField(520100004, 'Дата заключения(Юридический отдел)', 'LAWDEPARTMENTDATE', 'Дата заключения(Юридический отдел)', 'LAWDEPARTMENTDATE', 0, 5201, 0, 0, 'ИспЛистДатаЗаключения', 0, null) ;

CALL ImportField(520100005, 'Номер заключения(Юридический отдел)', 'LAWDEPARTMENTNUMBER', 'Номер заключения(Юридический отдел)', 'LAWDEPARTMENTNUMBER', 0, 5201, 0, 0, 'ИспЛистНомерЗаключения', 0, null) ;

CALL ImportField(520100006, 'Ссылка на организации взыскателя', 'LEVIERACC_REF', 'Ссылка на организации взыскателя', 'LEVIERACC_REF', 0, 5201, 0, 1, 'ИспЛистСсылкаНаСчетОргВзыскателя', 0, null) ;

CALL ImportField(520100007, 'Ссылка на организацию взыскателя', 'LEVIERORG_REF', 'Ссылка на организацию взыскателя', 'LEVIERORG_REF', 0, 5201, 0, 1, 'ИспЛистОрганизацияВзыскатель', 0, null) ;

CALL ImportField(520100008, 'Наименование судебного органа', 'NAMEJUDICIALAGENCY', 'Наименование судебного органа', 'NAMEJUDICIALAGENCY', 0, 5201, 0, 0, 'ИспЛистНаименСудебногоОргана', 0, null) ;

CALL ImportField(520100009, 'Наименование судебного акта', 'NAMEJUDICIALDECISION', 'Наименование судебного акта', 'NAMEJUDICIALDECISION', 0, 5201, 0, 0, 'ИспЛистНаимСудебногоАкта', 0, null) ;

CALL ImportField(520100010, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 5201, 0, 0, 'Примечание', 0, null) ;

CALL ImportField(520100011, 'Уникальный номер ИЛ', 'UNIQUENUMBER', 'Уникальный номер исполнительного листа ', 'UNIQUENUMBER', 0, 5201, 0, 0, 'ИспЛистУникальныйНомер', 0, null) ;

CALL ImportField(520100012, 'Дата предъявления ИЛ', 'PRESENTDATE', 'Дата предъявления испонительного документа', 'PRESENTDATE', 0, 5201, 0, 0, 'ИспЛистДатаПредъявИспДокумента', 0, null) ;

CALL ImportField(520100013, 'Номер дела', 'NUMBERDOSSIER', 'Номер дела', 'NUMBERDOSSIER', 0, 5201, 0, 0, 'ИспЛистНомерДела', 0, null) ;

CALL ImportField(520100014, 'Индекс данных', 'PROGINDEX', 'Индекс данных', ' ', 0, 5201, 0, 1, '', 0, null) ;

CALL ImportField(520100015, 'Причина отклонения (комментарий)', 'REJECTCAUSE', 'Причина отклонения (комментарий)', 'REJECTCAUSE', 0, 5201, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(520100016, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECT_CLS', 0, 5201, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(520100017, 'Количество листов приложения', 'SHEETSCOUNT', 'Количество листов приложения', 'SHEETSCOUNT', 0, 5201, 0, 0, 'ИспЛистКолЛистовПриложения', 0, null) ;

CALL ImportField(520100018, 'Дата вручения уведомления должнику', 'DELIVERYDATE', 'Дата вручения уведомления должнику', 'DELIVERYDATE', 0, 5201, 0, 0, 'ИспЛистДатаВрученияУвед', 0, null) ;

CALL ImportField(520100019, 'Кол-во листов копий судебного акта', 'COURTSHEETSCOUNT', 'Количество листов копий судебного акта', 'COURTSHEETSCOUNT', 0, 5201, 0, 0, 'ИспЛистКолЛистовКопийСудАкта', 0, null) ;

CALL ImportField(520100021, 'Дата начала отсчета срока действия ИЛ ', 'STARTDATE', 'Дата начала отсчета срока действия ИЛ ', 'STARTDATE', 0, 5201, 0, 0, 'ИспЛистДатаНачОтсчетаСрокаДействия', 0, null) ;

CALL ImportField(520100026, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 0, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520100029, 'Номер исполнительного документа', 'DOCNUMBER', 'Номер исполнительного документа', 'DOCNUMBER', 0, 5201, 0, 0, 'НомерДокумента', 0, null) ;

CALL ImportField(520100030, 'Состояние', 'DOCSTATEREF', 'Состояние', 'DOCSTATEREF', 0, 5201, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(520100032, 'Недействителен', 'ISINVALID', 'Галочка о действительности ИЛ, ставится если был возврат или приостановили без указания срока действия', 'ISINVALID', 0, 5201, 0, 0, 'ИспЛистНедействителен', 0, null) ;

CALL ImportField(520100033, 'Л/с владельца документа', 'FACIALACC_CLS', 'Л/с владельца документа', 'FACIALACC_CLS', 0, 5201, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(520100034, 'Сумма', 'WRITEXECUTIONTOTALSUMMA', 'Сумма', 'WRITEXECUTIONTOTALSUMMA', 0, 5201, 0, 0, 'ИспЛистСуммаДокумента', 0, null) ;

CALL ImportField(520100035, 'Взыскатель', 'LivierParent', 'Взыскатель', ' ', 0, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520100037, 'Счет(взыскатель)', 'LivierAcc', 'Счет(взыскатель)', ' ', 0, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520100038, 'ИНН(взыскатель)', 'LivierInn', 'ИНН(взыскатель)', ' ', 0, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520100039, 'КПП(взыскатель)', 'LivierInn20', 'КПП(взыскатель)', ' ', 0, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520100043, 'Конечная дата', 'ENDDATE', 'Дата окончания срока действия текущего состояния', 'ENDDATE', 0, 5201, 0, 0, 'ИспЛистДатаКонца', 0, null) ;

CALL ImportField(520100051, 'Код категории дела', 'CASECATEGORY', 'Код категории дела', 'CASECATEGORY', 0, 5201, 0, 0, 'ИспЛистКатегория', 0, null) ;

CALL ImportField(520100052, 'Тип исполнительного документа', 'WritType', 'Тип исполнительного документа: 0 - казенные; 1 - БУ/АУ; 2 - Иски к казне', 'WritType', 0, 5201, 0, 0, 'ИспЛистТипДокумента', 0, null) ;

CALL ImportField(520100053, 'Периодичность', 'WritPeriod', 'Периодичночть исполнительного  листа: 0 - непериодические; 1 - ежемесячные; 2 - ежеквартальные', 'WritPeriod', 0, 5201, 0, 0, 'ИспЛистПериод', 0, null) ;

CALL ImportField(520100054, 'Внутренний номер', 'InnerNumber', '', 'InnerNumber', 0, 5201, 0, 0, 'ИспЛистВнутреннийНомер', 0, null) ;

CALL ImportField(520101001, 'Вн. номер БО', 'BudgetPromise', 'Вн. номер БО', 'BudgetPromise', 0, 5201, 1, 1, 'ДоговораБО', 0, null) ;

CALL ImportField(520101002, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 0, 5201, 1, 0, 'КодБюджета', 0, null) ;

CALL ImportField(520101004, 'Тип документа', 'DOCTYPE', 'Тип документа', 'DOCTYPE', 0, 5201, 1, 0, 'ТипДокумента', 0, null) ;

CALL ImportField(520101005, 'Лицевой счет должника', 'FACIALACC_CLS', 'Лицевой счет должника', 'FACIALACC_CLS', 0, 5201, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(520101007, 'Источник финансирования', 'FINSOURCE', 'Источник финансирования', 'FINSOURCE', 0, 5201, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(520101009, 'КЦСРКлюч', 'KCSR', 'КЦСРКлюч', 'KCSR', 0, 5201, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(520101010, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'KCSRCode', 0, 5201, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(520101011, 'КЭСР(Классификация)', 'KESR', 'КЭСР(Классификация)', 'KESR', 0, 5201, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(520101012, 'КФСР(Классификация)', 'KFSR', 'КФСР(Классификация)', 'KFSR', 0, 5201, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(520101013, 'КВРКлюч', 'KVR', 'КВРКлюч', 'KVR', 0, 5201, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(520101014, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'KVRCode', 0, 5201, 1, 0, 'КВР', 0, null) ;

CALL ImportField(520101015, 'КВСРКлюч', 'KVSR', 'КВСРКлюч', 'KVSR', 0, 5201, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(520101016, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'KVSRCode', 0, 5201, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(520101017, 'Тип средств', 'MEANSTYPE', 'Тип средств', 'MEANSTYPE', 0, 5201, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(520101018, 'Индекс данных', 'PROGINDEX', 'Индекс данных', 'PROGINDEX', 0, 5201, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(520101019, '№ БО', 'PROMISE', '№ БО', 'PROMISE', 0, 5201, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(520101020, 'Код документа', 'RECORDINDEX', 'Код документа', 'RECORDINDEX', 0, 5201, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(520101021, 'Район', 'REGIONCLS', 'Район', 'REGIONCLS', 0, 5201, 1, 0, 'Регион', 0, null) ;

CALL ImportField(520101022, 'Суб КОСГУ', 'SUBKESR', 'Суб КОСГУ', 'SUBKESR', 0, 5201, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(520101023, 'Сумма по исполнительному документу', 'WRITEXECUTIONSUMMA', 'Сумма по исполнительному документу', 'WRITEXECUTIONSUMMA', 0, 5201, 1, 0, 'ИспЛистСумма', 0, null) ;

CALL ImportField(520101030, 'Январь', 'MONTH01', 'Сумма по исполнительному листу на январь', 'MONTH01', 0, 5201, 1, 0, 'ИспЛистЯнварь', 0, null) ;

CALL ImportField(520101031, 'Февраль', 'MONTH02', 'Сумма по исполнительному листу на февраль', 'MONTH02', 0, 5201, 1, 0, 'ИспЛистФевраль', 0, null) ;

CALL ImportField(520101032, 'Март', 'MONTH03', 'Сумма по исполнительному листу на март', 'MONTH03', 0, 5201, 1, 0, 'ИспЛистМарт', 0, null) ;

CALL ImportField(520101033, 'Апрель', 'MONTH04', 'Сумма по исполнительному листу на апрель', 'MONTH04', 0, 5201, 1, 0, 'ИспЛистАпрель', 0, null) ;

CALL ImportField(520101034, 'Май', 'MONTH05', 'Сумма по исполнительному листу на май', 'MONTH05', 0, 5201, 1, 0, 'ИспЛистМай', 0, null) ;

CALL ImportField(520101035, 'Июнь', 'MONTH06', 'Сумма по исполнительному листу на июнь', 'MONTH06', 0, 5201, 1, 0, 'ИспЛистИюнь', 0, null) ;

CALL ImportField(520101036, 'Июль', 'MONTH07', 'Сумма по исполнительному листу на июль', 'MONTH07', 0, 5201, 1, 0, 'ИспЛистИюль', 0, null) ;

CALL ImportField(520101037, 'Август', 'MONTH08', 'Сумма по исполнительному листу на август', 'MONTH08', 0, 5201, 1, 0, 'ИспЛистАвгуст', 0, null) ;

CALL ImportField(520101038, 'Сентябрь', 'MONTH09', 'Сумма по исполнительному листу на сентябрь', 'MONTH09', 0, 5201, 1, 0, 'ИспЛистСентябрь', 0, null) ;

CALL ImportField(520101039, 'Октябрь', 'MONTH10', 'Сумма по исполнительному листу на октябрь', 'MONTH10', 0, 5201, 1, 0, 'ИспЛистОктябрь', 0, null) ;

CALL ImportField(520101040, 'Ноябрь', 'MONTH11', 'Сумма по исполнительному листу на ноябрь', 'MONTH11', 0, 5201, 1, 0, 'ИспЛистНоябрь', 0, null) ;

CALL ImportField(520101041, 'Декабрь', 'MONTH12', 'Сумма по исполнительному листу на декабрь', 'MONTH12', 0, 5201, 1, 0, 'ИспЛистДекабрь', 0, null) ;

CALL ImportField(520101042, 'Квартал 1', 'QUARTER1', 'Сумма по исполнительному листу на первый квартал', 'QUARTER1', 0, 5201, 1, 0, 'ИспЛистКвартал1', 0, null) ;

CALL ImportField(520101043, 'Квартал 2', 'QUARTER2', 'Сумма по исполнительному листу на второй квартал', 'QUARTER2', 0, 5201, 1, 0, 'ИспЛистКвартал2', 0, null) ;

CALL ImportField(520101044, 'Квартал 3', 'QUARTER3', 'Сумма по исполнительному листу на третий квартал', 'QUARTER3', 0, 5201, 1, 0, 'ИспЛистКвартал3', 0, null) ;

CALL ImportField(520101045, 'Квартал 4', 'QUARTER4', 'Сумма по исполнительному листу на четвертый квартал', 'QUARTER4', 0, 5201, 1, 0, 'ИспЛистКвартал4', 0, null) ;

CALL ImportField(520101046, 'Дата помесячных выплат', 'MONTHLYDATE', 'Число для помесячных периодических выплат', 'MONTHLYDATE', 0, 5201, 1, 0, 'ИспЛистДеньПомесячныхВыплат', 0, null) ;

CALL ImportField(520101047, 'День квартальных выплат', 'QUARTERLYMONTHDAY', 'Число для периодических выплат по кварталу', 'QUARTERLYMONTHDAY', 0, 5201, 1, 0, 'ИспЛистДеньКвартальныхВыплат', 0, null) ;

CALL ImportField(520101048, 'Номер месяца квартальных выплат', 'QUARTERLYMONTHNUMBER', 'Номер месяца для периодических выплат по кварталу', 'QUARTERLYMONTHNUMBER', 0, 5201, 1, 0, 'ИспЛистНомерМесяцаКвартальныхВыплат', 0, null) ;

CALL ImportField(520101049, 'Код исходной записи', 'PARENTID', 'Ссылка на строку детализации этой же таблицы.  Поле зарезервировано для уточняющей классификации', ' ', 0, 5201, 1, 1, 'PARENTID', 0, null) ;

CALL ImportField(520102001, 'Код записи', 'id', 'Код записи', 'id', 0, 5201, 2, 1, 'КодДокумента', 0, null) ;

CALL ImportField(520102002, 'Классификация', 'NOTIFYCLS', 'Классификация уведомления', 'NOTIFYCLS', 0, 5201, 2, 1, 'ИспЛистУведКлс', 0, null) ;

CALL ImportField(520102003, 'Описание', 'DESCRIPTION', 'Описание', 'DESCRIPTION', 0, 5201, 2, 0, 'ИспЛистУведОписание', 0, null) ;

CALL ImportField(520102004, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 0, 5201, 2, 0, 'Примечание', 0, null) ;

CALL ImportField(520102005, 'Код документа', 'RECORDINDEX', 'Ссылка на заголовок', 'RECORDINDEX', 0, 5201, 2, 1, 'КодДокумента', 0, null) ;

CALL ImportField(520102006, 'Номер', 'NOTIFYNUMBER', 'Номер уведомления', 'NOTIFYNUMBER', 0, 5201, 2, 0, 'ИспЛистУведНомер', 0, null) ;

CALL ImportField(520102007, 'Дата', 'NOTIFYDATE', 'Дата уведомления', 'NOTIFYDATE', 0, 5201, 2, 0, 'ИспЛистУведДата', 0, null) ;

-- Исполнительные листы, Бюджет(1)
CALL ImportField(520110001, 'Код записи', 'id', 'Код записи', 'id', 1, 5201, 0, 1, 'КодДокумента', 0, 25404) ;

CALL ImportField(520110002, 'Дата выдачи исполнительного документа', 'ISSUEDATE', 'Дата выдачи исполнительного документа', 'ISSUEDATE', 1, 5201, 0, 0, 'ИспЛистДатаВыдачи', 0, 25405) ;

CALL ImportField(520110004, 'Дата заключения(Юридический отдел)', 'LAWDEPARTMENTDATE', 'Дата заключения(Юридический отдел)', 'LAWDEPARTMENTDATE', 1, 5201, 0, 0, 'ИспЛистДатаЗаключения', 0, 25407) ;

CALL ImportField(520110005, 'Номер заключения(Юридический отдел)', 'LAWDEPARTMENTNUMBER', 'Номер заключения(Юридический отдел)', 'LAWDEPARTMENTNUMBER', 1, 5201, 0, 0, 'ИспЛистНомерЗаключения', 0, 25408) ;

CALL ImportField(520110006, 'Счет организации - взыскателя', 'LEVIERACC_REF', 'Ссылка на организации взыскателя', 'LEVIERACC_REF', 1, 5201, 0, 1, 'ИспЛистСсылкаНаСчетОргВзыскателя', 0, 25409) ;

CALL ImportField(520110007, 'Ссылка на организацию взыскателя', 'LEVIERORG_REF', 'Ссылка на организацию взыскателя', 'LEVIERORG_REF', 1, 5201, 0, 1, 'ИспЛистОрганизацияВзыскатель', 0, 25410) ;

CALL ImportField(520110008, 'Наименование судебного органа', 'NAMEJUDICIALAGENCY', 'Наименование судебного органа', 'NAMEJUDICIALAGENCY', 1, 5201, 0, 0, 'ИспЛистНаименСудебногоОргана', 0, 25411) ;

CALL ImportField(520110009, 'Наименование судебного акта', 'NAMEJUDICIALDECISION', 'Наименование судебного акта', 'NAMEJUDICIALDECISION', 1, 5201, 0, 0, 'ИспЛистНаимСудебногоАкта', 0, 25412) ;

CALL ImportField(520110010, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 5201, 0, 0, 'Примечание', 0, 25413) ;

CALL ImportField(520110011, 'Уникальный номер ИЛ', 'UNIQUENUMBER', 'Уникальный номер исполнительного листа ', 'UNIQUENUMBER', 1, 5201, 0, 0, 'ИспЛистУникальныйНомер', 0, 31836) ;

CALL ImportField(520110012, 'Дата предьявления (дата ввода)', 'PRESENTDATE', 'Номер(Уведомление о поступлении)', 'PRESENTDATE', 1, 5201, 0, 0, 'ИспЛистДатаПредъявИспДокумента', 0, 31834) ;

CALL ImportField(520110013, 'Номер дела', 'NUMBERDOSSIER', 'Номер дела', 'NUMBERDOSSIER', 1, 5201, 0, 0, 'ИспЛистНомерДела', 0, 25416) ;

CALL ImportField(520110014, 'Индекс данных', 'PROGINDEX', 'Индекс данных', ' ', 1, 5201, 0, 1, 'ИндексыДанныхЗаголовок', 0, 25417) ;

CALL ImportField(520110015, 'Причина возврата', 'REJECTCAUSE', 'Причина отклонения (комментарий)', 'REJECTCAUSE', 1, 5201, 0, 0, 'ПричинаОтклонТекст', 0, 25419) ;

CALL ImportField(520110016, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'RejectCls', 1, 5201, 0, 1, 'ПричинаОтклонКод', 0, 25418) ;

CALL ImportField(520110017, 'Количество листов приложения', 'SHEETSCOUNT', 'Количество листов приложения', 'SHEETSCOUNT', 1, 5201, 0, 0, 'ИспЛистКолЛистовПриложения', 0, 31835) ;

CALL ImportField(520110018, 'Дата вручения уведомления должнику', 'DELIVERYDATE', 'Дата вручения уведомления должнику', 'DELIVERYDATE', 1, 5201, 0, 0, 'ИспЛистДатаВрученияУвед', 0, 31832) ;

CALL ImportField(520110019, 'Кол-во листов копий судебного акта', 'COURTSHEETSCOUNT', 'Количество листов копий судебного акта', 'COURTSHEETSCOUNT', 1, 5201, 0, 0, 'ИспЛистКолЛистовКопийСудАкта', 0, 31830) ;

CALL ImportField(520110021, 'Дата начала отсчета срока действия ИЛ ', 'STARTDATE', 'Дата начала отсчета срока действия ИЛ ', 'STARTDATE', 1, 5201, 0, 1, 'ИспЛистДатаНачОтсчетаСрокаДействия', 0, 25427) ;

CALL ImportField(520110029, 'Номер исполнительного документа', 'DOCNUMBER', 'Номер исполнительного документа', 'DOCNUMBER', 1, 5201, 0, 0, 'НомерДокумента', 0, 25398) ;

CALL ImportField(520110030, 'Состояние', 'DOCSTATEREF', 'Состояние', 'DOCSTATEREF', 1, 5201, 0, 1, 'СостояниеДокумента', 0, 25399) ;

CALL ImportField(520110032, 'Недействителен', 'ISINVALID', 'Галочка о действительности ИЛ, ставится если был возврат или приостановили без указания срока действия', 'ISINVALID', 1, 5201, 0, 0, 'ИспЛистНедействителен', 0, 31833) ;

CALL ImportField(520110033, 'Л/с владельца документа', 'FACIALACC_CLS', 'Л/с владельца документа', 'FACIALACC_CLS', 1, 5201, 0, 0, 'ЛицевойСчетЗаголовок', 0, 25403) ;

CALL ImportField(520110034, 'Сумма', 'WRITEXECUTIONTOTALSUMMA', 'Сумма', 'WRITEXECUTIONTOTALSUMMA', 1, 5201, 0, 0, 'ИспЛистСуммаДокумента', 0, 25432) ;

CALL ImportField(520110035, 'Взыскатель', 'LivierParent', 'Взыскатель', ' ', 1, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520110037, 'Счет(взыскатель)', 'LivierAcc', 'Счет(взыскатель)', ' ', 1, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520110038, 'ИНН(взыскатель)', 'LivierInn', 'ИНН(взыскатель)', ' ', 1, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520110039, 'КПП(взыскатель)', 'LivierInn20', 'КПП(взыскатель)', ' ', 1, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520110043, 'Наименование организации должника', 'DebtorName', '', ' ', 1, 5201, 0, 0, '', 0, 31831) ;

CALL ImportField(520110044, 'Счет(Взыскатель)', 'LevierAcc', '', ' ', 1, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520110045, 'ИНН(Взыскатель)', 'LevierInn', '', ' ', 1, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520110046, 'Наименование(Взыскатель)', 'LevierName', '', ' ', 1, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520110047, 'Взыскатель', 'LevierParent', '', ' ', 1, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520110048, 'Код клиента УРМ', 'SENDERID', '', 'SenderID', 1, 5201, 0, 0, 'КодОтправителяДокумента', 0, 25425) ;

CALL ImportField(520110049, 'Дата окончания срока действия ИЛ', 'ENDDATE', 'Дата окончания срока действия текущего состояния', 'ENDDATE', 1, 5201, 0, 0, 'ИспЛистДатаКонца', 0, 25402) ;

CALL ImportField(520110050, 'Остаток исполнения', 'ExecutionBalance', '', ' ', 1, 5201, 0, 0, '', 0, null) ;

CALL ImportField(520110051, 'Код категории дела', 'CASECATEGORY', 'Код категории дела', 'CASECATEGORY', 1, 5201, 0, 0, 'ИспЛистКатегория', 0, 31829) ;

CALL ImportField(520110052, 'Тип исп. документа', 'WritType', 'Тип исполнительного документа: 0 - казенные; 1 - БУ/АУ; 2 - Иски к казне', 'WritType', 1, 5201, 0, 0, 'ИспЛистТипДокумента', 0, 31838) ;

CALL ImportField(520110053, 'Периодичность', 'WritPeriod', 'Периодичночть исполнительного  листа: 0 - непериодические; 1 - ежемесячные; 2 - ежеквартальные', 'WritPeriod', 1, 5201, 0, 0, 'ИспЛистПериод', 0, 31837) ;

CALL ImportField(520110054, 'Внутренний номер', 'InnerNumber', '', 'InnerNumber', 1, 5201, 0, 0, 'ИспЛистВнутреннийНомер', 0, null) ;

CALL ImportField(520111001, 'Вн. номер БО', 'BudgetPromise', 'Вн. номер БО', 'BudgetPromise', 1, 5201, 1, 1, 'ДоговораБО', 0, null) ;

CALL ImportField(520111002, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BUDGETREF', 1, 5201, 1, 0, 'КодБюджета', 0, null) ;

CALL ImportField(520111004, 'Тип документа', 'DOCTYPE', 'Тип документа', 'DOCTYPE', 1, 5201, 1, 0, 'ТипДокумента', 0, null) ;

CALL ImportField(520111005, 'Лицевой счет должника', 'FACIALACC_CLS', 'Лицевой счет должника', 'FACIALACC_CLS', 1, 5201, 1, 0, 'ЛицевойСчет', 0, null) ;

CALL ImportField(520111007, 'Источник финансирования', 'FINSOURCE', 'Источник финансирования', 'FINSOURCE', 1, 5201, 1, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(520111009, 'КЦСРКлюч', 'KCSR', 'КЦСРКлюч', 'KCSR', 1, 5201, 1, 1, 'КЦСРКлюч', 0, null) ;

CALL ImportField(520111010, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'KCSR', 1, 5201, 1, 0, 'КЦСР', 0, null) ;

CALL ImportField(520111011, 'ЭКР(Классификация)', 'KESR', 'КЭСР(Классификация)', 'KESR', 1, 5201, 1, 0, 'КЭСР', 0, null) ;

CALL ImportField(520111012, 'ФКР(Классификация)', 'KFSR', 'КФСР(Классификация)', 'KFSR', 1, 5201, 1, 0, 'КФСР', 0, null) ;

CALL ImportField(520111013, 'КВРКлюч', 'KVR', 'КВРКлюч', 'KVR', 1, 5201, 1, 1, 'КВРКлюч', 0, null) ;

CALL ImportField(520111014, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'KVR', 1, 5201, 1, 0, 'КВР', 0, null) ;

CALL ImportField(520111015, 'КВСРКлюч', 'KVSR', 'КВСРКлюч', 'KVSR', 1, 5201, 1, 1, 'КВСРКлюч', 0, null) ;

CALL ImportField(520111016, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'KVSR', 1, 5201, 1, 0, 'КВСР', 0, null) ;

CALL ImportField(520111017, 'Тип средств', 'MEANSTYPE', 'Тип средств', 'MEANSTYPE', 1, 5201, 1, 0, 'ТипСредств', 0, null) ;

CALL ImportField(520111018, 'Индекс данных', 'PROGINDEX', 'Индекс данных', 'PROGINDEX', 1, 5201, 1, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(520111019, '№ БО', 'PROMISE', '№ БО', 'PROMISE', 1, 5201, 1, 0, 'БюджОбяз', 0, null) ;

CALL ImportField(520111020, 'Код документа', 'RECORDINDEX', 'Код документа', 'RECORDINDEX', 1, 5201, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(520111021, 'Район трансферта', 'REGIONCLS', 'Район', 'REGIONCLS', 1, 5201, 1, 0, 'Регион', 0, null) ;

CALL ImportField(520111022, 'Суб КОСГУ', 'SUBKESR', 'Суб КОСГУ', 'SUBKESR', 1, 5201, 1, 0, 'СубКЭСР', 0, null) ;

CALL ImportField(520111023, 'Сумма по исполнительному документу', 'WRITEXECUTIONSUMMA', 'Сумма по исполнительному документу', 'WRITEXECUTIONSUMMA', 1, 5201, 1, 0, 'ИспЛистСумма', 0, null) ;

CALL ImportField(520111024, '№ бюдж. обязательства', 'BudgetPromiseCollaps', '', ' ', 1, 5201, 1, 0, '', 0, null) ;

CALL ImportField(520111025, 'Номер БО получателя(№ бюдж. обязат-ва)', 'BudgetPromiseNum', '', ' ', 1, 5201, 1, 0, '', 0, null) ;

CALL ImportField(520111026, 'Док. исполнения', 'ExecDocCollaps', '', ' ', 1, 5201, 1, 0, '', 0, null) ;

CALL ImportField(520111027, 'Номер(Док. исполнения)', 'ExecDocNum', '', ' ', 1, 5201, 1, 0, '', 0, null) ;

CALL ImportField(520111028, 'Классификация', 'TreeOwner0', '', ' ', 1, 5201, 1, 0, '', 0, null) ;

CALL ImportField(520111029, 'Исполнено на текущий момент', 'WritExecutionSummaExec', '', ' ', 1, 5201, 1, 0, '', 0, null) ;

CALL ImportField(520111030, 'Январь(Периодичные выплаты)', 'MONTH01', 'Сумма по исполнительному листу на январь', 'MONTH01', 1, 5201, 1, 0, 'ИспЛистЯнварь', 0, null) ;

CALL ImportField(520111031, 'Февраль(Периодичные выплаты)', 'MONTH02', 'Сумма по исполнительному листу на февраль', 'MONTH02', 1, 5201, 1, 0, 'ИспЛистФевраль', 0, null) ;

CALL ImportField(520111032, 'Март(Периодичные выплаты)', 'MONTH03', 'Сумма по исполнительному листу на март', 'MONTH03', 1, 5201, 1, 0, 'ИспЛистМарт', 0, null) ;

CALL ImportField(520111033, 'Апрель(Периодичные выплаты)', 'MONTH04', 'Сумма по исполнительному листу на апрель', 'MONTH04', 1, 5201, 1, 0, 'ИспЛистАпрель', 0, null) ;

CALL ImportField(520111034, 'Май(Периодичные выплаты)', 'MONTH05', 'Сумма по исполнительному листу на май', 'MONTH05', 1, 5201, 1, 0, 'ИспЛистМай', 0, null) ;

CALL ImportField(520111035, 'Июнь(Периодичные выплаты)', 'MONTH06', 'Сумма по исполнительному листу на июнь', 'MONTH06', 1, 5201, 1, 0, 'ИспЛистИюнь', 0, null) ;

CALL ImportField(520111036, 'Июль(Периодичные выплаты)', 'MONTH07', 'Сумма по исполнительному листу на июль', 'MONTH07', 1, 5201, 1, 0, 'ИспЛистИюль', 0, null) ;

CALL ImportField(520111037, 'Август(Периодичные выплаты)', 'MONTH08', 'Сумма по исполнительному листу на август', 'MONTH08', 1, 5201, 1, 0, 'ИспЛистАвгуст', 0, null) ;

CALL ImportField(520111038, 'Сентябрь(Периодичные выплаты)', 'MONTH09', 'Сумма по исполнительному листу на сентябрь', 'MONTH09', 1, 5201, 1, 0, 'ИспЛистСентябрь', 0, null) ;

CALL ImportField(520111039, 'Октябрь(Периодичные выплаты)', 'MONTH10', 'Сумма по исполнительному листу на октябрь', 'MONTH10', 1, 5201, 1, 0, 'ИспЛистОктябрь', 0, null) ;

CALL ImportField(520111040, 'Ноябрь(Периодичные выплаты)', 'MONTH11', 'Сумма по исполнительному листу на ноябрь', 'MONTH11', 1, 5201, 1, 0, 'ИспЛистНоябрь', 0, null) ;

CALL ImportField(520111041, 'Декабрь(Периодичные выплаты)', 'MONTH12', 'Сумма по исполнительному листу на декабрь', 'MONTH12', 1, 5201, 1, 0, 'ИспЛистДекабрь', 0, null) ;

CALL ImportField(520111042, 'Квартал 1(Периодичные выплаты)', 'QUARTER1', 'Сумма по исполнительному листу на первый квартал', 'QUARTER1', 1, 5201, 1, 0, 'ИспЛистКвартал1', 0, null) ;

CALL ImportField(520111043, 'Квартал 2(Периодичные выплаты)', 'QUARTER2', 'Сумма по исполнительному листу на второй квартал', 'QUARTER2', 1, 5201, 1, 0, 'ИспЛистКвартал2', 0, null) ;

CALL ImportField(520111044, 'Квартал 3(Периодичные выплаты)', 'QUARTER3', 'Сумма по исполнительному листу на третий квартал', 'QUARTER3', 1, 5201, 1, 0, 'ИспЛистКвартал3', 0, null) ;

CALL ImportField(520111045, 'Квартал 4(Периодичные выплаты)', 'QUARTER4', 'Сумма по исполнительному листу на четвертый квартал', 'QUARTER4', 1, 5201, 1, 0, 'ИспЛистКвартал4', 0, null) ;

CALL ImportField(520111046, 'День месяца для помесячных выплат(Периодичные выплаты)', 'MONTHLYDATE', 'Число для помесячных периодических выплат', 'MONTHLYDATE', 1, 5201, 1, 0, 'ИспЛистДатаПомесячныхВыплат', 0, null) ;

CALL ImportField(520111047, 'День месяца для поквартальных выплат(Периодичные выплаты)', 'QUARTERLYMONTHDAY', 'Число для периодических выплат по кварталу', 'QUARTERLYMONTHDAY', 1, 5201, 1, 0, 'ИспЛистДеньКвартальныхВыплат', 0, null) ;

CALL ImportField(520111048, 'Номер месяца для поквартальных выплат(Периодичные выплаты)', 'QUARTERLYMONTHNUMBER', 'Номер месяца для периодических выплат по кварталу', 'QUARTERLYMONTHNUMBER', 1, 5201, 1, 0, 'ИспЛистНомерМесяцаКвартальныхВыплат', 0, null) ;

CALL ImportField(520111049, 'Код исходной записи', 'PARENTID', 'Ссылка на строку детализации этой же таблицы.  Поле зарезервировано для уточняющей классификации', ' ', 1, 5201, 1, 1, 'PARENTID', 0, null) ;

CALL ImportField(520112001, 'Код записи', 'id', 'Код записи', 'id', 1, 5201, 2, 1, 'КодДокумента', 0, null) ;

CALL ImportField(520112002, 'Тип уведомления (код)', 'NOTIFYCLS', 'Классификация уведомления', 'NOTIFYCLS', 1, 5201, 2, 0, 'ИспЛистУведКлс', 0, 31865) ;

CALL ImportField(520112003, 'Описание', 'DESCRIPTION', 'Описание', 'DESCRIPTION', 1, 5201, 2, 0, 'ИспЛистУведОписание', 0, null) ;

CALL ImportField(520112004, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 5201, 2, 0, 'Примечание', 0, 31864) ;

CALL ImportField(520112005, 'Код документа', 'RECORDINDEX', 'Ссылка на заголовок', 'RECORDINDEX', 1, 5201, 2, 1, 'КодДокумента', 0, null) ;

CALL ImportField(520112006, 'Номер', 'NOTIFYNUMBER', 'Номер уведомления', 'NOTIFYNUMBER', 1, 5201, 2, 0, 'ИспЛистУведНомер', 0, null) ;

CALL ImportField(520112007, 'Дата', 'NOTIFYDATE', 'Дата уведомления', 'NOTIFYDATE', 1, 5201, 2, 0, 'ИспЛистУведДата', 0, null) ;

CALL ImportField(520112008, 'Тип уведомления (краткое наименование)', 'NotifyClsShortName', '', ' ', 1, 5201, 2, 0, '', 0, 31878) ;

-- Уведомление об уточнении поступлений, УРМ(0)
CALL ImportField(550100005, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 0, 5501, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(550100008, 'Исходный документ', 'OriginalAttr', 'Исходный документ', ' ', 0, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550100013, 'Плательщик(Исходный документ)', 'OriginalPayerParent', 'Плательщик(Исходный документ)', ' ', 0, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550100014, 'Справочник организаций(Исходный документ\Плательщик)', 'OriginalPayerhandBook', 'Справочник организаций(Плательщик)', ' ', 0, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550100026, 'Получатель(Исходный документ)', 'OriginalAcceptorParent', 'Получатель(Исходный документ)', ' ', 0, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550100027, 'Справочник организаций(Исходный документ\Получатель)', 'OriginalAcceptorHandBook', 'Справочник организаций(Получатель)', ' ', 0, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550100082, 'Ссылка на электронную копию', 'PayDocRef', '', ' ', 0, 5501, 0, 1, '', 0, null) ;

CALL ImportField(550100094, 'Признак электронного документа', 'ElDocRef', 'Признак электронного документа', ' ', 0, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550100097, 'Филиал(Исходный документ\Плательщик)', 'OriginalPayerBankFilName', 'Филиал(Плательщик)', ' ', 0, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550100098, 'Филиал(Исходный документ\Получатель)', 'OriginalAcceptorBankFilName', 'Филиал(Получатель)', ' ', 0, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550100101, 'Территориальный орган(Администратор поступлений)', 'TerritorialFKParent', 'Территориальный орган(Администратор поступлений)', ' ', 0, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550100110, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 5501, 0, 1, '', 0, null) ;

CALL ImportField(550100111, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 5501, 0, 1, '', 0, null) ;

CALL ImportField(550100112, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 5501, 0, 1, '', 0, null) ;

CALL ImportField(550100113, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 5501, 0, 1, '', 0, null) ;

CALL ImportField(550100120, 'Сумма договора', 'BudgetPromiseAgrSumma', 'Сумма договора', 'BudgetPromiseAgrSumma', 0, 5501, 0, 1, '', 0, null) ;

CALL ImportField(550100140, 'Номер эл. документа(Исходный документ)', 'ELNUM', '', ' ', 0, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550100141, 'Паспортные данные', 'PersonalInfo', '', ' ', 0, 5501, 0, 0, 'ПаспортныеДанные', 0, null) ;

CALL ImportField(550100159, 'Номер заявки', 'RequestNUmber', 'Номер заявки', 'RequestNUmber', 0, 5501, 0, 0, 'НомерЗаявки', 0, null) ;

CALL ImportField(550100162, 'Счет ФО', 'FoAcc', 'Счет ФО', ' ', 0, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550101050, 'Исходная классификация', 'OriginalClassification', 'Исходная классификация', ' ', 0, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550101053, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 0, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550101078, 'Новая организация', 'ChangeParent', 'Новая организация', ' ', 0, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550101079, 'Справочник организаций(Новая организация)', 'ChangeHandBook', 'Справочник организаций(Новая организация)', ' ', 0, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550101115, 'Ссылка на внутренний номер БО получателя', '', 'Ссылка на внутренний номер БО получателя', 'DestBudgetPromise', 0, 5501, 1, 1, '', 0, null) ;

CALL ImportField(550101116, 'Вн. номер БО', 'BudgetPromise', '', 'BudgetPromise', 0, 5501, 1, 1, 'ДоговораБОПолуч', 0, null) ;

CALL ImportField(550101117, 'Дата договора', 'BudgetPromiseAgrDate', 'Дата договора', 'BudgetPromiseAgrDate', 0, 5501, 1, 1, 'ДоговораБОДатаДоговора', 0, null) ;

CALL ImportField(550101118, 'Номер договора', 'BudgetPromiseAgrNum', 'Номер договора', 'BudgetPromiseAgrNum', 0, 5501, 1, 1, 'ДоговораБОНомерДоговора', 0, null) ;

CALL ImportField(550101119, 'Реестровый номер дог.', 'BudgetPromiseAgrRNum', 'Реестровый номер дог.', 'BudgetPromiseAgrRNum', 0, 5501, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(550101121, '№ бюдж. обязат-ва', 'BudgetPromiseCollaps', 'Бюджетное обязательство плательщика', 'BudgetPromiseCollaps', 0, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550101123, 'Дата гос. контракта', 'BudgetPromiseSODate', 'Дата гос. контракта', 'BudgetPromiseSODate', 0, 5501, 1, 1, 'ДоговораБОДатаДоговора', 0, null) ;

CALL ImportField(550101124, 'Прим. гос. контракта', 'BudgetPromiseSONote', 'Прим. гос. контракта', 'BudgetPromiseSONote', 0, 5501, 1, 1, 'ДоговораБОПримечаниеДоговора', 0, null) ;

CALL ImportField(550101125, 'Номер гос. контракта', 'BudgetPromiseSONum', 'Номер гос. контракта', 'BudgetPromiseSONum', 0, 5501, 1, 1, 'ДоговораБОНомерДоговора', 0, null) ;

CALL ImportField(550101126, 'Реестровый номер гос. контр', 'BudgetPromiseSORNum', 'Реестровый номер гос. контр', 'BudgetPromiseSORNum', 0, 5501, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(550101127, 'Сумма гос. контракта', 'BudgetPromiseSOSumma', 'Сумма гос. контракта', ' ', 0, 5501, 1, 1, '', 0, null) ;

CALL ImportField(550101128, 'Сумма БО', 'BudgetPromiseSumma', 'Сумма БО', 'BudgetPromiseSumma', 0, 5501, 1, 1, 'ДоговораБОСумма', 0, null) ;

CALL ImportField(550101130, 'Док. исполнения', 'ExecDocCollaps', '', ' ', 0, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550101131, 'Дата(Док. исполнения плательщика)', 'ExecDocDate', 'Дата ДИ плательщика', 'ExecDocDate', 0, 5501, 1, 1, 'ДокИсполненияДата', 0, null) ;

CALL ImportField(550101132, 'Назначение(Док. исполнения плательщика)', 'ExecDocNote', 'Примечание ДИ плательщика', 'ExecDocNote', 0, 5501, 1, 1, 'ДокИсполненияПримечание', 0, null) ;

CALL ImportField(550101133, 'Номер(Док. исполнения)', 'ExecDocNum', '', 'ExecDocNum', 0, 5501, 1, 1, '', 0, null) ;

CALL ImportField(550101134, 'Рестровый номер(Док. исполнения плательщика)', 'ExecDocReestr', 'Реестровый номер ДИ плательщика', 'ExecDocReestr', 0, 5501, 1, 1, 'ДокИсполненияНомерРеестра', 0, null) ;

CALL ImportField(550101135, 'Сумма(Док. исполнения плательщика)', 'ExecDocSumma', 'Сумма по ДИ плательщика', 'ExecDocSumma', 0, 5501, 1, 1, 'ДокИсполненияСумма', 0, null) ;

CALL ImportField(550101136, 'Тип(Док. исполнения плательщика)', 'ExecDocType', 'Тип ДИ плательщика', 'ExecDocType', 0, 5501, 1, 1, 'ДокИсполненияТип', 0, null) ;

CALL ImportField(550101154, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 5501, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(550101155, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 0, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550101163, 'Источник внутр. и внеш. финанс.', 'IFSCode', 'Источник внутр. и внеш. финанс.', 'IFSValue', 0, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550101165, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 0, 5501, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(550101166, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 5501, 1, 0, 'КодСубсидии', 0, null) ;

-- Уведомление об уточнении поступлений, Бюджет(1)
CALL ImportField(550110003, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 1, 5501, 0, 0, 'КодБюджета', 0, 22846) ;

CALL ImportField(550110004, 'Дата формирования', 'InputDate', 'Дата формирования', 'InputDate', 1, 5501, 0, 0, 'ДатаВвода', 0, 22848) ;

CALL ImportField(550110005, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 1, 5501, 0, 0, 'ДатаПринятия', 0, 22849) ;

CALL ImportField(550110006, 'Сумма уточнения', 'Summa', 'Сумма уточнения', 'summa', 1, 5501, 0, 0, '', 0, 22850) ;

CALL ImportField(550110007, 'Класс исходного документа', 'OriginalProgindex', 'Класс исходного документа', 'OriginalProgIndex', 1, 5501, 0, 1, 'ИсхДокКлассДокумента', 0, 22861) ;

CALL ImportField(550110008, 'Исходный документ', 'OriginalAttr', 'Исходный документ', ' ', 1, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550110009, 'Номер(Исходный документ)', 'OriginalNumber', 'Номер(Исходный документ)', 'OriginalNumber', 1, 5501, 0, 0, 'ИсхДокНомер', 0, 22857) ;

CALL ImportField(550110010, 'Сумма(Исходный документ)', 'OriginalSumma', 'Сумма(Исходный документ)', 'OriginalSumma', 1, 5501, 0, 0, 'ИсхДокСумма', 0, 22859) ;

CALL ImportField(550110011, 'Дата(Исходный документ)', 'OriginalDate', 'Дата(Исходный документ)', 'OriginalDate', 1, 5501, 0, 0, 'ИсхДокДата', 0, 22858) ;

CALL ImportField(550110012, 'Назначение платежа(Исходный документ)', 'OriginalNote', 'Назначение платежа(Исходный документ)', 'OriginalNote', 1, 5501, 0, 0, 'ИсхДокНазначение', 0, 22860) ;

CALL ImportField(550110013, 'Плательщик(Исходный документ)', 'OriginalPayerParent', 'Плательщик(Исходный документ)', ' ', 1, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550110014, 'Справочник организаций(Исходный документ\Плательщик)', 'OriginalPayerhandBook', 'Справочник организаций(Плательщик)', ' ', 1, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550110015, 'Счет(Исходный документ\Плательщик)', 'OriginalPayerAcc', 'Счет(Плательщик)', 'OriginalPayerAcc', 1, 5501, 0, 0, 'ИсхДокПлатСчет', 0, 22864) ;

CALL ImportField(550110016, 'Организация(Исходный документ\Плательщик)', 'OriginalPayerOrgName', 'Организация(Плательщик)', 'OriginalPayerOrgName', 1, 5501, 0, 0, 'ИсхДокПлатИмя', 0, 22865) ;

CALL ImportField(550110017, 'ИНН(Исходный документ\Плательщик)', 'OriginalPayerOrgInn', 'ИНН(Плательщик)', 'OriginalPayerOrgINN', 1, 5501, 0, 0, 'ИсхДокПлатИНН', 0, 22902) ;

CALL ImportField(550110018, 'КПП(Исходный документ\Плательщик)', 'OriginalPayerOrgInn20', 'КПП(Плательщик)', 'OriginalPayerOrgINN20', 1, 5501, 0, 0, 'ИсхДокПлатКПП', 0, 22866) ;

CALL ImportField(550110019, 'Банк', 'OriginalPayerBankName', 'Банк(Плательщик)', 'OriginalPayerBankName', 1, 5501, 0, 1, 'ИсхДокПлатБанкИмя', 0, 22867) ;

CALL ImportField(550110020, 'БИК', 'OriginalPayerBankMfo', 'БИК(Плательщик)', 'OriginalPayerBankMFO', 1, 5501, 0, 1, 'ИсхДокПлатБанкБИК', 0, 22868) ;

CALL ImportField(550110021, 'Кор. счет', 'OriginalPayerBankCor', 'Кор. счет(Плательщик)', 'OriginalPayerBankCor', 1, 5501, 0, 1, 'ИсхДокПлатБанкКорСчет', 0, 22869) ;

CALL ImportField(550110022, 'ИНН_ФК(Исходный документ\Плательщик)', 'OriginalPayerFKOrgINN', 'ИНН_ФК(Плательщик)', 'OriginalPayerFKOrgINN', 1, 5501, 0, 0, 'ИсхДокПлатОргУФКИНН', 0, 22870) ;

CALL ImportField(550110023, 'Наименование_ФК(Исходный документ\Плательщик)', 'OriginalPayerFKOrgName', 'Наименование_ФК(Плательщик)', 'OriginalPayerFKOrgName', 1, 5501, 0, 0, 'ИсхДокПлатОргУФКИмя', 0, 22871) ;

CALL ImportField(550110024, 'ЛС_ФК(Исходный документ\Плательщик)', 'OriginalPayerFKLS', 'ЛС_ФК(Плательщик)', 'OriginalPayerFKLS', 1, 5501, 0, 0, 'ИсхДокПлатОргУФКЛС', 0, 22872) ;

CALL ImportField(550110025, 'Код_ФК(Исходный документ\Плательщик)', 'OriginalPayerFKCode', 'Код_ФК(Плательщик)', 'OriginalPayerFKCode', 1, 5501, 0, 1, 'ИсхДокПлатОргУФККод', 0, 22894) ;

CALL ImportField(550110026, 'Получатель(Исходный документ)', 'OriginalAcceptorParent', 'Получатель(Исходный документ)', ' ', 1, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550110027, 'Справочник организаций(Исходный документ\Получатель)', 'OriginalAcceptorHandBook', 'Справочник организаций(Получатель)', ' ', 1, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550110028, 'Счет(Исходный документ\Получатель)', 'OriginalAcceptorAcc', 'Счет(Получатель)', 'OriginalAcceptorAcc', 1, 5501, 0, 0, 'ИсхДокПолучСчет', 0, 22874) ;

CALL ImportField(550110029, 'Организация(Исходный документ\Получатель)', 'OriginalAcceptorOrgName', 'Организация(Получатель)', 'OriginalAcceptorOrgName', 1, 5501, 0, 0, 'ИсхДокПолучИмя', 0, 22875) ;

CALL ImportField(550110030, 'ИНН(Исходный документ\Получатель)', 'OriginalAcceptorOrgInn', 'ИНН(Получатель)', 'OriginalAcceptorOrgINN', 1, 5501, 0, 0, 'ИсхДокПолучИНН', 0, 22903) ;

CALL ImportField(550110031, 'КПП(Исходный документ\Получатель)', 'OriginalAcceptorOrgInn20', 'КПП(Получатель)', 'OriginalAcceptorOrgINN20', 1, 5501, 0, 0, 'ИсхДокПолучКПП', 0, 22876) ;

CALL ImportField(550110032, 'Банк', 'OriginalAcceptorBankName', 'Банк(Получатель)', 'OriginalAcceptorBankName', 1, 5501, 0, 1, 'ИсхДокПолучБанкИмя', 0, 22877) ;

CALL ImportField(550110033, 'БИК', 'OriginalAcceptorBankMfo', 'БИК(Получатель)', 'OriginalAcceptorBankMFO', 1, 5501, 0, 1, 'ИсхДокПолучБанкБИК', 0, 22878) ;

CALL ImportField(550110034, 'Кор. счет', 'OriginalAcceptorBankCor', 'Кор. счет(Получатель)', 'OriginalAcceptorBankCor', 1, 5501, 0, 1, 'ИсхДокПолучБанкКорСчет', 0, 22879) ;

CALL ImportField(550110035, 'ИНН_ФК(Исходный документ\Получатель)', 'OriginalAcceptorFKOrgINN', 'ИНН_ФК(Получатель)', 'OriginalAcceptorFKOrgINN', 1, 5501, 0, 0, 'ИсхДокПолучОргУФКИНН', 0, 22880) ;

CALL ImportField(550110036, 'Наименование_ФК(Исходный документ\Получатель)', 'OriginalAcceptorFKOrgName', 'Наименование_ФК(Получатель)', 'OriginalAcceptorFKOrgName', 1, 5501, 0, 0, 'ИсхДокПолучОргУФКИмя', 0, 22881) ;

CALL ImportField(550110037, 'ЛС_ФК(Исходный документ\Получатель)', 'OriginalAcceptorFKLS', 'ЛС_ФК(Получатель)', 'OriginalAcceptorFKLS', 1, 5501, 0, 0, 'ИсхДокПолучОргУФКЛС', 0, 22882) ;

CALL ImportField(550110038, 'Код_ФК(Исходный документ\Получатель)', 'OriginalAcceptorFKCode', 'Код_ФК(Получатель)', 'OriginalAcceptorFKCode', 1, 5501, 0, 0, 'ИсхДокПолучОргУФККод', 0, 22893) ;

CALL ImportField(550110039, 'Основание', 'NoteEx', 'Основание', 'Основание', 1, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550110040, 'Примечание', 'Note', 'Примечание', 'Note', 1, 5501, 0, 0, 'ПримечаниеЗаголовка', 0, 22851) ;

CALL ImportField(550110041, 'Причина отклонения', 'Reject_Cls', 'Причина отклонения', 'Reject_Cls', 1, 5501, 0, 0, 'ПричинаОтклонКод', 0, 22883) ;

CALL ImportField(550110042, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 5501, 0, 0, 'ПричинаОтклонТекст', 0, 22884) ;

CALL ImportField(550110043, 'Код записи', 'id', 'Код записи', 'ID', 1, 5501, 0, 1, 'КодДокумента', 0, 22844) ;

CALL ImportField(550110044, 'Тип уведомления', 'DocType', 'Тип уведомления', 'DocType', 1, 5501, 0, 0, 'ТипУведомления', 0, 22852) ;

CALL ImportField(550110045, 'Вид уведомления', 'ProgIndex', 'Вид уведомления', 'ProgIndex', 1, 5501, 0, 1, 'ИндексыДанныхЗаголовок', 0, 22853) ;

CALL ImportField(550110046, 'ИсхДокКлассДокументаСсылка', 'OriginalRecordindex', 'ИсхДокКлассДокументаСсылка', 'ИсхДокКлассДокументаСсылка', 1, 5501, 0, 1, 'ИсхДокКлассДокументаСсылка', 0, 22862) ;

CALL ImportField(550110047, 'СсылкаНаСчет', 'OriginalPayerAcc_Ref', 'СсылкаНаСчет', 'OriginalPayerAcc_RefFUID', 1, 5501, 0, 1, 'ИсхДокПлатСсылкаНаСчет', 0, 22863) ;

CALL ImportField(550110048, 'СсылкаНаСчет', 'OriginalAcceptorAcc_Ref', 'СсылкаНаСчет', 'OriginalAcceptorAcc_refFUID', 1, 5501, 0, 1, 'ИсхДокПолучСсылкаНаСчет', 0, 22873) ;

CALL ImportField(550110082, 'Ссылка на электронную копию', 'PayDocRef', 'Ссылка на электронную копию', ' ', 1, 5501, 0, 1, '', 0, null) ;

CALL ImportField(550110094, 'Признак электронного документа', 'ElDocRef', 'Признак электронного документа', ' ', 1, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550110095, 'Направление операции', 'OperationDirection', 'Направление операции', ' ', 1, 5501, 0, 1, 'НаправлениеОперации', 0, 22854) ;

CALL ImportField(550110096, 'Дата учета', 'RecordDate', 'Дата учета', 'RecordDate', 1, 5501, 0, 0, 'ДатаУчета', 0, 22906) ;

CALL ImportField(550110097, 'Филиал', 'OriginalPayerBankFilName', 'Филиал(Плательщик)', ' ', 1, 5501, 0, 1, 'ИсхДокПлатБанкФилиалИмя', 0, null) ;

CALL ImportField(550110098, 'Филиал', 'OriginalAcceptorBankFilName', 'Филиал(Получатель)', ' ', 1, 5501, 0, 1, 'ИсхДокПолучБанкФилиалИмя', 0, null) ;

CALL ImportField(550110099, 'ИНН(Администратор поступлений)', 'AdminAcceptorInn', 'ИНН(Администратор поступлений)', ' ', 1, 5501, 0, 0, 'ОргАдминПостИНН', 0, 22895) ;

CALL ImportField(550110100, 'КПП(Администратор поступлений)', 'AdminAcceptorInn20', 'КПП(Администратор поступлений)', ' ', 1, 5501, 0, 0, 'ОргАдминПостКПП', 0, 22896) ;

CALL ImportField(550110101, 'Территориальный орган(Администратор поступлений)', 'TerritorialFKParent', 'Территориальный орган(Администратор поступлений)', ' ', 1, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550110102, 'ИНН(Администратор поступлений\Территориальный орган)', 'TerritorialFKInn', 'ИНН(Территориальный орган)', ' ', 1, 5501, 0, 0, 'ТерриторОргФКИНН', 0, 22900) ;

CALL ImportField(550110103, 'КПП(Администратор поступлений\Территориальный орган)', 'TerritorialFKInn20', 'КПП(Территориальный орган)', ' ', 1, 5501, 0, 0, 'ТерриторОргФККПП', 0, 22901) ;

CALL ImportField(550110104, 'Орган федерального казначества', 'FKParent', 'Орган федерального казначества', ' ', 1, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550110105, 'ИНН(Орган федерального казначейства)', 'FKInn', 'ИНН(Орган федерального казначества)', ' ', 1, 5501, 0, 0, 'ИсхДокОргФКИНН', 0, 22897) ;

CALL ImportField(550110106, 'КПП(Орган федерального казначейства)', 'FKInn20', 'КПП(Орган федерального казначества)', ' ', 1, 5501, 0, 0, 'ИсхДокОргФККПП', 0, 22898) ;

CALL ImportField(550110107, 'Наименование(Орган федерального казначейства)', 'FKName', 'Наименование(Орган федерального казначества)', ' ', 1, 5501, 0, 0, 'ИсхДокОргФКИмя', 0, 22899) ;

CALL ImportField(550110108, 'Номер уточнения', 'DocNumber', 'Номер документа', 'DocNumber', 1, 5501, 0, 0, 'НомерДокумента', 0, 22847) ;

CALL ImportField(550110109, 'Основание', 'BasicNote', 'Основание', 'BasicNote', 1, 5501, 0, 0, 'Основание', 0, 22907) ;

CALL ImportField(550110124, 'Сумма договора', 'BudgetPromiseAgrSumma', 'Сумма договора', 'BudgetPromiseAgrSumma', 1, 5501, 0, 1, '', 0, null) ;

CALL ImportField(550110125, 'Номер эл. документа(Исходный документ)', 'ELNUM', 'Номер эл. документа(Исходный документ)', ' ', 1, 5501, 0, 0, 'ИсхДокНомерЭлДокумента', 0, null) ;

CALL ImportField(550110126, 'OKATO(Исходный документ)', 'OKATO', 'OKATO(Исходный документ)', 'OKATO', 1, 5501, 0, 1, 'ОКАТО', 0, 25279) ;

CALL ImportField(550110127, 'Уточнение ОКАТО(Исходный документ)', 'ADDOKATO', 'Уточнение ОКАТО(Исходный документ)', 'ADDOKATO', 1, 5501, 0, 1, 'ДопОКАТО', 0, 25273) ;

CALL ImportField(550110143, 'Персональная информация(Исходный документ\Плательщик)', 'PersonalInfo', 'Персональная информация(Исходный документ\Плательщик)', ' ', 1, 5501, 0, 0, 'ПаспортныеДанные', 0, 25280) ;

CALL ImportField(550110152, 'Лицевой счёт из исходного документа(Исходный документ)', 'FacialAcc_Cls', 'Л/с', 'FacialAcc_Cls', 1, 5501, 0, 0, 'ЛицевойСчетЗаголовок', 0, 25277) ;

CALL ImportField(550110153, 'Обмен с УФК', 'ParentElBank', 'Обмен с УФК', ' ', 1, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550110160, 'Номер заявки', 'RequestNUmber', 'Номер заявки', 'RequestNUmber', 1, 5501, 0, 0, 'НомерЗаявки', 0, 25281) ;

CALL ImportField(550110161, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 5501, 0, 1, 'КриптоСтатус', 0, 25274) ;

CALL ImportField(550110163, 'Отдел', 'DEPARTMENTCLS', 'Отдел', 'DEPARTMENTCLS', 1, 5501, 0, 1, 'Отдел', 0, 27837) ;

CALL ImportField(550110164, 'Счет ФО', 'FoAcc', 'Счет ФО', ' ', 1, 5501, 0, 0, '', 0, null) ;

CALL ImportField(550111049, 'Классификация', 'ParentId', 'Классификация', 'ParentId', 1, 5501, 1, 1, 'СсылкаНаИсходнуюКлассификацию', 0, 22910) ;

CALL ImportField(550111050, 'Исходная классификация', 'OriginalClassification', 'Исходная классификация', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111051, 'Сумма', 'Summa', 'Сумма', 'summa', 1, 5501, 1, 0, '', 0, 22912) ;

CALL ImportField(550111052, 'Л/с', 'FacialAcc_Cls', 'Л/с', 'FacialAcc_Cls', 1, 5501, 1, 0, 'ЛицевойСчет', 0, 22914) ;

CALL ImportField(550111053, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111054, 'КВСРКлюч', 'KVSR', 'КВСР(Классификация)', 'KVSRKey', 1, 5501, 1, 1, 'КВСРКлюч', 0, 22915) ;

CALL ImportField(550111055, 'ФКР(Классификация)', 'KFSR', 'КФСР(Классификация)', 'KFSR', 1, 5501, 1, 0, 'КФСР', 0, 22916) ;

CALL ImportField(550111056, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'KCSRKey', 1, 5501, 1, 1, 'КЦСРКлюч', 0, 22917) ;

CALL ImportField(550111057, 'КВРКлюч', 'KVR', 'КВР(Классификация)', 'KVRKey', 1, 5501, 1, 1, 'КВРКлюч', 0, 22918) ;

CALL ImportField(550111058, 'ЭКР(Классификация)', 'KESR', 'КЭСР(Классификация)', 'KESR', 1, 5501, 1, 0, 'КЭСР', 0, 22919) ;

CALL ImportField(550111059, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111060, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111061, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111062, 'Администратор(Классификация)', 'KDKVSR', 'Администратор(Классификация)', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111063, 'Вид дохода(Классификация)', 'KDDescriptionCode', 'Вид дохода(Классификация)', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111064, 'Подвид(Классификация)', 'KDProgramCode', 'Программа(Классификация)', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111065, 'ЭКД(Классификация)', 'KDKESR', 'ЭКД(Классификация)', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111066, 'Тип классификации', 'clstype', 'Тип классификации', 'ClsType', 1, 5501, 1, 0, 'ТипКлассификации', 0, 22913) ;

CALL ImportField(550111069, 'Тип средств', 'MeansType', 'Тип средств', 'MeansType', 1, 5501, 1, 0, 'ТипСредств', 0, 22921) ;

CALL ImportField(550111070, 'Источник финансирования', 'FinSource', 'Источник финансирования', 'FinSource', 1, 5501, 1, 0, 'ИсточникФинансирования', 0, 22924) ;

CALL ImportField(550111072, 'Тип документа', 'DOCTYPE', 'Тип документа', 'DocType', 1, 5501, 1, 0, 'ТипДокумента', 0, 22926) ;

CALL ImportField(550111073, 'Район трансферта', 'REGIONCLS', 'Район трансферта', 'RegionCls', 1, 5501, 1, 0, 'РайонТрансферта', 0, 22923) ;

CALL ImportField(550111074, 'СубКОСГУ', 'SubKesr', 'СубКЭСР', 'SubKESR', 1, 5501, 1, 0, 'СубКЭСР', 0, 22927) ;

CALL ImportField(550111075, 'Источник образования', 'FundsSource', 'Источник образования', 'FundsSource', 1, 5501, 1, 0, 'ИсточникОбразованияСредств', 0, 22928) ;

CALL ImportField(550111076, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCls', 1, 5501, 1, 0, 'БухОперация', 0, 22931) ;

CALL ImportField(550111078, 'Новая организация', 'ChangeParent', 'Новая организация', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111079, 'Справочник организаций(Новая организация)', 'ChangeHandBook', 'Справочник организаций(Новая организация)', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111080, 'Счет(Новая организация)', 'ChangeAcc', 'Счет(Новая организация)', 'ChangeAcc', 1, 5501, 1, 0, 'НоваяОрганизацияСчет', 0, 22933) ;

CALL ImportField(550111081, 'Наименование(Новая организация)', 'ChangeOrgName', 'Наименование(Новая организация)', 'ChangeOrgName', 1, 5501, 1, 0, 'НоваяОрганизацияИмя', 0, 22934) ;

CALL ImportField(550111082, 'ИНН(Новая организация)', 'ChangeOrgINN', 'ИНН(Новая организация)', 'ChangeOrgINN', 1, 5501, 1, 0, 'НоваяОрганизацияИНН', 0, 22935) ;

CALL ImportField(550111083, 'КПП(Новая организация)', 'ChangeOrgINN20', 'КПП(Новая организация)', 'ChangeOrgINN20', 1, 5501, 1, 0, 'НоваяОрганизацияКПП', 0, 22936) ;

CALL ImportField(550111084, 'Заблокировано(Состояние блокировки)', 'IsBlocked', 'Заблокировано(Состояние блокировки)', 'IsBlocked', 1, 5501, 1, 0, 'ПризнакБлокировки', 0, 22941) ;

CALL ImportField(550111085, 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 1, 5501, 1, 0, 'ПричинаБлокировки', 0, 22942) ;

CALL ImportField(550111086, 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 1, 5501, 1, 0, 'ДатаРазблокировки', 0, 22943) ;

CALL ImportField(550111087, 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 1, 5501, 1, 0, 'ПричинаРазблокировки', 0, 22944) ;

CALL ImportField(550111088, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFS', 1, 5501, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 22930) ;

CALL ImportField(550111089, 'Код записи', 'id', 'Код записи', 'ID', 1, 5501, 1, 1, 'КодЗаписи', 0, 22909) ;

CALL ImportField(550111090, 'Код дохода', 'kd', 'Код дохода', 'KD', 1, 5501, 1, 1, 'КдКлюч', 0, 22929) ;

CALL ImportField(550111091, 'Ссылка на счет', 'ChangeAcc_Ref', 'Ссылка на счет', 'ChangeAcc_RefFUID', 1, 5501, 1, 1, 'НоваяОрганизацияСсылкаНаСчет', 0, 22932) ;

CALL ImportField(550111092, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 5501, 1, 1, 'ИндексыДанных', 0, 22937) ;

CALL ImportField(550111093, 'СсылкаНаДетализациюСвязанногоДокумента', 'DocumentRecordIndex', 'СсылкаНаДетализациюСвязанногоДокумента', 'СсылкаНаДетализациюСвязанногоДокумента', 1, 5501, 1, 1, 'СсылкаНаДетализациюСвязанногоДокумента', 0, null) ;

CALL ImportField(550111108, 'Примечание/Назначение платежа', 'Note', 'Примечание', 'Note', 1, 5501, 1, 0, 'ПримечаниеДетализации', 0, 22952) ;

CALL ImportField(550111110, 'Ссылка на заголовок', 'RecordIndex', 'Код записи', 'RecordIndex', 1, 5501, 1, 1, 'КодДокумента', 0, 22938) ;

CALL ImportField(550111111, 'Вн. номер БО', 'BudgetPromise', 'Вн. номер БО', 'BUDGETPROMISE', 1, 5501, 1, 1, 'ДоговораБОПолуч', 0, 25283) ;

CALL ImportField(550111112, '№ бюдж. обязат-ва', 'BudgetPromiseCollaps', 'Бюджетное обязательство плательщика', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111113, 'Номер БО получателя(№ бюдж. обязат-ва)', 'BudgetPromiseNum', 'Номер БО плательщика(договора)', 'BudgetPromiseNum', 1, 5501, 1, 0, 'БОНомер,ДоговораБОНомер', 0, 20223) ;

CALL ImportField(550111114, 'Номер Д.И. ссылка', 'ExecDoc', 'Номер Д.И. ссылка', 'ExecDoc', 1, 5501, 1, 1, 'ДокИсполненияПолуч', 0, 25284) ;

CALL ImportField(550111115, 'Док. исполнения', 'ExecDocCollaps', 'Док. исполнения', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111116, 'Номер(Док. исполнения)', 'ExecDocNum', 'Номер(Док. исполнения)', 'ExecDocNum', 1, 5501, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(550111117, 'КлассификацияИзменена', 'IsClsChanged', 'КлассификацияИзменена', 'IsClsChanged', 1, 5501, 1, 1, 'КлассификацияИзменена', 0, 22953) ;

CALL ImportField(550111118, '№ БО', 'PROMISE', '№ БО', 'PROMISE', 1, 5501, 1, 0, 'БюджОбяз', 0, 25289) ;

CALL ImportField(550111119, 'Дата договора', 'BudgetPromiseAgrDate', 'Дата договора', 'BudgetPromiseAgrDate', 1, 5501, 1, 1, 'ДоговораБОДатаДоговора', 0, null) ;

CALL ImportField(550111122, 'Номер договора', 'BudgetPromiseAgrNum', 'Номер договора', 'BudgetPromiseAgrNum', 1, 5501, 1, 1, 'ДоговораБОНомерДоговора', 0, null) ;

CALL ImportField(550111123, 'Реестровый номер дог.', 'BudgetPromiseAgrRNum', 'Реестровый номер дог.', 'BudgetPromiseAgrReestrNum', 1, 5501, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, null) ;

CALL ImportField(550111130, 'Сумма гос. контракта', 'BudgetPromiseSOSumma', 'Сумма гос. контракта', ' ', 1, 5501, 1, 1, '', 0, null) ;

CALL ImportField(550111131, 'Сумма БО(№ бюдж. обязат-ва)', 'BudgetPromiseSumma', 'Сумма БО', 'BudgetPromiseSumma', 1, 5501, 1, 1, 'ДоговораБОСумма', 0, 20242) ;

CALL ImportField(550111132, 'Дата(Док. исполнения плательщика)', 'ExecDocDate', 'Дата ДИ плательщика', 'ExecDocDate', 1, 5501, 1, 1, 'ДокИсполненияДата', 0, 19740) ;

CALL ImportField(550111134, 'Назначение(Док. исполнения плательщика)', 'ExecDocNote', 'Примечание ДИ плательщика', 'ExecDocNote', 1, 5501, 1, 1, 'ДокИсполненияПримечание', 0, 19762) ;

CALL ImportField(550111135, 'Рестровый номер(Док. исполнения плательщика)', 'ExecDocReestr', 'Реестровый номер ДИ плательщика', 'ExecDocReestr', 1, 5501, 1, 1, 'ДокИсполненияНомерРеестра', 0, 19756) ;

CALL ImportField(550111136, 'Сумма(Док. исполнения плательщика)', 'ExecDocSumma', 'Сумма по ДИ плательщика', 'ExecDocSumma', 1, 5501, 1, 1, 'ДокИсполненияСумма', 0, 19744) ;

CALL ImportField(550111137, 'Тип(Док. исполнения плательщика)', 'ExecDocType', 'Тип ДИ плательщика', 'ExecDocType', 1, 5501, 1, 1, 'ДокИсполненияТип', 0, 19738) ;

CALL ImportField(550111144, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 5501, 1, 1, 'КодЦелевыхСредствКлюч', 0, 25291) ;

CALL ImportField(550111149, 'Сумма по исходной классификации', 'ORIGINALCLSSUMMA', 'Сумма по исходной классификации', 'ORIGINALCLSSUMMA', 1, 5501, 1, 1, 'СуммаПоКлассификацииИсходногоДокумента', 0, 25288) ;

CALL ImportField(550111150, 'Примечание для строки с новой классификацией', 'NoteCls', 'Примечание для строки с новой классификацией', 'NOTECLS', 1, 5501, 1, 0, 'НазначениеДетализации', 0, 25285) ;

CALL ImportField(550111151, 'Тип операции', 'OperationType', 'Тип операции', 'OperationType', 1, 5501, 1, 1, 'ТипОперацииКлассификации', 0, 25287) ;

CALL ImportField(550111153, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор(Классификация)', ' ', 1, 5501, 1, 0, '', 0, null) ;

CALL ImportField(550111154, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 5501, 1, 1, 'КодСубсидииКлюч', 0, 27700) ;

CALL ImportField(550111157, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 5501, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27838) ;

CALL ImportField(550111159, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayPromiseCls', 1, 5501, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27839) ;

-- Уведомление об уточнении выбытий, УРМ(0)
CALL ImportField(550200008, 'Исходный документ', 'OriginalAttr', 'Исходный документ', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550200013, 'Плательщик(Исходный документ)', 'OriginalPayerParent', 'Плательщик(Исходный документ)', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550200014, 'Справочник организаций(Исходный документ\Плательщик)', 'OriginalPayerhandBook', 'Справочник организаций(Плательщик)', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550200026, 'Получатель(Исходный документ)', 'OriginalAcceptorParent', 'Получатель(Исходный документ)', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550200027, 'Справочник организаций(Исходный документ\Получатель)', 'OriginalAcceptorHandBook', 'Справочник организаций(Получатель)', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550200082, 'Ссылка на электронную копию', 'PayDocRef', '', ' ', 0, 5502, 0, 1, '', 0, null) ;

CALL ImportField(550200094, 'Признак электронного документа', 'io', '', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550200097, 'Филиал(Исходный документ\Плательщик)', 'OriginalPayerBankFilName', 'Филиал(Плательщик)', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550200098, 'Филиал(Исходный документ\Получатель)', 'OriginalAcceptorBankFilName', 'Филиал(Получатель)', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550200101, 'Территориальный орган(Администратор поступлений)', 'TerritorialFKParent', 'Территориальный орган(Администратор поступлений)', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550200104, 'Орган федерального казначества', 'FKParent', 'Орган федерального казначества', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550200112, 'Локальная виза', 'IsVised', 'Локальная виза', 'IsVised', 0, 5502, 0, 1, '', 0, null) ;

CALL ImportField(550200113, 'Есть в Бюджете', 'IsInBudget', 'Есть в Бюджете', 'IsInBudget', 0, 5502, 0, 1, '', 0, null) ;

CALL ImportField(550200114, 'Признак зависания', 'DocSuspended', 'Признак зависания', 'DocSuspended', 0, 5502, 0, 1, '', 0, null) ;

CALL ImportField(550200115, 'Начальное состояние документа', 'BeginDocStateRef', 'Начальное состояние документа', 'BeginDocStateRef', 0, 5502, 0, 1, '', 0, null) ;

CALL ImportField(550200116, 'Дата экстренного изменения', '', 'Дата экстренного изменения', 'LASTEXTRCHANGE', 0, 5502, 0, 1, '', 0, null) ;

CALL ImportField(550200121, 'Паспортные данные', 'PersonalInfo', '', ' ', 0, 5502, 0, 0, 'ПаспортныеДанные', 0, null) ;

CALL ImportField(550200138, 'Признак электронного документа', 'ElDocRef', 'Признак электронного документа', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550200144, 'Номер заявки', 'RequestNUmber', 'Номер заявки', 'RequestNUmber', 0, 5502, 0, 0, 'НомерЗаявки', 0, null) ;

CALL ImportField(550200145, 'Счет ФО', 'FoAcc', 'Счет ФО', ' ', 0, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550201050, 'Исходная классификация', 'OriginalClassification', 'Исходная классификация', ' ', 0, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550201053, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 0, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550201062, 'Администратор(Классификация)', 'KDKVSR', 'Администратор(Классификация)', ' ', 0, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550201078, 'Новая организация', 'ChangeParent', 'Новая организация', ' ', 0, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550201079, 'Справочник организаций(Новая организация)', 'ChangeHandBook', 'Справочник организаций(Новая организация)', ' ', 0, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550201139, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 0, 5502, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(550201148, 'Номер БО(№ бюдж. обязат-ва)', 'BudgetPromiseNum', 'Номер БО плательщика(договора)', 'BudgetPromiseNum', 0, 5502, 1, 0, 'БОНомер,ДоговораБОНомер', 0, null) ;

CALL ImportField(550201149, 'Док. исполнения', 'ExecDocCollaps', '', ' ', 0, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550201151, 'Источник внутр. и внеш. финанс.', 'IFSCode', 'Источник внутр. и внеш. финанс.', 'IFSValue', 0, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550201167, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 0, 5502, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(550201168, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 0, 5502, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(550201169, '№ бюдж. обязат-ва', 'BudgetPromiseCollaps', '№ бюдж. обязат-ва', ' ', 0, 5502, 1, 0, '', 0, null) ;

-- Уведомление об уточнении выбытий, Бюджет(1)
CALL ImportField(550210001, 'Состояние', 'DocStateRef', 'Состояние', 'DocStateREf', 1, 5502, 0, 1, 'СостояниеДокумента', 0, 22887) ;

CALL ImportField(550210002, 'Номер уточнения', 'DocNumber', 'Номер уточнения', 'DocNumber', 1, 5502, 0, 0, 'НомерДокумента', 0, 22847) ;

CALL ImportField(550210003, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 1, 5502, 0, 0, 'КодБюджета', 0, 22846) ;

CALL ImportField(550210004, 'Дата формирования', 'InputDate', 'Дата формирования', 'InputDate', 1, 5502, 0, 0, 'ДатаВвода', 0, 22848) ;

CALL ImportField(550210005, 'Дата принятия', 'AcceptDate', 'Дата принятия', 'AcceptDate', 1, 5502, 0, 0, 'ДатаПринятия', 0, 22849) ;

CALL ImportField(550210006, 'Сумма уточнения', 'Summa', 'Сумма уточнения', 'summa', 1, 5502, 0, 0, '', 0, 22850) ;

CALL ImportField(550210007, 'Класс исходного документа', 'OriginalProgindex', 'Класс исходного документа', 'OriginalProgIndex', 1, 5502, 0, 1, 'ИсхДокКлассДокумента', 0, 22861) ;

CALL ImportField(550210008, 'Исходный документ', 'OriginalAttr', 'Исходный документ', ' ', 1, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550210009, 'Номер(Исходный документ)', 'OriginalNumber', 'Номер(Исходный документ)', 'OriginalNumber', 1, 5502, 0, 0, 'ИсхДокНомер', 0, 22857) ;

CALL ImportField(550210010, 'Сумма(Исходный документ)', 'OriginalSumma', 'Сумма(Исходный документ)', 'OriginalSumma', 1, 5502, 0, 0, 'ИсхДокСумма', 0, 22859) ;

CALL ImportField(550210011, 'Дата(Исходный документ)', 'OriginalDate', 'Дата(Исходный документ)', 'OriginalDate', 1, 5502, 0, 0, 'ИсхДокДата', 0, 22858) ;

CALL ImportField(550210012, 'Назначение платежа(Исходный документ)', 'OriginalNote', 'Назначение платежа(Исходный документ)', 'OriginalNote', 1, 5502, 0, 0, 'ИсхДокНазначение', 0, 22860) ;

CALL ImportField(550210013, 'Плательщик(Исходный документ)', 'OriginalPayerParent', 'Плательщик(Исходный документ)', ' ', 1, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550210014, 'Справочник организаций(Исходный документ\Плательщик)', 'OriginalPayerhandBook', 'Справочник организаций(Плательщик)', ' ', 1, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550210015, 'Счет(Исходный документ\Плательщик)', 'OriginalPayerAcc', 'Счет(Плательщик)', 'OriginalPayerAcc', 1, 5502, 0, 0, 'ИсхДокПлатСчет', 0, 22864) ;

CALL ImportField(550210016, 'Организация(Исходный документ\Плательщик)', 'OriginalPayerOrgName', 'Организация(Плательщик)', 'OriginalPayerOrgName', 1, 5502, 0, 0, 'ИсхДокПлатИмя', 0, 22865) ;

CALL ImportField(550210017, 'ИНН(Исходный документ\Плательщик)', 'OriginalPayerOrgInn', 'ИНН(Плательщик)', 'OriginalPayerOrgINN', 1, 5502, 0, 0, 'ИсхДокПлатИНН', 0, 22902) ;

CALL ImportField(550210018, 'КПП(Исходный документ\Плательщик)', 'OriginalPayerOrgInn20', 'КПП(Плательщик)', 'OriginalPayerOrgINN20', 1, 5502, 0, 0, 'ИсхДокПлатКПП', 0, 22866) ;

CALL ImportField(550210019, 'Банк', 'OriginalPayerBankName', 'Банк(Плательщик)', 'OriginalPayerBankName', 1, 5502, 0, 1, 'ИсхДокПлатБанкИмя', 0, 22867) ;

CALL ImportField(550210020, 'БИК', 'OriginalPayerBankMfo', 'БИК(Плательщик)', 'OriginalPayerBankMFO', 1, 5502, 0, 1, 'ИсхДокПлатБанкБИК', 0, 22868) ;

CALL ImportField(550210021, 'Кор. счет', 'OriginalPayerBankCor', 'Кор. счет(Плательщик)', 'OriginalPayerBankCor', 1, 5502, 0, 1, 'ИсхДокПлатБанкКорСчет', 0, 22869) ;

CALL ImportField(550210022, 'ИНН_ФК(Исходный документ\Плательщик)', 'OriginalPayerFKOrgINN', 'ИНН_ФК(Плательщик)', 'OriginalPayerFKOrgINN', 1, 5502, 0, 0, 'ИсхДокПлатОргУФКИНН', 0, 22870) ;

CALL ImportField(550210023, 'Наименование_ФК(Исходный документ\Плательщик)', 'OriginalPayerFKOrgName', 'Наименование_ФК(Плательщик)', 'OriginalPayerFKOrgName', 1, 5502, 0, 0, 'ИсхДокПлатОргУФКИмя', 0, 22871) ;

CALL ImportField(550210024, 'ЛС_ФК(Исходный документ\Плательщик)', 'OriginalPayerFKLS', 'ЛС_ФК(Плательщик)', 'OriginalPayerFKLS', 1, 5502, 0, 0, 'ИсхДокПлатОргУФКЛС', 0, 22872) ;

CALL ImportField(550210025, 'Код_ФК(Исходный документ\Плательщик)', 'OriginalPayerFKCode', 'Код_ФК(Плательщик)', 'OriginalPayerFKCode', 1, 5502, 0, 1, 'ИсхДокПлатОргУФККод', 0, 22894) ;

CALL ImportField(550210026, 'Получатель(Исходный документ)', 'OriginalAcceptorParent', 'Получатель(Исходный документ)', ' ', 1, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550210027, 'Справочник организаций(Исходный документ\Получатель)', 'OriginalAcceptorHandBook', 'Справочник организаций(Получатель)', ' ', 1, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550210028, 'Счет(Исходный документ\Получатель)', 'OriginalAcceptorAcc', 'Счет(Получатель)', 'OriginalAcceptorAcc', 1, 5502, 0, 0, 'ИсхДокПолучСчет', 0, 22874) ;

CALL ImportField(550210029, 'Организация(Исходный документ\Получатель)', 'OriginalAcceptorOrgName', 'Организация(Получатель)', 'OriginalAcceptorOrgName', 1, 5502, 0, 0, 'ИсхДокПолучИмя', 0, 22875) ;

CALL ImportField(550210030, 'ИНН(Исходный документ\Получатель)', 'OriginalAcceptorOrgInn', 'ИНН(Получатель)', 'OriginalAcceptorOrgINN', 1, 5502, 0, 0, 'ИсхДокПолучИНН', 0, 22903) ;

CALL ImportField(550210031, 'КПП(Исходный документ\Получатель)', 'OriginalAcceptorOrgInn20', 'КПП(Получатель)', 'OriginalAcceptorOrgINN20', 1, 5502, 0, 0, 'ИсхДокПолучКПП', 0, 22876) ;

CALL ImportField(550210032, 'Банк', 'OriginalAcceptorBankName', 'Банк(Получатель)', 'OriginalAcceptorBankName', 1, 5502, 0, 1, 'ИсхДокПолучБанкИмя', 0, 22877) ;

CALL ImportField(550210033, 'БИК', 'OriginalAcceptorBankMfo', 'БИК(Получатель)', 'OriginalAcceptorBankMFO', 1, 5502, 0, 1, 'ИсхДокПолучБанкБИК', 0, 22878) ;

CALL ImportField(550210034, 'Кор. счет', 'OriginalAcceptorBankCor', 'Кор. счет(Получатель)', 'OriginalAcceptorBankCor', 1, 5502, 0, 1, 'ИсхДокПолучБанкКорСчет', 0, 22879) ;

CALL ImportField(550210035, 'ИНН_ФК(Исходный документ\Получатель)', 'OriginalAcceptorFKOrgINN', 'ИНН_ФК(Получатель)', 'OriginalAcceptorFKOrgINN', 1, 5502, 0, 0, 'ИсхДокПолучОргУФКИНН', 0, 22880) ;

CALL ImportField(550210036, 'Наименование_ФК(Исходный документ\Получатель)', 'OriginalAcceptorFKOrgName', 'Наименование_ФК(Получатель)', 'OriginalAcceptorFKOrgName', 1, 5502, 0, 0, 'ИсхДокПолучОргУФКИмя', 0, 22881) ;

CALL ImportField(550210037, 'ЛС_ФК(Исходный документ\Получатель)', 'OriginalAcceptorFKLS', 'ЛС_ФК(Получатель)', 'OriginalAcceptorFKLS', 1, 5502, 0, 0, 'ИсхДокПолучОргУФКЛС', 0, 22882) ;

CALL ImportField(550210038, 'Код_ФК(Исходный документ\Получатель)', 'OriginalAcceptorFKCode', 'Код_ФК(Получатель)', 'OriginalAcceptorFKCode', 1, 5502, 0, 1, 'ИсхДокПолучОргУФККод', 0, 22893) ;

CALL ImportField(550210039, 'Основание', 'NoteEx', 'Основание', 'Основание', 1, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550210040, 'Примечание', 'Note', 'Примечание', 'Note', 1, 5502, 0, 0, 'ПримечаниеЗаголовка', 0, 22851) ;

CALL ImportField(550210041, 'Причина отклонения', 'Reject_Cls', 'Причина отклонения', 'Reject_Cls', 1, 5502, 0, 0, 'ПричинаОтклонКод', 0, 22883) ;

CALL ImportField(550210042, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 5502, 0, 0, 'ПричинаОтклонТекст', 0, 22884) ;

CALL ImportField(550210043, 'Код записи', 'id', 'Код записи', 'ID', 1, 5502, 0, 1, 'КодДокумента', 0, 22844) ;

CALL ImportField(550210044, 'Тип уведомления', 'DocType', 'Тип уведомления', 'DocType', 1, 5502, 0, 0, 'ТипУведомления', 0, 22852) ;

CALL ImportField(550210045, 'Вид уведомления', 'ProgIndex', 'Вид уведомления', 'ProgIndex', 1, 5502, 0, 1, 'ИндексыДанныхЗаголовок', 0, 22853) ;

CALL ImportField(550210046, 'ИсхДокКлассДокументаСсылка', 'OriginalRecordindex', 'ИсхДокКлассДокументаСсылка', 'ИсхДокКлассДокументаСсылка', 1, 5502, 0, 1, 'ИсхДокКлассДокументаСсылка', 0, 22862) ;

CALL ImportField(550210047, 'СсылкаНаСчет', 'OriginalPayerAcc_Ref', 'СсылкаНаСчет', 'OriginalPayerAcc_RefFUID', 1, 5502, 0, 1, 'ИсхДокПлатСсылкаНаСчет', 0, 22863) ;

CALL ImportField(550210048, 'СсылкаНаСчет', 'OriginalAcceptorAcc_Ref', 'СсылкаНаСчет', 'OriginalAcceptorAcc_refFUID', 1, 5502, 0, 1, 'ИсхДокПолучСсылкаНаСчет', 0, 22873) ;

CALL ImportField(550210082, 'Ссылка на электронную копию', 'PayDocRef', 'Ссылка на электронную копию', ' ', 1, 5502, 0, 1, '', 0, null) ;

CALL ImportField(550210094, 'Признак электронного документа', 'ElDocRef', 'Признак электронного документа', ' ', 1, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550210095, 'Направление операции', 'OperationDirection', 'Направление операции', ' ', 1, 5502, 0, 1, 'НаправлениеОперации', 0, 22854) ;

CALL ImportField(550210096, 'Дата учета', 'RecordDate', 'Дата учета', 'RecordDate', 1, 5502, 0, 0, 'ДатаУчета', 0, 22906) ;

CALL ImportField(550210097, 'Филиал', 'OriginalPayerBankFilName', 'Филиал(Плательщик)', ' ', 1, 5502, 0, 1, 'ИсхДокПлатБанкФилиалИмя', 0, null) ;

CALL ImportField(550210098, 'Филиал', 'OriginalAcceptorBankFilName', 'Филиал(Получатель)', ' ', 1, 5502, 0, 1, 'ИсхДокПолучБанкФилиалИмя', 0, null) ;

CALL ImportField(550210099, 'ИНН(Администратор поступлений)', 'AdminAcceptorInn', 'ИНН(Администратор поступлений)', ' ', 1, 5502, 0, 0, 'ОргАдминПостИНН', 0, 22895) ;

CALL ImportField(550210100, 'КПП(Администратор поступлений)', 'AdminAcceptorInn20', 'КПП(Администратор поступлений)', ' ', 1, 5502, 0, 0, 'ОргАдминПостКПП', 0, 22896) ;

CALL ImportField(550210101, 'Территориальный орган(Администратор поступлений)', 'TerritorialFKParent', 'Территориальный орган(Администратор поступлений)', ' ', 1, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550210102, 'ИНН(Администратор поступлений\Территориальный орган)', 'TerritorialFKInn', 'ИНН(Территориальный орган)', ' ', 1, 5502, 0, 0, 'ТерриторОргФКИНН', 0, 22900) ;

CALL ImportField(550210103, 'КПП(Администратор поступлений\Территориальный орган)', 'TerritorialFKInn20', 'КПП(Территориальный орган)', ' ', 1, 5502, 0, 0, 'ТерриторОргФККПП', 0, 22901) ;

CALL ImportField(550210104, 'Орган федерального казначества', 'FKParent', 'Орган федерального казначества', ' ', 1, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550210105, 'ИНН(Орган федерального казначейства)', 'FKInn', 'ИНН(Орган федерального казначества)', ' ', 1, 5502, 0, 0, 'ИсхДокОргФКИНН', 0, 22897) ;

CALL ImportField(550210106, 'КПП(Орган федерального казначейства)', 'FKInn20', 'КПП(Орган федерального казначества)', ' ', 1, 5502, 0, 0, 'ИсхДокОргФККПП', 0, 22898) ;

CALL ImportField(550210107, 'Наименование(Орган федерального казначейства)', 'FKName', 'Наименование(Орган федерального казначества)', ' ', 1, 5502, 0, 0, 'ИсхДокОргФКИмя', 0, 22899) ;

CALL ImportField(550210108, 'Основание', 'BasicNote', 'Основание', 'BasicNote', 1, 5502, 0, 0, 'Основание', 0, 22907) ;

CALL ImportField(550210109, 'Номер эл. документа(Исходный документ)', 'ELNUM', 'Номер эл. документа(Исходный документ)', ' ', 1, 5502, 0, 0, 'ИсхДокНомерЭлДокумента', 0, null) ;

CALL ImportField(550210110, 'OKATO(Исходный документ)', 'OKATO', 'OKATO(Исходный документ)', 'OKATO', 1, 5502, 0, 1, 'ОКАТО', 0, 25279) ;

CALL ImportField(550210111, 'Уточнение ОКАТО(Исходный документ)', 'ADDOKATO', 'Уточнение ОКАТО(Исходный документ)', 'ADDOKATO', 1, 5502, 0, 1, 'ДопОКАТО', 0, 25273) ;

CALL ImportField(550210124, 'Персональная информация(Исходный документ\Получатель)', 'PersonalInfo', 'Персональная информация(Исходный документ\Получатель)', ' ', 1, 5502, 0, 0, 'ПаспортныеДанные', 0, 25280) ;

CALL ImportField(550210136, 'Лицевой счёт из исходного документа(Исходный документ)', 'FacialAcc_Cls', 'Л/с', 'FacialAcc_Cls', 1, 5502, 0, 0, 'ЛицевойСчетЗаголовок', 0, 25277) ;

CALL ImportField(550210137, 'Обмен с УФК', 'ParentElBank', 'Обмен с УФК', ' ', 1, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550210145, 'Номер заявки', 'RequestNUmber', 'Номер заявки', 'RequestNUmber', 1, 5502, 0, 0, 'НомерЗаявки', 0, 25281) ;

CALL ImportField(550210146, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 5502, 0, 1, 'КриптоСтатус', 0, 25274) ;

CALL ImportField(550210147, 'Отдел', 'DEPARTMENTCLS', 'Отдел', 'DEPARTMENTCLS', 1, 5502, 0, 1, 'Отдел', 0, 27837) ;

CALL ImportField(550210148, 'Счет ФО', 'FoAcc', 'Счет ФО', ' ', 1, 5502, 0, 0, '', 0, null) ;

CALL ImportField(550211049, 'Классификация', 'ParentId', 'Классификация', 'ParentId', 1, 5502, 1, 1, 'СсылкаНаИсходнуюКлассификацию', 0, 22910) ;

CALL ImportField(550211050, 'Исходная классификация', 'OriginalClassification', 'Исходная классификация', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211051, 'Сумма', 'Summa', 'Сумма', 'summa', 1, 5502, 1, 0, '', 0, 22912) ;

CALL ImportField(550211052, 'Л/с', 'FacialAcc_Cls', 'Л/с', 'FacialAcc_Cls', 1, 5502, 1, 0, 'ЛицевойСчет', 0, 22914) ;

CALL ImportField(550211053, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211054, 'КВСРКлюч', 'KVSR', 'КВСР(Классификация)', 'KVSRKey', 1, 5502, 1, 1, 'КВСРКлюч', 0, 22915) ;

CALL ImportField(550211055, 'ФКР(Классификация)', 'KFSR', 'КФСР(Классификация)', 'KFSR', 1, 5502, 1, 0, 'КФСР', 0, 22916) ;

CALL ImportField(550211056, 'КЦСРКлюч', 'KCSR', 'КЦСР(Классификация)', 'KCSRKey', 1, 5502, 1, 1, 'КЦСРКлюч', 0, 22917) ;

CALL ImportField(550211057, 'КВРКлюч', 'KVR', 'КВР(Классификация)', 'KVRKey', 1, 5502, 1, 1, 'КВРКлюч', 0, 22918) ;

CALL ImportField(550211058, 'ЭКР(Классификация)', 'KESR', 'КЭСР(Классификация)', 'KESR', 1, 5502, 1, 0, 'КЭСР', 0, 22919) ;

CALL ImportField(550211059, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211060, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211061, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211062, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор(Классификация)', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211063, 'Вид дохода(Классификация)', 'KDDescriptionCode', 'Вид дохода(Классификация)', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211064, 'Подвид(Классификация)', 'KDProgramCode', 'Программа(Классификация)', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211065, 'ЭКД(Классификация)', 'KDKESR', 'ЭКД(Классификация)', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211066, 'Тип классификации', 'clstype', 'Тип классификации', 'ClsType', 1, 5502, 1, 0, 'ТипКлассификации', 0, 22913) ;

CALL ImportField(550211069, 'Тип средств', 'MeansType', 'Тип средств', 'MeansType', 1, 5502, 1, 0, 'ТипСредств', 0, 22921) ;

CALL ImportField(550211070, 'Источник финансирования', 'FinSource', 'Источник финансирования', 'FinSource', 1, 5502, 1, 0, 'ИсточникФинансирования', 0, 22924) ;

CALL ImportField(550211072, 'Тип документа', 'DOCTYPE', 'Тип документа', 'DocType', 1, 5502, 1, 0, 'ТипДокумента', 0, 22926) ;

CALL ImportField(550211073, 'Район трансферта', 'REGIONCLS', 'Район трансферта', 'RegionCls', 1, 5502, 1, 0, 'РайонТрансферта', 0, 22923) ;

CALL ImportField(550211074, 'СубКОСГУ', 'SubKesr', 'СубКЭСР', 'SubKESR', 1, 5502, 1, 0, 'СубКЭСР', 0, 22927) ;

CALL ImportField(550211075, 'Источник образования', 'FundsSource', 'Источник образования', 'FundsSource', 1, 5502, 1, 0, 'ИсточникОбразованияСредств', 0, 22928) ;

CALL ImportField(550211076, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCls', 1, 5502, 1, 0, 'БухОперация', 0, 22931) ;

CALL ImportField(550211078, 'Новая организация', 'ChangeParent', 'Новая организация', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211079, 'Справочник организаций(Новая организация)', 'ChangeHandBook', 'Справочник организаций(Новая организация)', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211080, 'Счет(Новая организация)', 'ChangeAcc', 'Счет(Новая организация)', 'ChangeAcc', 1, 5502, 1, 0, 'НоваяОрганизацияСчет', 0, 22933) ;

CALL ImportField(550211081, 'Наименование(Новая организация)', 'ChangeOrgName', 'Наименование(Новая организация)', 'ChangeOrgName', 1, 5502, 1, 0, 'НоваяОрганизацияИмя', 0, 22934) ;

CALL ImportField(550211082, 'ИНН(Новая организация)', 'ChangeOrgINN', 'ИНН(Новая организация)', 'ChangeOrgINN', 1, 5502, 1, 0, 'НоваяОрганизацияИНН', 0, 22935) ;

CALL ImportField(550211083, 'КПП(Новая организация)', 'ChangeOrgINN20', 'КПП(Новая организация)', 'ChangeOrgINN20', 1, 5502, 1, 0, 'НоваяОрганизацияКПП', 0, 22936) ;

CALL ImportField(550211084, 'Заблокировано(Состояние блокировки)', 'IsBlocked', 'Заблокировано(Состояние блокировки)', 'IsBlocked', 1, 5502, 1, 0, 'ПризнакБлокировки', 0, 22941) ;

CALL ImportField(550211085, 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 'Причина блокировки(Состояние блокировки)', 'BlockedCause', 1, 5502, 1, 0, 'ПричинаБлокировки', 0, 22942) ;

CALL ImportField(550211086, 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', 1, 5502, 1, 0, 'ДатаРазблокировки', 0, 22943) ;

CALL ImportField(550211087, 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', 1, 5502, 1, 0, 'ПричинаРазблокировки', 0, 22944) ;

CALL ImportField(550211088, 'Источниковая классификация', 'IFS', 'Источниковая классификация', 'IFSValue', 1, 5502, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 22930) ;

CALL ImportField(550211089, 'Код записи', 'id', 'Код записи', 'ID', 1, 5502, 1, 1, 'КодЗаписи', 0, 22909) ;

CALL ImportField(550211090, 'Код дохода', 'kd', 'Код дохода', 'KD', 1, 5502, 1, 1, 'КдКлюч', 0, 22929) ;

CALL ImportField(550211091, 'Ссылка на счет', 'ChangeAcc_Ref', 'Ссылка на счет', 'ChangeAcc_RefFUID', 1, 5502, 1, 1, 'НоваяОрганизацияСсылкаНаСчет', 0, 22932) ;

CALL ImportField(550211092, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 5502, 1, 1, 'ИндексыДанных', 0, 22937) ;

CALL ImportField(550211093, 'СсылкаНаДетализациюСвязанногоДокумента', 'DocumentRecordIndex', 'СсылкаНаДетализациюСвязанногоДокумента', 'СсылкаНаДетализациюСвязанногоДокумента', 1, 5502, 1, 1, 'СсылкаНаДетализациюСвязанногоДокумента', 0, null) ;

CALL ImportField(550211108, 'Примечание/Назначение платежа', 'Note', 'Примечание', 'Note', 1, 5502, 1, 0, 'ПримечаниеДетализации', 0, 22952) ;

CALL ImportField(550211109, 'Ссылка на заголовок', 'RecordIndex', 'Код документа', 'RecordIndex', 1, 5502, 1, 1, 'КодДокумента', 0, 22938) ;

CALL ImportField(550211111, '№ бюдж. обязат-ва', 'BudgetPromiseCollaps', '№ бюдж. обязат-ва', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211112, 'Номер БО получателя(№ бюдж. обязат-ва)', 'BudgetPromiseNum', 'Номер БО плательщика(договора)', 'BudgetPromiseNum', 1, 5502, 1, 0, 'БОНомер,ДоговораБОНомер', 0, 20223) ;

CALL ImportField(550211113, 'Номер Д.И. ссылка', 'ExecDoc', 'Номер Д.И. ссылка', 'ExecDoc', 1, 5502, 1, 1, 'ДокИсполненияПолуч', 0, 25284) ;

CALL ImportField(550211114, 'Док. исполнения', 'ExecDocCollaps', 'Док. исполнения', ' ', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211115, 'Номер(Док. исполнения)', 'ExecDocNum', 'Номер(Док. исполнения)', 'ExecDocNum', 1, 5502, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(550211116, 'КлассификацияИзменена', 'IsClsChanged', 'КлассификацияИзменена', 'IsClsChanged', 1, 5502, 1, 1, 'КлассификацияИзменена', 0, 22953) ;

CALL ImportField(550211117, '№ БО', 'PROMISE', '№ БО', 'PROMISE', 1, 5502, 1, 0, 'БюджОбяз', 0, 25289) ;

CALL ImportField(550211125, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 5502, 1, 1, 'КодЦелевыхСредствКлюч', 0, 25291) ;

CALL ImportField(550211130, 'Сумма по исходной классификации', 'ORIGINALCLSSUMMA', 'Сумма по исходной классификации', 'ORIGINALCLSSUMMA', 1, 5502, 1, 1, 'СуммаПоКлассификацииИсходногоДокумента', 0, 25288) ;

CALL ImportField(550211131, 'Примечание для строки с новой классификацией', 'NoteCls', 'Примечание для строки с новой классификацией', 'NOTECLS', 1, 5502, 1, 0, 'НазначениеДетализации', 0, 25285) ;

CALL ImportField(550211132, 'Тип операции', 'OperationType', 'Тип операции', 'OperationType', 1, 5502, 1, 1, 'ТипОперацииКлассификации', 0, 25287) ;

CALL ImportField(550211134, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 5502, 1, 1, 'КодСубсидииКлюч', 0, 27700) ;

CALL ImportField(550211135, 'Код дохода', 'KDValue', '', 'KDValue', 1, 5502, 1, 0, '', 0, null) ;

CALL ImportField(550211136, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 5502, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27838) ;

CALL ImportField(550211138, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayPromiseCls', 1, 5502, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27839) ;

-- Протокол пакетной замены классификации, Бюджет(1)
CALL ImportField(550310001, 'Код записи', 'ID', 'Код записи', 'ID', 1, 5503, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(550310002, 'Номер', 'DocNumber', 'Номер документа', 'DocNumber', 1, 5503, 0, 0, 'ПротоколНомерДокумента', 0, null) ;

CALL ImportField(550310003, 'Дата ввода', 'InputDate', 'Дата ввода документа', 'InputDate', 1, 5503, 0, 0, 'ПротоколДатаВводаДокумента', 0, null) ;

CALL ImportField(550310004, 'Примечание', 'Note', 'Примечание', 'Note', 1, 5503, 0, 0, 'ПротоколПримечаниеЗаголовок', 0, null) ;

CALL ImportField(550310007, 'Причина отклонения', 'Reject_Cls', 'Причина отклонения ПЗК', 'Reject_Cls', 1, 5503, 0, 0, 'ПротоколПричинаОтклонения', 0, null) ;

CALL ImportField(550310008, 'Причина отклонения (комментарий)', 'Reject_Cause', 'Причина отклонения (комментарий)', 'Reject_Cause', 1, 5503, 0, 0, 'ПротоколПричинаОтклоненияКомментарий', 0, null) ;

CALL ImportField(550310009, 'Выполнил ПЗК', 'PZKUser', 'Пользователь, выполнивший ПЗК', 'PZKUser', 1, 5503, 0, 1, 'ПротоколВыполнилПЗК', 0, null) ;

CALL ImportField(550310010, 'Дата начала ПЗК', 'PZKStartDate', 'Дата начала ПЗК', 'PZKStartDate', 1, 5503, 0, 1, 'ПротоколДатаНачалаПЗК', 0, null) ;

CALL ImportField(550310011, 'Дата окончания ПЗК', 'PZKEndDate', 'Дата окончания ПЗК', 'PZKEndDate', 1, 5503, 0, 1, 'ПротоколДатаОкончанияПЗК', 0, null) ;

CALL ImportField(550310012, 'Состояние документа', 'DocStateRef', 'Состояние документа', 'DocStateRef', 1, 5503, 0, 1, 'ПротоколСостояниеДокумента', 0, null) ;

-- Организации, УРМ(0)
CALL ImportField(960100032, 'Наименование (полное)', 'NAME', '', ' ', 0, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960100034, 'Краткое имя', 'SHORTNAME', '', ' ', 0, 9601, 0, 0, '', 0, null) ;

-- Организации, Бюджет(1)
CALL ImportField(960110003, 'Наименование Бюджета', 'BUDGETNAME', '', ' ', 1, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110005, 'ФИО бухгалтера', 'BUGNAME', '', ' ', 1, 9601, 0, 0, '', 0, 16657) ;

CALL ImportField(960110006, 'Телефон бухгалтера', 'BUGPHONE', '', ' ', 1, 9601, 0, 0, '', 0, 16659) ;

CALL ImportField(960110007, 'Дата изменения информации в реестре', 'CHANGEDATE', '', ' ', 1, 9601, 0, 0, '', 0, 16679) ;

CALL ImportField(960110013, 'ФИО директора', 'DIRNAME', '', ' ', 1, 9601, 0, 0, '', 0, 16656) ;

CALL ImportField(960110014, 'Телефон директора', 'DIRPHONE', '', ' ', 1, 9601, 0, 0, '', 0, 16658) ;

CALL ImportField(960110015, 'E-mail адрес', 'EMAIL', '', ' ', 1, 9601, 0, 0, '', 0, 16665) ;

CALL ImportField(960110017, 'Код региона ', 'FEDERALREGIONCODE', '', ' ', 1, 9601, 0, 0, '', 0, 16681) ;

CALL ImportField(960110018, 'ИНН организации-распорядителя', 'GENERALORG_INN', '', ' ', 1, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110019, 'КПП организации-распорядителя', 'GENERALORG_KPP', '', ' ', 1, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110020, 'Наименование организации-распорядителя', 'GENERALORG_NAME', '', ' ', 1, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110022, 'ГосНИ', 'GOSNI', '', ' ', 1, 9601, 0, 0, '', 0, 16647) ;

CALL ImportField(960110027, 'ОКФС', 'OKFS', '', ' ', 1, 9601, 0, 0, '', 0, 16675) ;

CALL ImportField(960110028, 'ОКОПФ', 'OKOPF', '', ' ', 1, 9601, 0, 0, '', 0, 16676) ;

CALL ImportField(960110029, 'Дата включения в реестр', 'OPENDATE', '', ' ', 1, 9601, 0, 0, '', 0, 16677) ;

CALL ImportField(960110032, 'Наименование (полное)', 'ORG_NAME', '', ' ', 1, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110034, 'Краткое имя', 'ORG_SHORTNAME', '', ' ', 1, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110038, 'Сфера применения', 'RCORG', '', ' ', 1, 9601, 0, 0, '', 0, 16660) ;

CALL ImportField(960110040, 'Код удаленного клиента', 'SENDERID', '', ' ', 1, 9601, 0, 0, '', 0, 16673) ;

CALL ImportField(960110043, 'Идентификатор(по РПБС/по КОФК)', 'UFKCODE', '', ' ', 1, 9601, 0, 0, '', 0, 16668) ;

CALL ImportField(960110044, 'Адрес Web-сайта', 'WEBSITE', '', ' ', 1, 9601, 0, 0, '', 0, 16666) ;

CALL ImportField(960110045, '', 'ORG_USECOUNT', '', ' ', 1, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110046, 'По расходам(Бюджетные полномочия)', 'COSTAUTHORITY', '', ' ', 1, 9601, 0, 0, '', 0, 24926) ;

CALL ImportField(960110047, 'По источникам(Бюджетные полномочия)', 'DEBTAUTHORITY', '', ' ', 1, 9601, 0, 0, '', 0, 24927) ;

CALL ImportField(960110048, 'По доходам(Бюджетные полномочия)', 'INCOMEAUTHORITY', '', ' ', 1, 9601, 0, 0, '', 0, 24928) ;

CALL ImportField(960110049, 'По СВР(Бюджетные полномочия)', 'SVRAUTHORITY', '', ' ', 1, 9601, 0, 0, '', 0, 24929) ;

CALL ImportField(960110050, '', 'ORG_REF', '', ' ', 1, 9601, 0, 0, '', 0, 16643) ;

CALL ImportField(960110051, 'Дата открытия', 'DATEOPEN', '', ' ', 1, 9601, 0, 0, '', 0, 31711) ;

-- Организации, УРМ+Бюджет(2)
CALL ImportField(960110001, 'Уточнение ОКАТО', 'ADDOKATO', '', ' ', 2, 9601, 0, 0, '', 0, 16669) ;

CALL ImportField(960110002, 'Адрес', 'ADDRESS', '', ' ', 2, 9601, 0, 0, '', 0, 16651) ;

CALL ImportField(960110008, 'Код заказчика', 'CLIENTID', '', ' ', 2, 9601, 0, 0, '', 0, 16684) ;

CALL ImportField(960110009, 'Дата исключения из реестра', 'CLOSEDATE', '', ' ', 2, 9601, 0, 0, '', 0, 16678) ;

CALL ImportField(960110010, 'Страна', 'COUNTRY', '', ' ', 2, 9601, 0, 0, '', 0, 16649) ;

CALL ImportField(960110011, 'Код страны', 'COUNTRYCODE', '', ' ', 2, 9601, 0, 0, '', 0, 16686) ;

CALL ImportField(960110012, 'Дата закрытия', 'DATECLOSE', '', ' ', 2, 9601, 0, 0, '', 0, 16672) ;

CALL ImportField(960110016, '', 'FACIALACC', '', ' ', 2, 9601, 0, 0, '', 0, 16655) ;

CALL ImportField(960110023, 'ИНН', 'INN', '', ' ', 2, 9601, 0, 0, '', 0, 16645) ;

CALL ImportField(960110025, 'ПППКлюч', 'KVSR', '', ' ', 2, 9601, 0, 0, '', 0, 16674) ;

CALL ImportField(960110026, 'ОКАТО', 'OKATO', '', ' ', 2, 9601, 0, 0, '', 0, 16667) ;

CALL ImportField(960110031, 'Тип организации (старый)', 'ORG_CLS', '', ' ', 2, 9601, 0, 0, '', 0, 16652) ;

CALL ImportField(960110035, 'Вид организации', 'ORG_TYPE', '', ' ', 2, 9601, 0, 0, '', 0, 16682) ;

CALL ImportField(960110036, 'Идентификатор(по РПБС/по КОФК)', 'ORGCODE', '', ' ', 2, 9601, 0, 0, '', 0, 16687) ;

CALL ImportField(960110037, 'Телефон', 'PHONE', '', ' ', 2, 9601, 0, 0, '', 0, 16650) ;

CALL ImportField(960110039, 'Район', 'REGIONCLS', '', ' ', 2, 9601, 0, 0, '', 0, 16644) ;

CALL ImportField(960110041, 'Суб ИНН', 'SUBINN', '', ' ', 2, 9601, 0, 0, '', 0, 16654) ;

CALL ImportField(960110042, 'Статус поставщика', 'SUPPLIERSTATUS', '', ' ', 2, 9601, 0, 0, '', 0, 16685) ;

-- Счета организаций, УРМ(0)
CALL ImportField(960200003, 'Ключ счета(ссылка)', 'ACC_REF', '', ' ', 0, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960200009, 'Описание счета', 'ACOMMENT', '', ' ', 0, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960200013, 'Признак закрытия счета', 'CLOSED', '', ' ', 0, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960200017, 'Тип обслуживающей организации', 'SERVICEACC', '', ' ', 0, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960200023, '', 'FACIALACC_CLS', '', ' ', 0, 9602, 0, 0, '', 0, null) ;

-- Счета организаций, Бюджет(1)
CALL ImportField(960210004, 'Наименование типа счета', 'ACCCLSNAME', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210005, 'Признак закрытия банка', 'BANK_CLOSED', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210006, 'Дата закрытия банка', 'BANK_DATECLOSE', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210009, 'Описание счета', 'COMMENT', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210011, 'Тип финансирования', 'FINTYPE', '', ' ', 1, 9602, 0, 0, '', 0, 17114) ;

CALL ImportField(960210012, 'Счет по умолчанию', 'ISDEFAULT', '', ' ', 1, 9602, 0, 0, '', 0, 17124) ;

CALL ImportField(960210013, 'Признак закрытия счета', 'ORGACC_CLOSED', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210017, 'Тип обслуживающей организации', 'SERVICETYPE', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210018, '', 'BANK_COR', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210019, '', 'BANK_MFO', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210020, 'Банк', 'BANK_REF', '', ' ', 1, 9602, 0, 0, '', 0, 17111) ;

CALL ImportField(960210022, '', 'ORGACC_CLOSECODE', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210023, '', 'ORGACC_FACIALACC', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210024, '', 'ACC_REF', '', ' ', 1, 9602, 0, 0, '', 0, 17109) ;

CALL ImportField(960210025, '', 'SERVICEORG_ACCTYPE', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210026, '', 'SRCFKACC', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210027, '', 'SRCSERVICEBANK', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210028, '', 'SRCSERVICEBANK_COR', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210029, '', 'SRCSERVICEBANK_MFO', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210030, '', 'SRCSERVICEFACIALCODE', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210031, '', 'SRCSERVICESUBFACIALCODE', '', ' ', 1, 9602, 0, 0, '', 0, null) ;

-- Счета организаций, УРМ+Бюджет(2)
CALL ImportField(960210001, 'Счет', 'ACC', '', ' ', 2, 9602, 0, 0, '', 0, 17112) ;

CALL ImportField(960210002, 'Тип счета', 'ACC_CLS', '', ' ', 2, 9602, 0, 0, '', 0, 17113) ;

CALL ImportField(960210007, 'Номер отделения СБ', 'BANKDEPNUMBER', '', ' ', 2, 9602, 0, 0, '', 0, 17115) ;

CALL ImportField(960210015, 'Service_Acc_Ref', 'SERVICE_ACC_REF', '', ' ', 2, 9602, 0, 0, '', 0, 17126) ;

CALL ImportField(960210021, 'Организация', 'ORG_REF', '', ' ', 2, 9602, 0, 0, '', 0, 17110) ;

-- Банки, Бюджет(1)
CALL ImportField(960310001, 'Город', 'BANK_CITY', '', ' ', 1, 9603, 0, 0, '', 0, null) ;

CALL ImportField(960310002, 'Дата закрытия', 'BANK_DATECLOSE', '', ' ', 1, 9603, 0, 0, '', 0, null) ;

CALL ImportField(960310003, 'Наименование банка', 'BANK_NAME', '', ' ', 1, 9603, 0, 0, '', 0, null) ;

CALL ImportField(960310008, 'Тип участника расчетов', 'PZN', '', ' ', 1, 9603, 0, 0, '', 0, 17106) ;

CALL ImportField(960310009, 'Участие в электронных расчетах', 'UER', '', ' ', 1, 9603, 0, 0, '', 0, 17104) ;

CALL ImportField(960310010, 'Код контроля', 'UERREAL', '', ' ', 1, 9603, 0, 0, '', 0, 17105) ;

CALL ImportField(960310011, '', 'BANK_USECOUNT', '', ' ', 1, 9603, 0, 0, '', 0, null) ;

-- Банки, УРМ+Бюджет(2)
CALL ImportField(960310006, 'Кор. счет', 'COR', '', ' ', 2, 9603, 0, 0, '', 0, 17102) ;

CALL ImportField(960310007, 'БИК', 'MFO', '', ' ', 2, 9603, 0, 0, '', 0, 17101) ;

-- Счета ФО, Бюджет(1)
CALL ImportField(960410001, 'Банковский счет', 'ACC', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410002, 'Принадлежность', 'ACCMODE', '', ' ', 1, 9604, 0, 0, '', 0, 17269) ;

CALL ImportField(960410003, 'Бюджет', 'BUDGETREF', '', ' ', 1, 9604, 0, 0, '', 0, 17266) ;

CALL ImportField(960410004, 'Бух счет(устарело)', 'BUHACC', '', ' ', 1, 9604, 0, 0, '', 0, 17268) ;

CALL ImportField(960410005, 'Closed', 'CLOSED', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410006, 'Описание счета', 'COMMENT', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410007, 'Ключ счета ФО(ссылка)', 'DFACC_REF', '', ' ', 1, 9604, 0, 0, '', 0, 17267) ;

CALL ImportField(960410008, 'Код счета для ФО', 'FINORGACCREF', '', ' ', 1, 9604, 0, 0, '', 0, 17275) ;

CALL ImportField(960410009, 'Код счета для ФО', 'FINORGBUHACC', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410010, 'Ссылка на ИВФ', 'FINSOURCEREF', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410011, 'ИВФ(значение)', 'FINSOURCEVALUE', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410012, 'Тип', 'FIXED', '', ' ', 1, 9604, 0, 0, '', 0, 17270) ;

CALL ImportField(960410013, 'ИВФ(вид)', 'FSDESCRIPTIONCODE', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410014, 'ИВФ(ЭКИ)', 'FSKESR', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410015, 'ИВФ(Администратор)', 'FSKVSR', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410016, 'Единый', 'ISCOMMON', '', ' ', 1, 9604, 0, 0, '', 0, 17278) ;

CALL ImportField(960410017, 'Бюджетный(Вид использования)', 'ISFORBUDGET', '', ' ', 1, 9604, 0, 0, '', 0, 17279) ;

CALL ImportField(960410018, 'Предпринимательский(Вид использования)', 'ISFORBUSINESS', '', ' ', 1, 9604, 0, 0, '', 0, 17280) ;

CALL ImportField(960410019, 'Для наличности', 'ISFORCASH', '', ' ', 1, 9604, 0, 0, '', 0, 17282) ;

CALL ImportField(960410020, 'Для СВР(Вид использования)', 'ISFORTEMPORARY', '', ' ', 1, 9604, 0, 0, '', 0, 17281) ;

CALL ImportField(960410021, 'Код счета для казначейства', 'TREASURYACCREF', '', ' ', 1, 9604, 0, 0, '', 0, 17274) ;

CALL ImportField(960410022, 'Код счета для казначейства', 'TREASURYBUHACC', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410023, 'Вид использования', 'USEVIEW', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410024, '', 'ACC_CLS', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410025, '', 'SERVICE_ORG_REF', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410026, '', 'SERVICEACC', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410027, '', 'SERVICEORGNAME', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410028, '', 'SERVICESUBFACIALCODE', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410029, '', 'SERVICETYPE', '', ' ', 1, 9604, 0, 0, '', 0, null) ;

CALL ImportField(960410030, 'Депозитный', 'ISDEPOSIT', '', ' ', 1, 9604, 0, 0, '', 0, 26548) ;

CALL ImportField(960410031, 'Для БУ\АУ(Вид использования)', 'ISFORBU_AU', '', ' ', 1, 9604, 0, 0, '', 0, 26549) ;

CALL ImportField(960410032, 'Для СВР БУ\АУ(Вид использования)', 'ISFORTEMPORARYBU_AU', '', ' ', 1, 9604, 0, 0, '', 0, 29907) ;

CALL ImportField(960410033, 'Для АУ(Вид использования)', 'ISFORAU', '', ' ', 1, 9604, 0, 0, '', 0, 31655) ;

-- ФКР, Бюджет(1)
CALL ImportField(980210010, 'Автор', 'CREATERUSER', '', ' ', 1, 9802, 0, 0, '', 0, 29919) ;

CALL ImportField(980210011, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9802, 0, 0, '', 0, 29920) ;

-- ФКР, УРМ+Бюджет(2)
CALL ImportField(980210001, 'Раздел 1', 'CODE1', '', ' ', 2, 9802, 0, 0, '', 0, 16846) ;

CALL ImportField(980210002, 'Раздел 2', 'CODE2', '', ' ', 2, 9802, 0, 0, '', 0, 16847) ;

CALL ImportField(980210003, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9802, 0, 0, '', 0, 16849) ;

CALL ImportField(980210004, 'Код', 'ID', '', ' ', 2, 9802, 0, 0, '', 0, 16845) ;

CALL ImportField(980210005, 'Наименование', 'NAME', '', ' ', 2, 9802, 0, 0, '', 0, 16848) ;

CALL ImportField(980210006, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9802, 0, 0, '', 0, 16850) ;

CALL ImportField(980210007, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9802, 0, 0, '', 0, 24903) ;

CALL ImportField(980210008, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9802, 0, 0, '', 0, 24905) ;

CALL ImportField(980210009, 'Краткое имя', 'SHORTNAME', '', ' ', 2, 9802, 0, 0, '', 0, 24904) ;

-- КВСР, Бюджет(1)
CALL ImportField(980310011, 'Автор', 'CREATERUSER', '', ' ', 1, 9803, 0, 0, '', 0, 29923) ;

CALL ImportField(980310012, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9803, 0, 0, '', 0, 29924) ;

-- КВСР, УРМ+Бюджет(2)
CALL ImportField(980310001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9803, 0, 0, '', 0, 16854) ;

CALL ImportField(980310002, 'Код', 'ID', '', ' ', 2, 9803, 0, 0, '', 0, 16852) ;

CALL ImportField(980310003, 'Наименование', 'NAME', '', ' ', 2, 9803, 0, 0, '', 0, 16853) ;

CALL ImportField(980310004, 'Ссылка на организацию', 'ORG_REF', '', ' ', 2, 9803, 0, 0, '', 0, 16856) ;

CALL ImportField(980310005, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9803, 0, 0, '', 0, 16855) ;

CALL ImportField(980310006, 'Код бюджета', 'BUDGETREF', '', ' ', 2, 9803, 0, 0, '', 0, 25471) ;

CALL ImportField(980310007, 'Значимый код', 'CODE', '', ' ', 2, 9803, 0, 0, '', 0, 25472) ;

CALL ImportField(980310008, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9803, 0, 0, '', 0, 25473) ;

CALL ImportField(980310009, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9803, 0, 0, '', 0, 25475) ;

CALL ImportField(980310010, 'Краткое имя', 'SHORTNAME', '', ' ', 2, 9803, 0, 0, '', 0, 25474) ;

-- КВР, Бюджет(1)
CALL ImportField(980410010, 'Автор', 'CREATERUSER', '', ' ', 1, 9804, 0, 0, '', 0, 29921) ;

CALL ImportField(980410011, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9804, 0, 0, '', 0, 29922) ;

-- КВР, УРМ+Бюджет(2)
CALL ImportField(980410001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9804, 0, 0, '', 0, 16867) ;

CALL ImportField(980410003, 'Наименование', 'NAME', '', ' ', 2, 9804, 0, 0, '', 0, 16866) ;

CALL ImportField(980410004, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9804, 0, 0, '', 0, 16868) ;

CALL ImportField(980410005, 'Код бюджета', 'BUDGETREF', '', ' ', 2, 9804, 0, 0, '', 0, 25466) ;

CALL ImportField(980410007, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9804, 0, 0, '', 0, 25468) ;

CALL ImportField(980410008, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9804, 0, 0, '', 0, 25470) ;

CALL ImportField(980410009, 'Краткое имя', 'SHORTNAME', '', ' ', 2, 9804, 0, 0, '', 0, 25469) ;

-- КЦСР, Бюджет(1)
CALL ImportField(980510010, 'Автор', 'CREATERUSER', '', ' ', 1, 9805, 0, 0, '', 0, 29915) ;

CALL ImportField(980510011, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9805, 0, 0, '', 0, 29916) ;

-- КЦСР, УРМ+Бюджет(2)
CALL ImportField(980510001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9805, 0, 0, '', 0, 16860) ;

CALL ImportField(980510003, 'Наименование', 'NAME', '', ' ', 2, 9805, 0, 0, '', 0, 16859) ;

CALL ImportField(980510004, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9805, 0, 0, '', 0, 16861) ;

CALL ImportField(980510005, 'Код бюджета', 'BUDGETREF', '', ' ', 2, 9805, 0, 0, '', 0, 25461) ;

CALL ImportField(980510007, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9805, 0, 0, '', 0, 25463) ;

CALL ImportField(980510008, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9805, 0, 0, '', 0, 25465) ;

CALL ImportField(980510009, 'Краткое имя', 'SHORTNAME', '', ' ', 2, 9805, 0, 0, '', 0, 25464) ;

-- Суб КЦСР, УРМ+Бюджет(2)
CALL ImportField(980610001, 'Код', 'ID', '', ' ', 2, 9806, 0, 0, '', 0, 16887) ;

CALL ImportField(980610002, 'Наименование', 'NAME', '', ' ', 2, 9806, 0, 0, '', 0, 16888) ;

-- Суб КОСГУ, УРМ+Бюджет(2)
CALL ImportField(980810001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9808, 0, 0, '', 0, 16918) ;

CALL ImportField(980810002, 'Код', 'ID', '', ' ', 2, 9808, 0, 0, '', 0, 16916) ;

CALL ImportField(980810003, 'Наименование', 'NAME', '', ' ', 2, 9808, 0, 0, '', 0, 16917) ;

CALL ImportField(980810004, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9808, 0, 0, '', 0, 16919) ;

CALL ImportField(980810005, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9808, 0, 0, '', 0, 24901) ;

CALL ImportField(980810006, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9808, 0, 0, '', 0, 24902) ;

-- КД, Бюджет(1)
CALL ImportField(980910005, 'Значимый код', 'FullId', '', ' ', 1, 9809, 0, 0, '', 0, null) ;

CALL ImportField(980910021, 'Краткое имя', 'SHORTNAME', '', ' ', 1, 9809, 0, 0, '', 0, 24896) ;

CALL ImportField(980910022, 'Автор', 'CREATERUSER', '', ' ', 1, 9809, 0, 0, '', 0, 29917) ;

CALL ImportField(980910023, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9809, 0, 0, '', 0, 29918) ;

-- КД, УРМ+Бюджет(2)
CALL ImportField(980910001, 'Код бюджета', 'BUDGETREF', '', ' ', 2, 9809, 0, 0, '', 0, 16842) ;

CALL ImportField(980910002, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9809, 0, 0, '', 0, 16828) ;

CALL ImportField(980910003, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9809, 0, 0, '', 0, 16843) ;

CALL ImportField(980910006, 'Код', 'ID', '', ' ', 2, 9809, 0, 0, '', 0, 16825) ;

CALL ImportField(980910008, 'ЭКР', 'KESR', '', ' ', 2, 9809, 0, 0, '', 0, 16835) ;

CALL ImportField(980910009, 'КВСР', 'KVSR', '', ' ', 2, 9809, 0, 0, '', 0, 16830) ;

CALL ImportField(980910010, '', 'MAINDESCRIPTIONCODE', '', ' ', 2, 9809, 0, 0, '', 0, 16832) ;

CALL ImportField(980910011, 'Наименование', 'NAME', '', ' ', 2, 9809, 0, 0, '', 0, 16826) ;

CALL ImportField(980910013, 'Код удален', 'REMOTEFLAG', '', ' ', 2, 9809, 0, 0, '', 0, 16839) ;

CALL ImportField(980910014, '', 'REPCODE', '', ' ', 2, 9809, 0, 0, '', 0, 16827) ;

CALL ImportField(980910016, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9809, 0, 0, '', 0, 16829) ;

CALL ImportField(980910017, '', 'KVSRCODE', '', ' ', 2, 9809, 0, 0, '', 0, null) ;

CALL ImportField(980910018, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9809, 0, 0, '', 0, 24897) ;

CALL ImportField(980910019, '', 'KD_LEVEL', '', ' ', 2, 9809, 0, 0, '', 0, 24895) ;

CALL ImportField(980910020, '', 'KDVALUE', '', ' ', 2, 9809, 0, 0, '', 0, 16836) ;

-- Суб КД, Бюджет(1)
CALL ImportField(981010001, 'Бух. счет', 'BUHACCOUNT', '', ' ', 1, 9810, 0, 0, '', 0, 16933) ;

CALL ImportField(981010002, 'Раздел 1', 'CODE1', '', ' ', 1, 9810, 0, 0, '', 0, 16930) ;

CALL ImportField(981010003, 'Раздел 2', 'CODE2', '', ' ', 1, 9810, 0, 0, '', 0, 16931) ;

CALL ImportField(981010004, 'Раздел 3', 'CODE3', '', ' ', 1, 9810, 0, 0, '', 0, 16932) ;

-- Суб КД, УРМ+Бюджет(2)
CALL ImportField(981010005, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9810, 0, 0, '', 0, 16935) ;

CALL ImportField(981010006, 'Код', 'ID', '', ' ', 2, 9810, 0, 0, '', 0, 16929) ;

CALL ImportField(981010007, 'Наименование', 'NAME', '', ' ', 2, 9810, 0, 0, '', 0, 16934) ;

CALL ImportField(981010008, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9810, 0, 0, '', 0, 16936) ;

CALL ImportField(981010009, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9810, 0, 0, '', 0, 25013) ;

CALL ImportField(981010010, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9810, 0, 0, '', 0, 25014) ;

-- Документы, Бюджет(1)
CALL ImportField(981110001, 'Раздел 1', 'CODE1', '', ' ', 1, 9811, 0, 0, '', 0, 16816) ;

CALL ImportField(981110002, 'Раздел 2', 'CODE2', '', ' ', 1, 9811, 0, 0, '', 0, 16817) ;

CALL ImportField(981110003, 'Раздел 3', 'CODE3', '', ' ', 1, 9811, 0, 0, '', 0, 16818) ;

CALL ImportField(981110008, 'Версия записи', 'RVERSION', '', ' ', 1, 9811, 0, 0, '', 0, 16822) ;

-- Документы, УРМ+Бюджет(2)
CALL ImportField(981110004, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9811, 0, 0, '', 0, 16820) ;

CALL ImportField(981110005, 'Код', 'ID', '', ' ', 2, 9811, 0, 0, '', 0, 16815) ;

CALL ImportField(981110006, 'Наименование', 'NAME', '', ' ', 2, 9811, 0, 0, '', 0, 16819) ;

CALL ImportField(981110007, 'Вид учета', 'REGISTRATIONTYPE', '', ' ', 2, 9811, 0, 0, '', 0, 16823) ;

CALL ImportField(981110009, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9811, 0, 0, '', 0, 16821) ;

-- Районы, Бюджет(1)
CALL ImportField(981210001, '', 'BUDGETTYPE', '', ' ', 1, 9812, 0, 0, '', 0, 16694) ;

CALL ImportField(981210002, 'Раздел 1', 'CODE1', '', ' ', 1, 9812, 0, 0, '', 0, 16690) ;

CALL ImportField(981210003, 'Раздел 2', 'CODE2', '', ' ', 1, 9812, 0, 0, '', 0, 16691) ;

CALL ImportField(981210004, 'Раздел 3', 'CODE3', '', ' ', 1, 9812, 0, 0, '', 0, 16692) ;

CALL ImportField(981210006, '', 'KVB_EXPORT', '', ' ', 1, 9812, 0, 0, '', 0, 16696) ;

CALL ImportField(981210008, '', 'ORG_EXPORT', '', ' ', 1, 9812, 0, 0, '', 0, 16697) ;

-- Районы, УРМ+Бюджет(2)
CALL ImportField(981210005, 'Код', 'ID', '', ' ', 2, 9812, 0, 0, '', 0, 16689) ;

CALL ImportField(981210007, 'Наименование', 'NAME', '', ' ', 2, 9812, 0, 0, '', 0, 16693) ;

CALL ImportField(981210009, 'ТФО(ссылка)', 'ORGANIZATIONS', '', ' ', 2, 9812, 0, 0, '', 0, 16695) ;

CALL ImportField(981210010, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9812, 0, 0, '', 0, 16698) ;

CALL ImportField(981210011, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9812, 0, 0, '', 0, 24955) ;

CALL ImportField(981210012, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9812, 0, 0, '', 0, 24956) ;

CALL ImportField(981210013, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9812, 0, 0, '', 0, 16699) ;

-- Источники финансирования, УРМ+Бюджет(2)
CALL ImportField(981310001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9813, 0, 0, '', 0, 16986) ;

CALL ImportField(981310002, 'Код', 'ID', '', ' ', 2, 9813, 0, 0, '', 0, 16984) ;

CALL ImportField(981310003, 'Наименование', 'NAME', '', ' ', 2, 9813, 0, 0, '', 0, 16985) ;

CALL ImportField(981310004, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9813, 0, 0, '', 0, 16987) ;

-- КСШК, Бюджет(1)
CALL ImportField(981410001, 'Код', 'ID', '', ' ', 1, 9814, 0, 0, '', 0, 16884) ;

CALL ImportField(981410002, 'Наименование', 'NAME', '', ' ', 1, 9814, 0, 0, '', 0, 16885) ;

-- Материальные ценности, Бюджет(1)
CALL ImportField(981510001, 'Код', 'ID', '', ' ', 1, 9815, 0, 0, '', 0, 16908) ;

CALL ImportField(981510002, 'Наименование', 'NAME', '', ' ', 1, 9815, 0, 0, '', 0, 16909) ;

-- Основные средства, Бюджет(1)
CALL ImportField(981610001, 'Код', 'ID', '', ' ', 1, 9816, 0, 0, '', 0, 16905) ;

CALL ImportField(981610002, 'Наименование', 'NAME', '', ' ', 1, 9816, 0, 0, '', 0, 16906) ;

-- Справочно, Бюджет(1)
CALL ImportField(981710001, 'Код', 'ID', '', ' ', 1, 9817, 0, 0, '', 0, 16902) ;

CALL ImportField(981710002, 'Наименование', 'NAME', '', ' ', 1, 9817, 0, 0, '', 0, 16903) ;

-- Валюты, Бюджет(1)
CALL ImportField(981810001, 'Значимый код', 'CODE', '', ' ', 1, 9818, 0, 0, '', 0, 16940) ;

CALL ImportField(981810002, 'Код', 'ID', '', ' ', 1, 9818, 0, 0, '', 0, 16938) ;

CALL ImportField(981810003, '', 'KIND', '', ' ', 1, 9818, 0, 0, '', 0, 16941) ;

CALL ImportField(981810004, 'Наименование', 'NAME', '', ' ', 1, 9818, 0, 0, '', 0, 16939) ;

CALL ImportField(981810005, '', 'VARIANT1', '', ' ', 1, 9818, 0, 0, '', 0, 16942) ;

CALL ImportField(981810006, '', 'VARIANT2', '', ' ', 1, 9818, 0, 0, '', 0, 16943) ;

CALL ImportField(981810007, '', 'VARIANT7', '', ' ', 1, 9818, 0, 0, '', 0, 16944) ;

-- Тип организации (старый), Бюджет(1)
CALL ImportField(982010001, 'Раздел 1', 'CODE1', '', ' ', 1, 9820, 0, 0, '', 0, 16990) ;

CALL ImportField(982010002, 'Раздел 2', 'CODE2', '', ' ', 1, 9820, 0, 0, '', 0, 16991) ;

CALL ImportField(982010003, 'Раздел 3', 'CODE3', '', ' ', 1, 9820, 0, 0, '', 0, 16992) ;

-- Тип организации (старый), УРМ+Бюджет(2)
CALL ImportField(982010004, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9820, 0, 0, '', 0, 16994) ;

CALL ImportField(982010005, 'Код', 'ID', '', ' ', 2, 9820, 0, 0, '', 0, 16989) ;

CALL ImportField(982010006, 'Наименование', 'NAME', '', ' ', 2, 9820, 0, 0, '', 0, 16993) ;

CALL ImportField(982010007, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9820, 0, 0, '', 0, 16995) ;

-- Коды расчетных счетов, Бюджет(1)
CALL ImportField(982110001, 'Раздел 1', 'CODE1', '', ' ', 1, 9821, 0, 0, '', 0, 16998) ;

CALL ImportField(982110002, 'Раздел 2', 'CODE2', '', ' ', 1, 9821, 0, 0, '', 0, 16999) ;

CALL ImportField(982110003, 'Раздел 3', 'CODE3', '', ' ', 1, 9821, 0, 0, '', 0, 17000) ;

-- Коды расчетных счетов, УРМ+Бюджет(2)
CALL ImportField(982110004, 'Код', 'ID', '', ' ', 2, 9821, 0, 0, '', 0, 16997) ;

CALL ImportField(982110005, 'Наименование', 'NAME', '', ' ', 2, 9821, 0, 0, '', 0, 17001) ;

CALL ImportField(982110006, 'Вид обслуживания счета', 'SERVICETYPE', '', ' ', 2, 9821, 0, 0, '', 0, 17002) ;

CALL ImportField(982110007, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9821, 0, 0, '', 0, 17003) ;

CALL ImportField(982110008, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9821, 0, 0, '', 0, 17004) ;

-- Группы информации, Бюджет(1)
CALL ImportField(982210001, 'Раздел 1', 'CODE1', '', ' ', 1, 9822, 0, 0, '', 0, 17007) ;

CALL ImportField(982210002, 'Раздел 2', 'CODE2', '', ' ', 1, 9822, 0, 0, '', 0, 17008) ;

CALL ImportField(982210003, 'Код', 'ID', '', ' ', 1, 9822, 0, 0, '', 0, 17006) ;

CALL ImportField(982210004, 'Наименование', 'NAME', '', ' ', 1, 9822, 0, 0, '', 0, 17009) ;

-- ГосНИ, Бюджет(1)
CALL ImportField(982310001, 'Раздел 1', 'CODE1', '', ' ', 1, 9823, 0, 0, '', 0, 16950) ;

CALL ImportField(982310002, 'Раздел 2', 'CODE2', '', ' ', 1, 9823, 0, 0, '', 0, 16951) ;

-- ГосНИ, УРМ+Бюджет(2)
CALL ImportField(982310003, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9823, 0, 0, '', 0, 16953) ;

CALL ImportField(982310004, 'Код', 'ID', '', ' ', 2, 9823, 0, 0, '', 0, 16949) ;

CALL ImportField(982310005, 'Наименование', 'NAME', '', ' ', 2, 9823, 0, 0, '', 0, 16952) ;

CALL ImportField(982310006, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9823, 0, 0, '', 0, 16954) ;

-- Слой доходов, УРМ+Бюджет(2)
CALL ImportField(982610001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9826, 0, 0, '', 0, 16913) ;

CALL ImportField(982610002, 'Код', 'ID', '', ' ', 2, 9826, 0, 0, '', 0, 16911) ;

CALL ImportField(982610003, 'Наименование', 'NAME', '', ' ', 2, 9826, 0, 0, '', 0, 16912) ;

CALL ImportField(982610004, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9826, 0, 0, '', 0, 16914) ;

-- Код дополнительной информации, Бюджет(1)
CALL ImportField(982710001, 'Бух. счет', 'ACCOUNT', '', ' ', 1, 9827, 0, 0, '', 0, 16959) ;

CALL ImportField(982710005, '', 'GENBUHACCFLAG', '', ' ', 1, 9827, 0, 0, '', 0, 16963) ;

-- Код дополнительной информации, УРМ+Бюджет(2)
CALL ImportField(982710004, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9827, 0, 0, '', 0, 16961) ;

CALL ImportField(982710006, 'Код', 'ID', '', ' ', 2, 9827, 0, 0, '', 0, 16956) ;

CALL ImportField(982710007, 'Наименование', 'NAME', '', ' ', 2, 9827, 0, 0, '', 0, 16960) ;

CALL ImportField(982710008, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9827, 0, 0, '', 0, 16962) ;

-- Мероприятия, УРМ+Бюджет(2)
CALL ImportField(982810004, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9828, 0, 0, '', 0, 16970) ;

CALL ImportField(982810005, 'Код', 'ID', '', ' ', 2, 9828, 0, 0, '', 0, 16965) ;

CALL ImportField(982810006, 'Наименование', 'NAME', '', ' ', 2, 9828, 0, 0, '', 0, 16969) ;

CALL ImportField(982810007, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9828, 0, 0, '', 0, 16971) ;

CALL ImportField(982810008, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9828, 0, 0, '', 0, 24735) ;

CALL ImportField(982810009, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9828, 0, 0, '', 0, 24736) ;

-- Нормативно-правовые акты, УРМ+Бюджет(2)
CALL ImportField(982910004, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9829, 0, 0, '', 0, 16979) ;

CALL ImportField(982910005, 'Дата', 'DocumentBaseDate', '', ' ', 2, 9829, 0, 0, '', 0, 16981) ;

CALL ImportField(982910006, 'Номер документа', 'DOCUMENTBASENUM', '', ' ', 2, 9829, 0, 0, '', 0, 16982) ;

CALL ImportField(982910007, 'Код', 'ID', '', ' ', 2, 9829, 0, 0, '', 0, 16974) ;

CALL ImportField(982910008, 'Наименование', 'NAME', '', ' ', 2, 9829, 0, 0, '', 0, 16978) ;

CALL ImportField(982910009, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9829, 0, 0, '', 0, 16980) ;

-- Тип отчета, Бюджет(1)
CALL ImportField(983410001, 'Код', 'ID', '', ' ', 1, 9834, 0, 0, '', 0, 16946) ;

CALL ImportField(983410002, 'Наименование', 'NAME', '', ' ', 1, 9834, 0, 0, '', 0, 16947) ;

-- Вид бюджета (счета по взаимным), Бюджет(1)
CALL ImportField(983510001, '', 'ACCOUNT1', '', ' ', 1, 9835, 0, 0, '', 0, 17013) ;

CALL ImportField(983510002, '', 'ACCOUNT2', '', ' ', 1, 9835, 0, 0, '', 0, 17014) ;

CALL ImportField(983510003, '', 'ACCOUNT3', '', ' ', 1, 9835, 0, 0, '', 0, 17015) ;

CALL ImportField(983510004, 'Код', 'ID', '', ' ', 1, 9835, 0, 0, '', 0, 17011) ;

CALL ImportField(983510005, 'Наименование', 'NAME', '', ' ', 1, 9835, 0, 0, '', 0, 17012) ;

CALL ImportField(983510006, '', 'TRANSFERTLEVELKIND', '', ' ', 1, 9835, 0, 0, '', 0, 31635) ;

-- Лицевые счета, Бюджет(1)
CALL ImportField(984110001, 'Доп разряды ОКАТО', 'ADDOKATO', '', ' ', 1, 9841, 0, 0, '', 0, null) ;

CALL ImportField(984110002, 'Бюджет', 'BUDGETNAME', '', ' ', 1, 9841, 0, 0, '', 0, null) ;

CALL ImportField(984110004, '', 'BudgetRight', '', ' ', 1, 9841, 0, 0, '', 0, null) ;

CALL ImportField(984110005, 'Номер документа закрытия', 'CLOSEDOCNUMBER', '', ' ', 1, 9841, 0, 0, '', 0, 17157) ;

CALL ImportField(984110006, 'Раздел 1', 'CODE1', '', ' ', 1, 9841, 0, 0, '', 0, 17131) ;

CALL ImportField(984110007, 'Раздел 2', 'CODE2', '', ' ', 1, 9841, 0, 0, '', 0, 17132) ;

CALL ImportField(984110008, 'Раздел 3', 'CODE3', '', ' ', 1, 9841, 0, 0, '', 0, 17133) ;

CALL ImportField(984110009, 'Раздел 4', 'CODE4', '', ' ', 1, 9841, 0, 0, '', 0, 17134) ;

CALL ImportField(984110013, 'отдел', 'DEPARTMENTCLS', '', ' ', 1, 9841, 0, 0, '', 0, 17154) ;

CALL ImportField(984110017, 'ОКАТО(полный код)', 'FullOKATO', '', ' ', 1, 9841, 0, 0, '', 0, null) ;

CALL ImportField(984110029, 'ОКАТО', 'OKATO', '', ' ', 1, 9841, 0, 0, '', 0, null) ;

CALL ImportField(984110030, 'Номер изв. об открытии', 'OPENDOCNUMBER', '', ' ', 1, 9841, 0, 0, '', 0, 17156) ;

CALL ImportField(984110033, 'Версия записи', 'RVERSION', '', ' ', 1, 9841, 0, 0, '', 0, 17155) ;

CALL ImportField(984110038, 'Счет в ФК', 'ACC', '', ' ', 1, 9841, 0, 0, '', 0, null) ;

CALL ImportField(984110040, 'Характер использования', 'HARACTERACCOUNTEX', '', ' ', 1, 9841, 0, 0, '', 0, null) ;

CALL ImportField(984110047, 'Наименование организации-владельца', 'ORG_NAME', '', ' ', 1, 9841, 0, 0, '', 0, null) ;

CALL ImportField(984110048, '', 'GENERALORGFACIALACC', '', ' ', 1, 9841, 0, 0, '', 0, 30896) ;

CALL ImportField(984110049, '', 'GRANTEEORG_REF', '', ' ', 1, 9841, 0, 0, '', 0, 30897) ;

CALL ImportField(984110050, '', 'GRANTEEORGNAME', '', ' ', 1, 9841, 0, 0, '', 0, null) ;

-- Лицевые счета, УРМ+Бюджет(2)
CALL ImportField(984110003, 'Код бюджета', 'BUDGETREF', '', ' ', 2, 9841, 0, 0, '', 0, 17159) ;

CALL ImportField(984110010, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9841, 0, 0, '', 0, 17150) ;

CALL ImportField(984110011, 'Дата закрытия', 'DATECLOSE', '', ' ', 2, 9841, 0, 0, '', 0, 17144) ;

CALL ImportField(984110012, 'Дата открытия', 'DateOpen', '', ' ', 2, 9841, 0, 0, '', 0, 17143) ;

CALL ImportField(984110014, 'МнемоКод', 'FACIALCODE', '', ' ', 2, 9841, 0, 0, '', 0, 17149) ;

CALL ImportField(984110015, 'Ссылка на счет в ФК', 'FCACCOUNT', '', ' ', 2, 9841, 0, 0, '', 0, 17160) ;

CALL ImportField(984110016, 'Тип финансирования', 'FINTYPE', '', ' ', 2, 9841, 0, 0, '', 0, 17141) ;

CALL ImportField(984110018, 'Организация-распорядитель', 'GENERALORG_REF', '', ' ', 2, 9841, 0, 0, '', 0, 17152) ;

CALL ImportField(984110019, 'Характер счета(устарел)', 'HARACTERACCOUNT', '', ' ', 2, 9841, 0, 0, '', 0, 17147) ;

CALL ImportField(984110020, 'Консолидирующая организация', 'HIGHERORG_REF', '', ' ', 2, 9841, 0, 0, '', 0, 17158) ;

CALL ImportField(984110021, 'Код', 'ID', '', ' ', 2, 9841, 0, 0, '', 0, 17130) ;

CALL ImportField(984110022, 'КЦСР', 'KCSR', '', ' ', 2, 9841, 0, 0, '', 0, 17137) ;

CALL ImportField(984110023, 'ЭКР', 'KESR', '', ' ', 2, 9841, 0, 0, '', 0, 17140) ;

CALL ImportField(984110024, 'ФКР', 'KFSR', '', ' ', 2, 9841, 0, 0, '', 0, 17138) ;

CALL ImportField(984110025, 'КВР', 'KVR', '', ' ', 2, 9841, 0, 0, '', 0, 17139) ;

CALL ImportField(984110026, 'КВСР', 'KVSR', '', ' ', 2, 9841, 0, 0, '', 0, 17136) ;

CALL ImportField(984110027, 'Тип средств', 'MEANSTYPE', '', ' ', 2, 9841, 0, 0, '', 0, 17153) ;

CALL ImportField(984110028, 'Наименование', 'NAME', '', ' ', 2, 9841, 0, 0, '', 0, 17135) ;

CALL ImportField(984110031, 'организация-владелец', 'ORG_REF', '', ' ', 2, 9841, 0, 0, '', 0, 17142) ;

CALL ImportField(984110032, 'Район', 'REGIONCLS', '', ' ', 2, 9841, 0, 0, '', 0, 17148) ;

CALL ImportField(984110034, 'Признак служебности', 'SERVICEACCOUNT', '', ' ', 2, 9841, 0, 0, '', 0, 17145) ;

CALL ImportField(984110035, 'Признак закрытия, блокирования ', 'STATUSACCOUNT', '', ' ', 2, 9841, 0, 0, '', 0, 17146) ;

CALL ImportField(984110036, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9841, 0, 0, '', 0, 17151) ;

CALL ImportField(984110037, 'Примечание', 'NOTE', '', ' ', 2, 9841, 0, 0, '', 0, 24729) ;

CALL ImportField(984110039, 'Номер Л/С', 'FACIALCODEEX', '', ' ', 2, 9841, 0, 0, '', 0, 26617) ;

CALL ImportField(984110041, 'л\с БУ, АУ', 'ISBU', '', ' ', 2, 9841, 0, 0, '', 0, 26618) ;

CALL ImportField(984110042, 'л\с ПБС', 'ISPBS', '', ' ', 2, 9841, 0, 0, '', 0, 26619) ;

CALL ImportField(984110043, 'л\с по переданным полномочиям', 'ISPROXY', '', ' ', 2, 9841, 0, 0, '', 0, 26620) ;

CALL ImportField(984110044, 'распорядительный л\с ', 'ISRBS', '', ' ', 2, 9841, 0, 0, '', 0, 26621) ;

CALL ImportField(984110045, 'отдельный л\с БУ, АУ ', 'ISSEPARATEBU', '', ' ', 2, 9841, 0, 0, '', 0, 26622) ;

CALL ImportField(984110046, 'л\с для ОМС', 'ISOMS', '', ' ', 2, 9841, 0, 0, '', 0, 27841) ;

-- Виды платежей, УРМ+Бюджет(2)
CALL ImportField(984310001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9843, 0, 0, '', 0, 17019) ;

CALL ImportField(984310002, 'Код', 'ID', '', ' ', 2, 9843, 0, 0, '', 0, 17017) ;

CALL ImportField(984310003, 'Наименование', 'NAME', '', ' ', 2, 9843, 0, 0, '', 0, 17018) ;

CALL ImportField(984310004, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9843, 0, 0, '', 0, 17020) ;

-- Умолчания расчетных счетов, Бюджет(1)
CALL ImportField(984410001, 'Код', 'ID', '', ' ', 1, 9844, 0, 0, '', 0, 17022) ;

CALL ImportField(984410002, 'Наименование', 'NAME', '', ' ', 1, 9844, 0, 0, '', 0, 17025) ;

CALL ImportField(984410003, 'Очередность платежа', 'PAYQUEUE', '', ' ', 1, 9844, 0, 0, '', 0, 17024) ;

CALL ImportField(984410004, 'Тип платежа', 'PAYTYPE', '', ' ', 1, 9844, 0, 0, '', 0, 17023) ;

-- Кассовые символы, Бюджет(1)
CALL ImportField(984510001, 'Раздел 1', 'CODE1', '', ' ', 1, 9845, 0, 0, '', 0, 17065) ;

CALL ImportField(984510002, 'Раздел 2', 'CODE2', '', ' ', 1, 9845, 0, 0, '', 0, 17066) ;

-- Кассовые символы, УРМ+Бюджет(2)
CALL ImportField(984510003, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9845, 0, 0, '', 0, 17067) ;

CALL ImportField(984510004, 'Код', 'ID', '', ' ', 2, 9845, 0, 0, '', 0, 17063) ;

CALL ImportField(984510005, 'Наименование', 'NAME', '', ' ', 2, 9845, 0, 0, '', 0, 17064) ;

CALL ImportField(984510006, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9845, 0, 0, '', 0, 17068) ;

-- Бухгалтерская операция(старая), УРМ+Бюджет(2)
CALL ImportField(984610001, 'направление операции для плательщика(устарело)', 'DESTTYPE', '', ' ', 2, 9846, 0, 0, '', 0, 17072) ;

CALL ImportField(984610002, 'Код', 'ID', '', ' ', 2, 9846, 0, 0, '', 0, 17070) ;

CALL ImportField(984610003, 'Наименование', 'NAME', '', ' ', 2, 9846, 0, 0, '', 0, 17073) ;

CALL ImportField(984610004, 'направление операции для получателя(устарело)', 'SOURCETYPE', '', ' ', 2, 9846, 0, 0, '', 0, 17071) ;

-- Код операции, УРМ+Бюджет(2)
CALL ImportField(984710001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9847, 0, 0, '', 0, 17097) ;

CALL ImportField(984710002, 'Код', 'ID', '', ' ', 2, 9847, 0, 0, '', 0, 17095) ;

CALL ImportField(984710003, 'Наименование', 'NAME', '', ' ', 2, 9847, 0, 0, '', 0, 17096) ;

CALL ImportField(984710004, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9847, 0, 0, '', 0, 17098) ;

-- Назначения платежа, Бюджет(1)
CALL ImportField(984810001, 'Раздел 1', 'CODE1', '', ' ', 1, 9848, 0, 0, '', 0, 17089) ;

CALL ImportField(984810002, 'Раздел 2', 'CODE2', '', ' ', 1, 9848, 0, 0, '', 0, 17090) ;

CALL ImportField(984810003, 'Раздел 3', 'CODE3', '', ' ', 1, 9848, 0, 0, '', 0, 17091) ;

-- Назначения платежа, УРМ+Бюджет(2)
CALL ImportField(984810004, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9848, 0, 0, '', 0, 17092) ;

CALL ImportField(984810005, 'Код', 'ID', '', ' ', 2, 9848, 0, 0, '', 0, 17085) ;

CALL ImportField(984810006, 'Наименование', 'NAME', '', ' ', 2, 9848, 0, 0, '', 0, 17086) ;

CALL ImportField(984810007, 'Приоритет', 'PRIORITY', '', ' ', 2, 9848, 0, 0, '', 0, 17087) ;

CALL ImportField(984810008, 'Налог. платеж', 'TAXNOTE', '', ' ', 2, 9848, 0, 0, '', 0, 17088) ;

CALL ImportField(984810009, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9848, 0, 0, '', 0, 17093) ;

-- Тип средств бюджета, Бюджет(1)
CALL ImportField(984910009, 'Раздел 1', 'CODE1', '', ' ', 1, 9849, 0, 0, '', 0, 17313) ;

CALL ImportField(984910010, 'Раздел 2', 'CODE2', '', ' ', 1, 9849, 0, 0, '', 0, 17314) ;

CALL ImportField(984910011, 'Раздел 3', 'CODE3', '', ' ', 1, 9849, 0, 0, '', 0, 17315) ;

CALL ImportField(984910012, 'Код цели', 'STRCODE', '', ' ', 1, 9849, 0, 0, '', 0, null) ;

-- Тип средств бюджета, УРМ+Бюджет(2)
CALL ImportField(984910001, 'Код вида деятельности', 'ACTIVITYKIND', '', ' ', 2, 9849, 0, 0, '', 0, 17319) ;

CALL ImportField(984910002, 'Код', 'ID', '', ' ', 2, 9849, 0, 0, '', 0, 17312) ;

CALL ImportField(984910003, 'Наименование', 'NAME', '', ' ', 2, 9849, 0, 0, '', 0, 17316) ;

CALL ImportField(984910004, 'Код цели', 'TARGETCLS', '', ' ', 2, 9849, 0, 0, '', 0, 17320) ;

CALL ImportField(984910005, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9849, 0, 0, '', 0, 17317) ;

CALL ImportField(984910006, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9849, 0, 0, '', 0, 24919) ;

CALL ImportField(984910007, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9849, 0, 0, '', 0, 24920) ;

CALL ImportField(984910008, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9849, 0, 0, '', 0, 17318) ;

CALL ImportField(984910013, 'Код типа деятельности', 'ACTIVITYTYPE', '', ' ', 2, 9849, 0, 0, '', 0, 29925) ;

-- Причина отклонения, Бюджет(1)
CALL ImportField(985010001, 'Раздел 1', 'CODE1', '', ' ', 1, 9850, 0, 0, '', 0, 17028) ;

CALL ImportField(985010002, 'Раздел 2', 'CODE2', '', ' ', 1, 9850, 0, 0, '', 0, 17029) ;

CALL ImportField(985010003, 'Раздел 3', 'CODE3', '', ' ', 1, 9850, 0, 0, '', 0, 17030) ;

-- Причина отклонения, УРМ+Бюджет(2)
CALL ImportField(985010004, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9850, 0, 0, '', 0, 17032) ;

CALL ImportField(985010005, 'Код', 'ID', '', ' ', 2, 9850, 0, 0, '', 0, 17027) ;

CALL ImportField(985010006, 'Наименование', 'NAME', '', ' ', 2, 9850, 0, 0, '', 0, 17031) ;

CALL ImportField(985010007, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9850, 0, 0, '', 0, 17033) ;

-- Коды ошибок, Бюджет(1)
CALL ImportField(985110001, 'Раздел 1', 'CODE1', '', ' ', 1, 9851, 0, 0, '', 0, 17036) ;

CALL ImportField(985110002, 'Раздел 2', 'CODE2', '', ' ', 1, 9851, 0, 0, '', 0, 17037) ;

CALL ImportField(985110003, 'Раздел 3', 'CODE3', '', ' ', 1, 9851, 0, 0, '', 0, 17038) ;

-- Коды ошибок, УРМ+Бюджет(2)
CALL ImportField(985110004, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9851, 0, 0, '', 0, 17040) ;

CALL ImportField(985110005, 'Код', 'ID', '', ' ', 2, 9851, 0, 0, '', 0, 17035) ;

CALL ImportField(985110006, '', 'IMPORTANCE', '', ' ', 2, 9851, 0, 0, '', 0, 17042) ;

CALL ImportField(985110007, 'Наименование', 'NAME', '', ' ', 2, 9851, 0, 0, '', 0, 17039) ;

CALL ImportField(985110008, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9851, 0, 0, '', 0, 17041) ;

-- Источники финансирования дефицита бюджета, Бюджет(1)
CALL ImportField(985210007, 'Значимый код', 'FullId', '', ' ', 1, 9852, 0, 0, '', 0, null) ;

CALL ImportField(985210018, '', 'KVSRCODE', '', ' ', 1, 9852, 0, 0, '', 0, null) ;

CALL ImportField(985210021, 'Краткое имя', 'SHORTNAME', '', ' ', 1, 9852, 0, 0, '', 0, 24885) ;

-- Источники финансирования дефицита бюджета, УРМ+Бюджет(2)
CALL ImportField(985210001, 'Код бюджета', 'BUDGETREF', '', ' ', 2, 9852, 0, 0, '', 0, 17059) ;

CALL ImportField(985210002, '', 'CLSASPECT', '', ' ', 2, 9852, 0, 0, '', 0, 17056) ;

CALL ImportField(985210003, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9852, 0, 0, '', 0, 17046) ;

CALL ImportField(985210004, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9852, 0, 0, '', 0, 17060) ;

CALL ImportField(985210008, 'Код', 'ID', '', ' ', 2, 9852, 0, 0, '', 0, 17044) ;

CALL ImportField(985210010, 'ЭКР', 'KESR', '', ' ', 2, 9852, 0, 0, '', 0, 17054) ;

CALL ImportField(985210011, 'КВСР', 'KVSR', '', ' ', 2, 9852, 0, 0, '', 0, 17049) ;

CALL ImportField(985210013, 'Наименование', 'NAME', '', ' ', 2, 9852, 0, 0, '', 0, 17045) ;

CALL ImportField(985210015, 'Код удален', 'REMOTEFLAG', '', ' ', 2, 9852, 0, 0, '', 0, 17058) ;

CALL ImportField(985210017, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9852, 0, 0, '', 0, 17047) ;

CALL ImportField(985210019, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9852, 0, 0, '', 0, 24886) ;

CALL ImportField(985210020, '', 'FINSOURCEVALUE', '', ' ', 2, 9852, 0, 0, '', 0, 17055) ;

-- Тип реестра, Бюджет(1)
CALL ImportField(985310001, 'Раздел 1', 'CODE1', '', ' ', 1, 9853, 0, 0, '', 0, 19707) ;

CALL ImportField(985310002, 'Раздел 2', 'CODE2', '', ' ', 1, 9853, 0, 0, '', 0, 19708) ;

CALL ImportField(985310003, 'Раздел 3', 'CODE3', '', ' ', 1, 9853, 0, 0, '', 0, 19709) ;

-- Тип реестра, УРМ+Бюджет(2)
CALL ImportField(985310004, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9853, 0, 0, '', 0, 19711) ;

CALL ImportField(985310005, 'Код', 'ID', '', ' ', 2, 9853, 0, 0, '', 0, 19706) ;

CALL ImportField(985310006, 'Наименование', 'NAME', '', ' ', 2, 9853, 0, 0, '', 0, 19710) ;

CALL ImportField(985310007, 'Список интерфейсов', 'TREASUARYITFLIST', '', ' ', 2, 9853, 0, 0, '', 0, 19713) ;

CALL ImportField(985310008, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9853, 0, 0, '', 0, 19712) ;

-- Вид ссуды, Бюджет(1)
CALL ImportField(985710001, 'Бухгалтерский счет', 'BUHACCOUNT', '', ' ', 1, 9857, 0, 0, '', 0, 20181) ;

CALL ImportField(985710002, 'Код', 'ID', '', ' ', 1, 9857, 0, 0, '', 0, 20174) ;

CALL ImportField(985710003, 'Наименование', 'NAME', '', ' ', 1, 9857, 0, 0, '', 0, 20178) ;

-- Вид заимствования, Бюджет(1)
CALL ImportField(985810001, 'Бухгалтерский счет', 'BUHACCOUNT', '', ' ', 1, 9858, 0, 0, '', 0, 20190) ;

CALL ImportField(985810002, 'Код', 'ID', '', ' ', 1, 9858, 0, 0, '', 0, 20183) ;

CALL ImportField(985810003, 'Наименование', 'NAME', '', ' ', 1, 9858, 0, 0, '', 0, 20187) ;

-- Отдел, Бюджет(1)
CALL ImportField(985910001, 'Раздел 1', 'CODE1', '', ' ', 1, 9859, 0, 0, '', 0, 19788) ;

CALL ImportField(985910002, 'Раздел 2', 'CODE2', '', ' ', 1, 9859, 0, 0, '', 0, 19789) ;

CALL ImportField(985910003, 'Раздел 3', 'CODE3', '', ' ', 1, 9859, 0, 0, '', 0, 19790) ;

CALL ImportField(985910004, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9859, 0, 0, '', 0, 19792) ;

CALL ImportField(985910005, 'Код', 'ID', '', ' ', 1, 9859, 0, 0, '', 0, 19787) ;

CALL ImportField(985910006, 'Наименование', 'NAME', '', ' ', 1, 9859, 0, 0, '', 0, 19791) ;

CALL ImportField(985910007, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9859, 0, 0, '', 0, 19793) ;

CALL ImportField(985910008, '', 'USER_REF', '', ' ', 1, 9859, 0, 0, '', 0, 19794) ;

-- Единицы измерения, Бюджет(1)
CALL ImportField(986010002, 'Автор', 'CREATERUSER', '', ' ', 1, 9860, 0, 0, '', 0, 20731) ;

CALL ImportField(986010007, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9860, 0, 0, '', 0, 20734) ;

-- Единицы измерения, УРМ+Бюджет(2)
CALL ImportField(986010001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9860, 0, 0, '', 0, 20732) ;

CALL ImportField(986010003, 'Код', 'ID', '', ' ', 2, 9860, 0, 0, '', 0, 20728) ;

CALL ImportField(986010004, 'Наименование', 'NAME', '', ' ', 2, 9860, 0, 0, '', 0, 20729) ;

CALL ImportField(986010005, 'Краткое имя', 'SHORTNAME', '', ' ', 2, 9860, 0, 0, '', 0, 20730) ;

CALL ImportField(986010006, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9860, 0, 0, '', 0, 20733) ;

-- Предмет заявки, Бюджет(1)
CALL ImportField(986110001, '', 'ACCEPTDATE', '', ' ', 1, 9861, 0, 0, '', 0, 20717) ;

CALL ImportField(986110002, '', 'ATTRIBUTE', '', ' ', 1, 9861, 0, 0, '', 0, 20726) ;

CALL ImportField(986110003, '', 'BRAND', '', ' ', 1, 9861, 0, 0, '', 0, 20701) ;

CALL ImportField(986110004, 'Расширенный код', 'CODE', '', ' ', 1, 9861, 0, 0, '', 0, 20699) ;

CALL ImportField(986110005, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9861, 0, 0, '', 0, 20704) ;

CALL ImportField(986110006, 'Автор', 'CREATERUSER', '', ' ', 1, 9861, 0, 0, '', 0, 20703) ;

CALL ImportField(986110007, '', 'CRYPTOSTATUS', '', ' ', 1, 9861, 0, 0, '', 0, 20710) ;

CALL ImportField(986110008, '', 'DOCSTATEREF', '', ' ', 1, 9861, 0, 0, '', 0, 20713) ;

CALL ImportField(986110009, '', 'DOCUMENTDATE', '', ' ', 1, 9861, 0, 0, '', 0, 20718) ;

CALL ImportField(986110010, '', 'FACIALACCCLS', '', ' ', 1, 9861, 0, 0, '', 0, 20714) ;

CALL ImportField(986110011, 'Код', 'ID', '', ' ', 1, 9861, 0, 0, '', 0, 20695) ;

CALL ImportField(986110012, 'КЭСР', 'KESR', '', ' ', 1, 9861, 0, 0, '', 0, 20702) ;

CALL ImportField(986110013, '', 'MEASUREMENTCLS', '', ' ', 1, 9861, 0, 0, '', 0, 20707) ;

CALL ImportField(986110014, 'Наименование', 'NAME', '', ' ', 1, 9861, 0, 0, '', 0, 20697) ;

CALL ImportField(986110015, '', 'NAME2', '', ' ', 1, 9861, 0, 0, '', 0, null) ;

CALL ImportField(986110016, '', 'NAME3', '', ' ', 1, 9861, 0, 0, '', 0, null) ;

CALL ImportField(986110017, '', 'NAME4', '', ' ', 1, 9861, 0, 0, '', 0, null) ;

CALL ImportField(986110018, '', 'NOTE', '', ' ', 1, 9861, 0, 0, '', 0, 20715) ;

CALL ImportField(986110019, '', 'OBJECTSPEC', '', ' ', 1, 9861, 0, 0, '', 0, 20700) ;

CALL ImportField(986110020, 'ОКДП', 'OKDP', '', ' ', 1, 9861, 0, 0, '', 0, 20696) ;

CALL ImportField(986110021, '', 'OKPCLS', '', ' ', 1, 9861, 0, 0, '', 0, 20725) ;

CALL ImportField(986110022, '', 'REJECTCAUSE', '', ' ', 1, 9861, 0, 0, '', 0, 20709) ;

CALL ImportField(986110023, '', 'REJECTCLS', '', ' ', 1, 9861, 0, 0, '', 0, 20708) ;

CALL ImportField(986110024, 'Версия записи', 'RVERSION', '', ' ', 1, 9861, 0, 0, '', 0, 20720) ;

CALL ImportField(986110025, '', 'SENDERID', '', ' ', 1, 9861, 0, 0, '', 0, 20711) ;

CALL ImportField(986110026, '', 'SENDERRECORDID', '', ' ', 1, 9861, 0, 0, '', 0, 20712) ;

CALL ImportField(986110027, 'Краткое имя', 'SHORTNAME', '', ' ', 1, 9861, 0, 0, '', 0, 20698) ;

CALL ImportField(986110028, '', 'TENDEROBJREPLACE', '', ' ', 1, 9861, 0, 0, '', 0, 20719) ;

CALL ImportField(986110029, '', 'UPDATECAUSE', '', ' ', 1, 9861, 0, 0, '', 0, 20716) ;

CALL ImportField(986110030, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9861, 0, 0, '', 0, 20705) ;

CALL ImportField(986110031, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9861, 0, 0, '', 0, 20706) ;

CALL ImportField(986110032, '', 'WEBID', '', ' ', 1, 9861, 0, 0, '', 0, 20721) ;

CALL ImportField(986110033, '', 'REALID', '', ' ', 1, 9861, 0, 0, '', 0, 25046) ;

CALL ImportField(986110034, '', 'SENDERIDKEY', '', ' ', 1, 9861, 0, 0, '', 0, 29961) ;

CALL ImportField(986110035, '', 'SENDERRECORDIDKEY', '', ' ', 1, 9861, 0, 0, '', 0, 29962) ;

-- ОКАТО, Бюджет(1)
CALL ImportField(986210003, 'Район', 'REGIONCLS', '', ' ', 1, 9862, 0, 0, '', 0, 20425) ;

-- ОКАТО, УРМ+Бюджет(2)
CALL ImportField(986210001, 'Код', 'ID', '', ' ', 2, 9862, 0, 0, '', 0, 20419) ;

CALL ImportField(986210002, 'Наименование', 'NAME', '', ' ', 2, 9862, 0, 0, '', 0, 20423) ;

-- Тип обеспечения, Бюджет(1)
CALL ImportField(986310001, 'Код', 'ID', '', ' ', 1, 9863, 0, 0, '', 0, 20434) ;

CALL ImportField(986310002, 'Наименование', 'NAME', '', ' ', 1, 9863, 0, 0, '', 0, 20438) ;

-- Вид плана, УРМ+Бюджет(2)
CALL ImportField(986410001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9864, 0, 0, '', 0, 20689) ;

CALL ImportField(986410002, 'Код', 'ID', '', ' ', 2, 9864, 0, 0, '', 0, 20687) ;

CALL ImportField(986410003, 'Наименование', 'NAME', '', ' ', 2, 9864, 0, 0, '', 0, 20688) ;

CALL ImportField(986410004, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9864, 0, 0, '', 0, 20690) ;

-- План счетов, Бюджет(1)
CALL ImportField(986510004, 'Значимый код', 'FullId', '', ' ', 1, 9865, 0, 0, '', 0, null) ;

-- План счетов, УРМ+Бюджет(2)
CALL ImportField(986510002, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9865, 0, 0, '', 0, 21632) ;

CALL ImportField(986510005, 'Код', 'ID', '', ' ', 2, 9865, 0, 0, '', 0, 21628) ;

CALL ImportField(986510006, 'Наименование', 'NAME', '', ' ', 2, 9865, 0, 0, '', 0, 21631) ;

CALL ImportField(986510007, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9865, 0, 0, '', 0, 21633) ;

CALL ImportField(986510008, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9865, 0, 0, '', 0, 26745) ;

CALL ImportField(986510009, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9865, 0, 0, '', 0, 26746) ;

-- Код операции сектора государственного управления, Бюджет(1)
CALL ImportField(986810001, 'Раздел 1', 'CODE1', '', ' ', 1, 9868, 0, 0, '', 0, 16873) ;

CALL ImportField(986810002, 'Раздел 2', 'CODE2', '', ' ', 1, 9868, 0, 0, '', 0, 16874) ;

CALL ImportField(986810003, 'Раздел 3', 'CODE3', '', ' ', 1, 9868, 0, 0, '', 0, 16875) ;

CALL ImportField(986810004, '', 'CONTROLCODE', '', ' ', 1, 9868, 0, 0, '', 0, 16877) ;

CALL ImportField(986810013, 'Краткое имя', 'SHORTNAME', '', ' ', 1, 9868, 0, 0, '', 0, 24899) ;

CALL ImportField(986810015, 'Автор', 'CREATERUSER', '', ' ', 1, 9868, 0, 0, '', 0, 30898) ;

CALL ImportField(986810016, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9868, 0, 0, '', 0, 30899) ;

-- Код операции сектора государственного управления, УРМ+Бюджет(2)
CALL ImportField(986810005, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9868, 0, 0, '', 0, 16878) ;

CALL ImportField(986810006, 'Код', 'ID', '', ' ', 2, 9868, 0, 0, '', 0, 16872) ;

CALL ImportField(986810007, 'Является ЭКД', 'ISEKD', '', ' ', 2, 9868, 0, 0, '', 0, 16881) ;

CALL ImportField(986810008, 'Является ЭКИ', 'ISEKI', '', ' ', 2, 9868, 0, 0, '', 0, 16882) ;

CALL ImportField(986810009, 'Является ЭКР', 'ISEKR', '', ' ', 2, 9868, 0, 0, '', 0, 16880) ;

CALL ImportField(986810010, 'Наименование', 'NAME', '', ' ', 2, 9868, 0, 0, '', 0, 16876) ;

CALL ImportField(986810011, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9868, 0, 0, '', 0, 16879) ;

CALL ImportField(986810012, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9868, 0, 0, '', 0, 24898) ;

CALL ImportField(986810014, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9868, 0, 0, '', 0, 24900) ;

-- Направление, УРМ+Бюджет(2)
CALL ImportField(986910001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9869, 0, 0, '', 0, 21558) ;

CALL ImportField(986910002, 'Код', 'ID', '', ' ', 2, 9869, 0, 0, '', 0, 21556) ;

CALL ImportField(986910003, 'Наименование', 'NAME', '', ' ', 2, 9869, 0, 0, '', 0, 21557) ;

CALL ImportField(986910004, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9869, 0, 0, '', 0, 21559) ;

CALL ImportField(986910005, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9869, 0, 0, '', 0, 24715) ;

CALL ImportField(986910006, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9869, 0, 0, '', 0, 24716) ;

-- Подвид дохода, Бюджет(1)
CALL ImportField(987010001, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9870, 0, 0, '', 0, 21563) ;

CALL ImportField(987010002, 'Код', 'ID', '', ' ', 1, 9870, 0, 0, '', 0, 21561) ;

CALL ImportField(987010003, 'Наименование', 'NAME', '', ' ', 1, 9870, 0, 0, '', 0, 21562) ;

CALL ImportField(987010004, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9870, 0, 0, '', 0, 21564) ;

CALL ImportField(987010005, 'Краткое имя', 'SHORTNAME', '', ' ', 1, 9870, 0, 0, '', 0, 24936) ;

CALL ImportField(987010006, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 1, 9870, 0, 0, '', 0, 30727) ;

CALL ImportField(987010007, 'Дата начала срока действия', 'STARTDATE', '', ' ', 1, 9870, 0, 0, '', 0, 30728) ;

-- Операция, Бюджет(1)
CALL ImportField(987110001, 'Бухгалтерские записи', 'ACCOUNTS', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110002, '', 'ACCOUNTSFORMATED1', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110003, '', 'ACCOUNTSFORMATED2', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110004, '', 'ACCOUNTSFORMATED3', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110005, '', 'ACCOUNTSFORMATED4', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110006, '', 'ACCOUNTSFORMATED5', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110007, '', 'ACCOUNTSFORMATED6', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110008, '', 'ACCOUNTSFORMATED7', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110009, '', 'BALANCECLS', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110010, '', 'BUHACCCREDIT', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110011, '', 'BUHACCDEBIT', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110013, '', 'CORRECTIONFLAG', '', ' ', 1, 9871, 0, 0, '', 0, 21639) ;

CALL ImportField(987110014, '', 'CREDITACCREF', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110015, '', 'CREDITBUDCLSKIND', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110016, '', 'DEBITACCREF', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110017, '', 'DEBITBUDCLSKIND', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110018, '', 'ECCLSCREDIT', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110019, '', 'ECCLSDEBIT', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110020, 'Значимый код', 'FULLID', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110023, 'Причина отклонения', 'REJECTINFO', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

-- Операция, УРМ+Бюджет(2)
CALL ImportField(987110012, '', 'BUHOPERATIONCLS', '', ' ', 2, 9871, 0, 0, '', 0, 21635) ;

CALL ImportField(987110021, 'Код', 'ID', '', ' ', 2, 9871, 0, 0, '', 0, null) ;

CALL ImportField(987110022, 'Наименование', 'NAME', '', ' ', 2, 9871, 0, 0, '', 0, 21636) ;

CALL ImportField(987110024, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9871, 0, 0, '', 0, 26747) ;

CALL ImportField(987110025, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9871, 0, 0, '', 0, 26748) ;

-- Баланс, УРМ+Бюджет(2)
CALL ImportField(987210001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9872, 0, 0, '', 0, 21644) ;

CALL ImportField(987210002, 'Код', 'ID', '', ' ', 2, 9872, 0, 0, '', 0, 21641) ;

CALL ImportField(987210003, 'Наименование', 'NAME', '', ' ', 2, 9872, 0, 0, '', 0, 21642) ;

CALL ImportField(987210004, 'Обозначение', 'SHORTNAME', '', ' ', 2, 9872, 0, 0, '', 0, 21643) ;

CALL ImportField(987210005, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9872, 0, 0, '', 0, 21645) ;

-- Бюджет, УРМ(0)
CALL ImportField(987800012, '', 'AYEAR', '', ' ', 0, 9878, 0, 0, '', 0, null) ;

-- Бюджет, Бюджет(1)
CALL ImportField(987810004, 'Значимый код', 'FULLID', '', ' ', 1, 9878, 0, 0, '', 0, null) ;

CALL ImportField(987810005, 'ОКАТО', 'FULLOKATO', '', ' ', 1, 9878, 0, 0, '', 0, null) ;

CALL ImportField(987810010, '', 'RIGHT', '', ' ', 1, 9878, 0, 0, '', 0, null) ;

CALL ImportField(987810012, '', 'YEAR', '', ' ', 1, 9878, 0, 0, '', 0, null) ;

-- Бюджет, УРМ+Бюджет(2)
CALL ImportField(987810001, '', 'ADDOKATO', '', ' ', 2, 9878, 0, 0, '', 0, 16810) ;

CALL ImportField(987810002, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9878, 0, 0, '', 0, 16811) ;

CALL ImportField(987810003, '', 'CURRENTBUDGET', '', ' ', 2, 9878, 0, 0, '', 0, 16807) ;

CALL ImportField(987810006, 'Код', 'ID', '', ' ', 2, 9878, 0, 0, '', 0, 16804) ;

CALL ImportField(987810007, 'Наименование', 'NAME', '', ' ', 2, 9878, 0, 0, '', 0, 16805) ;

CALL ImportField(987810008, 'Полное наименование', 'NOTE', '', ' ', 2, 9878, 0, 0, '', 0, 16808) ;

CALL ImportField(987810009, '', 'OKATO', '', ' ', 2, 9878, 0, 0, '', 0, 16809) ;

CALL ImportField(987810011, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9878, 0, 0, '', 0, 16812) ;

CALL ImportField(987810013, '', 'BUDGETLEVEL', '', ' ', 2, 9878, 0, 0, '', 0, 24689) ;

CALL ImportField(987810014, '', 'CHIEFNAME', '', ' ', 2, 9878, 0, 0, '', 0, 26543) ;

CALL ImportField(987810015, '', 'CHIEFROLE', '', ' ', 2, 9878, 0, 0, '', 0, 26544) ;

-- Код цели, Бюджет(1)
CALL ImportField(987910006, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 1, 9879, 0, 0, '', 0, 27865) ;

CALL ImportField(987910007, 'Дата начала срока действия', 'STARTDATE', '', ' ', 1, 9879, 0, 0, '', 0, 27866) ;

-- Код цели, УРМ+Бюджет(2)
CALL ImportField(987910001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9879, 0, 0, '', 0, 22388) ;

CALL ImportField(987910002, 'Код', 'ID', '', ' ', 2, 9879, 0, 0, '', 0, 22386) ;

CALL ImportField(987910003, 'Наименование', 'NAME', '', ' ', 2, 9879, 0, 0, '', 0, 22387) ;

CALL ImportField(987910004, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9879, 0, 0, '', 0, 22389) ;

CALL ImportField(987910005, 'Строковый код', 'STRCODE', '', ' ', 2, 9879, 0, 0, '', 0, 22390) ;

-- Источник образования средств, Бюджет(1)
CALL ImportField(988010002, 'Автор', 'CREATERUSER', '', ' ', 1, 9880, 0, 0, '', 0, 22635) ;

CALL ImportField(988010006, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9880, 0, 0, '', 0, 22638) ;

CALL ImportField(988010007, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 1, 9880, 0, 0, '', 0, 24814) ;

CALL ImportField(988010008, 'Направление использования', 'NOTE', '', ' ', 1, 9880, 0, 0, '', 0, 24815) ;

CALL ImportField(988010009, 'Краткое имя', 'SHORTNAME', '', ' ', 1, 9880, 0, 0, '', 0, 24816) ;

CALL ImportField(988010010, 'Дата начала срока действия', 'STARTDATE', '', ' ', 1, 9880, 0, 0, '', 0, 24817) ;

-- Источник образования средств, УРМ+Бюджет(2)
CALL ImportField(988010001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9880, 0, 0, '', 0, 22636) ;

CALL ImportField(988010003, 'Код', 'ID', '', ' ', 2, 9880, 0, 0, '', 0, 22633) ;

CALL ImportField(988010004, 'Наименование', 'NAME', '', ' ', 2, 9880, 0, 0, '', 0, 22634) ;

CALL ImportField(988010005, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9880, 0, 0, '', 0, 22637) ;

-- ОКФС, Бюджет(1)
CALL ImportField(988110001, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9881, 0, 0, '', 0, 22800) ;

CALL ImportField(988110002, 'Код', 'ID', '', ' ', 1, 9881, 0, 0, '', 0, 22798) ;

CALL ImportField(988110003, 'Наименование', 'NAME', '', ' ', 1, 9881, 0, 0, '', 0, 22799) ;

CALL ImportField(988110004, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9881, 0, 0, '', 0, 22801) ;

-- ОКОПФ, Бюджет(1)
CALL ImportField(988210001, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9882, 0, 0, '', 0, 22816) ;

CALL ImportField(988210002, 'Код', 'ID', '', ' ', 1, 9882, 0, 0, '', 0, 22814) ;

CALL ImportField(988210003, 'Наименование', 'NAME', '', ' ', 1, 9882, 0, 0, '', 0, 22815) ;

CALL ImportField(988210004, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9882, 0, 0, '', 0, 22817) ;

-- Вид организации, УРМ+Бюджет(2)
CALL ImportField(988310001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9883, 0, 0, '', 0, 22821) ;

CALL ImportField(988310002, 'Код', 'ID', '', ' ', 2, 9883, 0, 0, '', 0, 22819) ;

CALL ImportField(988310003, 'Наименование', 'NAME', '', ' ', 2, 9883, 0, 0, '', 0, 22820) ;

CALL ImportField(988310004, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9883, 0, 0, '', 0, 22822) ;

-- Код целевых средств, Бюджет(1)
CALL ImportField(988410004, '', 'RECEIVE', '', ' ', 1, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410007, '', 'RECEIVEKD_DESCRIPTIONCODE', '', ' ', 1, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410009, '', 'RECEIVEKD_KESR', '', ' ', 1, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410010, '', 'RECEIVEKD_KVSR', '', ' ', 1, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410011, '', 'RECEIVEKD_PROGRAMCODE', '', ' ', 1, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410017, '', 'TRANSFER', '', ' ', 1, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410032, 'Код бюджета', 'BUDGETREF', '', ' ', 1, 9884, 0, 0, '', 0, 27634) ;

CALL ImportField(988410033, '', 'COMMONRECEIPTCLS', '', ' ', 1, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410034, '', 'COMMONTRANSFERCLS', '', ' ', 1, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410035, '', 'DESTLEVEL', '', ' ', 1, 9884, 0, 0, '', 0, 31750) ;

CALL ImportField(988410036, '', 'GRANTKIND', '', ' ', 1, 9884, 0, 0, '', 0, 31751) ;

CALL ImportField(988410037, '', 'SOURCELEVEL', '', ' ', 1, 9884, 0, 0, '', 0, 31752) ;

CALL ImportField(988410038, '', 'SOURCELEVELCALC', '', ' ', 1, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410039, '', 'TRANSFERTKIND', '', ' ', 1, 9884, 0, 0, '', 0, 31753) ;

CALL ImportField(988410040, '', 'TRANSFERTYEAR', '', ' ', 1, 9884, 0, 0, '', 0, 31754) ;

-- Код целевых средств, УРМ+Бюджет(2)
CALL ImportField(988410001, 'Значимый код', 'CODE', '', ' ', 2, 9884, 0, 0, '', 0, 25326) ;

CALL ImportField(988410002, 'Код', 'ID', '', ' ', 2, 9884, 0, 0, '', 0, 22774) ;

CALL ImportField(988410003, 'Наименование', 'NAME', '', ' ', 2, 9884, 0, 0, '', 0, 22775) ;

CALL ImportField(988410005, '', 'RECEIVEKCSR', '', ' ', 2, 9884, 0, 0, '', 0, 25328) ;

CALL ImportField(988410012, '', 'RECEIVEKESR', '', ' ', 2, 9884, 0, 0, '', 0, 25330) ;

CALL ImportField(988410013, '', 'RECEIVEKFSR', '', ' ', 2, 9884, 0, 0, '', 0, 25331) ;

CALL ImportField(988410014, '', 'RECEIVEKVR', '', ' ', 2, 9884, 0, 0, '', 0, 25332) ;

CALL ImportField(988410015, '', 'RECEIVEKVSR', '', ' ', 2, 9884, 0, 0, '', 0, 25333) ;

CALL ImportField(988410020, '', 'TRANSFERKDVALUE', '', ' ', 2, 9884, 0, 0, '', 0, 25338) ;

CALL ImportField(988410027, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9884, 0, 0, '', 0, 25327) ;

CALL ImportField(988410028, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9884, 0, 0, '', 0, 25334) ;

CALL ImportField(988410029, '', 'TARGETCLS', '', ' ', 2, 9884, 0, 0, '', 0, 25335) ;

CALL ImportField(988410030, 'Район', 'RegionCLS', '', ' ', 2, 9884, 0, 0, '', 0, 22782) ;

CALL ImportField(988410031, '', 'NOTE', '', ' ', 2, 9884, 0, 0, '', 0, 27635) ;

-- Вид ассигнований, УРМ+Бюджет(2)
CALL ImportField(988510001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9885, 0, 0, '', 0, 22980) ;

CALL ImportField(988510002, 'Автор', 'CREATERUSER', '', ' ', 2, 9885, 0, 0, '', 0, 22979) ;

CALL ImportField(988510003, 'Код', 'ID', '', ' ', 2, 9885, 0, 0, '', 0, 22977) ;

CALL ImportField(988510004, 'Наименование', 'NAME', '', ' ', 2, 9885, 0, 0, '', 0, 22978) ;

CALL ImportField(988510005, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9885, 0, 0, '', 0, 22982) ;

CALL ImportField(988510006, 'Изменивший', 'UPDATERUSER', '', ' ', 2, 9885, 0, 0, '', 0, 22981) ;

CALL ImportField(988510007, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9885, 0, 0, '', 0, 24630) ;

CALL ImportField(988510008, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9885, 0, 0, '', 0, 24631) ;

CALL ImportField(988510010, '', 'MARK', '', ' ', 2, 9885, 0, 0, '', 0, 27697) ;

-- Вид изменений, Бюджет(1)
CALL ImportField(988610009, '', 'MARK', '', ' ', 1, 9886, 0, 0, '', 0, 27698) ;

-- Вид изменений, УРМ+Бюджет(2)
CALL ImportField(988610001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9886, 0, 0, '', 0, 22987) ;

CALL ImportField(988610002, 'Автор', 'CREATERUSER', '', ' ', 2, 9886, 0, 0, '', 0, 22986) ;

CALL ImportField(988610003, 'Код', 'ID', '', ' ', 2, 9886, 0, 0, '', 0, 22984) ;

CALL ImportField(988610004, 'Наименование', 'NAME', '', ' ', 2, 9886, 0, 0, '', 0, 22985) ;

CALL ImportField(988610005, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9886, 0, 0, '', 0, 22989) ;

CALL ImportField(988610006, 'Изменивший', 'UPDATERUSER', '', ' ', 2, 9886, 0, 0, '', 0, 22988) ;

CALL ImportField(988610007, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9886, 0, 0, '', 0, 24633) ;

CALL ImportField(988610008, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9886, 0, 0, '', 0, 24634) ;

-- Вариант, УРМ+Бюджет(2)
CALL ImportField(988710001, 'Код', 'ID', '', ' ', 2, 9887, 0, 0, '', 0, 25103) ;

CALL ImportField(988710002, 'Наименование', 'NAME', '', ' ', 2, 9887, 0, 0, '', 0, 25104) ;

-- Код субсидии, Бюджет(1)
CALL ImportField(988910013, 'Принадлежность средств', 'BELONGINGKIND', '', ' ', 1, 9889, 0, 0, '', 0, 30621) ;

CALL ImportField(988910014, 'Год', 'SUBSIDYYEAR', '', ' ', 1, 9889, 0, 0, '', 0, 30622) ;

CALL ImportField(988910015, '', 'DOCUMENTCLS', '', ' ', 1, 9889, 0, 0, '', 0, 31747) ;

-- Код субсидии, УРМ+Бюджет(2)
CALL ImportField(988910001, 'Код бюджета', 'BUDGETREF', '', ' ', 2, 9889, 0, 0, '', 0, 26640) ;

CALL ImportField(988910002, 'Значимый код', 'CODE', '', ' ', 2, 9889, 0, 0, '', 0, 26641) ;

CALL ImportField(988910003, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9889, 0, 0, '', 0, 26642) ;

CALL ImportField(988910004, 'Автор', 'CREATERUSER', '', ' ', 2, 9889, 0, 0, '', 0, 26643) ;

CALL ImportField(988910005, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9889, 0, 0, '', 0, 26644) ;

CALL ImportField(988910006, 'Код', 'ID', '', ' ', 2, 9889, 0, 0, '', 0, 26645) ;

CALL ImportField(988910007, 'Наименование', 'NAME', '', ' ', 2, 9889, 0, 0, '', 0, 26646) ;

CALL ImportField(988910008, 'Ссылка на организацию', 'ORG_REF', '', ' ', 2, 9889, 0, 0, '', 0, 26647) ;

CALL ImportField(988910009, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9889, 0, 0, '', 0, 26648) ;

CALL ImportField(988910010, 'Вид субсидии', 'SUBSIDYKIND', '', ' ', 2, 9889, 0, 0, '', 0, 26649) ;

CALL ImportField(988910011, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9889, 0, 0, '', 0, 26650) ;

CALL ImportField(988910012, 'Изменивший', 'UPDATERUSER', '', ' ', 2, 9889, 0, 0, '', 0, 26651) ;

-- Код бюджетного ассигнования, Бюджет(1)
CALL ImportField(989010004, 'Автор', 'CREATERUSER', '', ' ', 1, 9890, 0, 0, '', 0, 27827) ;

CALL ImportField(989010010, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9890, 0, 0, '', 0, 27833) ;

-- Код бюджетного ассигнования, УРМ+Бюджет(2)
CALL ImportField(989010001, 'Код бюджета', 'BUDGETREF', '', ' ', 2, 9890, 0, 0, '', 0, 27824) ;

CALL ImportField(989010002, 'Значимый код', 'CODE', '', ' ', 2, 9890, 0, 0, '', 0, 27825) ;

CALL ImportField(989010003, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9890, 0, 0, '', 0, 27826) ;

CALL ImportField(989010005, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9890, 0, 0, '', 0, 27828) ;

CALL ImportField(989010006, 'Код', 'ID', '', ' ', 2, 9890, 0, 0, '', 0, 27829) ;

CALL ImportField(989010007, 'Наименование', 'NAME', '', ' ', 2, 9890, 0, 0, '', 0, 27830) ;

CALL ImportField(989010008, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9890, 0, 0, '', 0, 27831) ;

CALL ImportField(989010009, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9890, 0, 0, '', 0, 27832) ;

-- Код расходного обязательства, Бюджет(1)
CALL ImportField(989110004, 'Автор', 'CREATERUSER', '', ' ', 1, 9891, 0, 0, '', 0, 27851) ;

CALL ImportField(989110010, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9891, 0, 0, '', 0, 27857) ;

-- Код расходного обязательства, УРМ+Бюджет(2)
CALL ImportField(989110001, 'Код бюджета', 'BUDGETREF', '', ' ', 2, 9891, 0, 0, '', 0, 27848) ;

CALL ImportField(989110002, 'Значимый код', 'CODE', '', ' ', 2, 9891, 0, 0, '', 0, 27849) ;

CALL ImportField(989110003, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9891, 0, 0, '', 0, 27850) ;

CALL ImportField(989110005, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 2, 9891, 0, 0, '', 0, 27852) ;

CALL ImportField(989110006, 'Код', 'ID', '', ' ', 2, 9891, 0, 0, '', 0, 27853) ;

CALL ImportField(989110007, 'Наименование', 'NAME', '', ' ', 2, 9891, 0, 0, '', 0, 27854) ;

CALL ImportField(989110008, 'Дата начала срока действия', 'STARTDATE', '', ' ', 2, 9891, 0, 0, '', 0, 27855) ;

CALL ImportField(989110009, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9891, 0, 0, '', 0, 27856) ;

-- Категории архивных документов (справочник), Бюджет(1)
CALL ImportField(989210001, 'Периодичность', 'PERIODTYPE', '', ' ', 1, 9892, 0, 0, '', 0, 30692) ;

CALL ImportField(989210002, '', 'BEGINDATE', '', ' ', 1, 9892, 0, 0, '', 0, 30683) ;

CALL ImportField(989210003, 'Значимый код', 'CODE', '', ' ', 1, 9892, 0, 0, '', 0, 30684) ;

CALL ImportField(989210004, '', 'CONSTRAINTSCRIPTNAME', '', ' ', 1, 9892, 0, 0, '', 0, 30685) ;

CALL ImportField(989210005, '', 'CREATINGSCRIPTNAME', '', ' ', 1, 9892, 0, 0, '', 0, 30688) ;

CALL ImportField(989210006, '', 'DYNSETNAME', '', ' ', 1, 9892, 0, 0, '', 0, 31628) ;

CALL ImportField(989210007, '', 'ENABLEDIMPORTKINDS', '', ' ', 1, 9892, 0, 0, '', 0, 31084) ;

CALL ImportField(989210008, '', 'ENDDATE', '', ' ', 1, 9892, 0, 0, '', 0, 30689) ;

CALL ImportField(989210009, 'Код', 'ID', '', ' ', 1, 9892, 0, 0, '', 0, 30690) ;

CALL ImportField(989210010, '', 'LIMITPARAMS', '', ' ', 1, 9892, 0, 0, '', 0, 31629) ;

CALL ImportField(989210011, 'Наименование', 'NAME', '', ' ', 1, 9892, 0, 0, '', 0, 30691) ;

CALL ImportField(989210012, 'Схема подписания', 'SCHEMENAME', '', ' ', 1, 9892, 0, 0, '', 0, null) ;

CALL ImportField(989210013, '', 'SECTIONTYPE', '', ' ', 1, 9892, 0, 0, '', 0, 30693) ;

CALL ImportField(989210014, '', 'SIGNSCHEME', '', ' ', 1, 9892, 0, 0, '', 0, 30893) ;

CALL ImportField(989210015, '', 'STORETOLINK', '', ' ', 1, 9892, 0, 0, '', 0, 31630) ;

CALL ImportField(989210016, '', 'TEMPLATECODE', '', ' ', 1, 9892, 0, 0, '', 0, 30694) ;

CALL ImportField(989210017, '', 'TEMPLATETYPE', '', ' ', 1, 9892, 0, 0, '', 0, 30695) ;

-- Справочник организаций, Бюджет(1)
CALL ImportField(990310005, 'Тип организации (старый)', 'ORG_CLS', 'Тип организации(устарело)', ' ', 1, 9903, 0, 0, 'Тип_Организации', 0, 16652) ;

CALL ImportField(990310006, 'ГосНИ', 'GOSNI', 'ГосНИ', ' ', 1, 9903, 0, 0, 'ГосНИ', 0, 16647) ;

CALL ImportField(990310007, 'Суб ИНН', 'SUBINN', 'Суб ИНН', ' ', 1, 9903, 0, 0, '', 0, 16654) ;

CALL ImportField(990310013, 'ФИО директора', 'dirname', 'ФИО директора', ' ', 1, 9903, 0, 0, 'ФИО_Директора', 0, 16656) ;

CALL ImportField(990310014, 'Телефон директора', 'dirphone', 'Телефон директора', ' ', 1, 9903, 0, 0, 'Телефон_Директора', 0, 16658) ;

CALL ImportField(990310015, 'ФИО бухгалтера', 'bugname', 'ФИО бухгалтера', ' ', 1, 9903, 0, 0, 'ФИО_Бухгалтера', 0, 16657) ;

CALL ImportField(990310016, 'Телефон бухгалтера', 'bugphone', 'Телефон бухгалтера', ' ', 1, 9903, 0, 0, 'Телефон_Бухгалтера', 0, 16659) ;

CALL ImportField(990310017, 'Сфера применения', 'RCOrg', 'Сфера применения', ' ', 1, 9903, 0, 0, 'Сфера_применения', 0, 16660) ;

CALL ImportField(990310018, 'E-mail адрес', 'EMail', 'E-mail адрес', ' ', 1, 9903, 0, 0, 'E-Mail_Адрес', 0, 16665) ;

CALL ImportField(990310019, 'Адрес Web-сайта', 'WebSite', 'Адрес Web-сайта', ' ', 1, 9903, 0, 0, 'Адрес_Web-сайта', 0, 16666) ;

CALL ImportField(990310020, 'ОКАТО', 'Okato', 'ОКАТО', ' ', 1, 9903, 0, 0, 'ОКАТО', 0, 16667) ;

CALL ImportField(990310021, 'Уточнение ОКАТО', 'AddOKATO', 'Уточнение ОКАТО', ' ', 1, 9903, 0, 0, 'РасширениеОКАТО', 0, 16669) ;

CALL ImportField(990310022, 'Идентификатор(по РПБС/по КОФК)', 'UFKCODE', 'Код в УФК', ' ', 1, 9903, 0, 1, 'КодВУФК', 0, 16668) ;

CALL ImportField(990310023, 'Дата закрытия', 'DateClose', 'Дата закрытия', ' ', 1, 9903, 0, 0, 'ДатаЗакрытия', 0, 16672) ;

CALL ImportField(990310024, 'Код удаленного клиента', 'SenderId', 'Код удаленного клиента', ' ', 1, 9903, 0, 1, 'КодОтправителяДокумента', 0, 16673) ;

CALL ImportField(990310058, 'ПППКлюч', 'KVSR', 'ППП', ' ', 1, 9903, 0, 1, 'ППП', 0, 16674) ;

CALL ImportField(990310059, 'ОКФС', 'OKFS', 'ОКФС', ' ', 1, 9903, 0, 0, 'ОКФС', 0, 16675) ;

CALL ImportField(990310060, 'ОКОПФ', 'OKOPF', 'ОКОПФ', ' ', 1, 9903, 0, 0, 'ОКОПФ', 0, 16676) ;

CALL ImportField(990310061, 'Дата включения в реестр', 'OPENDATE', 'Дата включения в реестр', ' ', 1, 9903, 0, 0, 'ДатаВключенияВРеестр', 0, 16677) ;

CALL ImportField(990310062, 'Дата исключения из реестра', 'CLOSEDATE', 'Дата исключения из реестра', ' ', 1, 9903, 0, 0, 'ДатаИсключенияИзРеестра', 0, 16678) ;

CALL ImportField(990310063, 'Дата изменения информации в реестре', 'CHANGEDATE', 'Дата изменения информации в реестре', ' ', 1, 9903, 0, 0, 'ДатаИзмененияИнформацииВРеестре', 0, 16679) ;

CALL ImportField(990310064, 'Код региона ', 'FederalRegionCode', 'Код региона ', ' ', 1, 9903, 0, 0, 'КодТОФК', 0, 16681) ;

CALL ImportField(990310066, 'ИНН(Распорядитель(учредитель))', 'GeneralOrgINN', 'ИНН распорядителя', ' ', 1, 9903, 0, 0, '', 0, 16645) ;

CALL ImportField(990310067, 'КПП(Распорядитель(учредитель))', 'GeneralOrgKPP', 'КПП распорядителя', ' ', 1, 9903, 0, 0, '', 0, 16653) ;

CALL ImportField(990310068, 'Наименование(Распорядитель)', 'GeneralOrgName', 'Наименование организации-распорядителя', ' ', 1, 9903, 0, 0, '', 0, 16646) ;

CALL ImportField(990310069, 'Код', 'ID', 'ID', ' ', 1, 9903, 0, 1, 'Код', 0, 16643) ;

CALL ImportField(990310076, 'Бюджет', 'BudgetRef', 'Бюджет', ' ', 1, 9903, 0, 0, '', 0, 16683) ;

CALL ImportField(990310077, 'Код заказчика', 'ClientID', 'Код заказчика', ' ', 1, 9903, 0, 0, '', 0, 16684) ;

CALL ImportField(990310080, 'Идентификатор(по РПБС/по КОФК)', 'OrgCode', 'Идентификатор(по РПБС/по КОФК)', ' ', 1, 9903, 0, 0, '', 0, 16687) ;

CALL ImportField(990310083, 'Является банком', 'IsBank', 'признак того, является ли организация банком. Если является, то заполняется ссылкой на банк', ' ', 1, 9903, 0, 1, '', 0, 17100) ;

CALL ImportField(990310084, 'Распорядитель(ссылка)', 'GeneralOrg_Ref', 'Организация-распорядитель(ссылка)', ' ', 1, 9903, 0, 1, '', 0, 16680) ;

CALL ImportField(990310086, 'Бюджетные полномочия', 'BudgetAuthority', 'Бюджетные полномочия', ' ', 1, 9903, 0, 0, '', 0, null) ;

CALL ImportField(990310087, 'По расходам(Бюджетные полномочия)', 'CostAuthority', 'По расходам(Бюджетные полномочия)', ' ', 1, 9903, 0, 0, 'ПолномочияПоРасходам', 0, 24926) ;

CALL ImportField(990310088, 'По источникам(Бюджетные полномочия)', 'DebtAuthority', 'По источникам(Бюджетные полномочия)', ' ', 1, 9903, 0, 0, 'ПолномочияПоИсточникам', 0, 24927) ;

CALL ImportField(990310089, 'По доходам(Бюджетные полномочия)', 'IncomeAuthority', 'По доходам(Бюджетные полномочия)', ' ', 1, 9903, 0, 0, 'ПолномочияПоДоходам', 0, 24928) ;

CALL ImportField(990310090, 'По СВР(Бюджетные полномочия)', 'SVRAuthority', 'По СВР(Бюджетные полномочия)', ' ', 1, 9903, 0, 0, 'ПолномочияПоСВР', 0, 24929) ;

CALL ImportField(990310091, 'Дата открытия', 'DateOpen', '', ' ', 1, 9903, 0, 0, '', 0, 31711) ;

CALL ImportField(990311025, 'Счет', 'ACC', 'Счет', ' ', 1, 9903, 1, 0, '', 0, 17112) ;

CALL ImportField(990311026, 'Банк(Обслуживающая организация)', 'banks', 'Банк', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311027, 'Тип счета', 'ACC_CLS', 'Тип счета', ' ', 1, 9903, 1, 0, 'Тип_Счета', 0, 17113) ;

CALL ImportField(990311030, 'Описание счета', 'COMMENT', 'Описание счета', ' ', 1, 9903, 1, 0, 'Коментарий', 0, null) ;

CALL ImportField(990311031, 'Умолчания платежа', 'ACCDEFAULT', 'Умолчания платежа', ' ', 1, 9903, 1, 0, 'Очередность', 0, 17121) ;

CALL ImportField(990311032, 'Счет закрыт', 'CLOSED', 'Счет закрыт', ' ', 1, 9903, 1, 0, 'Закрыт', 0, 17120) ;

CALL ImportField(990311033, 'Номер отделения СБ', 'BankDepNumber', ' Номер отделения СБ ', ' ', 1, 9903, 1, 0, 'Номер_Отделения_СБ', 0, 17115) ;

CALL ImportField(990311034, 'Орган ФК(Обслуживающая организация)', 'ServiceOrg', 'Обслуживающая организация', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311035, 'Счет органа ФК(Обслуживающая организация\Орган ФК)', 'FACIALCODE', 'Счет обслуживающей организации', ' ', 1, 9903, 1, 0, 'СубСчет', 0, 17122) ;

CALL ImportField(990311036, 'Наименование(Обслуживающая организация\Орган ФК)', 'SERVICEORGNAME', 'Наименование обслуживающей организации', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311037, 'Счет по умолчанию', 'IsDefault', 'Счет по умолчанию', ' ', 1, 9903, 1, 0, 'Счет_по_умолчанию', 0, 17124) ;

CALL ImportField(990311070, 'Банк', 'bank_ref', 'Банк', ' ', 1, 9903, 1, 1, 'Банк', 0, 17111) ;

CALL ImportField(990311071, 'Организация', 'ORG_REF', 'ORG_REF', ' ', 1, 9903, 1, 1, 'Организация', 0, 17110) ;

CALL ImportField(990311072, 'SERVICE_ORG_REF', 'SERVICE_ORG_REF', 'SERVICE_ORG_REF', ' ', 1, 9903, 1, 1, 'Организация_ФК', 0, 17123) ;

CALL ImportField(990311073, 'Корр. счет(Обслуживающая организация\Банк)', 'COR', 'Корр. счет(Банк)', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311074, 'БИК(Обслуживающая организация\Банк)', 'MFO', 'БИК(Банк)', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311075, 'Наименование(Обслуживающая организация\Банк)', 'NAME', 'Наименование(Банк)', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311076, 'Вид обслуживания', 'ServiceAcc', '', ' ', 1, 9903, 1, 0, '', 0, 26636) ;

CALL ImportField(990311077, 'л/счет в ФК(Обслуживающая организация\Финансовый орган)', 'FCAcc', '', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311078, 'Счет ФК(Обслуживающая организация\Финансовый орган)', 'FKAcc', '', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311079, 'Наименование(Обслуживающая организация\Финансовый орган)', 'TresuaryName', '', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311080, 'Финансовый орган(Обслуживающая организация)', 'TresuaryOrgName', '', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311081, 'Лицевой счет', 'FacialAcc_CLS', 'Лицевой счет', ' ', 1, 9903, 1, 0, '', 0, 27016) ;

CALL ImportField(990311082, 'Обслуживающая организация', 'CustomServiceOrgName', '', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311083, 'Cчет в банке(Обслуживающая организация\Финансовый орган)', 'BankAcc', '', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311099, 'Ссылка на счет обслуживающей организации', 'Service_Acc_Ref', 'Ссылка на счет обслуживающей организации', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990312038, 'Код', 'ID', 'Код', ' ', 1, 9903, 2, 0, 'Код', 0, 17130) ;

CALL ImportField(990312039, 'Описание', 'NAME', 'Описание', ' ', 1, 9903, 2, 0, 'Наименование', 0, 17135) ;

CALL ImportField(990312040, 'Мнемокод', 'FacialCode', 'Мнемокод', ' ', 1, 9903, 2, 1, 'МнемоКодЛС', 0, 17149) ;

CALL ImportField(990312041, 'Счет в ФК', 'FCName', 'Счет в ФК', ' ', 1, 9903, 2, 0, '', 0, null) ;

CALL ImportField(990312042, 'КВСРКлюч', 'KVSR', 'КВСР', ' ', 1, 9903, 2, 1, 'КВСР', 0, 17136) ;

CALL ImportField(990312043, 'КЦСРКлюч', 'KCSR', 'КЦСР', ' ', 1, 9903, 2, 1, 'КЦСР', 0, 17137) ;

CALL ImportField(990312044, 'КФСР', 'KFSR', 'КФСР', ' ', 1, 9903, 2, 0, 'КФСР', 0, 17138) ;

CALL ImportField(990312045, 'КВРКлюч', 'KVR', 'КВР', ' ', 1, 9903, 2, 1, 'КВР', 0, 17139) ;

CALL ImportField(990312046, 'КЭСР', 'KESR', 'КЭСР', ' ', 1, 9903, 2, 0, 'КЭСР', 0, 17140) ;

CALL ImportField(990312048, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 9903, 2, 0, 'ТипСредств', 0, 17153) ;

CALL ImportField(990312049, 'Дата открытия(Информация об извещениях)', 'DATEOPEN', 'Дата открытия', ' ', 1, 9903, 2, 0, 'ДатаОткрытияЛС', 0, 17143) ;

CALL ImportField(990312050, 'Дата закрытия(Информация об извещениях)', 'DATECLOSE', 'Дата закрытия', ' ', 1, 9903, 2, 0, 'ДатаЗакрытияЛС', 0, 17144) ;

CALL ImportField(990312051, 'Признак служебного л/с', 'SERVICEACCOUNT', 'Признак служебного л/с', ' ', 1, 9903, 2, 0, 'СлужебныйЛС', 0, 17145) ;

CALL ImportField(990312052, 'Характер (устарел)', 'HARACTERACCOUNT', 'Характер счёта', ' ', 1, 9903, 2, 0, 'ХарактерCчетаЛС', 0, 17147) ;

CALL ImportField(990312053, 'Состояние счёта', 'STATUSACCOUNT', 'Состояние счёта', ' ', 1, 9903, 2, 0, 'СтатусСчетаЛС', 0, 17146) ;

CALL ImportField(990312054, 'Район', 'RegionCls', 'Район', ' ', 1, 9903, 2, 1, 'Регион', 0, 17148) ;

CALL ImportField(990312055, 'Распорядитель', 'GeneralOrg_Name', 'Распорядитель', ' ', 1, 9903, 2, 0, '', 0, 16646) ;

CALL ImportField(990312056, 'Куратор лицевого счёта', 'DEPARTMENT', 'Куратор лицевого счёта', ' ', 1, 9903, 2, 0, 'КураторЛС', 0, 17154) ;

CALL ImportField(990312073, 'Организация л\с', 'ORG_REF', 'ORG_REF', ' ', 1, 9903, 2, 1, 'ОрганизацияЛС', 0, 17142) ;

CALL ImportField(990312074, 'Распорядитель л\с', 'GeneralOrg_Ref', 'Организация-распорядитель(ссылка)', ' ', 1, 9903, 2, 1, 'РаспорядительЛС', 0, 17152) ;

CALL ImportField(990312075, 'Счет в ФК', 'FCAccount', 'Счет в ФК', ' ', 1, 9903, 2, 1, 'СчетФК', 0, 17160) ;

CALL ImportField(990312081, 'Номер изв. о закр.(Информация об извещениях)', 'CloseDocNumber', 'Номер изв. о закр.', ' ', 1, 9903, 2, 0, 'НомерИзвещенияЗакрытия', 0, 17157) ;

CALL ImportField(990312082, 'Номер изв. об откр.(Информация об извещениях)', 'OpenDocNumber', 'Номер изв. об откр.', ' ', 1, 9903, 2, 0, 'НомерИзвещенияОткрытия', 0, 17156) ;

CALL ImportField(990312086, 'Номер Л/С', 'FacialCodeEx', '', ' ', 1, 9903, 2, 0, '', 0, 26617) ;

CALL ImportField(990312087, 'Примечание', 'Note', '', ' ', 1, 9903, 2, 0, 'ПримечаниеЛС', 0, 24729) ;

CALL ImportField(990312088, 'БУ/АУ(Характер счета)', 'IsBU', '', ' ', 1, 9903, 2, 0, '', 0, 26618) ;

CALL ImportField(990312089, 'ПБС(Характер счета)', 'IsPBS', '', ' ', 1, 9903, 2, 0, '', 0, 26619) ;

CALL ImportField(990312090, 'По переданным полномочиям(Характер счета)', 'IsProxy', '', ' ', 1, 9903, 2, 0, '', 0, 26620) ;

CALL ImportField(990312091, 'Распорядительный(Характер счета)', 'IsRBS', '', ' ', 1, 9903, 2, 0, '', 0, 26621) ;

CALL ImportField(990312092, 'Отдельный БУ/АУ(Характер счета)', 'IsSeparateBU', '', ' ', 1, 9903, 2, 0, '', 0, 26622) ;

CALL ImportField(990312093, 'ОМС(Характер счета)', 'IsOMS', '', ' ', 1, 9903, 2, 0, '', 0, 27841) ;

CALL ImportField(990312094, 'Номер изв. о переоформл.(Информация об извещениях)', 'ChangeDocNumber', '', ' ', 1, 9903, 2, 0, '', 0, 29913) ;

CALL ImportField(990312095, 'Дата переоформления(Информация об извещениях)', 'DateChange', '', ' ', 1, 9903, 2, 0, '', 0, 29914) ;

CALL ImportField(990312096, 'Информация об извещениях', 'NotifyDocs', '', ' ', 1, 9903, 2, 0, '', 0, null) ;

CALL ImportField(990312097, 'Л/c распорядителя (учредителя)', 'GeneralOrgFacialAcc', 'л/с распорядителя (учредителя)', ' ', 1, 9903, 2, 0, '', 0, 30896) ;

CALL ImportField(990312098, 'Получатель полномочий', 'GranteeOrg_Ref', 'Организация-получатель полномочий (ссылка)', ' ', 1, 9903, 2, 0, '', 0, null) ;

-- Справочник контактных лиц, УРМ+Бюджет(2)
CALL ImportField(990410001, 'Лицевой счёт создателя', 'Лиц. счет', 'Лицевой счёт создавшего контактную информацию', 'FacialAccCls', 2, 9904, 0, 0, '', 0, null) ;

CALL ImportField(990410002, 'ИНН', 'ИНН', 'ИНН организации', 'OrgINN', 2, 9904, 0, 0, '', 0, null) ;

CALL ImportField(990410003, 'КПП', 'КПП', 'КПП организации', 'OrgKPP', 2, 9904, 0, 0, '', 0, null) ;

CALL ImportField(990410004, 'Наименование', 'Наименование', 'Наименование организации', 'OrgName', 2, 9904, 0, 0, '', 0, null) ;

CALL ImportField(990410005, 'ФИО', 'ФИО контактного лица', '', 'Name', 2, 9904, 0, 0, '', 0, null) ;

CALL ImportField(990410006, 'Должность', 'Должность', '', 'HoldRank', 2, 9904, 0, 0, '', 0, null) ;

CALL ImportField(990410007, 'Номер телефона', 'Номер телефона', '', 'PhoneNo', 2, 9904, 0, 0, '', 0, null) ;

CALL ImportField(990410008, 'Электронная почта', 'E-mail контактного лица', 'Электронная почта контактного лица', 'EMail', 2, 9904, 0, 0, '', 0, null) ;

CALL ImportField(990410009, 'Примечание', 'Примечание', '', 'Note', 2, 9904, 0, 0, '', 0, null) ;

CALL ImportField(990410010, 'Причина отклонения', 'Причина отклонения', '', 'RejectCls', 2, 9904, 0, 0, '', 0, null) ;

CALL ImportField(990410011, 'Причина отклонения', 'Причина отклонения(текст)', '', 'RejectCause', 2, 9904, 0, 0, '', 0, null) ;

-- Справочник банков, Бюджет(1)
CALL ImportField(990510001, 'Страна', 'COUNTRY', 'Страна', ' ', 1, 9905, 0, 0, 'Страна', 0, 16649) ;

CALL ImportField(990510002, 'БИК', 'MFO', 'БИК', ' ', 1, 9905, 0, 0, 'БИК', 0, 17101) ;

CALL ImportField(990510003, 'Наименование', 'NAME', 'Наименование', ' ', 1, 9905, 0, 0, 'Имя', 0, 16646) ;

CALL ImportField(990510004, 'Город', 'CITY', 'Город', ' ', 1, 9905, 0, 0, 'Город', 0, 16648) ;

CALL ImportField(990510005, 'Кор. счет', 'COR', 'Кор. счет', ' ', 1, 9905, 0, 0, 'КорСчет', 0, 17102) ;

CALL ImportField(990510006, 'Закрыт', 'CLOSED', 'Закрыт', ' ', 1, 9905, 0, 0, 'БанкЗакрыт', 0, null) ;

CALL ImportField(990510007, 'ИНН', 'INN', 'ИНН', ' ', 1, 9905, 0, 0, 'ИНН', 0, 16645) ;

CALL ImportField(990510008, 'Суб ИНН', 'SUBINN', 'Суб ИНН', ' ', 1, 9905, 0, 0, '', 0, 16654) ;

CALL ImportField(990510009, 'Район', 'RegionCls', 'Район', ' ', 1, 9905, 0, 0, 'Район', 0, 16644) ;

CALL ImportField(990510010, 'Тип организации (Старый)', 'org_cls', 'Тип организации', ' ', 1, 9905, 0, 0, 'Тип_Организации', 0, 16652) ;

CALL ImportField(990510011, 'ГосНИ', 'GOSNI', 'ГосНИ', ' ', 1, 9905, 0, 0, 'ГосНИ', 0, 16647) ;

CALL ImportField(990510012, 'КПП', 'INN20', 'КПП', ' ', 1, 9905, 0, 0, 'КПП', 0, 16653) ;

CALL ImportField(990510013, 'Телефон', 'PHONE', 'Телефон', ' ', 1, 9905, 0, 0, 'Телефон', 0, 16650) ;

CALL ImportField(990510014, 'Адрес', 'ADDRESS', 'Адрес', ' ', 1, 9905, 0, 0, 'Адрес', 0, 16651) ;

CALL ImportField(990510015, 'ФИО директора', 'dirname', 'ФИО директора', ' ', 1, 9905, 0, 0, 'ФИО_Директора', 0, 16656) ;

CALL ImportField(990510016, 'Телефон директора', 'dirphone', 'Телефон директора', ' ', 1, 9905, 0, 0, 'Телефон_Директора', 0, 16658) ;

CALL ImportField(990510017, 'ФИО бухгалтера', 'bugname', 'ФИО бухгалтера', ' ', 1, 9905, 0, 0, 'ФИО_Бухгалтера', 0, 16657) ;

CALL ImportField(990510018, 'Телефон бухгалтера', 'bugphone', 'Телефон бухгалтера', ' ', 1, 9905, 0, 0, 'Телефон_Бухгалтера', 0, 16659) ;

CALL ImportField(990510019, 'Участие в электронных расчетах', 'UER', 'Участие в электронных расчетах', ' ', 1, 9905, 0, 0, 'УчастиеВЭлРасчетах', 0, 17104) ;

CALL ImportField(990510020, 'Код контроля', 'UerReal', 'Код контроля', ' ', 1, 9905, 0, 0, 'КодКонтроля', 0, 17105) ;

CALL ImportField(990510021, 'Тип участника расчетов', 'pzn', 'Тип участника расчетов', ' ', 1, 9905, 0, 0, 'ТипУчастникаРасчетов', 0, 17106) ;

CALL ImportField(990510022, 'Код', 'ID', 'ID', ' ', 1, 9905, 0, 1, 'Код', 0, 16643) ;

CALL ImportField(990510023, 'Дата закрытия', 'DateClose', 'Дата закрытия', ' ', 1, 9905, 0, 0, '', 0, 17107) ;

CALL ImportField(990510024, 'Код региона', 'FederalRegionCode', 'Код региона', ' ', 1, 9905, 0, 0, 'КодТОФК', 0, 16681) ;

CALL ImportField(990510025, 'Вид организации', 'Org_Type', 'Вид организации', ' ', 1, 9905, 0, 1, 'ВидИспользования', 0, 16682) ;

-- Типы документов, Бюджет(1)
CALL ImportField(990810001, 'Вид документа', 'DocumentKind', 'Вид документа', ' ', 1, 9908, 0, 1, 'ВидДокумента', 0, null) ;

CALL ImportField(990810002, 'Имя макроса действий по умолчанию', 'DefaultActionMacrosName', 'Имя макроса действий', ' ', 1, 9908, 0, 0, 'ИмяМакросаДействий', 0, 20615) ;

CALL ImportField(990810003, 'Коллекция картинок', 'IconCollection', 'Коллекция картинок', ' ', 1, 9908, 0, 0, 'КоллекцияКартинок', 0, 20611) ;

CALL ImportField(990810004, 'Скрывать форму простановки подписи', 'NeedHideEDSForm', 'Скрывать форму простановки электронной подписи', ' ', 1, 9908, 0, 0, 'СкрыватьФормуПростановкиЭЦП', 0, 20612) ;

CALL ImportField(990810005, 'ЭЦП', 'NeedEDS', 'ЭЦП', ' ', 1, 9908, 0, 0, 'ЭЦП', 0, 20609) ;

CALL ImportField(990810006, 'Информация для блокировки', 'DBTable', 'Информация для блокировки', ' ', 1, 9908, 0, 0, 'ИнфДляБлок', 0, 20608) ;

CALL ImportField(990810007, 'Исп. состояния', 'UseState', 'Использовать состояния', ' ', 1, 9908, 0, 0, 'ИспСостояния', 0, 20607) ;

CALL ImportField(990810008, 'Вычислять блокировки', 'LockMask', '', ' ', 1, 9908, 0, 0, '', 0, 20614) ;

CALL ImportField(990810009, 'Примечание', 'Note', '', ' ', 1, 9908, 0, 0, '', 0, 20602) ;

CALL ImportField(990810010, 'Прикрепление файлов к документам(Права)', 'RightsAttachFiles', '', ' ', 1, 9908, 0, 0, '', 0, null) ;

CALL ImportField(990810011, 'Открепление файлов от документов(Права)', 'RightsDetachFiles', '', ' ', 1, 9908, 0, 0, '', 0, null) ;

CALL ImportField(990810012, 'Отклонение прикрепленных файлов(Права)', 'RightsRejectAttachFiles', '', ' ', 1, 9908, 0, 0, '', 0, null) ;

CALL ImportField(990810013, 'Имя таблицы УРМ', 'URMDBTable', '', ' ', 1, 9908, 0, 0, '', 0, 20610) ;

CALL ImportField(990811001, 'Номер дет.', 'DetailNumber', '', ' ', 1, 9908, 1, 0, '', 0, 20828) ;

CALL ImportField(990811002, 'Код поля', 'ID', '', ' ', 1, 9908, 1, 0, '', 0, 20822) ;

CALL ImportField(990811003, 'Принадлежит', 'IsBudget', '', ' ', 1, 9908, 1, 0, '', 0, 20826) ;

CALL ImportField(990811004, 'Название поля на интерф.', 'ItfFieldName', '', ' ', 1, 9908, 1, 0, '', 0, 20824) ;

CALL ImportField(990811005, 'Примечание', 'Name', '', ' ', 1, 9908, 1, 0, '', 0, 20823) ;

CALL ImportField(990811006, 'Редактируется с интерфейса', 'OnlyRead', '', ' ', 1, 9908, 1, 0, '', 0, 20834) ;

CALL ImportField(990811007, 'Имя колонки контроля', 'ReportFieldName', '', ' ', 1, 9908, 1, 0, '', 0, 20835) ;

CALL ImportField(990811008, 'Имя колонки шаблона', 'TemplateField', '', ' ', 1, 9908, 1, 0, '', 0, 20833) ;

CALL ImportField(990812001, 'Обобщенное имя состояния', 'Common_StateName', '', ' ', 1, 9908, 2, 0, '', 0, null) ;

CALL ImportField(990812002, 'Уровень бюджетного контроля', 'ControlLevel', '', ' ', 1, 9908, 2, 0, '', 0, null) ;

CALL ImportField(990812003, 'Картинка', 'IconName', '', ' ', 1, 9908, 2, 0, '', 0, null) ;

CALL ImportField(990812004, 'Название состояния', 'Name', '', ' ', 1, 9908, 2, 0, '', 0, null) ;

CALL ImportField(990812005, 'Прикрепление файлов к документам(Права)', 'RightsAttachFiles', '', ' ', 1, 9908, 2, 0, '', 0, null) ;

CALL ImportField(990812006, 'Открепление файлов от документов(Права)', 'RightsDetachFiles', '', ' ', 1, 9908, 2, 0, '', 0, null) ;

CALL ImportField(990812007, 'Номер состояния', 'StateNumber', '', ' ', 1, 9908, 2, 0, '', 0, null) ;

CALL ImportField(990812008, 'Порядок при отображении', 'StateOrder', '', ' ', 1, 9908, 2, 0, '', 0, null) ;

CALL ImportField(990812009, 'Тип состояния', 'StateTypeName', '', ' ', 1, 9908, 2, 0, '', 0, null) ;

CALL ImportField(990813001, 'Обратный', 'BackJump', '', ' ', 1, 9908, 3, 0, '', 0, null) ;

CALL ImportField(990813002, 'Начальное состояние', 'BeginStateName', '', ' ', 1, 9908, 3, 0, '', 0, null) ;

CALL ImportField(990813003, 'Формирование печатных документов', 'DocsEvent', '', ' ', 1, 9908, 3, 0, '', 0, null) ;

CALL ImportField(990813004, 'Конечное состояние', 'EndStateName', '', ' ', 1, 9908, 3, 0, '', 0, null) ;

CALL ImportField(990813005, 'Название перехода', 'Name', '', ' ', 1, 9908, 3, 0, '', 0, null) ;

CALL ImportField(990813006, 'Проверять ЭЦП', 'NeedCheckEDS', '', ' ', 1, 9908, 3, 0, '', 0, null) ;

CALL ImportField(990813007, 'Требуется ЭЦП', 'NeedEDS', '', ' ', 1, 9908, 3, 0, '', 0, null) ;

CALL ImportField(990813008, 'Примечание', 'Note', '', ' ', 1, 9908, 3, 0, '', 0, null) ;

CALL ImportField(990814001, 'Событие на формирование параметров', 'ActEvent', '', ' ', 1, 9908, 4, 0, '', 0, null) ;

CALL ImportField(990814002, 'Имя макроса', 'ActionName', '', ' ', 1, 9908, 4, 0, '', 0, null) ;

CALL ImportField(990814003, 'Позиция кнопки', 'ActPosition', '', ' ', 1, 9908, 4, 0, '', 0, null) ;

CALL ImportField(990814004, 'Обратное действие', 'BackAction', '', ' ', 1, 9908, 4, 0, '', 0, null) ;

CALL ImportField(990814005, 'Примечание', 'Hint', '', ' ', 1, 9908, 4, 0, '', 0, null) ;

CALL ImportField(990814006, 'Имя картинки', 'IconName', '', ' ', 1, 9908, 4, 0, '', 0, null) ;

CALL ImportField(990814007, 'Без кнопки', 'Invisible', '', ' ', 1, 9908, 4, 0, '', 0, null) ;

CALL ImportField(990814008, 'Принадлежность', 'IsBudget', '', ' ', 1, 9908, 4, 0, '', 0, null) ;

CALL ImportField(990814009, 'Доступные переходы', 'JumpsNamesCalc', '', ' ', 1, 9908, 4, 0, '', 0, null) ;

CALL ImportField(990814010, 'Название', 'Name', '', ' ', 1, 9908, 4, 0, '', 0, null) ;

-- Счета бюджета, Бюджет(1)
CALL ImportField(991210001, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 9912, 0, 0, '', 0, 17266) ;

CALL ImportField(991210003, 'Часто используемый', 'ACCMODE', 'Принадлежность', ' ', 1, 9912, 0, 0, '', 0, 17269) ;

CALL ImportField(991210004, 'Тип', 'FIXED', 'Тип', ' ', 1, 9912, 0, 0, '', 0, 17270) ;

CALL ImportField(991210005, 'Единый', 'isCommon', 'Единый', ' ', 1, 9912, 0, 0, '', 0, 17278) ;

CALL ImportField(991210006, 'Бюджетный(Вид использования)', 'isForBudget', 'Бюджетный(Вид использования)', ' ', 1, 9912, 0, 0, '', 0, 17279) ;

CALL ImportField(991210007, 'Предпринимательский(Вид использования)', 'isForBusiness', 'Предпринимательский(Вид использования)', ' ', 1, 9912, 0, 0, '', 0, 17280) ;

CALL ImportField(991210008, 'Для СВР(Вид использования)', 'isForTemporary', 'Для СВР(Вид использования)', ' ', 1, 9912, 0, 0, '', 0, 17281) ;

CALL ImportField(991210009, 'Для наличности', 'isForCash', 'Для наличности', ' ', 1, 9912, 0, 0, '', 0, 17282) ;

CALL ImportField(991210010, 'Код счета для казначейства', 'TreasuryBuhAcc', 'Код счета для казначейства', ' ', 1, 9912, 0, 0, '', 0, 21629) ;

CALL ImportField(991210011, 'Код счета для ФО', 'FinOrgBuhAcc', 'Код счета для ФО', ' ', 1, 9912, 0, 0, '', 0, 21629) ;

CALL ImportField(991210012, 'Источники внутреннего и внешнего финансирования', 'FSFULLID', 'Источники внутреннего и внешнего финансирования', ' ', 1, 9912, 0, 0, '', 0, 17055) ;

CALL ImportField(991210013, 'Валюта', 'CurrencyCls', 'Валюта', ' ', 1, 9912, 0, 0, '', 0, 17273) ;

CALL ImportField(991210014, 'Счет', 'ID', 'Счет', ' ', 1, 9912, 0, 1, 'Код', 0, 17109) ;

CALL ImportField(991210015, 'Район выдачи наличности', 'RegionCls', 'Район выдачи наличности', ' ', 1, 9912, 0, 0, '', 0, 17285) ;

CALL ImportField(991210016, 'Депозитный', 'isDeposit', '', ' ', 1, 9912, 0, 0, '', 0, 26548) ;

CALL ImportField(991210017, 'Для БУ\АУ(Вид использования)', 'isForBU_AU', '', ' ', 1, 9912, 0, 0, '', 0, 26549) ;

CALL ImportField(991210018, 'Л/с АДБ', 'FacialAcc_ADB', 'Лицевой счет администратора доходов бюджета', ' ', 1, 9912, 0, 0, '', 0, 28251) ;

CALL ImportField(991210019, 'Для СВР БУ\АУ(Вид использования)', 'isForTemporaryBU_AU', '', ' ', 1, 9912, 0, 0, '', 0, 29907) ;

-- Объекты, Бюджет(1)
CALL ImportField(991310001, 'ID', 'ID', 'Код', ' ', 1, 9913, 0, 1, '', 0, 16723) ;

CALL ImportField(991310002, 'Уникальный идентификатор', 'GUID', 'Уникальный интерфейс', ' ', 1, 9913, 0, 0, '', 0, 16724) ;

CALL ImportField(991310004, 'Параметр', 'Param', 'Параметр', ' ', 1, 9913, 0, 0, '', 0, 16726) ;

CALL ImportField(991310005, 'Код объекта', 'CLS', 'Код объекта', ' ', 1, 9913, 0, 1, '', 0, 16727) ;

CALL ImportField(991310006, 'Тип интерфейса', 'InterfaceType', 'Тип интерфейса', ' ', 1, 9913, 0, 0, '', 0, null) ;

CALL ImportField(991310007, 'Параметры ограничений', 'ParamCollection', 'Параметры ограничений', ' ', 1, 9913, 0, 0, '', 0, 24887) ;

CALL ImportField(991311007, '№ записи', 'ID', 'Код', ' ', 1, 9913, 1, 1, '', 0, 16730) ;

CALL ImportField(991311008, '№ интерфейса', 'InterfaceRef', 'Код интерфейса', ' ', 1, 9913, 1, 1, '', 0, 16731) ;

CALL ImportField(991311009, 'Разрешение', 'Name', 'Разрешение', ' ', 1, 9913, 1, 0, '', 0, 16732) ;

CALL ImportField(991311010, 'Пользователи', 'Val', 'Пользователи', ' ', 1, 9913, 1, 0, '', 0, 16733) ;

CALL ImportField(991312011, 'Код связи', 'ID', 'Код связи', ' ', 1, 9913, 2, 1, '', 0, null) ;

CALL ImportField(991312012, 'Имя', 'Name', 'Имя', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312013, 'Код шаблона', 'TemplateCls', 'Код шаблона', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312014, 'Код родительского набора', 'ParentDocCls', 'Код родительского набора', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312015, 'Код дочернего набора', 'ChildDocCls', 'Код дочернего набора', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312016, 'Блокировка родительской записи', 'BlockParent', 'Блокировка родительской записи', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312017, 'Блокировка дочерней записи', 'BlockChild', 'Блокировка дочерней записи', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312018, 'Удаление заблокированной родительской записи', 'CanDelBlockParent', 'Удаление заблокированной родительской записи', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312019, 'Удаление заблокированной дочерней записи', 'CanDelBlockChild', 'Удаление заблокированной дочерней записи', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312021, 'Событие на удаление', 'DelMacrosName', 'Событие на удаление', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312022, 'Комментарий', 'LinkComment', 'Комментарий', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312023, 'Тип картинки родителя', 'ParentPictureType', 'Тип картинки родителя', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312024, 'Тип картинки дочернего', 'ChildPictureType', 'Тип картинки дочернего', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312027, 'Коллекция картинок', 'PictureCollectionName', 'Коллекция картинок', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312028, 'Использовать на УРМ', 'UrmUse', 'Использовать на УРМ', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312030, 'Картинка дочернего', 'ChildPictureName', 'Картинка дочернего', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312031, 'Картинка родителя', 'ParentPictureName', 'Картинка родителя', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312032, 'Вид связи', 'LinkKind', 'Тип связи', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312033, 'Удалять дочерние при удалении связи', 'NEEDDELCHILD', 'Удалять дочерние при удалении связи', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991312034, 'Событие на показ по связям', 'ShowEvent', '', ' ', 1, 9913, 2, 0, '', 0, null) ;

CALL ImportField(991313001, 'Видимость по-умолчанию', 'DefaultVisible', 'Видимость по-умолчанию', ' ', 1, 9913, 3, 0, '', 0, null) ;

CALL ImportField(991313002, 'Номер детализации', 'DetailNumber', 'Номер детализации', ' ', 1, 9913, 3, 0, '', 0, null) ;

CALL ImportField(991313003, 'Имя поля', 'FieldName', 'Имя поля', ' ', 1, 9913, 3, 0, '', 0, null) ;

CALL ImportField(991313004, 'Имя параметра', 'ParamTab', 'Имя параметра', ' ', 1, 9913, 3, 0, '', 0, null) ;

CALL ImportField(991313005, 'Обязательность', 'Required', 'Обязательность', ' ', 1, 9913, 3, 0, '', 0, null) ;

CALL ImportField(991313006, 'Видимость', 'Visible', 'Видимость', ' ', 1, 9913, 3, 0, '', 0, null) ;

CALL ImportField(991314001, 'Тип дочернего документа', 'ChildDocCLS', 'Тип дочернего документа', ' ', 1, 9913, 4, 0, '', 0, 20827) ;

CALL ImportField(991314002, 'Код дочернего поля', 'CHILDFIELDREF', 'Код дочернего поля', ' ', 1, 9913, 4, 0, '', 0, 22791) ;

CALL ImportField(991314003, 'Имя дочернего поля', 'ChildTemplateField', 'Имя дочернего поля', ' ', 1, 9913, 4, 0, '', 0, 20833) ;

CALL ImportField(991314004, 'Наименование', 'NAME', 'Наименование', ' ', 1, 9913, 4, 0, '', 0, 22789) ;

CALL ImportField(991314005, 'Тип родительского документа', 'ParentDocCLS', 'Тип родительского документа', ' ', 1, 9913, 4, 0, '', 0, 20827) ;

CALL ImportField(991314006, 'Код родительского поля', 'PARENTFIELDREF', 'Код родительского поля', ' ', 1, 9913, 4, 0, '', 0, 22790) ;

CALL ImportField(991314007, 'Имя родительского поля', 'ParentTemplateField', 'Имя родительского поля', ' ', 1, 9913, 4, 0, '', 0, 20833) ;

CALL ImportField(991314008, 'Действие на удаление родительского документа', 'ParentDelActionVisible', '', ' ', 1, 9913, 4, 0, '', 0, null) ;

-- Редактор типов пакетов, Бюджет(1)
CALL ImportField(991410001, 'Макрос ограничений', 'ConstraintScriptName', 'Макрос ограничений', ' ', 1, 9914, 0, 0, '', 0, 22412) ;

CALL ImportField(991410002, 'Права на создание', 'CreationPermissions', 'Права на создание', ' ', 1, 9914, 0, 0, '', 0, 22410) ;

CALL ImportField(991410003, 'Состояние', 'Enabled', 'Состояние', ' ', 1, 9914, 0, 0, '', 0, 22411) ;

CALL ImportField(991410004, 'Код', 'ID', 'Код', ' ', 1, 9914, 0, 0, '', 0, 22406) ;

CALL ImportField(991410005, 'Название', 'Name', 'Название', ' ', 1, 9914, 0, 0, '', 0, 22407) ;

CALL ImportField(991410006, 'Периодичность', 'Period', 'Периодичность', ' ', 1, 9914, 0, 0, '', 0, 22408) ;

CALL ImportField(991410007, 'Тип обработки', 'ProcessingType', 'Тип обработки', ' ', 1, 9914, 0, 0, '', 0, 22409) ;

CALL ImportField(991410008, 'Категория по умолчанию', 'ArchiveDocTypeCode', 'Категория по умолчанию', ' ', 1, 9914, 0, 0, '', 0, 30684) ;

CALL ImportField(991410009, 'Категория по умолчанию (ключ)', 'ArchiveDocType', 'Категория по умолчанию (ключ)', ' ', 1, 9914, 0, 0, '', 0, null) ;

CALL ImportField(991411001, 'Макрос формирования', 'CreatingScriptName', 'Макрос формирования', ' ', 1, 9914, 1, 0, '', 0, 22505) ;

CALL ImportField(991411002, 'Тип секции', 'DataSectionTypeLookup', 'Тип секции', ' ', 1, 9914, 1, 0, '', 0, null) ;

CALL ImportField(991411003, 'Шаблон формирования', 'GenerationTemplate', 'Шаблон формирования', ' ', 1, 9914, 1, 0, '', 0, 22503) ;

CALL ImportField(991411004, 'Название', 'Name', 'Название', ' ', 1, 9914, 1, 0, '', 0, 22511) ;

CALL ImportField(991411005, 'Макрос предпросмотра', 'PreviewScriptName', 'Макрос предпросмотра', ' ', 1, 9914, 1, 0, '', 0, 22512) ;

CALL ImportField(991411006, 'Макрос обработки', 'ProcessingScriptName', 'Макрос обработки', ' ', 1, 9914, 1, 0, '', 0, 22506) ;

CALL ImportField(991411007, 'Шаблон обработки', 'ProcessingTemplate', 'Шаблон обработки', ' ', 1, 9914, 1, 0, '', 0, 22504) ;

CALL ImportField(991411008, 'Тип пакета', 'DataPacketType', 'Тип пакета', ' ', 1, 9914, 1, 1, '', 0, 22501) ;

-- Открытие операционного дня, Бюджет(1)
CALL ImportField(991510002, 'Примечание', 'Note', 'Примечание', 'Note', 1, 9915, 0, 0, '', 0, 25374) ;

CALL ImportField(991510003, 'Открыть день', 'UnLock', 'Открыть день', 'UnLock', 1, 9915, 0, 0, '', 0, 25376) ;

CALL ImportField(991510004, 'Дата', 'UnLockDate', 'Дата', 'UnLockDate', 1, 9915, 0, 0, '', 0, 25377) ;

CALL ImportField(991511002, 'Примечание', 'Note', 'Примечание', ' ', 1, 9915, 1, 0, '', 0, 25374) ;

CALL ImportField(991511003, 'Разрешить', 'UnLock', 'Разрешить', ' ', 1, 9915, 1, 0, '', 0, 25376) ;

CALL ImportField(991511004, 'Дата', 'UnLockDate', 'Дата', ' ', 1, 9915, 1, 0, '', 0, 25377) ;

CALL ImportField(991511005, '№', 'JNumber', '№', 'JNumber', 1, 9915, 1, 0, '', 0, 25372) ;

-- Константы казначейства, Бюджет(1)
CALL ImportField(991710027, 'Код причины отклонения для неверной ЭЦП', 'КодПричиныОтклоненияДляНевернойЭЦП', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(1000, 102, 3, 'Код причины отклонения для неверной ЭЦП', '', 0, 10500) ;

CALL ImportField(991710028, 'Настройка ведения интерфейсов "Утверждение ОФ", "Распределение ОФ"\Разрешать использовать нефедеральные л/с на и/ф "Утверждение ОФ" и "Распределение ОФ"', 'РазрешатьИспользоватьНеФедеральныеЛСНаИнтерфейсахУтверждениеОФиРаспределениеОФ', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 36, 3, 'Настройка ведения интерфейсов "Утверждение ОФ", "Распределение ОФ"\Разрешать использовать нефедеральные л/с на и/ф "Утверждение ОФ" и "Распределение ОФ"', '', 0, 0) ;

CALL ImportField(991710032, 'Ведение л/счета по переданным полномочиям', 'ВедениеЛСПоПереданнымПолномочиям', '', ' ', 1, 9917, 0, 1, '', 0, null) ;

CALL InsertConst(30, 42, 3, 'Ведение л/счета по переданным полномочиям', '', 0, 0) ;

-- Генераторы, Бюджет(1)
CALL ImportField(991810001, 'Значение', 'GenValue', 'Значение', ' ', 1, 9918, 0, 0, '', 0, 22541) ;

CALL ImportField(991810002, 'Верхнее значение', 'GenValueMax', 'Верхнее значение', ' ', 1, 9918, 0, 0, '', 0, 22543) ;

CALL ImportField(991810003, 'Нижнее значение', 'GenValueMin', 'Нижнее значение', ' ', 1, 9918, 0, 0, '', 0, 22542) ;

CALL ImportField(991810004, 'Отключить блокировку', 'LockId', 'Отключить блокировку', ' ', 1, 9918, 0, 0, '', 0, 22544) ;

CALL ImportField(991810005, 'Наименование генератора (список критериев)', 'Name', 'Наименование генератора (список критериев)', ' ', 1, 9918, 0, 0, '', 0, 22540) ;

CALL ImportField(991810006, 'Примечание', 'Note', 'Примечание', ' ', 1, 9918, 0, 0, '', 0, 22546) ;

CALL ImportField(991811001, 'Детализация', 'DetailNum', 'Детализация', ' ', 1, 9918, 1, 0, '', 0, 22551) ;

CALL ImportField(991811002, 'Код документа', 'DocRef', 'Код документа', ' ', 1, 9918, 1, 0, '', 0, 22550) ;

CALL ImportField(991811003, 'Имя поля', 'FieldName', 'Имя поля', ' ', 1, 9918, 1, 0, '', 0, 22552) ;

CALL ImportField(991811004, 'Формат', 'Format', 'Формат', ' ', 1, 9918, 1, 0, '', 0, 22553) ;

CALL ImportField(991811005, 'Время генерации', 'GenPosition', 'Время генерации', ' ', 1, 9918, 1, 0, '', 0, 22557) ;

CALL ImportField(991811006, 'Недопустимые значения', 'RejectExp', 'Недопустимые значения', ' ', 1, 9918, 1, 0, '', 0, 22554) ;

CALL ImportField(991811007, 'Использовать пропущенные номера', 'SetOf', 'Использовать пропущенные номера', ' ', 1, 9918, 1, 0, '', 0, 22555) ;

CALL ImportField(991811008, 'Приращение', 'Step', 'Приращение', ' ', 1, 9918, 1, 0, '', 0, 22556) ;

-- Редактор справочника операций , Бюджет(1)
CALL ImportField(992010001, 'Дата закрытия', 'DeleteDate', '', ' ', 1, 9920, 0, 0, '', 0, 26747) ;

CALL ImportField(992010002, 'Код операции', 'Id', '', ' ', 1, 9920, 0, 0, '', 0, 21635) ;

CALL ImportField(992010003, 'Содержание операции', 'Name', '', ' ', 1, 9920, 0, 0, '', 0, 21636) ;

CALL ImportField(992010004, 'Дата вступления в действие', 'StartDate', '', ' ', 1, 9920, 0, 0, '', 0, 26748) ;

CALL ImportField(992011001, 'Наименование обратной проводки', 'BackName', '', ' ', 1, 9920, 1, 0, '', 0, 21662) ;

CALL ImportField(992011002, 'Баланс', 'BalanceName', '', ' ', 1, 9920, 1, 0, '', 0, 21642) ;

CALL ImportField(992011003, 'Инверсия знака суммы проводки', 'CorrectionFlag', '', ' ', 1, 9920, 1, 0, '', 0, 21663) ;

CALL ImportField(992011004, 'Счет кредита', 'Credit', '', ' ', 1, 9920, 1, 0, '', 0, null) ;

CALL ImportField(992011005, 'Источник БК кредита', 'CreditBudClsKind', '', ' ', 1, 9920, 1, 0, '', 0, 21658) ;

CALL ImportField(992011006, 'Счет дебета', 'Debit', '', ' ', 1, 9920, 1, 0, '', 0, null) ;

CALL ImportField(992011007, 'Источник БК дебета ', 'DebitBudClsKind', '', ' ', 1, 9920, 1, 0, '', 0, 21657) ;

CALL ImportField(992011008, 'Источник вида деятельности', 'HeadActivityKind', '', ' ', 1, 9920, 1, 0, '', 0, 24703) ;

CALL ImportField(992011009, 'Наименование проводки', 'Name', '', ' ', 1, 9920, 1, 0, '', 0, 21661) ;

-- Редактор справочника бюджетов, Бюджет(1)
CALL ImportField(992110001, 'Уровень бюджета', 'BUDGETLEVEL', '', ' ', 1, 9921, 0, 0, '', 0, 24689) ;

CALL ImportField(992110002, 'ФИО руководителя', 'ChiefName', '', ' ', 1, 9921, 0, 0, '', 0, 26543) ;

CALL ImportField(992110003, 'Должность руководителя', 'ChiefRole', '', ' ', 1, 9921, 0, 0, '', 0, 26544) ;

CALL ImportField(992110004, 'ОКАТО (с уточнением)', 'FullOKATO', '', ' ', 1, 9921, 0, 0, '', 0, null) ;

CALL ImportField(992110005, 'Код бюджета', 'ID', '', ' ', 1, 9921, 0, 0, '', 0, 16804) ;

CALL ImportField(992110006, 'Наименование', 'NAME', '', ' ', 1, 9921, 0, 0, '', 0, 16805) ;

CALL ImportField(992110007, 'Полное наименование', 'NOTE', '', ' ', 1, 9921, 0, 0, '', 0, 16808) ;

CALL ImportField(992110008, 'Год', 'YEAR', '', ' ', 1, 9921, 0, 0, '', 0, null) ;

CALL ImportField(992111001, 'Номер изв. о закр.', 'CloseDocNumber', '', ' ', 1, 9921, 1, 0, 'НомерИзвещенияЗакрытия', 0, 17157) ;

CALL ImportField(992111002, 'Дата закрытия', 'DATECLOSE', '', ' ', 1, 9921, 1, 0, 'ДатаЗакрытияЛС', 0, 17144) ;

CALL ImportField(992111003, 'Дата открытия', 'DATEOPEN', '', ' ', 1, 9921, 1, 0, 'ДатаОткрытияЛС', 0, 17143) ;

CALL ImportField(992111004, 'Куратор лицевого счёта', 'DEPARTMENT', '', ' ', 1, 9921, 1, 0, 'КураторЛС', 0, 17154) ;

CALL ImportField(992111005, 'Мнемокод', 'FacialCode', '', ' ', 1, 9921, 1, 0, 'МнемоКодЛС', 0, 17149) ;

CALL ImportField(992111006, 'Тип фин.', 'FINTYPE', '', ' ', 1, 9921, 1, 0, 'ТипФинансирования', 0, 17141) ;

CALL ImportField(992111007, 'ИНН(Распорядитель)', 'GeneralOrg_INN', '', ' ', 1, 9921, 1, 0, '', 0, 16645) ;

CALL ImportField(992111008, 'КПП(Распорядитель)', 'GeneralOrg_KPP', '', ' ', 1, 9921, 1, 0, '', 0, 16653) ;

CALL ImportField(992111009, 'Распорядитель', 'GeneralOrg_Name', '', ' ', 1, 9921, 1, 0, '', 0, 16646) ;

CALL ImportField(992111010, 'Распорядитель л\с', 'GeneralOrg_Ref', '', ' ', 1, 9921, 1, 1, 'РаспорядительЛС', 0, 17152) ;

CALL ImportField(992111011, 'Характер л\с', 'HARACTERACCOUNT', '', ' ', 1, 9921, 1, 1, 'ХарактерCчетаЛС', 0, 17147) ;

CALL ImportField(992111012, 'Характер счёта', 'HARACTERACCOUNTSTR', '', ' ', 1, 9921, 1, 0, '', 0, null) ;

CALL ImportField(992111013, 'ИНН(Вышестоящая организация)', 'HigherOrg_INN', '', ' ', 1, 9921, 1, 0, '', 0, 16645) ;

CALL ImportField(992111014, 'КПП(Вышестоящая организация)', 'HigherOrg_KPP', '', ' ', 1, 9921, 1, 0, '', 0, 16653) ;

CALL ImportField(992111015, 'Вышестоящая организация', 'HigherOrg_Name', '', ' ', 1, 9921, 1, 0, '', 0, 16646) ;

CALL ImportField(992111016, 'Вышестоящая организация л\с', 'HigherOrg_Ref', '', ' ', 1, 9921, 1, 1, 'ВышестоящаяОрганизацияЛС', 0, 17158) ;

CALL ImportField(992111017, 'Код', 'ID', '', ' ', 1, 9921, 1, 0, 'Код', 0, 17130) ;

CALL ImportField(992111018, 'ИНН(Организация)', 'INN', '', ' ', 1, 9921, 1, 0, 'ИНН', 0, 16645) ;

CALL ImportField(992111019, 'КЦСРКлюч', 'KCSR', '', ' ', 1, 9921, 1, 1, 'КЦСР', 0, 17137) ;

CALL ImportField(992111021, 'ЭКР', 'KESR', '', ' ', 1, 9921, 1, 0, 'КЭСР', 0, 17140) ;

CALL ImportField(992111022, 'ФКР', 'KFSR', '', ' ', 1, 9921, 1, 0, 'КФСР', 0, 17138) ;

CALL ImportField(992111023, 'КПП(Организация)', 'KPP', '', ' ', 1, 9921, 1, 0, 'КПП', 0, 16653) ;

CALL ImportField(992111024, 'КВРКлюч', 'KVR', '', ' ', 1, 9921, 1, 1, 'КВР', 0, 17139) ;

CALL ImportField(992111026, 'КВСРКлюч', 'KVSR', '', ' ', 1, 9921, 1, 1, 'КВСР', 0, 17136) ;

CALL ImportField(992111028, 'Тип средств', 'MeansType', '', ' ', 1, 9921, 1, 0, 'ТипСредств', 0, 17153) ;

CALL ImportField(992111029, 'Описание', 'NAME', '', ' ', 1, 9921, 1, 0, 'Наименование', 0, 17135) ;

CALL ImportField(992111030, 'Номер изв. об откр.', 'OpenDocNumber', '', ' ', 1, 9921, 1, 0, 'НомерИзвещенияОткрытия', 0, 17156) ;

CALL ImportField(992111031, 'Организация л\с', 'ORG_REF', '', ' ', 1, 9921, 1, 1, 'ОрганизацияЛС', 0, 17142) ;

CALL ImportField(992111032, 'Организация', 'OrgName', '', ' ', 1, 9921, 1, 0, 'Имя', 0, 16646) ;

CALL ImportField(992111033, 'Район', 'RegionCls', '', ' ', 1, 9921, 1, 0, 'Регион', 0, 17148) ;

CALL ImportField(992111034, 'Признак служебного л/с', 'SERVICEACCOUNT', '', ' ', 1, 9921, 1, 1, 'СлужебныйЛС', 0, 17145) ;

CALL ImportField(992111035, 'Признак служебного л/c', 'SERVICEACCOUNTSTR', '', ' ', 1, 9921, 1, 0, '', 0, null) ;

CALL ImportField(992111036, 'Статус л\с', 'STATUSACCOUNT', '', ' ', 1, 9921, 1, 1, 'СтатусСчетаЛС', 0, 17146) ;

CALL ImportField(992111037, 'Состояние счёта', 'STATUSACCOUNTSTR', '', ' ', 1, 9921, 1, 0, '', 0, null) ;

CALL ImportField(992112001, 'Принадлежность', 'ACCMODE', '', ' ', 1, 9921, 2, 0, '', 0, 17269) ;

CALL ImportField(992112002, 'Синтетический счет бухгалтерии', 'BUHACC', '', ' ', 1, 9921, 2, 0, '', 0, 17268) ;

CALL ImportField(992112003, 'Валюта', 'CurrencyCls', '', ' ', 1, 9921, 2, 0, '', 0, 17273) ;

CALL ImportField(992112004, 'Код счета для ФО', 'FinOrgBuhAcc', '', ' ', 1, 9921, 2, 0, '', 0, 21629) ;

CALL ImportField(992112005, 'Тип', 'FIXED', '', ' ', 1, 9921, 2, 0, '', 0, 17270) ;

CALL ImportField(992112006, 'Источники внутреннего и внешнего финансирования', 'FSFULLID', '', ' ', 1, 9921, 2, 0, '', 0, 17055) ;

CALL ImportField(992112007, 'Счет', 'ID', '', ' ', 1, 9921, 2, 1, 'СчетОрганизации', 0, 17109) ;

CALL ImportField(992112008, 'Единый', 'isCommon', '', ' ', 1, 9921, 2, 0, '', 0, 17278) ;

CALL ImportField(992112009, 'Бюджетный(Вид использования)', 'isForBudget', '', ' ', 1, 9921, 2, 0, '', 0, 17279) ;

CALL ImportField(992112010, 'Предпринимательский(Вид использования)', 'isForBusiness', '', ' ', 1, 9921, 2, 0, '', 0, 17280) ;

CALL ImportField(992112011, 'Для наличности', 'isForCash', '', ' ', 1, 9921, 2, 0, '', 0, 17282) ;

CALL ImportField(992112012, 'Для СВР(Вид использования)', 'isForTemporary', '', ' ', 1, 9921, 2, 0, '', 0, 17281) ;

CALL ImportField(992112013, 'Код счета для казначейства', 'TreasuryBuhAcc', '', ' ', 1, 9921, 2, 0, '', 0, 21629) ;

-- Категории архивных документов, Бюджет(1)
CALL ImportField(992210001, 'Дата начала действия', 'BeginDate', '', ' ', 1, 9922, 0, 0, '', 0, 30683) ;

CALL ImportField(992210002, 'Код', 'Code', '', ' ', 1, 9922, 0, 0, '', 0, 30684) ;

CALL ImportField(992210003, 'Макрос ограничений', 'ConstraintScriptName', '', ' ', 1, 9922, 0, 0, '', 0, 30685) ;

CALL ImportField(992210004, 'Макрос формирования', 'CreatingScriptName', '', ' ', 1, 9922, 0, 0, '', 0, 30688) ;

CALL ImportField(992210005, 'Удаление(отклонение) неопубликованных(Права)', 'DeleteRight', '', ' ', 1, 9922, 0, 0, '', 0, null) ;

CALL ImportField(992210006, 'Опубликование(Права)', 'EditRight', '', ' ', 1, 9922, 0, 0, '', 0, null) ;

CALL ImportField(992210007, 'Дата окончания действия', 'EndDate', '', ' ', 1, 9922, 0, 0, '', 0, 30689) ;

CALL ImportField(992210008, 'Добавление(Права)', 'InsertRight', '', ' ', 1, 9922, 0, 0, '', 0, null) ;

CALL ImportField(992210009, 'Название', 'Name', '', ' ', 1, 9922, 0, 0, '', 0, 30691) ;

CALL ImportField(992210010, 'Периодичность', 'PeriodType', '', ' ', 1, 9922, 0, 0, '', 0, 30692) ;

CALL ImportField(992210011, 'Просмотр(Права)', 'ReadRight', '', ' ', 1, 9922, 0, 0, '', 0, null) ;

CALL ImportField(992210012, 'Тип документа', 'SectionTypeLookup', '', ' ', 1, 9922, 0, 0, '', 0, null) ;

CALL ImportField(992210013, 'Схема подписания', 'SignSchemeLookup', '', ' ', 1, 9922, 0, 0, '', 0, null) ;

CALL ImportField(992210014, 'Код бланка', 'TemplateCode', '', ' ', 1, 9922, 0, 0, '', 0, 30694) ;

CALL ImportField(992210015, 'Вид категории', 'TemplateType', '', ' ', 1, 9922, 0, 0, '', 0, 30695) ;

CALL ImportField(992210016, 'Просмотр чужих неопубликованных(Права)', 'ViewOtherRight', '', ' ', 1, 9922, 0, 0, '', 0, null) ;

CALL ImportField(992210017, 'Имя динамической настройки', 'DynSetName', '', ' ', 1, 9922, 0, 0, '', 0, 31628) ;

CALL ImportField(992210018, 'Разрешить добавлять из файла', 'EnabledImportKinds', '', ' ', 1, 9922, 0, 0, '', 0, 31084) ;

CALL ImportField(992210019, 'Настройки параметров ограничений', 'LimitParams', '', ' ', 1, 9922, 0, 0, '', 0, 31629) ;

CALL ImportField(992210020, 'Хранить по ссылке', 'StoreToLink', '', ' ', 1, 9922, 0, 0, '', 0, 31630) ;

CALL ImportField(992211001, 'Закрытый', 'ClosedAttr', '', ' ', 1, 9922, 1, 0, '', 0, 30661) ;

CALL ImportField(992211002, 'Тип классификатора', 'ClsType', '', ' ', 1, 9922, 1, 0, '', 0, 30662) ;

CALL ImportField(992211003, 'Фиксированный', 'FixedAttr', '', ' ', 1, 9922, 1, 0, '', 0, null) ;

CALL ImportField(992211004, 'Группа', 'GroupName', '', ' ', 1, 9922, 1, 0, '', 0, 30666) ;

CALL ImportField(992211005, 'Скрытый', 'HiddenAttr', '', ' ', 1, 9922, 1, 0, '', 0, 30667) ;

CALL ImportField(992211006, 'Подсказка', 'Hint', '', ' ', 1, 9922, 1, 0, '', 0, 30668) ;

CALL ImportField(992211007, 'Ключевой', 'KeyAttr', '', ' ', 1, 9922, 1, 0, '', 0, 30670) ;

CALL ImportField(992211008, 'Имя', 'Name', '', ' ', 1, 9922, 1, 0, '', 0, 30671) ;

CALL ImportField(992211009, 'Примечание', 'Note', '', ' ', 1, 9922, 1, 0, '', 0, 30672) ;

CALL ImportField(992211010, 'Порядок', 'ParamOrder', '', ' ', 1, 9922, 1, 0, '', 0, 30673) ;

CALL ImportField(992211011, 'Размер', 'ParamSize', '', ' ', 1, 9922, 1, 0, '', 0, 30674) ;

CALL ImportField(992211012, 'Тип атрибута', 'ParamType', '', ' ', 1, 9922, 1, 0, '', 0, 30675) ;

CALL ImportField(992211013, 'Выпадающий список', 'PickList', '', ' ', 1, 9922, 1, 0, '', 0, 30676) ;

CALL ImportField(992211014, 'Только для чтения', 'ReadOnlyAttr', '', ' ', 1, 9922, 1, 0, '', 0, 30677) ;

CALL ImportField(992211015, 'Обязательный', 'RequiredAttr', '', ' ', 1, 9922, 1, 0, '', 0, 30679) ;

CALL ImportField(992211016, 'Имя в БД', 'StorageName', '', ' ', 1, 9922, 1, 0, '', 0, 30680) ;

CALL ImportField(992211017, 'Постоянное значение', 'ValueAttr', '', ' ', 1, 9922, 1, 0, '', 0, 31083) ;

CALL ImportField(992211018, 'Запрет мультивыбора', 'BanMltAttr', '', ' ', 1, 9922, 1, 0, '', 0, 31626) ;

CALL ImportField(992211019, 'Источник значения', 'MappingAttr', '', ' ', 1, 9922, 1, 0, '', 0, 31627) ;

-- Редактор схем подписания, Бюджет(1)
CALL ImportField(992310001, 'Дата окончания подписания', 'CloseDate', '', ' ', 1, 9923, 0, 0, '', 0, 30755) ;

CALL ImportField(992310002, 'Наименование схемы', 'Name', '', ' ', 1, 9923, 0, 0, '', 0, 30762) ;

CALL ImportField(992310003, 'Примечание', 'Note', '', ' ', 1, 9923, 0, 0, '', 0, 30763) ;

CALL ImportField(992310004, 'UseSignCount', 'UseSignCount', '', ' ', 1, 9923, 0, 1, '', 0, null) ;

CALL ImportField(992311001, 'Действие', 'ActionRef', '', ' ', 1, 9923, 1, 0, '', 0, null) ;

CALL ImportField(992311002, 'Фиктивная', 'FICTIVESIGN', '', ' ', 1, 9923, 1, 0, '', 0, null) ;

CALL ImportField(992311004, 'Наименование подписи', 'SignRefLookup', '', ' ', 1, 9923, 1, 0, '', 0, null) ;

-- Редактор справочника ролей, Бюджет(1)
CALL ImportField(992410001, 'Наименование', 'Name', '', ' ', 1, 9924, 0, 0, '', 0, 30751) ;

-- Редактор пластиковых карт, Бюджет(1)
CALL ImportField(992510001, 'Казначейский счет', 'ACC', '', ' ', 1, 9925, 0, 0, 'Имя', 0, 17112) ;

CALL ImportField(992510002, 'Дата выпуска карты банком', 'BankCreateDate', '', ' ', 1, 9925, 0, 0, '', 0, 31642) ;

CALL ImportField(992510003, 'Дата возврата карты в банк', 'BankReturnDate', '', ' ', 1, 9925, 0, 0, '', 0, 31643) ;

CALL ImportField(992510004, 'Номер карты', 'CARDNUMBER', '', ' ', 1, 9925, 0, 0, '', 0, 18939) ;

CALL ImportField(992510005, 'Клиент', 'Client', '', ' ', 1, 9925, 0, 0, '', 0, null) ;

CALL ImportField(992510006, 'ИНН(Клиент)', 'ClientINN', '', ' ', 1, 9925, 0, 0, 'ИНН', 0, 16645) ;

CALL ImportField(992510007, 'КПП(Клиент)', 'ClientKPP', '', ' ', 1, 9925, 0, 0, 'КПП', 0, 16653) ;

CALL ImportField(992510008, 'Наименование(Клиент)', 'ClientName', '', ' ', 1, 9925, 0, 0, 'Имя', 0, 16646) ;

CALL ImportField(992510009, 'Дата выдачи карты клиенту', 'ClientReceiveDate', '', ' ', 1, 9925, 0, 0, '', 0, 31645) ;

CALL ImportField(992510010, 'Дата возврата карты клиентом', 'ClientReturnDate', '', ' ', 1, 9925, 0, 0, '', 0, 31646) ;

CALL ImportField(992510011, 'Примечание', 'COMMENT', '', ' ', 1, 9925, 0, 0, '', 0, null) ;

CALL ImportField(992510012, 'ФИО Ответственного сотрудника клиента', 'EmployeeName', '', ' ', 1, 9925, 0, 0, '', 0, 31648) ;

CALL ImportField(992510013, 'Полный номер карты', 'FullCardNumber', '', ' ', 1, 9925, 0, 0, '', 0, 31649) ;

CALL ImportField(992510014, 'Дата заявления(Заявление на получение карт)', 'Request_Date', '', ' ', 1, 9925, 0, 0, '', 0, 31650) ;

CALL ImportField(992510015, 'Номер заявления(Заявление на получение карт)', 'Request_Number', '', ' ', 1, 9925, 0, 0, '', 0, 31651) ;

CALL ImportField(992511001, 'Лицевой счет', 'FACIALACC_CLS', '', ' ', 1, 9925, 1, 0, '', 0, 22619) ;

CALL ImportField(992512001, 'ЭКР', 'KESR', '', ' ', 1, 9925, 2, 0, '', 0, 22627) ;

-- Редактор справочника типов уведомлений, Бюджет(1)
CALL ImportField(992610001, 'Код записи', 'IdCode', 'Код записи', 'IdCode', 1, 9926, 0, 0, '', 0, 31875) ;

CALL ImportField(992610002, 'Наименование', 'NAME', 'Наименование уведомления', 'NAME', 1, 9926, 0, 0, '', 0, 31876) ;

CALL ImportField(992610003, 'Сокращенное наименование', 'SHORTNAME', 'Краткое наименование уведомления', 'SHORTNAME', 1, 9926, 0, 0, '', 0, 31878) ;

CALL ImportField(992610004, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 9926, 0, 0, '', 0, 31877) ;

CALL ImportField(992610005, 'Используется в системе состояний', 'StateFilter', 'Используется в системе состояний', 'StateFilter', 1, 9926, 0, 0, '', 0, 31879) ;

CALL ImportField(992611001, 'Код записи', 'ID', 'Код записи', 'ID', 1, 9926, 1, 1, '', 0, null) ;

CALL ImportField(992611002, 'Код документа', 'RECORDINDEX', 'Ссылка на заголовок', 'RECORDINDEX', 1, 9926, 1, 1, '', 0, null) ;

CALL ImportField(992611003, 'Тип уведомления', 'NOTIFYCLSPART', 'Ссылка на поле - атрибут данного типа уведомления', 'NOTIFYCLSPART', 1, 9926, 1, 0, '', 0, 31886) ;

CALL ImportField(992611004, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 9926, 1, 0, '', 0, 31885) ;

CALL ImportField(992611005, 'Системный', 'IsSystem', 'Системный аттрибут уведомления', 'IsSystem', 1, 9926, 1, 0, '', 0, null) ;

CALL ImportField(992612001, 'Код записи', 'ID', 'Код записи', 'ID', 1, 9926, 2, 1, '', 0, null) ;

CALL ImportField(992612002, 'Имя поля', 'NAME', 'Имя поля', 'NAME', 1, 9926, 2, 0, '', 0, null) ;

CALL ImportField(992612003, 'Короткое имя поля', 'SHORTNAME', 'Короткое имя поля', 'SHORTNAME', 1, 9926, 2, 0, '', 0, null) ;

CALL ImportField(992612004, 'Тип поля', 'NOTIFY_FIELDTYPE', 'Тип поля: 0 - целое; 1 - строка(255); 2 - дробное; 3 - дата', 'NOTIFY_FIELDTYPE', 1, 9926, 2, 0, '', 0, null) ;

CALL ImportField(992612005, 'Примечание', 'NOTE', 'Примечание', 'NOTE', 1, 9926, 2, 0, '', 0, null) ;

CALL ImportField(992612006, 'Классификатор справочника', 'HandbookId', 'Классификатор справочника ', 'HandbookId', 1, 9926, 2, 0, '', 0, null) ;

DROP PROCEDURE ImportField
/

/* Начальное заполнение ссылки на страницу поля*/
ALTER TRIGGER TR_DOCUMENTFIELDS_BU_500 DISABLE
/

Update TB_DocumentFields df
set documentcls=doctyperef*100+detailnumber
where (detailnumber<100)and(documentcls is null)
 and(exists(select dc.id from documentcls dc where id=df.doctyperef*100+df.detailnumber))
/

ALTER TRIGGER TR_DOCUMENTFIELDS_BU_500 ENABLE
/

DROP PROCEDURE DeleteFields
/

DROP PROCEDURE InsertConst
/

-- Запись информации о скрипте в журнал
INSERT INTO DFUCHANGELOG (VersionID, BEGINUPDATECODE, ENDUPDATECODE, LASTUPDATEDFU, ISBUDGET, INCLUDEDEL, INCLUDEBLOCKS, INCLUDEDOCS, SCRIPTCREATOR, SCRIPTCREATEDATE, NOTE) VALUES (644, 60500, 80000, TO_DATE('05.12.2014 16:52:31', 'DD.MM.YYYY HH24:MI:SS'), 2, 1, 'Поля', '00.00, 01.01, 02.00, 02.01, 02.02, 02.03, 02.04, 02.05, 02.06, 02.07, 02.08, 02.09, 02.10, 02.11, 02.12, 03.00, 03.01, 03.02, 03.03, 03.04, 03.05, 03.06, 03.07, 03.08, 03.11, 03.12, 03.14, 03.15, 03.16, 03.22, 03.23, 03.24, 04.01, 05.01, 07.01, 07.02, 07.03, 08.01, 08.02, 08.03, 08.04, 09.00, 09.01, 09.02, 09.03, 09.05, 09.06, 09.07, 12.01, 15.01, 16.01, 16.02, 17.01, 17.02, 18.05, 18.07, 18.10, 18.12, 18.13, 18.14, 18.15, 18.16, 19.00, 19.01, 19.02, 19.03, 19.06, 22.00, 22.01, 25.01, 25.02, 25.03, 25.04, 28.01, 28.02, 30.01, 30.03, 30.06, 36.10, 37.01, 39.01, 44.01, 44.03, 48.01, 49.01, 49.02, 49.03, 52.01, 55.01, 55.02, 55.03, 96.01, 96.02, 96.03, 96.04, 98.02, 98.03, 98.04, 98.05, 98.06, 98.08, 98.09, 98.10, 98.11, 98.12, 98.13, 98.14, 98.15, 98.16, 98.17, 98.18, 98.20, 98.21, 98.22, 98.23, 98.26, 98.27, 98.28, 98.29, 98.34, 98.35, 98.41, 98.42, 98.43, 98.44, 98.45, 98.46, 98.47, 98.48, 98.49, 98.50, 98.51, 98.52, 98.53, 98.57, 98.58, 98.59, 98.60, 98.61, 98.62, 98.63, 98.64, 98.65, 98.67, 98.68, 98.69, 98.70, 98.71, 98.72, 98.78, 98.79, 98.80, 98.81, 98.82, 98.83, 98.84, 98.85, 98.86, 98.87, 98.88, 98.89, 98.90, 98.91, 98.92, 98.94, 98.95, 98.99, 99.03, 99.04, 99.05, 99.08, 99.12, 99.13, 99.14, 99.15, 99.16, 99.17, 99.18, 99.19, 99.20, 99.21, 99.22, 99.23, 99.24, 99.25, 99.26, 99.27, 99.28', 'ZIMIN-NEW/zimin', TO_DATE('09.12.2014 12:5:23', 'DD.MM.YYYY HH24:MI:SS'), '') ;

COMMIT WORK
/



-- #########################################################
-- #########################################################
-- Add_LayerTables_Triggers.sql
-- #########################################################
-- #########################################################

-- CREATE TRIGGER TR_LAYERTABLES_BI
CREATE OR REPLACE TRIGGER TR_LAYERTABLES_BI
  BEFORE INSERT
  ON LAYERTABLES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_LAYERTABLES_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_LAYERTABLES_BI_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLES_BI
  BEFORE INSERT
  ON LAYERTABLES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_LAYERTABLES_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_LAYERTABLES_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := USER;
  :new.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_LAYERTABLES_BU_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLES_BU_500
  BEFORE UPDATE
  ON LAYERTABLES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_LAYERTABLES_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdateDate := SYSDATE;
  :new.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_LAYERTABLES_AD_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLES_AD
  AFTER DELETE
  ON LAYERTABLES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_LAYERTABLES_AD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (240, :old.ID, SYSDATE) ;

END;
/
-- CREATE TRIGGER TR_LAYERTABLES_AI_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLES_AI
  AFTER INSERT
  ON LAYERTABLES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_LAYERTABLES_AI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 240) and (RecordID = :new.ID);

END;
/
-- CREATE TRIGGER TR_LAYERTABLES_AU_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLES_AU
  AFTER UPDATE
  ON LAYERTABLES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (TR_LAYERTABLES_AU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID<>:old.ID) THEN
    INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate) VALUES (240, :old.ID, SYSDATE);
    DELETE FROM DelRecIndexes WHERE (TableID=240) AND (RecordId=:new.ID);
      
  END IF;

END;
/
-- CREATE TRIGGER TR_LAYERTABLES_BD
CREATE OR REPLACE TRIGGER TR_LAYERTABLES_BD
  BEFORE DELETE
  ON LAYERTABLES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_LAYERTABLES_BD)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  DELETE FROM LAYERTABLESFIELDS WHERE (TableID = :old.ID);
  DELETE FROM LAYERTABLESTRIGGERS WHERE (TableID = :old.ID);
  DELETE FROM LAYERTABLESIDX WHERE (TableID = :old.ID);
  DELETE FROM LAYERTABLESFK WHERE (TableID = :old.ID);

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFIELDS_BI
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFIELDS_BI
  BEFORE INSERT
  ON LAYERTABLESFIELDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_LAYERTABLESFIELDS_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFIELDS_BI_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFIELDS_BI
  BEFORE INSERT
  ON LAYERTABLESFIELDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_LAYERTABLESFIELDS_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_LAYERTABLESFIELDS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := USER;
  :new.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFIELDS_BU
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFIELDS_BU
  BEFORE UPDATE
  ON LAYERTABLESFIELDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_LAYERTABLESFIELDS_BU)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  NULL;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFIELDS_BU_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFIELDS_BU_500
  BEFORE UPDATE
  ON LAYERTABLESFIELDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_LAYERTABLESFIELDS_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdateDate := SYSDATE;
  :new.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFIELDS_AD_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFIELDS_AD
  AFTER DELETE
  ON LAYERTABLESFIELDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_LAYERTABLESFIELDS_AD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (241, :old.ID, SYSDATE) ;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFIELDS_AI_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFIELDS_AI
  AFTER INSERT
  ON LAYERTABLESFIELDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_LAYERTABLESFIELDS_AI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 241) and (RecordID = :new.ID);

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFIELDS_AU_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFIELDS_AU
  AFTER UPDATE
  ON LAYERTABLESFIELDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (TR_LAYERTABLESFIELDS_AU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID<>:old.ID) THEN
    INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate) VALUES (241, :old.ID, SYSDATE);
    DELETE FROM DelRecIndexes WHERE (TableID=241) AND (RecordId=:new.ID);
      
  END IF;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESTRIGGERS_BI
CREATE OR REPLACE TRIGGER TR_LAYERTABLESTRIGGERS_BI
  BEFORE INSERT
  ON LAYERTABLESTRIGGERS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_LAYERTABLESTRIGGERS_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESTRIGGERS_BI_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESTRIGGERS_BI
  BEFORE INSERT
  ON LAYERTABLESTRIGGERS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_LAYERTABLESTRIGGERS_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_LAYERTABLESTRIGGERS_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := USER;
  :new.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESTRIGGERS_BU_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESTRIGGERS_BU_500
  BEFORE UPDATE
  ON LAYERTABLESTRIGGERS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_LAYERTABLESTRIGGERS_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdateDate := SYSDATE;
  :new.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESTRIGGERS_AD_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESTRIGGERS_AD
  AFTER DELETE
  ON LAYERTABLESTRIGGERS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_LAYERTABLESTRIGGERS_AD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (242, :old.ID, SYSDATE) ;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESTRIGGERS_AI_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESTRIGGERS_AI
  AFTER INSERT
  ON LAYERTABLESTRIGGERS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_LAYERTABLESTRIGGERS_AI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 242) and (RecordID = :new.ID);

END;
/
-- CREATE TRIGGER TR_LAYERTABLESTRIGGERS_AU_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESTRIGGERS_AU
  AFTER UPDATE
  ON LAYERTABLESTRIGGERS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (TR_LAYERTABLESTRIGGERS_AU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID<>:old.ID) THEN
    INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate) VALUES (242, :old.ID, SYSDATE);
    DELETE FROM DelRecIndexes WHERE (TableID=242) AND (RecordId=:new.ID);
      
  END IF;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESIDX_BI
CREATE OR REPLACE TRIGGER TR_LAYERTABLESIDX_BI
  BEFORE INSERT
  ON LAYERTABLESIDX
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_LAYERTABLESIDX_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESIDX_BI_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESIDX_BI
  BEFORE INSERT
  ON LAYERTABLESIDX
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_LAYERTABLESIDX_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_LAYERTABLESIDX_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := USER;
  :new.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESIDX_BU_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESIDX_BU_500
  BEFORE UPDATE
  ON LAYERTABLESIDX
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_LAYERTABLESIDX_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdateDate := SYSDATE;
  :new.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESIDX_AD_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESIDX_AD
  AFTER DELETE
  ON LAYERTABLESIDX
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_LAYERTABLESIDX_AD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (243, :old.ID, SYSDATE) ;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESIDX_AI_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESIDX_AI
  AFTER INSERT
  ON LAYERTABLESIDX
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_LAYERTABLESIDX_AI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 243) and (RecordID = :new.ID);

END;
/
-- CREATE TRIGGER TR_LAYERTABLESIDX_AU_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESIDX_AU
  AFTER UPDATE
  ON LAYERTABLESIDX
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (TR_LAYERTABLESIDX_AU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID<>:old.ID) THEN
    INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate) VALUES (243, :old.ID, SYSDATE);
    DELETE FROM DelRecIndexes WHERE (TableID=243) AND (RecordId=:new.ID);
      
  END IF;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFK_BI
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFK_BI
  BEFORE INSERT
  ON LAYERTABLESFK
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_LAYERTABLESFK_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFK_BI_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFK_BI
  BEFORE INSERT
  ON LAYERTABLESFK
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_LAYERTABLESFK_BI)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.id IS NULL) THEN 
    select g_shared.nextval into :new.id from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_LAYERTABLESFK_BI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.CreateDate := SYSDATE;
  :new.UpdateDate := :new.CreateDate;
  :new.CreaterUser := USER;
  :new.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFK_BU_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFK_BU_500
  BEFORE UPDATE
  ON LAYERTABLESFK
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_LAYERTABLESFK_BU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  :new.UpdateDate := SYSDATE;
  :new.UpdaterUser := USER;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFK_AD_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFK_AD
  AFTER DELETE
  ON LAYERTABLESFK
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_LAYERTABLESFK_AD_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (244, :old.ID, SYSDATE) ;

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFK_AI_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFK_AI
  AFTER INSERT
  ON LAYERTABLESFK
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_LAYERTABLESFK_AI_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 244) and (RecordID = :new.ID);

END;
/
-- CREATE TRIGGER TR_LAYERTABLESFK_AU_500
CREATE OR REPLACE TRIGGER TR_LAYERTABLESFK_AU
  AFTER UPDATE
  ON LAYERTABLESFK
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (TR_LAYERTABLESFK_AU_500)
-- Version 10.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID<>:old.ID) THEN
    INSERT INTO DelRecIndexes(TableID, RecordId, DeleteDate) VALUES (244, :old.ID, SYSDATE);
    DELETE FROM DelRecIndexes WHERE (TableID=244) AND (RecordId=:new.ID);
      
  END IF;

END;
/
COMMIT WORK
/


-- #########################################################
-- #########################################################
-- UpdDocFields_10.00.00_Ora.sql
-- #########################################################
-- #########################################################


-- Интервал обновлений: 90000 - 100000. Последнее изменение БД было 28.04.2015 08:46:53.
CREATE OR REPLACE PROCEDURE ImportDocType (
   ID_               NUMBER,
   PROGINDEX_        NUMBER,
   NAME_             VARCHAR2,
   USESTATE_         NUMBER,
   DBTABLE_          VARCHAR2,
   NEEDEDS_          NUMBER,
   LOCKMASK_         NUMBER,
   DEFAULTACTIONMACROSNAME_ VARCHAR2,
   DOCUMENTKIND_     NUMBER,
   SHORTNAME_         VARCHAR2
) IS
   IDExists$   NUMBER (10);
BEGIN
   SELECT COUNT (ID)
     INTO IDExists$
     FROM DocumentTypes
    WHERE (ID = ID_);

  IF (IDExists$ = 0) THEN
     INSERT INTO DocumentTypes
                 (ID, PROGINDEX, NAME, USESTATE, DBTABLE, NEEDEDS, LOCKMASK, DEFAULTACTIONMACROSNAME, DOCUMENTKIND, SHORTNAME)
          VALUES (ID_, PROGINDEX_, NAME_, USESTATE_, DBTABLE_, NEEDEDS_, LOCKMASK_, DEFAULTACTIONMACROSNAME_, DOCUMENTKIND_, SHORTNAME_);
  else
      Update documenttypes set
        Name=Name_,
		    DBTABLE=DBTABLE_,
        LockMask=LockMask_,
        DEFAULTACTIONMACROSNAME=DEFAULTACTIONMACROSNAME_,
        DOCUMENTKIND=DOCUMENTKIND_,
        SHORTNAME=SHORTNAME_,
	      PROGINDEX=PROGINDEX_
      where (id=ID_)
        and (
          (Name<>Name_) or
          ((LockMask is null) and (LockMask_ is not null)) or
          ((LockMask is not null) and (LockMask_ is null)) or
          ((LockMask is not null) and (LockMask_ is not null) and (LockMask <> LockMask_)) or
          (DEFAULTACTIONMACROSNAME is null) or
          (DOCUMENTKIND<>DOCUMENTKIND_) or 
          (SHORTNAME is null) or 
          (SHORTNAME<>SHORTNAME_) or
          (PROGINDEX <> PROGINDEX_)
        );
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE UPDATEINTERFACES (
  CLS_   NUMBER,
  NOTE_  VARCHAR2,
  GUID_  VARCHAR2,
  PARAM_ VARCHAR2
) IS
  IDExists$ NUMBER (10);
BEGIN
  SELECT COUNT (ID)
   INTO IDEXISTS$
   FROM INTERFACES
  WHERE (GUID=GUID_);
  
  IF (IDExists$ = 0)  THEN
    INSERT INTO INTERFACES
      (CLS,NOTE,GUID,PARAM)
    VALUES
      (CLS_,NOTE_,GUID_,PARAM_);
  ELSE
    IF ((PARAM_ ='')OR(PARAM_ IS NULL)) THEN 
      UPDATE INTERFACES SET
        CLS = CLS_
      WHERE (GUID=GUID_) AND ((CLS<> CLS_)OR(CLS IS NULL));
    ELSE 
      UPDATE INTERFACES SET
        CLS = CLS_
      WHERE (GUID=GUID_) AND (PARAM=PARAM_) AND ((CLS<> CLS_)OR(CLS IS NULL));
    END IF;
  END IF;
END;
/

-- Добавляем типы документов
CALL ImportDocType(0, 0, 'Обобщенный документ', 0, '', 0,0,'',30000,'') ;

CALL ImportDocType(101, 223, 'Сводные распоряжения на финансирование', 0, ' ', 0,-1,'',10200,'СводнРаспНаФинансирование') ;

CALL ImportDocType(200, 0, 'Все плановые документы(Расходы)', 0, '', 0,0,'',30000,'') ;

CALL ImportDocType(201, 32, 'Роспись по ПБС (расходы)', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'БР_Расходы') ;

CALL ImportDocType(202, 260, 'СБР (расходы)', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'СБР_Расходы') ;

CALL ImportDocType(203, 261, 'Кассовый план (расходы)', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'КП_Расходы') ;

CALL ImportDocType(204, 262, 'Сведения БУ, АУ', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'СметаПоПД_Расходы') ;

CALL ImportDocType(205, 263, 'Бюджет', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'ЗаконОБюджете') ;

CALL ImportDocType(206, 268, 'ПОФ по ПБС (расходы)', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'КП_ПБС_Расходы') ;

CALL ImportDocType(207, 272, 'Помесячный кассовый план', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'КП_Месяц') ;

CALL ImportDocType(208, 273, 'Помесячные ПОФ по ПБС', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'КП_ПБС_Месяц') ;

CALL ImportDocType(209, 274, 'Подневный ПОФ', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'ПОФ_Подневный') ;

CALL UpdateInterfaces(209, 'Подневный ПОФ', '{DA309359-EF6B-4D29-AC0D-309040B5CDB6}', '') ;

CALL ImportDocType(210, 252, 'Внутренние РР', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'ВнутренниеРР') ;

CALL UpdateInterfaces(210, 'Внутренние РР', '{2EF0F811-E21F-4ADB-BC7E-A3A9B16059A4}', '') ;

CALL ImportDocType(211, 275, 'Подневный КП', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'КП_Подневный') ;

CALL UpdateInterfaces(211, 'Подневный КП', '{AE8281A0-BE7F-4F3A-90BD-A7831E8D842F}', '') ;

CALL ImportDocType(212, 276, 'Подневные сведения БУ, АУ', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'СметаПоПД_Подневно') ;

CALL UpdateInterfaces(212, 'Подневные сведения БУ, АУ', '{B743C24B-6E28-4C9C-B3CA-16AC6E529D07}', '') ;

CALL ImportDocType(300, 0, 'Все казначейские документы', 0, '', 0,0,'',30000,'') ;

CALL ImportDocType(301, 66, 'Внутренняя переброска', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнПереброска') ;

CALL ImportDocType(302, 63, 'Выбытия по п\п', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнПП') ;

CALL ImportDocType(303, 65, 'Внутренние зачисления(разассигновка)', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнРазассигновка') ;

CALL ImportDocType(304, 64, 'Выбытия по чекам', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнЧек') ;

CALL ImportDocType(305, 61, 'Поступления по п\п', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнПриходПроч') ;

CALL ImportDocType(306, 62, 'Поступление по объявлениям', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнОбъявления') ;

CALL ImportDocType(307, 0, 'Реестры казначейства', 0, 'FacialFinReestr', 0,-1,'Управление_ДляСценариев',10100,'КазнРеестры') ;

CALL ImportDocType(308, 67, 'Внутренние платежи', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнВнебюджетВнутрПлат') ;

CALL UpdateInterfaces(308, 'Внутренние платежи', '{B50F2C63-9CF4-42C3-8062-E355EABD53E4}', '') ;

CALL ImportDocType(311, 68, 'Перечисление на счета наличности', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнПеречисл_СчетНал') ;

CALL ImportDocType(312, 69, 'Подтверждение перечисления на счета наличности', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнПодтвПеречисл_СчетНал') ;

CALL ImportDocType(314, 70, 'Возврат со счетов наличности', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнВозврат_СчетНал') ;

CALL ImportDocType(315, 71, 'Подтверждение возврата со счетов для наличности', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10200,'КазнПодтвВозврата_СчетНал') ;

CALL ImportDocType(316, 521, 'Сводные заявки', 0, 'ManagerBid', 0,0,'',10100,'СводныеЗаявки') ;

CALL ImportDocType(322, 73, 'Учет кассовых выплат', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10200,'КазнУчетКассВыплат') ;

CALL ImportDocType(323, 75, 'Утверждение ОФ', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнУтверждениеОФ') ;

CALL ImportDocType(324, 76, 'Распределение ОФ', 0, 'FacialFinCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнРаспределениеОФ') ;

CALL ImportDocType(401, 0, 'Кредиты от кредитных организаций', 0, ' ', 0,-1,'',10200,'Кредиты') ;

CALL ImportDocType(501, 0, 'Ссуды юридическим лицам', 0, ' ', 0,-1,'',10200,'Ссуды') ;

CALL ImportDocType(701, 23, 'Распоряжения на финансирование', 0, ' ', 0,-1,'',10200,'РаспНаФинансирование') ;

CALL ImportDocType(702, 0, 'Банковские платежные поручения', 0, ' ', 0,-1,'',10200,'БанковскиеПП') ;

CALL ImportDocType(703, 0, 'Свободное финансирование', 0, ' ', 0,-1,'',10200,'СвободноеФин') ;

CALL ImportDocType(801, 57, 'Объемы финансирования', 0, 'LimitNotifyCaption[RVERSION=RVERSION-1]', 0,34,'Управление_ДляСценариев',10100,'ПредельныеОФ_Уведомления') ;

CALL ImportDocType(802, 0, 'Объемы финансирования (линейно)', 0, ' ', 0,-1,'',10200,'ПредельныеОФ_Линейно') ;

CALL ImportDocType(803, 0, 'Заявки на выделение объемов финансирования', 0, ' ', 0,-1,'',10200,'ПредельныеОФ_Заявки') ;

CALL ImportDocType(804, 0, 'Принятие объемов финансирования', 0, ' ', 0,-1,'',10200,'ПредельныеОФ_Принятие') ;

CALL ImportDocType(900, 0, 'Доходы', 0, '', 0,0,'',30000,'') ;

CALL ImportDocType(901, 0, 'Распоряжение на возврат доходов', 0, ' ', 0,-1,'',10200,'Доходы_Возврат') ;

CALL ImportDocType(902, 0, 'Внутренние операции (доходы)', 0, ' ', 0,-1,'',10200,'Доходы_ВнутрОперации') ;

CALL ImportDocType(903, 45, 'Выписка по доходам', 0, ' ', 0,-1,'',10100,'Доходы_Выписка') ;

CALL ImportDocType(905, 0, 'Суммы в пути', 0, ' ', 0,-1,'',10200,'Доходы_СуммыВПути') ;

CALL ImportDocType(906, 41, 'Невыясненные поступления (устарел)', 0, ' ', 0,-1,'',10200,'Доходы_Невыясненные') ;

CALL ImportDocType(907, 0, 'Оперативные данные (доходы)', 0, ' ', 0,-1,'',10200,'Доходы_ОперДанные') ;

CALL ImportDocType(1201, 0, 'Закрытие года', 0, ' ', 0,-1,'',10200,'ЗакрытиеГода') ;

CALL ImportDocType(1501, 0, 'Оперативные данные', 0, ' ', 0,-1,'',10200,'ОперДанные') ;

CALL ImportDocType(1601, 224, 'Бюджетные обязательства', 0, 'Promise_Caption', 0,-1,'Управление_ДляСценариев',10100,'БО') ;

CALL ImportDocType(1602, 0, 'БО.Обязательства - линейно', 0, ' ', 0,-1,'',10200,'БО_Линейно') ;

CALL ImportDocType(1701, 222, 'Заявки', 0, 'REQUESTS[RVERSION=RVERSION-1]', 0,-1,'',10100,'Заявки') ;

CALL ImportDocType(1702, 0, 'Заявки(старые)', 0, ' ', 0,-1,'',10200,'Заявки_Стар') ;

CALL ImportDocType(1805, 0, 'Буферный интерфейс поступлений', 0, '', 0,-1,'',10200,'ВходящиеПлатежи') ;

CALL UpdateInterfaces(1805, 'Буферный интерфейс поступлений', '{FE9F8D41-C23F-11D5-B571-0050BF2079BC}', '') ;

CALL ImportDocType(1807, 0, 'Экспорт электронных документов', 0, '', 0,-1,'',10200,'ЭлектронныйОбменПП') ;

CALL UpdateInterfaces(1807, 'Экспорт электронных документов', '{DCD3A201-01A8-11D5-9238-4854E826BF13}', '') ;

CALL ImportDocType(1809, 0, 'Таблица подстановок реквизитов при импорте ЭПД', 0, 'BANKEXCH_SUBSTITUTION', 0,0,'',10200,'ТаблицаПодстановок') ;

CALL UpdateInterfaces(1809, 'Таблица подстановок реквизитов при импорте ЭПД', '{84AB1481-04A6-4885-9524-B0689D95F35A}', '') ;

CALL ImportDocType(1810, 0, 'Буферный интерфейс выбытий', 0, ' ', 0,-1,'',10200,'ВедомостиКассВыплат') ;

CALL UpdateInterfaces(1810, 'Буферный интерфейс выбытий', '{EF52F7D8-C963-492E-8012-F94BD6E4197E}', '') ;

CALL ImportDocType(1812, 0, 'Буферный интерфейс уведомлений', 0, '', 0,-1,'',10200,'БуферныеУведомления') ;

CALL UpdateInterfaces(1812, 'Буферный интерфейс уведомлений', '{9CDFC584-6F7A-44CC-95AD-B9B947AFDCA4}', '') ;

CALL ImportDocType(1813, 0, 'Редактор областей форматирования', 0, '', 0,-1,'',10200,'РедОблФормат') ;

CALL UpdateInterfaces(1813, 'Редактор областей форматирования', '{A7B7ED86-DB11-4D8A-96CE-1BAE4B7EC77F}', '') ;

CALL ImportDocType(1814, 0, 'Буферная таблица выписки по счету', 0, '', 0,-1,'',10200,'БуфТаблВыпПоСчету') ;

CALL UpdateInterfaces(1814, 'Буферная таблица выписки по счету', '{B079EB25-3341-4395-9554-FBAAC3293171}', '') ;

CALL ImportDocType(1815, 0, 'Буферная таблица остатков на счете', 0, '', 0,-1,'',10200,'БуфТаблОстНаСчете') ;

CALL UpdateInterfaces(1815, 'Буферная таблица остатков на счете', '{D92C5F6D-D02D-4589-B0A8-0E5A05AFEFBF}', '') ;

CALL ImportDocType(1816, 0, 'Модальная форма импорта', 0, '', 0,-1,'',10200,'ФорИмп') ;

CALL UpdateInterfaces(1816, 'Модальная форма импорта', '{584B1826-AD94-47DC-A420-B5E42F2CA7D7}', '') ;

CALL ImportDocType(1900, 0, 'Все плановые документы(источники)', 0, '', 0,0,'',30000,'') ;

CALL ImportDocType(1901, 264, 'СБР (источники)', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'',10100,'СБР_Источники') ;

CALL ImportDocType(1902, 215, 'Роспись по АИФ (источники)', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'',10100,'БР_Источники') ;

CALL ImportDocType(1903, 265, 'Кассовый план (источники)', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'',10100,'КП_Источники') ;

CALL ImportDocType(1906, 271, 'ПОФ по АИФ (источники)', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'',10100,'ПОФ_ПБС_Источники') ;

CALL ImportDocType(2200, 0, 'Все плановые документы(доходы)', 0, '', 0,0,'',30000,'') ;

CALL ImportDocType(2201, 46, 'Кассовый план (доходы)', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'КП_Доходы') ;

CALL ImportDocType(2501, 305, 'Государственные контракты', 0, 'Agreements', 0,-65537,'',10100,'ГосКонтракты') ;

CALL ImportDocType(2502, 304, 'Договора', 0, 'Agreements', 0,-65537,'',10100,'Договора') ;

CALL ImportDocType(2503, 308, 'Документы исполнения ', 0, 'ExecutionDocumentsCaption', 0,-65537,'',10100,'ДокИсполнения') ;

CALL ImportDocType(2504, 314, 'Муниципальные контракты', 0, 'Agreements', 0,-65537,'',10100,'МупКонтракты') ;

CALL ImportDocType(2801, 0, 'Операции со счетами через распоряжение на финансирование', 0, ' ', 0,-1,'',10200,'ОпСоСчетамиРасп') ;

CALL ImportDocType(2802, 0, 'Операции со счетами', 0, ' ', 0,-1,'',10200,'ОпСоСчетами') ;

CALL ImportDocType(3001, 230, 'Заявка на закупку продукции', 0, 'TenderCaption', 0,-65537,'',10100,'ЗаявкиНаЗакупку') ;

CALL ImportDocType(3003, 234, 'Итоги конкурса', 0, 'TenderResultCaption', 0,-65537,'',10100,'ИтогиКонкурса') ;

CALL ImportDocType(3006, 241, 'План-график', 0, 'TenderCaption', 0,-65537,'',10100,'ПланыЗакупок') ;

CALL ImportDocType(3610, 550, 'Консолидация бюджетной отчетности', 0, 'UTypedFormsCaption', 0,-1,'',10100,'Консолидация5Н') ;

CALL ImportDocType(3701, 235, 'Каталогизация продукции', 0, 'TenderObjects', 0,-65537,'',10100,'КатПродукции') ;

CALL ImportDocType(3901, 0, 'Делопроизводство.Входящие документы', 0, ' ', 0,-1,'',10200,'Делопроизводство_Входящие') ;

CALL ImportDocType(4401, 251, 'Расходные расписания', 0, 'UnionNotifyCaption', 0,-1,'Управление_ДляСценариев',10100,'РасхРасписания') ;

CALL UpdateInterfaces(4401, 'Расходные расписания', '{AB6937F7-A672-461D-A94C-808F4DCA4D71}', '') ;

CALL ImportDocType(4403, 254, 'Внутренние КУ,РР', 0, 'UnionNotifyCaption', 0,-1,'Управление_ДляСценариев',10100,'КазнУведомления') ;

CALL ImportDocType(4801, 528, 'Обуславливающие документы', 0, 'GeneralDocuments', 0,-1,'Управление_ДляСценариев',10100,'ОбуславливающиеДокументы') ;

CALL ImportDocType(4901, 525, 'Пакеты документов для УРМ', 0, 'DataPacket', 0,-1,'Управление_ДляСценариев',10100,'ПакетыДляУРМ') ;

CALL ImportDocType(4902, 526, 'Пакеты файлов', 0, '', 0,-1,'',10200,'ПакетыСФайлами') ;

CALL ImportDocType(4903, 527, 'Электронный архив', 0, 'DataPacket', 0,-1,'Управление_ДляСценариев',10100,'ЭлектронныйАрхив') ;

CALL ImportDocType(5201, 555, 'Исполнительные листы', 0, 'WritExecutionCaption', 0,-1,'',10100,'ИсполнительныеЛисты') ;

CALL UpdateInterfaces(5201, 'Исполнительные листы', '{623EE404-09D9-4069-9115-27974DB69AD1}', '') ;

CALL ImportDocType(5501, 312, 'Уведомление об уточнении поступлений', 0, 'CorrectionCaption', 0,-1,'',10100,'Уточнения_ПоступлениеНов') ;

CALL ImportDocType(5502, 313, 'Уведомление об уточнении выбытий', 0, 'CorrectionCaption', 0,-1,'',10100,'Уточнения_ВыбытиеНов') ;

CALL ImportDocType(5503, 0, 'Протокол пакетной замены классификации', 0, 'ReplacementClsCaption', 0,-1,'',10100,'ПротоколПЗК') ;

CALL UpdateInterfaces(5503, 'Протокол пакетной замены классификации', '{6110B8B7-DFE8-46EF-BD9F-39CCF092BB79}', '') ;

CALL ImportDocType(9601, 0, 'Организации', 0, 'ORGANIZATIONS', 0,0,'',20100,'Организации') ;

CALL ImportDocType(9602, 0, 'Счета организаций', 0, 'ORG_ACCOUNTS', 0,0,'',20100,'СчетаОрганизаций') ;

CALL ImportDocType(9603, 0, 'Банки', 0, 'BANKS', 0,0,'',20100,'Банки') ;

CALL ImportDocType(9604, 0, 'Счета ФО', 0, 'DFACCOUNTSBUHTABLE', 0,0,'',20100,'СчетаФО') ;

CALL ImportDocType(9802, 0, 'ФКР', 0, 'kfsr', 0,0,'',20200,'ФКР') ;

CALL ImportDocType(9803, 0, 'КВСР', 0, 'KVSR', 0,0,'',20100,'КВСР') ;

CALL ImportDocType(9804, 0, 'КВР', 0, 'KVR', 0,0,'',20100,'КВР') ;

CALL ImportDocType(9805, 0, 'КЦСР', 0, 'KCSR', 0,0,'',20100,'КЦСР') ;

CALL ImportDocType(9806, 0, 'Суб КЦСР', 0, 'SUBKCSR', 0,0,'',20200,'СубКЦСР') ;

CALL ImportDocType(9808, 0, 'Суб КОСГУ', 0, 'KESRSubCode', 0,0,'',20200,'СубКЭСР') ;

CALL ImportDocType(9809, 0, 'КД', 0, 'KD', 0,0,'',20100,'КД') ;

CALL ImportDocType(9810, 0, 'Суб КД', 0, 'SubKD', 0,0,'',20200,'СубКД') ;

CALL ImportDocType(9811, 0, 'Документы', 0, 'DocTypes', 0,0,'',20200,'ТипыДокументов') ;

CALL ImportDocType(9812, 0, 'Районы', 0, 'RegionCLS', 0,0,'',20200,'Районы') ;

CALL ImportDocType(9813, 0, 'Источники финансирования', 0, 'NOTIFYTYPES', 0,0,'',20200,'ИстФинансирования') ;

CALL ImportDocType(9814, 0, 'КСШК', 0, 'KSHK', 0,0,'',20200,'КСШК') ;

CALL ImportDocType(9815, 0, 'Материальные ценности', 0, 'VALUECLS', 0,0,'',20200,'МатЦенности') ;

CALL ImportDocType(9816, 0, 'Основные средства', 0, 'MeansCLS', 0,0,'',20200,'ОснСредства') ;

CALL ImportDocType(9817, 0, 'Справочно', 0, 'REFCLS', 0,0,'',20200,'Справочно') ;

CALL ImportDocType(9818, 0, 'Валюты', 0, 'CURRENCYCLS', 0,0,'',20200,'Валюты') ;

CALL ImportDocType(9820, 0, 'Тип организации (старый)', 0, 'ORG_CLS', 0,0,'',20200,'ТипыОрганизацииСтар') ;

CALL ImportDocType(9821, 0, 'Коды расчетных счетов', 0, 'ACC_CLS', 0,0,'',20200,'КодыРС') ;

CALL ImportDocType(9822, 0, 'Группы информации', 0, 'GroupInf_CLS', 0,0,'',20200,'ГруппыИнф') ;

CALL ImportDocType(9823, 0, 'ГосНИ', 0, 'GOSNI', 0,0,'',20200,'ГосНИ') ;

CALL ImportDocType(9826, 0, 'Слой доходов', 0, 'BUDGETACCOUNTS', 0,0,'',20200,'СлоиДоходов') ;

CALL ImportDocType(9827, 0, 'Код дополнительной информации', 0, 'FinType', 0,0,'',20200,'КодДопИнформации') ;

CALL ImportDocType(9828, 0, 'Мероприятия', 0, 'FACT', 0,0,'',20100,'Мероприятия') ;

CALL ImportDocType(9829, 0, 'Нормативно-правовые акты', 0, 'DocBase', 0,0,'',20200,'ДокОснования') ;

CALL ImportDocType(9834, 0, 'Тип отчета', 0, 'ReportType', 0,0,'',20200,'ТипыОтчетаСтар') ;

CALL ImportDocType(9835, 0, 'Вид бюджета (счета по взаимным)', 0, 'BUDGETTYPE', 0,0,'',20200,'ВидыБюджета') ;

CALL ImportDocType(9841, 0, 'Лицевые счета', 0, 'FACIALACC_CLS', 0,0,'',20200,'ЛицСчета') ;

CALL ImportDocType(9842, 0, 'ОКВЭД2', 0, 'OKVED2', 0,0,'',20200,'ОКВЭД2') ;

CALL ImportDocType(9843, 0, 'Виды платежей', 0, 'PAYTYPECLS', 0,0,'',20200,'ВидыПлатежей') ;

CALL ImportDocType(9844, 0, 'Умолчания расчетных счетов', 0, 'Org_AccDefaults', 0,0,'',20200,'УмолчанияРС') ;

CALL ImportDocType(9845, 0, 'Кассовые символы', 0, 'PAYSYMBOLCLS', 0,0,'',20200,'КассСимволы') ;

CALL ImportDocType(9846, 0, 'Бухгалтерская операция(старая)', 0, 'BUHPAYMENTCLS', 0,0,'',20200,'БухОперацииСтар') ;

CALL ImportDocType(9847, 0, 'Код операции', 0, 'TYPEOPERATIONCLS', 0,0,'',20200,'КодыОперации') ;

CALL ImportDocType(9848, 0, 'Назначения платежа', 0, 'PAYDESTINATIONCLS', 0,0,'',20200,'НазнПлатежа') ;

CALL ImportDocType(9849, 0, 'Тип средств бюджета', 0, 'MEANSTYPE', 0,0,'',20200,'ТипСредств') ;

CALL ImportDocType(9850, 0, 'Причина отклонения', 0, 'RejectCLS', 0,0,'',20200,'ПричиныОткл') ;

CALL ImportDocType(9851, 0, 'Коды ошибок', 0, 'Error', 0,0,'',20200,'КодыОшибки') ;

CALL ImportDocType(9852, 0, 'Источники финансирования дефицита бюджета', 0, 'InnerFinSource', 0,0,'',20100,'ИФДБ') ;

CALL ImportDocType(9853, 0, 'Тип реестра', 0, 'REESTRTYPE', 0,0,'',20200,'ТипыРеестра') ;

CALL ImportDocType(9854, 0, 'Объекты', 0, 'INVESTOBJECT', 0,0,'',20100,'ОбъектыУчета') ;

CALL ImportDocType(9857, 0, 'Вид ссуды', 0, 'LOANTYPE', 0,0,'',20200,'ВидыСсуд') ;

CALL ImportDocType(9858, 0, 'Вид заимствования', 0, 'DEBTTYPE', 0,0,'',20200,'ВидыЗаимствований') ;

CALL ImportDocType(9859, 0, 'Отдел', 0, 'DepartmentCLS', 0,0,'',20200,'Отделы') ;

CALL ImportDocType(9860, 0, 'Единицы измерения', 0, 'MEASUREMENTCLS', 0,0,'',20200,'ЕдИзмерения') ;

CALL ImportDocType(9861, 0, 'Предмет заявки', 0, 'TenderObjects', 0,0,'',20200,'ПредметыЗаявки') ;

CALL ImportDocType(9862, 0, 'ОКАТО', 0, 'OKATO', 0,0,'',20200,'ОКАТО') ;

CALL ImportDocType(9863, 0, 'Тип обеспечения', 0, 'COLLATERALTYPE', 0,0,'',20200,'ТипыОбеспечения') ;

CALL ImportDocType(9864, 0, 'Вид плана', 0, 'PlanDocType', 0,0,'',20200,'ВидыПлана') ;

CALL ImportDocType(9865, 0, 'План счетов', 0, 'BuhAccPlan', 0,0,'',20100,'ПланСчетов') ;

CALL ImportDocType(9867, 0, 'ОКПД2', 0, 'OKPD2', 0,0,'',20200,'ОКПД2') ;

CALL ImportDocType(9868, 0, 'Код операции сектора государственного управления', 0, 'KESR', 0,0,'',20200,'КОСГУ') ;

CALL ImportDocType(9869, 0, 'Направление', 0, 'DirectionCLS', 0,0,'',20100,'Направления') ;

CALL ImportDocType(9870, 0, 'Подвид дохода', 0, 'ProgramCode', 0,0,'',20200,'ПодвидДохода') ;

CALL ImportDocType(9871, 0, 'Операция', 0, 'BuhOperationCls', 0,0,'',20200,'БухОперации') ;

CALL ImportDocType(9872, 0, 'Баланс', 0, 'BalanceCls', 0,0,'',20200,'Балансы') ;

CALL ImportDocType(9878, 0, 'Бюджет', 0, 'budgets_s', 0,0,'',20200,'Бюджеты') ;

CALL ImportDocType(9879, 0, 'Код цели', 0, 'TargetCls', 0,0,'',20200,'КодыЦели') ;

CALL ImportDocType(9880, 0, 'Источник образования средств', 0, 'FundsSource', 0,0,'',20200,'ИсточнОбразСредств') ;

CALL ImportDocType(9881, 0, 'ОКФС', 0, 'OKFS', 0,0,'',20200,'ОКФС') ;

CALL ImportDocType(9882, 0, 'ОКОПФ', 0, 'OKOPF', 0,0,'',20200,'ОКОПФ') ;

CALL ImportDocType(9883, 0, 'Вид организации', 0, 'Org_Type', 0,0,'',20200,'ВидыОрганизации') ;

CALL ImportDocType(9884, 0, 'Код целевых средств', 0, 'TransfertCLS', 0,0,'',20100,'КЦС') ;

CALL ImportDocType(9885, 0, 'Вид ассигнований', 0, 'AssignmentKind', 0,0,'',20200,'ВидыАссигнований') ;

CALL ImportDocType(9886, 0, 'Вид изменений', 0, 'AssignmentSource', 0,0,'',20200,'ВидыИзменений') ;

CALL ImportDocType(9887, 0, 'Вариант', 0, 'VariantCls', 0,0,'',20200,'Вариант') ;

CALL ImportDocType(9888, 0, 'Общероссийский классификатор продукции', 0, 'OKP', 0,0,'',20200,'ОКП') ;

CALL ImportDocType(9889, 0, 'Код субсидии', 0, 'SubsidyCls', 0,0,'',20100,'КодыСубсидии') ;

CALL ImportDocType(9890, 0, 'Код бюджетного ассигнования', 0, 'BudAllocationCls', 0,0,'',20100,'КодБА') ;

CALL ImportDocType(9891, 0, 'Код расходного обязательства', 0, 'PayPromiseCls', 0,0,'',20100,'КодРО') ;

CALL ImportDocType(9892, 0, 'Категории архивных документов (справочник)', 0, 'ARCHIVEDOCTYPE', 0,0,'',20100,'КатегорииАрхДокументовСправочник') ;

CALL ImportDocType(9894, 0, 'Направления расходов вышестоящих бюджетов ', 0, 'COMMDIRECTIONEXPENCECLS', 0,0,'',20100,'ОбщиеНаправленияРасходов') ;

CALL ImportDocType(9895, 0, 'ОКТМО', 0, 'OKTMO', 0,0,'',20100,'ОКТМО') ;

CALL ImportDocType(9899, 0, 'Пользователи системы', 0, 'DBUsers', 0,0,'',20100,'Пользователи') ;

CALL ImportDocType(9903, 0, 'Справочник организаций', 0, ' ', 0,-1,'',10100,'Организации_Редактор') ;

CALL ImportDocType(9904, 560, 'Справочник контактных лиц', 0, 'CONTACTPERSONS', 0,0,'',10200,'Контактные лица') ;

CALL ImportDocType(9905, 0, 'Справочник банков', 0, ' ', 0,-1,'',10200,'Банки_Редактор') ;

CALL ImportDocType(9908, 0, 'Типы документов', 0, '', 0,0,'',10200,'Типы_Документов') ;

CALL ImportDocType(9912, 0, 'Счета бюджета', 0, ' ', 0,-1,'',10200,'СчетаБюджета') ;

CALL ImportDocType(9913, 0, 'Объекты', 0, '', 0,0,'',10200,'Объекты') ;

CALL ImportDocType(9914, 0, 'Редактор типов пакетов', 0, '', 0,-1,'',10200,'РедакторТиповПакетов') ;

CALL ImportDocType(9915, 0, 'Открытие операционного дня', 0, 'UnLockDates', 0,-1,'',10100,'ОткрытиеОперДня') ;

CALL ImportDocType(9916, 0, 'Константы системы', 0, '', 0,0,'',10300,'КонстантыСистемы') ;

CALL ImportDocType(9917, 0, 'Константы казначейства', 0, '', 0,0,'',10300,'КонстантыКазначейства') ;

CALL ImportDocType(9918, 0, 'Генераторы', 0, '', 0,0,'',10200,'Генераторы') ;

CALL ImportDocType(9919, 0, 'Редактор классификаторов', 0, '', 0,0,'',10200,'РедакторКлассификаторров') ;

CALL UpdateInterfaces(9919, 'Редактор классификаторов', '{88FA05A2-02A0-11D2-B26C-008048E689F8}', '') ;

CALL ImportDocType(9920, 0, 'Редактор справочника операций ', 0, '', 0,0,'',10200,'РедакторБухОпераций') ;

CALL UpdateInterfaces(9920, 'Редактор справочника операций ', '{2F5EDB5F-CC69-4F04-9C91-B457D92C75AC}', '') ;

CALL ImportDocType(9921, 0, 'Редактор справочника бюджетов', 0, '', 0,0,'',10200,'РедакторБюджетов') ;

CALL UpdateInterfaces(9921, 'Редактор справочника бюджетов', '{61875F0C-17AA-44F1-80F0-B689371AFBDF}', '') ;

CALL ImportDocType(9922, 0, 'Категории архивных документов', 0, '', 0,0,'',10200,'КатегорииАрхивныхДокументов') ;

CALL UpdateInterfaces(9922, 'Категории архивных документов', '{C9277BAB-1206-41DD-966D-5D86A9E75AB8}', '') ;

CALL ImportDocType(9923, 0, 'Редактор схем подписания', 0, '', 0,0,'',10200,'СхемыПодписания') ;

CALL UpdateInterfaces(9923, 'Редактор схем подписания', '{82245B63-9A83-41F5-8541-A77AAD1B6EAA}', '') ;

CALL ImportDocType(9924, 0, 'Редактор справочника ролей', 0, '', 0,0,'',10200,'Подписи') ;

CALL UpdateInterfaces(9924, 'Редактор справочника ролей', '{4C71385E-A42A-43D1-AEBB-807B3C86E76B}', '') ;

CALL ImportDocType(9925, 0, 'Редактор пластиковых карт', 0, 'Cards', 0,0,'',10200,'ПластиковыеКарты') ;

CALL UpdateInterfaces(9925, 'Редактор пластиковых карт', '{992D6D69-0DA8-490F-8F88-EA0EB3C78CF3}', '') ;

CALL ImportDocType(9926, 0, 'Редактор справочника типов уведомлений', 0, 'WritNotifyCls ', 0,0,'',10200,'РедакторТиповУведомлений') ;

CALL UpdateInterfaces(9926, 'Редактор справочника типов уведомлений', '{89CAEE9C-9516-4EE2-8A4B-CB0BFA9165AB}', '') ;

CALL ImportDocType(9927, 0, 'Права удаленных клиентов', 0, 'RemoteClient', 0,0,'',10200,'ПраваУдаленныхКлиентов') ;

CALL UpdateInterfaces(9927, 'Права удаленных клиентов', '{60EFBA81-B436-11D6-8CA4-000021DDD8CD}', '') ;

CALL ImportDocType(9928, 0, 'Соответствие КВР КОСГУ', 0, 'ClsCorrespondents', 0,0,'',20100,'СоответствиеКВРКОСГУ') ;

CALL UpdateInterfaces(9928, 'Соответствие КВР КОСГУ', '{C1FAE5FE-7817-4D46-858B-ACFA478BA485}', '') ;

CALL ImportDocType(9929, 0, 'Редактор справочника структуры расходов бюджета', 0, 'BudStruct', 0,0,'',10200,'РедакторДереваБК') ;

CALL UpdateInterfaces(9929, 'Редактор справочника структуры расходов бюджета', '{B95FC8BB-D031-4122-B714-B6F41ACFA610}', '') ;

DROP PROCEDURE ImportDocType
/

DROP PROCEDURE UPDATEINTERFACES
/



CREATE OR REPLACE PROCEDURE SELECTIONS_IMPORT(
  ID_ NUMBER,
  KIND_ NUMBER,
  NAME_ VARCHAR2,
  NOTE_ VARCHAR2,
  READONLY_ NUMBER,
  USEINDOC_ NUMBER,
  TABLENAME_ VARCHAR2,
  ALIAS_ VARCHAR2,
  TABLECODE_ NUMBER,
  NEEDGROUPONDB_ NUMBER,
  NEEDDISTINCT_ NUMBER,
  MASTER_ NUMBER,
  DISCRIMVALUE_ VARCHAR2,
  AVAILABLEINDEREF_ NUMBER,
  CACHETYPE_ NUMBER,
  FULLORMODINSREFRTIME_ NUMBER,
  DELETEREFRTIME_ NUMBER,
  FINDTIMEREFRESH_ NUMBER,
  ANNOTATION_ VARCHAR2,
  DEREFNAME_ VARCHAR2,
  GroupID_ NUMBER,
  IsLogged_ NUMBER
) IS
  IDExists$ NUMBER (10);
BEGIN
  SELECT COUNT(ID)
  INTO IDExists$
  FROM SELECTIONS
  WHERE (ID = ID_);
  IF (IDExists$ <> 0) THEN
    UPDATE SELECTIONS SET
      KIND = KIND_,
      NAME = NAME_,
      NOTE = NOTE_,
      READONLY = READONLY_,
      USEINDOC = USEINDOC_,
      TABLENAME = TABLENAME_,
      ALIAS = ALIAS_,
      TABLECODE = TABLECODE_,    
      NEEDGROUPONDB = NEEDGROUPONDB_,
      NEEDDISTINCT = NEEDDISTINCT_,
      MASTER = MASTER_,
      DISCRIMVALUE = DISCRIMVALUE_,
      AVAILABLEINDEREF = AVAILABLEINDEREF_,         
      CACHETYPE = CACHETYPE_,   
      FULLORMODINSREFRTIME = FULLORMODINSREFRTIME_,   
      DELETEREFRTIME = DELETEREFRTIME_,   
      FINDTIMEREFRESH = FINDTIMEREFRESH_,   
      ANNOTATION = ANNOTATION_,   
      DEREFNAME = DEREFNAME_,     
      GroupID = GroupID_, 
      IsLogged = IsLogged_  
    WHERE ID = ID_;
  ELSE
    INSERT INTO SELECTIONS
      (ID, KIND, NAME, NOTE, READONLY, USEINDOC, TABLENAME, ALIAS, TABLECODE, NEEDGROUPONDB, NEEDDISTINCT, MASTER, DISCRIMVALUE,
      AVAILABLEINDEREF, CACHETYPE, FULLORMODINSREFRTIME, DELETEREFRTIME, FINDTIMEREFRESH, ANNOTATION, DEREFNAME, GroupID, IsLogged)
    VALUES
      (ID_, KIND_, NAME_, NOTE_, READONLY_, USEINDOC_, TABLENAME_, ALIAS_, TABLECODE_, NEEDGROUPONDB_, NEEDDISTINCT_, MASTER_, DISCRIMVALUE_,
      AVAILABLEINDEREF_, CACHETYPE_, FULLORMODINSREFRTIME_, DELETEREFRTIME_, FINDTIMEREFRESH_, ANNOTATION_, DEREFNAME_, GroupID_, IsLogged_);
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE SELECTIONSDETAIL_IMPORT(
  ID_ NUMBER,
  SELECTIONREF_ NUMBER,
  TABLEREF_ NUMBER,
  ALIAS_ VARCHAR2,
  JOINORDER_ NUMBER,
  JOINTYPE_ NUMBER,
  RELATIONTYPE_ NUMBER,
  JOINCONDITION_ VARCHAR2,
  DONTUSETABLELIMITS_ NUMBER,
  LIMITNAMESLIST_ VARCHAR2,
  QueryGroup_ NUMBER  
) IS
  IDExists$ NUMBER (10);
BEGIN
  SELECT COUNT(ID)
  INTO IDExists$
  FROM SELECTIONSDETAIL
  WHERE (ID = ID_);
  IF (IDExists$ <> 0) THEN
    UPDATE SELECTIONSDETAIL SET
      SELECTIONREF = SELECTIONREF_,
      TABLEREF = TABLEREF_,
      ALIAS = ALIAS_,
      JOINORDER = JOINORDER_,
      JOINTYPE = JOINTYPE_,
      RELATIONTYPE = RELATIONTYPE_,
      JOINCONDITION = JOINCONDITION_,
      DONTUSETABLELIMITS = DONTUSETABLELIMITS_,
      LIMITNAMESLIST = LIMITNAMESLIST_,
      QueryGroup = QueryGroup_
    WHERE ID = ID_;
  ELSE
    INSERT INTO SELECTIONSDETAIL
      (ID, SELECTIONREF, TABLEREF, ALIAS, JOINORDER, JOINTYPE, RELATIONTYPE, JOINCONDITION, DONTUSETABLELIMITS, LIMITNAMESLIST, QueryGroup)
    VALUES
      (ID_, SELECTIONREF_, TABLEREF_, ALIAS_, JOINORDER_, JOINTYPE_, RELATIONTYPE_, JOINCONDITION_, DONTUSETABLELIMITS_, LIMITNAMESLIST_, QueryGroup_);
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE FIELDSINFO_IMPORT(
  ID_ NUMBER,
  FIELDKIND_ NUMBER,
  DESCRIPTIONLEVEL_ NUMBER,
  ANCESTORREF_ NUMBER,
  SELECTIONREF_ NUMBER,
  TABLEREF_ NUMBER,
  FIELDNAME_ VARCHAR2,
  DATATYPE_ NUMBER,
  SUBDATATYPE_ NUMBER,
  FIELDSIZE_ NUMBER,
  DISPLAYLABEL_ VARCHAR2,
  NOTE_ VARCHAR2,
  DEFAULTWIDTH_ NUMBER,
  EDITMASK_ VARCHAR2,
  DISPLAYFORMAT_ VARCHAR2,
  EDITFORMAT_ VARCHAR2,
  CANTEDIT_ NUMBER,
  NOVISUALIZE_ NUMBER,
  ENUMSREF_ NUMBER,
  REQUIRED_ NUMBER,
  FOREIGNKEY_ NUMBER,
  ONDELACTION_ NUMBER,
  PRIMARYKEY_ NUMBER,
  ISRVERSION_ NUMBER,
  LIMITPARAMNAMES_ VARCHAR2,
  FOLLOWORDER_ NUMBER,
  SORTDIRECTION_ NUMBER,
  SORTORDER_ NUMBER,
  AGRFUNCTION_ NUMBER,
  FLAGFIELDNAME_ NUMBER,
  FLAGDISPLAYLABEL_ NUMBER,
  FLAGNOTE_ NUMBER,
  FLAGDEFAULTWIDTH_ NUMBER,
  FLAGCANTEDIT_ NUMBER,
  FLAGNOVISUALIZE_ NUMBER,
  FLAGREQUIRED_ NUMBER,
  FLAGLIMITPARAMNAMES_ NUMBER,
  FLAGAGRFUNCTION_ NUMBER,
  ISTIMESTAMPFIELD_ NUMBER,
  ISBUDGET_ NUMBER,
  AVAILABLEINDEREF_ NUMBER,
  ANNOTATION_ VARCHAR2,
  ALIAS_ VARCHAR2,
  DEREFNAME_ VARCHAR2
) IS
  IDExists$ NUMBER (10);
BEGIN
  SELECT COUNT(ID)
  INTO IDExists$
  FROM FIELDSINFO
  WHERE (ID = ID_);
  IF (IDExists$ <> 0) THEN
    UPDATE FIELDSINFO SET
      FIELDKIND = FIELDKIND_,
      DESCRIPTIONLEVEL = DESCRIPTIONLEVEL_,
      ANCESTORREF = ANCESTORREF_,
      SELECTIONREF = SELECTIONREF_,
      TABLEREF = TABLEREF_,
      FIELDNAME = FIELDNAME_,
      DATATYPE = DATATYPE_,
      SUBDATATYPE = SUBDATATYPE_,
      FIELDSIZE = FIELDSIZE_,
      DISPLAYLABEL = DISPLAYLABEL_,
      NOTE = NOTE_,
      DEFAULTWIDTH = DEFAULTWIDTH_,
      EDITMASK = EDITMASK_,
      DISPLAYFORMAT = DISPLAYFORMAT_,
      EDITFORMAT = EDITFORMAT_,
      CANTEDIT = CANTEDIT_,
      NOVISUALIZE = NOVISUALIZE_,
      ENUMSREF = ENUMSREF_,
      REQUIRED = REQUIRED_,
      FOREIGNKEY = FOREIGNKEY_,
      ONDELACTION = ONDELACTION_,
      PRIMARYKEY = PRIMARYKEY_,
      ISRVERSION = ISRVERSION_,
      LIMITPARAMNAMES = LIMITPARAMNAMES_,
      FOLLOWORDER = FOLLOWORDER_,
      SORTDIRECTION = SORTDIRECTION_,
      SORTORDER = SORTORDER_,
      AGRFUNCTION = AGRFUNCTION_,
      FLAGFIELDNAME = FLAGFIELDNAME_,
      FLAGDISPLAYLABEL = FLAGDISPLAYLABEL_,
      FLAGNOTE = FLAGNOTE_,
      FLAGDEFAULTWIDTH = FLAGDEFAULTWIDTH_,
      FLAGCANTEDIT = FLAGCANTEDIT_,
      FLAGNOVISUALIZE = FLAGNOVISUALIZE_,
      FLAGREQUIRED = FLAGREQUIRED_,
      FLAGLIMITPARAMNAMES = FLAGLIMITPARAMNAMES_,
      FLAGAGRFUNCTION = FLAGAGRFUNCTION_,
      ISTIMESTAMPFIELD = ISTIMESTAMPFIELD_,
      ISBUDGET = ISBUDGET_,
      AVAILABLEINDEREF = AVAILABLEINDEREF_,
      ANNOTATION = ANNOTATION_,
      ALIAS = ALIAS_,
      DEREFNAME = DEREFNAME_
    WHERE ID = ID_;
  ELSE
    INSERT INTO FIELDSINFO
      (ID, FIELDKIND, DESCRIPTIONLEVEL, ANCESTORREF, SELECTIONREF, TABLEREF, FIELDNAME, DATATYPE, SUBDATATYPE,
       FIELDSIZE, DISPLAYLABEL, NOTE, DEFAULTWIDTH, EDITMASK, DISPLAYFORMAT, EDITFORMAT, CANTEDIT, NOVISUALIZE,
       ENUMSREF, REQUIRED, FOREIGNKEY, ONDELACTION, PRIMARYKEY, ISRVERSION, LIMITPARAMNAMES,
       FOLLOWORDER, SORTDIRECTION, SORTORDER, AGRFUNCTION, FLAGFIELDNAME, FLAGDISPLAYLABEL, FLAGNOTE,
       FLAGDEFAULTWIDTH, FLAGCANTEDIT, FLAGNOVISUALIZE, FLAGREQUIRED, FLAGLIMITPARAMNAMES, FLAGAGRFUNCTION,
       ISTIMESTAMPFIELD, ISBUDGET, AVAILABLEINDEREF, ANNOTATION, ALIAS, DEREFNAME)
    VALUES
      (ID_, FIELDKIND_, DESCRIPTIONLEVEL_, ANCESTORREF_, SELECTIONREF_, TABLEREF_, FIELDNAME_, DATATYPE_, SUBDATATYPE_,
       FIELDSIZE_, DISPLAYLABEL_, NOTE_, DEFAULTWIDTH_, EDITMASK_, DISPLAYFORMAT_, EDITFORMAT_, CANTEDIT_, NOVISUALIZE_,
       ENUMSREF_, REQUIRED_, FOREIGNKEY_, ONDELACTION_, PRIMARYKEY_, ISRVERSION_, LIMITPARAMNAMES_,
       FOLLOWORDER_, SORTDIRECTION_, SORTORDER_, AGRFUNCTION_, FLAGFIELDNAME_, FLAGDISPLAYLABEL_, FLAGNOTE_,
       FLAGDEFAULTWIDTH_, FLAGCANTEDIT_, FLAGNOVISUALIZE_, FLAGREQUIRED_, FLAGLIMITPARAMNAMES_, FLAGAGRFUNCTION_,
       ISTIMESTAMPFIELD_, ISBUDGET_, AVAILABLEINDEREF_, ANNOTATION_, ALIAS_, DEREFNAME_);
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE SELECTIONEVENTS_IMPORT(
  ID_ NUMBER,
  SELECTIONREF_ NUMBER,
  EVENTCODE_ NUMBER,
  SCRIPTNAME_ VARCHAR2
) IS
  IDExists$ NUMBER (10);
BEGIN
  SELECT COUNT(ID)
  INTO IDExists$
  FROM SELECTIONEVENTS
  WHERE (ID = ID_);
  IF (IDExists$ <> 0) THEN
    UPDATE SELECTIONEVENTS SET
      SELECTIONREF = SELECTIONREF_,
      EVENTCODE = EVENTCODE_,
      SCRIPTNAME = SCRIPTNAME_
    WHERE ID = ID_;
  ELSE
    INSERT INTO SELECTIONEVENTS
      (ID, SELECTIONREF, EVENTCODE, SCRIPTNAME)
    VALUES
      (ID_, SELECTIONREF_, EVENTCODE_, SCRIPTNAME_);
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE FIELDSINFO_DELETE(
  ID_ NUMBER
) IS
BEGIN
  UPDATE DOCUMENTFIELDS SET
    FIELDINFOREF = NULL
  WHERE FIELDINFOREF = ID_;
  DELETE FROM FIELDSINFO FI
  WHERE FI.ID = ID_;
END;
/

CREATE OR REPLACE PROCEDURE SELECTIONSDETAIL_DELETE(
  ID_ NUMBER
) IS
BEGIN
  DELETE FROM SELECTIONSDETAIL SLD
  WHERE SLD.ID = ID_;
END;
/

CREATE OR REPLACE PROCEDURE SELECTIONS_DELETE(
  ID_ NUMBER
) IS
BEGIN
  DELETE FROM SELECTIONS SL
  WHERE SL.ID = ID_;
END;
/

CREATE OR REPLACE PROCEDURE SELECTIONEVENTS_DELETE(
  ID_ NUMBER
) IS
BEGIN
  DELETE FROM SELECTIONEVENTS SE
  WHERE SE.ID = ID_;
END;
/

-- Выборки
CALL FIELDSINFO_DELETE(16957) ;

CALL FIELDSINFO_DELETE(16958) ;

CALL FIELDSINFO_DELETE(16966) ;

CALL FIELDSINFO_DELETE(16967) ;

CALL FIELDSINFO_DELETE(16968) ;

CALL FIELDSINFO_DELETE(16975) ;

CALL FIELDSINFO_DELETE(16976) ;

CALL FIELDSINFO_DELETE(16977) ;

CALL FIELDSINFO_DELETE(18056) ;

CALL FIELDSINFO_DELETE(18057) ;

CALL FIELDSINFO_DELETE(18058) ;

CALL FIELDSINFO_DELETE(18060) ;

CALL FIELDSINFO_DELETE(18061) ;

CALL FIELDSINFO_DELETE(18062) ;

CALL FIELDSINFO_DELETE(18063) ;

CALL FIELDSINFO_DELETE(18064) ;

CALL FIELDSINFO_DELETE(18065) ;

CALL FIELDSINFO_DELETE(18066) ;

CALL FIELDSINFO_DELETE(18067) ;

CALL FIELDSINFO_DELETE(18068) ;

CALL FIELDSINFO_DELETE(18069) ;

CALL FIELDSINFO_DELETE(18070) ;

CALL FIELDSINFO_DELETE(18071) ;

CALL FIELDSINFO_DELETE(18072) ;

CALL FIELDSINFO_DELETE(18073) ;

CALL FIELDSINFO_DELETE(18098) ;

CALL FIELDSINFO_DELETE(18099) ;

CALL FIELDSINFO_DELETE(18100) ;

CALL FIELDSINFO_DELETE(18101) ;

CALL FIELDSINFO_DELETE(18102) ;

CALL FIELDSINFO_DELETE(18103) ;

CALL FIELDSINFO_DELETE(18104) ;

CALL FIELDSINFO_DELETE(18105) ;

CALL FIELDSINFO_DELETE(18106) ;

CALL FIELDSINFO_DELETE(18107) ;

CALL FIELDSINFO_DELETE(18108) ;

CALL FIELDSINFO_DELETE(18109) ;

CALL FIELDSINFO_DELETE(18110) ;

CALL FIELDSINFO_DELETE(18111) ;

CALL FIELDSINFO_DELETE(18112) ;

CALL FIELDSINFO_DELETE(18113) ;

CALL FIELDSINFO_DELETE(18114) ;

CALL FIELDSINFO_DELETE(18115) ;

CALL FIELDSINFO_DELETE(18116) ;

CALL FIELDSINFO_DELETE(18117) ;

CALL FIELDSINFO_DELETE(18118) ;

CALL FIELDSINFO_DELETE(18119) ;

CALL FIELDSINFO_DELETE(18120) ;

CALL FIELDSINFO_DELETE(18121) ;

CALL FIELDSINFO_DELETE(18154) ;

CALL FIELDSINFO_DELETE(18155) ;

CALL FIELDSINFO_DELETE(18156) ;

CALL FIELDSINFO_DELETE(18157) ;

CALL FIELDSINFO_DELETE(18158) ;

CALL FIELDSINFO_DELETE(18159) ;

CALL FIELDSINFO_DELETE(18160) ;

CALL FIELDSINFO_DELETE(18161) ;

CALL FIELDSINFO_DELETE(18162) ;

CALL FIELDSINFO_DELETE(18163) ;

CALL FIELDSINFO_DELETE(18164) ;

CALL FIELDSINFO_DELETE(18165) ;

CALL FIELDSINFO_DELETE(18166) ;

CALL FIELDSINFO_DELETE(18167) ;

CALL FIELDSINFO_DELETE(18168) ;

CALL FIELDSINFO_DELETE(18169) ;

CALL FIELDSINFO_DELETE(18171) ;

CALL FIELDSINFO_DELETE(18172) ;

CALL FIELDSINFO_DELETE(18173) ;

CALL FIELDSINFO_DELETE(18174) ;

CALL FIELDSINFO_DELETE(18175) ;

CALL FIELDSINFO_DELETE(18176) ;

CALL FIELDSINFO_DELETE(18177) ;

CALL FIELDSINFO_DELETE(18178) ;

CALL FIELDSINFO_DELETE(18179) ;

CALL FIELDSINFO_DELETE(18180) ;

CALL FIELDSINFO_DELETE(18181) ;

CALL FIELDSINFO_DELETE(18182) ;

CALL FIELDSINFO_DELETE(18183) ;

CALL FIELDSINFO_DELETE(18184) ;

CALL FIELDSINFO_DELETE(18185) ;

CALL FIELDSINFO_DELETE(18186) ;

CALL FIELDSINFO_DELETE(18187) ;

CALL FIELDSINFO_DELETE(18188) ;

CALL FIELDSINFO_DELETE(18190) ;

CALL FIELDSINFO_DELETE(18191) ;

CALL FIELDSINFO_DELETE(18192) ;

CALL FIELDSINFO_DELETE(18193) ;

CALL FIELDSINFO_DELETE(18194) ;

CALL FIELDSINFO_DELETE(18195) ;

CALL FIELDSINFO_DELETE(18196) ;

CALL FIELDSINFO_DELETE(18198) ;

CALL FIELDSINFO_DELETE(18199) ;

CALL FIELDSINFO_DELETE(18200) ;

CALL FIELDSINFO_DELETE(18201) ;

CALL FIELDSINFO_DELETE(18202) ;

CALL FIELDSINFO_DELETE(18203) ;

CALL FIELDSINFO_DELETE(18204) ;

CALL FIELDSINFO_DELETE(18205) ;

CALL FIELDSINFO_DELETE(18206) ;

CALL FIELDSINFO_DELETE(18207) ;

CALL FIELDSINFO_DELETE(18208) ;

CALL FIELDSINFO_DELETE(18209) ;

CALL FIELDSINFO_DELETE(18210) ;

CALL FIELDSINFO_DELETE(18211) ;

CALL FIELDSINFO_DELETE(18213) ;

CALL FIELDSINFO_DELETE(18214) ;

CALL FIELDSINFO_DELETE(18215) ;

CALL FIELDSINFO_DELETE(18216) ;

CALL FIELDSINFO_DELETE(18217) ;

CALL FIELDSINFO_DELETE(18218) ;

CALL FIELDSINFO_DELETE(18219) ;

CALL FIELDSINFO_DELETE(18220) ;

CALL FIELDSINFO_DELETE(18221) ;

CALL FIELDSINFO_DELETE(18222) ;

CALL FIELDSINFO_DELETE(18223) ;

CALL FIELDSINFO_DELETE(18224) ;

CALL FIELDSINFO_DELETE(18225) ;

CALL FIELDSINFO_DELETE(18227) ;

CALL FIELDSINFO_DELETE(18228) ;

CALL FIELDSINFO_DELETE(18229) ;

CALL FIELDSINFO_DELETE(18230) ;

CALL FIELDSINFO_DELETE(18231) ;

CALL FIELDSINFO_DELETE(18232) ;

CALL FIELDSINFO_DELETE(18233) ;

CALL FIELDSINFO_DELETE(18234) ;

CALL FIELDSINFO_DELETE(18236) ;

CALL FIELDSINFO_DELETE(18237) ;

CALL FIELDSINFO_DELETE(18238) ;

CALL FIELDSINFO_DELETE(18239) ;

CALL FIELDSINFO_DELETE(18240) ;

CALL FIELDSINFO_DELETE(18241) ;

CALL FIELDSINFO_DELETE(18242) ;

CALL FIELDSINFO_DELETE(18243) ;

CALL FIELDSINFO_DELETE(18244) ;

CALL FIELDSINFO_DELETE(18245) ;

CALL FIELDSINFO_DELETE(18247) ;

CALL FIELDSINFO_DELETE(18248) ;

CALL FIELDSINFO_DELETE(18249) ;

CALL FIELDSINFO_DELETE(18251) ;

CALL FIELDSINFO_DELETE(18252) ;

CALL FIELDSINFO_DELETE(18253) ;

CALL FIELDSINFO_DELETE(18254) ;

CALL FIELDSINFO_DELETE(18255) ;

CALL FIELDSINFO_DELETE(18256) ;

CALL FIELDSINFO_DELETE(18257) ;

CALL FIELDSINFO_DELETE(18258) ;

CALL FIELDSINFO_DELETE(18259) ;

CALL FIELDSINFO_DELETE(18260) ;

CALL FIELDSINFO_DELETE(18261) ;

CALL FIELDSINFO_DELETE(18263) ;

CALL FIELDSINFO_DELETE(18264) ;

CALL FIELDSINFO_DELETE(18265) ;

CALL FIELDSINFO_DELETE(18266) ;

CALL FIELDSINFO_DELETE(18267) ;

CALL FIELDSINFO_DELETE(18268) ;

CALL FIELDSINFO_DELETE(18269) ;

CALL FIELDSINFO_DELETE(18270) ;

CALL FIELDSINFO_DELETE(18272) ;

CALL FIELDSINFO_DELETE(18273) ;

CALL FIELDSINFO_DELETE(18274) ;

CALL FIELDSINFO_DELETE(18275) ;

CALL FIELDSINFO_DELETE(18276) ;

CALL FIELDSINFO_DELETE(18278) ;

CALL FIELDSINFO_DELETE(18279) ;

CALL FIELDSINFO_DELETE(18280) ;

CALL FIELDSINFO_DELETE(18282) ;

CALL FIELDSINFO_DELETE(18283) ;

CALL FIELDSINFO_DELETE(18284) ;

CALL FIELDSINFO_DELETE(18285) ;

CALL FIELDSINFO_DELETE(18286) ;

CALL FIELDSINFO_DELETE(18287) ;

CALL FIELDSINFO_DELETE(18288) ;

CALL FIELDSINFO_DELETE(18289) ;

CALL FIELDSINFO_DELETE(18290) ;

CALL FIELDSINFO_DELETE(18291) ;

CALL FIELDSINFO_DELETE(18292) ;

CALL FIELDSINFO_DELETE(18293) ;

CALL FIELDSINFO_DELETE(18294) ;

CALL FIELDSINFO_DELETE(18295) ;

CALL FIELDSINFO_DELETE(18296) ;

CALL FIELDSINFO_DELETE(18297) ;

CALL FIELDSINFO_DELETE(18298) ;

CALL FIELDSINFO_DELETE(18300) ;

CALL FIELDSINFO_DELETE(18301) ;

CALL FIELDSINFO_DELETE(18302) ;

CALL FIELDSINFO_DELETE(18303) ;

CALL FIELDSINFO_DELETE(18304) ;

CALL FIELDSINFO_DELETE(18305) ;

CALL FIELDSINFO_DELETE(18306) ;

CALL FIELDSINFO_DELETE(18307) ;

CALL FIELDSINFO_DELETE(18309) ;

CALL FIELDSINFO_DELETE(18310) ;

CALL FIELDSINFO_DELETE(18311) ;

CALL FIELDSINFO_DELETE(18312) ;

CALL FIELDSINFO_DELETE(18313) ;

CALL FIELDSINFO_DELETE(18314) ;

CALL FIELDSINFO_DELETE(18315) ;

CALL FIELDSINFO_DELETE(18316) ;

CALL FIELDSINFO_DELETE(18317) ;

CALL FIELDSINFO_DELETE(18318) ;

CALL FIELDSINFO_DELETE(18320) ;

CALL FIELDSINFO_DELETE(18321) ;

CALL FIELDSINFO_DELETE(18322) ;

CALL FIELDSINFO_DELETE(18323) ;

CALL FIELDSINFO_DELETE(18324) ;

CALL FIELDSINFO_DELETE(18325) ;

CALL FIELDSINFO_DELETE(18326) ;

CALL FIELDSINFO_DELETE(18327) ;

CALL FIELDSINFO_DELETE(18328) ;

CALL FIELDSINFO_DELETE(18329) ;

CALL FIELDSINFO_DELETE(18330) ;

CALL FIELDSINFO_DELETE(18332) ;

CALL FIELDSINFO_DELETE(18333) ;

CALL FIELDSINFO_DELETE(18334) ;

CALL FIELDSINFO_DELETE(18336) ;

CALL FIELDSINFO_DELETE(18337) ;

CALL FIELDSINFO_DELETE(18338) ;

CALL FIELDSINFO_DELETE(18339) ;

CALL FIELDSINFO_DELETE(18340) ;

CALL FIELDSINFO_DELETE(18341) ;

CALL FIELDSINFO_DELETE(18342) ;

CALL FIELDSINFO_DELETE(18343) ;

CALL FIELDSINFO_DELETE(18345) ;

CALL FIELDSINFO_DELETE(18346) ;

CALL FIELDSINFO_DELETE(18347) ;

CALL FIELDSINFO_DELETE(18348) ;

CALL FIELDSINFO_DELETE(18349) ;

CALL FIELDSINFO_DELETE(18351) ;

CALL FIELDSINFO_DELETE(18352) ;

CALL FIELDSINFO_DELETE(18353) ;

CALL FIELDSINFO_DELETE(18608) ;

CALL FIELDSINFO_DELETE(18609) ;

CALL FIELDSINFO_DELETE(18610) ;

CALL FIELDSINFO_DELETE(18611) ;

CALL FIELDSINFO_DELETE(18612) ;

CALL FIELDSINFO_DELETE(18613) ;

CALL FIELDSINFO_DELETE(18614) ;

CALL FIELDSINFO_DELETE(18615) ;

CALL FIELDSINFO_DELETE(18616) ;

CALL FIELDSINFO_DELETE(18617) ;

CALL FIELDSINFO_DELETE(18618) ;

CALL FIELDSINFO_DELETE(18619) ;

CALL FIELDSINFO_DELETE(18620) ;

CALL FIELDSINFO_DELETE(18621) ;

CALL FIELDSINFO_DELETE(18622) ;

CALL FIELDSINFO_DELETE(18623) ;

CALL FIELDSINFO_DELETE(18624) ;

CALL FIELDSINFO_DELETE(18625) ;

CALL FIELDSINFO_DELETE(18626) ;

CALL FIELDSINFO_DELETE(18674) ;

CALL FIELDSINFO_DELETE(18675) ;

CALL FIELDSINFO_DELETE(18676) ;

CALL FIELDSINFO_DELETE(18677) ;

CALL FIELDSINFO_DELETE(18678) ;

CALL FIELDSINFO_DELETE(18679) ;

CALL FIELDSINFO_DELETE(18680) ;

CALL FIELDSINFO_DELETE(18681) ;

CALL FIELDSINFO_DELETE(18682) ;

CALL FIELDSINFO_DELETE(18683) ;

CALL FIELDSINFO_DELETE(18684) ;

CALL FIELDSINFO_DELETE(18685) ;

CALL FIELDSINFO_DELETE(18687) ;

CALL FIELDSINFO_DELETE(18688) ;

CALL FIELDSINFO_DELETE(18689) ;

CALL FIELDSINFO_DELETE(18690) ;

CALL FIELDSINFO_DELETE(18691) ;

CALL FIELDSINFO_DELETE(18692) ;

CALL FIELDSINFO_DELETE(18693) ;

CALL FIELDSINFO_DELETE(18694) ;

CALL FIELDSINFO_DELETE(18695) ;

CALL FIELDSINFO_DELETE(18696) ;

CALL FIELDSINFO_DELETE(18698) ;

CALL FIELDSINFO_DELETE(18699) ;

CALL FIELDSINFO_DELETE(18700) ;

CALL FIELDSINFO_DELETE(18701) ;

CALL FIELDSINFO_DELETE(18703) ;

CALL FIELDSINFO_DELETE(18704) ;

CALL FIELDSINFO_DELETE(18705) ;

CALL FIELDSINFO_DELETE(18706) ;

CALL FIELDSINFO_DELETE(18708) ;

CALL FIELDSINFO_DELETE(18709) ;

CALL FIELDSINFO_DELETE(18711) ;

CALL FIELDSINFO_DELETE(18712) ;

CALL FIELDSINFO_DELETE(18714) ;

CALL FIELDSINFO_DELETE(18715) ;

CALL FIELDSINFO_DELETE(19743) ;

CALL FIELDSINFO_DELETE(19862) ;

CALL FIELDSINFO_DELETE(20516) ;

CALL FIELDSINFO_DELETE(20517) ;

CALL FIELDSINFO_DELETE(20518) ;

CALL FIELDSINFO_DELETE(20519) ;

CALL FIELDSINFO_DELETE(20520) ;

CALL FIELDSINFO_DELETE(20521) ;

CALL FIELDSINFO_DELETE(20522) ;

CALL FIELDSINFO_DELETE(20523) ;

CALL FIELDSINFO_DELETE(20524) ;

CALL FIELDSINFO_DELETE(20526) ;

CALL FIELDSINFO_DELETE(20527) ;

CALL FIELDSINFO_DELETE(20528) ;

CALL FIELDSINFO_DELETE(20529) ;

CALL FIELDSINFO_DELETE(20530) ;

CALL FIELDSINFO_DELETE(20531) ;

CALL FIELDSINFO_DELETE(20532) ;

CALL FIELDSINFO_DELETE(20533) ;

CALL FIELDSINFO_DELETE(20534) ;

CALL FIELDSINFO_DELETE(20535) ;

CALL FIELDSINFO_DELETE(20536) ;

CALL FIELDSINFO_DELETE(20537) ;

CALL FIELDSINFO_DELETE(20538) ;

CALL FIELDSINFO_DELETE(32274) ;

CALL FIELDSINFO_DELETE(32343) ;

CALL FIELDSINFO_DELETE(32344) ;

CALL FIELDSINFO_DELETE(32348) ;

CALL FIELDSINFO_DELETE(32349) ;

CALL FIELDSINFO_DELETE(32350) ;

CALL FIELDSINFO_DELETE(32351) ;

CALL FIELDSINFO_DELETE(32352) ;

CALL FIELDSINFO_DELETE(32353) ;

CALL FIELDSINFO_DELETE(32354) ;

CALL FIELDSINFO_DELETE(32355) ;

CALL FIELDSINFO_DELETE(32356) ;

CALL FIELDSINFO_DELETE(32357) ;

CALL FIELDSINFO_DELETE(32358) ;

CALL FIELDSINFO_DELETE(32359) ;

CALL FIELDSINFO_DELETE(32882) ;

CALL FIELDSINFO_DELETE(32883) ;

CALL FIELDSINFO_DELETE(32890) ;

CALL FIELDSINFO_DELETE(34406) ;

CALL FIELDSINFO_DELETE(34409) ;

CALL FIELDSINFO_DELETE(34418) ;

CALL FIELDSINFO_DELETE(34421) ;

CALL FIELDSINFO_DELETE(34430) ;

CALL FIELDSINFO_DELETE(34431) ;

CALL FIELDSINFO_DELETE(34432) ;

CALL FIELDSINFO_DELETE(34445) ;

CALL FIELDSINFO_DELETE(34454) ;

CALL FIELDSINFO_DELETE(34455) ;

CALL FIELDSINFO_DELETE(34468) ;

CALL FIELDSINFO_DELETE(34479) ;

CALL FIELDSINFO_DELETE(34480) ;

CALL FIELDSINFO_DELETE(34493) ;

CALL FIELDSINFO_DELETE(34501) ;

CALL FIELDSINFO_DELETE(34502) ;

CALL FIELDSINFO_DELETE(34516) ;

CALL FIELDSINFO_DELETE(34523) ;

CALL FIELDSINFO_DELETE(34524) ;

CALL FIELDSINFO_DELETE(34538) ;

CALL FIELDSINFO_DELETE(34546) ;

CALL FIELDSINFO_DELETE(34547) ;

CALL FIELDSINFO_DELETE(34561) ;

CALL FIELDSINFO_DELETE(34569) ;

CALL FIELDSINFO_DELETE(34570) ;

CALL FIELDSINFO_DELETE(34583) ;

CALL FIELDSINFO_DELETE(34594) ;

CALL FIELDSINFO_DELETE(34597) ;

CALL FIELDSINFO_DELETE(34609) ;

CALL FIELDSINFO_DELETE(34617) ;

CALL FIELDSINFO_DELETE(34618) ;

CALL FIELDSINFO_DELETE(34630) ;

CALL FIELDSINFO_DELETE(34644) ;

CALL FIELDSINFO_DELETE(34647) ;

CALL FIELDSINFO_DELETE(34648) ;

CALL FIELDSINFO_DELETE(34676) ;

CALL FIELDSINFO_DELETE(34679) ;

CALL FIELDSINFO_DELETE(34680) ;

CALL FIELDSINFO_DELETE(34733) ;

CALL FIELDSINFO_DELETE(34736) ;

CALL FIELDSINFO_DELETE(34737) ;

CALL FIELDSINFO_DELETE(34754) ;

CALL FIELDSINFO_DELETE(34757) ;

CALL FIELDSINFO_DELETE(34758) ;

CALL FIELDSINFO_DELETE(34773) ;

CALL FIELDSINFO_DELETE(34776) ;

CALL FIELDSINFO_DELETE(34777) ;

CALL FIELDSINFO_DELETE(34794) ;

CALL FIELDSINFO_DELETE(34797) ;

CALL FIELDSINFO_DELETE(34798) ;

CALL FIELDSINFO_DELETE(34815) ;

CALL FIELDSINFO_DELETE(34818) ;

CALL FIELDSINFO_DELETE(34819) ;

CALL FIELDSINFO_DELETE(34835) ;

CALL FIELDSINFO_DELETE(34838) ;

CALL FIELDSINFO_DELETE(34839) ;

CALL FIELDSINFO_DELETE(34928) ;

CALL FIELDSINFO_DELETE(34932) ;

CALL FIELDSINFO_DELETE(34936) ;

CALL FIELDSINFO_DELETE(34940) ;

CALL FIELDSINFO_DELETE(35039) ;

CALL FIELDSINFO_DELETE(35040) ;

CALL FIELDSINFO_DELETE(35115) ;

CALL SELECTIONS_DELETE(18055) ;

CALL SELECTIONS_DELETE(18097) ;

CALL SELECTIONS_DELETE(18153) ;

CALL SELECTIONS_DELETE(18170) ;

CALL SELECTIONS_DELETE(18189) ;

CALL SELECTIONS_DELETE(18197) ;

CALL SELECTIONS_DELETE(18212) ;

CALL SELECTIONS_DELETE(18226) ;

CALL SELECTIONS_DELETE(18235) ;

CALL SELECTIONS_DELETE(18246) ;

CALL SELECTIONS_DELETE(18250) ;

CALL SELECTIONS_DELETE(18262) ;

CALL SELECTIONS_DELETE(18271) ;

CALL SELECTIONS_DELETE(18277) ;

CALL SELECTIONS_DELETE(18281) ;

CALL SELECTIONS_DELETE(18299) ;

CALL SELECTIONS_DELETE(18308) ;

CALL SELECTIONS_DELETE(18319) ;

CALL SELECTIONS_DELETE(18331) ;

CALL SELECTIONS_DELETE(18335) ;

CALL SELECTIONS_DELETE(18344) ;

CALL SELECTIONS_DELETE(18350) ;

CALL SELECTIONS_DELETE(18607) ;

CALL SELECTIONS_DELETE(18673) ;

CALL SELECTIONS_DELETE(18686) ;

CALL SELECTIONS_DELETE(18697) ;

CALL SELECTIONS_DELETE(18702) ;

CALL SELECTIONS_DELETE(18707) ;

CALL SELECTIONS_DELETE(18710) ;

CALL SELECTIONS_DELETE(18713) ;

CALL SELECTIONS_DELETE(20515) ;

CALL SELECTIONS_DELETE(20525) ;

CALL SELECTIONS_IMPORT(16642, 1, 'ORGANIZATIONS', 'Организации', 0, 0, 'ORGANIZATIONS', 'Organizations', 27, 0, 0, 2, '', 1, 1, 600, null, 5, '"PERSISTENT=REFRESHMINCHANGEDROWS=100,REFRESHMINCHANGEDPERCENT=5"', '', null, 0) ;

CALL SELECTIONS_IMPORT(16688, 1, 'REGIONCLS', 'Районы', 0, 0, 'REGIONCLS', 'regionCLS', 18, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16700, 1, 'SINGLE', 'Таблица с одной записью', 1, 0, 'SINGLE', 'Single', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16702, 1, 'DATABASEVERSION', 'Версии БД', 0, 0, 'DATABASEVERSION', 'DBVersion', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16708, 1, 'DBUSERS', 'Пользователи', 0, 0, 'DBUSERS', 'DbUsers', 100, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16722, 1, 'INTERFACES', 'Интерфейсы', 0, 0, 'INTERFACES', 'Interfaces', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16729, 1, 'PERMISSIONS', 'Старые права', 0, 0, 'PERMISSIONS', 'PERMISSIONS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16734, 1, 'WORKPLACES', 'Рабочие места', 0, 0, 'WORKPLACES', 'Workplaces', 0, 0, 0, 1, '', 1, 1, 3600, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16738, 1, 'WORKPLACES_INTERFACE', 'Интерфейсы на рабочих местах', 0, 0, 'WORKPLACES_INTERFACE', 'WORKPLACES_INTERFACE', 0, 0, 0, 1, '', 1, 1, 3600, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16744, 1, 'USER_WORKPLACES', 'Рабочие места пользователей', 0, 0, 'USER_WORKPLACES', 'USER_WORKPLACES', 0, 0, 0, 1, '', 1, 1, 3600, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16749, 1, 'WORKPLACES_NEWREPORTS', 'Отчеты на рабочих местах', 0, 0, 'WORKPLACES_NEWREPORTS', 'WorkPlaces_NewReports', 0, 0, 0, 1, '', 1, 1, 3600, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16755, 1, 'INTCONST', 'Целые константы', 0, 0, 'INTCONST', 'IntConst', 0, 0, 0, 2, '', 1, 1, -1, -1, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16762, 1, 'VARCHARCONST', 'Строковые константы', 0, 0, 'VARCHARCONST', 'VarCharConst', 0, 0, 0, 2, '', 1, 1, -1, -1, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16767, 1, 'REALCONST', 'Вещественные константы', 0, 0, 'REALCONST', 'RealConst', 0, 0, 0, 1, '', 1, 1, -1, -1, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16777, 1, 'REGUSERS', 'Журнал работы пользователей', 0, 0, 'REGUSERS', 'REGUSERS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23400, 1, 'WRITEXECUTIONCAPTION', 'Заголовки документов исполнения', 0, 0, 'WRITEXECUTIONCAPTION', 'WRITEXECUTIONCAPTION', 1410, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23401, 1, 'WRITEXECUTIONDETAIL', 'Детализации документов исполнения', 0, 0, 'WRITEXECUTIONDETAIL', 'WRITEXECUTIONDETAIL', 5102, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16803, 1, 'BUDGETS_S', 'Бюджеты', 0, 0, 'BUDGETS_S', 'Budgets_s', 178, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16814, 1, 'DOCTYPES', 'Тип документа', 0, 0, 'DOCTYPES', 'DocTypes', 1, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16824, 1, 'KD', 'Код дохода', 0, 0, 'KD', 'KD', 80, 0, 0, 2, '', 1, 1, 600, null, 5, '"PERSISTENT=REFRESHMINCHANGEDROWS=100,REFRESHMINCHANGEDPERCENT=5"', '', null, 0) ;

CALL SELECTIONS_IMPORT(16844, 1, 'KFSR', 'ФКР', 0, 0, 'KFSR', 'kfsr', 2, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16851, 1, 'KVSR', 'КВСР', 0, 0, 'KVSR', 'KVSR', 3, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16857, 1, 'KCSR', 'КЦСР', 0, 0, 'KCSR', 'KCSR', 4, 0, 0, 2, '', 1, 1, 1800, null, 5, '"PERSISTENT=REFRESHMINCHANGEDROWS=100,REFRESHMINCHANGEDPERCENT=5"', '', null, 0) ;

CALL SELECTIONS_IMPORT(16864, 1, 'KVR', 'КВР', 0, 0, 'KVR', 'KVR', 5, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16871, 1, 'KESR', 'КОСГУ', 0, 0, 'KESR', 'KESR', 6, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16883, 1, 'KSHK', 'Сети и штаты', 0, 0, 'KSHK', 'KSHK', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16886, 1, 'SUBKCSR', 'Суб КЦСР', 0, 0, 'SUBKCSR', 'SUBKCSR', 0, 0, 0, 1, '', 1, 1, 1800, -1, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16901, 1, 'REFCLS', 'Справочно', 0, 0, 'REFCLS', 'REFCLS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16904, 1, 'MEANSCLS', 'Основные средства', 0, 0, 'MEANSCLS', 'MeansCLS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16907, 1, 'VALUECLS', 'Материальные ценности', 0, 0, 'VALUECLS', 'VALUECLS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16910, 1, 'BUDGETACCOUNTS', 'Бюджетный счет', 0, 0, 'BUDGETACCOUNTS', 'BudAccounts', 158, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16915, 1, 'KESRSUBCODE', 'Суб КОСГУ', 0, 0, 'KESRSUBCODE', 'KESRSubCode', 7, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16920, 1, 'ACCOUNTPLAN', 'Устарело. Старый план счетов', 0, 0, 'ACCOUNTPLAN', 'ACCOUNTPLAN', 71, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16928, 1, 'SUBKD', 'Суб КД', 0, 0, 'SUBKD', 'SubKD', 159, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16937, 1, 'CURRENCYCLS', 'Код валюты', 0, 0, 'CURRENCYCLS', 'CurrencyCLS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16945, 1, 'REPORTTYPE', 'Устарело. Тип отчета', 0, 0, 'REPORTTYPE', 'ReportType', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16948, 1, 'GOSNI', 'ГОСНИ', 0, 0, 'GOSNI', 'GOSNI', 157, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16955, 1, 'FINTYPE', 'Код дополнительной информации', 0, 0, 'FINTYPE', 'FinType', 8, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16964, 1, 'FACT', 'Мероприятие', 0, 0, 'FACT', 'FACT', 9, 0, 0, 2, '', 1, 1, 600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16973, 1, 'DOCBASE', 'Нормативно-правовые акты', 0, 0, 'DOCBASE', 'DocBase', 29, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16983, 1, 'NOTIFYTYPES', 'Источники финансирования', 0, 0, 'NOTIFYTYPES', 'NOTIFYTYPES', 10, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16988, 1, 'ORG_CLS', 'Тип организации', 0, 0, 'ORG_CLS', 'ORG_CLS', 31, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(16996, 1, 'ACC_CLS', 'Код расчетного счета', 0, 0, 'ACC_CLS', 'Acc_CLS', 1403, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17005, 1, 'GROUPINF_CLS', 'Группа информации', 0, 0, 'GROUPINF_CLS', 'GroupInf_CLS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17010, 1, 'BUDGETTYPE', 'Вид бюджета', 0, 0, 'BUDGETTYPE', 'BUDGETTYPE', 0, 0, 0, 1, '', 1, 1, 3600, -1, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17016, 1, 'PAYTYPECLS', 'Виды платежей', 0, 0, 'PAYTYPECLS', 'PayTypeCls', 12, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17021, 1, 'ORG_ACCDEFAULTS', 'Умолчания расчетных счетов', 0, 0, 'ORG_ACCDEFAULTS', 'Org_AccDefaults', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17026, 1, 'REJECTCLS', 'Причина отклонения', 0, 0, 'REJECTCLS', 'RejectCLS', 17, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17034, 1, 'ERROR', 'Коды ошибок', 0, 0, 'ERROR', 'Error', 143, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17043, 1, 'INNERFINSOURCE', 'ИФДБ', 0, 0, 'INNERFINSOURCE', 'InnerFinSource', 145, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17062, 1, 'PAYSYMBOLCLS', 'Кассовые символы', 0, 0, 'PAYSYMBOLCLS', 'PAYSYMBOLCLS', 14, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17069, 1, 'BUHPAYMENTCLS', 'Старая бух проводка', 0, 0, 'BUHPAYMENTCLS', 'BuhPaymentCls', 16, 0, 0, 2, '', 2, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17076, 1, 'ACCOUNTSCORR', 'Корреспонденция бухгалтерских счетов ', 0, 0, 'ACCOUNTSCORR', 'AccountsCorr', 72, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17084, 1, 'PAYDESTINATIONCLS', 'Назначения платежа', 0, 0, 'PAYDESTINATIONCLS', 'PayDestinationCLS', 0, 0, 0, 2, '', 1, 1, 3600, -1, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17094, 1, 'TYPEOPERATIONCLS', 'Вид операции', 0, 0, 'TYPEOPERATIONCLS', 'TYPEOPERATIONCLS', 15, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17099, 1, 'BANKS', 'Банки', 0, 0, 'BANKS', 'Banks', 20, 0, 0, 2, '', 1, 1, 1800, null, 5, '"PERSISTENT=REFRESHMINCHANGEDROWS=100,REFRESHMINCHANGEDPERCENT=5"', '', null, 0) ;

CALL SELECTIONS_IMPORT(17108, 1, 'ORG_ACCOUNTS', 'Расчетные счета', 0, 0, 'ORG_ACCOUNTS', 'Org_Accounts', 21, 0, 0, 2, '', 1, 1, 100, null, 5, '"PERSISTENT=REFRESHMINCHANGEDROWS=100,REFRESHMINCHANGEDPERCENT=5"', '', null, 0) ;

CALL SELECTIONS_IMPORT(17129, 1, 'FACIALACC_CLS', 'Лицевой счет', 0, 0, 'FACIALACC_CLS', 'FacialAcc_Cls', 19, 0, 0, 2, '', 1, 1, 600, null, 5, '"PERSISTENT=REFRESHMINCHANGEDROWS=50,REFRESHMINCHANGEDPERCENT=5"', '', null, 0) ;

CALL SELECTIONS_IMPORT(17164, 1, 'PAYDOC32', 'Старые платежные поручения', 0, 0, 'PAYDOC32', 'PayDoc32', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17204, 1, 'PAYDOCTEMPLATES', 'Устарело. Шаблоны п/п ', 0, 0, 'PAYDOCTEMPLATES', 'PAYDOCTEMPLATES', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17218, 1, 'EXCHANGENUMBER', 'Обменные номера ', 0, 0, 'EXCHANGENUMBER', 'EXCHANGENUMBER', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17225, 1, 'PAYDOCEXCHANGE', 'Обмен с банком платежками ', 0, 0, 'PAYDOCEXCHANGE', 'PayDocExchange', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17243, 1, 'MUTNOTIFCAPT', 'Устарело. Уведомления по взаимным расчетам', 0, 0, 'MUTNOTIFCAPT', 'MUTNOTIFCAPT', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17259, 1, 'RPS_DOCUMENT_JOURNAL', 'Устарело. Журнализация ', 0, 0, 'RPS_DOCUMENT_JOURNAL', 'RPS_DOCUMENT_JOURNAL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17265, 1, 'DFACCOUNTSBUHTABLE', 'Счета ФО', 0, 0, 'DFACCOUNTSBUHTABLE', 'DFAccBuhTable', 73, 0, 0, 2, '', 1, 1, 600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17286, 1, 'DFACCOUNTOPERATION', 'Операции между расчетными счетами ФО', 0, 0, 'DFACCOUNTOPERATION', 'DFAccountOperation', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17301, 1, 'ACCSOPERTITLE', 'Формирование п\п связанных со счетамти ФО. Заголовок ', 0, 0, 'ACCSOPERTITLE', 'AccsOperTitle', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17311, 1, 'MEANSTYPE', 'Тип средств бюджета', 0, 0, 'MEANSTYPE', 'MEANSTYPE', 13, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17321, 1, 'BUH_JOURNAL', 'Устарело. Журнал бухгалтерии ', 0, 0, 'BUH_JOURNAL', 'Buh_Journal', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17402, 1, 'MEM_WARRANT', 'Устарело. Мемориальные ордера', 0, 0, 'MEM_WARRANT', 'Mem_warrant', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17408, 1, 'BUDGETDATA', 'Плановые документы детализация ', 0, 0, 'BUDGETDATA', 'BudgetData', 26, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 1) ;

CALL SELECTIONS_IMPORT(17463, 1, 'BUDNOTIFY', 'Плановые документы заголовки', 0, 0, 'BUDNOTIFY', 'BudNotify', 28, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 1) ;

CALL SELECTIONS_IMPORT(17511, 1, 'INCOMESDATA', 'Устарело. Доходы план', 0, 0, 'INCOMESDATA', 'IncomesData', 164, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17583, 1, 'PROMISE_CAPTION', 'Заголовки бюджетных обязательств ', 0, 0, 'PROMISE_CAPTION', 'Promise_Caption', 77, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17616, 1, 'INCOMESNOTIF', 'Устарело. Уведомления об изменении плана доходов ', 0, 0, 'INCOMESNOTIF', 'IncomesNotif', 163, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17643, 1, 'QUOTESTITLE', 'Заголовки выписок по доходам', 0, 0, 'QUOTESTITLE', 'QuotesTitle', 160, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 1) ;

CALL SELECTIONS_IMPORT(17668, 1, 'INCOMES32', 'Доходы (факт) ', 0, 0, 'INCOMES32', 'Incomes32', 161, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 1) ;

CALL SELECTIONS_IMPORT(17744, 1, 'SUMINPASSAGE', 'Суммы в пути ', 0, 0, 'SUMINPASSAGE', 'SumInPassage', 162, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17772, 1, 'SCHEMEBUHCACH', 'Устарело. Кэш бухгалтерии (схема) ', 0, 0, 'SCHEMEBUHCACH', 'SCHEMEBUHCACH', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17784, 1, 'INCTEMPLATETITLE', 'Устарело. Шаблоны доходов (заголовки) ', 0, 0, 'INCTEMPLATETITLE', 'incTemplateTitle', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17796, 1, 'INCTEMPLATEDETAIL', 'Устарело. Шаблоны доходов (детализация) ', 0, 0, 'INCTEMPLATEDETAIL', 'incTemplateDetail', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17810, 1, 'EXEMPTIONTITLE', 'Основная таблица данных', 0, 0, 'EXEMPTIONTITLE', 'EXEMPTIONTITLE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17821, 1, 'FINDOCDETAIL', 'Финансирование детализация', 0, 0, 'FINDOCDETAIL', 'FinDocDetail', 24, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17876, 1, 'FINDOCCAPTION', 'Финансирование заголовок', 0, 0, 'FINDOCCAPTION', 'FinDocCaption', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17896, 1, 'MUTNOTIFDETAIL', 'Устарело. Уведомления по взаимным расчетам (детализация)', 0, 0, 'MUTNOTIFDETAIL', 'MUTNOTIFDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17942, 1, 'VZ_OFFSET', 'Устарело. Взаимозачёты', 0, 0, 'VZ_OFFSET', 'Vz_Offset', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17956, 1, 'INCOMES_ARREARS', 'Устарело. Таблица задолженностей', 0, 0, 'INCOMES_ARREARS', 'Incomes_arrears', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(17959, 1, 'LOANCREDIT', 'Устарело. Ссуды/кредиты заголовок', 0, 0, 'LOANCREDIT', 'LoanCredit', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18005, 1, 'ADMISSION', 'Устарело. Средства полученные', 0, 0, 'ADMISSION', 'Admission', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18037, 1, 'OTHBUDNOTIFCAPTION', 'Устарело. Уведомления по взаимным расчетам заголовок', 0, 0, 'OTHBUDNOTIFCAPTION', 'OthBudNotifCaption', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18074, 1, 'OTHBUDNOTIFDETAIL', 'Устарело. уведомлений по взаимным расчетам Детализация ', 0, 0, 'OTHBUDNOTIFDETAIL', 'OthBudNotifDetail', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18122, 1, 'LOANCREDITPERCENTS', 'Устарело. Ссуды/кредиты - начисленные проценты ', 0, 0, 'LOANCREDITPERCENTS', 'LoanCreditPercents', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18354, 1, 'CURRENCYEXCHANGE', 'Курсы валют', 0, 0, 'CURRENCYEXCHANGE', 'CurrencyExchange', 0, 0, 0, 1, '', 1, 1, 600, -1, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18365, 1, 'ACCCUROPERATION', 'Операции с валютными счетами', 0, 0, 'ACCCUROPERATION', 'AccCurOperation', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18371, 1, 'CURRENCYINCOMES', 'Надстройка к доходам', 0, 0, 'CURRENCYINCOMES', 'CurrencyIncomes', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18377, 1, 'ORGOPERAT', 'Оперативные данные', 0, 0, 'ORGOPERAT', 'ORGOPERAT', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18414, 1, 'BILLS', 'Устарело. Приходы по векселям. Заголовки', 0, 0, 'BILLS', 'Bills', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18427, 1, 'BILLS_DET', 'Устарело. Данных по векселям. Детализация', 0, 0, 'BILLS_DET', 'Bills_Det', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18446, 1, 'BILL_ACCORDDOC', 'Устарело. Соглашения на финансирование векселями. Заголовки. ', 0, 0, 'BILL_ACCORDDOC', 'Bill_AccordDoc', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18459, 1, 'VZFINCAPTION', 'Устарело. Взаимозачёты заголовок', 0, 0, 'VZFINCAPTION', 'VZFINCAPTION', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18469, 1, 'ORGSHARECAPTION', 'Устарело. Состояние расчетных счетов распорядителей кредитов ', 0, 0, 'ORGSHARECAPTION', 'OrgShareCaption', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18477, 1, 'ORGSHAREDETAIL', 'Устарело. Состояние расчетных счетов распорядителей кредитов (детализация) ', 0, 0, 'ORGSHAREDETAIL', 'OrgShareDetail', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(27814, 1, 'BUDALLOCATIONCLS', 'Коды бюджетных ассигнований', 0, 0, 'BUDALLOCATIONCLS', 'BUDALLOCATIONCLS', 221, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(27815, 1, 'PAYPROMISECLS', 'Коды расходных обязательств', 0, 0, 'PAYPROMISECLS', 'PAYPROMISECLS', 222, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(27816, 1, 'UCONSCHAINSCAPTION', '', 0, 0, 'UCONSCHAINSCAPTION', 'UCONSCHAINSCAPTION', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18577, 1, 'MONTHREPORTCAPTION', 'Устарело. Таблица-заголовок месячных отчетов', 0, 0, 'MONTHREPORTCAPTION', 'MONTHREPORTCAPTION', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18591, 1, 'MONTHREPORTDETAIL', 'Устарело. Таблица детализации месячных отчетов', 0, 0, 'MONTHREPORTDETAIL', 'MONTHREPORTDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18627, 1, 'LIMITFINDETAIL', 'Устарело. Детализация лимитов(заявок и уточнений)', 0, 0, 'LIMITFINDETAIL', 'LimitFinDetail', 25, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18716, 1, 'REQUESTFINCAPTION', 'Заявки на финансирование заголовок', 0, 0, 'REQUESTFINCAPTION', 'RequestFinCaption', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18732, 1, 'LIMITNOTIFYCAPTION', 'Устарело. Заголовки уточнений лимитов на финансирование', 0, 0, 'LIMITNOTIFYCAPTION', 'LimitNotifyCaption', 75, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18765, 1, 'LIMITFINCAPTION', 'Устарело. Даты принятия лимитов на финансирование', 0, 0, 'LIMITFINCAPTION', 'LimitFinCaption', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18793, 1, 'FINCLAIM', 'Устарело. Налоги бюджета заголовок', 0, 0, 'FINCLAIM', 'FinClaim', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18803, 1, 'FINCLAIMDET', 'Устарело. Налоги бюджета детализация', 0, 0, 'FINCLAIMDET', 'FinClaimDet', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18816, 1, 'FINTENDER', 'Заявки на финансирование заголовок', 0, 0, 'FINTENDER', 'FinTender', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18826, 1, 'FINTENDERDET', 'Заявки на финансирование детализация', 0, 0, 'FINTENDERDET', 'FinTenderDet', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18860, 1, 'FINTENDERORG', 'Цепочка организаций, через которые проходит зачет', 0, 0, 'FINTENDERORG', 'FinTenderOrg', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18864, 1, 'FACIALFINDETAIL', 'Казначейство детализация', 0, 0, 'FACIALFINDETAIL', 'FacialFinDet', 22, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 1) ;

CALL SELECTIONS_IMPORT(18937, 1, 'CARDS', 'Корпоративные карты заголовок', 0, 0, 'CARDS', 'Cards', 30, 0, 0, 2, '', 1, 1, 100, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(18947, 1, 'FACIALFINCAPTION', 'Казначейство заголовок', 0, 0, 'FACIALFINCAPTION', 'FacialFinCpt', 23, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 1) ;

CALL SELECTIONS_IMPORT(19016, 1, 'PROMISE_DETAIL', 'Расшифровка договоров', 0, 0, 'PROMISE_DETAIL', 'Promise_Det', 76, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19088, 1, 'FACIALFINREESTR', 'Реестры казначейства', 0, 0, 'FACIALFINREESTR', 'FacialFinReestr', 191, 0, 0, 2, '', 1, 1, 3, 30, null, '"PERSISTENT=REFRESHMINCHANGEDROWS=100,REFRESHMINCHANGEDPERCENT=5"', '', null, 0) ;

CALL SELECTIONS_IMPORT(19110, 1, 'PERCENTJOURNAL', 'Журнал процентных ставок ', 0, 0, 'PERCENTJOURNAL', 'PercentJournal', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19123, 1, 'REQUESTS', 'Заявки', 0, 0, 'REQUESTS', 'Requests', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19182, 1, 'DEBT', 'Устарело. Источники заимствований', 0, 0, 'DEBT', 'Debt', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19221, 1, 'LOANCREDITPLAN', 'Устарело. Плапн погашения кредита', 0, 0, 'LOANCREDITPLAN', 'LOANCREDITPLAN', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19234, 1, 'REQUESTSPAYMENTS', 'Оплаты заявок', 0, 0, 'REQUESTSPAYMENTS', 'RequestsPayments', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19242, 1, 'DELRECINDEXES', 'Журнал удаления данных', 0, 0, 'DELRECINDEXES', 'DELRECINDEXES', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(27817, 1, 'UCONSCHAINSDETAIL', '', 0, 0, 'UCONSCHAINSDETAIL', 'UCONSCHAINSDETAIL', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19295, 1, 'BANKEXCH_MERDOC', 'Обмен с банком. Таблица буфферизации данных из входящих пакетов A, B, C', 0, 0, 'BANKEXCH_MERDOC', 'BANKEXCH_MERDOC', 1407, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19387, 1, 'BANKEXCH_REOUT', 'Обмен с банком Таблица буфферизации данных из V пакета', 0, 0, 'BANKEXCH_REOUT', 'BANKEXCH_REOUT', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19441, 1, 'BANKEXCH_LS_KB', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_LS_KB', 'BANKEXCH_LS_KB', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19476, 1, 'BANKEXCH_KO_SALDO', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_KO_SALDO', 'BANKEXCH_KO_SALDO', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19497, 1, 'BANKEXCH_MERKWI', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_MERKWI', 'BANKEXCH_MERKWI', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19516, 1, 'BANKEXCH_POST', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_POST', 'BANKEXCH_POST', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19535, 1, 'BANKEXCH_QUERY', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_QUERY', 'BANKEXCH_QUERY', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19556, 1, 'BANKEXCH_CONFIRM', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_CONFIRM', 'BANKEXCH_CONFIRM', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19582, 1, 'BANKEXCH_QUEUE', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_QUEUE', 'BANKEXCH_QUEUE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19609, 1, 'UFK_VP', 'Информация о зачислении, списании и передвижке средств в ОФК ', 0, 0, 'UFK_VP', 'UFK_VP', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19639, 1, 'UFK_RM', 'Оборотно-сальдовая ведомость по лицевым счетам', 0, 0, 'UFK_RM', 'UFK_RM', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19661, 1, 'UFK_SVOD', 'Информация по доходам бюджета ', 0, 0, 'UFK_SVOD', 'UFK_SVOD', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19684, 1, 'BNKINPUTDOC_JOURNAL', 'Журнал принятых из банка пакетов', 0, 0, 'BNKINPUTDOC_JOURNAL', 'BnkInputDoc_Journal', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19688, 1, 'BNKOUTPUTDOC_JOURNAL', 'Журнал принятых из банка пакетов', 0, 0, 'BNKOUTPUTDOC_JOURNAL', 'BnkOutputDoc_Journal', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19695, 1, 'BNK_DSIGNDOCUMENTS', 'Подписанные документы, принятые из банка', 0, 0, 'BNK_DSIGNDOCUMENTS', 'Bnk_DSignDocuments', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19705, 1, 'REESTRTYPE', 'Тип реестра', 0, 0, 'REESTRTYPE', 'REESTRTYPE', 190, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19714, 1, 'OKDP', 'ОКДП', 0, 0, 'OKDP', 'OKDP', 82, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19729, 1, 'REMOTEDOCUMENT', 'Настройки схем обработки документов ', 0, 0, 'REMOTEDOCUMENT', 'RemoteDocument', 50, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19736, 1, 'EXECUTIONDOCUMENTSCAPTION', 'Документы исполнения - заголовок', 0, 0, 'EXECUTIONDOCUMENTSCAPTION', 'ExecutionDocumentsCaption', 114, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19786, 1, 'DEPARTMENTCLS', 'Отдел', 0, 0, 'DEPARTMENTCLS', 'DepartmentCLS', 1412, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19795, 1, 'AGREEMENTS', 'Договор-заголовок ', 0, 0, 'AGREEMENTS', 'Agreements', 110, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(27818, 1, 'UCONSGROUPSCAPTION', '', 0, 0, 'UCONSGROUPSCAPTION', 'UCONSGROUPSCAPTION', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19876, 1, 'UFK_LOGCAPTION', 'Таблица импорта. Заголовок', 0, 0, 'UFK_LOGCAPTION', 'UFK_LogCaption', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19891, 1, 'UFK_LOGDETAIL', 'Таблица импорта. Детализация', 0, 0, 'UFK_LOGDETAIL', 'UFK_LogDetail', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19909, 1, 'INCCURRENCY', 'Устарело. Изменения курсовой разницы', 0, 0, 'INCCURRENCY', 'IncCurrency', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19980, 1, 'KDSHIFR', 'Поступление доходов в областной бюджет', 0, 0, 'KDSHIFR', 'KDSHIFR', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19988, 1, 'OLDINCOMES', 'Устарело. Таблица для хранения информации по дохдам за прошлый год', 0, 0, 'OLDINCOMES', 'OLDINCOMES', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(19994, 1, 'KDSHIFRDETAIL', 'Связь шифра с кодами дохода', 0, 0, 'KDSHIFRDETAIL', 'KDSHIFRDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(27819, 1, 'UCONSGROUPSDETAIL', '', 0, 0, 'UCONSGROUPSDETAIL', 'UCONSGROUPSDETAIL', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20054, 1, 'REMOTECLIENT', 'Cписок удаленных клиентов ', 0, 0, 'REMOTECLIENT', 'RemoteClient', 58, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20071, 1, 'CBPERCENTJOURNAL', 'Журнал процентов Центробанка ', 0, 0, 'CBPERCENTJOURNAL', 'CBPERCENTJOURNAL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20107, 1, 'AGREEMENTSTEPS', 'Этапы договора', 0, 0, 'AGREEMENTSTEPS', 'AgreementSteps', 111, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20127, 1, 'ESTIMATE', 'Смета', 0, 0, 'ESTIMATE', 'ESTIMATE', 112, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20153, 1, 'EXECUTIONDOCUMENTSDETAIL', 'Документы исполнения - деталь', 0, 0, 'EXECUTIONDOCUMENTSDETAIL', 'ExecutionDocumentsDetail', 115, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20173, 1, 'LOANTYPE', 'Устарело. Вид ссуды', 0, 0, 'LOANTYPE', 'LOANTYPE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20182, 1, 'DEBTTYPE', 'Устарело. Вид заимствования', 0, 0, 'DEBTTYPE', 'DEBTTYPE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20191, 1, 'REMOTEINPUTRIGHT', '', 0, 0, 'REMOTEINPUTRIGHT', 'RemoteInputRight', 60, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20201, 1, 'REMOTEREADRIGHT', 'Добавление нового типа задачи', 0, 0, 'REMOTEREADRIGHT', 'RemoteReadRight', 59, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20211, 1, 'REMOTECLIENTACCOUNT', 'Счета удаленных клиентов', 0, 0, 'REMOTECLIENTACCOUNT', 'RemoteClientAccount', 62, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20221, 1, 'PAYMENTSCHEDULE', 'График выплат по договору ', 0, 0, 'PAYMENTSCHEDULE', 'PaymentSchedule', 113, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20344, 1, 'OBJECTCAPTION', 'Объекты заголовок', 0, 0, 'OBJECTCAPTION', 'objectcaption', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20350, 1, 'OBJECTDETAIL', 'Объекты детализация', 0, 0, 'OBJECTDETAIL', 'objectdetail', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20387, 1, 'UFK_SVERKA', 'Ввод остатков по расчетным счетам ', 0, 0, 'UFK_SVERKA', 'UFK_SVERKA', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20400, 1, 'BUDSTRUCT', 'Таблица для справочника Структура расходной части бюджета', 0, 0, 'BUDSTRUCT', 'BUDSTRUCT', 141, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20418, 1, 'OKATO', 'ОКАТО', 0, 0, 'OKATO', 'OKATO', 116, 0, 0, 2, '', 2, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20428, 1, 'TREASUARYDOCSTATE', 'Устарело. Добавление нового линейного классификатора - состояние казначейского документа', 0, 0, 'TREASUARYDOCSTATE', 'TREASUARYDOCSTATE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20433, 1, 'COLLATERALTYPE', 'Тип обеспечения', 0, 0, 'COLLATERALTYPE', 'COLLATERALTYPE', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20441, 1, 'CLIENTDFACCOUNTLIST', 'Таблица соответствия счетов ФО форматам электронного обмена', 0, 0, 'CLIENTDFACCOUNTLIST', 'ClientDFAccountList', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20449, 1, 'PAPEROPERATION', 'Устарело. Ценные бумаги (содержится информация о покупке и продаже векселей)', 0, 0, 'PAPEROPERATION', 'PaperOperation', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20480, 1, 'COLLATERAL', 'Обеспечение (залог, поручиетельство и т.п.) кредитного договора', 0, 0, 'COLLATERAL', 'COLLATERAL', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20497, 1, 'MANAGERBID', 'Устарело. Распорядительные заявки ', 0, 0, 'MANAGERBID', 'ManagerBid', 78, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20510, 1, 'REPORTSPERMISSIONS', 'Устарело. Настройки параметров для отчетов', 0, 0, 'REPORTSPERMISSIONS', 'REPORTSPERMISSIONS', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20539, 1, 'ITF_DOCS', 'Печатные документы', 0, 0, 'ITF_DOCS', 'Itf_Docs', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(27820, 1, 'UCONSSUBJECTFORMS', '', 0, 0, 'UCONSSUBJECTFORMS', 'UCONSSUBJECTFORMS', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20554, 1, 'COMPOUNDCLS', 'Группа статей экономической классификации ', 0, 0, 'COMPOUNDCLS', 'CompoundCls', 131, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20561, 1, 'COMPOUNDCLSDETAIL', 'Экономические статьи входящие в группу', 0, 0, 'COMPOUNDCLSDETAIL', 'COMPOUNDCLSDETAIL', 132, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20578, 1, 'RESERVEFUNDS', 'Устарело. Резервы средств ', 0, 0, 'RESERVEFUNDS', 'RESERVEFUNDS', 133, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20591, 1, 'STATE_TYPES', 'Типы состояний (справочник)', 0, 0, 'STATE_TYPES', 'St_T', 87, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20598, 1, 'DOCUMENTTYPES', 'Типы документов', 0, 0, 'DOCUMENTTYPES', 'DocumentTypes', 88, 0, 0, 2, '', 1, 1, -1, -1, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20618, 1, 'BANKEXCH_CLSREPLACEMENT', '', 0, 0, 'BANKEXCH_CLSREPLACEMENT', 'BankExch_ClsReplacement', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20638, 1, 'REMOTECLIENTTYPE', 'Типы удаленных клиентов', 0, 0, 'REMOTECLIENTTYPE', 'RemoteClientType', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20646, 1, 'REMOTETASKREGIME', 'Права удалённого пользователя ', 0, 0, 'REMOTETASKREGIME', 'RemoteTaskRegime', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20649, 1, 'REMOTETASKTYPE', 'Типы задач ', 0, 0, 'REMOTETASKTYPE', 'RemoteTaskType', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20652, 1, 'REMOTETASKMANAGER', 'Менеджер задач ', 0, 0, 'REMOTETASKMANAGER', 'RemoteTaskManager', 108, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20666, 1, 'REMOTETASKMANAGERDETAIL', 'Менеджер задач детализация', 0, 0, 'REMOTETASKMANAGERDETAIL', 'RemoteTaskManagerDetail', 109, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20677, 1, 'ITF_CTRL', 'Раскладка элементов окружения по интерфейсам ввода', 0, 0, 'ITF_CTRL', 'Itf_Ctrl', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20686, 1, 'PLANDOCTYPE', 'Вид плана', 0, 0, 'PLANDOCTYPE', 'PlanDocType', 106, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20691, 1, 'REPORTTESTERCONTROL', '', 0, 0, 'REPORTTESTERCONTROL', 'REPORTTESTERCONTROL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20694, 1, 'TENDEROBJECTS', 'Предмет заявки', 0, 0, 'TENDEROBJECTS', 'TenderObj', 83, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20727, 1, 'MEASUREMENTCLS', 'Единицы измерения', 0, 0, 'MEASUREMENTCLS', 'MeasurementCls', 81, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20735, 1, 'DBGROUPS', 'Группы пользователей', 0, 0, 'DBGROUPS', 'DBGroups', 101, 0, 0, 2, '', 1, 1, 3600, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20741, 1, 'GROUPSWORKPLACES', 'Права групп на РМ', 0, 0, 'GROUPSWORKPLACES', 'GROUPSWORKPLACES', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20746, 1, 'OBJECTKIND', 'Тип объекта системы ', 0, 0, 'OBJECTKIND', 'ObjectKind', 99, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20751, 1, 'RIGHTKIND', 'Тип права на объекты системы', 0, 0, 'RIGHTKIND', 'RightKind', 98, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20756, 1, 'DBRIGHTS', 'Соотнесение прав объектам системы', 0, 0, 'DBRIGHTS', 'DBRights', 102, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20763, 1, 'GROUPSRIGHTS', 'Права групп на объекты', 0, 0, 'GROUPSRIGHTS', 'GroupsRights', 105, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20772, 1, 'USERSRIGHTS', 'Права пользователей на объекты ', 0, 0, 'USERSRIGHTS', 'UsersRights', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20781, 1, 'USERSINGROUPS', 'Вхождение пользователей в группы ', 0, 0, 'USERSINGROUPS', 'UsersInGroups', 103, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20787, 1, 'DATECONST', 'Константы типа дата', 0, 0, 'DATECONST', 'DateConst', 0, 0, 0, 1, '', 1, 1, -1, -1, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20792, 1, 'GUARANTEE', 'Устарело. Гарантии', 0, 0, 'GUARANTEE', 'Guarantee', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20821, 1, 'DOCUMENTFIELDS', 'Поля документов ', 0, 0, 'DOCUMENTFIELDS', 'DocumentFields', 92, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20836, 1, 'STATE_DOCSTATES', 'Состояния документов', 0, 0, 'STATE_DOCSTATES', 'St_DS', 89, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20851, 1, 'STATE_JUMPS', 'Переходы ', 0, 0, 'STATE_JUMPS', 'St_J', 90, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20868, 1, 'STATE_OPENFIELDS', 'Поля, открытые для редактирования, для каждого перехода', 0, 0, 'STATE_OPENFIELDS', 'St_OF', 93, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20877, 1, 'DUALRIGHTS', 'Права на связки объектов', 0, 0, 'DUALRIGHTS', 'DualRights', 107, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20887, 1, 'EXCHNUMBERLIMITS', 'Ограничения каждого типа номера (снизу и сверху) для каждого типа обмена', 0, 0, 'EXCHNUMBERLIMITS', 'EXCHNUMBERLIMITS', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20892, 1, 'EXCHNUMBER', 'Обменные номера для каждой даты обмена и типа обмена', 0, 0, 'EXCHNUMBER', 'ExchNumber', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20902, 1, 'REMOTEMAILMESSAGES', 'Содержание почтового сообщения ', 0, 0, 'REMOTEMAILMESSAGES', 'RemoteMailMessages', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20908, 1, 'REMOTEMAILCLIENTMESSAGES', 'Почтовые сообщения для удалённых клиентов ', 0, 0, 'REMOTEMAILCLIENTMESSAGES', 'RemoteMailClientMessages', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20914, 1, 'REMOTEMAILATTACHEDFILES', 'Файлы, приложенные к почтовым сообщениям ', 0, 0, 'REMOTEMAILATTACHEDFILES', 'RemoteMailAttachedFiles', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20918, 1, 'BUDSTRLINK', 'Сруктура расходной части бюджета', 0, 0, 'BUDSTRLINK', 'BudStrLink', 142, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20957, 1, 'UTYPEDFORMS', 'Реестр форм ввода, подлежащих консолидации', 0, 0, 'UTYPEDFORMS', 'uTypedForms', 1300, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(20983, 1, 'UTYPEDFORMSCAPTION', 'Шапка таблицы с содержимым форм ввода', 0, 0, 'UTYPEDFORMSCAPTION', 'uTypedFormsCaption', 1301, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21028, 1, 'TENDERPRODUCT', 'Детализация заявок, конс. заявок, и итогов конкурса', 0, 0, 'TENDERPRODUCT', 'TenderProduct', 138, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21131, 1, 'UTYPEDFORMSDETAIL', 'Детализация содержимого форм ввода', 0, 0, 'UTYPEDFORMSDETAIL', 'utypedformsdetail', 1302, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21247, 1, 'UTYPEDFORMSPLACES', 'Раскладка форм ввода по интерфейсам', 0, 0, 'UTYPEDFORMSPLACES', 'utypedformsplaces', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21275, 1, 'TENDERCAPTION', 'Таблица заголовков заявок', 0, 0, 'TENDERCAPTION', 'TenderCpt', 139, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21356, 1, 'TENDERSOURCEORG', 'Заявки - список организаций', 0, 0, 'TENDERSOURCEORG', 'TENDERSOURCEORG', 79, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21369, 1, 'TENDERRESULTCAPTION', 'Заголовки итогов конкурса', 0, 0, 'TENDERRESULTCAPTION', 'TenderResultCpt', 134, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21424, 1, 'BANKEXCH_SUBSTITUTION', 'Таблица подстановок ЭПД', 0, 0, 'BANKEXCH_SUBSTITUTION', 'BANKEXCH_SUBSTITUTION', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21480, 1, 'BUDSTRUCTRIGHTS', 'Права на обобщающие значения по классификаторам', 0, 0, 'BUDSTRUCTRIGHTS', 'BudStructRights', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21520, 1, 'DESCRDOCUMENTFIELDS', 'Описания документов. Для серверных обработчиков УРМ ', 0, 0, 'DESCRDOCUMENTFIELDS', 'DESCRDOCUMENTFIELDS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21541, 1, 'DESCRDOCUMENTTYPES', 'Описания документов, позволяющие автоматически формировать запросы для серверных обработчиков УРМ', 0, 0, 'DESCRDOCUMENTTYPES', 'DESCRDOCUMENTTYPES', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21555, 1, 'DIRECTIONCLS', 'Направление', 0, 0, 'DIRECTIONCLS', 'DirectionCLS', 144, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21560, 1, 'PROGRAMCODE', 'Подвид дохода', 0, 0, 'PROGRAMCODE', 'ProgramCode', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21565, 1, 'STATE_ACTIONJUMPS', 'Разрешенные переходы', 0, 0, 'STATE_ACTIONJUMPS', 'St_AJ', 96, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21569, 1, 'STATE_ACTIONS', 'Действия', 0, 0, 'STATE_ACTIONS', 'St_A', 95, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21585, 1, 'STATEJUMPHISTORY', 'История переходов сотояний документов', 0, 0, 'STATEJUMPHISTORY', 'St_JH', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(27821, 1, 'UCONSSUBJECTTYPES', '', 0, 0, 'UCONSSUBJECTTYPES', 'UCONSSUBJECTTYPES', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21599, 1, 'UTFCTREE', 'Связи для отчетов и заданий типа m:n', 0, 0, 'UTFCTREE', 'utfctree', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21608, 1, 'UTYPEDFORMSREGCAPTION', 'Шапка для реестра форм ввода', 0, 0, 'UTYPEDFORMSREGCAPTION', 'utypedformsregcaption', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21619, 1, 'UTYPEDFORMSREGDETAIL', 'Детализация содержимого форм ввода', 0, 0, 'UTYPEDFORMSREGDETAIL', 'utypedformsregdetail', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21627, 1, 'BUHACCPLAN', 'План счетов', 0, 0, 'BUHACCPLAN', 'BuhAccPlan', 146, 0, 0, 2, '', 1, 1, 1800, null, 5, '"PERSISTENT=REFRESHMINCHANGEDROWS=100,REFRESHMINCHANGEDPERCENT=5"', '', null, 0) ;

CALL SELECTIONS_IMPORT(21634, 1, 'BUHOPERATIONCLS', 'Бухгалтерские операции (проводки)', 0, 0, 'BUHOPERATIONCLS', 'BuhOpCls', 147, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21640, 1, 'BALANCECLS', 'Тип счетов', 0, 0, 'BALANCECLS', 'BalanceCls', 148, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21646, 1, 'ACCOUNTSCONFORMITY', 'Соответствие счетов', 0, 0, 'ACCOUNTSCONFORMITY', 'AccountsConformity', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21651, 1, 'BUHACCCORR', 'Корреспонденция счетов', 0, 0, 'BUHACCCORR', 'BuhAccCorr', 149, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21664, 1, 'INTERFACESBUHOP', 'Ограничения бухопераций по коду интерфейса', 0, 0, 'INTERFACESBUHOP', 'InterfacesBuhOp', 150, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21672, 1, 'TRANSFER15NTO70N', 'Устарело. Переходы от проводок 15н к бух. операциям 70н', 0, 0, 'TRANSFER15NTO70N', 'TRANSFER15NTO70N', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21681, 1, 'UNIONNOTIFYCAPTION', 'Таблица для блока сводных уведомлений 1Н. Заголовок', 0, 0, 'UNIONNOTIFYCAPTION', 'UNIONNOTIFYCAPTION', 181, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21709, 1, 'UNIONNOTIFYDETAIL', 'Таблица для блока сводных уведомлений 1Н. Детализация', 0, 0, 'UNIONNOTIFYDETAIL', 'UNIONNOTIFYDETAIL', 182, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21876, 1, 'STATE_JUMPCONTROL', 'Таблица для хранения списка контролей на переходы между состояниями документов', 0, 0, 'STATE_JUMPCONTROL', 'St_JC', 97, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21896, 1, 'CONTACTPERSONS', 'Справочник контакных лиц организаций (л/с)', 0, 0, 'CONTACTPERSONS', 'CONTACTPERSONS', 151, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21916, 1, 'TENDERCONTACTS', 'Таблица контакных лиц для заявок на закупку', 0, 0, 'TENDERCONTACTS', 'TenderContacts', 152, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21929, 1, 'YARDSTICKS', 'Справочник критериев оценки/квалификационных требований', 0, 0, 'YARDSTICKS', 'YARDSTICKS', 153, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21942, 1, 'TENDERYARDSTICKS', 'Критерии/требования к заявке заказчика', 0, 0, 'TENDERYARDSTICKS', 'TENDERYARDSTICKS', 154, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21964, 1, 'TENDERSUPPLEMENTS', 'Документы предоставляемые государственным заказчиком', 0, 0, 'TENDERSUPPLEMENTS', 'TENDERSUPPLEMENTS', 155, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21978, 1, 'ENUMS', 'Описание перечислимых типов данных ', 0, 0, 'ENUMS', 'Enums', 165, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(21990, 1, 'ENUMVALUES', 'Описания значений перечислимых типов данных ', 0, 0, 'ENUMVALUES', 'ENUMVALUES', 166, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22002, 1, 'STATE_CASCADEACTIONS', 'Устарело. Таблица для каскадных переходов', 0, 0, 'STATE_CASCADEACTIONS', 'St_CA', 156, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22014, 1, 'LAYERTYPES', 'Виды слоев', 0, 0, 'LAYERTYPES', 'LAYERTYPES', 167, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22024, 1, 'LAYERS', 'Виды слоев', 0, 0, 'LAYERS', 'Layers', 168, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22042, 1, 'LAYERFIELDS', 'Описание полей слоя', 0, 0, 'LAYERFIELDS', 'LAYERFIELDS', 169, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22075, 1, 'LAYERCONTROLRULES', 'Описание полей слоя', 0, 0, 'LAYERCONTROLRULES', 'LAYERCONTROLRULES', 170, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22089, 1, 'LAYERRELATIONS', 'Таблица для задания отношений между слоями ', 0, 0, 'LAYERRELATIONS', 'LAYERRELATIONS', 171, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22105, 1, 'LAYERFIELDSRELATIONS', 'Таблица для задания отношений между слоями ', 0, 0, 'LAYERFIELDSRELATIONS', 'LAYERFIELDSRELATIONS', 172, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22120, 1, 'LAYERTASKS', 'Таблица для хранения задач', 0, 0, 'LAYERTASKS', 'LAYERTASKS', 173, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22143, 1, 'LAYERDATA', 'Таблица для хранения данных слоев ', 0, 0, 'LAYERDATA', 'LAYERDATA', 174, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22257, 1, 'LAYERNEEDCONTROL', 'Таблица заданий для согласования слоев', 0, 0, 'LAYERNEEDCONTROL', 'LayerNeedControl', 175, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22270, 1, 'ED_DETAIL', '', 0, 0, 'ED_DETAIL', 'ED_Detail', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22280, 1, 'UTYPEDFORMSVERSION', 'Таблица для хранения списка версии на формы ввода', 0, 0, 'UTYPEDFORMSVERSION', 'uTypedFormsVersion', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22293, 1, 'LOANCREDITCONTRACTS', 'Устарело. Таблица для хранения списка версии на формы ввода', 0, 0, 'LOANCREDITCONTRACTS', 'LOANCREDITCONTRACTS', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22306, 1, 'ED_SALDO', 'Остатки на счетах ФО ', 0, 0, 'ED_SALDO', 'ED_SALDO', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22334, 1, 'ED_OUTPAYDOC', 'Расходные пп', 0, 0, 'ED_OUTPAYDOC', 'ED_OutPayDoc', 1406, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22385, 1, 'TARGETCLS', 'Код цели', 0, 0, 'TARGETCLS', 'TargetCls', 11, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22391, 1, 'ORGATTRIBUTES', 'Таблица атрибутов для организаций плательщика/получателя, нужных для отправления документа в ФК ', 0, 0, 'ORGATTRIBUTES', 'OrgAttributes', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22405, 1, 'DATAPACKETTYPES', 'Типы пакетов обратной ЭЦП', 0, 0, 'DATAPACKETTYPES', 'DataPacketTypes', 186, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22417, 1, 'REMOTEEDSRIGHT', 'Таблица прав удаленных клиентов на пакетами документов, заверенными ЭЦП', 0, 0, 'REMOTEEDSRIGHT', 'REMOTEEDSRIGHT', 185, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22428, 1, 'LINKTYPE', 'Типы связей ', 0, 0, 'LINKTYPE', 'LinkType', 1401, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22454, 1, 'UTYPEDCLSCAPTION', 'мастер таблицы для произвольных справочников в технологии консолидации ', 0, 0, 'UTYPEDCLSCAPTION', 'utypedclscaption', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22468, 1, 'DATAPACKET', 'Пакеты обратной ЭЦП', 0, 0, 'DATAPACKET', 'DataPacket', 189, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22489, 1, 'DATASECTIONTYPES', 'Таблица описания секций типов пакетов обратной ЭЦП', 0, 0, 'DATASECTIONTYPES', 'DATASECTIONTYPES', 187, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22499, 1, 'DATAPACKETCONTENT', 'Таблица описания содержания пакетов обратной ЭЦП', 0, 0, 'DATAPACKETCONTENT', 'DataPacketContent', 188, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22513, 1, 'RECORDPARAMS', 'Таблица атрибутов записей ', 0, 0, 'RECORDPARAMS', 'RecordParams', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22523, 1, 'USERGENERATOROPT', '', 0, 0, 'USERGENERATOROPT', 'USERGENERATOROPT', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22529, 1, 'LINKRECORDS', 'Динамические связи', 0, 0, 'LINKRECORDS', 'LinkRecords', 1402, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22538, 1, 'USERGENERATOR', 'Пользовательские генераторы', 0, 0, 'USERGENERATOR', 'UserGenerator', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22547, 1, 'USERGENERATORFIELDS', 'Привязка генераторов к полям документов', 0, 0, 'USERGENERATORFIELDS', 'UserGeneratorFields', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22558, 1, 'DOCLOCK', 'Блокировки для документов ', 0, 0, 'DOCLOCK', 'DOCLOCK', 223, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22576, 1, 'DOCLOCKFIELDS', 'Поля для блокировок', 0, 0, 'DOCLOCKFIELDS', 'DOCLOCKFIELDS', 225, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22580, 1, 'UTYPEDCLSDETAIL', '', 0, 0, 'UTYPEDCLSDETAIL', 'UTYPEDCLSDETAIL', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22616, 1, 'CARDSDETAIL_FACC', 'Список л\с, разрешенных для использования с пласт. картой', 0, 0, 'CARDSDETAIL_FACC', 'CardsDetail_FAcc', 183, 0, 0, 2, '', 1, 1, 600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22624, 1, 'CARDSDETAIL_KESR', 'Перечень ЭКР, разрешенных для использования с пластиковой картой', 0, 0, 'CARDSDETAIL_KESR', 'CARDSDETAIL_KESR', 184, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22632, 1, 'FUNDSSOURCE', 'Устарело. Источник образования средств', 0, 0, 'FUNDSSOURCE', 'FUNDSSOURCE', 32, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22639, 1, 'ALLOWANCECAPTION', 'Устарело. Разрешения. Заголовок', 0, 0, 'ALLOWANCECAPTION', 'AllowanceCaption', 5000, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22675, 1, 'ALLOWANCEDETAIL', 'Устарело. Разрешения. Деталь', 0, 0, 'ALLOWANCEDETAIL', 'AllowanceDetail', 5001, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22697, 1, 'TENDERLOT', '', 0, 0, 'TENDERLOT', 'TenderLot', 195, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22727, 1, 'SUPDOCTYPECLS', '', 0, 0, 'SUPDOCTYPECLS', 'SupDTCls', 198, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22737, 1, 'OKP', '', 0, 0, 'OKP', 'OKP', 192, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22773, 1, 'TRANSFERTCLS', 'Код целевых средств', 0, 0, 'TRANSFERTCLS', 'KCS', 203, 0, 0, 2, '', 1, 1, 600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22787, 1, 'STATICLINKS', 'Описание статических связей между документами', 0, 0, 'STATICLINKS', 'StLinks', 1405, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22797, 1, 'OKFS', '', 0, 0, 'OKFS', 'OKFS', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22802, 1, 'STATE_FILTER', 'Фильтры, применяемые в сценариях системы состояний', 0, 0, 'STATE_FILTER', 'St_F', 1404, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22813, 1, 'OKOPF', '', 0, 0, 'OKOPF', 'OKOPF', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22818, 1, 'ORG_TYPE', 'Виды организаций', 0, 0, 'ORG_TYPE', 'ORG_TYPE', 210, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22823, 1, 'DOCUMENTCLS', 'Страницы документов с 6-разрядной кодировкой', 0, 0, 'DOCUMENTCLS', 'DocumentCls', 220, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22838, 1, 'LAYERBLOBS', '', 0, 0, 'LAYERBLOBS', 'LAYERBLOBS', 197, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22843, 1, 'CORRECTIONCAPTION', 'Уведомления об уточнении заголовок', 0, 0, 'CORRECTIONCAPTION', 'CorrectionCpt', 5503, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 1) ;

CALL SELECTIONS_IMPORT(22908, 1, 'CORRECTIONDETAIL', 'Уведомления об уточнении детализация', 0, 0, 'CORRECTIONDETAIL', 'CorrectionDet', 5504, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 1) ;

CALL SELECTIONS_IMPORT(22954, 1, 'PLANKIND', '', 0, 0, 'PLANKIND', 'PLANKIND', 200, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22961, 1, 'TENDERSUPDOCUMENT', '', 0, 0, 'TENDERSUPDOCUMENT', 'TENDERSUPDOCUMENT', 196, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22976, 1, 'ASSIGNMENTKIND', 'Вид ассигнований', 0, 0, 'ASSIGNMENTKIND', 'ASSIGNMENTKIND', 201, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22983, 1, 'ASSIGNMENTSOURCE', 'Вид изменений', 0, 0, 'ASSIGNMENTSOURCE', 'ASSIGNMENTSOURCE', 202, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(22990, 1, 'TENDERPROPOSAL', '', 0, 0, 'TENDERPROPOSAL', 'TENDERPROPOSAL', 205, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23004, 1, 'TENDERPROPOSALDETAIL', '', 0, 0, 'TENDERPROPOSALDETAIL', 'TENDERPROPOSALDet', 206, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23023, 1, 'TENDERPURCHASELOT', '', 0, 0, 'TENDERPURCHASELOT', 'TENDERPURCHASELOT', 207, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23037, 1, 'TENDERPURCHASE', '', 0, 0, 'TENDERPURCHASE', 'TENDERPURCHASE', 204, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23055, 0, 'ПРОТОТИПЫ', 'Прототипы полей', 1, 0, '', 'Прототипы', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23058, 1, 'UNLOCKDATES', 'Таблица для хранения дат закрытых от изменения дней', 0, 0, 'UNLOCKDATES', 'UNLOCKDATES', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23059, 1, 'VARIANTCLS', 'Справочник вариантов (бюджетные данные)', 0, 0, 'VARIANTCLS', 'VARIANTCLS', 1408, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23060, 1, 'ACCCUROPERATIONVIEW', 'Устарело. Вьюшка. ', 1, 0, 'ACCCUROPERATIONVIEW', 'ACCCUROPERATIONVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23061, 1, 'BANKSNAMES', 'Вьюшка. ', 1, 0, 'BANKSNAMES', 'BANKSNAMES', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23063, 1, 'BILLFINVIEW', 'Устарело. Вьюшка. ', 1, 0, 'BILLFINVIEW', 'BILLFINVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23065, 1, 'DFACCOUNTS', 'Устарело. Вьюшка на счета ФО', 1, 0, 'DFACCOUNTS', 'DFACCOUNTS', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23066, 1, 'DOCUMENTTEMPLATE', 'Шаблоны ввода данных для интерфейсов ввода', 0, 0, 'DOCUMENTTEMPLATE', 'DOCUMENTTEMPLATE', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23067, 1, 'DZACC', 'Устарело. Вьюшка. ', 1, 0, 'DZACC', 'DZACC', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23069, 1, 'FIELDSINFO', 'Информация о полях выборок', 0, 0, 'FIELDSINFO', 'FIELDSINFO', 0, 0, 0, 2, '', 1, 1, -1, -1, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23070, 1, 'FINCLAIMTMP', 'Устарело. Вьюшка. ', 1, 0, 'FINCLAIMTMP', 'FINCLAIMTMP', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23071, 1, 'FINCLAIMVIEW', 'Устарело. Вьюшка. ', 1, 0, 'FINCLAIMVIEW', 'FINCLAIMVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23072, 1, 'FINDETAILVIEW', 'Устарело. Вьюшка. ', 1, 0, 'FINDETAILVIEW', 'FINDETAILVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23074, 1, 'FREEFINVIEW', 'Устарело. Вьюшка. ', 1, 0, 'FREEFINVIEW', 'FREEFINVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23075, 1, 'INCOMESLEFT', 'Устарело. Вьюшка. ', 1, 0, 'INCOMESLEFT', 'INCOMESLEFT', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23077, 1, 'INCOMESRIGHT', 'Устарело. Вьюшка. ', 1, 0, 'INCOMESRIGHT', 'INCOMESRIGHT', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23078, 1, 'INCOMES_REDIRECT', 'Вьюшка. ', 1, 0, 'INCOMES_REDIRECT', 'INCOMES_REDIRECT', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23079, 1, 'INCTEMPLATETITLEVIEW', 'УСТАРЕЛО. Вьюшка. ', 1, 0, 'INCTEMPLATETITLEVIEW', 'INCTEMPLATETITLEVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23080, 1, 'INTERFACESVIEW', 'Вьюшка. ', 1, 0, 'INTERFACESVIEW', 'INTERFACESVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23081, 1, 'ORGNAMEINNACC', 'Вьюшка. ', 1, 0, 'ORGNAMEINNACC', 'ORGNAMEINNACC', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23082, 1, 'PROTOCOLDOCTYPE', '', 0, 0, 'PROTOCOLDOCTYPE', 'PROTOCOLDOCTYPE', 208, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23083, 1, 'PROTOCOLREASON', '', 0, 0, 'PROTOCOLREASON', 'PROTOCOLREASON', 209, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23084, 1, 'REG_JOURNAL', 'Журнал регистрации', 1, 0, 'REG_JOURNAL', 'REG_JOURNAL', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23088, 1, 'SCENARIO', 'Сценарии', 0, 0, 'SCENARIO', 'SCENARIO', 1409, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23089, 1, 'SELECTIONS', 'Выборки данных', 0, 0, 'SELECTIONS', 'SELECTIONS', 0, 0, 0, 2, '', 1, 1, -1, -1, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23090, 1, 'SELECTIONSDETAIL', 'Вложенные выборки данных', 0, 0, 'SELECTIONSDETAIL', 'SELECTIONSDETAIL', 0, 0, 0, 2, '', 1, 1, -1, -1, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23091, 1, 'STATUSICONS', 'Статусные иконки для интерфейсов ввода', 0, 0, 'STATUSICONS', 'ICONS', 224, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23092, 1, 'SUMINPASSAGEVIEW', 'Устарело. Вьюшка. ', 1, 0, 'SUMINPASSAGEVIEW', 'SumInPassageView', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23093, 1, 'UCONSCLIENTS', '', 0, 0, 'UCONSCLIENTS', 'UCONSCLIENTS', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23094, 1, 'UNKNOWNREDIRECTMASTER', 'Вьюшка. ', 1, 0, 'UNKNOWNREDIRECTMASTER', 'UNKNOWNREDIRECTMASTER', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23095, 1, 'VZFINDETAIL', 'УСТАРЕЛО. Вьюшка. ', 1, 0, 'VZFINDETAIL', 'VZFINDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23096, 1, 'V_FIN_BILLS_DET', 'Устарело. Вьюшка. ', 1, 0, 'V_FIN_BILLS_DET', 'V_FIN_BILLS_DET', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23097, 1, 'WORKPLACESINTERFACES', 'Вьюшка. Распределение интерфейсов по рабочим местам', 1, 0, 'WORKPLACESINTERFACES', 'WP_INTERFACES', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23098, 1, 'WORKPLACESUSER', 'Вьюшка. Назначение рабочих мест пользователям', 1, 0, 'WORKPLACESUSER', 'WORKPLACESUSER', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23099, 1, 'WORKPLACESVIEW', 'Вьюшка. ', 1, 0, 'WORKPLACESVIEW', 'WORKPLACESVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(23100, 1, 'DOCUMENTTEMPLATEFIELDS', 'Таблица для хранения шаблонных значений полей для шаблонов ввода', 0, 0, 'DOCUMENTTEMPLATEFIELDS', 'DOCUMENTTEMPLATEFIELDS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(26536, 1, 'SUBSIDYCLS', 'Коды субсидий', 0, 0, 'SUBSIDYCLS', 'SUBSIDYCLS', 211, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(26537, 1, 'ED_CORRECTIONCAPTION', '', 0, 0, 'ED_CORRECTIONCAPTION', 'ED_CORRECTIONCAPTION', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(26538, 1, 'ED_CORRECTIONDETAIL', '', 0, 0, 'ED_CORRECTIONDETAIL', 'ED_CORRECTIONDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(26793, 1, 'REPLACEMENTCLSCAPTION', '', 0, 0, 'REPLACEMENTCLSCAPTION', 'REPLACEMENTCLSCAPTION', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(26794, 1, 'REPLACEMENTCLSDETAIL', '', 0, 0, 'REPLACEMENTCLSDETAIL', 'REPLACEMENTCLSDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(26795, 1, 'REPLACEMENTCLSDETAILINFO', '', 0, 0, 'REPLACEMENTCLSDETAILINFO', 'REPLACEMENTCLSDETAILINFO', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(26796, 1, 'UTYPEDIMPORTREGISTRY', '', 0, 0, 'UTYPEDIMPORTREGISTRY', 'UTYPEDIMPORTREGISTRY', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(30653, 1, 'ARCHIVEDOCPARAMS', 'Параметры для категории архивных докуметов', 0, 0, 'ARCHIVEDOCPARAMS', 'ARCHIVEDOCPARAMS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(30654, 1, 'ARCHIVEDOCTYPE', 'Категории архивных документов', 0, 0, 'ARCHIVEDOCTYPE', 'ArchiveDocType', 1413, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(30655, 1, 'ARCHIVEOPLOG', 'Журнал операций с архивными документами', 0, 0, 'ARCHIVEOPLOG', 'ARCHIVEOPLOG', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(30656, 1, 'SIGNLOG', 'ЭА. Таблица основного журнала подписания', 0, 0, 'SIGNLOG', 'SIGNLOG', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(30657, 1, 'SIGNPARAMS', 'ЭА. Таблица вспомогательного журнала подписания', 0, 0, 'SIGNPARAMS', 'SIGNPARAMS', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(30658, 1, 'SIGNS', 'ЭА. Справочник подписей (ролей)', 0, 0, 'SIGNS', 'SIGNS', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(30659, 1, 'SIGNSCHEMECAPTION', 'ЭА. Справочник схем подписания (заголовок)', 0, 0, 'SIGNSCHEMECAPTION', 'SIGNSCHEMECAPTION', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(30660, 1, 'SIGNSCHEMEDETAIL', 'ЭА. Справочник схем подписания (детализация)', 0, 0, 'SIGNSCHEMEDETAIL', 'SIGNSCHEMEDETAIL', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(31615, 1, 'WRITEXECUTIONNOTIFY', '', 0, 0, 'WRITEXECUTIONNOTIFY', 'WRITEXECUTIONNOTIFY', 1416, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(31616, 1, 'WRITNOTIFYCLS', '', 0, 0, 'WRITNOTIFYCLS', 'WRITNOTIFYCLS', 1417, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(31617, 1, 'GENERALDOCSDETAIL', '', 0, 0, 'GENERALDOCSDETAIL', 'GENERALDOCSDETAIL', 1415, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(31618, 1, 'GENERALDOCUMENTS', '', 0, 0, 'GENERALDOCUMENTS', 'GENERALDOCUMENTS', 1414, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(31619, 1, 'UTYPEDDOCUMENTS', '', 0, 0, 'UTYPEDDOCUMENTS', 'UTYPEDDOCUMENTS', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(31620, 1, 'UTYPEDPERIODCAPTION', '', 0, 0, 'UTYPEDPERIODCAPTION', 'UTYPEDPERIODCAPTION', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(31621, 1, 'UTYPEDPERIODDETAIL', '', 0, 0, 'UTYPEDPERIODDETAIL', 'UTYPEDPERIODDETAIL', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(31622, 1, 'UTYPEDSOURCESCAPTION', '', 0, 0, 'UTYPEDSOURCESCAPTION', 'UTYPEDSOURCESCAPTION', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(31623, 1, 'UTYPEDSOURCESDETAIL', '', 0, 0, 'UTYPEDSOURCESDETAIL', 'UTYPEDSOURCESDETAIL', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(31624, 1, 'WRITNOTIFYCLSDETAIL', '', 0, 0, 'WRITNOTIFYCLSDETAIL', 'WRITNOTIFYCLSDETAIL', 1418, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(31625, 1, 'WRITNOTIFYCLSPART', '', 0, 0, 'WRITNOTIFYCLSPART', 'WRITNOTIFYCLSPART', 1419, 0, 0, 2, '', 0, 0, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(32786, 1, 'COMMDIRECTIONEXPENCECLS', 'Направления расходов вышестоящих бюджетов ', 0, 0, 'COMMDIRECTIONEXPENCECLS', 'COMMDIRECTIONEXPENCECLS', 226, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(32820, 1, 'OKTMO', 'Классификатор муниципальный образований / населенных пунктов', 0, 0, 'OKTMO', 'OKTMO', 227, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(32867, 2, 'CLS_302', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(32895, 1, 'DFUCHANGELOG', '', 0, 0, 'DFUCHANGELOG', 'DFUCHANGELOG', 0, 0, 0, 1, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(37748, 2, 'CLS_210', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(32896, 1, 'SELECTIONEVENTS', '', 0, 0, 'SELECTIONEVENTS', 'SELECTIONEVENTS', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(34400, 2, 'CLS_304', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(35312, 1, 'OKPD', '', 0, 0, 'OKPD', 'OKPD', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(34424, 2, 'CLS_305', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34448, 2, 'CLS_303', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34471, 2, 'CLS_306', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34494, 2, 'CLS_312', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34517, 2, 'CLS_311', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34539, 2, 'CLS_314', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34562, 2, 'CLS_315', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34588, 2, 'CLS_322', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34610, 2, 'CLS_323', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34631, 2, 'CLS_201', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34650, 2, 'CLS_202', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34683, 1, 'SIGNDOCRECORDS', '', 0, 0, 'SIGNDOCRECORDS', 'SIGNDOCRECORDS', 0, 0, 0, 1, '', 0, 0, 3, 3, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(34700, 2, 'ДАННЫЕЭЦП', '', 1, 0, '', '', 0, 0, 0, 1, '', 1, 0, 3, -1, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(34718, 2, 'CLS_203', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34738, 2, 'CLS_204', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34759, 2, 'CLS_205', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34779, 2, 'CLS_206', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34799, 2, 'CLS_207', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34820, 2, 'CLS_208', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(34841, 2, 'CLS_4903', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, -1, null, 'PERSISTENT=STOREDAYCOUNT=7,"RefreshOptions=NotCheckUpdate=1,NotCheckDelete=1"', '', null, 0) ;

CALL SELECTIONS_IMPORT(35019, 2, 'CLS_903', '', 1, 0, '', '', 0, 1, 0, 1, '', 0, 1, 20, null, null, 'PERSISTENT=STOREDAYCOUNT=7,Composite=', '', null, 0) ;

CALL SELECTIONS_IMPORT(35044, 1, 'LAYERFIELDTYPESDETAIL', '', 0, 0, 'LAYERFIELDTYPESDETAIL', 'LAYERFIELDTYPESDETAIL', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(35045, 1, 'SIGNCERTIFICATE', '', 0, 0, 'SIGNCERTIFICATE', 'SIGNCERTIFICATE', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(35046, 1, 'SIGNDOCUMENTSGROUP', '', 0, 0, 'SIGNDOCUMENTSGROUP', 'SIGNDOCUMENTSGROUP', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(35047, 1, 'SIGNDOCUMENTSGROUPDETAIL', '', 0, 0, 'SIGNDOCUMENTSGROUPDETAIL', 'SIGNDOCUMENTSGROUPDETAIL', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(35048, 1, 'LAYERFIELDTYPES', '', 0, 0, 'LAYERFIELDTYPES', 'LAYERFIELDTYPES', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(35049, 1, 'SIGNPROFILE', '', 0, 0, 'SIGNPROFILE', 'SIGNPROFILE', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(35050, 1, 'SIGNPROFILEDETAIL', '', 0, 0, 'SIGNPROFILEDETAIL', 'SIGNPROFILEDETAIL', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(35313, 1, 'OKVED', '', 0, 0, 'OKVED', 'OKVED', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(35357, 1, 'CLSCORRESPONDENTS', '', 0, 0, 'CLSCORRESPONDENTS', 'CLSCORRESPONDENTS', 1420, 0, 0, 2, '', 1, 1, 3600, -1, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(37806, 1, 'OKPD2', 'ОКПД2 (ОК 034-2014)', 1, 0, 'OKPD2', 'OKPD2', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(37807, 1, 'OKVED2', 'ОКВЭД2 (ОК 029-2014)', 1, 0, 'OKVED2', 'OKVED2', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(36012, 2, 'ГОСПРОГРАММА', '', 0, 0, '', '', 0, 0, 0, 2, '', 1, 1, 600, null, 5, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(36032, 1, 'CHANGELOGBYUPDDATE', 'Лог операций с таблицами', 1, 0, 'CHANGELOGBYUPDDATE', 'ChangeLogByUpdDate', 0, 0, 0, 1, '', 0, 1, 3, null, null, '', '', null, 0) ;

CALL SELECTIONS_IMPORT(38203, 1, 'INVESTOBJECT', 'Объекты', 0, 0, 'INVESTOBJECT', 'INVESTOBJECT', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '', null, 0) ;

CALL SELECTIONSDETAIL_IMPORT(32868, 32867, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=63', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(32869, 32867, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34401, 34400, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=64', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34402, 34400, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34426, 34424, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=61', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34427, 34424, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34450, 34448, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=65', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34451, 34448, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34473, 34471, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=62', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34474, 34471, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34496, 34494, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=69', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34497, 34494, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34519, 34517, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=68', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34520, 34517, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34541, 34539, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=70', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34542, 34539, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34564, 34562, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=71', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34565, 34562, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34590, 34588, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=73', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34591, 34588, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34612, 34610, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=75', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34613, 34610, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34632, 34631, 17463, 'BN', 0, 0, 1, 'BN.Progindex=32', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34633, 34631, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34652, 34650, 17463, 'BN', 0, 0, 1, 'BN.Progindex=260', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34653, 34650, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34701, 34700, 34683, 'sdr', 0, 0, 1, '', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34720, 34718, 17463, 'BN', 0, 0, 1, 'BN.Progindex=261', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34721, 34718, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34740, 34738, 17463, 'BN', 0, 0, 1, 'BN.Progindex=262', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34741, 34738, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34761, 34759, 17463, 'BN', 0, 0, 1, 'BN.Progindex=263', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34762, 34759, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34781, 34779, 17463, 'BN', 0, 0, 1, 'BN.Progindex=268', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34782, 34779, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34801, 34799, 17463, 'BN', 0, 0, 1, 'BN.Progindex=272', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34802, 34799, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34822, 34820, 17463, 'BN', 0, 0, 1, 'BN.Progindex=273', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34823, 34820, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(34842, 34841, 22468, 'DP', 0, 0, 1, 'DP.PROGINDEX=527', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(35023, 35019, 17643, 'QT', 0, 0, 1, '(QT.Progindex=45) or (QT.Progindex=140)', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(35024, 35019, 17668, 'INC', 1, 2, 1, 'INC.RECORDINDEX=QT.ID', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(36013, 36012, 16964, 'FACT', 0, 0, 1, '', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(37751, 37748, 17463, 'BN', 0, 0, 1, 'BN.Progindex=252', 0, '', 0) ;

CALL SELECTIONSDETAIL_IMPORT(37752, 37748, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '', 0) ;

-- ПРОТОТИПЫ
CALL FIELDSINFO_IMPORT(23056, 0, 0, null, 23055, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 0, '', '', '', 0, 0, null, 0, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORGANIZATIONS
CALL FIELDSINFO_IMPORT(16643, 0, 1, 23056, 16642, null, 'ID', 3, 0, 0, 'Организация главный распорядитель', 'Ссылка на организацию-главного распорядителя', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16644, 0, 1, null, 16642, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16645, 0, 1, null, 16642, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '9999999999', '0000000000', '0000000000', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16646, 0, 1, null, 16642, null, 'NAME', 1, 0, 2000, 'Наименование(Распорядитель)', '', 60, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16647, 0, 1, null, 16642, null, 'GOSNI', 3, 0, 0, 'ГосНИ', 'ГОСНИ', 6, '99.99', '', '', 0, 0, null, 1, 16948, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16648, 0, 1, null, 16642, null, 'CITY', 1, 0, 50, 'Город(Плательщик\Банк плательщика)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16649, 0, 1, null, 16642, null, 'COUNTRY', 1, 0, 50, 'Страна', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16650, 0, 1, null, 16642, null, 'PHONE', 1, 0, 20, 'Телефон', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16651, 0, 1, null, 16642, null, 'ADDRESS', 1, 0, 255, 'Адрес', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16652, 0, 1, null, 16642, null, 'ORG_CLS', 3, 0, 0, 'Тип организации (старый)', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16988, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16653, 0, 1, null, 16642, null, 'INN20', 1, 0, 20, 'КПП(Распорядитель)', '', 9, '999999999;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16654, 0, 1, null, 16642, null, 'SUBINN', 3, 0, 0, 'Суб ИНН', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16655, 0, 1, null, 16642, null, 'FACIALACC', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16656, 0, 1, null, 16642, null, 'DIRNAME', 1, 0, 50, 'ФИО директора', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16657, 0, 1, null, 16642, null, 'BUGNAME', 1, 0, 50, 'ФИО бухгалтера', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16658, 0, 1, null, 16642, null, 'DIRPHONE', 1, 0, 20, 'Телефон директора', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16659, 0, 1, null, 16642, null, 'BUGPHONE', 1, 0, 20, 'Телефон бухгалтера', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16660, 0, 1, null, 16642, null, 'RCORG', 3, 0, 0, 'Сфера применения', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16661, 0, 1, null, 16642, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16662, 0, 1, null, 16642, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16663, 0, 1, null, 16642, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16664, 0, 1, null, 16642, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16665, 0, 1, null, 16642, null, 'EMAIL', 1, 0, 50, 'E-mail адрес', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16666, 0, 1, null, 16642, null, 'WEBSITE', 1, 0, 50, 'Адрес Web-сайта', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16667, 0, 1, null, 16642, null, 'OKATO', 3, 0, 0, 'ОКАТО', 'ОКАТО', 11, '99.999.999', '', '', 0, 0, null, 1, 20418, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16668, 0, 1, null, 16642, null, 'UFKCODE', 3, 0, 0, 'Идентификатор(по РПБС/по КОФК)', '', 6, '99999', '', '#####', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16669, 0, 1, null, 16642, null, 'ADDOKATO', 3, 0, 0, 'Уточнение ОКАТО', '', 4, '000', '', '###', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16670, 0, 1, null, 16642, null, 'SHORTNAME', 1, 0, 2000, 'Сокращенное наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16671, 0, 1, null, 16642, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16672, 0, 1, null, 16642, null, 'DATECLOSE', 6, 0, 0, 'Дата закрытия', '', 11, '99/99/9999', 'dd/mm/yyyy', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16673, 0, 1, null, 16642, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16674, 0, 1, null, 16642, null, 'KVSR', 3, 0, 0, 'ППП', '', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16675, 0, 1, null, 16642, null, 'OKFS', 3, 0, 0, 'ОКФС', '', 3, '99', '', '', 0, 0, null, 1, 22797, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16676, 0, 1, null, 16642, null, 'OKOPF', 3, 0, 0, 'ОКОПФ', '', 8, '99', '', '', 0, 0, null, 1, 22813, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16677, 0, 1, null, 16642, null, 'OPENDATE', 6, 0, 0, 'Дата включения в реестр', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16678, 0, 1, null, 16642, null, 'CLOSEDATE', 6, 0, 0, 'Дата исключения из реестра', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16679, 0, 1, null, 16642, null, 'CHANGEDATE', 6, 0, 0, 'Дата изменения информации в реестре', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16680, 0, 1, null, 16642, null, 'GENERALORG_REF', 3, 0, 0, 'Организация-распорядитель(ссылка)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16681, 0, 1, null, 16642, null, 'FEDERALREGIONCODE', 3, 0, 0, 'Код региона ', '', 3, '99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16682, 0, 1, null, 16642, null, 'ORG_TYPE', 3, 0, 0, 'Вид организации', '', 9, '99.99.99', '', '', 0, 0, null, 1, 22818, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16683, 0, 1, null, 16642, null, 'BUDGETREF', 3, 0, 0, 'Бюджет(ссылка)', '', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16684, 0, 1, null, 16642, null, 'CLIENTID', 1, 0, 11, 'Код заказчика', '', 11, '99999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16685, 0, 1, null, 16642, null, 'SUPPLIERSTATUS', 3, 0, 0, 'Статус поставщика', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16686, 0, 1, null, 16642, null, 'COUNTRYCODE', 3, 0, 0, 'Код страны', '', 4, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16687, 0, 1, null, 16642, null, 'ORGCODE', 1, 0, 20, 'Идентификатор(по РПБС/по КОФК)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32161, 0, 1, null, 16642, null, 'FUID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24926, 0, 1, null, 16642, null, 'COSTAUTHORITY', 3, 0, 0, 'По расходам(Бюджетные полномочия)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24927, 0, 1, null, 16642, null, 'DEBTAUTHORITY', 3, 0, 0, 'По источникам(Бюджетные полномочия)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24928, 0, 1, null, 16642, null, 'INCOMEAUTHORITY', 3, 0, 0, 'По доходам(Бюджетные полномочия)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24929, 0, 1, null, 16642, null, 'SVRAUTHORITY', 3, 0, 0, 'По СВР(Бюджетные полномочия)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32858, 0, 1, null, 16642, null, 'OKTMO', 3, 0, 0, 'ОКТМО', 'ОКТМО', 15, '', '', '', 0, 0, null, 0, 32820, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38087, 0, 1, null, 16642, null, 'OGRN', 1, 0, 20, 'ОГРН', '', 15, '9999999999999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32938, 0, 1, null, 16642, null, 'OKPO', 1, 0, 20, 'ОКПО', '', 10, '9999999999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31711, 0, 1, null, 16642, null, 'DATEOPEN', 6, 0, 0, 'Дата открытия', '', 11, '99/99/9999', 'dd/mm/yyyy', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38088, 0, 1, null, 16642, null, 'REMOTEPBSCODE', 1, 0, 20, 'УПБС', '', 6, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38089, 0, 1, null, 16642, null, 'REMOTENOTPBSCODE', 1, 0, 20, 'НУБП', '', 6, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- REGIONCLS
CALL FIELDSINFO_IMPORT(16689, 0, 1, null, 16688, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16690, 0, 1, null, 16688, null, 'CODE1', 3, 0, 0, 'Разряд классификатора', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16691, 0, 1, null, 16688, null, 'CODE2', 3, 0, 0, 'Разряд классификатора', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16692, 0, 1, null, 16688, null, 'CODE3', 3, 0, 0, 'Разряд классификатора', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16693, 0, 1, null, 16688, null, 'NAME', 1, 0, 1024, 'Описание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16694, 0, 1, null, 16688, null, 'BUDGETTYPE', 3, 0, 0, 'Вид бюджета', '', 11, '999', '', '', 0, 0, null, 1, 17010, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16695, 0, 1, null, 16688, null, 'ORGANIZATIONS', 3, 0, 0, 'ТФО(ссылка)', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16696, 0, 1, null, 16688, null, 'KVB_EXPORT', 3, 0, 0, 'Код бюджета (экспорт консолидации)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16697, 0, 1, null, 16688, null, 'ORG_EXPORT', 3, 0, 0, 'Код района (экспорт консолидации)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16698, 0, 1, null, 16688, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16699, 0, 1, null, 16688, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24955, 0, 1, null, 16688, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24956, 0, 1, null, 16688, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SINGLE
CALL FIELDSINFO_IMPORT(16701, 0, 1, null, 16700, null, 'ID', 1, 0, 1, 'Первичный ключ', '', 1, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- DATABASEVERSION
CALL FIELDSINFO_IMPORT(16703, 0, 1, null, 16702, null, 'VERSION', 1, 0, 10, 'Версия ', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16704, 0, 1, null, 16702, null, 'MAJOR', 3, 0, 0, 'Версия библиотек ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16705, 0, 1, null, 16702, null, 'MINOR', 3, 0, 0, 'Обновление ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16706, 0, 1, null, 16702, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16707, 0, 1, null, 16702, null, 'ACOMMENT', 1, 0, 255, 'Комментарий ', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25292, 0, 1, null, 16702, null, 'BUILD', 3, 0, 0, '', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DBUSERS
CALL FIELDSINFO_IMPORT(16709, 0, 1, null, 16708, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16710, 0, 1, null, 16708, null, 'FIRSTNAME', 1, 0, 50, 'Фамилия', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16711, 0, 1, null, 16708, null, 'MIDDLENAME', 1, 0, 50, 'Отчество', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16712, 0, 1, null, 16708, null, 'LASTNAME', 1, 0, 50, 'Имя', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16713, 0, 1, null, 16708, null, 'NOTE', 1, 0, 255, 'Должность', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16714, 0, 1, null, 16708, null, 'PHONE', 1, 0, 50, 'Телефон', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16715, 0, 1, null, 16708, null, 'DESCRIPTION', 15, 0, 0, 'Описание ', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16716, 0, 1, null, 16708, null, 'DEPARTMENTCLS', 3, 0, 0, 'Отдел', '', 11, '99.99.99', '', '', 0, 0, null, 0, 19786, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16717, 0, 1, null, 16708, null, 'USERNAME', 1, 0, 30, 'Имя пользователя БД', '', 30, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16718, 0, 1, null, 16708, null, 'REMOTECLIENTREF', 3, 0, 0, 'Удалённый пользователь', '', 11, '', '', '', 0, 0, null, 0, 20054, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16719, 0, 1, null, 16708, null, 'REMOTEID', 3, 0, 0, 'Код удалённого пользователя', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16720, 0, 1, null, 16708, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16721, 0, 1, null, 16708, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(28250, 0, 1, null, 16708, null, 'ORG_REF', 3, 0, 0, 'Ссылка на организацию', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24709, 0, 1, null, 16708, null, 'CRYPTOID', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24710, 0, 1, null, 16708, null, 'CRYPTOPARAMS', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32904, 0, 1, null, 16708, null, 'EMAILADDRESS', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32905, 0, 1, null, 16708, null, 'NOTE2', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35052, 0, 1, null, 16708, null, 'PRINCIPALNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35053, 0, 1, null, 16708, null, 'USERGUID', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INTERFACES
CALL FIELDSINFO_IMPORT(16723, 0, 1, null, 16722, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16724, 0, 1, null, 16722, null, 'GUID', 1, 0, 50, 'Уникальный идентификатор', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16725, 0, 1, null, 16722, null, 'NOTE', 1, 0, 255, 'Название', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16726, 0, 1, null, 16722, null, 'PARAM', 1, 0, 255, 'Параметр', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16727, 0, 1, null, 16722, null, 'CLS', 3, 0, 0, 'Код объекта', '', 6, '99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16728, 0, 1, null, 16722, null, 'INTERFACETYPE', 3, 0, 0, 'Тип интерфейса', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24887, 0, 1, null, 16722, null, 'PARAMCOLLECTION', 1, 0, 4000, 'Параметры ограничений', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33033, 0, 1, null, 16722, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33034, 0, 1, null, 16722, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33035, 0, 1, null, 16722, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33036, 0, 1, null, 16722, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PERMISSIONS
CALL FIELDSINFO_IMPORT(16730, 0, 1, null, 16729, null, 'ID', 3, 0, 0, '№ записи', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16731, 0, 1, null, 16729, null, 'INTERFACEREF', 3, 0, 0, '№ интерфейса', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16732, 0, 1, null, 16729, null, 'NAME', 1, 0, 255, 'Разрешение', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16733, 0, 1, null, 16729, null, 'VAL', 1, 0, 4000, 'Пользователи', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33049, 0, 1, null, 16729, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33050, 0, 1, null, 16729, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33051, 0, 1, null, 16729, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33052, 0, 1, null, 16729, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- WORKPLACES
CALL FIELDSINFO_IMPORT(16735, 0, 1, null, 16734, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16736, 0, 1, null, 16734, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16737, 0, 1, null, 16734, null, 'HIDETABS', 3, 0, 0, 'Прятать табы у закладок при просмотре', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33077, 0, 1, null, 16734, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33078, 0, 1, null, 16734, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33079, 0, 1, null, 16734, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33080, 0, 1, null, 16734, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- WORKPLACES_INTERFACE
CALL FIELDSINFO_IMPORT(16739, 0, 1, null, 16738, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16740, 0, 1, null, 16738, null, 'WORKPLACES_REF', 3, 0, 0, 'Ссылка на рабочее место', '', 11, '', '', '', 0, 0, null, 1, 16734, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16741, 0, 1, null, 16738, null, 'INTERFACES_REF', 3, 0, 0, 'Ссылка на интерфейс', '', 11, '', '', '', 0, 0, null, 1, 16722, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16742, 0, 1, null, 16738, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16743, 0, 1, null, 16738, null, 'ORDERBY', 3, 0, 0, 'Признак сортировки', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33081, 0, 1, null, 16738, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33082, 0, 1, null, 16738, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33083, 0, 1, null, 16738, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33084, 0, 1, null, 16738, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- USER_WORKPLACES
CALL FIELDSINFO_IMPORT(16745, 0, 1, null, 16744, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16746, 0, 1, null, 16744, null, 'USERS_REF', 3, 0, 0, 'Пользователь', '', 11, '', '', '', 0, 0, null, 1, 16708, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16747, 0, 1, null, 16744, null, 'WORKPLACES_REF', 3, 0, 0, 'Рабочее место', '', 11, '', '', '', 0, 0, null, 1, 16734, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16748, 0, 1, null, 16744, null, 'DEFAULTWORKPLACE', 3, 0, 0, 'Рабочее место по умолчанию', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33065, 0, 1, null, 16744, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33066, 0, 1, null, 16744, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33067, 0, 1, null, 16744, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33068, 0, 1, null, 16744, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- WORKPLACES_NEWREPORTS
CALL FIELDSINFO_IMPORT(16750, 0, 1, null, 16749, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16751, 0, 1, null, 16749, null, 'WORKPLACES_REF', 3, 0, 0, 'Рабочее место', '', 11, '', '', '', 0, 0, null, 1, 16734, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16752, 0, 1, null, 16749, null, 'REPORTS_REF', 3, 0, 0, 'Класс отчета', '', 11, '99.99.99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16753, 0, 1, null, 16749, null, 'NOTE', 1, 0, 255, 'Заголовок', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16754, 0, 1, null, 16749, null, 'ORDERBY', 3, 0, 0, 'Порядок', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33085, 0, 1, null, 16749, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33086, 0, 1, null, 16749, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33087, 0, 1, null, 16749, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33088, 0, 1, null, 16749, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INTCONST
CALL FIELDSINFO_IMPORT(16756, 0, 1, null, 16755, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16757, 0, 1, null, 16755, null, 'CONSTINDEX', 3, 0, 0, 'Номер константы ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16758, 0, 1, null, 16755, null, 'CONSTVALUE', 3, 0, 0, 'Значение', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16759, 0, 1, null, 16755, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16760, 0, 1, null, 16755, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16761, 0, 1, null, 16755, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32931, 0, 1, null, 16755, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32932, 0, 1, null, 16755, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32933, 0, 1, null, 16755, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36098, 0, 1, null, 16755, null, 'CLOSEDATE', 11, 0, 0, 'Дата прекращения использования', '', 20, '99/99/9999', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36099, 0, 1, null, 16755, null, 'EDITDOCCODE', 3, 0, 0, 'Код интерфейса, с которого редактируется константа ', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- VARCHARCONST
CALL FIELDSINFO_IMPORT(16763, 0, 1, null, 16762, null, 'PROGINDEX', 3, 0, 0, 'Тип константы', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16764, 0, 1, null, 16762, null, 'CONSTINDEX', 3, 0, 0, 'Номер константы', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16765, 0, 1, null, 16762, null, 'CONSTVALUE', 1, 0, 1024, 'Значение', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16766, 0, 1, null, 16762, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32459, 0, 1, null, 16762, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32460, 0, 1, null, 16762, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32966, 0, 1, null, 16762, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32967, 0, 1, null, 16762, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32968, 0, 1, null, 16762, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36100, 0, 1, null, 16762, null, 'CLOSEDATE', 11, 0, 0, 'Дата прекращения использования', '', 20, '99/99/9999', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36101, 0, 1, null, 16762, null, 'EDITDOCCODE', 3, 0, 0, 'Код интерфейса, с которого редактируется константа ', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- REALCONST
CALL FIELDSINFO_IMPORT(16768, 0, 1, null, 16767, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16769, 0, 1, null, 16767, null, 'CONSTINDEX', 3, 0, 0, 'Номер константы', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16770, 0, 1, null, 16767, null, 'CONSTVALUE', 6, 0, 0, 'Значение', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16771, 0, 1, null, 16767, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32939, 0, 1, null, 16767, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32940, 0, 1, null, 16767, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32941, 0, 1, null, 16767, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32942, 0, 1, null, 16767, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32943, 0, 1, null, 16767, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36102, 0, 1, null, 16767, null, 'CLOSEDATE', 11, 0, 0, 'Дата прекращения использования', '', 20, '99/99/9999', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36103, 0, 1, null, 16767, null, 'EDITDOCCODE', 3, 0, 0, 'Код интерфейса, с которого редактируется константа ', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REGUSERS
CALL FIELDSINFO_IMPORT(16778, 0, 1, null, 16777, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16779, 0, 1, null, 16777, null, 'DBUSERNAME', 1, 0, 30, 'Имя пользователя в БД', '', 30, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16780, 0, 1, null, 16777, null, 'DATEBEGIN', 11, 0, 0, 'Дата и время начала работы', '', 20, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16781, 0, 1, null, 16777, null, 'DATEEND', 11, 0, 0, 'Дата и время окончания работы', '', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16782, 0, 1, null, 16777, null, 'NETUSERNAME', 1, 0, 30, 'Имя пользователя с сети', '', 30, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16783, 0, 1, null, 16777, null, 'NETCOMPNAME', 1, 0, 20, 'Имя компьютера в сети', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16784, 0, 1, null, 16777, null, 'ASESSION', 3, 0, 0, 'Сессия работы с программой', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33055, 0, 1, null, 16777, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33056, 0, 1, null, 16777, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BUDGETS_S
CALL FIELDSINFO_IMPORT(16804, 0, 1, null, 16803, null, 'ID', 3, 0, 0, 'Код', '', 4, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16805, 0, 1, null, 16803, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16806, 0, 1, null, 16803, null, 'LASTMODIFDATE_B', 6, 0, 0, 'Конечная дата для модификации данных бюджета', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16807, 0, 1, null, 16803, null, 'CURRENTBUDGET', 3, 0, 0, 'Текущий бюджет', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16808, 0, 1, null, 16803, null, 'NOTE', 1, 0, 255, 'Полное наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16809, 0, 1, null, 16803, null, 'OKATO', 3, 0, 0, 'ОКАТО', '', 11, '99.999.999', '', '', 0, 0, null, 1, 20418, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16810, 0, 1, null, 16803, null, 'ADDOKATO', 3, 0, 0, 'Расширение ОКАТО', '', 4, '000', '', '###', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16811, 0, 1, null, 16803, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16812, 0, 1, null, 16803, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16813, 0, 1, null, 16803, null, 'AYEAR', 3, 0, 0, 'Год', '', 11, '9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24689, 0, 1, null, 16803, null, 'BUDGETLEVEL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24690, 0, 1, null, 16803, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24691, 0, 1, null, 16803, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26543, 0, 1, null, 16803, null, 'CHIEFNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26544, 0, 1, null, 16803, null, 'CHIEFROLE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- DOCTYPES
CALL FIELDSINFO_IMPORT(16815, 0, 1, null, 16814, null, 'ID', 3, 0, 0, 'Код документа', '', 11, '9.99.9', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16816, 0, 1, null, 16814, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16817, 0, 1, null, 16814, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16818, 0, 1, null, 16814, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16819, 0, 1, null, 16814, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16820, 0, 1, null, 16814, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16821, 0, 1, null, 16814, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16822, 0, 1, null, 16814, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16823, 0, 1, null, 16814, null, 'REGISTRATIONTYPE', 3, 0, 0, 'Вид учета', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- KD
CALL FIELDSINFO_IMPORT(16825, 0, 1, null, 16824, null, 'ID', 3, 0, 0, 'Код', '', 11, '9.99.99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16826, 0, 1, null, 16824, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16827, 0, 1, null, 16824, null, 'REPCODE', 1, 0, 10, 'Код отчётности', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16828, 0, 1, null, 16824, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16829, 0, 1, null, 16824, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16830, 0, 1, null, 16824, null, 'KVSR', 3, 0, 0, 'КВСР', '', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16831, 0, 1, null, 16824, null, 'DESCRIPTIONCODE', 6, 0, 0, 'Вид дохода', '', 15, '9.99.99.999.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16832, 0, 1, null, 16824, null, 'MAINDESCRIPTIONCODE', 3, 0, 0, 'Значимый вид дохода. 4-11 позиции', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16833, 0, 1, null, 16824, null, 'ITEMCODE', 3, 0, 0, 'Элемент', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16834, 0, 1, null, 16824, null, 'PROGRAMCODE', 3, 0, 0, 'Код программы', '', 5, '9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16835, 0, 1, null, 16824, null, 'KESR', 3, 0, 0, 'ЭКР', '', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16836, 0, 1, null, 16824, null, 'KDVALUE', 1, 0, 20, 'На код дохода', 'Классификатор кода дохода', 31, '999.9.99.99.999.99.9999.999;0;_', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16839, 0, 1, null, 16824, null, 'REMOTEFLAG', 3, 0, 0, 'Код удален', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16840, 0, 1, null, 16824, null, 'UNIONFLAG', 3, 0, 0, 'Признак обобщения', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16842, 0, 1, null, 16824, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16843, 0, 1, null, 16824, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24895, 0, 1, null, 16824, null, 'KD_LEVEL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24896, 0, 1, null, 16824, null, 'SHORTNAME', 1, 0, 1024, 'Краткое имя', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24897, 0, 1, null, 16824, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29917, 0, 1, null, 16824, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29918, 0, 1, null, 16824, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- KFSR
CALL FIELDSINFO_IMPORT(16845, 0, 1, null, 16844, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16846, 0, 1, null, 16844, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16847, 0, 1, null, 16844, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16848, 0, 1, null, 16844, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16849, 0, 1, null, 16844, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16850, 0, 1, null, 16844, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24903, 0, 1, null, 16844, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24904, 0, 1, null, 16844, null, 'SHORTNAME', 1, 0, 1024, 'Краткое имя', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24905, 0, 1, null, 16844, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29919, 0, 1, null, 16844, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29920, 0, 1, null, 16844, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- KVSR
CALL FIELDSINFO_IMPORT(16852, 0, 1, null, 16851, null, 'ID', 3, 0, 0, '', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16853, 0, 1, null, 16851, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16854, 0, 1, null, 16851, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16855, 0, 1, null, 16851, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16856, 0, 1, null, 16851, null, 'ORG_REF', 3, 0, 0, 'Организация-главный распорядитель', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29923, 0, 1, null, 16851, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29924, 0, 1, null, 16851, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25471, 0, 1, null, 16851, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25472, 0, 1, null, 16851, null, 'CODE', 3, 0, 0, 'Код', '', 4, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25473, 0, 1, null, 16851, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25474, 0, 1, null, 16851, null, 'SHORTNAME', 1, 0, 1024, 'Краткое имя', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25475, 0, 1, null, 16851, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- KCSR
CALL FIELDSINFO_IMPORT(16858, 0, 1, null, 16857, null, 'ID', 3, 0, 0, '', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16859, 0, 1, null, 16857, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16860, 0, 1, null, 16857, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16861, 0, 1, null, 16857, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32934, 0, 1, null, 16857, null, 'CONFORMITYCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32935, 0, 1, null, 16857, null, 'DIRECTIONEXPENCE', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29915, 0, 1, null, 16857, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29916, 0, 1, null, 16857, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25461, 0, 1, null, 16857, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25462, 0, 1, null, 16857, null, 'CODE', 1, 0, 20, 'Код', '', 10, '>aa.a.aaaa', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25463, 0, 1, null, 16857, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25464, 0, 1, null, 16857, null, 'SHORTNAME', 1, 0, 1024, 'Краткое имя', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25465, 0, 1, null, 16857, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- KVR
CALL FIELDSINFO_IMPORT(16865, 0, 1, null, 16864, null, 'ID', 3, 0, 0, '', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16866, 0, 1, null, 16864, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16867, 0, 1, null, 16864, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16868, 0, 1, null, 16864, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29921, 0, 1, null, 16864, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29922, 0, 1, null, 16864, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25466, 0, 1, null, 16864, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25467, 0, 1, null, 16864, null, 'CODE', 1, 0, 20, 'Код', '', 6, '>a.a.a', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25468, 0, 1, null, 16864, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25469, 0, 1, null, 16864, null, 'SHORTNAME', 1, 0, 1024, 'Краткое имя', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25470, 0, 1, null, 16864, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- KESR
CALL FIELDSINFO_IMPORT(16872, 0, 1, null, 16871, null, 'ID', 3, 0, 0, 'Код', '', 11, '9.9.99.9.9', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16873, 0, 1, null, 16871, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16874, 0, 1, null, 16871, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16875, 0, 1, null, 16871, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16876, 0, 1, null, 16871, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16877, 0, 1, null, 16871, null, 'CONTROLCODE', 3, 0, 0, 'Код обобщения', '', 11, '9.9.99.9.9', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16878, 0, 1, null, 16871, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16879, 0, 1, null, 16871, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16880, 0, 1, null, 16871, null, 'ISEKR', 3, 0, 0, 'Является ЭКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16881, 0, 1, null, 16871, null, 'ISEKD', 3, 0, 0, 'Является ЭКД', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16882, 0, 1, null, 16871, null, 'ISEKI', 3, 0, 0, 'Является ЭКИ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24898, 0, 1, null, 16871, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24899, 0, 1, null, 16871, null, 'SHORTNAME', 1, 0, 1024, 'Краткое имя', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24900, 0, 1, null, 16871, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30898, 0, 1, null, 16871, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30899, 0, 1, null, 16871, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- KSHK
CALL FIELDSINFO_IMPORT(16884, 0, 1, null, 16883, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16885, 0, 1, null, 16883, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33037, 0, 1, null, 16883, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33038, 0, 1, null, 16883, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33039, 0, 1, null, 16883, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33040, 0, 1, null, 16883, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- SUBKCSR
CALL FIELDSINFO_IMPORT(16887, 0, 1, null, 16886, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16888, 0, 1, null, 16886, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33061, 0, 1, null, 16886, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33062, 0, 1, null, 16886, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33063, 0, 1, null, 16886, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33064, 0, 1, null, 16886, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REFCLS
CALL FIELDSINFO_IMPORT(16902, 0, 1, null, 16901, null, 'ID', 3, 0, 0, 'Код', '', 11, '9999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16903, 0, 1, null, 16901, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- MEANSCLS
CALL FIELDSINFO_IMPORT(16905, 0, 1, null, 16904, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16906, 0, 1, null, 16904, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33041, 0, 1, null, 16904, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33042, 0, 1, null, 16904, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33043, 0, 1, null, 16904, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33044, 0, 1, null, 16904, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- VALUECLS
CALL FIELDSINFO_IMPORT(16908, 0, 1, null, 16907, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16909, 0, 1, null, 16907, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BUDGETACCOUNTS
CALL FIELDSINFO_IMPORT(16911, 0, 1, null, 16910, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16912, 0, 1, null, 16910, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16913, 0, 1, null, 16910, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16914, 0, 1, null, 16910, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- KESRSUBCODE
CALL FIELDSINFO_IMPORT(16916, 0, 1, null, 16915, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16917, 0, 1, null, 16915, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16918, 0, 1, null, 16915, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16919, 0, 1, null, 16915, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24901, 0, 1, null, 16915, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24902, 0, 1, null, 16915, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- ACCOUNTPLAN
CALL FIELDSINFO_IMPORT(16921, 0, 1, null, 16920, null, 'ID', 3, 0, 0, 'Счёт', '', 11, '9999.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16922, 0, 1, null, 16920, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16923, 0, 1, null, 16920, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16924, 0, 1, null, 16920, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16925, 0, 1, null, 16920, null, 'STATE', 3, 0, 0, 'Тип', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16926, 0, 1, null, 16920, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16927, 0, 1, null, 16920, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- SUBKD
CALL FIELDSINFO_IMPORT(16929, 0, 1, null, 16928, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16930, 0, 1, null, 16928, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16931, 0, 1, null, 16928, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16932, 0, 1, null, 16928, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16933, 0, 1, null, 16928, null, 'BUHACCOUNT', 3, 0, 0, 'Бух. счет', '', 11, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16934, 0, 1, null, 16928, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16935, 0, 1, null, 16928, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16936, 0, 1, null, 16928, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25013, 0, 1, null, 16928, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25014, 0, 1, null, 16928, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- CURRENCYCLS
CALL FIELDSINFO_IMPORT(16938, 0, 1, null, 16937, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16939, 0, 1, null, 16937, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16940, 0, 1, null, 16937, null, 'CODE', 1, 0, 10, 'Симв. код', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16941, 0, 1, null, 16937, null, 'KIND', 3, 0, 0, 'Род', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16942, 0, 1, null, 16937, null, 'VARIANT1', 1, 0, 255, 'Склонение 1', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16943, 0, 1, null, 16937, null, 'VARIANT2', 1, 0, 255, 'Склонение 2', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16944, 0, 1, null, 16937, null, 'VARIANT7', 1, 0, 255, 'Склонение 7', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33021, 0, 1, null, 16937, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33022, 0, 1, null, 16937, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33023, 0, 1, null, 16937, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33024, 0, 1, null, 16937, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REPORTTYPE
CALL FIELDSINFO_IMPORT(16946, 0, 1, null, 16945, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16947, 0, 1, null, 16945, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- GOSNI
CALL FIELDSINFO_IMPORT(16949, 0, 1, null, 16948, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16950, 0, 1, null, 16948, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16951, 0, 1, null, 16948, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16952, 0, 1, null, 16948, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16953, 0, 1, null, 16948, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16954, 0, 1, null, 16948, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- FINTYPE
CALL FIELDSINFO_IMPORT(16956, 0, 1, null, 16955, null, 'ID', 3, 0, 0, 'Ключ', '', 11, '9.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16959, 0, 1, null, 16955, null, 'ACCOUNT', 3, 0, 0, 'Бух. счет', '', 11, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16960, 0, 1, null, 16955, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16961, 0, 1, null, 16955, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16962, 0, 1, null, 16955, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16963, 0, 1, null, 16955, null, 'GENBUHACCFLAG', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36852, 0, 1, null, 16955, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36853, 0, 1, null, 16955, null, 'CODE', 1, 0, 20, 'Код', '', 6, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- FACT
CALL FIELDSINFO_IMPORT(16965, 0, 1, null, 16964, null, 'ID', 3, 0, 0, 'Ключ', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16969, 0, 1, null, 16964, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16970, 0, 1, null, 16964, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16971, 0, 1, null, 16964, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24735, 0, 1, null, 16964, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24736, 0, 1, null, 16964, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32920, 0, 1, null, 16964, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32921, 0, 1, null, 16964, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36863, 0, 1, null, 16964, null, 'CODE', 1, 0, 20, 'Код', '', 20, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36864, 0, 1, null, 16964, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38101, 0, 1, null, 16964, null, 'EXTID', 1, 0, 50, 'UID для обмена с внешними системами', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- DOCBASE
CALL FIELDSINFO_IMPORT(16974, 0, 1, null, 16973, null, 'ID', 3, 0, 0, '', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16978, 0, 1, null, 16973, null, 'NAME', 1, 0, 1024, 'Наименование', 'Наименование', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16979, 0, 1, null, 16973, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16980, 0, 1, null, 16973, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16981, 0, 1, null, 16973, null, 'DOCUMENTBASEDATE', 6, 0, 0, 'Дата документа', 'Дата документа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16982, 0, 1, null, 16973, null, 'DOCUMENTBASENUM', 1, 0, 50, '№ документа', 'Номер документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36865, 0, 1, null, 16973, null, 'CODE', 1, 0, 20, 'Код', '', 20, '>aa.aa.aaa', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36866, 0, 1, null, 16973, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36867, 0, 1, null, 16973, null, 'DELETEDATE', 11, 0, 0, 'Дата закрытия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36868, 0, 1, null, 16973, null, 'STARTDATE', 11, 0, 0, 'Дата вступления в действие', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- NOTIFYTYPES
CALL FIELDSINFO_IMPORT(16984, 0, 1, null, 16983, null, 'ID', 3, 0, 0, 'Номер', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16985, 0, 1, null, 16983, null, 'NAME', 1, 0, 1024, 'Тип уведомления', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16986, 0, 1, null, 16983, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16987, 0, 1, null, 16983, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- ORG_CLS
CALL FIELDSINFO_IMPORT(16989, 0, 1, null, 16988, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16990, 0, 1, null, 16988, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16991, 0, 1, null, 16988, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16992, 0, 1, null, 16988, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16993, 0, 1, null, 16988, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16994, 0, 1, null, 16988, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16995, 0, 1, null, 16988, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- ACC_CLS
CALL FIELDSINFO_IMPORT(16997, 0, 1, null, 16996, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16998, 0, 1, null, 16996, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(16999, 0, 1, null, 16996, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17000, 0, 1, null, 16996, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17001, 0, 1, null, 16996, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17002, 0, 1, null, 16996, null, 'SERVICETYPE', 3, 0, 0, 'Вид обслуживания счета', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17003, 0, 1, null, 16996, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17004, 0, 1, null, 16996, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- GROUPINF_CLS
CALL FIELDSINFO_IMPORT(17006, 0, 1, null, 17005, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17007, 0, 1, null, 17005, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17008, 0, 1, null, 17005, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17009, 0, 1, null, 17005, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33025, 0, 1, null, 17005, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33026, 0, 1, null, 17005, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33027, 0, 1, null, 17005, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33028, 0, 1, null, 17005, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BUDGETTYPE
CALL FIELDSINFO_IMPORT(17011, 0, 1, null, 17010, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17012, 0, 1, null, 17010, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17013, 0, 1, null, 17010, null, 'ACCOUNT1', 3, 0, 0, 'Взаимные', '', 11, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17014, 0, 1, null, 17010, null, 'ACCOUNT2', 3, 0, 0, 'Подлежит передаче', '', 11, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17015, 0, 1, null, 17010, null, 'ACCOUNT3', 3, 0, 0, 'Ссуды', '', 11, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33017, 0, 1, null, 17010, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33018, 0, 1, null, 17010, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33019, 0, 1, null, 17010, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31635, 0, 1, null, 17010, null, 'TRANSFERTLEVELKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33020, 0, 1, null, 17010, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PAYTYPECLS
CALL FIELDSINFO_IMPORT(17017, 0, 1, null, 17016, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17018, 0, 1, null, 17016, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17019, 0, 1, null, 17016, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17020, 0, 1, null, 17016, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- ORG_ACCDEFAULTS
CALL FIELDSINFO_IMPORT(17022, 0, 1, null, 17021, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17023, 0, 1, null, 17021, null, 'PAYTYPE', 3, 0, 0, 'Тип платежа', '', 11, '999', '', '', 0, 0, null, 0, 17016, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17024, 0, 1, null, 17021, null, 'PAYQUEUE', 3, 0, 0, 'Очередность платежа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17025, 0, 1, null, 17021, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33045, 0, 1, null, 17021, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33046, 0, 1, null, 17021, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33047, 0, 1, null, 17021, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33048, 0, 1, null, 17021, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REJECTCLS
CALL FIELDSINFO_IMPORT(17027, 0, 1, null, 17026, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17028, 0, 1, null, 17026, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17029, 0, 1, null, 17026, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17030, 0, 1, null, 17026, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17031, 0, 1, null, 17026, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17032, 0, 1, null, 17026, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17033, 0, 1, null, 17026, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- ERROR
CALL FIELDSINFO_IMPORT(17035, 0, 1, null, 17034, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17036, 0, 1, null, 17034, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17037, 0, 1, null, 17034, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17038, 0, 1, null, 17034, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17039, 0, 1, null, 17034, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17040, 0, 1, null, 17034, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17041, 0, 1, null, 17034, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17042, 0, 1, null, 17034, null, 'IMPORTANCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- INNERFINSOURCE
CALL FIELDSINFO_IMPORT(17044, 0, 1, null, 17043, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.9.9.9', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17045, 0, 1, null, 17043, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17046, 0, 1, null, 17043, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17047, 0, 1, null, 17043, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17048, 0, 1, null, 17043, null, 'DIRECTION', 3, 0, 0, 'Направление', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17049, 0, 1, null, 17043, null, 'KVSR', 3, 0, 0, 'КВСР', '', 4, '999', '999', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17050, 0, 1, null, 17043, null, 'DESCRIPTIONCODE', 6, 0, 0, 'Вид источника', '', 20, '99.99.99.99.99.9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17051, 0, 1, null, 17043, null, 'MAINDESCRIPTIONCODE', 3, 0, 0, 'код источника(20 разрядов)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17052, 0, 1, null, 17043, null, 'ITEMCODE', 3, 0, 0, 'Элемент', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17053, 0, 1, null, 17043, null, 'PROGRAMCODE', 3, 0, 0, 'Код программы', '', 11, '9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17054, 0, 1, null, 17043, null, 'KESR', 3, 0, 0, 'ЭКР', '', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17055, 0, 1, null, 17043, null, 'FINSOURCEVALUE', 1, 0, 20, 'Источники внутр. и внешн.  финансирования', 'Классификатор источников внутреннего и внешнего финансирования дефицита бюджета', 31, '999.99.99.99.99.99.9999.999;0;_', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17056, 0, 1, null, 17043, null, 'CLSASPECT', 3, 0, 0, 'Принадлежность: 0 - внутренний, 1 - внешний источник', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17057, 0, 1, null, 17043, null, 'UNIONFLAG', 3, 0, 0, 'Признак обобщения', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17058, 0, 1, null, 17043, null, 'REMOTEFLAG', 3, 0, 0, 'Код удален', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17059, 0, 1, null, 17043, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17060, 0, 1, null, 17043, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24885, 0, 1, null, 17043, null, 'SHORTNAME', 1, 0, 1024, 'Краткое имя', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24886, 0, 1, null, 17043, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32929, 0, 1, null, 17043, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32930, 0, 1, null, 17043, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PAYSYMBOLCLS
CALL FIELDSINFO_IMPORT(17063, 0, 1, null, 17062, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17064, 0, 1, null, 17062, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17065, 0, 1, null, 17062, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17066, 0, 1, null, 17062, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17067, 0, 1, null, 17062, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17068, 0, 1, null, 17062, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- BUHPAYMENTCLS
CALL FIELDSINFO_IMPORT(17070, 0, 1, null, 17069, null, 'ID', 3, 0, 0, 'Код', '', 11, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17071, 0, 1, null, 17069, null, 'SOURCETYPE', 3, 0, 0, 'направление операции для получателя(устарело)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17072, 0, 1, null, 17069, null, 'DESTTYPE', 3, 0, 0, 'направление операции для плательщика(устарело)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17073, 0, 1, null, 17069, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17074, 0, 1, null, 17069, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17075, 0, 1, null, 17069, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- ACCOUNTSCORR
CALL FIELDSINFO_IMPORT(17077, 0, 1, null, 17076, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17078, 0, 1, null, 17076, null, 'DEBIT', 3, 0, 0, 'Дебет', '', 11, '9999', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17079, 0, 1, null, 17076, null, 'CREDIT', 3, 0, 0, 'Кредит', '', 11, '9999', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17080, 0, 1, null, 17076, null, 'NOTE', 1, 0, 255, 'Содержание операции', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17081, 0, 1, null, 17076, null, 'BUHOPERATIONID', 3, 0, 0, '№ операции', '', 11, '999.99', '', '', 0, 0, null, 0, 17069, 1, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17082, 0, 1, null, 17076, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17083, 0, 1, null, 17076, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- PAYDESTINATIONCLS
CALL FIELDSINFO_IMPORT(17085, 0, 1, null, 17084, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17086, 0, 1, null, 17084, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17087, 0, 1, null, 17084, null, 'PRIORITY', 3, 0, 0, 'Приоритет', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17088, 0, 1, null, 17084, null, 'TAXNOTE', 1, 0, 150, 'Налог. платеж', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17089, 0, 1, null, 17084, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17090, 0, 1, null, 17084, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17091, 0, 1, null, 17084, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17092, 0, 1, null, 17084, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17093, 0, 1, null, 17084, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- TYPEOPERATIONCLS
CALL FIELDSINFO_IMPORT(17095, 0, 1, null, 17094, null, 'ID', 3, 0, 0, 'Код', '', 11, '99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17096, 0, 1, null, 17094, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17097, 0, 1, null, 17094, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17098, 0, 1, null, 17094, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- BANKS
CALL FIELDSINFO_IMPORT(17100, 0, 1, null, 17099, null, 'ID', 3, 0, 0, 'Ключ банка(ссылка)', '', 11, '', '', '', 2, 0, null, 1, 16642, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17101, 0, 1, null, 17099, null, 'MFO', 1, 0, 20, 'БИК', '', 13, '999999999;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17102, 0, 1, null, 17099, null, 'COR', 1, 0, 20, 'Кор. счет', '', 24, '99999999999999999999;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17103, 0, 1, null, 17099, null, 'CLOSED', 3, 0, 0, 'Признак закрытия', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17104, 0, 1, null, 17099, null, 'UER', 3, 0, 0, 'Участие в электронных расчетах', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17105, 0, 1, null, 17099, null, 'UERREAL', 3, 0, 0, 'Код контроля', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17106, 0, 1, null, 17099, null, 'PZN', 1, 0, 2, 'Тип участника расчетов', '', 2, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17107, 0, 1, null, 17099, null, 'DATECLOSE', 6, 0, 0, 'Дата закрытия', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33013, 0, 1, null, 17099, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33014, 0, 1, null, 17099, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33015, 0, 1, null, 17099, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33016, 0, 1, null, 17099, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORG_ACCOUNTS
CALL FIELDSINFO_IMPORT(17109, 0, 1, null, 17108, null, 'ID', 3, 0, 0, 'Счет', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17110, 0, 1, null, 17108, null, 'ORG_REF', 3, 0, 0, 'Организация главный распорядитель', 'Ссылка на организацию-главного распорядителя', 11, '', '', '', 0, 0, null, 1, 16642, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17111, 0, 1, null, 17108, null, 'BANK_REF', 3, 0, 0, 'Банк', '', 11, '', '', '', 0, 0, null, 1, 17099, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17112, 0, 1, null, 17108, null, 'ACC', 1, 0, 20, 'Счет', '', 20, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17113, 0, 1, null, 17108, null, 'ACC_CLS', 3, 0, 0, 'Тип счета', 'Тип расчетного счета', 9, '99.99.99', '', '', 0, 0, null, 1, 16996, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17114, 0, 1, null, 17108, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17115, 0, 1, null, 17108, null, 'BANKDEPNUMBER', 1, 0, 255, 'Номер отделения СБ', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17116, 0, 1, null, 17108, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17117, 0, 1, null, 17108, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17118, 0, 1, null, 17108, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17119, 0, 1, null, 17108, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17120, 0, 1, null, 17108, null, 'CLOSED', 3, 0, 0, 'Счет закрыт', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17121, 0, 1, null, 17108, null, 'ACCDEFAULT', 3, 0, 0, 'Очерёдность', '', 4, '999', '', '', 0, 0, null, 0, 17021, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17122, 0, 1, null, 17108, null, 'FACIALCODE', 1, 0, 20, 'Счет обслуживающей организации(Обслуживающая организация)', '', 24, 'AAAAAAAAAAAAAAAAAAAA;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17123, 0, 1, null, 17108, null, 'SERVICE_ORG_REF', 3, 0, 0, 'Ссылка на обслуживающую организацию', '', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17124, 0, 1, null, 17108, null, 'ISDEFAULT', 3, 0, 0, 'Счет по умолчанию', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17125, 0, 1, null, 17108, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17126, 0, 1, null, 17108, null, 'SERVICE_ACC_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17127, 0, 1, null, 17108, null, 'CLOSECODE', 3, 0, 0, 'Причина закрытия', '', 11, '', '', '9999', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17128, 0, 1, null, 17108, null, 'ACOMMENT', 1, 0, 255, 'Описание счета', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26636, 0, 1, null, 17108, null, 'SERVICEACC', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27016, 0, 1, null, 17108, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 13, '', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37184, 0, 1, null, 17108, null, 'DATEOPEN', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37185, 0, 1, null, 17108, null, 'DATECLOSE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- FACIALACC_CLS
CALL FIELDSINFO_IMPORT(17130, 0, 1, null, 17129, null, 'ID', 3, 0, 0, 'Код', '', 13, '999.99.999.9', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17131, 0, 1, null, 17129, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17132, 0, 1, null, 17129, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17133, 0, 1, null, 17129, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17134, 0, 1, null, 17129, null, 'CODE4', 3, 0, 0, 'Раздел 4', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17135, 0, 1, null, 17129, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17136, 0, 1, null, 17129, null, 'KVSR', 3, 0, 0, 'КВСР', 'Ведомственная статья (ППП)', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17137, 0, 1, null, 17129, null, 'KCSR', 3, 0, 0, 'КЦСР', 'Целевая статья', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17138, 0, 1, null, 17129, null, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17139, 0, 1, null, 17129, null, 'KVR', 3, 0, 0, 'КВР', 'Вид расхода', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17140, 0, 1, null, 17129, null, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17141, 0, 1, null, 17129, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', 'Классификатор типа финансирования', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17142, 0, 1, null, 17129, null, 'ORG_REF', 3, 0, 0, 'Организация л\с', 'Организация Лицевого Счета', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17143, 0, 1, null, 17129, null, 'DATEOPEN', 6, 0, 0, 'Дата открытия л\с', 'Дата Открытия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17144, 0, 1, null, 17129, null, 'DATECLOSE', 6, 0, 0, 'Дата закрытия л\с', 'Дата Закрытия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17145, 0, 1, null, 17129, null, 'SERVICEACCOUNT', 3, 0, 0, 'Служебный л\с', 'Признак Служебности Лицевого Счета', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17146, 0, 1, null, 17129, null, 'STATUSACCOUNT', 3, 0, 0, 'Статус л\с', 'Статус Лицевого Счета', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17147, 0, 1, null, 17129, null, 'HARACTERACCOUNT', 3, 0, 0, 'Характер л\с', 'Характер Лицевого Счета', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17148, 0, 1, null, 17129, null, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17149, 0, 1, null, 17129, null, 'FACIALCODE', 1, 0, 20, 'МнемоКод л\с', 'МнемоКод', 20, '00000000000;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17150, 0, 1, null, 17129, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17151, 0, 1, null, 17129, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17152, 0, 1, null, 17129, null, 'GENERALORG_REF', 3, 0, 0, 'Распорядитель л\с', 'Распорядитель лицевого счета', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17153, 0, 1, null, 17129, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17154, 0, 1, null, 17129, null, 'DEPARTMENTCLS', 3, 0, 0, 'Куратор лицевого счета', 'Куратор Лицевого счёта', 9, '99.99.99', '', '', 0, 0, null, 0, 19786, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17155, 0, 1, null, 17129, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17156, 0, 1, null, 17129, null, 'OPENDOCNUMBER', 1, 0, 100, 'НомерИзвещенияОткрытия', 'Номер извещения об открытии л/с', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17157, 0, 1, null, 17129, null, 'CLOSEDOCNUMBER', 1, 0, 20, 'НомерИзвещенияЗакрытия', 'Номер извещения о закрытии л/с', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17158, 0, 1, null, 17129, null, 'HIGHERORG_REF', 3, 0, 0, 'Консолидирующая организация', '', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17159, 0, 1, null, 17129, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 4, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17160, 0, 1, null, 17129, null, 'FCACCOUNT', 3, 0, 0, 'Ссылка на счет в ФК', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17161, 0, 1, null, 17129, null, 'CLOSECODE', 3, 0, 0, 'Причина закрытия', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17162, 0, 1, null, 17129, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17163, 0, 1, null, 17129, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24729, 0, 1, null, 17129, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26617, 0, 1, null, 17129, null, 'FACIALCODEEX', 1, 0, 50, 'Номер Л/С', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26618, 0, 1, null, 17129, null, 'ISBU', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26619, 0, 1, null, 17129, null, 'ISPBS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26620, 0, 1, null, 17129, null, 'ISPROXY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26621, 0, 1, null, 17129, null, 'ISRBS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26622, 0, 1, null, 17129, null, 'ISSEPARATEBU', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27841, 0, 1, null, 17129, null, 'ISOMS', 3, 0, 0, 'ОМС(Характер счета)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29913, 0, 1, null, 17129, null, 'CHANGEDOCNUMBER', 1, 0, 100, 'Номер изв. о переоформл.(Информация об извещениях)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29914, 0, 1, null, 17129, null, 'DATECHANGE', 6, 0, 0, 'Дата переоформления(Информация об извещениях)', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30896, 0, 1, null, 17129, null, 'GENERALORGFACIALACC', 3, 0, 0, 'Л/c распорядителя (учредителя)', '', 13, '999.99.999.9', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30897, 0, 1, null, 17129, null, 'GRANTEEORG_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37183, 0, 1, null, 17129, null, 'PREVCLS', 3, 0, 0, 'Предыдущее значение', '', 11, '', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- PAYDOC32
CALL FIELDSINFO_IMPORT(17165, 0, 1, null, 17164, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17166, 0, 1, null, 17164, null, 'ANUMBER', 3, 0, 0, 'Номер документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17167, 0, 1, null, 17164, null, 'INPUTDATE', 6, 0, 0, 'Дата ввода', 'Дата ввода', 11, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17168, 0, 1, null, 17164, null, 'PRINTDATE', 6, 0, 0, 'Дата печати', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17169, 0, 1, null, 17164, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17170, 0, 1, null, 17164, null, 'PAYERATTRREF', 3, 0, 0, 'р\с финоргана', 'Расчетный счет плательщика (ссылка)', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17171, 0, 1, null, 17164, null, 'ACCEPTORATTRREF', 3, 0, 0, 'Счет получателя', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17172, 0, 1, null, 17164, null, 'SENDBY', 3, 0, 0, 'Вид платежа', '', 4, '999', '', '', 0, 0, null, 0, 17016, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17173, 0, 1, null, 17164, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17174, 0, 1, null, 17164, null, 'CURSUM', 6, 0, 0, 'Сумма в валюте', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17175, 0, 1, null, 17164, null, 'CURRENCY', 3, 0, 0, 'Код валюты', 'Код валюты', 4, '999', '999', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17176, 0, 1, null, 17164, null, 'PAYDATE', 11, 0, 0, 'Дата платежа', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17177, 0, 1, null, 17164, null, 'PAYQUEUE', 3, 0, 0, 'Очередность платежа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17178, 0, 1, null, 17164, null, 'TEXTNOTE', 1, 0, 255, 'Примечание (деталь)', 'Примечание из детализации документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17179, 0, 1, null, 17164, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17180, 0, 1, null, 17164, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17181, 0, 1, null, 17164, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17182, 0, 1, null, 17164, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17183, 0, 1, null, 17164, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17184, 0, 1, null, 17164, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17185, 0, 1, null, 17164, null, 'PARENTINDEX', 3, 0, 0, 'Ключ объединенного ПП', '', 11, '', '', '', 0, 0, null, 0, 17164, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17186, 0, 1, null, 17164, null, 'SOURCEDOCNUMBER', 1, 0, 20, '№ распоряжения', 'Номер реестра', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17187, 0, 1, null, 17164, null, 'CHILDCOUNT', 3, 0, 0, 'Количество дочерних записей', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17188, 0, 1, null, 17164, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17189, 0, 1, null, 17164, null, 'ACCOUNTREF', 3, 0, 0, 'Счет распорядителя', 'Расчетный счет распорядителя кредитов (ссылка)', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17190, 0, 1, null, 17164, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17191, 0, 1, null, 17164, null, 'SOURCEFACIALACC_CLS', 3, 0, 0, 'Лицевой счет плательщика', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17192, 0, 1, null, 17164, null, 'TAXNOTE', 1, 0, 150, 'Налоги', 'Информация о налоге', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17193, 0, 1, null, 17164, null, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17194, 0, 1, null, 17164, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', 'Текст причины отклонения документа', 40, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17195, 0, 1, null, 17164, null, 'REALPAYERORG_REF', 3, 0, 0, 'Организация', '', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17196, 0, 1, null, 17164, null, 'ISDIVIDE', 3, 0, 0, 'Дробление', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17197, 0, 1, null, 17164, null, 'CREDIT', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17198, 0, 1, null, 17164, null, 'DEBIT', 6, 0, 0, 'Сумма инкассового', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17199, 0, 1, null, 17164, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17200, 0, 1, null, 17164, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17201, 0, 1, null, 17164, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17202, 0, 1, null, 17164, null, 'PAYMENTCONDITION', 1, 0, 255, 'Условие оплаты', 'Условие оплаты', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17203, 0, 1, null, 17164, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 4, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26638, 0, 1, null, 17164, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PAYDOCTEMPLATES
CALL FIELDSINFO_IMPORT(17205, 0, 1, null, 17204, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17206, 0, 1, null, 17204, null, 'PAYERATTRREF', 3, 0, 0, 'Счет плательщика', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17207, 0, 1, null, 17204, null, 'ACCEPTORATTRREF', 3, 0, 0, 'Счёт получателя', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17208, 0, 1, null, 17204, null, 'SENDBY', 3, 0, 0, 'Вид платежа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17209, 0, 1, null, 17204, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17210, 0, 1, null, 17204, null, 'CURSUM', 6, 0, 0, 'Сумма в валюте', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17211, 0, 1, null, 17204, null, 'CURRENCY', 3, 0, 0, 'Индекс валюты', '', 11, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17212, 0, 1, null, 17204, null, 'PAYDATE', 11, 0, 0, 'Срок платежа', '', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17213, 0, 1, null, 17204, null, 'PAYQUEUE', 3, 0, 0, 'Очередность платежа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17214, 0, 1, null, 17204, null, 'TEXTNOTE', 1, 0, 255, 'Назначение платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17215, 0, 1, null, 17204, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17216, 0, 1, null, 17204, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17217, 0, 1, null, 17204, null, 'ACOMMENT', 1, 0, 50, 'Название шаблона', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- EXCHANGENUMBER
CALL FIELDSINFO_IMPORT(17219, 0, 1, null, 17218, null, 'PACKNUMBER', 3, 0, 0, 'Текущий индекс номера пакета', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17220, 0, 1, null, 17218, null, 'DOCNUMBER', 3, 0, 0, 'Текущий индекс номера документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17221, 0, 1, null, 17218, null, 'LOCKINGFLAG', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17222, 0, 1, null, 17218, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17223, 0, 1, null, 17218, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17224, 0, 1, null, 17218, null, 'DATEEX', 6, 0, 0, 'Дата', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PAYDOCEXCHANGE
CALL FIELDSINFO_IMPORT(17226, 0, 1, null, 17225, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17227, 0, 1, null, 17225, null, 'PACKETNUMBER', 1, 0, 255, 'Номер электронного пакета ', 'Номер пакета электронного обмена', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17228, 0, 1, null, 17225, null, 'DOCNUMBER', 1, 0, 50, '№ электронного документа', 'Номер электронного документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17229, 0, 1, null, 17225, null, 'SENDDATE', 6, 0, 0, 'Дата отправления пакета', 'Дата отправления', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17230, 0, 1, null, 17225, null, 'ERROR', 3, 0, 0, 'Код ошибки(Обмен с банком)', '', 9, '99.99.99', '', '', 0, 0, null, 0, 17034, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17231, 0, 1, null, 17225, null, 'NOTE', 1, 0, 255, 'Содержание ошибки', 'Примечание электронного документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17232, 0, 1, null, 17225, null, 'PAYDOCREF', 3, 0, 0, 'Ссылка на платежку(казначейскую или финоргановскую)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17233, 0, 1, null, 17225, null, 'STATUS', 3, 0, 0, 'Статус', 'Статус электронного документа', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17234, 0, 1, null, 17225, null, 'QUEUETIME', 11, 0, 0, 'Время постановки в очередь(Обмен с банком)', '', 9, 'hh:mm:ss', 'hh:mm:ss', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17235, 0, 1, null, 17225, null, 'REESTRNUMBER', 1, 0, 20, '№ реестра ЭПД', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17236, 0, 1, null, 17225, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17237, 0, 1, null, 17225, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17238, 0, 1, null, 17225, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17239, 0, 1, null, 17225, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17240, 0, 1, null, 17225, null, 'TYPEINF', 3, 0, 0, '0-финансирование,1-казначейство', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17241, 0, 1, null, 17225, null, 'CODEFORMAT', 3, 0, 0, 'код формата обмена', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17242, 0, 1, null, 17225, null, 'ELPACKETNUMBER', 1, 0, 50, '№ эл. пакета', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- MUTNOTIFCAPT
CALL FIELDSINFO_IMPORT(17244, 0, 1, null, 17243, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17245, 0, 1, null, 17243, null, 'ANUMBER', 1, 0, 20, 'Номер: 02-09', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17246, 0, 1, null, 17243, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17247, 0, 1, null, 17243, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17248, 0, 1, null, 17243, null, 'INPUTDATE', 6, 0, 0, 'Дата ввода', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17249, 0, 1, null, 17243, null, 'BUDSOURCE', 3, 0, 0, 'Из бюджета', '', 11, '', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17250, 0, 1, null, 17243, null, 'BUDDIST', 3, 0, 0, 'В бюджет', '', 11, '', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17251, 0, 1, null, 17243, null, 'INOUT', 3, 0, 0, '0 - входящий 1 - исходящий', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17252, 0, 1, null, 17243, null, 'NOTE', 1, 0, 255, 'В связи: на покрытие расходов', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17253, 0, 1, null, 17243, null, 'SPECIAL', 1, 0, 255, 'Дополнительные указания', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17254, 0, 1, null, 17243, null, 'OSNOVANIE', 1, 0, 255, 'На основании чего перечислено', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17255, 0, 1, null, 17243, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17256, 0, 1, null, 17243, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17257, 0, 1, null, 17243, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17258, 0, 1, null, 17243, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- RPS_DOCUMENT_JOURNAL
CALL FIELDSINFO_IMPORT(17260, 0, 1, null, 17259, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17261, 0, 1, null, 17259, null, 'DOCUMENTDATE', 6, 0, 0, 'Дата документа', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17262, 0, 1, null, 17259, null, 'PACKETSIZE', 3, 0, 0, 'Размер переданного пакета ', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17263, 0, 1, null, 17259, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17264, 0, 1, null, 17259, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DFACCOUNTSBUHTABLE
CALL FIELDSINFO_IMPORT(17266, 0, 1, null, 17265, null, 'BUDGETREF', 3, 0, 0, 'Бюджет', '', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17267, 0, 1, null, 17265, null, 'ID', 3, 0, 0, 'Ключ счета ФО(ссылка)', '', 11, '', '', '', 2, 0, null, 1, 17108, 0, 1, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17268, 0, 1, null, 17265, null, 'BUHACC', 3, 0, 0, 'Бух счет(устарело)', '', 8, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17269, 0, 1, null, 17265, null, 'ACCMODE', 3, 0, 0, 'Принадлежность', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17270, 0, 1, null, 17265, null, 'FIXED', 3, 0, 0, 'Тип', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17271, 0, 1, null, 17265, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17272, 0, 1, null, 17265, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17273, 0, 1, null, 17265, null, 'CURRENCYCLS', 3, 0, 0, 'Валюта', '', 4, '999', '', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17274, 0, 1, null, 17265, null, 'TREASURYACCREF', 3, 0, 0, 'Код счета для казначейства', '', 11, '', '', '', 0, 0, null, 0, 21627, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17275, 0, 1, null, 17265, null, 'FINORGACCREF', 3, 0, 0, 'Код счета для ФО', '', 11, '', '', '', 0, 0, null, 0, 21627, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17276, 0, 1, null, 17265, null, 'IFS', 3, 0, 0, 'Вид источника', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17277, 0, 1, null, 17265, null, 'SINGLEID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17278, 0, 1, null, 17265, null, 'ISCOMMON', 3, 0, 0, 'Единый', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17279, 0, 1, null, 17265, null, 'ISFORBUDGET', 3, 0, 0, 'Бюджетный(Вид использования)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17280, 0, 1, null, 17265, null, 'ISFORBUSINESS', 3, 0, 0, 'Предпринимательский(Вид использования)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17281, 0, 1, null, 17265, null, 'ISFORTEMPORARY', 3, 0, 0, 'Для СВР(Вид использования)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17282, 0, 1, null, 17265, null, 'ISFORCASH', 3, 0, 0, 'Для наличности', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17283, 0, 1, null, 17265, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17284, 0, 1, null, 17265, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17285, 0, 1, null, 17265, null, 'REGIONCLS', 3, 0, 0, 'Район выдачи наличности', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(28251, 0, 1, null, 17265, null, 'FACIALACC_ADB', 3, 0, 0, 'Л/с АДБ', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26548, 0, 1, null, 17265, null, 'ISDEPOSIT', 3, 0, 0, 'Депозитный', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26549, 0, 1, null, 17265, null, 'ISFORBU_AU', 3, 0, 0, 'Для БУ\АУ(Вид использования)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29907, 0, 1, null, 17265, null, 'ISFORTEMPORARYBU_AU', 3, 0, 0, 'Для СВР БУ\АУ(Вид использования)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31655, 0, 1, null, 17265, null, 'ISFORAU', 3, 0, 0, 'Для АУ(Вид использования)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- DFACCOUNTOPERATION
CALL FIELDSINFO_IMPORT(17287, 0, 1, null, 17286, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17288, 0, 1, null, 17286, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17289, 0, 1, null, 17286, null, 'SDFACCOUNT', 3, 0, 0, 'Счет плательщика', 'Расчетный счет плательщика (ссылка)', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17290, 0, 1, null, 17286, null, 'DDFACCOUNT', 3, 0, 0, 'Счет получателя', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17291, 0, 1, null, 17286, null, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17292, 0, 1, null, 17286, null, 'BUDGETREF', 3, 0, 0, 'Бюджет', '', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17293, 0, 1, null, 17286, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '0.00####', '0.00####', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17294, 0, 1, null, 17286, null, 'NOTE', 1, 0, 255, 'Примечание', 'Примечание', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17295, 0, 1, null, 17286, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17296, 0, 1, null, 17286, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17297, 0, 1, null, 17286, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17298, 0, 1, null, 17286, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17299, 0, 1, null, 17286, null, 'DOCNUMBER', 1, 0, 50, 'Номер документа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17300, 0, 1, null, 17286, null, 'FUNDSSOURCE', 3, 0, 0, 'Источник образования', '', 11, '999.999.99', '', '', 0, 0, null, 1, 22632, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25293, 0, 1, null, 17286, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25294, 0, 1, null, 17286, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25295, 0, 1, null, 17286, null, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25296, 0, 1, null, 17286, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25297, 0, 1, null, 17286, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25298, 0, 1, null, 17286, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ACCSOPERTITLE
CALL FIELDSINFO_IMPORT(17302, 0, 1, null, 17301, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17303, 0, 1, null, 17301, null, 'DOCNUMBER', 1, 0, 20, '№ документа', 'Номер документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17304, 0, 1, null, 17301, null, 'NOTE', 1, 0, 255, 'Примечание', 'Примечание', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17305, 0, 1, null, 17301, null, 'BUDGETREF', 3, 0, 0, 'Бюджет', '', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17306, 0, 1, null, 17301, null, 'BUILDDATE', 6, 0, 0, 'Дата ввода', 'Дата ввода', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17307, 0, 1, null, 17301, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17308, 0, 1, null, 17301, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17309, 0, 1, null, 17301, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17310, 0, 1, null, 17301, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- MEANSTYPE
CALL FIELDSINFO_IMPORT(17312, 0, 1, null, 17311, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17313, 0, 1, null, 17311, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17314, 0, 1, null, 17311, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17315, 0, 1, null, 17311, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17316, 0, 1, null, 17311, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17317, 0, 1, null, 17311, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17318, 0, 1, null, 17311, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17319, 0, 1, null, 17311, null, 'ACTIVITYKIND', 3, 0, 0, 'Код вида деятельности', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17320, 0, 1, null, 17311, null, 'TARGETCLS', 3, 0, 0, 'Код цели', '', 11, '999', '', '', 0, 0, null, 0, 22385, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24919, 0, 1, null, 17311, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24920, 0, 1, null, 17311, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29925, 0, 1, null, 17311, null, 'ACTIVITYTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30900, 0, 1, null, 17311, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30901, 0, 1, null, 17311, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BUH_JOURNAL
CALL FIELDSINFO_IMPORT(17322, 0, 1, null, 17321, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17323, 0, 1, null, 17321, null, 'DAT', 6, 0, 0, 'Дата', '', 11, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17324, 0, 1, null, 17321, null, 'DEBIT', 3, 0, 0, 'Дебет', '', 11, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17325, 0, 1, null, 17321, null, 'CREDIT', 3, 0, 0, 'Кредит', '', 11, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17326, 0, 1, null, 17321, null, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17327, 0, 1, null, 17321, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17328, 0, 1, null, 17321, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17329, 0, 1, null, 17321, null, 'CURRENCY', 3, 0, 0, 'Признак валюты ', '', 11, '999', '', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17330, 0, 1, null, 17321, null, 'NOTE', 1, 0, 255, 'Примечание', 'Примечание', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17331, 0, 1, null, 17321, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17332, 0, 1, null, 17321, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17333, 0, 1, null, 17321, null, 'ACCOUNTREF', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17334, 0, 1, null, 17321, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17335, 0, 1, null, 17321, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17336, 0, 1, null, 17321, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзменений', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17337, 0, 1, null, 17321, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17338, 0, 1, null, 17321, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17339, 0, 1, null, 17321, null, 'IFS_CORR', 3, 0, 0, 'ИВВФ', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17340, 0, 1, null, 17321, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17341, 0, 1, null, 17321, null, 'KVSR', 3, 0, 0, 'КВСР', 'Ведомственная статья (ППП)', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17342, 0, 1, null, 17321, null, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17343, 0, 1, null, 17321, null, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17344, 0, 1, null, 17321, null, 'KVR', 3, 0, 0, 'КВР', 'Вид расхода', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17345, 0, 1, null, 17321, null, 'KCSR', 3, 0, 0, 'КЦСР', 'Целевая статья', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17346, 0, 1, null, 17321, null, 'CLSTYPE', 3, 0, 0, 'Признак классификации', 'Признак классификации: 0 - расходная (по умолчанию),1 - источниковая', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17347, 0, 1, null, 17321, null, 'KVSR_CORR', 3, 0, 0, 'КВСР Ключ', '', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17348, 0, 1, null, 17321, null, 'KFSR_CORR', 3, 0, 0, 'КФСР(Корреспондирующая классификация)', '', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17349, 0, 1, null, 17321, null, 'KESR_CORR', 3, 0, 0, 'КЭСР(Корреспондирующая классификация)', '', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17350, 0, 1, null, 17321, null, 'KVR_CORR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17351, 0, 1, null, 17321, null, 'KCSR_CORR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17352, 0, 1, null, 17321, null, 'CLSTYPE_CORR', 3, 0, 0, 'Тип корреспондирующей классификации', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17353, 0, 1, null, 17321, null, 'KD', 3, 0, 0, 'Код дохода (кредит)', '', 11, '', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17354, 0, 1, null, 17321, null, 'KD_CORR', 3, 0, 0, 'Код дохода (дебет)', '', 11, '', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17355, 0, 1, null, 17321, null, 'IFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17356, 0, 1, null, 17321, null, 'DOCNUMBER', 1, 0, 50, 'Номер уточнения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17357, 0, 1, null, 17321, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17358, 0, 1, null, 17321, null, 'ORIGINALNUMBER', 1, 0, 50, 'Номер', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17359, 0, 1, null, 17321, null, 'ORIGINALDATE', 6, 0, 0, 'Дата', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17360, 0, 1, null, 17321, null, 'ORIGINALSUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17361, 0, 1, null, 17321, null, 'ORIGINALPAYERREF', 3, 0, 0, 'Плательщик', '', 11, '', '', '', 0, 0, null, 0, 22391, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17362, 0, 1, null, 17321, null, 'ORIGINALACCEPTORREF', 3, 0, 0, 'Получатель', '', 11, '', '', '', 0, 0, null, 0, 22391, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17363, 0, 1, null, 17321, null, 'ORIGINALNOTE', 1, 0, 255, 'Назначение платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17364, 0, 1, null, 17321, null, 'ORIGINALPROGINDEX', 3, 0, 0, 'Класс исходного документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17365, 0, 1, null, 17321, null, 'ORIGINALRECORDINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17366, 0, 1, null, 17321, null, 'SOURCEPROGINDEX', 3, 0, 0, 'Класс корректирующего документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17367, 0, 1, null, 17321, null, 'SOURCERECORDINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17368, 0, 1, null, 17321, null, 'DESTPROGINDEX', 3, 0, 0, 'Класс нового документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17369, 0, 1, null, 17321, null, 'DESTRECORDINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17370, 0, 1, null, 17321, null, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17371, 0, 1, null, 17321, null, 'FACT_CORR', 3, 0, 0, 'Мероприятие', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17372, 0, 1, null, 17321, null, 'MEANSTYPE_CORR', 3, 0, 0, 'Тип средств', '', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17373, 0, 1, null, 17321, null, 'REGIONCLS_CORR', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17374, 0, 1, null, 17321, null, 'FACIALACC_CLS', 3, 0, 0, 'Уточняемый л/с', '', 11, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17375, 0, 1, null, 17321, null, 'FACIALACC_CLS_CORR', 3, 0, 0, 'Новый л/с', '', 11, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17376, 0, 1, null, 17321, null, 'FINSOURCE', 3, 0, 0, 'Источник финансирования', 'Источник финансирования', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17377, 0, 1, null, 17321, null, 'FINSOURCE_CORR', 3, 0, 0, 'Источник финансирования', '', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17378, 0, 1, null, 17321, null, 'NOTEEX', 1, 0, 255, 'Основание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17379, 0, 1, null, 17321, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17380, 0, 1, null, 17321, null, 'DIRECTIONCLS_CORR', 3, 0, 0, 'Направление(Корреспондирующая классификация)', '', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17381, 0, 1, null, 17321, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', 'Классификатор типа финансирования', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17382, 0, 1, null, 17321, null, 'FINTYPE_CORR', 3, 0, 0, 'Тип финансирования', '', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17383, 0, 1, null, 17321, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', 'Классификатор типа документа', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17384, 0, 1, null, 17321, null, 'DOCTYPE_CORR', 3, 0, 0, 'Тип документа', '', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17385, 0, 1, null, 17321, null, 'NEEDSENDUFK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17386, 0, 1, null, 17321, null, 'NEEDPERFORM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17387, 0, 1, null, 17321, null, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17388, 0, 1, null, 17321, null, 'SUBKESR_CORR', 3, 0, 0, 'СубКЭСР', '', 10, '999.99.99', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17389, 0, 1, null, 17321, null, 'DESTORGREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22391, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17390, 0, 1, null, 17321, null, 'REJECT_CLS', 3, 0, 0, 'Код причины отклонения', '', 11, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17391, 0, 1, null, 17321, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17392, 0, 1, null, 17321, null, 'FUNDSSOURCE', 3, 0, 0, 'Источник образования', '', 11, '999.999.99', '', '', 0, 0, null, 1, 22632, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17393, 0, 1, null, 17321, null, 'FUNDSSOURCE_CORR', 3, 0, 0, 'Источник образования', '', 11, '999.999.99', '', '', 0, 0, null, 1, 22632, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17394, 0, 1, null, 17321, null, 'ISBLOCKED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17395, 0, 1, null, 17321, null, 'BLOCKEDCAUSE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17396, 0, 1, null, 17321, null, 'UNBLOCKEDDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17397, 0, 1, null, 17321, null, 'UNBLOCKEDCAUSE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17398, 0, 1, null, 17321, null, 'ISBLOCKED_COR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17399, 0, 1, null, 17321, null, 'BLOCKEDCAUSE_COR', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17400, 0, 1, null, 17321, null, 'UNBLOCKEDDATE_COR', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17401, 0, 1, null, 17321, null, 'UNBLOCKEDCAUSE_COR', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- MEM_WARRANT
CALL FIELDSINFO_IMPORT(17403, 0, 1, null, 17402, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17404, 0, 1, null, 17402, null, 'DATE_MONTH', 6, 0, 0, 'Дата', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17405, 0, 1, null, 17402, null, 'NUM_MEM', 3, 0, 0, '№ МО', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17406, 0, 1, null, 17402, null, 'WORK_FL', 3, 0, 0, 'Рабочие дни', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17407, 0, 1, null, 17402, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BUDGETDATA
CALL FIELDSINFO_IMPORT(17409, 0, 1, null, 17408, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17410, 0, 1, null, 17408, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 4, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17411, 0, 1, null, 17408, null, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17412, 0, 1, null, 17408, null, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '000', '000', 0, 0, null, 1, 16851, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17413, 0, 1, null, 17408, null, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '000', '000', 0, 0, null, 1, 16857, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17414, 0, 1, null, 17408, null, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '000', '000', 0, 0, null, 1, 16864, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17415, 0, 1, null, 17408, null, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17416, 0, 1, null, 17408, null, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '9.9.9', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17417, 0, 1, null, 17408, null, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17418, 0, 1, null, 17408, null, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17419, 0, 1, null, 17408, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17420, 0, 1, null, 17408, null, 'ACC_REF', 3, 0, 0, 'Счет распорядителя', 'Расчетный счет распорядителя кредитов (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17421, 0, 1, null, 17408, null, 'QUARTER1', 6, 0, 0, 'Роспись за 1 квартал', 'Сумма по кассовому плану за 1 квартал', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17422, 0, 1, null, 17408, null, 'QUARTER2', 6, 0, 0, 'Роспись за 2 квартал', 'Сумма по кассовому плану за 2 квартал', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17423, 0, 1, null, 17408, null, 'QUARTER3', 6, 0, 0, 'Роспись за 3 квартал', 'Сумма по кассовому плану за 3 квартал', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17424, 0, 1, null, 17408, null, 'QUARTER4', 6, 0, 0, 'Роспись за 4 квартал', 'Сумма по кассовому плану за 4 квартал', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17425, 0, 1, null, 17408, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', 'Классификатор типа финансирования', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17426, 0, 1, null, 17408, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17427, 0, 1, null, 17408, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17428, 0, 1, null, 17408, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17429, 0, 1, null, 17408, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17430, 0, 1, null, 17408, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзменений', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17431, 0, 1, null, 17408, null, 'NOTE', 1, 0, 2000, 'Примечание', 'Примечание', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17432, 0, 1, null, 17408, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17433, 0, 1, null, 17408, null, 'RECORDINDEX', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 0, 17463, 1, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17434, 0, 1, null, 17408, null, 'SENDERID', 3, 0, 0, 'Код отправителя записи', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17435, 0, 1, null, 17408, null, 'SENDERRECORDID', 3, 0, 0, 'Код УРМ записи', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17436, 0, 1, null, 17408, null, 'MONTH01', 6, 0, 0, 'Роспись за январь', 'Сумма по кассовому плану за январь', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17437, 0, 1, null, 17408, null, 'MONTH02', 6, 0, 0, 'Роспись за февраль', 'Сумма по кассовому плану за февраль', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17438, 0, 1, null, 17408, null, 'MONTH03', 6, 0, 0, 'Роспись за март', 'Сумма по кассовому плану за март', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17439, 0, 1, null, 17408, null, 'MONTH04', 6, 0, 0, 'Роспись за апрель', 'Сумма по кассовому плану за апрель', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17440, 0, 1, null, 17408, null, 'MONTH05', 6, 0, 0, 'Роспись за май', 'Сумма по кассовому плану за май', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17441, 0, 1, null, 17408, null, 'MONTH06', 6, 0, 0, 'Роспись за июнь', 'Сумма по кассовому плану за июнь', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17442, 0, 1, null, 17408, null, 'MONTH07', 6, 0, 0, 'Роспись за июль', 'Сумма по кассовому плану за июль', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17443, 0, 1, null, 17408, null, 'MONTH08', 6, 0, 0, 'Роспись за август', 'Сумма по кассовому плану за август', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17444, 0, 1, null, 17408, null, 'MONTH09', 6, 0, 0, 'Роспись за сентябрь', 'Сумма по кассовому плану за сентябрь', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17445, 0, 1, null, 17408, null, 'MONTH10', 6, 0, 0, 'Роспись за октябрь', 'Сумма по кассовому плану за октябрь', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17446, 0, 1, null, 17408, null, 'MONTH11', 6, 0, 0, 'Роспись за ноябрь', 'Сумма по кассовому плану за ноябрь', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17447, 0, 1, null, 17408, null, 'MONTH12', 6, 0, 0, 'Роспись за декабрь', 'Сумма по кассовому плану за декабрь', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17448, 0, 1, null, 17408, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17449, 0, 1, null, 17408, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17450, 0, 1, null, 17408, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '000', '000', 0, 0, null, 1, 21555, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17451, 0, 1, null, 17408, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17452, 0, 1, null, 17408, null, 'IFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17453, 0, 1, null, 17408, null, 'CLSTYPE', 3, 0, 0, 'Признак классификации', 'Признак классификации: 0 - расходная (по умолчанию),1 - источниковая', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17454, 0, 1, null, 17408, null, 'ORG_REF', 3, 0, 0, 'Организация', 'Ссылка на организацию из детали', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17455, 0, 1, null, 17408, null, 'UNIONNOTIFYREF', 3, 0, 0, 'Сводное уведомление', '', 11, '', '', '', 0, 0, null, 0, 21709, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17456, 0, 1, null, 17408, null, 'FUNDSSOURCE', 3, 0, 0, 'Источник образования', 'Источник образования средств', 11, '999.999.99', '', '', 0, 0, null, 1, 22632, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17457, 0, 1, null, 17408, null, 'SUMMAYEAR1', 6, 0, 0, 'СБР на первый год', 'Сумма бюджетной росписи на текущий финансовый год', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 49, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17458, 0, 1, null, 17408, null, 'SUMMAYEAR2', 6, 0, 0, 'СБР на второй год', 'Сумма бюджетной росписи на второй плановый год', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 50, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17459, 0, 1, null, 17408, null, 'SUMMAYEAR3', 6, 0, 0, 'СБР на третийй год', 'Сумма бюджетной росписи на третий плановый год', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 51, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17460, 0, 1, null, 17408, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17461, 0, 1, null, 17408, null, 'KESRCORR', 3, 0, 0, 'Корреспондирующий КЭСР', 'Корреспондирующий КЭСР', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17462, 0, 1, null, 17408, null, 'ASSIGNMENTKIND', 3, 0, 0, 'Вид ассигнований', 'Вид ассигнований', 9, '99.99.99', '', '', 0, 0, null, 1, 22976, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29463, 0, 1, null, 17408, null, 'TRANSFERTORG_REF', 3, 0, 0, 'Получатель субсидии(трансферта)', 'Ссылка на организацию получателя субсидии(трансферта) из детали', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26542, 0, 1, null, 17408, null, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27834, 0, 1, null, 17408, null, 'BUDALLOCATIONCLS', 3, 0, 0, 'Код бюджетного ассигнованияКлюч', '', 9, '9999999', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27835, 0, 1, null, 17408, null, 'PAYPROMISECLS', 3, 0, 0, 'Код расходного обязательстваКлюч', '', 13, '999999999', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27836, 0, 1, null, 17408, null, 'SUBSIDYCLSOLD', 3, 0, 0, 'Прежний код субсидии', '', 12, '999.99.9999', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25268, 0, 1, null, 17408, null, 'DAYPLAN', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25269, 0, 1, null, 17408, null, 'DAYPLANSUMMA', 6, 0, 0, 'Сумма заявки', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 56, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25270, 0, 1, null, 17408, null, 'KD', 3, 0, 0, 'КД', 'Ссылка на код дохода', 11, '', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25271, 0, 1, null, 17408, null, 'SUBKD', 3, 0, 0, 'СубКД', 'Классификатор суб кода дохода', 9, '99.99.99', '', '', 0, 0, null, 1, 16928, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30005, 0, 1, null, 17408, null, 'DEPARTMENTCLS', 3, 0, 0, 'Отдел', '', 9, '99.99.99', '', '', 0, 0, null, 1, 19786, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- BUDNOTIFY
CALL FIELDSINFO_IMPORT(17464, 0, 1, null, 17463, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17465, 0, 1, null, 17463, null, 'DAT', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17466, 0, 1, null, 17463, null, 'DOCDAT', 6, 0, 0, 'Дата документа-основания', 'Дата документа-основания', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17467, 0, 1, null, 17463, null, 'DOCNUMBER', 1, 0, 50, '№ документа-основания', 'Номер документа-основания', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17468, 0, 1, null, 17463, null, 'NOTE', 1, 0, 1024, 'Основание', 'Основание', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17469, 0, 1, null, 17463, null, 'NOTE1', 1, 0, 255, 'ПримечаниеДокумент', 'Примечание из заголовка', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17470, 0, 1, null, 17463, null, 'NOTE2', 1, 0, 1024, 'По вопросу', 'По вопросу (расшифровка документа-основания)', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17471, 0, 1, null, 17463, null, 'NOTIFYTYPE', 3, 0, 0, 'Источник финансирования', 'Источник финансирования', 4, '999', '000', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17472, 0, 1, null, 17463, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17473, 0, 1, null, 17463, null, 'DOCBASE', 3, 0, 0, 'Тип документа основания', 'Классификатор типа документа-оснвания', 10, '99.99.999', '', '', 0, 0, null, 1, 16973, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17474, 0, 1, null, 17463, null, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17475, 0, 1, null, 17463, null, 'SENDERID', 3, 0, 0, 'Код отправителя документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17476, 0, 1, null, 17463, null, 'SENDERRECORDID', 3, 0, 0, 'Код УРМ документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17477, 0, 1, null, 17463, null, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17478, 0, 1, null, 17463, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', 'dd/mm/yyyy hh:mm:ss', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17479, 0, 1, null, 17463, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', 'dd/mm/yyyy hh:mm:ss', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17480, 0, 1, null, 17463, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзмененийДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17481, 0, 1, null, 17463, null, 'DOCUMENTSTATE', 1, 0, 1, 'Состояние документа', '', 1, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17482, 0, 1, null, 17463, null, 'USERSVISA', 1, 0, 10, 'Виза пользователя', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17483, 0, 1, null, 17463, null, 'DATEINPUT', 6, 0, 0, 'Дата документа', 'Дата документа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17484, 0, 1, null, 17463, null, 'ORGREF', 3, 0, 0, 'Организация', 'Ссылка на организацию из заголовка', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17485, 0, 1, null, 17463, null, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17486, 0, 1, null, 17463, null, 'REJECTNOTE', 1, 0, 255, 'Текст причины отклонения', 'Текст причины отклонения документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17487, 0, 1, null, 17463, null, 'PLANDOCTYPE', 3, 0, 0, 'Вид плана', 'Вид плана', 5, '9.99', '', '', 0, 0, null, 1, 20686, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17488, 0, 1, null, 17463, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17489, 0, 1, null, 17463, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17490, 0, 1, null, 17463, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', 'Статус электронной цифровой подписи', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17491, 0, 1, null, 17463, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17492, 0, 1, null, 17463, null, 'DOCSTATEREF', 3, 0, 0, 'СостояниеДокумента', 'Состояние документа', 11, '', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17493, 0, 1, null, 17463, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17494, 0, 1, null, 17463, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17495, 0, 1, null, 17463, null, 'LASTEXTRCHANGE', 11, 0, 0, 'Дата экстренного изменения', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17496, 0, 1, null, 17463, null, 'BIDNUMBER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17497, 0, 1, null, 17463, null, 'FAXDOCCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17498, 0, 1, null, 17463, null, 'ATYPE', 3, 0, 0, 'ТипБюджета', 'Тип документа. 0-роспись, 1-уведомление.', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17499, 0, 1, null, 17463, null, 'ANUMBER', 1, 0, 20, '№ документа', 'Номер документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17500, 0, 1, null, 17463, null, 'PLANKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22954, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17501, 0, 1, null, 17463, null, 'ASSIGNMENTSOURCE', 3, 0, 0, 'Вид изменений', 'Вид изменений', 8, '99.99.9', '', '', 0, 0, null, 1, 22983, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17502, 0, 1, null, 17463, null, 'BA_LBO_FLAG', 3, 0, 0, 'ПринадлежностьБА_ЛБО', 'Признак определяющий является ли документ лимитом или бюджетными ассигнованием(0- “БА, ЛБО”, 1- “БА”, 2- “ЛБО”)', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24698, 0, 1, null, 17463, null, 'CLSTYPE', 3, 0, 0, 'Тип классификации', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24699, 0, 1, null, 17463, null, 'DATE_UTV_PP', 6, 0, 0, 'Дата введения в действие', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24700, 0, 1, null, 17463, null, 'KPPERIOD', 3, 0, 0, 'Период планирования КП', 'Период планирования КП, КП по ПБС', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36043, 0, 1, null, 17463, null, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INCOMESDATA
CALL FIELDSINFO_IMPORT(17512, 0, 1, null, 17511, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17513, 0, 1, null, 17511, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17514, 0, 1, null, 17511, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '9.99.99.99.99', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17515, 0, 1, null, 17511, null, 'SUBKD', 3, 0, 0, 'Суб.код дохода', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16928, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17516, 0, 1, null, 17511, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17517, 0, 1, null, 17511, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17518, 0, 1, null, 17511, null, 'QUARTER1', 6, 0, 0, 'Квартал 1', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17519, 0, 1, null, 17511, null, 'QUARTER2', 6, 0, 0, 'Квартал 2', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17520, 0, 1, null, 17511, null, 'QUARTER3', 6, 0, 0, 'Квартал 3', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17521, 0, 1, null, 17511, null, 'QUARTER4', 6, 0, 0, 'Квартал 4', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17522, 0, 1, null, 17511, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17523, 0, 1, null, 17511, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17524, 0, 1, null, 17511, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 17616, 1, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17525, 0, 1, null, 17511, null, 'MONTH01', 6, 0, 0, 'Январь', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17526, 0, 1, null, 17511, null, 'MONTH02', 6, 0, 0, 'Февраль', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17527, 0, 1, null, 17511, null, 'MONTH03', 6, 0, 0, 'Март', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17528, 0, 1, null, 17511, null, 'MONTH04', 6, 0, 0, 'Апрель', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17529, 0, 1, null, 17511, null, 'MONTH05', 6, 0, 0, 'Май', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17530, 0, 1, null, 17511, null, 'MONTH06', 6, 0, 0, 'Июнь', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17531, 0, 1, null, 17511, null, 'MONTH07', 6, 0, 0, 'Июль', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17532, 0, 1, null, 17511, null, 'MONTH08', 6, 0, 0, 'Август', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17533, 0, 1, null, 17511, null, 'MONTH09', 6, 0, 0, 'Сентябрь', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17534, 0, 1, null, 17511, null, 'MONTH10', 6, 0, 0, 'Октябрь', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17535, 0, 1, null, 17511, null, 'MONTH11', 6, 0, 0, 'Ноябрь', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17536, 0, 1, null, 17511, null, 'MONTH12', 6, 0, 0, 'Декабрь', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17537, 0, 1, null, 17511, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17538, 0, 1, null, 17511, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17539, 0, 1, null, 17511, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17540, 0, 1, null, 17511, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17541, 0, 1, null, 17511, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17542, 0, 1, null, 17511, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17543, 0, 1, null, 17511, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17544, 0, 1, null, 17511, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17545, 0, 1, null, 17511, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17546, 0, 1, null, 17511, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17547, 0, 1, null, 17511, null, 'FUNDSSOURCE', 3, 0, 0, 'Источник образования', '', 11, '999.999.99', '', '', 0, 0, null, 1, 22632, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17548, 0, 1, null, 17511, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17549, 0, 1, null, 17511, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', '', 11, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17550, 0, 1, null, 17511, null, 'SUMMAYEAR1', 6, 0, 0, '', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17551, 0, 1, null, 17511, null, 'SUMMAYEAR2', 6, 0, 0, 'Второй плановый год', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17552, 0, 1, null, 17511, null, 'SUMMAYEAR3', 6, 0, 0, 'Третий плановый год', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17553, 0, 1, null, 17511, null, 'ASSIGNMENTKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22976, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PROMISE_CAPTION
CALL FIELDSINFO_IMPORT(17584, 0, 1, null, 17583, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17585, 0, 1, null, 17583, null, 'ANUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17586, 0, 1, null, 17583, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17587, 0, 1, null, 17583, null, 'ACCEPTED_REVERTED', 3, 0, 0, 'Принятые - непринятые', 'Признак принятия или непринятия', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17588, 0, 1, null, 17583, null, 'AGREEMENT_NUM', 1, 0, 50, '№ документа', 'Номер документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17589, 0, 1, null, 17583, null, 'AGREEMENT_DATE', 6, 0, 0, 'Дата документа', 'Дата документа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17590, 0, 1, null, 17583, null, 'AGREEMENT_END', 6, 0, 0, 'Дата завершения', 'Дата завершения', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17591, 0, 1, null, 17583, null, 'AGREEMENT_NOTE', 1, 0, 255, 'Краткое содержание договора', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17592, 0, 1, null, 17583, null, 'AGREEMENT_TYPE', 3, 0, 0, 'Тип документа', 'Тип документа бюджетного обязательства', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17593, 0, 1, null, 17583, null, 'AGREEMENT_SUMMA', 6, 0, 0, 'Сумма договора бюджетных обязательств за период', 'Сумма договора бюджетных обязательств за период', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17594, 0, 1, null, 17583, null, 'SUPPLIER_REF', 3, 0, 0, 'Организация поставщик', 'Организация поставщик', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17595, 0, 1, null, 17583, null, 'DELIVERY_RULES', 1, 0, 255, 'Условие поставки', 'Условие поставки', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17596, 0, 1, null, 17583, null, 'TOTALSUMM', 6, 0, 0, 'Сумма бюджетных обязательств за период', 'Сумма бюджетных обязательств за период', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17597, 0, 1, null, 17583, null, 'BUDGETORG_REF', 3, 0, 0, 'БюджетнаяОрганизация', 'Бюджетная организация', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17598, 0, 1, null, 17583, null, 'FACIALACC_CLS', 3, 0, 0, 'л\с заголовка', 'Лицевой счет заголовка бюджетных обязательств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17599, 0, 1, null, 17583, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17600, 0, 1, null, 17583, null, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17601, 0, 1, null, 17583, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17602, 0, 1, null, 17583, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17603, 0, 1, null, 17583, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17604, 0, 1, null, 17583, null, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17605, 0, 1, null, 17583, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', 'Текст причины отклонения документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17606, 0, 1, null, 17583, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17607, 0, 1, null, 17583, null, 'SENDERID', 3, 0, 0, 'Код удалённого клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17608, 0, 1, null, 17583, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17609, 0, 1, null, 17583, null, 'DOCUMENTSTATE', 1, 0, 1, 'Текущее состояние документа в плане иерархии', '', 1, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17610, 0, 1, null, 17583, null, 'USERSVISA', 1, 0, 10, 'Виза пользователя', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17611, 0, 1, null, 17583, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17612, 0, 1, null, 17583, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17613, 0, 1, null, 17583, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17614, 0, 1, null, 17583, null, 'BIDNUMBER', 1, 0, 50, 'Номер заявки', 'Номер заявки', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17615, 0, 1, null, 17583, null, 'FAXDOCCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27858, 0, 1, null, 17583, null, 'ADVANCESUMMA', 6, 0, 0, 'Сумма аванса', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27859, 0, 1, null, 17583, null, 'INFONUMBER', 1, 0, 50, '№ сведения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25479, 0, 1, null, 17583, null, 'SUPPLIER_ACC_REF', 3, 0, 0, 'Р/с поставщика', 'Расчетный счет поставщика', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- INCOMESNOTIF
CALL FIELDSINFO_IMPORT(17617, 0, 1, null, 17616, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17618, 0, 1, null, 17616, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17619, 0, 1, null, 17616, null, 'BUILDDATE', 6, 0, 0, 'Дата ввода', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17620, 0, 1, null, 17616, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17621, 0, 1, null, 17616, null, 'DOCBASEDATE', 6, 0, 0, 'Дата документа-основания', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17622, 0, 1, null, 17616, null, 'DOCBASENUMBER', 1, 0, 50, 'Номер документа-основания', '', 40, '99.99.999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17623, 0, 1, null, 17616, null, 'DOCBASETYPE', 3, 0, 0, 'Тип документа-основания', '', 11, '99.99.999', '', '', 0, 0, null, 1, 16973, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17624, 0, 1, null, 17616, null, 'NOTE', 1, 0, 255, 'Основание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17625, 0, 1, null, 17616, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17626, 0, 1, null, 17616, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17627, 0, 1, null, 17616, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17628, 0, 1, null, 17616, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17629, 0, 1, null, 17616, null, 'VARIANT', 3, 0, 0, 'Вариант', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17630, 0, 1, null, 17616, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17631, 0, 1, null, 17616, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17632, 0, 1, null, 17616, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17633, 0, 1, null, 17616, null, 'LASTEXTRCHANGE', 11, 0, 0, 'Дата экстренного изменения', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17634, 0, 1, null, 17616, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 11, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17635, 0, 1, null, 17616, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17636, 0, 1, null, 17616, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17637, 0, 1, null, 17616, null, 'PLANDOCTYPE', 3, 0, 0, '', '', 11, '9.99', '', '', 0, 0, null, 1, 20686, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17638, 0, 1, null, 17616, null, 'ANUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17639, 0, 1, null, 17616, null, 'ATYPE', 3, 0, 0, 'Тип', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17640, 0, 1, null, 17616, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17641, 0, 1, null, 17616, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17642, 0, 1, null, 17616, null, 'ASSIGNMENTSOURCE', 3, 0, 0, 'Вид изменений', '', 11, '99.99.9', '', '', 0, 0, null, 1, 22983, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24857, 0, 1, null, 17616, null, 'KPPERIOD', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- QUOTESTITLE
CALL FIELDSINFO_IMPORT(17644, 0, 1, null, 17643, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17645, 0, 1, null, 17643, null, 'BUILDDATE', 6, 0, 0, 'Дата ввода', 'Дата ввода', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17646, 0, 1, null, 17643, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17647, 0, 1, null, 17643, null, 'INCACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17648, 0, 1, null, 17643, null, 'DOCNUMBER', 1, 0, 20, '№ документа', 'Номер документа из заголовка', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17649, 0, 1, null, 17643, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17650, 0, 1, null, 17643, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17651, 0, 1, null, 17643, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17652, 0, 1, null, 17643, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17653, 0, 1, null, 17643, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17654, 0, 1, null, 17643, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17655, 0, 1, null, 17643, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17656, 0, 1, null, 17643, null, 'TYPEOPERATIONCLS', 3, 0, 0, 'Тип операции', 'Классификатор типа операции', 3, '99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17657, 0, 1, null, 17643, null, 'REESTRDATE', 6, 0, 0, 'ДатаФедРеестра', 'Дата федерального реестра', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17658, 0, 1, null, 17643, null, 'REESTRNUMBER', 1, 0, 20, '№ реестра', 'Номер реестра', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17659, 0, 1, null, 17643, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17660, 0, 1, null, 17643, null, 'SENDERID', 3, 0, 0, 'Код отправителя документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17661, 0, 1, null, 17643, null, 'SENDERRECORDID', 3, 0, 0, 'Код УРМ документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17662, 0, 1, null, 17643, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой Счет Администратора', 'Лицевой Счет Администратора', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17663, 0, 1, null, 17643, null, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17664, 0, 1, null, 17643, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', 'Текст причины отклонения документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17665, 0, 1, null, 17643, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17666, 0, 1, null, 17643, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17667, 0, 1, null, 17643, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27626, 0, 1, null, 17643, null, 'DEPARTMENTCLS', 3, 0, 0, 'Отдел', '', 9, '99.99.99', '', '', 0, 0, null, 1, 19786, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25481, 0, 1, null, 17643, null, 'DOCSTATEREF', 3, 0, 0, 'СостояниеДокумента', 'Состояние документа', 11, '', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36046, 0, 1, null, 17643, null, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INCOMES32
CALL FIELDSINFO_IMPORT(17669, 0, 1, null, 17668, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17670, 0, 1, null, 17668, null, 'DOCNUMBER', 3, 0, 0, '№ документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17671, 0, 1, null, 17668, null, 'DOCCOUNT', 3, 0, 0, 'Кол-во док.', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17672, 0, 1, null, 17668, null, 'IDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия из детализации', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17673, 0, 1, null, 17668, null, 'DEBIT', 6, 0, 0, 'Сумма дебет', 'Сумма по дебету', 13, '', '0.00####', '0.00####', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17674, 0, 1, null, 17668, null, 'CREDIT', 6, 0, 0, 'Сумма кредит', 'Сумма по кредиту', 13, '', '0.00####', '0.00####', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17675, 0, 1, null, 17668, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', 'Классификатор типа документа', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17676, 0, 1, null, 17668, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '9999999999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17677, 0, 1, null, 17668, null, 'ORG_REF', 3, 0, 0, 'Организация', 'Организация', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17678, 0, 1, null, 17668, null, 'ACCOUNTINDEX', 3, 0, 0, 'Слой', 'Слой доходов', 4, '999', '', '', 0, 0, null, 1, 16910, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17679, 0, 1, null, 17668, null, 'ACCOUNTREF', 3, 0, 0, 'Счет распорядителя', 'Расчетный счет распорядителя кредитов (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17680, 0, 1, null, 17668, null, 'KD', 3, 0, 0, 'КД', 'Ссылка на код дохода', 11, '9.99.99.99.99', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17681, 0, 1, null, 17668, null, 'SUBKD', 3, 0, 0, 'СубКД', 'Классификатор суб кода дохода', 9, '99.99.99', '', '', 0, 0, null, 1, 16928, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17682, 0, 1, null, 17668, null, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17683, 0, 1, null, 17668, null, 'GOSNI', 3, 0, 0, 'ГосНИ', 'ГОСНИ', 6, '99.99', '', '', 0, 0, null, 1, 16948, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17684, 0, 1, null, 17668, null, 'INCACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17685, 0, 1, null, 17668, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17686, 0, 1, null, 17668, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', 'Ссылка мастер записи на деталь запись', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17687, 0, 1, null, 17668, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 4, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17688, 0, 1, null, 17668, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17689, 0, 1, null, 17668, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 11, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17690, 0, 1, null, 17668, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 11, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17691, 0, 1, null, 17668, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзменений', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17692, 0, 1, null, 17668, null, 'NOTE', 1, 0, 255, 'ПримечаниеДет', 'Примечание из детализации документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17693, 0, 1, null, 17668, null, 'RECORDINDEX2', 3, 0, 0, 'Индекс программы ', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17694, 0, 1, null, 17668, null, 'ELNUM', 1, 0, 20, 'Номер эл. документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17695, 0, 1, null, 17668, null, 'ELPACKETNUM', 1, 0, 20, 'Номер эл. пакета', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17696, 0, 1, null, 17668, null, 'NOTEEX', 1, 0, 255, 'Назначение', 'Назначение электронного документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17697, 0, 1, null, 17668, null, 'FACIALACC_CLS', 3, 0, 0, 'С лицевого счета', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17698, 0, 1, null, 17668, null, 'NDS', 6, 0, 0, 'Сумма', 'Сумма НДС', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17699, 0, 1, null, 17668, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17700, 0, 1, null, 17668, null, 'BUHPAYMENTCLS', 3, 0, 0, 'Вид учета (старый)', 'Старый классификатор бухгалтерской проводки (Вида учета (старый))', 4, '999', '', '', 0, 0, null, 1, 17069, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17701, 0, 1, null, 17668, null, 'RECORDDATE', 6, 0, 0, 'ДатаУчета', 'Дата документа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17702, 0, 1, null, 17668, null, 'TOTALREF', 3, 0, 0, 'Код документа', 'Код заголовка обобщенной заявки', 11, '', '', '', 0, 0, null, 0, 17876, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17703, 0, 1, null, 17668, null, 'REQUESTSINDEX', 3, 0, 0, 'Индекс заявки', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17704, 0, 1, null, 17668, null, 'KVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17705, 0, 1, null, 17668, null, 'TAXNOTE', 1, 0, 150, 'Налоги', 'Информация о налоге', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17706, 0, 1, null, 17668, null, 'REALPAYERORG_REF', 3, 0, 0, 'Организация', '', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17707, 0, 1, null, 17668, null, 'DOCNUM', 1, 0, 50, 'Номер распоряжения', 'Номер распоряжения из детализации', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17708, 0, 1, null, 17668, null, 'DOCDATE', 6, 0, 0, 'Дата документа', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17709, 0, 1, null, 17668, null, 'DOCBASE', 3, 0, 0, 'Документ-основание', '', 10, '99.99.999', '', '', 0, 0, null, 1, 16973, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17710, 0, 1, null, 17668, null, 'FACT', 3, 0, 0, 'С мероприятия', 'Мероприятие', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17711, 0, 1, null, 17668, null, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17712, 0, 1, null, 17668, null, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17713, 0, 1, null, 17668, null, 'KVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17714, 0, 1, null, 17668, null, 'KCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17715, 0, 1, null, 17668, null, 'SUMCOMPLETE', 3, 0, 0, 'Признак того, что вся сумма по данной записи была израсходована', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17716, 0, 1, null, 17668, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17717, 0, 1, null, 17668, null, 'ELDOCREF', 3, 0, 0, 'Электронный документ', '', 11, '', '', '', 0, 0, null, 0, 19295, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17718, 0, 1, null, 17668, null, 'REQUESTSINDEX2', 3, 0, 0, 'Заявка', '', 11, '', '', '', 0, 0, null, 0, 19123, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17719, 0, 1, null, 17668, null, 'FEDERALFUNDSREF', 3, 0, 0, 'Федеральные cредства', 'Ссылка на реестр федеральных средств', 11, '', '', '', 0, 0, null, 0, 17668, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17720, 0, 1, null, 17668, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17721, 0, 1, null, 17668, null, 'IFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17722, 0, 1, null, 17668, null, 'IFS_CORR', 3, 0, 0, 'Источник финансирования', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17723, 0, 1, null, 17668, null, 'CLSTYPE', 3, 0, 0, 'Признак классификации', 'Признак классификации: 0 - расходная (по умолчанию),1 - источниковая', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17724, 0, 1, null, 17668, null, 'NDSNOTE', 1, 0, 100, 'НДС', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17725, 0, 1, null, 17668, null, 'DOGNUM', 1, 0, 20, '№ договора', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17726, 0, 1, null, 17668, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17727, 0, 1, null, 17668, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17728, 0, 1, null, 17668, null, 'OKATO', 3, 0, 0, 'ОКАТО', 'ОКАТО', 11, '99.999.999', '', '', 0, 0, null, 1, 20418, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17729, 0, 1, null, 17668, null, 'ADDOKATO', 3, 0, 0, 'УточнениеОКАТО', 'Уточнение ОКАТО', 4, '000', '', '###', 0, 0, null, 0, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17730, 0, 1, null, 17668, null, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17731, 0, 1, null, 17668, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', 'Текст причины отклонения документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17732, 0, 1, null, 17668, null, 'FUNDSSOURCE', 3, 0, 0, 'Источник образования', 'Источник образования средств', 11, '999.999.99', '', '', 0, 0, null, 1, 22632, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17733, 0, 1, null, 17668, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17734, 0, 1, null, 17668, null, 'ISBLOCKED', 3, 0, 0, 'ПризнакБлокировки', 'Признак того что документ заблокирован (=1)', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17735, 0, 1, null, 17668, null, 'BLOCKEDCAUSE', 1, 0, 255, 'Причина блокировки', 'Причина блокировки документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17736, 0, 1, null, 17668, null, 'UNBLOCKEDDATE', 6, 0, 0, 'Дата разблокировки', 'Дата разблокировки документа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17737, 0, 1, null, 17668, null, 'UNBLOCKEDCAUSE', 1, 0, 255, 'Причина разблокировки', 'Причина разблокировки документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17738, 0, 1, null, 17668, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17739, 0, 1, null, 17668, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26627, 0, 1, null, 17668, null, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32928, 0, 1, null, 17668, null, 'OKTMO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 32820, 0, 0, 0, '', 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27703, 0, 1, null, 17668, null, 'FAORGTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22818, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35368, 0, 1, null, 17668, null, 'UINCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36856, 0, 1, null, 17668, null, 'FINTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SUMINPASSAGE
CALL FIELDSINFO_IMPORT(17745, 0, 1, null, 17744, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, 17668, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17746, 0, 1, null, 17744, null, 'ODATE', 6, 0, 0, 'Дата поступления ', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17747, 0, 1, null, 17744, null, 'BUHACCOUNT', 3, 0, 0, 'Счет сумм в пути', '', 8, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17748, 0, 1, null, 17744, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17749, 0, 1, null, 17744, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17750, 0, 1, null, 17744, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Операция перечисления', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17751, 0, 1, null, 17744, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17752, 0, 1, null, 17744, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17753, 0, 1, null, 17744, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SCHEMEBUHCACH
CALL FIELDSINFO_IMPORT(17773, 0, 1, null, 17772, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17774, 0, 1, null, 17772, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17775, 0, 1, null, 17772, null, 'DAT', 6, 0, 0, 'Дата', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17776, 0, 1, null, 17772, null, 'DEBET', 3, 0, 0, 'Дебет', '', 11, '', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17777, 0, 1, null, 17772, null, 'CREDIT', 3, 0, 0, 'Кредит', '', 11, '', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17778, 0, 1, null, 17772, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17779, 0, 1, null, 17772, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17780, 0, 1, null, 17772, null, 'ACCREF1', 3, 0, 0, 'Ссылка на счет 1', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17781, 0, 1, null, 17772, null, 'ACCREF2', 3, 0, 0, 'Ссылка на счет 1', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17782, 0, 1, null, 17772, null, 'FILTERINDEX', 3, 0, 0, 'Фильтр', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17783, 0, 1, null, 17772, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INCTEMPLATETITLE
CALL FIELDSINFO_IMPORT(17785, 0, 1, null, 17784, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17786, 0, 1, null, 17784, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17787, 0, 1, null, 17784, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17788, 0, 1, null, 17784, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17789, 0, 1, null, 17784, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17790, 0, 1, null, 17784, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17791, 0, 1, null, 17784, null, 'PERCENTTOTAL', 6, 0, 0, 'Процент суммы', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17792, 0, 1, null, 17784, null, 'ACCEPTFLAG', 3, 0, 0, 'Принять шаблон', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17793, 0, 1, null, 17784, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17794, 0, 1, null, 17784, null, 'TEMPLATETYPE', 3, 0, 0, 'Тип шаблона', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17795, 0, 1, null, 17784, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INCTEMPLATEDETAIL
CALL FIELDSINFO_IMPORT(17797, 0, 1, null, 17796, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17798, 0, 1, null, 17796, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '9.99.99.99.99', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17799, 0, 1, null, 17796, null, 'SUBKD', 3, 0, 0, 'Суб.код дохода', '', 11, '99.99.99', '', '', 0, 0, null, 0, 16928, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17800, 0, 1, null, 17796, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17801, 0, 1, null, 17796, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17802, 0, 1, null, 17796, null, 'ACCOUNTINDEX', 3, 0, 0, 'Слой', '', 11, '999', '', '', 0, 0, null, 1, 16910, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17803, 0, 1, null, 17796, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17784, 1, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17804, 0, 1, null, 17796, null, 'PERCENT', 6, 0, 0, 'Процент расщепления', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17805, 0, 1, null, 17796, null, 'PERCENTTOTAL', 6, 0, 0, 'Процент суммы', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17806, 0, 1, null, 17796, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бухгалтерская операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17807, 0, 1, null, 17796, null, 'IFS_CORR', 3, 0, 0, 'Источник финансирования', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17808, 0, 1, null, 17796, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17809, 0, 1, null, 17796, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- EXEMPTIONTITLE
CALL FIELDSINFO_IMPORT(17811, 0, 1, null, 17810, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17812, 0, 1, null, 17810, null, 'ANUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17813, 0, 1, null, 17810, null, 'IDATE', 6, 0, 0, 'Дата дохода', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17814, 0, 1, null, 17810, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17815, 0, 1, null, 17810, null, 'NUMINQUIRY', 1, 0, 20, 'Номер справки', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17816, 0, 1, null, 17810, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17817, 0, 1, null, 17810, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17818, 0, 1, null, 17810, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17819, 0, 1, null, 17810, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17820, 0, 1, null, 17810, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FINDOCDETAIL
CALL FIELDSINFO_IMPORT(17822, 0, 1, null, 17821, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17823, 0, 1, null, 17821, null, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17824, 0, 1, null, 17821, null, 'KCSR', 3, 0, 0, 'КЦСР', 'Целевая статья', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17825, 0, 1, null, 17821, null, 'KVSR', 3, 0, 0, 'КВСР', 'Ведомственная статья (ППП)', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17826, 0, 1, null, 17821, null, 'KVR', 3, 0, 0, 'КВР', 'Вид расхода', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17827, 0, 1, null, 17821, null, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17828, 0, 1, null, 17821, null, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17829, 0, 1, null, 17821, null, 'FACT', 3, 0, 0, 'МероприятиеФин', 'Классификатор мероприятия из финансирования', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17830, 0, 1, null, 17821, null, 'FINSOURCE', 3, 0, 0, 'Источник финансирования', 'Источник финансирования', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17831, 0, 1, null, 17821, null, 'REGIONCLS', 3, 0, 0, 'РегионФин', 'Классификатор районов из финансирования', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17832, 0, 1, null, 17821, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', 'Классификатор типа документа', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17833, 0, 1, null, 17821, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', 'Классификатор типа финансирования', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17834, 0, 1, null, 17821, null, 'CURRENCYCLS', 3, 0, 0, 'Код валюты', 'Код валюты', 4, '999', '', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17835, 0, 1, null, 17821, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17836, 0, 1, null, 17821, null, 'DFACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет плательщика (ссылка)', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17837, 0, 1, null, 17821, null, 'ACCOUNTREF', 3, 0, 0, 'Счет распорядителя', 'Счет кредитора из детализации', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17838, 0, 1, null, 17821, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия из детализации', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17839, 0, 1, null, 17821, null, 'PLANDATE', 6, 0, 0, 'Плановая дата', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17840, 0, 1, null, 17821, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 4, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17841, 0, 1, null, 17821, null, 'SUMMA', 6, 0, 0, 'Сумма платежа', '', 13, '', '0.00####', '0.00####', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17842, 0, 1, null, 17821, null, 'CURRENCYSUMMA', 6, 0, 0, 'Сумма в валюте', 'Сумма в валюте из детализации', 13, '999', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17843, 0, 1, null, 17821, null, 'CREDIT', 6, 0, 0, 'Кредит', 'Кредитовое поле для детализаций с проводками', 13, '', '0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17844, 0, 1, null, 17821, null, 'DEBIT', 6, 0, 0, 'Дебет', 'Дебетовое поле для всех детализаций с проводками', 13, '', '0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17845, 0, 1, null, 17821, null, 'NOTE', 1, 0, 255, 'ПримечаниеДет', 'Примечание из детализации', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17846, 0, 1, null, 17821, null, 'USERFLAG', 3, 0, 0, 'Параметр пользователя ', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17847, 0, 1, null, 17821, null, 'SOURCEDOCNUM', 1, 0, 50, 'НомерЗаписи', 'Номер реестра', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17848, 0, 1, null, 17821, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17849, 0, 1, null, 17821, null, 'RECORDINDEX', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17850, 0, 1, null, 17821, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17851, 0, 1, null, 17821, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17852, 0, 1, null, 17821, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17853, 0, 1, null, 17821, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзменений', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17854, 0, 1, null, 17821, null, 'ACCEPTORACCREF', 3, 0, 0, 'СчетПолучателя', 'Счет получателя ссуды', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17855, 0, 1, null, 17821, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет из финансировния', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17856, 0, 1, null, 17821, null, 'RECORDINDEX2', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17857, 0, 1, null, 17821, null, 'PROMISE', 3, 0, 0, '№Бюджетного обязательства', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17858, 0, 1, null, 17821, null, 'BUHPAYMENTCLS', 3, 0, 0, 'Вид учета (старый)', 'Старый классификатор бухгалтерской проводки (Вида учета (старый))', 4, '999', '', '', 0, 0, null, 1, 17069, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17859, 0, 1, null, 17821, null, 'REQUESTSINDEX', 3, 0, 0, 'Индекс заявки', '', 11, '', '', '', 0, 0, null, 0, 19234, 1, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17860, 0, 1, null, 17821, null, 'RECORDINDEX3', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17861, 0, 1, null, 17821, null, 'RECORDDATE', 6, 0, 0, 'ДатаУчета', 'Дата учета из детализации', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17862, 0, 1, null, 17821, null, 'TOTALREF', 3, 0, 0, 'Ссылка на свободное', '', 11, '', '', '', 0, 0, null, 0, 17876, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17863, 0, 1, null, 17821, null, 'DOCUMENTBASETYPE', 3, 0, 0, 'Тип документа основания', 'Классификатор типа документа-оснвания', 10, '99.99.999', '', '', 0, 0, null, 0, 16973, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17864, 0, 1, null, 17821, null, 'TAXNOTE', 1, 0, 150, 'Налоги', 'Информация о налоге', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17865, 0, 1, null, 17821, null, 'FEDERALFUNDSREF', 3, 0, 0, 'Федеральные cредства', 'Ссылка на реестр федеральных средств', 11, '', '', '', 0, 0, null, 0, 17668, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17866, 0, 1, null, 17821, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17867, 0, 1, null, 17821, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17868, 0, 1, null, 17821, null, 'ELDOCREF', 3, 0, 0, 'Электронный документ', '', 11, '', '', '', 0, 0, null, 0, 19295, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17869, 0, 1, null, 17821, null, 'REQUESTSINDEX2', 3, 0, 0, 'Заявка', '', 11, '', '', '', 0, 0, null, 0, 19123, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17870, 0, 1, null, 17821, null, 'DOCNUMBER', 1, 0, 50, '№ документа', 'Номер документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17871, 0, 1, null, 17821, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17872, 0, 1, null, 17821, null, 'IFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17873, 0, 1, null, 17821, null, 'IFS_CORR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17874, 0, 1, null, 17821, null, 'CLSTYPE', 3, 0, 0, 'Признак классификации', 'Признак классификации: 0 - расходная (по умолчанию),1 - источниковая', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17875, 0, 1, null, 17821, null, 'UNIONNOTIFYREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21709, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25499, 0, 1, null, 17821, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', '', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- FINDOCCAPTION
CALL FIELDSINFO_IMPORT(17877, 0, 1, null, 17876, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17878, 0, 1, null, 17876, null, 'ANUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17879, 0, 1, null, 17876, null, 'MAKEDATE', 6, 0, 0, 'Дата ввода', 'Дата ввода', 11, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17880, 0, 1, null, 17876, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17881, 0, 1, null, 17876, null, 'USERNOTE', 1, 0, 255, 'Примечание из заголовка', 'Примечание из заголовка', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17882, 0, 1, null, 17876, null, 'DFACCOUNT', 3, 0, 0, 'Счет плательщика', 'Расчетный счет плательщика (ссылка)', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17883, 0, 1, null, 17876, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17884, 0, 1, null, 17876, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17885, 0, 1, null, 17876, null, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17886, 0, 1, null, 17876, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17887, 0, 1, null, 17876, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17888, 0, 1, null, 17876, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзмененийДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17889, 0, 1, null, 17876, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17890, 0, 1, null, 17876, null, 'ELPACKETNAME', 1, 0, 20, 'Имя пакета', 'Имя пакета', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17891, 0, 1, null, 17876, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- MUTNOTIFDETAIL
CALL FIELDSINFO_IMPORT(17897, 0, 1, null, 17896, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17898, 0, 1, null, 17896, null, 'CAPTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17243, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17899, 0, 1, null, 17896, null, 'QUARTER1', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17900, 0, 1, null, 17896, null, 'QUARTER2', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17901, 0, 1, null, 17896, null, 'QUARTER3', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17902, 0, 1, null, 17896, null, 'QUARTER4', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17903, 0, 1, null, 17896, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17904, 0, 1, null, 17896, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17905, 0, 1, null, 17896, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17906, 0, 1, null, 17896, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17907, 0, 1, null, 17896, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17908, 0, 1, null, 17896, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17909, 0, 1, null, 17896, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17910, 0, 1, null, 17896, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17911, 0, 1, null, 17896, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17912, 0, 1, null, 17896, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17913, 0, 1, null, 17896, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- VZ_OFFSET
CALL FIELDSINFO_IMPORT(17943, 0, 1, null, 17942, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17944, 0, 1, null, 17942, null, 'NUM_CONVENT', 1, 0, 20, 'Номер взаимозачета', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17945, 0, 1, null, 17942, null, 'NUM_DOCUMENT', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17946, 0, 1, null, 17942, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17947, 0, 1, null, 17942, null, 'DOCUMENTDATE', 6, 0, 0, 'Дата справки', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17948, 0, 1, null, 17942, null, 'BUILDDATE', 6, 0, 0, 'Дата протокола', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17949, 0, 1, null, 17942, null, 'ACCEPTDATE', 6, 0, 0, 'Дата проводки', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17950, 0, 1, null, 17942, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17951, 0, 1, null, 17942, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17952, 0, 1, null, 17942, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17953, 0, 1, null, 17942, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17954, 0, 1, null, 17942, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17955, 0, 1, null, 17942, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INCOMES_ARREARS
CALL FIELDSINFO_IMPORT(17957, 0, 1, null, 17956, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, 17668, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17958, 0, 1, null, 17956, null, 'ARREARSDATE', 6, 0, 0, 'Дата задолженности', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LOANCREDIT
CALL FIELDSINFO_IMPORT(17960, 0, 1, null, 17959, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17961, 0, 1, null, 17959, null, 'ANUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17962, 0, 1, null, 17959, null, 'DATEINPUT', 6, 0, 0, 'Дата документа', 'Дата документа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17963, 0, 1, null, 17959, null, 'DATEAMORTIZATION', 6, 0, 0, 'ДатаПогашенияПлан', 'Плановая дата закрытия договора', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17964, 0, 1, null, 17959, null, 'SUMMA', 6, 0, 0, 'СуммаЗаголовка', 'Сумма в заголовке', 13, '', '0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17965, 0, 1, null, 17959, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17966, 0, 1, null, 17959, null, 'BUDGETREF', 3, 0, 0, 'Бюджет', '', 4, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17967, 0, 1, null, 17959, null, 'ORG_REF', 3, 0, 0, 'Организация', 'Организация', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17968, 0, 1, null, 17959, null, 'NOTE', 1, 0, 255, 'Примечание', 'Примечание', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17969, 0, 1, null, 17959, null, 'CONTRACTTYPE', 3, 0, 0, 'Вид договора', 'Тип договора: "Новый кредит" или "Перекредитовка"', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17970, 0, 1, null, 17959, null, 'PERIODSTART', 6, 0, 0, 'ДатаНачалаПериода', 'Дата начала периода начисления процентов', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17971, 0, 1, null, 17959, null, 'PERIODLENGTH', 3, 0, 0, 'Периодичность(Начисление процентов)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17972, 0, 1, null, 17959, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17973, 0, 1, null, 17959, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17974, 0, 1, null, 17959, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17975, 0, 1, null, 17959, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17976, 0, 1, null, 17959, null, 'LONGDATE', 6, 0, 0, 'ДатаПролонгирования', 'Дата пролонгирования из заголовка', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17977, 0, 1, null, 17959, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17978, 0, 1, null, 17959, null, 'YEARTYPE', 3, 0, 0, 'Тип года', 'Тип года из заголовка', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17979, 0, 1, null, 17959, null, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор "Район" из заголовка', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17980, 0, 1, null, 17959, null, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17981, 0, 1, null, 17959, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17982, 0, 1, null, 17959, null, 'LOANTYPE', 3, 0, 0, 'Вид ссуды', 'Классификатор вида ссуды', 9, '99.99.99', '', '', 0, 0, null, 1, 20173, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17983, 0, 1, null, 17959, null, 'DEBTTYPE', 3, 0, 0, 'Вид заимствования', 'Классификатор "Вид заимствования"', 12, '99.99.99.99', '', '', 0, 0, null, 1, 20182, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17984, 0, 1, null, 17959, null, 'CURRENCYSUMMA', 6, 0, 0, 'Сумма в валюте', '', 13, '', '0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17985, 0, 1, null, 17959, null, 'CURRENCYCLS', 3, 0, 0, 'Тип валюты', '', 4, '999', '', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17986, 0, 1, null, 17959, null, 'CBPERCENTRATE', 6, 0, 0, 'ДоляСтавкиЦБПроц', 'Доля ставки ЦБ для процентов', 13, '', '0.00000000', '0.00000000', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17987, 0, 1, null, 17959, null, 'CBFINERATE', 6, 0, 0, 'ДоляСтавкиЦБПениОсн', 'Доля ставки ЦБ для пени по осн. долгу', 13, '', '0.00000000', '0.00000000', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17988, 0, 1, null, 17959, null, 'CBFINEPERCENTRATE', 6, 0, 0, 'ДоляСтавкиЦБПениПроц', 'Доля ставки ЦБ для пени по процентам', 13, '', '0.00000000', '0.00000000', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17989, 0, 1, null, 17959, null, 'PERCENT', 6, 0, 0, 'Процент', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17990, 0, 1, null, 17959, null, 'FINE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17991, 0, 1, null, 17959, null, 'RETURNSTARTDATE', 6, 0, 0, 'Дата(Погашение осн. долга)', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17992, 0, 1, null, 17959, null, 'RETURNPERIODLENGTH', 3, 0, 0, 'Периодичность(Погашение осн. долга)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17993, 0, 1, null, 17959, null, 'PAYPERCENTSTARTDATE', 6, 0, 0, 'ДатаНачалаУплатыПроцентов', 'Дата начала уплаты процентов из заголовка', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17994, 0, 1, null, 17959, null, 'PAYPERCENTPERIODLENGTH', 3, 0, 0, 'Периодичность уплаты процентов', 'Периодичность уплаты процентов', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17995, 0, 1, null, 17959, null, 'DOCBASE', 3, 0, 0, 'Тип документа основания', 'Классификатор типа документа-оснвания', 10, '99.99.999', '', '', 0, 0, null, 1, 16973, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17996, 0, 1, null, 17959, null, 'GUARANTEEKIND', 3, 0, 0, 'Объем обязательств', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17997, 0, 1, null, 17959, null, 'GUARANTEEACCREF', 3, 0, 0, 'Счет заемщика', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17998, 0, 1, null, 17959, null, 'EXECUTEPERIOD', 3, 0, 0, 'Срок выполнения обязательств', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(17999, 0, 1, null, 17959, null, 'DFACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18000, 0, 1, null, 17959, null, 'ACCREF', 3, 0, 0, 'Счет кредитора', 'Счет кредитора из детализации', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18001, 0, 1, null, 17959, null, 'ADDITIONALACCREF', 3, 0, 0, 'Счет уплаты процентов', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18002, 0, 1, null, 17959, null, 'CONTRACTINFO', 1, 0, 255, 'Информация о кредитном договоре', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18003, 0, 1, null, 17959, null, 'BONDCOUNT', 3, 0, 0, 'Количество облигаций(Информация об облигациях)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18004, 0, 1, null, 17959, null, 'BONDCOST', 6, 0, 0, 'Номинальная цена(Информация об облигациях)', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ADMISSION
CALL FIELDSINFO_IMPORT(18006, 0, 1, null, 18005, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18007, 0, 1, null, 18005, null, 'BUDREF', 3, 0, 0, 'Бюджет', '', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18008, 0, 1, null, 18005, null, 'BUDSOURCE', 3, 0, 0, 'Из Бюджета', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18009, 0, 1, null, 18005, null, 'BUDDEST', 3, 0, 0, 'В бюджет', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18010, 0, 1, null, 18005, null, 'DAT', 6, 0, 0, 'Дата', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18011, 0, 1, null, 18005, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18012, 0, 1, null, 18005, null, 'ACC', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18013, 0, 1, null, 18005, null, 'FLAG', 3, 0, 0, 'Тип операции', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18014, 0, 1, null, 18005, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18015, 0, 1, null, 18005, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18016, 0, 1, null, 18005, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18017, 0, 1, null, 18005, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18018, 0, 1, null, 18005, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18019, 0, 1, null, 18005, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18020, 0, 1, null, 18005, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '9.99.99.99.99', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18021, 0, 1, null, 18005, null, 'SUBKD', 3, 0, 0, 'Суб. КД', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16928, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18022, 0, 1, null, 18005, null, 'GOSNI', 3, 0, 0, 'ГОС. НИ', '', 11, '99.99', '', '', 0, 0, null, 1, 16948, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18023, 0, 1, null, 18005, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18024, 0, 1, null, 18005, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18025, 0, 1, null, 18005, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18026, 0, 1, null, 18005, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18027, 0, 1, null, 18005, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18028, 0, 1, null, 18005, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18029, 0, 1, null, 18005, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18030, 0, 1, null, 18005, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18031, 0, 1, null, 18005, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18032, 0, 1, null, 18005, null, 'FINSOURCE', 3, 0, 0, '', '', 11, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18033, 0, 1, null, 18005, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18034, 0, 1, null, 18005, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18035, 0, 1, null, 18005, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бухгалтерская операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18036, 0, 1, null, 18005, null, 'IFS_CORR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- OTHBUDNOTIFCAPTION
CALL FIELDSINFO_IMPORT(18038, 0, 1, null, 18037, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18039, 0, 1, null, 18037, null, 'ANUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18040, 0, 1, null, 18037, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18041, 0, 1, null, 18037, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18042, 0, 1, null, 18037, null, 'INPUTDATE', 6, 0, 0, 'Дата ввода', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18043, 0, 1, null, 18037, null, 'BUDDIST', 3, 0, 0, 'Бюджет', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18044, 0, 1, null, 18037, null, 'INOUT', 3, 0, 0, 'Тип уведомления', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18045, 0, 1, null, 18037, null, 'NOTE', 1, 0, 255, 'В связи', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18046, 0, 1, null, 18037, null, 'SPECIAL', 1, 0, 255, 'Доп. указания', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18047, 0, 1, null, 18037, null, 'OSNOVANIE', 1, 0, 255, 'Основание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18048, 0, 1, null, 18037, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18049, 0, 1, null, 18037, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18050, 0, 1, null, 18037, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18051, 0, 1, null, 18037, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18052, 0, 1, null, 18037, null, 'DOCBASE', 3, 0, 0, 'Документ основание', '', 11, '99.99.999', '', '', 0, 0, null, 1, 16973, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18053, 0, 1, null, 18037, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18054, 0, 1, null, 18037, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- OTHBUDNOTIFDETAIL
CALL FIELDSINFO_IMPORT(18075, 0, 1, null, 18074, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18076, 0, 1, null, 18074, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 18037, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18077, 0, 1, null, 18074, null, 'QUARTER1', 6, 0, 0, 'Квартал 1', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18078, 0, 1, null, 18074, null, 'QUARTER2', 6, 0, 0, 'Квартал 2', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18079, 0, 1, null, 18074, null, 'QUARTER3', 6, 0, 0, 'Квартал 3', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18080, 0, 1, null, 18074, null, 'QUARTER4', 6, 0, 0, 'Квартал 4', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18081, 0, 1, null, 18074, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18082, 0, 1, null, 18074, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18083, 0, 1, null, 18074, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18084, 0, 1, null, 18074, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18085, 0, 1, null, 18074, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18086, 0, 1, null, 18074, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '999', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18087, 0, 1, null, 18074, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18088, 0, 1, null, 18074, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18089, 0, 1, null, 18074, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18090, 0, 1, null, 18074, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18091, 0, 1, null, 18074, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18092, 0, 1, null, 18074, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18093, 0, 1, null, 18074, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18094, 0, 1, null, 18074, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бухгалтерская операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18095, 0, 1, null, 18074, null, 'IFS_CORR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18096, 0, 1, null, 18074, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LOANCREDITPERCENTS
CALL FIELDSINFO_IMPORT(18123, 0, 1, null, 18122, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18124, 0, 1, null, 18122, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18125, 0, 1, null, 18122, null, 'ACCEPTDATE', 6, 0, 0, 'Дата', 'Дата принятия из детализации', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18126, 0, 1, null, 18122, null, 'SUMMA', 6, 0, 0, 'Кредит', 'Кредитовое поле для детализаций с проводками', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18127, 0, 1, null, 18122, null, 'SUBKD', 3, 0, 0, 'СубКД', 'Классификатор суб кода дохода', 9, '99.99.99', '', '', 0, 0, null, 1, 16928, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18128, 0, 1, null, 18122, null, 'BUHPAYMENTCLS', 3, 0, 0, 'Вид учета (старый)', 'Старый классификатор бухгалтерской проводки (Вида учета (старый))', 4, '999', '', '', 0, 0, null, 1, 17069, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18129, 0, 1, null, 18122, null, 'NOTE', 1, 0, 255, 'ПримечаниеДет', 'Примечание из детализации', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18130, 0, 1, null, 18122, null, 'PERIODSTART', 6, 0, 0, 'Начало периода', 'Начало периода из детализации "Начисление %"', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18131, 0, 1, null, 18122, null, 'PERIODEND', 6, 0, 0, 'Конец периода', 'Конец периода из детализации "Начисление процентов"', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18132, 0, 1, null, 18122, null, 'PAYPERCENTDATE', 6, 0, 0, 'ДатаУплатыПроцПлан', 'Дата плановой уплаты процентов из детализации "Начисление %"', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18133, 0, 1, null, 18122, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18134, 0, 1, null, 18122, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18135, 0, 1, null, 18122, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18136, 0, 1, null, 18122, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18137, 0, 1, null, 18122, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18138, 0, 1, null, 18122, null, 'RECORDDATE', 6, 0, 0, 'ДатаУчета', 'Дата учета из детализации', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18139, 0, 1, null, 18122, null, 'CURRENCYCLS', 3, 0, 0, 'Код валюты', 'Код валюты', 4, '999', '', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18140, 0, 1, null, 18122, null, 'CURRENCYSUMMA', 6, 0, 0, 'Сумма в валюте', 'Сумма в валюте из детализации', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18141, 0, 1, null, 18122, null, 'DFACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18142, 0, 1, null, 18122, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18143, 0, 1, null, 18122, null, 'IFS', 3, 0, 0, 'ИВФ', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18144, 0, 1, null, 18122, null, 'IFS_CORR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18145, 0, 1, null, 18122, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18146, 0, 1, null, 18122, null, 'KD', 3, 0, 0, 'Код дохода', '', 11, '', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18147, 0, 1, null, 18122, null, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18148, 0, 1, null, 18122, null, 'KFSR', 3, 0, 0, 'КФСР(Классификация)', '', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18149, 0, 1, null, 18122, null, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18150, 0, 1, null, 18122, null, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18151, 0, 1, null, 18122, null, 'KESR', 3, 0, 0, 'КЭСР(Классификация)', '', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18152, 0, 1, null, 18122, null, 'CLSTYPE', 3, 0, 0, 'Тип классификации', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- CURRENCYEXCHANGE
CALL FIELDSINFO_IMPORT(18355, 0, 1, null, 18354, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18356, 0, 1, null, 18354, null, 'CURRENCY', 3, 0, 0, '', '', 11, '999', '', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18357, 0, 1, null, 18354, null, 'DAT', 6, 0, 0, 'Дата', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18358, 0, 1, null, 18354, null, 'EXCHANGE', 6, 0, 0, 'Обменный курс', '', 13, '', '0.00####', '0.00####', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18359, 0, 1, null, 18354, null, 'MVBEXCHANGE', 6, 0, 0, 'Курс МВБ', '', 13, '', '0.00####', '0.00####', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18360, 0, 1, null, 18354, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18361, 0, 1, null, 18354, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18362, 0, 1, null, 18354, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18363, 0, 1, null, 18354, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18364, 0, 1, null, 18354, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ACCCUROPERATION
CALL FIELDSINFO_IMPORT(18366, 0, 1, null, 18365, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, 17821, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18367, 0, 1, null, 18365, null, 'CURRENCY', 3, 0, 0, 'Валюта', '', 4, '999', '', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18368, 0, 1, null, 18365, null, 'CURSUMMA', 6, 0, 0, 'Сумма в валюте', '', 13, '', '0.00####', '0.00####', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18369, 0, 1, null, 18365, null, 'EXCHANGE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18370, 0, 1, null, 18365, null, 'OPERATION', 3, 0, 0, 'Вид операции', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33009, 0, 1, null, 18365, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33010, 0, 1, null, 18365, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33011, 0, 1, null, 18365, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33012, 0, 1, null, 18365, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- CURRENCYINCOMES
CALL FIELDSINFO_IMPORT(18372, 0, 1, null, 18371, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, 17668, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18373, 0, 1, null, 18371, null, 'CURDATE', 6, 0, 0, 'Дата поступления валюты', '', 11, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18374, 0, 1, null, 18371, null, 'CURRENCYINDEX', 3, 0, 0, 'Тип валюты', '', 4, '999', '', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18375, 0, 1, null, 18371, null, 'CURRENCYVALUE', 6, 0, 0, 'Сумма в валюте', '', 13, '', '0.00####', '0.00####', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18376, 0, 1, null, 18371, null, 'EXCHANGEPRICE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORGOPERAT
CALL FIELDSINFO_IMPORT(18378, 0, 1, null, 18377, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18379, 0, 1, null, 18377, null, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18380, 0, 1, null, 18377, null, 'KCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18381, 0, 1, null, 18377, null, 'KVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18382, 0, 1, null, 18377, null, 'KVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18383, 0, 1, null, 18377, null, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18384, 0, 1, null, 18377, null, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18385, 0, 1, null, 18377, null, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18386, 0, 1, null, 18377, null, 'FINSOURCE', 3, 0, 0, 'Источник', '', 4, '999', '', '', 0, 0, null, 0, 16983, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18387, 0, 1, null, 18377, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', 'Классификатор типа финансирования', 5, '9.99', '', '', 0, 0, null, 0, 16955, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18388, 0, 1, null, 18377, null, 'ACCOUNTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18389, 0, 1, null, 18377, null, 'NOWDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18390, 0, 1, null, 18377, null, 'YEARREPORT', 3, 0, 0, 'Год', 'Год документа', 11, '', '0000', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18391, 0, 1, null, 18377, null, 'MONTHREPORT', 3, 0, 0, 'Месяц', 'Номер месяца', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18392, 0, 1, null, 18377, null, 'SUMMA', 6, 0, 0, 'ОперДанныеСумма', 'Сумма из оперативных данных', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18393, 0, 1, null, 18377, null, 'GROUPINF', 3, 0, 0, 'ГруппаИнформации', 'Группа информации', 6, '99.99', '', '', 0, 0, null, 1, 17005, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18394, 0, 1, null, 18377, null, 'NOTE', 1, 0, 255, 'Примечание', 'Примечание', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18395, 0, 1, null, 18377, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18396, 0, 1, null, 18377, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18397, 0, 1, null, 18377, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18398, 0, 1, null, 18377, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18399, 0, 1, null, 18377, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18400, 0, 1, null, 18377, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18401, 0, 1, null, 18377, null, 'SUMMA1', 6, 0, 0, 'ОперДанныеЗаявка', 'Сумма заявки из оперативных данных', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18402, 0, 1, null, 18377, null, 'QUARTER1', 6, 0, 0, 'ОперДанныеКвартал1', 'Сумма квартала 1 по оперативным данным', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18403, 0, 1, null, 18377, null, 'QUARTER2', 6, 0, 0, 'ОперДанныеКвартал2', 'Сумма квартала 2 по оперативным данным', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 26, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18404, 0, 1, null, 18377, null, 'QUARTER3', 6, 0, 0, 'ОперДанныеКвартал3', 'Сумма квартала 3 по оперативным данным', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18405, 0, 1, null, 18377, null, 'QUARTER4', 6, 0, 0, 'ОперДанныеКвартал4', 'Сумма квартала 4 по оперативным данным', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 28, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18406, 0, 1, null, 18377, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18407, 0, 1, null, 18377, null, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18408, 0, 1, null, 18377, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18409, 0, 1, null, 18377, null, 'ACCEPTORACCREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18410, 0, 1, null, 18377, null, 'IFS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18411, 0, 1, null, 18377, null, 'SUBKCSR', 3, 0, 0, 'СубКЦСР', 'Классификатор суб целевой статьи расхода', 4, '999', '', '', 0, 0, null, 1, 16886, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18412, 0, 1, null, 18377, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18413, 0, 1, null, 18377, null, 'DOCBASE', 3, 0, 0, 'Тип документа основания', 'Классификатор типа документа-оснвания', 10, '99.99.999', '', '', 0, 0, null, 0, 16973, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26637, 0, 1, null, 18377, null, 'CLSTYPE', 3, 0, 0, 'Тип классификации', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27017, 0, 1, null, 18377, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BILLS
CALL FIELDSINFO_IMPORT(18415, 0, 1, null, 18414, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18416, 0, 1, null, 18414, null, 'DATE_INPUT', 6, 0, 0, 'Дата ввода', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18417, 0, 1, null, 18414, null, 'ID_ORG', 3, 0, 0, 'ID организации ', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18418, 0, 1, null, 18414, null, 'NUM_NOTIF', 1, 0, 50, '№ извещения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18419, 0, 1, null, 18414, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18420, 0, 1, null, 18414, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18421, 0, 1, null, 18414, null, 'SUMBYINCOMES', 6, 0, 0, 'Сумма детальных записей по доходам ', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18422, 0, 1, null, 18414, null, 'SUMBYBILLS', 6, 0, 0, 'Сумма детальных записей по векселям ', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18423, 0, 1, null, 18414, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18424, 0, 1, null, 18414, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18425, 0, 1, null, 18414, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18426, 0, 1, null, 18414, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BILLS_DET
CALL FIELDSINFO_IMPORT(18428, 0, 1, null, 18427, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18429, 0, 1, null, 18427, null, 'ANUMBER', 1, 0, 50, '№ векселя', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18430, 0, 1, null, 18427, null, 'SERIES', 1, 0, 150, 'Серия векселя', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18431, 0, 1, null, 18427, null, 'NOMINAL', 6, 0, 0, 'Учетная стоимость', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18432, 0, 1, null, 18427, null, 'DATEAMORTIZATION', 6, 0, 0, 'Дата погашения', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18433, 0, 1, null, 18427, null, 'SUMMAOUT', 6, 0, 0, 'Сумма реализации', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18434, 0, 1, null, 18427, null, 'NOMINALPRICE', 6, 0, 0, 'Номинальная стоимость', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18435, 0, 1, null, 18427, null, 'PROGINDEX_BILL', 3, 0, 0, 'Ссылка на таблицу Bills', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18436, 0, 1, null, 18427, null, 'RECORDINDEX_BILL', 3, 0, 0, 'Ссылка на таблицу Bills', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18437, 0, 1, null, 18427, null, 'REF_ISSUE', 3, 0, 0, '№ организации', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18438, 0, 1, null, 18427, null, 'DATE_OUT', 6, 0, 0, 'Дата ухода', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18439, 0, 1, null, 18427, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18440, 0, 1, null, 18427, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18441, 0, 1, null, 18427, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18442, 0, 1, null, 18427, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18443, 0, 1, null, 18427, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18444, 0, 1, null, 18427, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18445, 0, 1, null, 18427, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BILL_ACCORDDOC
CALL FIELDSINFO_IMPORT(18447, 0, 1, null, 18446, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18448, 0, 1, null, 18446, null, 'NUM_ACCORD', 1, 0, 50, '№ договора', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18449, 0, 1, null, 18446, null, 'BUILDDATE', 6, 0, 0, 'Дата ввода', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18450, 0, 1, null, 18446, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18451, 0, 1, null, 18446, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18452, 0, 1, null, 18446, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18453, 0, 1, null, 18446, null, 'SUMBYFIN', 6, 0, 0, 'Сумма детальных записей по финансированию ', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18454, 0, 1, null, 18446, null, 'SUMBYBILLS', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18455, 0, 1, null, 18446, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18456, 0, 1, null, 18446, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18457, 0, 1, null, 18446, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18458, 0, 1, null, 18446, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- VZFINCAPTION
CALL FIELDSINFO_IMPORT(18460, 0, 1, null, 18459, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18461, 0, 1, null, 18459, null, 'NUM_CONVENT', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18462, 0, 1, null, 18459, null, 'NUM_DOCUMENT', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18463, 0, 1, null, 18459, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18464, 0, 1, null, 18459, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18465, 0, 1, null, 18459, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18466, 0, 1, null, 18459, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18467, 0, 1, null, 18459, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18468, 0, 1, null, 18459, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORGSHARECAPTION
CALL FIELDSINFO_IMPORT(18470, 0, 1, null, 18469, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18471, 0, 1, null, 18469, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18472, 0, 1, null, 18469, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18473, 0, 1, null, 18469, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18474, 0, 1, null, 18469, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18475, 0, 1, null, 18469, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18476, 0, 1, null, 18469, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORGSHAREDETAIL
CALL FIELDSINFO_IMPORT(18478, 0, 1, null, 18477, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18479, 0, 1, null, 18477, null, 'ACC_REF', 3, 0, 0, 'Ссылка на счет', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18480, 0, 1, null, 18477, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18481, 0, 1, null, 18477, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18482, 0, 1, null, 18477, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18483, 0, 1, null, 18477, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18484, 0, 1, null, 18477, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18485, 0, 1, null, 18477, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18486, 0, 1, null, 18477, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- MONTHREPORTCAPTION
CALL FIELDSINFO_IMPORT(18578, 0, 1, null, 18577, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18579, 0, 1, null, 18577, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18580, 0, 1, null, 18577, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18581, 0, 1, null, 18577, null, 'REPORTFLAG', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18582, 0, 1, null, 18577, null, 'PERIOD', 3, 0, 0, 'Период', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18583, 0, 1, null, 18577, null, 'KVB', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18584, 0, 1, null, 18577, null, 'ORG', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18585, 0, 1, null, 18577, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18586, 0, 1, null, 18577, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18587, 0, 1, null, 18577, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18588, 0, 1, null, 18577, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18589, 0, 1, null, 18577, null, 'AMONTH', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18590, 0, 1, null, 18577, null, 'AYEAR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- MONTHREPORTDETAIL
CALL FIELDSINFO_IMPORT(18592, 0, 1, null, 18591, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18593, 0, 1, null, 18591, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 18577, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18594, 0, 1, null, 18591, null, 'REPORTCODE', 1, 0, 5, '', '', 5, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18595, 0, 1, null, 18591, null, 'PAGECODE', 1, 0, 5, '', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18596, 0, 1, null, 18591, null, 'STRINGCODE', 1, 0, 5, '', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18597, 0, 1, null, 18591, null, 'YEARSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18598, 0, 1, null, 18591, null, 'PLANSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18599, 0, 1, null, 18591, null, 'FACTSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18600, 0, 1, null, 18591, null, 'YEARSUMMAFINISH', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18601, 0, 1, null, 18591, null, 'PLANSUMMAFINISH', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18602, 0, 1, null, 18591, null, 'FACTSUMMAFINISH', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18603, 0, 1, null, 18591, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18604, 0, 1, null, 18591, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18605, 0, 1, null, 18591, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18606, 0, 1, null, 18591, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- LIMITFINDETAIL
CALL FIELDSINFO_IMPORT(18628, 0, 1, null, 18627, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18629, 0, 1, null, 18627, null, 'KVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18630, 0, 1, null, 18627, null, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18631, 0, 1, null, 18627, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 4, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18632, 0, 1, null, 18627, null, 'FACIALACC', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18633, 0, 1, null, 18627, null, 'FINSOURCE', 3, 0, 0, 'Источник финансирования', 'Источник финансирования', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18634, 0, 1, null, 18627, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', 'Классификатор типа финансирования', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18635, 0, 1, null, 18627, null, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18636, 0, 1, null, 18627, null, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18637, 0, 1, null, 18627, null, 'AMONTH', 3, 0, 0, 'Месяц', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18638, 0, 1, null, 18627, null, 'AYEAR', 3, 0, 0, 'Год', '', 11, '9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18639, 0, 1, null, 18627, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18640, 0, 1, null, 18627, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18641, 0, 1, null, 18627, null, 'ACCEPTSUMMA', 6, 0, 0, 'Принятая сумма', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18642, 0, 1, null, 18627, null, 'NOTE', 1, 0, 255, 'Примечание', 'Примечание', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18643, 0, 1, null, 18627, null, 'REQUESTFLAG', 3, 0, 0, 'Принятие', 'Статус документа', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18644, 0, 1, null, 18627, null, 'RECORDINDEX', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18645, 0, 1, null, 18627, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18646, 0, 1, null, 18627, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18647, 0, 1, null, 18627, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18648, 0, 1, null, 18627, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18649, 0, 1, null, 18627, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзменений', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18650, 0, 1, null, 18627, null, 'DOCTYPES', 3, 0, 0, 'Тип документа', 'Классификатор типа документа', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18651, 0, 1, null, 18627, null, 'KVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18652, 0, 1, null, 18627, null, 'KCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18653, 0, 1, null, 18627, null, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18654, 0, 1, null, 18627, null, 'IMPORTID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18655, 0, 1, null, 18627, null, 'SENDERINN', 6, 0, 0, '', '', 13, '9999999999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18656, 0, 1, null, 18627, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18657, 0, 1, null, 18627, null, 'ACC_REF', 3, 0, 0, 'Счет получателя', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18658, 0, 1, null, 18627, null, 'DFACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18659, 0, 1, null, 18627, null, 'SOURCEFACIALACC', 3, 0, 0, 'л\с плательщика', 'Лицевой счет плательщика средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18660, 0, 1, null, 18627, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18661, 0, 1, null, 18627, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18662, 0, 1, null, 18627, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18663, 0, 1, null, 18627, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18664, 0, 1, null, 18627, null, 'DOCBASE', 3, 0, 0, 'Тип документа основания', 'Классификатор типа документа-оснвания', 10, '99.99.999', '', '', 0, 0, null, 0, 16973, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18665, 0, 1, null, 18627, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18666, 0, 1, null, 18627, null, 'IFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18667, 0, 1, null, 18627, null, 'CLSTYPE', 3, 0, 0, 'Признак классификации', 'Признак классификации: 0 - расходная (по умолчанию),1 - источниковая', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18668, 0, 1, null, 18627, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18669, 0, 1, null, 18627, null, 'UNIONNOTIFYREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21709, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18670, 0, 1, null, 18627, null, 'FUNDSSOURCE', 3, 0, 0, 'Источник образования средств', '', 11, '999.999.99', '', '', 0, 0, null, 1, 22632, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18671, 0, 1, null, 18627, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18672, 0, 1, null, 18627, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27704, 0, 1, null, 18627, null, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- REQUESTFINCAPTION
CALL FIELDSINFO_IMPORT(18717, 0, 1, null, 18716, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18718, 0, 1, null, 18716, null, 'ANUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18719, 0, 1, null, 18716, null, 'INPUTDATE', 6, 0, 0, 'Дата ввода', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18720, 0, 1, null, 18716, null, 'AMONTH', 3, 0, 0, 'Месяц', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18721, 0, 1, null, 18716, null, 'AYEAR', 3, 0, 0, 'Год', '', 11, '9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18722, 0, 1, null, 18716, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18723, 0, 1, null, 18716, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18724, 0, 1, null, 18716, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18725, 0, 1, null, 18716, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18726, 0, 1, null, 18716, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18727, 0, 1, null, 18716, null, 'DFACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18728, 0, 1, null, 18716, null, 'SOURCEFACIALACC', 3, 0, 0, 'л\с плательщика', 'Лицевой счет плательщика средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18729, 0, 1, null, 18716, null, 'SUMMA', 6, 0, 0, 'Сумма лимита', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18730, 0, 1, null, 18716, null, 'STATE', 3, 0, 0, 'Принято к рассмотрению', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18731, 0, 1, null, 18716, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LIMITNOTIFYCAPTION
CALL FIELDSINFO_IMPORT(18733, 0, 1, null, 18732, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18734, 0, 1, null, 18732, null, 'ANUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18735, 0, 1, null, 18732, null, 'INPUTDATE', 6, 0, 0, 'Дата ввода', 'Дата ввода', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18736, 0, 1, null, 18732, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18737, 0, 1, null, 18732, null, 'AMONTH', 3, 0, 0, 'Месяц', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18738, 0, 1, null, 18732, null, 'AYEAR', 3, 0, 0, 'Год', '', 11, '9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18739, 0, 1, null, 18732, null, 'FINSOURCE', 3, 0, 0, 'Источник финансирования', 'Источник финансирования', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18740, 0, 1, null, 18732, null, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18741, 0, 1, null, 18732, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18742, 0, 1, null, 18732, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18743, 0, 1, null, 18732, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзмененийДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18744, 0, 1, null, 18732, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18745, 0, 1, null, 18732, null, 'IMPORTID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18746, 0, 1, null, 18732, null, 'SENDERINN', 6, 0, 0, '', '', 13, '9999999999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18747, 0, 1, null, 18732, null, 'DFACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18748, 0, 1, null, 18732, null, 'SOURCEFACIALACC', 3, 0, 0, 'л\с плательщика', 'Лицевой счет плательщика средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18749, 0, 1, null, 18732, null, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18750, 0, 1, null, 18732, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', 'Текст причины отклонения документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18751, 0, 1, null, 18732, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', 'Статус электронной цифровой подписи', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18752, 0, 1, null, 18732, null, 'SENDERID', 3, 0, 0, 'Код отправителя документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18753, 0, 1, null, 18732, null, 'SENDERRECORDID', 3, 0, 0, 'Код УРМ документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18754, 0, 1, null, 18732, null, 'DOCUMENTSTATE', 1, 0, 1, 'Статус документа', '', 1, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18755, 0, 1, null, 18732, null, 'USERSVISA', 1, 0, 10, 'Виза пользователя', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18756, 0, 1, null, 18732, null, 'ACCEPTSUMMA', 6, 0, 0, 'СуммаЗаголовка', 'Сумма в заголовке', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18757, 0, 1, null, 18732, null, 'PLANDOCTYPE', 3, 0, 0, 'Вид плана', 'Вид плана', 5, '9.99', '', '', 0, 0, null, 1, 20686, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18758, 0, 1, null, 18732, null, 'DOCSTATEREF', 3, 0, 0, 'СостояниеДокумента', 'Состояние документа', 11, '', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18759, 0, 1, null, 18732, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18760, 0, 1, null, 18732, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18761, 0, 1, null, 18732, null, 'FACIALACCCLS', 3, 0, 0, 'л\с получателя', 'Лицевой счет получателя средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18762, 0, 1, null, 18732, null, 'BIDNUMBER', 1, 0, 50, 'Номер заявки', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18763, 0, 1, null, 18732, null, 'FAXDOCCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18764, 0, 1, null, 18732, null, 'LASTEXTRCHANGE', 11, 0, 0, 'Дата экстренного изменения', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- LIMITFINCAPTION
CALL FIELDSINFO_IMPORT(18766, 0, 1, null, 18765, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18767, 0, 1, null, 18765, null, 'AMONTH', 3, 0, 0, 'Месяц', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18768, 0, 1, null, 18765, null, 'AYEAR', 3, 0, 0, 'Год', '', 11, '9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18769, 0, 1, null, 18765, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18770, 0, 1, null, 18765, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18771, 0, 1, null, 18765, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18772, 0, 1, null, 18765, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18773, 0, 1, null, 18765, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18774, 0, 1, null, 18765, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18775, 0, 1, null, 18765, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FINCLAIM
CALL FIELDSINFO_IMPORT(18794, 0, 1, null, 18793, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18795, 0, 1, null, 18793, null, 'BUD_REF', 3, 0, 0, 'Ссылка на бюджет ', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18796, 0, 1, null, 18793, null, 'DAT', 6, 0, 0, 'Дата', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18797, 0, 1, null, 18793, null, 'ACC_REF', 3, 0, 0, 'Ссылка на счет', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18798, 0, 1, null, 18793, null, 'NUMSTR', 1, 0, 20, 'Номер', '', 20, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18799, 0, 1, null, 18793, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18800, 0, 1, null, 18793, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18801, 0, 1, null, 18793, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18802, 0, 1, null, 18793, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FINCLAIMDET
CALL FIELDSINFO_IMPORT(18804, 0, 1, null, 18803, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18805, 0, 1, null, 18803, null, 'BUD_REF', 3, 0, 0, 'Ссылка на бюджет', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18806, 0, 1, null, 18803, null, 'REF', 3, 0, 0, 'Ссылка на мастер-таблицу ', '', 11, '', '', '', 0, 0, null, 1, 18793, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18807, 0, 1, null, 18803, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '9.99.99.99.99', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18808, 0, 1, null, 18803, null, 'SUBKD', 3, 0, 0, 'Субкод дохода', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16928, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18809, 0, 1, null, 18803, null, 'GOSNI', 3, 0, 0, 'ГОС. НИ', '', 11, '99.99', '', '', 0, 0, null, 1, 16948, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18810, 0, 1, null, 18803, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18811, 0, 1, null, 18803, null, 'ASUMMA', 6, 0, 0, 'Сумма оплаты', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18812, 0, 1, null, 18803, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18813, 0, 1, null, 18803, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18814, 0, 1, null, 18803, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18815, 0, 1, null, 18803, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FINTENDER
CALL FIELDSINFO_IMPORT(18817, 0, 1, null, 18816, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18818, 0, 1, null, 18816, null, 'BUD_REF', 3, 0, 0, 'Ссылка на бюджет ', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18819, 0, 1, null, 18816, null, 'DAT', 6, 0, 0, 'Дата', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18820, 0, 1, null, 18816, null, 'ACC_REF', 3, 0, 0, 'Ссылка на счет', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18821, 0, 1, null, 18816, null, 'NUMSTR', 1, 0, 20, 'Номер', '', 20, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18822, 0, 1, null, 18816, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18823, 0, 1, null, 18816, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18824, 0, 1, null, 18816, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18825, 0, 1, null, 18816, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FINTENDERDET
CALL FIELDSINFO_IMPORT(18827, 0, 1, null, 18826, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18828, 0, 1, null, 18826, null, 'BUD_REF', 3, 0, 0, 'Ссылка на бюджет ', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18829, 0, 1, null, 18826, null, 'REF', 3, 0, 0, 'Ссылка на мастер-таблицу ', '', 11, '', '', '', 0, 0, null, 1, 18816, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18830, 0, 1, null, 18826, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18831, 0, 1, null, 18826, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18832, 0, 1, null, 18826, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18833, 0, 1, null, 18826, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18834, 0, 1, null, 18826, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18835, 0, 1, null, 18826, null, 'REGION', 3, 0, 0, 'Регион', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18836, 0, 1, null, 18826, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18837, 0, 1, null, 18826, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18838, 0, 1, null, 18826, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18839, 0, 1, null, 18826, null, 'ASUMMA', 6, 0, 0, 'Оплаченная сумма', '', 13, '', '0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18840, 0, 1, null, 18826, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18841, 0, 1, null, 18826, null, 'REESRT', 3, 0, 0, 'Реестр', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18842, 0, 1, null, 18826, null, 'ACC_REF', 3, 0, 0, 'Ссылка на счет', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18843, 0, 1, null, 18826, null, 'FACIALACC', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18844, 0, 1, null, 18826, null, 'DOGNUM', 1, 0, 20, 'Номер договора', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18845, 0, 1, null, 18826, null, 'DOGDATE', 6, 0, 0, 'Дата договора', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18846, 0, 1, null, 18826, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18847, 0, 1, null, 18826, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18848, 0, 1, null, 18826, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18849, 0, 1, null, 18826, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FINTENDERORG
CALL FIELDSINFO_IMPORT(18861, 0, 1, null, 18860, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18862, 0, 1, null, 18860, null, 'ACC_REF', 3, 0, 0, 'Ссылка на счет', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18863, 0, 1, null, 18860, null, 'REF', 3, 0, 0, 'Тип счета', '', 11, '', '', '', 0, 0, null, 1, 18826, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FACIALFINDETAIL
CALL FIELDSINFO_IMPORT(18865, 0, 1, null, 18864, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18866, 0, 1, null, 18864, null, 'SOURCEFACIALACC_CLS', 3, 0, 0, 'л\с плательщика', 'Лицевой счет плательщика средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18867, 0, 1, null, 18864, null, 'SOURCEKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18868, 0, 1, null, 18864, null, 'SOURCEKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18869, 0, 1, null, 18864, null, 'DESTFACIALACC_CLS', 3, 0, 0, 'л\с получателя', 'Лицевой счет получателя средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18870, 0, 1, null, 18864, null, 'DESTKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18871, 0, 1, null, 18864, null, 'DESTKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18872, 0, 1, null, 18864, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 4, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18873, 0, 1, null, 18864, null, 'CREDIT', 6, 0, 0, 'Сумма(руб)', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18874, 0, 1, null, 18864, null, 'PAYSYMBOLCLS', 3, 0, 0, 'Кассовый символ', 'Кассовый символ (для чеков, объявлений)', 6, '99.99', '', '', 0, 0, null, 0, 17062, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18875, 0, 1, null, 18864, null, 'MEMORDERNUM', 3, 0, 0, '№ мемордера', 'Номер мемориального ордера', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18876, 0, 1, null, 18864, null, 'NOTE', 1, 0, 255, 'Примечание (деталь)', 'Примечание из детализации документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18877, 0, 1, null, 18864, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18878, 0, 1, null, 18864, null, 'RECORDINDEX', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 0, 18947, 1, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18879, 0, 1, null, 18864, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18880, 0, 1, null, 18864, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18881, 0, 1, null, 18864, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18882, 0, 1, null, 18864, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзменений', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18883, 0, 1, null, 18864, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18884, 0, 1, null, 18864, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18885, 0, 1, null, 18864, null, 'PROMISE', 3, 0, 0, '№ бюджетного обязательства', 'Номер бюджетного обязательства', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18886, 0, 1, null, 18864, null, 'SOURCEKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18887, 0, 1, null, 18864, null, 'SOURCEKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18888, 0, 1, null, 18864, null, 'SOURCEKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18889, 0, 1, null, 18864, null, 'SOURCESUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18890, 0, 1, null, 18864, null, 'SOURCEFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18891, 0, 1, null, 18864, null, 'SOURCEMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18892, 0, 1, null, 18864, null, 'SOURCEFINSOURCE', 3, 0, 0, 'Источник финансирования', 'Источник финансирования', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18893, 0, 1, null, 18864, null, 'SOURCEFINTYPE', 3, 0, 0, 'Тип финансирования', 'Классификатор типа финансирования', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18894, 0, 1, null, 18864, null, 'SOURCEDOCTYPE', 3, 0, 0, 'Тип документа', 'Классификатор типа документа', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18895, 0, 1, null, 18864, null, 'DESTKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18896, 0, 1, null, 18864, null, 'DESTKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18897, 0, 1, null, 18864, null, 'DESTKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18898, 0, 1, null, 18864, null, 'DESTSUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18899, 0, 1, null, 18864, null, 'DESTFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18900, 0, 1, null, 18864, null, 'DESTMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18901, 0, 1, null, 18864, null, 'DESTFINSOURCE', 3, 0, 0, 'Источник финансирования', 'Источник финансирования', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18902, 0, 1, null, 18864, null, 'DESTFINTYPE', 3, 0, 0, 'Тип финансирования', 'Классификатор типа финансирования', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18903, 0, 1, null, 18864, null, 'DESTDOCTYPE', 3, 0, 0, 'Тип документа', 'Классификатор типа документа', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18904, 0, 1, null, 18864, null, 'REQUESTSINDEX', 3, 0, 0, 'Заявка', 'Индекс заявки', 11, '', '', '', 0, 0, null, 0, 19234, 1, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18905, 0, 1, null, 18864, null, 'SOURCEPROMISE', 3, 0, 0, '№ бюджетного обязательства', 'Номер бюджетного обязательства', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18906, 0, 1, null, 18864, null, 'DESTPROMISE', 3, 0, 0, '№ бюджетного обязательства', 'Номер бюджетного обязательства', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18907, 0, 1, null, 18864, null, 'RECORDINDEX2', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18908, 0, 1, null, 18864, null, 'SOURCEBUDGETPROMISE', 3, 0, 0, 'Договора БО', 'Номер нового бюджетного обязательства', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18909, 0, 1, null, 18864, null, 'DESTBUDGETPROMISE', 3, 0, 0, 'Договора БО', 'Номер нового бюджетного обязательства', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18910, 0, 1, null, 18864, null, 'SUBPROGINDEX', 3, 0, 0, 'Уточнение индекса данных', 'Уточнение индекса данных', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18911, 0, 1, null, 18864, null, 'STIMATEID', 3, 0, 0, 'Код cметы', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18912, 0, 1, null, 18864, null, 'RVERSION', 3, 0, 0, 'Версия изменения записи', 'Версия изменения записи', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18913, 0, 1, null, 18864, null, 'SOURCEDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18914, 0, 1, null, 18864, null, 'DESTDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18915, 0, 1, null, 18864, null, 'SOURCEDOCBASE', 3, 0, 0, 'Тип документа основания', 'Классификатор типа документа-основания', 10, '99.99.999', '', '', 0, 0, null, 0, 16973, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18916, 0, 1, null, 18864, null, 'DESTDOCBASE', 3, 0, 0, 'Тип документа основания', 'Классификатор типа документа-основания', 10, '99.99.999', '', '', 0, 0, null, 0, 16973, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18917, 0, 1, null, 18864, null, 'SOURCEEXECDOC', 3, 0, 0, 'Документ исполнения', 'Ссылка на документ исполнения', 11, '', '', '', 0, 0, null, 0, 19736, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18918, 0, 1, null, 18864, null, 'DESTEXECDOC', 3, 0, 0, 'Документ исполнения', 'Ссылка на документ исполнения', 11, '', '', '', 0, 0, null, 0, 19736, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18919, 0, 1, null, 18864, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18920, 0, 1, null, 18864, null, 'SOURCEIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр. финансирования плательщика', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18921, 0, 1, null, 18864, null, 'DESTIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр.финансирования получателя', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18922, 0, 1, null, 18864, null, 'CLSTYPE', 3, 0, 0, 'Признак классификации плательщика', 'Признак классификации: 0 - расходная (по умолчанию),1 - источниковая', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18923, 0, 1, null, 18864, null, 'UNIONNOTIFYREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21709, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18924, 0, 1, null, 18864, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18925, 0, 1, null, 18864, null, 'SOURCEKD', 3, 0, 0, 'Код дохода', 'Ссылка на код дохода плательщика', 11, '', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18926, 0, 1, null, 18864, null, 'DESTKD', 3, 0, 0, 'Код дохода', 'Ссылка на код дохода получателя', 11, '', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18927, 0, 1, null, 18864, null, 'SOURCEREGIONCLS', 3, 0, 0, 'Район плат.', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18928, 0, 1, null, 18864, null, 'DESTREGIONCLS', 3, 0, 0, 'Район получ-ля', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18929, 0, 1, null, 18864, null, 'DESTFUNDSSOURCE', 3, 0, 0, 'Источник образования', 'Источник образования средств', 11, '999.999.99', '', '', 0, 0, null, 1, 22632, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18930, 0, 1, null, 18864, null, 'SOURCEFUNDSSOURCE', 3, 0, 0, 'Источник образования', 'Источник образования средств', 11, '999.999.99', '', '', 0, 0, null, 1, 22632, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18931, 0, 1, null, 18864, null, 'ISBLOCKED', 3, 0, 0, 'ПризнакБлокировки', 'Признак того что документ заблокирован (=1)', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18932, 0, 1, null, 18864, null, 'BLOCKEDCAUSE', 1, 0, 255, 'Причина блокировки', 'Причина блокировки документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18933, 0, 1, null, 18864, null, 'UNBLOCKEDDATE', 6, 0, 0, 'Дата разблокировки', 'Дата разблокировки документа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18934, 0, 1, null, 18864, null, 'UNBLOCKEDCAUSE', 1, 0, 255, 'Причина разблокировки', 'Причина разблокировки документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18935, 0, 1, null, 18864, null, 'SOURCETRANSFERTCLS', 3, 0, 0, 'Код целевых средств плательщика (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18936, 0, 1, null, 18864, null, 'DESTTRANSFERTCLS', 3, 0, 0, 'Код целевых средств получателя (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26623, 0, 1, null, 18864, null, 'DESTEXECINNERNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26624, 0, 1, null, 18864, null, 'DESTSUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26625, 0, 1, null, 18864, null, 'SOURCEEXECINNERNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26626, 0, 1, null, 18864, null, 'SOURCESUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27701, 0, 1, null, 18864, null, 'DESTFAORG_TYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22818, 0, 0, 0, '', 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27702, 0, 1, null, 18864, null, 'SOURCEFAORG_TYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22818, 0, 0, 0, '', 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27842, 0, 1, null, 18864, null, 'DESTBUDALLOCATIONCLS', 3, 0, 0, 'Код бюджетного ассигнования получ-ляКлюч', '', 9, '9999999', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27843, 0, 1, null, 18864, null, 'DESTPAYPROMISECLS', 3, 0, 0, 'Код расходного обязательства получ-ляКлюч', '', 13, '999999999', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27844, 0, 1, null, 18864, null, 'SOURCEBUDALLOCATIONCLS', 3, 0, 0, 'Код бюджетного ассигнования плат.Ключ', '', 9, '9999999', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27845, 0, 1, null, 18864, null, 'SOURCEPAYPROMISECLS', 3, 0, 0, 'Код расходного обязательства плат.Ключ', '', 13, '999999999', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25178, 0, 1, null, 18864, null, 'DESTASSIGNMENTKIND', 3, 0, 0, 'ВидАссигнованийПолуч', 'Вид ассигнований', 9, '99.99.99', '', '', 0, 0, null, 1, 22976, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25179, 0, 1, null, 18864, null, 'DESTCLSTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25180, 0, 1, null, 18864, null, 'SOURCEASSIGNMENTKIND', 3, 0, 0, 'ВидАссигнованийПлат', '', 9, '99.99.99', '', '', 0, 0, null, 1, 22976, 0, 0, 0, '', 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38150, 0, 1, null, 18864, null, 'TRANSFERTORG_REF', 3, 0, 0, 'Получатель субсидии(трансферта)', 'Ссылка на организацию получателя субсидии(трансферта) из детали', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- CARDS
CALL FIELDSINFO_IMPORT(18938, 0, 1, null, 18937, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18939, 0, 1, null, 18937, null, 'CARDNUMBER', 1, 0, 20, 'номер карты; ', '', 20, '99999999999999999999;1;_', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18940, 0, 1, null, 18937, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18941, 0, 1, null, 18937, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18942, 0, 1, null, 18937, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18943, 0, 1, null, 18937, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18944, 0, 1, null, 18937, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18945, 0, 1, null, 18937, null, 'ACCOUNT', 3, 0, 0, 'Расчетный счет', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18946, 0, 1, null, 18937, null, 'ACOMMENT', 1, 0, 50, 'комментарий к карточке', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31642, 0, 1, null, 18937, null, 'BANKCREATEDATE', 6, 0, 0, 'Дата выпуска карты банком', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31643, 0, 1, null, 18937, null, 'BANKRETURNDATE', 6, 0, 0, 'Дата возврата карты в банк', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31644, 0, 1, null, 18937, null, 'CLIENTORG', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31645, 0, 1, null, 18937, null, 'CLIENTRECEIVEDATE', 6, 0, 0, 'Дата выдачи карты клиенту', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31646, 0, 1, null, 18937, null, 'CLIENTRETURNDATE', 6, 0, 0, 'Дата возврата карты клиентом', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31647, 0, 1, null, 18937, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31648, 0, 1, null, 18937, null, 'EMPLOYEENAME', 1, 0, 512, 'ФИО Ответственного сотрудника клиента', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31649, 0, 1, null, 18937, null, 'FULLCARDNUMBER', 1, 0, 20, 'Полный номер карты', '', 23, '9999.9999.9999.9999;0;_', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31650, 0, 1, null, 18937, null, 'REQUEST_DATE', 6, 0, 0, 'Дата заявления(Заявление на получение карт)', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31651, 0, 1, null, 18937, null, 'REQUEST_NUMBER', 1, 0, 50, 'Номер заявления(Заявление на получение карт)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- FACIALFINCAPTION
CALL FIELDSINFO_IMPORT(18948, 0, 1, null, 18947, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18949, 0, 1, null, 18947, null, 'DOCNUMBER', 1, 0, 50, '№ документа', 'Номер документа', 40, '999999999;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18950, 0, 1, null, 18947, null, 'SOURCEDOCNUM', 1, 0, 50, '№ реестра ', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18951, 0, 1, null, 18947, null, 'PAYDATE', 6, 0, 0, 'СрокПлатежа', 'Срок платежа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18952, 0, 1, null, 18947, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18953, 0, 1, null, 18947, null, 'DOCUMENTDATE', 6, 0, 0, 'Дата документа', 'Дата документа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18954, 0, 1, null, 18947, null, 'REESTRDATE', 6, 0, 0, 'Дата реестра', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18955, 0, 1, null, 18947, null, 'CREDIT', 6, 0, 0, 'СуммаЗаголовка', 'Сумма в заголовке', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18956, 0, 1, null, 18947, null, 'SOURCEACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет плательщика (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18957, 0, 1, null, 18947, null, 'SOURCEFACIALACC_CLS', 3, 0, 0, 'л\с плательщика', 'Лицевой счет плательщика средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18958, 0, 1, null, 18947, null, 'DESTACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18959, 0, 1, null, 18947, null, 'DESTFACIALACC_CLS', 3, 0, 0, 'л\с получателя', 'Лицевой счет получателя средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18960, 0, 1, null, 18947, null, 'PROGINDEX', 3, 0, 0, 'Индекс данных', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18961, 0, 1, null, 18947, null, 'ARHIVEDOC', 3, 0, 0, 'Признак архивности', 'Архивность', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18962, 0, 1, null, 18947, null, 'PAYSYMBOLCLS', 3, 0, 0, 'Кассовый символ', '', 11, '99.99', '', '', 0, 0, null, 0, 17062, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18963, 0, 1, null, 18947, null, 'PAYTYPECLS', 3, 0, 0, 'Вид платежа', 'Виды платежей', 4, '999', '', '', 0, 0, null, 1, 17016, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18964, 0, 1, null, 18947, null, 'NOTE', 1, 0, 1024, 'Примечание', 'Примечание', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18965, 0, 1, null, 18947, null, 'PERIOD', 1, 0, 20, 'Период', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18966, 0, 1, null, 18947, null, 'PAYPRIORITY', 3, 0, 0, 'Очередность ', 'Очердность платежа', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18967, 0, 1, null, 18947, null, 'TYPEOPERATIONCLS', 3, 0, 0, 'Тип операции', 'Классификатор типа операции', 3, '99', '', '', 0, 0, null, 0, 17094, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18968, 0, 1, null, 18947, null, 'BUHPAYMENTCLS', 3, 0, 0, 'Вид учета (старый)', 'Старый классификатор бухгалтерской проводки (Вида учета (старый))', 4, '999', '', '', 0, 0, null, 1, 17069, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18969, 0, 1, null, 18947, null, 'SENDERID', 3, 0, 0, 'Код отправителя документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18970, 0, 1, null, 18947, null, 'SENDERRECORDID', 3, 0, 0, 'Код УРМ документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18971, 0, 1, null, 18947, null, 'REESTR_REF', 3, 0, 0, 'Код реестра', 'Ссылка на реестр', 11, '', '', '', 0, 0, null, 0, 19088, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18972, 0, 1, null, 18947, null, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18973, 0, 1, null, 18947, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', 'Текст причины отклонения документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18974, 0, 1, null, 18947, null, 'CLIENTBANKNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18975, 0, 1, null, 18947, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', 'Статус электронной цифровой подписи', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18976, 0, 1, null, 18947, null, 'TRUSTNUMBER', 1, 0, 50, '№ доверенности', 'Номер доверенности (для чеков)', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18977, 0, 1, null, 18947, null, 'LINKEDDOCUMENT', 3, 0, 0, 'Связанный документ', 'Ссылка на связанный документ', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18978, 0, 1, null, 18947, null, 'BNKRECORDID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18979, 0, 1, null, 18947, null, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18980, 0, 1, null, 18947, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18981, 0, 1, null, 18947, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18982, 0, 1, null, 18947, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзмененийДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18983, 0, 1, null, 18947, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18984, 0, 1, null, 18947, null, 'SUBPROGINDEX', 3, 0, 0, 'Уточнение индекса данных', 'Уточнение индекса данных', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18985, 0, 1, null, 18947, null, 'CARDNUMBER', 1, 0, 50, 'Номер карточки', '', 40, '99999999999999999999;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18986, 0, 1, null, 18947, null, 'DOCUMENTSTATE', 1, 0, 1, 'Состояние документа', '', 1, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18987, 0, 1, null, 18947, null, 'USERSVISA', 1, 0, 10, 'Виза пользователя', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18988, 0, 1, null, 18947, null, 'TREASUARYDOCSTATECLS', 3, 0, 0, 'Состояние документа', 'Состояние платежного документа при обработке его по схеме', 11, '', '', '', 0, 0, null, 0, 20428, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18989, 0, 1, null, 18947, null, 'DEPARTMENTCLS', 3, 0, 0, 'Отдел', 'Классификатор отделов', 9, '99.99.99', '', '', 0, 0, null, 1, 19786, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18990, 0, 1, null, 18947, null, 'NDS', 1, 0, 100, 'НДС', 'Налог на добавленную стоимость', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18991, 0, 1, null, 18947, null, 'TAXNOTE', 1, 0, 150, 'Налоги', 'Информация о налоге', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18992, 0, 1, null, 18947, null, 'MANAGERBID', 3, 0, 0, 'Локальный реестр', 'Ссылка на локальный реестр', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18993, 0, 1, null, 18947, null, 'BIDNUMBER', 1, 0, 50, 'НомерЗаявки', 'Номер заявки', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18994, 0, 1, null, 18947, null, 'GROUPID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18995, 0, 1, null, 18947, null, 'GROUPSUMMA', 6, 0, 0, '', '', 13, '', '', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18996, 0, 1, null, 18947, null, 'DOCSTATEREF', 3, 0, 0, 'СостояниеДокумента', 'Состояние документа', 11, '', '00.00.00', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18997, 0, 1, null, 18947, null, 'LASTEXTRCHANGE', 11, 0, 0, 'Дата экстренного изменения', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18998, 0, 1, null, 18947, null, 'FAXDOCCOUNT', 3, 0, 0, 'ЧислоПодтверждающихДокументовПоФаксу', 'Счетчик количества факсов', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18999, 0, 1, null, 18947, null, 'STIMATEID', 3, 0, 0, 'Код cметы', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19000, 0, 1, null, 18947, null, 'INTEGRATEDDOCREF', 3, 0, 0, 'Код сводного платежного поручения', 'Код сводного платежного поручения', 11, '', '', '', 0, 0, null, 0, 18947, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19001, 0, 1, null, 18947, null, 'REQUESTNUMBER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19002, 0, 1, null, 18947, null, 'REQUESTDATE', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19003, 0, 1, null, 18947, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19004, 0, 1, null, 18947, null, 'FEDERALFUNDSREF', 3, 0, 0, 'Федеральные cредства', 'Ссылка на реестр федеральных средств', 11, '', '', '', 0, 0, null, 0, 17668, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19005, 0, 1, null, 18947, null, 'RVERSION', 3, 0, 0, 'Версия изменения документа', 'Версия изменения документа', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19006, 0, 1, null, 18947, null, 'ELDOCREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19295, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19007, 0, 1, null, 18947, null, 'BUHOPERATIONCLS', 3, 0, 0, 'БухОперация для заголовка', 'Бух операция по 70н в заголовке', 11, '', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19008, 0, 1, null, 18947, null, 'CLSTYPE', 3, 0, 0, 'Признак классификации плательщика', 'Признак классификации: 0 - расходная (по умолчанию),1 - источниковая', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19009, 0, 1, null, 18947, null, 'OPERATIONDIRECTION', 3, 0, 0, 'НаправлениеОперации', 'Направление операции', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19010, 0, 1, null, 18947, null, 'SOURCETYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19011, 0, 1, null, 18947, null, 'DESTTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19012, 0, 1, null, 18947, null, 'ISBLOCKED', 3, 0, 0, 'ПризнакБлокировки', 'Признак того что документ заблокирован (=1)', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19013, 0, 1, null, 18947, null, 'BLOCKEDCAUSE', 1, 0, 255, 'Причина блокировки', 'Причина блокировки документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19014, 0, 1, null, 18947, null, 'UNBLOCKEDDATE', 6, 0, 0, 'Дата разблокировки', 'Дата разблокировки документа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19015, 0, 1, null, 18947, null, 'UNBLOCKEDCAUSE', 1, 0, 255, 'Причина разблокировки', 'Причина разблокировки документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24730, 0, 1, null, 18947, null, 'BIDDATE', 6, 0, 0, 'ДатаЗаявки', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24731, 0, 1, null, 18947, null, 'CASHIERPERSONALINFO', 1, 0, 512, 'ПерсональнаяИнформация', 'Персональная информация', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31656, 0, 1, null, 18947, null, 'CARDREF', 3, 0, 0, 'КлючПластиковойКарты', 'Ссылка на пластиковую карту', 11, '', '', '', 0, 0, null, 0, 18937, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31657, 0, 1, null, 18947, null, 'DESTSTOREDPAYMENTPROPS', 1, 0, 2000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31658, 0, 1, null, 18947, null, 'SOURCESTOREDPAYMENTPROPS', 1, 0, 2000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31659, 0, 1, null, 18947, null, 'STOREDPAYMENTNOTE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34968, 0, 1, null, 18947, null, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35367, 0, 1, null, 18947, null, 'UINCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38174, 0, 1, null, 18947, null, 'SIGNERS', 1, 0, 1000, 'Подписи', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38187, 0, 1, null, 18947, null, 'DESTCLSTYPE', 3, 0, 0, 'Признак классификации получателя', 'Признак классификации: 0 - расходная (по умолчанию),1 - источниковая', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- PROMISE_DETAIL
CALL FIELDSINFO_IMPORT(19017, 0, 1, null, 19016, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19018, 0, 1, null, 19016, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17583, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19019, 0, 1, null, 19016, null, 'PARENT_PROMISE', 3, 0, 0, 'Номер уточняемого БО', 'Номер уточняемого БО', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19020, 0, 1, null, 19016, null, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19021, 0, 1, null, 19016, null, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19022, 0, 1, null, 19016, null, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19023, 0, 1, null, 19016, null, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19024, 0, 1, null, 19016, null, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19025, 0, 1, null, 19016, null, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19026, 0, 1, null, 19016, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19027, 0, 1, null, 19016, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19028, 0, 1, null, 19016, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', 'Классификатор типа документа', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19029, 0, 1, null, 19016, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', 'Классификатор типа финансирования', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19030, 0, 1, null, 19016, null, 'FINSOURCE', 3, 0, 0, 'Источник финансирования', 'Источник финансирования', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19031, 0, 1, null, 19016, null, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19032, 0, 1, null, 19016, null, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19033, 0, 1, null, 19016, null, 'SUMMA', 6, 0, 0, 'Сумма бюджетных обязательств за год', 'Сумма бюджетных обязательств за год', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19034, 0, 1, null, 19016, null, 'REGISTRNUMBER', 3, 0, 0, '№ бюджетного обязательства', 'Номер бюджетного обязательства', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19035, 0, 1, null, 19016, null, 'CLOSEDATE', 6, 0, 0, 'Дата уточнения', 'Дата уточнения', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19036, 0, 1, null, 19016, null, 'CHILD_PROMISE', 3, 0, 0, 'Номер уточняющего БО', 'Номер уточняющего БО', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19037, 0, 1, null, 19016, null, 'MONTH01', 6, 0, 0, 'Сумма бюджетных обязательств за январь', 'Сумма бюджетных обязательств за январь', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19038, 0, 1, null, 19016, null, 'MONTH02', 6, 0, 0, 'Сумма бюджетных обязательств за февраль', 'Сумма бюджетных обязательств за февраль', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19039, 0, 1, null, 19016, null, 'MONTH03', 6, 0, 0, 'Сумма бюджетных обязательств за март', 'Сумма бюджетных обязательств за март', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19040, 0, 1, null, 19016, null, 'MONTH04', 6, 0, 0, 'Сумма бюджетных обязательств за апрель', 'Сумма бюджетных обязательств за апрель', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19041, 0, 1, null, 19016, null, 'MONTH05', 6, 0, 0, 'Сумма бюджетных обязательств за май', 'Сумма бюджетных обязательств за май', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19042, 0, 1, null, 19016, null, 'MONTH06', 6, 0, 0, 'Сумма бюджетных обязательств за июнь', 'Сумма бюджетных обязательств за июнь', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 26, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19043, 0, 1, null, 19016, null, 'MONTH07', 6, 0, 0, 'Сумма бюджетных обязательств за июль', 'Сумма бюджетных обязательств за июль', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19044, 0, 1, null, 19016, null, 'MONTH08', 6, 0, 0, 'Сумма бюджетных обязательств за август', 'Сумма бюджетных обязательств за август', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 28, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19045, 0, 1, null, 19016, null, 'MONTH09', 6, 0, 0, 'Сумма бюджетных обязательств за сентябрь', 'Сумма бюджетных обязательств за сентябрь', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19046, 0, 1, null, 19016, null, 'MONTH10', 6, 0, 0, 'Сумма бюджетных обязательств за октябрь', 'Сумма бюджетных обязательств за октябрь', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19047, 0, 1, null, 19016, null, 'MONTH11', 6, 0, 0, 'Сумма бюджетных обязательств за ноябрь', 'Сумма бюджетных обязательств за ноябрь', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 31, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19048, 0, 1, null, 19016, null, 'MONTH12', 6, 0, 0, 'Сумма бюджетных обязательств за декабрь', 'Сумма бюджетных обязательств за декабрь', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 32, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19049, 0, 1, null, 19016, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 4, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19050, 0, 1, null, 19016, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19051, 0, 1, null, 19016, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19052, 0, 1, null, 19016, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19053, 0, 1, null, 19016, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19054, 0, 1, null, 19016, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19055, 0, 1, null, 19016, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19056, 0, 1, null, 19016, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19057, 0, 1, null, 19016, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19058, 0, 1, null, 19016, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19059, 0, 1, null, 19016, null, 'MONTH01DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19060, 0, 1, null, 19016, null, 'MONTH02DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19061, 0, 1, null, 19016, null, 'MONTH03DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19062, 0, 1, null, 19016, null, 'MONTH04DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19063, 0, 1, null, 19016, null, 'MONTH05DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19064, 0, 1, null, 19016, null, 'MONTH06DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19065, 0, 1, null, 19016, null, 'MONTH07DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19066, 0, 1, null, 19016, null, 'MONTH08DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19067, 0, 1, null, 19016, null, 'MONTH09DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19068, 0, 1, null, 19016, null, 'MONTH10DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19069, 0, 1, null, 19016, null, 'MONTH11DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19070, 0, 1, null, 19016, null, 'MONTH12DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19071, 0, 1, null, 19016, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19072, 0, 1, null, 19016, null, 'SUMMAYEAR1', 6, 0, 0, 'Сумма бюджетных обязательств на первый год', 'Сумма бюджетных обязательств на первый год', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 56, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19073, 0, 1, null, 19016, null, 'SUMMAYEAR2', 6, 0, 0, 'Сумма бюджетных обязательств на второй год', 'Сумма бюджетных обязательств на второй год', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 57, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19074, 0, 1, null, 19016, null, 'SUMMAYEAR3', 6, 0, 0, 'Сумма бюджетных обязательств на третий год', 'Сумма бюджетных обязательств на третий год', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 58, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19075, 0, 1, null, 19016, null, 'SUMMAYEAR1DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19076, 0, 1, null, 19016, null, 'SUMMAYEAR2DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19077, 0, 1, null, 19016, null, 'SUMMAYEAR3DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19078, 0, 1, null, 19016, null, 'ASSIGNMENTKIND', 3, 0, 0, 'Вид ассигнований', 'Вид ассигнований', 9, '99.99.99', '', '', 0, 0, null, 1, 22976, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27705, 0, 1, null, 19016, null, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27860, 0, 1, null, 19016, null, 'BUDALLOCATIONCLS', 3, 0, 0, 'Код бюджетного ассигнованияКлюч', '', 9, '9999999', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27861, 0, 1, null, 19016, null, 'PAYPROMISECLS', 3, 0, 0, 'Код расходного обязательстваКлюч', '', 13, '999999999', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25480, 0, 1, null, 19016, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средствКлюч', '', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- FACIALFINREESTR
CALL FIELDSINFO_IMPORT(19089, 0, 1, null, 19088, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19090, 0, 1, null, 19088, null, 'REESTRNUMBER', 1, 0, 50, '№ реестра', 'Номер реестра', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19091, 0, 1, null, 19088, null, 'REESTRDATE', 6, 0, 0, 'Дата реестра', 'Дата реестра', 11, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19092, 0, 1, null, 19088, null, 'REESTRTYPE', 3, 0, 0, 'Тип реестра', '', 11, '9.99.9', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19093, 0, 1, null, 19088, null, 'ACCEPTED', 3, 0, 0, 'Принятие реестра', 'Признак принятия реестра', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19094, 0, 1, null, 19088, null, 'SESSIONNUMBER', 3, 0, 0, 'Номер группы реестров', 'Номер группы реестров казначейства', 11, '', '', '##', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19095, 0, 1, null, 19088, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19096, 0, 1, null, 19088, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19097, 0, 1, null, 19088, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19098, 0, 1, null, 19088, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19099, 0, 1, null, 19088, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19100, 0, 1, null, 19088, null, 'PACKETNUMBER', 1, 0, 20, 'Номер эл. пакета', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19101, 0, 1, null, 19088, null, 'FACIALACC_CLS', 3, 0, 0, 'Субсчет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19102, 0, 1, null, 19088, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19103, 0, 1, null, 19088, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19104, 0, 1, null, 19088, null, 'FICTIVEDOC', 3, 0, 0, 'Номер п/п', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19105, 0, 1, null, 19088, null, 'REESTRTYPEEX', 3, 0, 0, 'ТипРеестра', 'Казначейство. Тип реестра', 7, '9.99.9', '', '', 0, 0, null, 1, 19705, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19106, 0, 1, null, 19088, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19107, 0, 1, null, 19088, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19108, 0, 1, null, 19088, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19109, 0, 1, null, 19088, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30617, 0, 1, null, 19088, null, 'DEPARTMENTCLS', 3, 0, 0, 'Отдел', '', 9, '99.99.99', '', '', 0, 0, null, 1, 19786, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PERCENTJOURNAL
CALL FIELDSINFO_IMPORT(19111, 0, 1, null, 19110, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19112, 0, 1, null, 19110, null, 'ACCEPTDATE', 6, 0, 0, 'Дата начисления', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19113, 0, 1, null, 19110, null, 'PERCENT', 6, 0, 0, 'Процентная ставка', '', 13, '', ',0.000000', '0.000000', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19114, 0, 1, null, 19110, null, 'PROGINDEX', 3, 0, 0, 'Тип', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19115, 0, 1, null, 19110, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19116, 0, 1, null, 19110, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19117, 0, 1, null, 19110, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19118, 0, 1, null, 19110, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19119, 0, 1, null, 19110, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19120, 0, 1, null, 19110, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19121, 0, 1, null, 19110, null, 'CBREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19122, 0, 1, null, 19110, null, 'ISLAST', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REQUESTS
CALL FIELDSINFO_IMPORT(19124, 0, 1, null, 19123, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19125, 0, 1, null, 19123, null, 'ANUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19126, 0, 1, null, 19123, null, 'BUDGET', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19127, 0, 1, null, 19123, null, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19128, 0, 1, null, 19123, null, 'KVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19129, 0, 1, null, 19123, null, 'KCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19130, 0, 1, null, 19123, null, 'KVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19131, 0, 1, null, 19123, null, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19132, 0, 1, null, 19123, null, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19133, 0, 1, null, 19123, null, 'AMONTH', 3, 0, 0, 'Месяц', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19134, 0, 1, null, 19123, null, 'AYEAR', 3, 0, 0, 'Год', '', 11, '9999', '####', '####', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19135, 0, 1, null, 19123, null, 'USERNOTE', 1, 0, 255, 'Примечание', 'Примечание', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19136, 0, 1, null, 19123, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19137, 0, 1, null, 19123, null, 'SOURCEACCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19138, 0, 1, null, 19123, null, 'DESTACCOUNT', 3, 0, 0, 'Счет получателя', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19139, 0, 1, null, 19123, null, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19140, 0, 1, null, 19123, null, 'FINSOURCE', 3, 0, 0, 'Источник финансирования', 'Источник финансирования', 4, '999', '', '', 0, 0, null, 0, 16983, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19141, 0, 1, null, 19123, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', 'Классификатор типа финансирования', 5, '9.99', '', '', 0, 0, null, 0, 16955, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19142, 0, 1, null, 19123, null, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19143, 0, 1, null, 19123, null, 'BUHPAYMENTCLS', 3, 0, 0, 'Вид учета (старый)', 'Старый классификатор бухгалтерской проводки (Вида учета (старый))', 4, '999', '', '', 0, 0, null, 0, 17069, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19144, 0, 1, null, 19123, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', 'Классификатор типа документа', 7, '9.99.9', '', '', 0, 0, null, 0, 16814, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19145, 0, 1, null, 19123, null, 'PAYDATE', 6, 0, 0, 'СрокПлатежа', 'Срок платежа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19146, 0, 1, null, 19123, null, 'PAYPRIORITY', 3, 0, 0, 'Очередность ', 'Очердность платежа', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19147, 0, 1, null, 19123, null, 'SUMMAREQUESTED', 6, 0, 0, 'Сумма заявки', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19148, 0, 1, null, 19123, null, 'SUMMATOFINANCE', 6, 0, 0, 'Сумма к исполнению', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19149, 0, 1, null, 19123, null, 'REQUESTTYPE', 3, 0, 0, 'Способ исполнения заявки', 'Способ исполнения заявки', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19150, 0, 1, null, 19123, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19151, 0, 1, null, 19123, null, 'PAYSYMBOLCLS', 3, 0, 0, 'Кассовый символ', 'Кассовый символ (для чеков, объявлений)', 6, '99.99', '', '', 0, 0, null, 0, 17062, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19152, 0, 1, null, 19123, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19153, 0, 1, null, 19123, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19154, 0, 1, null, 19123, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19155, 0, 1, null, 19123, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19156, 0, 1, null, 19123, null, 'PROMISE', 3, 0, 0, '№ бюджетного обязательства', 'Номер бюджетного обязательства', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19157, 0, 1, null, 19123, null, 'DOCUMENTBASETYPE', 3, 0, 0, 'Тип документа основания', 'Классификатор типа документа-оснвания', 10, '99.99.999', '', '', 0, 0, null, 0, 16973, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19158, 0, 1, null, 19123, null, 'INPUTDATE', 6, 0, 0, 'Дата ввода', 'Дата ввода', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19159, 0, 1, null, 19123, null, 'DFACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19160, 0, 1, null, 19123, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19161, 0, 1, null, 19123, null, 'PROGINDEX2', 3, 0, 0, 'Способ исполнения', 'Способ исполнения новых заявок', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19162, 0, 1, null, 19123, null, 'RECORDINDEX', 3, 0, 0, 'ИндексЗаявки', 'RecordIndex из заголовка заявок', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19163, 0, 1, null, 19123, null, 'INNERFINSOURCE', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '99.9.9.9', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19164, 0, 1, null, 19123, null, 'OUTERFINSOURCE', 3, 0, 0, 'Источник внешнего финансирования', '', 11, '99.99', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19165, 0, 1, null, 19123, null, 'KD', 3, 0, 0, 'КД', 'Ссылка на код дохода', 11, '9.99.99.99.99', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19166, 0, 1, null, 19123, null, 'SUBKD', 3, 0, 0, 'СубКД', 'Классификатор суб кода дохода', 9, '99.99.99', '', '', 0, 0, null, 1, 16928, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19167, 0, 1, null, 19123, null, 'PLANDATE', 6, 0, 0, 'Плановая дата', 'Плановая дата', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19168, 0, 1, null, 19123, null, 'CURRENCYCLS', 3, 0, 0, 'Код валюты', 'Код валюты', 4, '999', '', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19169, 0, 1, null, 19123, null, 'CURRENCYSUMMA', 6, 0, 0, 'Сумма в валюте', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19170, 0, 1, null, 19123, null, 'REQUESTSDOCSTATE', 3, 0, 0, 'Состояние заявки', 'Состояние заявки', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19171, 0, 1, null, 19123, null, 'TAXNOTE', 1, 0, 150, 'Налоги', 'Информация о налоге', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19172, 0, 1, null, 19123, null, 'GOSNI', 3, 0, 0, 'ГОС. НИ', '', 6, '99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19173, 0, 1, null, 19123, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19174, 0, 1, null, 19123, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19175, 0, 1, null, 19123, null, 'DOCSTATEREF', 3, 0, 0, 'СостояниеДокумента', 'Состояние документа', 11, '', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19176, 0, 1, null, 19123, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', 'Статус электронной цифровой подписи', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19177, 0, 1, null, 19123, null, 'FEDERALFUNDSREF', 3, 0, 0, 'Федеральные cредства', 'Ссылка на реестр федеральных средств', 11, '', '', '', 0, 0, null, 0, 17668, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19178, 0, 1, null, 19123, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19179, 0, 1, null, 19123, null, 'IFS_CORR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19180, 0, 1, null, 19123, null, 'CLSTYPE', 3, 0, 0, 'Признак классификации', 'Признак классификации: 0 - расходная (по умолчанию),1 - источниковая', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19181, 0, 1, null, 19123, null, 'REESTRDATE', 6, 0, 0, 'Дата реестра', 'Дата реестра', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24960, 0, 1, null, 19123, null, 'EXECSUMMA', 6, 0, 0, 'Исполнено на сумму', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27706, 0, 1, null, 19123, null, 'SUBSIDYCLS', 3, 0, 0, 'Код субсидии (ключ)', 'Ссылка на код субсидии ', 12, '999.99.9999', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29948, 0, 1, null, 19123, null, 'BUDALLOCATIONCLS', 3, 0, 0, 'Код бюджетного ассигнованияКлюч', '', 9, '9999999', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29949, 0, 1, null, 19123, null, 'PAYPROMISECLS', 3, 0, 0, 'Код расходного обязательстваКлюч', '', 13, '999999999', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29950, 0, 1, null, 19123, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средствКлюч', '', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DEBT
CALL FIELDSINFO_IMPORT(19183, 0, 1, null, 19182, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19184, 0, 1, null, 19182, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 4, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19185, 0, 1, null, 19182, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19186, 0, 1, null, 19182, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19187, 0, 1, null, 19182, null, 'ACCEPTDATE', 6, 0, 0, 'Дата', 'Дата принятия из детализации', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19188, 0, 1, null, 19182, null, 'RECORDDATE', 6, 0, 0, 'Дата учета', 'Дата учета из детализации', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19189, 0, 1, null, 19182, null, 'PLANDATE', 6, 0, 0, 'Дата', 'Дата принятия из детализации', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19190, 0, 1, null, 19182, null, 'DFACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19191, 0, 1, null, 19182, null, 'DEBIT', 6, 0, 0, 'Сумма', '', 13, '', '0.00####', '0.00####', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19192, 0, 1, null, 19182, null, 'CREDIT', 6, 0, 0, 'Кредит', '', 13, '', '0.00####', '0.00####', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19193, 0, 1, null, 19182, null, 'ACCREF', 3, 0, 0, 'Счет кредитора', 'Счет кредитора из детализации', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19194, 0, 1, null, 19182, null, 'ACCEPTORACCREF', 3, 0, 0, 'Счет получателя', 'Счет получателя из детализации(извращение для показа гарантий)', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19195, 0, 1, null, 19182, null, 'IFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '99.9.9.9', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19196, 0, 1, null, 19182, null, 'SUBKD', 3, 0, 0, 'СубКД', 'Классификатор суб кода дохода', 9, '99.99.99', '', '', 0, 0, null, 1, 16928, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19197, 0, 1, null, 19182, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', 'Классификатор типа документа', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19198, 0, 1, null, 19182, null, 'SOURCEDOCNUMBER', 1, 0, 20, 'НомерЗаписи', 'Номер документа из детализации', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19199, 0, 1, null, 19182, null, 'REGIONCLS', 3, 0, 0, 'РайонИзДетали', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19200, 0, 1, null, 19182, null, 'NOTE', 1, 0, 255, 'Примечание из детализации', 'Примечание из детализации', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19201, 0, 1, null, 19182, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19202, 0, 1, null, 19182, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19203, 0, 1, null, 19182, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19204, 0, 1, null, 19182, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19205, 0, 1, null, 19182, null, 'OFS', 3, 0, 0, '', '', 11, '99.99', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19206, 0, 1, null, 19182, null, 'CURRENCYCLS', 3, 0, 0, 'Код валюты', 'Код валюты', 4, '999', '000', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19207, 0, 1, null, 19182, null, 'CURRENCYSUMMA', 6, 0, 0, 'Сумма в валюте', 'Сумма в валюте из детализации', 13, '', '0.00####', '0.00####', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19208, 0, 1, null, 19182, null, 'BUHPAYMENTCLS', 3, 0, 0, 'Вид учета (старый)', 'Старый классификатор бухгалтерской проводки (Вида учета (старый))', 4, '999', '', '', 0, 0, null, 1, 17069, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19209, 0, 1, null, 19182, null, 'RECORDINDEX2', 3, 0, 0, 'Ссылка на мастер запись', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19210, 0, 1, null, 19182, null, 'TOTALREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 17876, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19211, 0, 1, null, 19182, null, 'REQUESTSINDEX', 3, 0, 0, 'Индекс заявки', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19212, 0, 1, null, 19182, null, 'TAXNOTE', 1, 0, 150, 'Информация для налогового платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19213, 0, 1, null, 19182, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19214, 0, 1, null, 19182, null, 'ELDOCREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19295, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19215, 0, 1, null, 19182, null, 'REQUESTSINDEX2', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19123, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19216, 0, 1, null, 19182, null, 'FEDERALFUNDSREF', 3, 0, 0, 'Федеральные cредства', 'Ссылка на реестр федеральных средств', 11, '', '', '', 0, 0, null, 0, 17668, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19217, 0, 1, null, 19182, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19218, 0, 1, null, 19182, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19219, 0, 1, null, 19182, null, 'IFS_CORR', 3, 0, 0, 'Классификация остатков средств', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19220, 0, 1, null, 19182, null, 'BONDCOUNT', 3, 0, 0, 'Количество облигаций', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LOANCREDITPLAN
CALL FIELDSINFO_IMPORT(19222, 0, 1, null, 19221, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19223, 0, 1, null, 19221, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19224, 0, 1, null, 19221, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19225, 0, 1, null, 19221, null, 'PLANDATE', 6, 0, 0, 'Дата', 'Дата принятия из детализации', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19226, 0, 1, null, 19221, null, 'SUMMA', 6, 0, 0, 'Кредит', 'Кредитовое поле для детализаций с проводками', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19227, 0, 1, null, 19221, null, 'NOTE', 1, 0, 255, 'ПримечаниеДет', 'Примечание из детализации', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19228, 0, 1, null, 19221, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19229, 0, 1, null, 19221, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19230, 0, 1, null, 19221, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19231, 0, 1, null, 19221, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19232, 0, 1, null, 19221, null, 'CURRENCYCLS', 3, 0, 0, 'Код валюты', 'Код валюты', 4, '999', '', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19233, 0, 1, null, 19221, null, 'CURRENCYSUMMA', 6, 0, 0, 'Сумма в валюте', 'Сумма в валюте из детализации', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REQUESTSPAYMENTS
CALL FIELDSINFO_IMPORT(19235, 0, 1, null, 19234, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19236, 0, 1, null, 19234, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19237, 0, 1, null, 19234, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 19123, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19238, 0, 1, null, 19234, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19239, 0, 1, null, 19234, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19240, 0, 1, null, 19234, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19241, 0, 1, null, 19234, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- DELRECINDEXES
CALL FIELDSINFO_IMPORT(19243, 0, 1, null, 19242, null, 'TABLEID', 3, 0, 0, 'Таблица', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19244, 0, 1, null, 19242, null, 'RECORDID', 3, 0, 0, 'Идентификатор записи', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19245, 0, 1, null, 19242, null, 'DELETEDATE', 11, 0, 0, 'Время удаления', '', 20, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19246, 0, 1, null, 19242, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19247, 0, 1, null, 19242, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19248, 0, 1, null, 19242, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKEXCH_MERDOC
CALL FIELDSINFO_IMPORT(19296, 0, 1, null, 19295, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19297, 0, 1, null, 19295, null, 'PACKETNUMBER', 1, 0, 255, 'Имя файла эл. пакета', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19298, 0, 1, null, 19295, null, 'GETDATE', 6, 0, 0, 'Дата получения', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19299, 0, 1, null, 19295, null, 'PROCESSING', 3, 0, 0, 'Обработан вручную', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19300, 0, 1, null, 19295, null, 'AUTOPROCESSING', 3, 0, 0, 'Обработан', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19301, 0, 1, null, 19295, null, 'NOTINCOME', 3, 0, 0, 'Не доход', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19302, 0, 1, null, 19295, null, 'NOTE', 1, 0, 255, 'Назначение платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19303, 0, 1, null, 19295, null, 'PAYERKPP', 1, 0, 20, 'КПП(Поля плательщика)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19304, 0, 1, null, 19295, null, 'PAYERNAME', 1, 0, 255, 'Наименование(Поля плательщика)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19305, 0, 1, null, 19295, null, 'KD', 3, 0, 0, 'КД', '', 11, '9.99.99.99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19306, 0, 1, null, 19295, null, 'PROCNOTE', 1, 0, 4000, 'Обработчик', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19307, 0, 1, null, 19295, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19308, 0, 1, null, 19295, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19309, 0, 1, null, 19295, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19310, 0, 1, null, 19295, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19311, 0, 1, null, 19295, null, 'DVV', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19312, 0, 1, null, 19295, null, 'DD', 6, 0, 0, 'Дата документа', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19313, 0, 1, null, 19295, null, 'ND', 1, 0, 10, 'Номер документа', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19314, 0, 1, null, 19295, null, 'DV', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19315, 0, 1, null, 19295, null, 'DAV', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19316, 0, 1, null, 19295, null, 'DK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19317, 0, 1, null, 19295, null, 'ELNUM', 1, 0, 50, '№ эл. документа', 'Электронный номер документа из таблицы входящих ЭПД, это поле введено для совместимости с файлом входящих ЭПД, который присылает банк', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19318, 0, 1, null, 19295, null, 'VO', 3, 0, 0, 'Вид операции', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19319, 0, 1, null, 19295, null, 'MFKB', 1, 0, 10, 'БИК банка плательщика (Поля плательщика\Банк)', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19320, 0, 1, null, 19295, null, 'LSKL', 1, 0, 20, 'Счет плательщика(Поля плательщика)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19321, 0, 1, null, 19295, null, 'NAMKL', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19322, 0, 1, null, 19295, null, 'MF', 1, 0, 10, 'БИК банка получателя(Поля получателя\Банк)', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19323, 0, 1, null, 19295, null, 'LSKOR', 1, 0, 20, 'Счет получателя (Поля получателя)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19324, 0, 1, null, 19295, null, 'NAMKOR', 1, 0, 255, 'Наименование получателя(Поля получателя)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19325, 0, 1, null, 19295, null, 'SU', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19326, 0, 1, null, 19295, null, 'NKOR1', 1, 0, 53, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19327, 0, 1, null, 19295, null, 'NKOR2', 1, 0, 53, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19328, 0, 1, null, 19295, null, 'NKOR3', 1, 0, 53, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19329, 0, 1, null, 19295, null, 'NKOR4', 1, 0, 53, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19330, 0, 1, null, 19295, null, 'PAROL', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19331, 0, 1, null, 19295, null, 'SS', 1, 0, 4, '', '', 4, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19332, 0, 1, null, 19295, null, 'KRKB', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19333, 0, 1, null, 19295, null, 'INNMFKB', 6, 0, 0, 'ИНН плательщика(Поля плательщика)', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19334, 0, 1, null, 19295, null, 'MFKBFIL', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19335, 0, 1, null, 19295, null, 'KR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19336, 0, 1, null, 19295, null, 'INNMF', 6, 0, 0, 'ИНН получателя(Поля получателя)', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19337, 0, 1, null, 19295, null, 'MFFIL', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19338, 0, 1, null, 19295, null, 'DFA', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19339, 0, 1, null, 19295, null, 'NA', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19340, 0, 1, null, 19295, null, 'T_CLOCK', 1, 0, 5, '', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19341, 0, 1, null, 19295, null, 'PR_DOC', 1, 0, 1, '', '', 1, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19342, 0, 1, null, 19295, null, 'DPLAT', 6, 0, 0, 'Срок платежа', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19343, 0, 1, null, 19295, null, 'SUB_ID', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19344, 0, 1, null, 19295, null, 'ELNUMS', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19345, 0, 1, null, 19295, null, 'LS_ERR', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19346, 0, 1, null, 19295, null, 'SENDER', 1, 0, 3, '', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19347, 0, 1, null, 19295, null, 'PAYKIND', 1, 0, 5, 'Вид платежа', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19348, 0, 1, null, 19295, null, 'IMPORTDOCREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19349, 0, 1, null, 19295, null, 'PRNUM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19350, 0, 1, null, 19295, null, 'KPPA', 1, 0, 9, 'КПП плательщика(Поля плательщика)', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19351, 0, 1, null, 19295, null, 'KPPB', 1, 0, 9, 'КПП получателя(Поля получателя)', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19352, 0, 1, null, 19295, null, 'DPPL', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19353, 0, 1, null, 19295, null, 'DKART', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19354, 0, 1, null, 19295, null, 'DSPL', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19355, 0, 1, null, 19295, null, 'D_OTMET', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19356, 0, 1, null, 19295, null, 'SSTATUS', 1, 0, 2, '', '', 2, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19357, 0, 1, null, 19295, null, 'CODBCLAS', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19358, 0, 1, null, 19295, null, 'CODOKATO', 1, 0, 11, '', '', 11, '99.999.999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19359, 0, 1, null, 19295, null, 'NALPLAT', 1, 0, 2, '', '', 2, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19360, 0, 1, null, 19295, null, 'NALPER', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19361, 0, 1, null, 19295, null, 'NDNAL', 1, 0, 15, '', '', 15, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19362, 0, 1, null, 19295, null, 'DDNAL', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19363, 0, 1, null, 19295, null, 'TYPNAL', 1, 0, 2, '', '', 2, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19364, 0, 1, null, 19295, null, 'SU_OST', 6, 0, 0, '', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 69, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19365, 0, 1, null, 19295, null, 'N_CH_PL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19366, 0, 1, null, 19295, null, 'D_PL', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19367, 0, 1, null, 19295, null, 'SHIFR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19368, 0, 1, null, 19295, null, 'N_PLDOK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19369, 0, 1, null, 19295, null, 'TAXNOTE', 1, 0, 150, 'Информация налогового платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19370, 0, 1, null, 19295, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19371, 0, 1, null, 19295, null, 'PRINTED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19372, 0, 1, null, 19295, null, 'SOP', 1, 0, 16, '', '', 16, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19373, 0, 1, null, 19295, null, 'UFK_PRIM', 1, 0, 512, 'Классификация', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19374, 0, 1, null, 19295, null, 'PROCDOCCLASS', 3, 0, 0, 'Класс документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19375, 0, 1, null, 19295, null, 'PROCUSEINFO', 1, 0, 255, 'Пользователи', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19376, 0, 1, null, 19295, null, 'ELPACKETNUMBER', 1, 0, 50, '№ эл. пакета', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19377, 0, 1, null, 19295, null, 'APRIOR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19378, 0, 1, null, 19295, null, 'SOURCEFILIALBANKNAME', 1, 0, 255, 'Филиал банка плательщика(Поля плательщика\Банк)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19379, 0, 1, null, 19295, null, 'DESTFILIALBANKNAME', 1, 0, 255, 'Филиал банка получателя(Поля получателя\Банк)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19380, 0, 1, null, 19295, null, 'SOURCEBANKNAME', 1, 0, 255, 'Банк плательщика(Поля плательщика\Банк)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19381, 0, 1, null, 19295, null, 'DESTBANKNAME', 1, 0, 255, 'Банк получателя(Поля получателя\Банк)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19382, 0, 1, null, 19295, null, 'DOCUMENTNAME', 1, 0, 255, 'Наименование документа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19383, 0, 1, null, 19295, null, 'SOURCEFACIALCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19384, 0, 1, null, 19295, null, 'DESTFACIALCODE', 1, 0, 20, 'Счет в ФК(Поля получателя)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19385, 0, 1, null, 19295, null, 'SOURCEINN', 1, 0, 12, '', '', 12, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19386, 0, 1, null, 19295, null, 'DESTINN', 1, 0, 12, '', '', 12, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24646, 0, 1, null, 19295, null, 'EXTPAYID', 1, 0, 50, 'Дополнительный идентификатор платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26541, 0, 1, null, 19295, null, 'KOD_IST', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27005, 0, 1, null, 19295, null, 'DEPARTMENTCLS', 3, 0, 0, '', '', 9, '', '', '', 0, 0, null, 0, 19786, 0, 0, 0, '', 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35358, 0, 1, null, 19295, null, 'UINCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKEXCH_REOUT
CALL FIELDSINFO_IMPORT(19388, 0, 1, null, 19387, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19389, 0, 1, null, 19387, null, 'PACKETNUMBER', 1, 0, 20, 'Номер пакета', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19390, 0, 1, null, 19387, null, 'GETDATE', 6, 0, 0, 'Дата получения ', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19391, 0, 1, null, 19387, null, 'PROCESSING', 3, 0, 0, 'Обработан вручную ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19392, 0, 1, null, 19387, null, 'AUTOPROCESSING', 3, 0, 0, 'Автообработка', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19393, 0, 1, null, 19387, null, 'PROCNOTE', 1, 0, 255, 'Обработчик', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19394, 0, 1, null, 19387, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19395, 0, 1, null, 19387, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19396, 0, 1, null, 19387, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19397, 0, 1, null, 19387, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19398, 0, 1, null, 19387, null, 'DVV', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19399, 0, 1, null, 19387, null, 'DD', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19400, 0, 1, null, 19387, null, 'DV', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19401, 0, 1, null, 19387, null, 'DAV', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19402, 0, 1, null, 19387, null, 'ND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19403, 0, 1, null, 19387, null, 'DK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19404, 0, 1, null, 19387, null, 'ELNUM', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19405, 0, 1, null, 19387, null, 'VO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19406, 0, 1, null, 19387, null, 'MFKB', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19407, 0, 1, null, 19387, null, 'LSKL', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19408, 0, 1, null, 19387, null, 'KRKB', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19409, 0, 1, null, 19387, null, 'MF', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19410, 0, 1, null, 19387, null, 'LSKOR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19411, 0, 1, null, 19387, null, 'KR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19412, 0, 1, null, 19387, null, 'SU', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19413, 0, 1, null, 19387, null, 'SS', 1, 0, 4, '', '', 4, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19414, 0, 1, null, 19387, null, 'DFA', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19415, 0, 1, null, 19387, null, 'NA', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19416, 0, 1, null, 19387, null, 'TYP_DOC', 1, 0, 1, '', '', 1, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19417, 0, 1, null, 19387, null, 'PR_DOC', 1, 0, 1, '', '', 1, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19418, 0, 1, null, 19387, null, 'T_EVENT', 1, 0, 5, '', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19419, 0, 1, null, 19387, null, 'SENDER', 1, 0, 3, '', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19420, 0, 1, null, 19387, null, 'KPPA', 1, 0, 9, '', '', 9, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19421, 0, 1, null, 19387, null, 'KPPB', 1, 0, 9, '', '', 9, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19422, 0, 1, null, 19387, null, 'DPPL', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19423, 0, 1, null, 19387, null, 'DKART', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19424, 0, 1, null, 19387, null, 'DSPL', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19425, 0, 1, null, 19387, null, 'SSTATUS', 1, 0, 2, '', '', 2, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19426, 0, 1, null, 19387, null, 'CODBCLAS', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19427, 0, 1, null, 19387, null, 'CODOKATO', 1, 0, 11, '', '', 11, '99.999.999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19428, 0, 1, null, 19387, null, 'NALPLAT', 1, 0, 2, '', '', 2, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19429, 0, 1, null, 19387, null, 'NALPER', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19430, 0, 1, null, 19387, null, 'NDNAL', 1, 0, 15, '', '', 15, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19431, 0, 1, null, 19387, null, 'DDNAL', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19432, 0, 1, null, 19387, null, 'TYPNAL', 1, 0, 2, '', '', 2, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19433, 0, 1, null, 19387, null, 'SU_OST', 6, 0, 0, '', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19434, 0, 1, null, 19387, null, 'N_CH_PL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19435, 0, 1, null, 19387, null, 'D_PL', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19436, 0, 1, null, 19387, null, 'SHIFR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19437, 0, 1, null, 19387, null, 'N_PLDOK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19438, 0, 1, null, 19387, null, 'D_OTMET', 1, 0, 8, '', '', 8, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19439, 0, 1, null, 19387, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19440, 0, 1, null, 19387, null, 'SOP', 1, 0, 16, '', '', 16, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKEXCH_LS_KB
CALL FIELDSINFO_IMPORT(19442, 0, 1, null, 19441, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19443, 0, 1, null, 19441, null, 'PACKETNUMBER', 1, 0, 255, 'Номер пакета', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19444, 0, 1, null, 19441, null, 'GETDATE', 6, 0, 0, 'Дата получения', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19445, 0, 1, null, 19441, null, 'AUTOPROCESSING', 3, 0, 0, 'Автообработка', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19446, 0, 1, null, 19441, null, 'PROCESSING', 3, 0, 0, 'Обработан вручную', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19447, 0, 1, null, 19441, null, 'PROCNOTE', 1, 0, 255, 'Обработчик', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19448, 0, 1, null, 19441, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19449, 0, 1, null, 19441, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19450, 0, 1, null, 19441, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19451, 0, 1, null, 19441, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19452, 0, 1, null, 19441, null, 'SU', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19453, 0, 1, null, 19441, null, 'ND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19454, 0, 1, null, 19441, null, 'MF', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19455, 0, 1, null, 19441, null, 'MFKB', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19456, 0, 1, null, 19441, null, 'LSK', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19457, 0, 1, null, 19441, null, 'LSD', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19458, 0, 1, null, 19441, null, 'KRSKB', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19459, 0, 1, null, 19441, null, 'DK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19460, 0, 1, null, 19441, null, 'NA', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19461, 0, 1, null, 19441, null, 'VO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19462, 0, 1, null, 19441, null, 'ELNUM', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19463, 0, 1, null, 19441, null, 'DVV', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19464, 0, 1, null, 19441, null, 'INNMFKB', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19465, 0, 1, null, 19441, null, 'INNMF', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19466, 0, 1, null, 19441, null, 'MFKBFIL', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19467, 0, 1, null, 19441, null, 'MFFIL', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19468, 0, 1, null, 19441, null, 'LSKL', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19469, 0, 1, null, 19441, null, 'LSKOR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19470, 0, 1, null, 19441, null, 'PFA', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19471, 0, 1, null, 19441, null, 'T_EVENT', 1, 0, 5, '', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19472, 0, 1, null, 19441, null, 'SENDER', 1, 0, 3, '', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19473, 0, 1, null, 19441, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19474, 0, 1, null, 19441, null, 'PD_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19475, 0, 1, null, 19441, null, 'ELPACKETNUMBER', 1, 0, 50, '№ эл. пакета', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKEXCH_KO_SALDO
CALL FIELDSINFO_IMPORT(19477, 0, 1, null, 19476, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19478, 0, 1, null, 19476, null, 'PACKETNUMBER', 1, 0, 255, 'Номер пакета', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19479, 0, 1, null, 19476, null, 'GETDATE', 6, 0, 0, 'Дата получения', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19480, 0, 1, null, 19476, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19481, 0, 1, null, 19476, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19482, 0, 1, null, 19476, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19483, 0, 1, null, 19476, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19484, 0, 1, null, 19476, null, 'LS', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19485, 0, 1, null, 19476, null, 'DT', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19486, 0, 1, null, 19476, null, 'KT', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19487, 0, 1, null, 19476, null, 'IXSP', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19488, 0, 1, null, 19476, null, 'IXSA', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19489, 0, 1, null, 19476, null, 'VXSP', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19490, 0, 1, null, 19476, null, 'VXSA', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19491, 0, 1, null, 19476, null, 'DF', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19492, 0, 1, null, 19476, null, 'T_CLOCK', 1, 0, 5, '', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19493, 0, 1, null, 19476, null, 'SENDER', 1, 0, 3, '', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19494, 0, 1, null, 19476, null, 'D_LAST', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19495, 0, 1, null, 19476, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19496, 0, 1, null, 19476, null, 'ELPACKETNUMBER', 1, 0, 50, '№ эл. пакета', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24635, 0, 1, null, 19476, null, 'INACC', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24636, 0, 1, null, 19476, null, 'INACCREST', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24637, 0, 1, null, 19476, null, 'INREST', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24638, 0, 1, null, 19476, null, 'OTHERSUMDAY', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24639, 0, 1, null, 19476, null, 'OUTACC', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24640, 0, 1, null, 19476, null, 'OUTACCREST', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24641, 0, 1, null, 19476, null, 'OUTREST', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24642, 0, 1, null, 19476, null, 'PAYMENTSUM', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24643, 0, 1, null, 19476, null, 'REESTRSUM', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24644, 0, 1, null, 19476, null, 'SUBSIDYDAY', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24645, 0, 1, null, 19476, null, 'UNKNOWNSUM', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKEXCH_MERKWI
CALL FIELDSINFO_IMPORT(19498, 0, 1, null, 19497, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19499, 0, 1, null, 19497, null, 'PACKETNUMBER', 1, 0, 20, 'Номер пакета', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19500, 0, 1, null, 19497, null, 'GETDATE', 6, 0, 0, 'Дата получения', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19501, 0, 1, null, 19497, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19502, 0, 1, null, 19497, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19503, 0, 1, null, 19497, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19504, 0, 1, null, 19497, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19505, 0, 1, null, 19497, null, 'MFA', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19506, 0, 1, null, 19497, null, 'MFB', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19507, 0, 1, null, 19497, null, 'IDA', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19508, 0, 1, null, 19497, null, 'IDB', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19509, 0, 1, null, 19497, null, 'SUM_', 6, 0, 0, 'SUM', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19510, 0, 1, null, 19497, null, 'COUNT_', 3, 0, 0, 'COUNT', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19511, 0, 1, null, 19497, null, 'NAMPOST', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19512, 0, 1, null, 19497, null, 'DW2', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19513, 0, 1, null, 19497, null, 'T_CLOCK', 1, 0, 5, '', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19514, 0, 1, null, 19497, null, 'SENDER', 1, 0, 3, '', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19515, 0, 1, null, 19497, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKEXCH_POST
CALL FIELDSINFO_IMPORT(19517, 0, 1, null, 19516, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19518, 0, 1, null, 19516, null, 'PACKETNUMBER', 1, 0, 20, 'Номер пакета', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19519, 0, 1, null, 19516, null, 'GETDATE', 6, 0, 0, 'Дата получения', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19520, 0, 1, null, 19516, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19521, 0, 1, null, 19516, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19522, 0, 1, null, 19516, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19523, 0, 1, null, 19516, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19524, 0, 1, null, 19516, null, 'DO_', 6, 0, 0, 'DO', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19525, 0, 1, null, 19516, null, 'TO_', 1, 0, 5, 'TO', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19526, 0, 1, null, 19516, null, 'NAMPOST', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19527, 0, 1, null, 19516, null, 'SUM_', 6, 0, 0, 'SUM', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19528, 0, 1, null, 19516, null, 'COUNT_', 3, 0, 0, 'COUNT', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19529, 0, 1, null, 19516, null, 'SUM_P', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19530, 0, 1, null, 19516, null, 'COUNT_P', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19531, 0, 1, null, 19516, null, 'ZSUM', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19532, 0, 1, null, 19516, null, 'ZCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19533, 0, 1, null, 19516, null, 'SENDER', 1, 0, 3, '', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19534, 0, 1, null, 19516, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKEXCH_QUERY
CALL FIELDSINFO_IMPORT(19536, 0, 1, null, 19535, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19537, 0, 1, null, 19535, null, 'PACKETNUMBER', 1, 0, 20, 'Номер пакета', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19538, 0, 1, null, 19535, null, 'GETDATE', 6, 0, 0, 'Дата получения', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19539, 0, 1, null, 19535, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19540, 0, 1, null, 19535, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19541, 0, 1, null, 19535, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19542, 0, 1, null, 19535, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19543, 0, 1, null, 19535, null, 'COD_QU', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19544, 0, 1, null, 19535, null, 'DD', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19545, 0, 1, null, 19535, null, 'DV', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19546, 0, 1, null, 19535, null, 'ND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19547, 0, 1, null, 19535, null, 'SUM_', 6, 0, 0, 'SUM', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19548, 0, 1, null, 19535, null, 'ELNUM', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19549, 0, 1, null, 19535, null, 'MFA', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19550, 0, 1, null, 19535, null, 'LSKL', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19551, 0, 1, null, 19535, null, 'MFB', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19552, 0, 1, null, 19535, null, 'LSKOR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19553, 0, 1, null, 19535, null, 'SENDER', 1, 0, 3, '', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19554, 0, 1, null, 19535, null, 'ELNUMREF', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19555, 0, 1, null, 19535, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKEXCH_CONFIRM
CALL FIELDSINFO_IMPORT(19557, 0, 1, null, 19556, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19558, 0, 1, null, 19556, null, 'PACKETNUMBER', 1, 0, 20, 'Номер пакета', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19559, 0, 1, null, 19556, null, 'GETDATE', 6, 0, 0, 'Дата получения', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19560, 0, 1, null, 19556, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19561, 0, 1, null, 19556, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19562, 0, 1, null, 19556, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19563, 0, 1, null, 19556, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19564, 0, 1, null, 19556, null, 'DVV', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19565, 0, 1, null, 19556, null, 'DD', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19566, 0, 1, null, 19556, null, 'ND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19567, 0, 1, null, 19556, null, 'DAV', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19568, 0, 1, null, 19556, null, 'PRNUM', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19569, 0, 1, null, 19556, null, 'ELNUM', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19570, 0, 1, null, 19556, null, 'VO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19571, 0, 1, null, 19556, null, 'MFKB', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19572, 0, 1, null, 19556, null, 'LSKL', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19573, 0, 1, null, 19556, null, 'MF', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19574, 0, 1, null, 19556, null, 'LSKOR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19575, 0, 1, null, 19556, null, 'SU', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19576, 0, 1, null, 19556, null, 'KRKB', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19577, 0, 1, null, 19556, null, 'KR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19578, 0, 1, null, 19556, null, 'SS', 1, 0, 4, '', '', 4, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19579, 0, 1, null, 19556, null, 'EXTENSION', 1, 0, 160, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19580, 0, 1, null, 19556, null, 'SENDER', 1, 0, 3, '', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19581, 0, 1, null, 19556, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKEXCH_QUEUE
CALL FIELDSINFO_IMPORT(19583, 0, 1, null, 19582, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19584, 0, 1, null, 19582, null, 'PACKETNUMBER', 1, 0, 20, 'Номер пакета', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19585, 0, 1, null, 19582, null, 'GETDATE', 6, 0, 0, 'Дата получения', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19586, 0, 1, null, 19582, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19587, 0, 1, null, 19582, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19588, 0, 1, null, 19582, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19589, 0, 1, null, 19582, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19590, 0, 1, null, 19582, null, 'DVV', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19591, 0, 1, null, 19582, null, 'DD', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19592, 0, 1, null, 19582, null, 'DV', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19593, 0, 1, null, 19582, null, 'DAV', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19594, 0, 1, null, 19582, null, 'ND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19595, 0, 1, null, 19582, null, 'DK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19596, 0, 1, null, 19582, null, 'ELNUM', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19597, 0, 1, null, 19582, null, 'VO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19598, 0, 1, null, 19582, null, 'MFKB', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19599, 0, 1, null, 19582, null, 'LSKL', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19600, 0, 1, null, 19582, null, 'KRKB', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19601, 0, 1, null, 19582, null, 'MF', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19602, 0, 1, null, 19582, null, 'LSKOR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19603, 0, 1, null, 19582, null, 'KR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19604, 0, 1, null, 19582, null, 'SU', 6, 0, 0, '', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19605, 0, 1, null, 19582, null, 'T_EVENT', 1, 0, 5, '', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19606, 0, 1, null, 19582, null, 'SENDER', 1, 0, 3, '', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19607, 0, 1, null, 19582, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19608, 0, 1, null, 19582, null, 'APRIOR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UFK_VP
CALL FIELDSINFO_IMPORT(19610, 0, 1, null, 19609, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19611, 0, 1, null, 19609, null, 'PACKETNUMBER', 1, 0, 20, 'Номер пакета', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19612, 0, 1, null, 19609, null, 'GETDATE', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19613, 0, 1, null, 19609, null, 'DATE_PROV', 6, 0, 0, 'Дата принятия', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19614, 0, 1, null, 19609, null, 'SCHET', 1, 0, 20, 'Л.с. в ФК', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19615, 0, 1, null, 19609, null, 'NUM', 6, 0, 0, 'Номер документа', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19616, 0, 1, null, 19609, null, 'DAT_DOC', 6, 0, 0, 'Дата документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19617, 0, 1, null, 19609, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19618, 0, 1, null, 19609, null, 'TIP_OPER', 3, 0, 0, 'Операция', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19619, 0, 1, null, 19609, null, 'TIP_DOC', 3, 0, 0, 'Признак документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19620, 0, 1, null, 19609, null, 'GL', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19621, 0, 1, null, 19609, null, 'PODRAZDEL', 3, 0, 0, 'КФСР', '', 11, '99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19622, 0, 1, null, 19609, null, 'VIDRASHOD', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19623, 0, 1, null, 19609, null, 'CELST', 3, 0, 0, 'КЦСР', '', 11, '9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19624, 0, 1, null, 19609, null, 'KL_NUM', 3, 0, 0, 'КЭСР', '', 11, '9.9.99.9.9', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19625, 0, 1, null, 19609, null, 'NAZNACH', 1, 0, 255, 'Назначение платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19626, 0, 1, null, 19609, null, 'SENDER', 1, 0, 3, 'Отправитель', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19627, 0, 1, null, 19609, null, 'PROCESSING', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19628, 0, 1, null, 19609, null, 'AUTOPROCESSING', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19629, 0, 1, null, 19609, null, 'REGIONCODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19630, 0, 1, null, 19609, null, 'PROCNOTE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19631, 0, 1, null, 19609, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19632, 0, 1, null, 19609, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19633, 0, 1, null, 19609, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19634, 0, 1, null, 19609, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19635, 0, 1, null, 19609, null, 'REGION_CLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19636, 0, 1, null, 19609, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19637, 0, 1, null, 19609, null, 'LASTPACKET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19638, 0, 1, null, 19609, null, 'ANUMBER', 3, 0, 0, 'Номер документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UFK_RM
CALL FIELDSINFO_IMPORT(19640, 0, 1, null, 19639, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19641, 0, 1, null, 19639, null, 'PACKETNUMBER', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19642, 0, 1, null, 19639, null, 'GETDATE', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19643, 0, 1, null, 19639, null, 'PROCESSING', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19644, 0, 1, null, 19639, null, 'AUTOPROCESSING', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19645, 0, 1, null, 19639, null, 'PROCNOTE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19646, 0, 1, null, 19639, null, 'DAT_DOC', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19647, 0, 1, null, 19639, null, 'SCHET', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19648, 0, 1, null, 19639, null, 'VH_OST', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19649, 0, 1, null, 19639, null, 'OBD', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19650, 0, 1, null, 19639, null, 'OBK', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19651, 0, 1, null, 19639, null, 'ISH_SALD', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19652, 0, 1, null, 19639, null, 'SENDER', 1, 0, 3, '', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19653, 0, 1, null, 19639, null, 'REGIONCODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19654, 0, 1, null, 19639, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19655, 0, 1, null, 19639, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19656, 0, 1, null, 19639, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19657, 0, 1, null, 19639, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19658, 0, 1, null, 19639, null, 'REGION_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19659, 0, 1, null, 19639, null, 'LASTPACKET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19660, 0, 1, null, 19639, null, 'ANUMBER', 3, 0, 0, 'Номер документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UFK_SVOD
CALL FIELDSINFO_IMPORT(19662, 0, 1, null, 19661, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19663, 0, 1, null, 19661, null, 'PACKETNUMBER', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19664, 0, 1, null, 19661, null, 'GETDATE', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19665, 0, 1, null, 19661, null, 'PROCESSING', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19666, 0, 1, null, 19661, null, 'AUTOPROCESSING', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19667, 0, 1, null, 19661, null, 'PROCNOTE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19668, 0, 1, null, 19661, null, 'PRIZ', 3, 0, 0, 'Признак счета', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19669, 0, 1, null, 19661, null, 'DATA', 6, 0, 0, 'Отчетная дата', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19670, 0, 1, null, 19661, null, 'NOM', 3, 0, 0, 'Код района', '', 11, '', '00', '00', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19671, 0, 1, null, 19661, null, 'NUM', 1, 0, 20, 'Код дохода', '', 20, '999.9.99.99.999.99.9999.9.9.9;0;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19672, 0, 1, null, 19661, null, 'QQ1', 6, 0, 0, 'В федеральный бюджет', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19673, 0, 1, null, 19661, null, 'QQ2', 6, 0, 0, 'В областной бюджет', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19674, 0, 1, null, 19661, null, 'QQ3', 6, 0, 0, 'В городской бюджет', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19675, 0, 1, null, 19661, null, 'QQ4', 6, 0, 0, 'В районный бюджет', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19676, 0, 1, null, 19661, null, 'QQS', 6, 0, 0, 'Сумма бюджетов', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19677, 0, 1, null, 19661, null, 'SENDER', 1, 0, 3, 'Отправитель', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19678, 0, 1, null, 19661, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19679, 0, 1, null, 19661, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19680, 0, 1, null, 19661, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19681, 0, 1, null, 19661, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19682, 0, 1, null, 19661, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '9999999999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19683, 0, 1, null, 19661, null, 'OKATO', 3, 0, 0, 'ОКАТО', '', 11, '99.999.999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BNKINPUTDOC_JOURNAL
CALL FIELDSINFO_IMPORT(19685, 0, 1, null, 19684, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19686, 0, 1, null, 19684, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19687, 0, 1, null, 19684, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BNKOUTPUTDOC_JOURNAL
CALL FIELDSINFO_IMPORT(19689, 0, 1, null, 19688, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19690, 0, 1, null, 19688, null, 'STATUS', 3, 0, 0, 'Статус', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19691, 0, 1, null, 19688, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19692, 0, 1, null, 19688, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19693, 0, 1, null, 19688, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19694, 0, 1, null, 19688, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BNK_DSIGNDOCUMENTS
CALL FIELDSINFO_IMPORT(19696, 0, 1, null, 19695, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19697, 0, 1, null, 19695, null, 'PACKETNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 19684, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19698, 0, 1, null, 19695, null, 'DOCUMENTID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19699, 0, 1, null, 19695, null, 'DOCSTATUS', 3, 0, 0, 'Обработка', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19700, 0, 1, null, 19695, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19701, 0, 1, null, 19695, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19702, 0, 1, null, 19695, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19703, 0, 1, null, 19695, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19704, 0, 1, null, 19695, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REESTRTYPE
CALL FIELDSINFO_IMPORT(19706, 0, 1, null, 19705, null, 'ID', 3, 0, 0, 'Код', '', 11, '9.99.9', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19707, 0, 1, null, 19705, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19708, 0, 1, null, 19705, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19709, 0, 1, null, 19705, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19710, 0, 1, null, 19705, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19711, 0, 1, null, 19705, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19712, 0, 1, null, 19705, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19713, 0, 1, null, 19705, null, 'TREASUARYITFLIST', 1, 0, 255, 'Список интерфейсов', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- OKDP
CALL FIELDSINFO_IMPORT(19715, 0, 1, null, 19714, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '99.9.9.99.9', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19716, 0, 1, null, 19714, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19717, 0, 1, null, 19714, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19718, 0, 1, null, 19714, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19719, 0, 1, null, 19714, null, 'CODE4', 3, 0, 0, 'Раздел 4', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19720, 0, 1, null, 19714, null, 'CODE5', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19721, 0, 1, null, 19714, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19724, 0, 1, null, 19714, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19725, 0, 1, null, 19714, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19728, 0, 1, null, 19714, null, 'MEASUREMENTCLS', 3, 0, 0, '', '', 11, '999', '', '', 0, 0, null, 1, 20727, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24921, 0, 1, null, 19714, null, 'CODE6', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24922, 0, 1, null, 19714, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24923, 0, 1, null, 19714, null, 'HASCHILDS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24924, 0, 1, null, 19714, null, 'SOURCECODE', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24925, 0, 1, null, 19714, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REMOTEDOCUMENT
CALL FIELDSINFO_IMPORT(19730, 0, 1, null, 19729, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19731, 0, 1, null, 19729, null, 'NAME', 1, 0, 50, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19732, 0, 1, null, 19729, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19733, 0, 1, null, 19729, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19734, 0, 1, null, 19729, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19735, 0, 1, null, 19729, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- EXECUTIONDOCUMENTSCAPTION
CALL FIELDSINFO_IMPORT(19737, 0, 1, null, 19736, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19738, 0, 1, null, 19736, null, 'DOCTYPE', 3, 0, 0, 'Тип документа исполнения', 'Тип документа исполнения получателя', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19739, 0, 1, null, 19736, null, 'DOCNUMBER', 1, 0, 50, 'Номер документа исполнения', 'Номер документа исполнения получателя', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19740, 0, 1, null, 19736, null, 'DOCUMENTDATE', 6, 0, 0, 'Дата документа исполнения', 'Дата документа исполнения получателя', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19741, 0, 1, null, 19736, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19742, 0, 1, null, 19736, null, 'SUPPLIERACC_REF', 3, 0, 0, 'Счет поставщика', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19744, 0, 1, null, 19736, null, 'SUMMA', 6, 0, 0, 'Сумма документа исполнения', 'Сумма документа исполнения получателя', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19745, 0, 1, null, 19736, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19746, 0, 1, null, 19736, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19747, 0, 1, null, 19736, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19748, 0, 1, null, 19736, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19749, 0, 1, null, 19736, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19752, 0, 1, null, 19736, null, 'STEPNUMBER', 3, 0, 0, 'Номер этапа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19753, 0, 1, null, 19736, null, 'REGISTRATIONTYPE', 3, 0, 0, 'Вид учета', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19754, 0, 1, null, 19736, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет получателя', '', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19755, 0, 1, null, 19736, null, 'RECIPIENT_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19756, 0, 1, null, 19736, null, 'REESTRNUMBER', 1, 0, 20, 'Реестровый номер документа исполнения', 'Реестровый номер документа исполнения получателя', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19757, 0, 1, null, 19736, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19758, 0, 1, null, 19736, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19759, 0, 1, null, 19736, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19760, 0, 1, null, 19736, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19761, 0, 1, null, 19736, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19762, 0, 1, null, 19736, null, 'NOTE', 1, 0, 1024, 'Примечание документа исполнения', 'Примечание документа исполнения получателя', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19763, 0, 1, null, 19736, null, 'REVIEWNOTE', 1, 0, 255, 'Результаты рассмотрения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19764, 0, 1, null, 19736, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19765, 0, 1, null, 19736, null, 'AGREEMENTINNERNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19766, 0, 1, null, 19736, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19767, 0, 1, null, 19736, null, 'EXECDOCFINSUMMA', 6, 0, 0, 'Оплачено', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19769, 0, 1, null, 19736, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26611, 0, 1, null, 19736, null, 'ACCEPTED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26612, 0, 1, null, 19736, null, 'ADJUSTMENTNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26613, 0, 1, null, 19736, null, 'ADJUSTMENTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19736, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26614, 0, 1, null, 19736, null, 'INNERNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26615, 0, 1, null, 19736, null, 'LASTACCEPTED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26616, 0, 1, null, 19736, null, 'LASTADJUSTMENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29912, 0, 1, null, 19736, null, 'AGREEMENTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19795, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25507, 0, 1, null, 19736, null, 'REALID', 1, 0, 127, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25508, 0, 1, null, 19736, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25509, 0, 1, null, 19736, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DEPARTMENTCLS
CALL FIELDSINFO_IMPORT(19787, 0, 1, null, 19786, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19788, 0, 1, null, 19786, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19789, 0, 1, null, 19786, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19790, 0, 1, null, 19786, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19791, 0, 1, null, 19786, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19792, 0, 1, null, 19786, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19793, 0, 1, null, 19786, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19794, 0, 1, null, 19786, null, 'USER_REF', 3, 0, 0, 'Руководитель', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- AGREEMENTS
CALL FIELDSINFO_IMPORT(29903, 0, 1, null, 19795, null, 'INFONUMBER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19796, 0, 1, null, 19795, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19797, 0, 1, null, 19795, null, 'SUMMA', 6, 0, 0, 'Сумма договора(№ бюдж. обязат-ва плательщика)', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19798, 0, 1, null, 19795, null, 'DOCNUMBER', 1, 0, 50, 'Номер контракта', 'Номер контракта получателя', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19799, 0, 1, null, 19795, null, 'AGREEMENTDATE', 6, 0, 0, 'Дата контракта', 'Дата контракта получателя', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19800, 0, 1, null, 19795, null, 'AGREEMENTENDDATE', 6, 0, 0, 'Дата завершения договора', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19801, 0, 1, null, 19795, null, 'EXECUTER_REF', 3, 0, 0, 'Исполнитель', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19802, 0, 1, null, 19795, null, 'CLIENT_REF', 3, 0, 0, 'Заказчик', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19803, 0, 1, null, 19795, null, 'FACIALACC_CLS', 3, 0, 0, 'Л/c заказчика', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19804, 0, 1, null, 19795, null, 'AGREEMENTTYPE', 3, 0, 0, 'Тип соглашения', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19805, 0, 1, null, 19795, null, 'ACCEPTED', 3, 0, 0, 'Принят/отклонен', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19806, 0, 1, null, 19795, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия/отклонения', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19807, 0, 1, null, 19795, null, 'CARDADVANCEPERCENT', 6, 0, 0, 'Процент аванса', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19808, 0, 1, null, 19795, null, 'CARDADVANCE', 6, 0, 0, 'Аванс', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19809, 0, 1, null, 19795, null, 'CLOSEDOC', 3, 0, 0, 'Документ закрытия', '', 11, '', '', '', 0, 0, null, 0, 19736, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19810, 0, 1, null, 19795, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19811, 0, 1, null, 19795, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19812, 0, 1, null, 19795, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19813, 0, 1, null, 19795, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19814, 0, 1, null, 19795, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19816, 0, 1, null, 19795, null, 'ADJUSTMENTNUMBER', 3, 0, 0, 'Порядковый номер уточнения', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19817, 0, 1, null, 19795, null, 'ADJUSTMENTDOCNUMBER', 1, 0, 50, 'Номер уточняемого договора', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19819, 0, 1, null, 19795, null, 'LASTADJUSTMENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19820, 0, 1, null, 19795, null, 'LASTACCEPTED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19821, 0, 1, null, 19795, null, 'NOTE', 1, 0, 1024, 'Примечание контракта', 'Примечание контракта получателя', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19822, 0, 1, null, 19795, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19823, 0, 1, null, 19795, null, 'REGION', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19824, 0, 1, null, 19795, null, 'CLOSEDATE', 6, 0, 0, 'Дата закрытия', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19825, 0, 1, null, 19795, null, 'DELIVERYRULES', 1, 0, 255, 'Метод авансировнаия', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19826, 0, 1, null, 19795, null, 'AGREEMENTSUMMA', 6, 0, 0, 'Сумма договора', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19827, 0, 1, null, 19795, null, 'AGREEMENTFINSUMMA', 6, 0, 0, 'Профинансировано', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19828, 0, 1, null, 19795, null, 'ADJUSTMENTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19795, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19829, 0, 1, null, 19795, null, 'OLDDOCNUMBER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19830, 0, 1, null, 19795, null, 'REESTRNUMBER', 1, 0, 20, 'Реестровый номер контракта', 'Реестровый номер контракта получателя', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19831, 0, 1, null, 19795, null, 'PAYMENTDATE', 6, 0, 0, 'Дата оплаты', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19832, 0, 1, null, 19795, null, 'AGREEMENTCARDADVANCE', 6, 0, 0, 'Аванс', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19833, 0, 1, null, 19795, null, 'FINCARDADVANCE', 6, 0, 0, 'Оплаченный аванс', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19834, 0, 1, null, 19795, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19835, 0, 1, null, 19795, null, 'STATEORDERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19795, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19836, 0, 1, null, 19795, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19837, 0, 1, null, 19795, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19838, 0, 1, null, 19795, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19839, 0, 1, null, 19795, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19840, 0, 1, null, 19795, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19841, 0, 1, null, 19795, null, 'AGREEMENTBEGINDATE', 6, 0, 0, 'Дата начала', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19842, 0, 1, null, 19795, null, 'INNERNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19843, 0, 1, null, 19795, null, 'PROTOCOLNUMBER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19844, 0, 1, null, 19795, null, 'PROTOCOLDATE', 6, 0, 0, '', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19845, 0, 1, null, 19795, null, 'REVIEWNOTE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19846, 0, 1, null, 19795, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19847, 0, 1, null, 19795, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19848, 0, 1, null, 19795, null, 'EXPORTDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19849, 0, 1, null, 19795, null, 'PURPORTDOC', 1, 0, 1024, 'Содержание договора(№ бюдж. обязат-ва плательщика)', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19850, 0, 1, null, 19795, null, 'FSORGAN', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19851, 0, 1, null, 19795, null, 'FSBUDGETNAME', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19852, 0, 1, null, 19795, null, 'FSOFFBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19853, 0, 1, null, 19795, null, 'RNCLIENTID', 1, 0, 11, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19854, 0, 1, null, 19795, null, 'RNYEAR', 3, 0, 0, '', '', 3, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19855, 0, 1, null, 19795, null, 'RNNUMBER', 3, 0, 0, '', '', 7, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19856, 0, 1, null, 19795, null, 'RNDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19857, 0, 1, null, 19795, null, 'PROTOCOLNOTICE', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19858, 0, 1, null, 19795, null, 'PROTOCOLRESULTDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19859, 0, 1, null, 19795, null, 'PROTOCOLDOCTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23082, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19860, 0, 1, null, 19795, null, 'PROTOCOLSALETYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19861, 0, 1, null, 19795, null, 'NOTIFYDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19863, 0, 1, null, 19795, null, 'EXECUTERACCREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19864, 0, 1, null, 19795, null, 'DOCBASEDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19865, 0, 1, null, 19795, null, 'DOCBASENOTIFYDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19866, 0, 1, null, 19795, null, 'DOCBASETEXT', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19867, 0, 1, null, 19795, null, 'DOCBASETYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19868, 0, 1, null, 19795, null, 'DOCBASESUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19869, 0, 1, null, 19795, null, 'UNKNOWNAMOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19870, 0, 1, null, 19795, null, 'PROTOCOLREASON', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23083, 0, 0, 0, '', 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24606, 0, 1, null, 19795, null, 'CLIENT_INN', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24607, 0, 1, null, 19795, null, 'CLIENT_INN20', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24608, 0, 1, null, 19795, null, 'CLIENT_NAME', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24609, 0, 1, null, 19795, null, 'EXECUTER_ADDRESS', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24610, 0, 1, null, 19795, null, 'EXECUTER_COUNTRY', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24611, 0, 1, null, 19795, null, 'EXECUTER_INN', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24612, 0, 1, null, 19795, null, 'EXECUTER_INN20', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24613, 0, 1, null, 19795, null, 'EXECUTER_NAME', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24614, 0, 1, null, 19795, null, 'EXECUTER_PHONE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24615, 0, 1, null, 19795, null, 'EXECUTER_STATUS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24616, 0, 1, null, 19795, null, 'LOTMAXSUM', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24617, 0, 1, null, 19795, null, 'REALID', 1, 0, 127, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24618, 0, 1, null, 19795, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24619, 0, 1, null, 19795, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26539, 0, 1, null, 19795, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 7, '', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26540, 0, 1, null, 19795, null, 'REESTRVERSION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29904, 0, 1, null, 19795, null, 'STATEORDERINNERNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- UFK_LOGCAPTION
CALL FIELDSINFO_IMPORT(19877, 0, 1, null, 19876, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19878, 0, 1, null, 19876, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19879, 0, 1, null, 19876, null, 'ERRORCLS', 3, 0, 0, 'Ошибка', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17034, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19880, 0, 1, null, 19876, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19881, 0, 1, null, 19876, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19882, 0, 1, null, 19876, null, 'IMPORTDATE', 6, 0, 0, 'Дата импорта', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19883, 0, 1, null, 19876, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19884, 0, 1, null, 19876, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19885, 0, 1, null, 19876, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19886, 0, 1, null, 19876, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19887, 0, 1, null, 19876, null, 'OPERDATE', 6, 0, 0, 'Дата опер. дня', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19888, 0, 1, null, 19876, null, 'IMPORTNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19889, 0, 1, null, 19876, null, 'DELETEFLAG', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19890, 0, 1, null, 19876, null, 'IMPORTEDCOUNT', 3, 0, 0, 'Кол-во имп. записей', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UFK_LOGDETAIL
CALL FIELDSINFO_IMPORT(19892, 0, 1, null, 19891, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19893, 0, 1, null, 19891, null, 'DESTRECORDINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19894, 0, 1, null, 19891, null, 'SOURCEFIRSTRECORDINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19895, 0, 1, null, 19891, null, 'SOURCESECONDRECORDINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19896, 0, 1, null, 19891, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19897, 0, 1, null, 19891, null, 'ERRORCLS', 3, 0, 0, '', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17034, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19898, 0, 1, null, 19891, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19899, 0, 1, null, 19891, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19900, 0, 1, null, 19891, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19901, 0, 1, null, 19891, null, 'IMPORTDATE', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19902, 0, 1, null, 19891, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19903, 0, 1, null, 19891, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19904, 0, 1, null, 19891, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19905, 0, 1, null, 19891, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19906, 0, 1, null, 19891, null, 'PACKETNUMBER', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19907, 0, 1, null, 19891, null, 'GETDATE', 6, 0, 0, '', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19908, 0, 1, null, 19891, null, 'ANUMBER', 3, 0, 0, 'Номер документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INCCURRENCY
CALL FIELDSINFO_IMPORT(19910, 0, 1, null, 19909, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19911, 0, 1, null, 19909, null, 'CURRENCYSUM', 6, 0, 0, 'Сумма в валюте', '', 13, '', ',0.00####', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19912, 0, 1, null, 19909, null, 'EXCHANGE', 6, 0, 0, 'Тек.обменный курс', '', 13, '', '0.0000####', '0.0000####', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19913, 0, 1, null, 19909, null, 'DELTA', 6, 0, 0, 'Изменение курса', '', 13, '', '0.0000####', '0.0000####', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- KDSHIFR
CALL FIELDSINFO_IMPORT(19981, 0, 1, null, 19980, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19982, 0, 1, null, 19980, null, 'SHIFR', 1, 0, 4, 'Шифр', '', 4, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19983, 0, 1, null, 19980, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19984, 0, 1, null, 19980, null, 'SECTIONNAME', 1, 0, 50, 'Вид доходов', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19985, 0, 1, null, 19980, null, 'ROWLEVEL', 3, 0, 0, 'Уровень', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19986, 0, 1, null, 19980, null, 'TEMPLATENAME', 1, 0, 255, 'Имя шаблона', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19987, 0, 1, null, 19980, null, 'LAYER', 3, 0, 0, 'Слой', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- OLDINCOMES
CALL FIELDSINFO_IMPORT(19989, 0, 1, null, 19988, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19990, 0, 1, null, 19988, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19991, 0, 1, null, 19988, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19992, 0, 1, null, 19988, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19993, 0, 1, null, 19988, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- KDSHIFRDETAIL
CALL FIELDSINFO_IMPORT(19995, 0, 1, null, 19994, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19996, 0, 1, null, 19994, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19997, 0, 1, null, 19994, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '9.99.99.99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19998, 0, 1, null, 19994, null, 'USEOLD', 3, 0, 0, 'Для прошлого года', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(19999, 0, 1, null, 19994, null, 'USENEW', 3, 0, 0, 'Для текущего года', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20000, 0, 1, null, 19994, null, 'KDEXT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20001, 0, 1, null, 19994, null, 'KDEXTMASK', 1, 0, 20, 'Маска кода дохода', '', 20, 'aaa.a.aa.aa.aaa.aa.aaaa.aaa;0;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REMOTECLIENT
CALL FIELDSINFO_IMPORT(20055, 0, 1, null, 20054, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20056, 0, 1, null, 20054, null, 'CLIENTID', 3, 0, 0, 'Код удаленного', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20057, 0, 1, null, 20054, null, 'PASS', 1, 0, 20, 'Пароль', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20058, 0, 1, null, 20054, null, 'ORGANIZATION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20059, 0, 1, null, 20054, null, 'CRYPTOID', 1, 0, 2000, 'Криптографический идентификатор', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20060, 0, 1, null, 20054, null, 'CLIENTVERSION', 1, 0, 20, 'Версия клиента', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20061, 0, 1, null, 20054, null, 'NOTE', 1, 0, 255, 'Наименование клиента УРМ', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20062, 0, 1, null, 20054, null, 'DATELASTSYNCHRO', 11, 0, 0, 'Дата посл. синхронизации', '', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20063, 0, 1, null, 20054, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20064, 0, 1, null, 20054, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20065, 0, 1, null, 20054, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20066, 0, 1, null, 20054, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20067, 0, 1, null, 20054, null, 'REMOTECLIENTTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 20638, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20068, 0, 1, null, 20054, null, 'USESIGN', 3, 0, 0, 'Использовать подпись', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20069, 0, 1, null, 20054, null, 'BLOCKLIST', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20070, 0, 1, null, 20054, null, 'LINKSPEED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24957, 0, 1, null, 20054, null, 'BSID', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24958, 0, 1, null, 20054, null, 'CERTEXPIRATIONDAYS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24959, 0, 1, null, 20054, null, 'CERTOWNERNAMES', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27627, 0, 1, null, 20054, null, 'PACKETBLOCKLIST', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27862, 0, 1, null, 20054, null, 'ALLOWEDCOPIES', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27863, 0, 1, null, 20054, null, 'ISEXECUTIONUSED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27864, 0, 1, null, 20054, null, 'USEDCOPIES', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31712, 0, 1, null, 20054, null, 'CERTEXPIRATIONDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- CBPERCENTJOURNAL
CALL FIELDSINFO_IMPORT(20072, 0, 1, null, 20071, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20073, 0, 1, null, 20071, null, 'PROGINDEX', 3, 0, 0, 'Прогиндекс, для Журнала процентов ЦБ равен 119', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20074, 0, 1, null, 20071, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20075, 0, 1, null, 20071, null, 'PERCENT', 6, 0, 0, 'Процент', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20076, 0, 1, null, 20071, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20077, 0, 1, null, 20071, null, 'ISLAST', 3, 0, 0, 'Указатель, последняя это запись или нет ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20078, 0, 1, null, 20071, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20079, 0, 1, null, 20071, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20080, 0, 1, null, 20071, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20081, 0, 1, null, 20071, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- AGREEMENTSTEPS
CALL FIELDSINFO_IMPORT(24620, 0, 1, null, 20107, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24621, 0, 1, null, 20107, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20108, 0, 1, null, 20107, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20109, 0, 1, null, 20107, null, 'ANUMBER', 3, 0, 0, 'Номер этапа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20110, 0, 1, null, 20107, null, 'BEGINSTEPDATE', 6, 0, 0, 'Дата начала', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20111, 0, 1, null, 20107, null, 'ENDSTEPDATE', 6, 0, 0, 'Дата окончания', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20112, 0, 1, null, 20107, null, 'SUMMA', 6, 0, 0, 'Сумма на год', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20113, 0, 1, null, 20107, null, 'NOTE', 1, 0, 255, 'Описание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20114, 0, 1, null, 20107, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20115, 0, 1, null, 20107, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20116, 0, 1, null, 20107, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20117, 0, 1, null, 20107, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20118, 0, 1, null, 20107, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20119, 0, 1, null, 20107, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20120, 0, 1, null, 20107, null, 'CLOSEDOC', 3, 0, 0, 'Документ закрытия', '', 11, '', '', '', 0, 0, null, 0, 19736, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20121, 0, 1, null, 20107, null, 'STEPSUMMA', 6, 0, 0, 'Сумма этапа', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20122, 0, 1, null, 20107, null, 'STEPFINSUMMA', 6, 0, 0, 'Профинансировано', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20123, 0, 1, null, 20107, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20124, 0, 1, null, 20107, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20125, 0, 1, null, 20107, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 19795, 1, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20126, 0, 1, null, 20107, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ESTIMATE
CALL FIELDSINFO_IMPORT(20128, 0, 1, null, 20127, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20129, 0, 1, null, 20127, null, 'OBJECT', 3, 0, 0, 'Предмет госконтракта', '', 11, '99.9.9.99.9', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20130, 0, 1, null, 20127, null, 'AMOUNT', 6, 0, 0, 'Количество', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20131, 0, 1, null, 20127, null, 'PRICE', 6, 0, 0, 'Цена за еденицу', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20132, 0, 1, null, 20127, null, 'COST', 6, 0, 0, 'Стоимость без налогов', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20133, 0, 1, null, 20127, null, 'VATPERCENT', 6, 0, 0, 'Ставка НДС', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20134, 0, 1, null, 20127, null, 'VATSUMMA', 6, 0, 0, 'Сумма НДС', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20135, 0, 1, null, 20127, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20136, 0, 1, null, 20127, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20137, 0, 1, null, 20127, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20138, 0, 1, null, 20127, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20139, 0, 1, null, 20127, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20140, 0, 1, null, 20127, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20141, 0, 1, null, 20127, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20142, 0, 1, null, 20127, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 19795, 1, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20143, 0, 1, null, 20127, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20144, 0, 1, null, 20127, null, 'CLOSEDATE', 6, 0, 0, 'Дата поставки ', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20145, 0, 1, null, 20127, null, 'PAYMENTDATE', 6, 0, 0, 'Дата оплаты ', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20146, 0, 1, null, 20127, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20147, 0, 1, null, 20127, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20148, 0, 1, null, 20127, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20149, 0, 1, null, 20127, null, 'PRODUCTCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20694, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20150, 0, 1, null, 20127, null, 'FINSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20151, 0, 1, null, 20127, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20152, 0, 1, null, 20127, null, 'PRICEVAT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24725, 0, 1, null, 20127, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24726, 0, 1, null, 20127, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- EXECUTIONDOCUMENTSDETAIL
CALL FIELDSINFO_IMPORT(20154, 0, 1, null, 20153, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20155, 0, 1, null, 20153, null, 'OBJECT', 3, 0, 0, 'Предмет договора', '', 11, '99.9.9.99.9', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20156, 0, 1, null, 20153, null, 'AMOUNT', 6, 0, 0, 'Количество', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20157, 0, 1, null, 20153, null, 'PRICE', 6, 0, 0, 'Цена за единицу', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20158, 0, 1, null, 20153, null, 'COST', 6, 0, 0, 'Общая стоимость', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20159, 0, 1, null, 20153, null, 'VATPERCENT', 6, 0, 0, '% НДС', '', 13, '', ',0.00####', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20160, 0, 1, null, 20153, null, 'VATSUMMA', 6, 0, 0, 'Сумма НДС', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20161, 0, 1, null, 20153, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20162, 0, 1, null, 20153, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20163, 0, 1, null, 20153, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20164, 0, 1, null, 20153, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20165, 0, 1, null, 20153, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20166, 0, 1, null, 20153, null, 'SUMMA', 6, 0, 0, 'Сумма с учетом налогов', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20167, 0, 1, null, 20153, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 19736, 1, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20168, 0, 1, null, 20153, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20169, 0, 1, null, 20153, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20170, 0, 1, null, 20153, null, 'PRODUCTCLS', 3, 0, 0, 'ИД продукции', '', 11, '', '', '', 0, 0, null, 1, 20694, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20171, 0, 1, null, 20153, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20172, 0, 1, null, 20153, null, 'PRICEVAT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24727, 0, 1, null, 20153, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24728, 0, 1, null, 20153, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LOANTYPE
CALL FIELDSINFO_IMPORT(20174, 0, 1, null, 20173, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20175, 0, 1, null, 20173, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20176, 0, 1, null, 20173, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20177, 0, 1, null, 20173, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20178, 0, 1, null, 20173, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20179, 0, 1, null, 20173, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20180, 0, 1, null, 20173, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20181, 0, 1, null, 20173, null, 'BUHACCOUNT', 3, 0, 0, 'Бухгалтерский счет', '', 11, '9999.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DEBTTYPE
CALL FIELDSINFO_IMPORT(20183, 0, 1, null, 20182, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20184, 0, 1, null, 20182, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20185, 0, 1, null, 20182, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20186, 0, 1, null, 20182, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20187, 0, 1, null, 20182, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20188, 0, 1, null, 20182, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20189, 0, 1, null, 20182, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20190, 0, 1, null, 20182, null, 'BUHACCOUNT', 3, 0, 0, 'Бухгалтерский счет', '', 11, '9999.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REMOTEINPUTRIGHT
CALL FIELDSINFO_IMPORT(20192, 0, 1, null, 20191, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20193, 0, 1, null, 20191, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20194, 0, 1, null, 20191, null, 'REMOTECLIENT', 3, 0, 0, 'Ссылка на мастер запись', '', 11, '', '', '', 0, 0, null, 1, 20054, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20195, 0, 1, null, 20191, null, 'REMOTEDOCUMENT', 3, 0, 0, 'Ссылка на документ', '', 11, '', '', '', 0, 0, null, 1, 19729, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20196, 0, 1, null, 20191, null, 'EXCLUDE', 3, 0, 0, 'Исключая', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20197, 0, 1, null, 20191, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20198, 0, 1, null, 20191, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20199, 0, 1, null, 20191, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20200, 0, 1, null, 20191, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REMOTEREADRIGHT
CALL FIELDSINFO_IMPORT(20202, 0, 1, null, 20201, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20203, 0, 1, null, 20201, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20204, 0, 1, null, 20201, null, 'REMOTECLIENT', 3, 0, 0, 'Ссылка на мастер запись', '', 11, '', '', '', 0, 0, null, 1, 20054, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20205, 0, 1, null, 20201, null, 'CLIENTID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20206, 0, 1, null, 20201, null, 'FACIALACCCLSUP', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20207, 0, 1, null, 20201, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20208, 0, 1, null, 20201, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20209, 0, 1, null, 20201, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20210, 0, 1, null, 20201, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REMOTECLIENTACCOUNT
CALL FIELDSINFO_IMPORT(20212, 0, 1, null, 20211, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20213, 0, 1, null, 20211, null, 'REMOTEDOCUMENT', 3, 0, 0, 'Ссылка на документ', '', 11, '', '', '', 0, 0, null, 1, 19729, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20214, 0, 1, null, 20211, null, 'REMOTECLIENT', 3, 0, 0, 'Ссылка на местер запись', '', 11, '', '', '', 0, 0, null, 1, 20054, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20215, 0, 1, null, 20211, null, 'DEFAULTACCOUNT', 3, 0, 0, 'Счет по умолчанию', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20216, 0, 1, null, 20211, null, 'ACCOUNT', 3, 0, 0, 'Ссылка на счет', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20217, 0, 1, null, 20211, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20218, 0, 1, null, 20211, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20219, 0, 1, null, 20211, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20220, 0, 1, null, 20211, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- PAYMENTSCHEDULE
CALL FIELDSINFO_IMPORT(20222, 0, 1, null, 20221, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20223, 0, 1, null, 20221, null, 'ANUMBER', 3, 0, 0, 'Номер обязательства', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20224, 0, 1, null, 20221, null, 'PARENTNUMBER', 3, 0, 0, 'Номер уточняемого обязательства', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20225, 0, 1, null, 20221, null, 'KFSR', 3, 0, 0, 'ФКР', '', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20226, 0, 1, null, 20221, null, 'KESR', 3, 0, 0, 'ЭКР', '', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20227, 0, 1, null, 20221, null, 'KVSR', 3, 0, 0, 'КВСР', '', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20228, 0, 1, null, 20221, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20229, 0, 1, null, 20221, null, 'KVR', 3, 0, 0, 'КВР', '', 7, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20230, 0, 1, null, 20221, null, 'MONTH01', 6, 0, 0, 'Январь', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20231, 0, 1, null, 20221, null, 'MONTH02', 6, 0, 0, 'Февраль', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20232, 0, 1, null, 20221, null, 'MONTH03', 6, 0, 0, 'Март', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20233, 0, 1, null, 20221, null, 'MONTH04', 6, 0, 0, 'Апрель', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20234, 0, 1, null, 20221, null, 'MONTH05', 6, 0, 0, 'Май', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20235, 0, 1, null, 20221, null, 'MONTH06', 6, 0, 0, 'Июнь', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20236, 0, 1, null, 20221, null, 'MONTH07', 6, 0, 0, 'Июль', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20237, 0, 1, null, 20221, null, 'MONTH08', 6, 0, 0, 'Август', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20238, 0, 1, null, 20221, null, 'MONTH09', 6, 0, 0, 'Сентябрь', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20239, 0, 1, null, 20221, null, 'MONTH10', 6, 0, 0, 'Октябрь', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20240, 0, 1, null, 20221, null, 'MONTH11', 6, 0, 0, 'Ноябрь', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20241, 0, 1, null, 20221, null, 'MONTH12', 6, 0, 0, 'Декабрь', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20242, 0, 1, null, 20221, null, 'SUMMA', 6, 0, 0, 'Сумма БО', 'Сумма бюджетного обязательства получателя', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20243, 0, 1, null, 20221, null, 'REGION', 3, 0, 0, 'Район', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20244, 0, 1, null, 20221, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 10, '999', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20245, 0, 1, null, 20221, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20246, 0, 1, null, 20221, null, 'FINSOURCE', 3, 0, 0, 'Источник финансирования', '', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20247, 0, 1, null, 20221, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20248, 0, 1, null, 20221, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20249, 0, 1, null, 20221, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20250, 0, 1, null, 20221, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20251, 0, 1, null, 20221, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20252, 0, 1, null, 20221, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20253, 0, 1, null, 20221, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20254, 0, 1, null, 20221, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20255, 0, 1, null, 20221, null, 'INNERPROMISENUM', 3, 0, 0, 'Внутренний номер бюджетного обязательства', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20256, 0, 1, null, 20221, null, 'ADJUSTMENTNUMBER', 3, 0, 0, 'Порядковый номер уточнения', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20257, 0, 1, null, 20221, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20258, 0, 1, null, 20221, null, 'LASTADJUSTMENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20259, 0, 1, null, 20221, null, 'ACCEPTED', 3, 0, 0, 'Принято/отклонено', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20260, 0, 1, null, 20221, null, 'LASTACCEPTED', 3, 0, 0, 'Зарезервировано', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20261, 0, 1, null, 20221, null, 'PROMISETYPE', 3, 0, 0, 'Вид обязательства', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20262, 0, 1, null, 20221, null, 'ADJUSTMENTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 20221, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20263, 0, 1, null, 20221, null, 'OLDNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20264, 0, 1, null, 20221, null, 'SUMMAPREVIOUSYEAR', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20265, 0, 1, null, 20221, null, 'SUMMAFINPREVIOUSYEAR', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20266, 0, 1, null, 20221, null, 'QUARTER1', 6, 0, 0, 'I квартал', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20267, 0, 1, null, 20221, null, 'QUARTER2', 6, 0, 0, 'II квартал', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20268, 0, 1, null, 20221, null, 'QUARTER3', 6, 0, 0, 'III квартал', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20269, 0, 1, null, 20221, null, 'QUARTER4', 6, 0, 0, 'IV квартал', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20270, 0, 1, null, 20221, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 20107, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20271, 0, 1, null, 20221, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20274, 0, 1, null, 20221, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20275, 0, 1, null, 20221, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20276, 0, 1, null, 20221, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20277, 0, 1, null, 20221, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20278, 0, 1, null, 20221, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20279, 0, 1, null, 20221, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бухгалтерская операция', '', 7, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20280, 0, 1, null, 20221, null, 'MONTH01DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20281, 0, 1, null, 20221, null, 'MONTH02DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20282, 0, 1, null, 20221, null, 'MONTH03DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20283, 0, 1, null, 20221, null, 'MONTH04DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20284, 0, 1, null, 20221, null, 'MONTH05DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20285, 0, 1, null, 20221, null, 'MONTH06DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20286, 0, 1, null, 20221, null, 'MONTH07DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20287, 0, 1, null, 20221, null, 'MONTH08DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20288, 0, 1, null, 20221, null, 'MONTH09DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20289, 0, 1, null, 20221, null, 'MONTH10DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20290, 0, 1, null, 20221, null, 'MONTH11DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20291, 0, 1, null, 20221, null, 'MONTH12DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20292, 0, 1, null, 20221, null, 'QUARTER1DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20293, 0, 1, null, 20221, null, 'QUARTER2DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20294, 0, 1, null, 20221, null, 'QUARTER3DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20295, 0, 1, null, 20221, null, 'QUARTER4DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20296, 0, 1, null, 20221, null, 'SUMMADELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20297, 0, 1, null, 20221, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20298, 0, 1, null, 20221, null, 'FINYEAR', 3, 0, 0, '', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20299, 0, 1, null, 20221, null, 'SUMMAYEAR1', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20300, 0, 1, null, 20221, null, 'SUMMAYEAR2', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20301, 0, 1, null, 20221, null, 'SUMMAYEAR3', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20302, 0, 1, null, 20221, null, 'SUMMAYEAR1DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20303, 0, 1, null, 20221, null, 'SUMMAYEAR2DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20304, 0, 1, null, 20221, null, 'SUMMAYEAR3DELTA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20305, 0, 1, null, 20221, null, 'ASSIGNMENTKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22976, 0, 0, 0, '', 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26639, 0, 1, null, 20221, null, 'EXECUTIONREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19736, 0, 0, 0, '', 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27623, 0, 1, null, 20221, null, 'AGREEMENTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19795, 0, 0, 0, '', 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27624, 0, 1, null, 20221, null, 'PROMISENUMBER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27625, 0, 1, null, 20221, null, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27846, 0, 1, null, 20221, null, 'BUDALLOCATIONCLS', 3, 0, 0, '', '', 9, '', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27847, 0, 1, null, 20221, null, 'PAYPROMISECLS', 3, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25476, 0, 1, null, 20221, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25477, 0, 1, null, 20221, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25478, 0, 1, null, 20221, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', '', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- OBJECTCAPTION
CALL FIELDSINFO_IMPORT(20345, 0, 1, null, 20344, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20346, 0, 1, null, 20344, null, 'GUID', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20347, 0, 1, null, 20344, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20348, 0, 1, null, 20344, null, 'CNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20349, 0, 1, null, 20344, null, 'INTERFACE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- OBJECTDETAIL
CALL FIELDSINFO_IMPORT(20351, 0, 1, null, 20350, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20352, 0, 1, null, 20350, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 20344, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20353, 0, 1, null, 20350, null, 'DETAILID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20354, 0, 1, null, 20350, null, 'MASTERFIELD', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20355, 0, 1, null, 20350, null, 'DETAILFIELD', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20356, 0, 1, null, 20350, null, 'ANUMBER', 3, 0, 0, 'Номер документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UFK_SVERKA
CALL FIELDSINFO_IMPORT(20388, 0, 1, null, 20387, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20389, 0, 1, null, 20387, null, 'DFACCOUNT', 3, 0, 0, 'Счет финоргана', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20390, 0, 1, null, 20387, null, 'DOCDATE', 6, 0, 0, 'Дата', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20391, 0, 1, null, 20387, null, 'DEBITBEFORE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20392, 0, 1, null, 20387, null, 'CREDITBEFORE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20393, 0, 1, null, 20387, null, 'DEBIT', 6, 0, 0, 'Обороты по дебету', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20394, 0, 1, null, 20387, null, 'CREDIT', 6, 0, 0, 'Обороты по кредиту', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20395, 0, 1, null, 20387, null, 'BUHACC', 3, 0, 0, 'Синтетический счет', '', 11, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20396, 0, 1, null, 20387, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20397, 0, 1, null, 20387, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20398, 0, 1, null, 20387, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20399, 0, 1, null, 20387, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BUDSTRUCT
CALL FIELDSINFO_IMPORT(20401, 0, 1, null, 20400, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20402, 0, 1, null, 20400, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20403, 0, 1, null, 20400, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20404, 0, 1, null, 20400, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20405, 0, 1, null, 20400, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20406, 0, 1, null, 20400, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20407, 0, 1, null, 20400, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '9.9.9', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20408, 0, 1, null, 20400, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20409, 0, 1, null, 20400, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20410, 0, 1, null, 20400, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20411, 0, 1, null, 20400, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20412, 0, 1, null, 20400, null, 'ACTUALDATE', 6, 0, 0, 'Актуально до', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20413, 0, 1, null, 20400, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20414, 0, 1, null, 20400, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20415, 0, 1, null, 20400, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20416, 0, 1, null, 20400, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20417, 0, 1, null, 20400, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25272, 0, 1, null, 20400, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30614, 0, 1, null, 20400, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', '', 11, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30707, 0, 1, null, 20400, null, 'ISLIMITSPEND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30708, 0, 1, null, 20400, null, 'STARTDATE', 6, 0, 0, 'Дата начала срока действия', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31636, 0, 1, null, 20400, null, 'BUDALLOCATIONCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31637, 0, 1, null, 20400, null, 'PAYPROMISECLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- OKATO
CALL FIELDSINFO_IMPORT(20419, 0, 1, null, 20418, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.999.999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20420, 0, 1, null, 20418, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20421, 0, 1, null, 20418, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20422, 0, 1, null, 20418, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20423, 0, 1, null, 20418, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20424, 0, 1, null, 20418, null, 'EXTENSION', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20425, 0, 1, null, 20418, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20426, 0, 1, null, 20418, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20427, 0, 1, null, 20418, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- TREASUARYDOCSTATE
CALL FIELDSINFO_IMPORT(20429, 0, 1, null, 20428, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20430, 0, 1, null, 20428, null, 'NAME', 1, 0, 1024, 'Состояние документа', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20431, 0, 1, null, 20428, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20432, 0, 1, null, 20428, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- COLLATERALTYPE
CALL FIELDSINFO_IMPORT(20434, 0, 1, null, 20433, null, 'ID', 3, 0, 0, 'Код', '', 11, '9.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20435, 0, 1, null, 20433, null, 'CODE1', 3, 0, 0, 'Раздел 1', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20436, 0, 1, null, 20433, null, 'CODE2', 3, 0, 0, 'Раздел 2', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20437, 0, 1, null, 20433, null, 'CODE3', 3, 0, 0, 'Раздел 3', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20438, 0, 1, null, 20433, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20439, 0, 1, null, 20433, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20440, 0, 1, null, 20433, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- CLIENTDFACCOUNTLIST
CALL FIELDSINFO_IMPORT(20442, 0, 1, null, 20441, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20443, 0, 1, null, 20441, null, 'ACC_REF', 3, 0, 0, 'Ссылка на счет', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20444, 0, 1, null, 20441, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20445, 0, 1, null, 20441, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20446, 0, 1, null, 20441, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20447, 0, 1, null, 20441, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20448, 0, 1, null, 20441, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PAPEROPERATION
CALL FIELDSINFO_IMPORT(20450, 0, 1, null, 20449, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20451, 0, 1, null, 20449, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20452, 0, 1, null, 20449, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20453, 0, 1, null, 20449, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20454, 0, 1, null, 20449, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20455, 0, 1, null, 20449, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20456, 0, 1, null, 20449, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20457, 0, 1, null, 20449, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20458, 0, 1, null, 20449, null, 'ACC_REF', 3, 0, 0, 'Ссылка на счет', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20459, 0, 1, null, 20449, null, 'ACCEPTORACC_REF', 3, 0, 0, 'Счет', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20460, 0, 1, null, 20449, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20461, 0, 1, null, 20449, null, 'BUHPAYMENTCLS', 3, 0, 0, 'Бух. операция', '', 11, '999', '', '', 0, 0, null, 1, 17069, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20462, 0, 1, null, 20449, null, 'DFACCOUNT', 3, 0, 0, 'Счет финоргана', '', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20463, 0, 1, null, 20449, null, 'DEBIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20464, 0, 1, null, 20449, null, 'CREDIT', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20465, 0, 1, null, 20449, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20466, 0, 1, null, 20449, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20467, 0, 1, null, 20449, null, 'DOCNUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20468, 0, 1, null, 20449, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20469, 0, 1, null, 20449, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20470, 0, 1, null, 20449, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бухгалтерская операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20471, 0, 1, null, 20449, null, 'IFS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20472, 0, 1, null, 20449, null, 'IFS_CORR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20473, 0, 1, null, 20449, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20474, 0, 1, null, 20449, null, 'CLSTYPE', 3, 0, 0, 'Тип классификации', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20475, 0, 1, null, 20449, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20476, 0, 1, null, 20449, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20477, 0, 1, null, 20449, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20478, 0, 1, null, 20449, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20479, 0, 1, null, 20449, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- COLLATERAL
CALL FIELDSINFO_IMPORT(20481, 0, 1, null, 20480, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20482, 0, 1, null, 20480, null, 'BUDGETREF', 3, 0, 0, 'Бюджет', '', 4, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20483, 0, 1, null, 20480, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20484, 0, 1, null, 20480, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20485, 0, 1, null, 20480, null, 'COLLATERALTYPE', 3, 0, 0, 'Тип обеспечения', '', 8, '9.99.99', '', '', 0, 0, null, 1, 20433, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20486, 0, 1, null, 20480, null, 'SUMMA', 6, 0, 0, 'Сумма обеспечения', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20487, 0, 1, null, 20480, null, 'NOMINALSUMMA', 6, 0, 0, 'Реальная стоимость', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20488, 0, 1, null, 20480, null, 'NAME', 1, 0, 255, 'Наименование обеспечения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20489, 0, 1, null, 20480, null, 'ORG_REF', 3, 0, 0, 'Организация', '', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20490, 0, 1, null, 20480, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20491, 0, 1, null, 20480, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20492, 0, 1, null, 20480, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20493, 0, 1, null, 20480, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20494, 0, 1, null, 20480, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20495, 0, 1, null, 20480, null, 'CURRENCYSUMMA', 6, 0, 0, 'Сумма в валюте', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20496, 0, 1, null, 20480, null, 'CURRENCYCLS', 3, 0, 0, 'Код валюты', '', 4, '999', '', '', 0, 0, null, 1, 16937, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- MANAGERBID
CALL FIELDSINFO_IMPORT(20498, 0, 1, null, 20497, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20499, 0, 1, null, 20497, null, 'MANAGERFACIALACCCLS', 3, 0, 0, 'Лицевой счет локального реестра', 'Лицевой счет локального реестра документа пришедшего из УРМ', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20500, 0, 1, null, 20497, null, 'ARHIVEDOC', 3, 0, 0, 'Архивный', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20501, 0, 1, null, 20497, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20502, 0, 1, null, 20497, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20503, 0, 1, null, 20497, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20504, 0, 1, null, 20497, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20505, 0, 1, null, 20497, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20506, 0, 1, null, 20497, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20507, 0, 1, null, 20497, null, 'MANAGERBIDNUMBER', 1, 0, 50, 'Номер локального реестра', 'Номер локального реестра документов пришедших из УРМ', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20508, 0, 1, null, 20497, null, 'MANAGERBIDDATE', 6, 0, 0, 'Дата локального реестра', 'Номер локального реестра документа пришедшего из УРМ', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20509, 0, 1, null, 20497, null, 'DOCSTATE', 3, 0, 0, 'Состояние заявки', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- REPORTSPERMISSIONS
CALL FIELDSINFO_IMPORT(20511, 0, 1, null, 20510, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20512, 0, 1, null, 20510, null, 'REPORTID', 3, 0, 0, 'Класс отчета', '', 11, '99.99.99.99', '', '99.99.99.99', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20513, 0, 1, null, 20510, null, 'USERID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16708, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20514, 0, 1, null, 20510, null, 'PERMISSIONSTR', 1, 0, 255, 'Право', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ITF_DOCS
CALL FIELDSINFO_IMPORT(20540, 0, 1, null, 20539, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20541, 0, 1, null, 20539, null, 'ITF_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16722, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20542, 0, 1, null, 20539, null, 'DOC_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20543, 0, 1, null, 20539, null, 'NOTE', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20544, 0, 1, null, 20539, null, 'ORDERBY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20545, 0, 1, null, 20539, null, 'DEFAULTEXEC', 3, 0, 0, 'Выполнить по умолчанию', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20546, 0, 1, null, 20539, null, 'DOCINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24892, 0, 1, null, 20539, null, 'ELEMFILTER', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24893, 0, 1, null, 20539, null, 'ENABLE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24894, 0, 1, null, 20539, null, 'ERRORMESSAGE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26632, 0, 1, null, 20539, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26633, 0, 1, null, 20539, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26634, 0, 1, null, 20539, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26635, 0, 1, null, 20539, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- COMPOUNDCLS
CALL FIELDSINFO_IMPORT(20555, 0, 1, null, 20554, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20556, 0, 1, null, 20554, null, 'CODE', 3, 0, 0, 'Код классификатора', '', 11, '999999999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20557, 0, 1, null, 20554, null, 'NAME', 1, 0, 255, 'Наименование классификатора', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20558, 0, 1, null, 20554, null, 'PROGINDEX', 3, 0, 0, 'Тип классификатора', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20559, 0, 1, null, 20554, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20560, 0, 1, null, 20554, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- COMPOUNDCLSDETAIL
CALL FIELDSINFO_IMPORT(20562, 0, 1, null, 20561, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20563, 0, 1, null, 20561, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20564, 0, 1, null, 20561, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20565, 0, 1, null, 20561, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '999', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20566, 0, 1, null, 20561, null, 'FINSOURCECLS', 3, 0, 0, 'Источник финансирования', '', 11, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20567, 0, 1, null, 20561, null, 'FACTCLS', 3, 0, 0, 'Мероприятие', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20568, 0, 1, null, 20561, null, 'MEANSTYPECLS', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20569, 0, 1, null, 20561, null, 'TYPEOPERATIONCLS', 3, 0, 0, 'Тип операции', '', 11, '99', '', '', 0, 0, null, 1, 17094, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20570, 0, 1, null, 20561, null, 'COMPOUNDCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20554, 1, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20571, 0, 1, null, 20561, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20572, 0, 1, null, 20561, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20573, 0, 1, null, 20561, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20574, 0, 1, null, 20561, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20575, 0, 1, null, 20561, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20576, 0, 1, null, 20561, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20577, 0, 1, null, 20561, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- RESERVEFUNDS
CALL FIELDSINFO_IMPORT(20579, 0, 1, null, 20578, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20580, 0, 1, null, 20578, null, 'MANAGERFACIALACCCLS', 3, 0, 0, 'Распорядительный лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20581, 0, 1, null, 20578, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20582, 0, 1, null, 20578, null, 'GROUPITEM', 3, 0, 0, 'Группа статей экономической классификации', '', 11, '', '', '', 0, 0, null, 1, 20554, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20583, 0, 1, null, 20578, null, 'TYPEFUNDSOPERATION', 3, 0, 0, 'Тип операции', '', 11, '', '', '', 0, 0, null, 1, 20554, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20584, 0, 1, null, 20578, null, 'RESERVEDATE', 6, 0, 0, 'Дата резерва', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20585, 0, 1, null, 20578, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20586, 0, 1, null, 20578, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20587, 0, 1, null, 20578, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20588, 0, 1, null, 20578, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20589, 0, 1, null, 20578, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20590, 0, 1, null, 20578, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- STATE_TYPES
CALL FIELDSINFO_IMPORT(20592, 0, 1, null, 20591, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20593, 0, 1, null, 20591, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20594, 0, 1, null, 20591, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20595, 0, 1, null, 20591, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20596, 0, 1, null, 20591, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20597, 0, 1, null, 20591, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DOCUMENTTYPES
CALL FIELDSINFO_IMPORT(20599, 0, 1, null, 20598, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 6, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20600, 0, 1, null, 20598, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20601, 0, 1, null, 20598, null, 'NAME', 1, 0, 255, 'Централизованное название', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20602, 0, 1, null, 20598, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20603, 0, 1, null, 20598, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20604, 0, 1, null, 20598, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20605, 0, 1, null, 20598, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20606, 0, 1, null, 20598, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20607, 0, 1, null, 20598, null, 'USESTATE', 3, 0, 0, 'Исп. состояния', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20608, 0, 1, null, 20598, null, 'DBTABLE', 1, 0, 255, 'Имя таблицы', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20609, 0, 1, null, 20598, null, 'NEEDEDS', 3, 0, 0, 'ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20610, 0, 1, null, 20598, null, 'URMDBTABLE', 1, 0, 255, 'Имя таблицы УРМ', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20611, 0, 1, null, 20598, null, 'ICONCOLLECTION', 1, 0, 255, 'Коллекция картинок', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20612, 0, 1, null, 20598, null, 'NEEDHIDEEDSFORM', 3, 0, 0, 'Скрывать форму простановки подписи', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20613, 0, 1, null, 20598, null, 'SCHEMAVERSION', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20614, 0, 1, null, 20598, null, 'LOCKMASK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20615, 0, 1, null, 20598, null, 'DEFAULTACTIONMACROSNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20616, 0, 1, null, 20598, null, 'DOCUMENTKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20617, 0, 1, null, 20598, null, 'SHORTNAME', 1, 0, 255, 'Краткое имя', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKEXCH_CLSREPLACEMENT
CALL FIELDSINFO_IMPORT(20619, 0, 1, null, 20618, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20620, 0, 1, null, 20618, null, 'SOURCEMFO', 1, 0, 20, 'БИК', '', 20, '!999999999;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20621, 0, 1, null, 20618, null, 'SOURCEINN', 6, 0, 0, 'ИНН', '', 13, '9999999999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20622, 0, 1, null, 20618, null, 'SOURCEKPP', 1, 0, 20, 'КПП', '', 20, '!999999999;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20623, 0, 1, null, 20618, null, 'SOURCEACC', 1, 0, 20, 'Счет', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20624, 0, 1, null, 20618, null, 'SOURCENOTE', 1, 0, 255, 'Назначение платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20625, 0, 1, null, 20618, null, 'SOURCEKD', 3, 0, 0, 'Код дохода', '', 11, '9.99.99.99.99', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20626, 0, 1, null, 20618, null, 'DESTNOTE', 1, 0, 255, 'Назначение платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20627, 0, 1, null, 20618, null, 'DESTKD', 3, 0, 0, 'Код дохода', '', 11, '9.99.99.99.99', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20628, 0, 1, null, 20618, null, 'DESTSUBKD', 3, 0, 0, 'СубКД', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16928, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20629, 0, 1, null, 20618, null, 'DESTREGION', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20630, 0, 1, null, 20618, null, 'DESTGOSNI', 3, 0, 0, 'ГосНИ', '', 11, '99.99', '', '', 0, 0, null, 1, 16948, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20631, 0, 1, null, 20618, null, 'DESTFACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20632, 0, 1, null, 20618, null, 'DESTMEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20633, 0, 1, null, 20618, null, 'DESTDOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20634, 0, 1, null, 20618, null, 'DESTFINTYPE', 3, 0, 0, '', '', 11, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20635, 0, 1, null, 20618, null, 'BUHPAYMENTCLS', 3, 0, 0, '', '', 11, '999', '', '', 0, 0, null, 1, 17069, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20636, 0, 1, null, 20618, null, 'DFACCOUNT', 1, 0, 20, 'Счет финоргана', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20637, 0, 1, null, 20618, null, 'PROCDOCCLASS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REMOTECLIENTTYPE
CALL FIELDSINFO_IMPORT(20639, 0, 1, null, 20638, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20640, 0, 1, null, 20638, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20641, 0, 1, null, 20638, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20642, 0, 1, null, 20638, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20643, 0, 1, null, 20638, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20644, 0, 1, null, 20638, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20645, 0, 1, null, 20638, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REMOTETASKREGIME
CALL FIELDSINFO_IMPORT(20647, 0, 1, null, 20646, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20648, 0, 1, null, 20646, null, 'NAME', 1, 0, 20, 'Наименование', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- REMOTETASKTYPE
CALL FIELDSINFO_IMPORT(20650, 0, 1, null, 20649, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20651, 0, 1, null, 20649, null, 'NAME', 1, 0, 30, 'Наименование', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- REMOTETASKMANAGER
CALL FIELDSINFO_IMPORT(20653, 0, 1, null, 20652, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20654, 0, 1, null, 20652, null, 'TASKENABLE', 3, 0, 0, 'Активна', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20655, 0, 1, null, 20652, null, 'TASKDATE', 6, 0, 0, 'Дата', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20656, 0, 1, null, 20652, null, 'TASKTIME', 1, 0, 5, 'Время', '', 5, '90:00;1;_', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20657, 0, 1, null, 20652, null, 'ISGROUP', 3, 0, 0, 'Группа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20658, 0, 1, null, 20652, null, 'REMOTECLIENT', 3, 0, 0, 'Пользователь', '', 11, '', '', '', 0, 0, null, 0, 20054, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20659, 0, 1, null, 20652, null, 'REMOTEGROUP', 3, 0, 0, 'Группа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20660, 0, 1, null, 20652, null, 'REMOTETASKREGIME', 3, 0, 0, 'Режим', '', 11, '', '', '', 0, 0, null, 1, 20646, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20661, 0, 1, null, 20652, null, 'DAYOFWEEK', 3, 0, 0, 'День недели', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20662, 0, 1, null, 20652, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20663, 0, 1, null, 20652, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20664, 0, 1, null, 20652, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20665, 0, 1, null, 20652, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REMOTETASKMANAGERDETAIL
CALL FIELDSINFO_IMPORT(20667, 0, 1, null, 20666, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20668, 0, 1, null, 20666, null, 'REMOTETASKMANAGER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20652, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20669, 0, 1, null, 20666, null, 'REMOTETASKTYPE', 3, 0, 0, 'Тип задачи', '', 11, '', '', '', 0, 0, null, 1, 20649, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20670, 0, 1, null, 20666, null, 'DOCTYPES', 3, 0, 0, 'Тип документа', '', 11, '9.99.9', '', '', 0, 0, null, 0, 20598, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20671, 0, 1, null, 20666, null, 'ORDERBY', 3, 0, 0, 'Порядок', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20672, 0, 1, null, 20666, null, 'PATH', 1, 0, 255, 'Приложение', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20673, 0, 1, null, 20666, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20674, 0, 1, null, 20666, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20675, 0, 1, null, 20666, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20676, 0, 1, null, 20666, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ITF_CTRL
CALL FIELDSINFO_IMPORT(20678, 0, 1, null, 20677, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20679, 0, 1, null, 20677, null, 'ITF_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16722, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20680, 0, 1, null, 20677, null, 'CTRL_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20681, 0, 1, null, 20677, null, 'NOTE', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20682, 0, 1, null, 20677, null, 'ORDERBY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20683, 0, 1, null, 20677, null, 'CTRLOPTIONS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20684, 0, 1, null, 20677, null, 'CONTROLFIELD', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20685, 0, 1, null, 20677, null, 'DOCINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26628, 0, 1, null, 20677, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26629, 0, 1, null, 20677, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26630, 0, 1, null, 20677, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26631, 0, 1, null, 20677, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25500, 0, 1, null, 20677, null, 'ELEMFILTER', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25501, 0, 1, null, 20677, null, 'ENABLE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25502, 0, 1, null, 20677, null, 'ERRORMESSAGE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25503, 0, 1, null, 20677, null, 'SCENARIOREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23088, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PLANDOCTYPE
CALL FIELDSINFO_IMPORT(20687, 0, 1, null, 20686, null, 'ID', 3, 0, 0, 'Код', '', 11, '9.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20688, 0, 1, null, 20686, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20689, 0, 1, null, 20686, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20690, 0, 1, null, 20686, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- REPORTTESTERCONTROL
CALL FIELDSINFO_IMPORT(20692, 0, 1, null, 20691, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20693, 0, 1, null, 20691, null, 'GUID', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- TENDEROBJECTS
CALL FIELDSINFO_IMPORT(20695, 0, 1, null, 20694, null, 'ID', 3, 0, 0, 'Код', '', 11, '999999999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20696, 0, 1, null, 20694, null, 'OKDP', 3, 0, 0, 'ОКДП', '', 11, '99.9.9.99.9', '', '', 0, 0, null, 1, 19714, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20697, 0, 1, null, 20694, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20698, 0, 1, null, 20694, null, 'SHORTNAME', 1, 0, 50, 'Краткое имя', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20699, 0, 1, null, 20694, null, 'CODE', 1, 0, 255, 'Расширенный код', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20700, 0, 1, null, 20694, null, 'OBJECTSPEC', 1, 0, 255, 'Спецификация', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20701, 0, 1, null, 20694, null, 'BRAND', 1, 0, 255, 'Марка', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20702, 0, 1, null, 20694, null, 'KESR', 3, 0, 0, 'КЭСР', '', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20703, 0, 1, null, 20694, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20704, 0, 1, null, 20694, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20705, 0, 1, null, 20694, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20706, 0, 1, null, 20694, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20707, 0, 1, null, 20694, null, 'MEASUREMENTCLS', 3, 0, 0, 'Единицы измерения', '', 4, '999', '', '', 0, 0, null, 1, 20727, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20708, 0, 1, null, 20694, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 9, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20709, 0, 1, null, 20694, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20710, 0, 1, null, 20694, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20711, 0, 1, null, 20694, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20712, 0, 1, null, 20694, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20713, 0, 1, null, 20694, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20714, 0, 1, null, 20694, null, 'FACIALACCCLS', 3, 0, 0, 'Автор (лиц. счет) ', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20715, 0, 1, null, 20694, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20716, 0, 1, null, 20694, null, 'UPDATECAUSE', 1, 0, 255, 'Причина доработки', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20717, 0, 1, null, 20694, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20718, 0, 1, null, 20694, null, 'DOCUMENTDATE', 6, 0, 0, 'Дата формирования', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20719, 0, 1, null, 20694, null, 'TENDEROBJREPLACE', 3, 0, 0, 'Продукция после переброски ', '', 11, '999999999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20720, 0, 1, null, 20694, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20721, 0, 1, null, 20694, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20725, 0, 1, null, 20694, null, 'OKPCLS', 3, 0, 0, 'ОКП', '', 11, '99.9.9.9.9', '', '', 0, 0, null, 1, 22737, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20726, 0, 1, null, 20694, null, 'ATTRIBUTE', 1, 0, 4000, 'Характеристика продукции', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25046, 0, 1, null, 20694, null, 'REALID', 1, 0, 127, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29961, 0, 1, null, 20694, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29962, 0, 1, null, 20694, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35340, 0, 1, null, 20694, null, 'OKPD', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 35312, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35341, 0, 1, null, 20694, null, 'OKVED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 35313, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37820, 0, 1, null, 20694, null, 'OKPD2', 3, 0, 0, 'ОКПД2', '', 9, '99.99.99.999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37821, 0, 1, null, 20694, null, 'OKVED2', 3, 0, 0, 'ОКВЭД2', '', 6, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- MEASUREMENTCLS
CALL FIELDSINFO_IMPORT(20728, 0, 1, null, 20727, null, 'ID', 3, 0, 0, 'Код', '', 4, '999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20729, 0, 1, null, 20727, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20730, 0, 1, null, 20727, null, 'SHORTNAME', 1, 0, 50, 'Краткое имя', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20731, 0, 1, null, 20727, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20732, 0, 1, null, 20727, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20733, 0, 1, null, 20727, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20734, 0, 1, null, 20727, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DBGROUPS
CALL FIELDSINFO_IMPORT(20736, 0, 1, null, 20735, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20737, 0, 1, null, 20735, null, 'NAME', 1, 0, 50, 'Имя группы', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20738, 0, 1, null, 20735, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20739, 0, 1, null, 20735, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20740, 0, 1, null, 20735, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35051, 0, 1, null, 20735, null, 'SYSTEMGROUPID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- GROUPSWORKPLACES
CALL FIELDSINFO_IMPORT(20742, 0, 1, null, 20741, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20743, 0, 1, null, 20741, null, 'GROUPREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20735, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20744, 0, 1, null, 20741, null, 'WORKPLACEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16734, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20745, 0, 1, null, 20741, null, 'DEFAULTWORKPLACE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33029, 0, 1, null, 20741, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33030, 0, 1, null, 20741, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33031, 0, 1, null, 20741, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33032, 0, 1, null, 20741, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- OBJECTKIND
CALL FIELDSINFO_IMPORT(20747, 0, 1, null, 20746, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20748, 0, 1, null, 20746, null, 'NAME', 1, 0, 255, 'Тип объекта', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20749, 0, 1, null, 20746, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20750, 0, 1, null, 20746, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- RIGHTKIND
CALL FIELDSINFO_IMPORT(20752, 0, 1, null, 20751, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20753, 0, 1, null, 20751, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20754, 0, 1, null, 20751, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20755, 0, 1, null, 20751, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- DBRIGHTS
CALL FIELDSINFO_IMPORT(20757, 0, 1, null, 20756, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20758, 0, 1, null, 20756, null, 'OBJREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20759, 0, 1, null, 20756, null, 'RIGHTKINDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20751, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20760, 0, 1, null, 20756, null, 'OBJECTKINDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20746, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20761, 0, 1, null, 20756, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20762, 0, 1, null, 20756, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- GROUPSRIGHTS
CALL FIELDSINFO_IMPORT(20764, 0, 1, null, 20763, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20765, 0, 1, null, 20763, null, 'GROUPREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20735, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20766, 0, 1, null, 20763, null, 'RIGHTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20756, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20767, 0, 1, null, 20763, null, 'ISREJECT', 3, 0, 0, 'Запрет', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20768, 0, 1, null, 20763, null, 'OBJREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20769, 0, 1, null, 20763, null, 'OBJECTKINDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20746, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20770, 0, 1, null, 20763, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20771, 0, 1, null, 20763, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35054, 0, 1, null, 20763, null, 'RIGHTKINDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20751, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- USERSRIGHTS
CALL FIELDSINFO_IMPORT(20773, 0, 1, null, 20772, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20774, 0, 1, null, 20772, null, 'USERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16708, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20775, 0, 1, null, 20772, null, 'RIGHTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20756, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20776, 0, 1, null, 20772, null, 'ISREJECT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20777, 0, 1, null, 20772, null, 'OBJREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20778, 0, 1, null, 20772, null, 'OBJECTKINDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20746, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20779, 0, 1, null, 20772, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20780, 0, 1, null, 20772, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35139, 0, 1, null, 20772, null, 'RIGHTKINDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20751, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- USERSINGROUPS
CALL FIELDSINFO_IMPORT(20782, 0, 1, null, 20781, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20783, 0, 1, null, 20781, null, 'GROUPREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20735, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20784, 0, 1, null, 20781, null, 'USERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16708, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20785, 0, 1, null, 20781, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20786, 0, 1, null, 20781, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- DATECONST
CALL FIELDSINFO_IMPORT(20788, 0, 1, null, 20787, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20789, 0, 1, null, 20787, null, 'CONSTINDEX', 3, 0, 0, 'Номер константы', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20790, 0, 1, null, 20787, null, 'CONSTVALUE', 11, 0, 0, 'Значение', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20791, 0, 1, null, 20787, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32899, 0, 1, null, 20787, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32900, 0, 1, null, 20787, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32901, 0, 1, null, 20787, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32902, 0, 1, null, 20787, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32903, 0, 1, null, 20787, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36104, 0, 1, null, 20787, null, 'CLOSEDATE', 11, 0, 0, 'Дата прекращения использования', '', 20, '99/99/9999', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36105, 0, 1, null, 20787, null, 'EDITDOCCODE', 3, 0, 0, 'Код интерфейса, с которого редактируется константа ', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- GUARANTEE
CALL FIELDSINFO_IMPORT(20793, 0, 1, null, 20792, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20794, 0, 1, null, 20792, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20795, 0, 1, null, 20792, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20796, 0, 1, null, 20792, null, 'PROGINDEX', 3, 0, 0, 'Вид операции', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20797, 0, 1, null, 20792, null, 'ACCEPTDATE', 6, 0, 0, 'Дата выдачи (факт)', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20798, 0, 1, null, 20792, null, 'RECORDDATE', 6, 0, 0, 'Дата учета', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20799, 0, 1, null, 20792, null, 'PLANDATE', 6, 0, 0, 'Плановая дата', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20800, 0, 1, null, 20792, null, 'CREDIT', 6, 0, 0, 'Сумма', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20801, 0, 1, null, 20792, null, 'DEBIT', 6, 0, 0, 'Сумма', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20802, 0, 1, null, 20792, null, 'SOURCEDOCNUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20803, 0, 1, null, 20792, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20804, 0, 1, null, 20792, null, 'BUHPAYMENTCLS', 3, 0, 0, 'Проводка', '', 11, '999', '', '', 0, 0, null, 1, 17069, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20805, 0, 1, null, 20792, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20806, 0, 1, null, 20792, null, 'PERIODSTART', 6, 0, 0, 'Начало периода', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20807, 0, 1, null, 20792, null, 'PERIODEND', 6, 0, 0, 'Конец периода', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20808, 0, 1, null, 20792, null, 'CURRENCYCLS', 3, 0, 0, 'Код валюты', '', 11, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20809, 0, 1, null, 20792, null, 'CURRENCYSUMMA', 6, 0, 0, 'Сумма в валюте', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20810, 0, 1, null, 20792, null, 'SUBRECORDINDEX', 3, 0, 0, 'Ссылка на документ по вспомогательной операции ', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20811, 0, 1, null, 20792, null, 'SUBPROGINDEX', 3, 0, 0, 'Способ финансирования', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20812, 0, 1, null, 20792, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20813, 0, 1, null, 20792, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20814, 0, 1, null, 20792, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20815, 0, 1, null, 20792, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20816, 0, 1, null, 20792, null, 'PARENTID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20817, 0, 1, null, 20792, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бухгалтерская операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20818, 0, 1, null, 20792, null, 'IFS', 3, 0, 0, 'Источники внутреннего и внешнего финансирования', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20819, 0, 1, null, 20792, null, 'IFS_CORR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20820, 0, 1, null, 20792, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DOCUMENTFIELDS
CALL FIELDSINFO_IMPORT(20822, 0, 1, null, 20821, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20823, 0, 1, null, 20821, null, 'NAME', 1, 0, 255, 'Название поля в БД', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20824, 0, 1, null, 20821, null, 'ITFFIELDNAME', 1, 0, 255, 'Название поля на интерф.', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20825, 0, 1, null, 20821, null, 'NOTE', 1, 0, 255, 'Примечание (Имя поля рус.)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20826, 0, 1, null, 20821, null, 'ISBUDGET', 3, 0, 0, 'Принадлежит', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20827, 0, 1, null, 20821, null, 'DOCTYPEREF', 3, 0, 0, 'Тип документа ', '', 11, '99.99', '', '', 0, 0, null, 1, 20598, 1, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20828, 0, 1, null, 20821, null, 'DETAILNUMBER', 3, 0, 0, 'Номер дет.', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20829, 0, 1, null, 20821, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20830, 0, 1, null, 20821, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20831, 0, 1, null, 20821, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20832, 0, 1, null, 20821, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20833, 0, 1, null, 20821, null, 'TEMPLATEFIELD', 1, 0, 255, 'Имя колонки шаблона', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20834, 0, 1, null, 20821, null, 'ONLYREAD', 3, 0, 0, 'Редактируется с интерфейса', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20835, 0, 1, null, 20821, null, 'REPORTFIELDNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26552, 0, 1, null, 20821, null, 'FIELDINFOREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23069, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25299, 0, 1, null, 20821, null, 'DOCUMENTCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22823, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- STATE_DOCSTATES
CALL FIELDSINFO_IMPORT(20837, 0, 1, null, 20836, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20838, 0, 1, null, 20836, null, 'NAME', 1, 0, 255, 'Состояние документа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20839, 0, 1, null, 20836, null, 'DOCTYPEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20598, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20840, 0, 1, null, 20836, null, 'STATETYPEREF', 3, 0, 0, 'Тип состояния', '', 11, '', '', '', 0, 0, null, 1, 20591, 1, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20841, 0, 1, null, 20836, null, 'ICONNAME', 1, 0, 255, 'Картинка', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20842, 0, 1, null, 20836, null, 'STATENUMBER', 3, 0, 0, 'Идент. состояния', '', 11, '99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20843, 0, 1, null, 20836, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20844, 0, 1, null, 20836, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20845, 0, 1, null, 20836, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20846, 0, 1, null, 20836, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20847, 0, 1, null, 20836, null, 'STATEORDER', 3, 0, 0, 'Порядок при отображении', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20848, 0, 1, null, 20836, null, 'CONTROLLEVEL', 3, 0, 0, 'Уровень бюджетного контроля', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20849, 0, 1, null, 20836, null, 'COMMON_STATENAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20850, 0, 1, null, 20836, null, 'ISACTIVE', 3, 0, 0, 'Вкл.', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27628, 0, 1, null, 20836, null, 'ISSYSTEM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30618, 0, 1, null, 20836, null, 'POSX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30619, 0, 1, null, 20836, null, 'POSY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- STATE_JUMPS
CALL FIELDSINFO_IMPORT(20852, 0, 1, null, 20851, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20853, 0, 1, null, 20851, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20854, 0, 1, null, 20851, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20855, 0, 1, null, 20851, null, 'BEGINSTATEREF', 3, 0, 0, 'Иcходное состояние', '', 11, '', '', '', 0, 0, null, 1, 20836, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20856, 0, 1, null, 20851, null, 'ENDSTATEREF', 3, 0, 0, 'Целевое состояние', '', 11, '', '', '', 0, 0, null, 1, 20836, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20857, 0, 1, null, 20851, null, 'DOCTYPEREF', 3, 0, 0, 'Тип документа (ссылка) ', '', 11, '', '', '', 0, 0, null, 1, 20598, 1, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20858, 0, 1, null, 20851, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20859, 0, 1, null, 20851, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20860, 0, 1, null, 20851, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20861, 0, 1, null, 20851, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20862, 0, 1, null, 20851, null, 'NEEDEDS', 3, 0, 0, 'ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20863, 0, 1, null, 20851, null, 'BACKJUMP', 3, 0, 0, 'Обратный', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20864, 0, 1, null, 20851, null, 'NEEDCHECKEDS', 3, 0, 0, 'Проверять ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20865, 0, 1, null, 20851, null, 'CONTROLLIST', 1, 0, 255, 'Список бюджетных контролей', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20866, 0, 1, null, 20851, null, 'DOCSEVENT', 1, 0, 255, 'Формирование печатных документов', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20867, 0, 1, null, 20851, null, 'DOCSLIST', 1, 0, 255, 'Список печатных документов', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24997, 0, 1, null, 20851, null, 'OPTIONSPATH', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25633, 0, 1, null, 20851, null, 'CANATTACHFILES', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25634, 0, 1, null, 20851, null, 'CANDETACTHFILES', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25635, 0, 1, null, 20851, null, 'CANREJECTATTACHEDFILES', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27629, 0, 1, null, 20851, null, 'ISACTIVE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- STATE_OPENFIELDS
CALL FIELDSINFO_IMPORT(20869, 0, 1, null, 20868, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20870, 0, 1, null, 20868, null, 'DOCFIELDREF', 3, 0, 0, 'Поле', '', 11, '', '', '', 0, 0, null, 1, 20821, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20871, 0, 1, null, 20868, null, 'JUMPREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20851, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20872, 0, 1, null, 20868, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20873, 0, 1, null, 20868, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20874, 0, 1, null, 20868, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20875, 0, 1, null, 20868, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20876, 0, 1, null, 20868, null, 'NONUSEREDIT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- DUALRIGHTS
CALL FIELDSINFO_IMPORT(20878, 0, 1, null, 20877, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20879, 0, 1, null, 20877, null, 'USERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20880, 0, 1, null, 20877, null, 'ISGROUP', 3, 0, 0, 'Право группы', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20881, 0, 1, null, 20877, null, 'RIGHTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20756, 1, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20882, 0, 1, null, 20877, null, 'ISREJECT', 3, 0, 0, 'Запрет', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20883, 0, 1, null, 20877, null, 'OBJREF1', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20884, 0, 1, null, 20877, null, 'OBJREF2', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20885, 0, 1, null, 20877, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20886, 0, 1, null, 20877, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30894, 0, 1, null, 20877, null, 'OBJREF1UP', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30895, 0, 1, null, 20877, null, 'OBJREF2UP', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35316, 0, 1, null, 20877, null, 'OBJECTKINDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20746, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35317, 0, 1, null, 20877, null, 'RIGHTKINDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20751, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- EXCHNUMBERLIMITS
CALL FIELDSINFO_IMPORT(20888, 0, 1, null, 20887, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20889, 0, 1, null, 20887, null, 'NUMBERTYPE', 3, 0, 0, '', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20890, 0, 1, null, 20887, null, 'MINNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20891, 0, 1, null, 20887, null, 'MAXNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- EXCHNUMBER
CALL FIELDSINFO_IMPORT(20893, 0, 1, null, 20892, null, 'DATEEX', 6, 0, 0, 'Дата эл. номера', '', 13, '99/99/9999', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20894, 0, 1, null, 20892, null, 'CODEFORMAT', 3, 0, 0, 'Формат', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20895, 0, 1, null, 20892, null, 'NUMBERTYPE', 3, 0, 0, 'Тип номера', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20896, 0, 1, null, 20892, null, 'ELNUM', 3, 0, 0, 'Эл. номер', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20897, 0, 1, null, 20892, null, 'LOCKUSER', 1, 0, 30, 'Заблокировал', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20898, 0, 1, null, 20892, null, 'LOCKDATE', 11, 0, 0, 'Дата блокировки', '', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20899, 0, 1, null, 20892, null, 'LOCKINGFLAG', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20900, 0, 1, null, 20892, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20901, 0, 1, null, 20892, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- REMOTEMAILMESSAGES
CALL FIELDSINFO_IMPORT(20903, 0, 1, null, 20902, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20904, 0, 1, null, 20902, null, 'SUBJECT', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20905, 0, 1, null, 20902, null, 'TEXTFILENAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20906, 0, 1, null, 20902, null, 'REMINDER', 3, 0, 0, 'Напоминание', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20907, 0, 1, null, 20902, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REMOTEMAILCLIENTMESSAGES
CALL FIELDSINFO_IMPORT(20909, 0, 1, null, 20908, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20910, 0, 1, null, 20908, null, 'MESSAGEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20902, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20911, 0, 1, null, 20908, null, 'REMOTECLIENTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20054, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20912, 0, 1, null, 20908, null, 'SENTDATE', 11, 0, 0, '', '', 20, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20913, 0, 1, null, 20908, null, 'RECEIVEDDATE', 11, 0, 0, '', '', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REMOTEMAILATTACHEDFILES
CALL FIELDSINFO_IMPORT(20915, 0, 1, null, 20914, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20916, 0, 1, null, 20914, null, 'ATTACHEDFILENAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20917, 0, 1, null, 20914, null, 'MESSAGEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20902, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BUDSTRLINK
CALL FIELDSINFO_IMPORT(24701, 0, 1, null, 20918, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24702, 0, 1, null, 20918, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20919, 0, 1, null, 20918, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20920, 0, 1, null, 20918, null, 'BUDSTRUCT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20400, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20921, 0, 1, null, 20918, null, 'ORG_REF', 3, 0, 0, 'Ссылка на организацию', '', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20922, 0, 1, null, 20918, null, 'FACIALACC', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20923, 0, 1, null, 20918, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20924, 0, 1, null, 20918, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20925, 0, 1, null, 20918, null, 'FILTERKIND', 3, 0, 0, 'Уровень фильтрации', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- UTYPEDFORMS
CALL FIELDSINFO_IMPORT(20958, 0, 1, null, 20957, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20959, 0, 1, null, 20957, null, 'NAME', 1, 0, 100, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20960, 0, 1, null, 20957, null, 'TYPEDFORMTMPLT', 1, 0, 255, 'Файл шаблона формы ввода', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20961, 0, 1, null, 20957, null, 'REPORTTMPLT', 1, 0, 255, 'Файл шаблона отчета', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20962, 0, 1, null, 20957, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20963, 0, 1, null, 20957, null, 'ONOPENDETAIL', 1, 0, 50, 'Тип детализации', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20964, 0, 1, null, 20957, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20965, 0, 1, null, 20957, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20966, 0, 1, null, 20957, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20967, 0, 1, null, 20957, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20968, 0, 1, null, 20957, null, 'DOCTMPLT', 1, 0, 255, 'Файл шаблона документа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20969, 0, 1, null, 20957, null, 'LOCKED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20970, 0, 1, null, 20957, null, 'TYPEDFORMTMPLTDATA', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20971, 0, 1, null, 20957, null, 'PERIOD', 3, 0, 0, 'Периодичность формы', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20972, 0, 1, null, 20957, null, 'PARAMS', 1, 0, 512, 'Параметры ограничений', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20973, 0, 1, null, 20957, null, 'PRINTDOCLIST', 1, 0, 4000, 'Печатные документы', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20974, 0, 1, null, 20957, null, 'IMPORTLIST', 1, 0, 255, 'Документы импорта', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20975, 0, 1, null, 20957, null, 'EXPORTLIST', 1, 0, 255, 'Документы экспорта', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20976, 0, 1, null, 20957, null, 'CONTROLLIST', 1, 0, 4000, 'Документы контроля', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20977, 0, 1, null, 20957, null, 'GROUPINDEX', 3, 0, 0, 'Код группы', '', 11, '00.00.00.00', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20978, 0, 1, null, 20957, null, 'CONSTMPLT', 1, 0, 4000, 'Документы формирования', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20979, 0, 1, null, 20957, null, 'REPORTKIND', 3, 0, 0, 'Вид отчета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20980, 0, 1, null, 20957, null, 'NEEDVERSION', 3, 0, 0, 'Поддерживать версии', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20981, 0, 1, null, 20957, null, 'SHORTNAME', 1, 0, 255, 'Краткое имя', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20982, 0, 1, null, 20957, null, 'MINFINCODE', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25083, 0, 1, null, 20957, null, 'PARAMLIST', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27932, 0, 1, null, 20957, null, 'BEGINDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27933, 0, 1, null, 20957, null, 'ENDDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27934, 0, 1, null, 20957, null, 'FORURM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27935, 0, 1, null, 20957, null, 'ISCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27936, 0, 1, null, 20957, null, 'TEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27937, 0, 1, null, 20957, null, 'VERSIONNUMBER', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- UTYPEDFORMSCAPTION
CALL FIELDSINFO_IMPORT(20984, 0, 1, null, 20983, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20985, 0, 1, null, 20983, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20986, 0, 1, null, 20983, null, 'ESTIMDATE', 6, 0, 0, 'Дата сдачи', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20987, 0, 1, null, 20983, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20988, 0, 1, null, 20983, null, 'DOCNUMBER', 1, 0, 20, 'Номер документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20989, 0, 1, null, 20983, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20990, 0, 1, null, 20983, null, 'TYPEDFORM', 3, 0, 0, 'Код формы ввода', '', 11, '99.99.99.99', '', '', 0, 0, null, 1, 20957, 1, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20991, 0, 1, null, 20983, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20992, 0, 1, null, 20983, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20993, 0, 1, null, 20983, null, 'ORG_REF', 3, 0, 0, 'Ссылка на организацию', '', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20994, 0, 1, null, 20983, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20995, 0, 1, null, 20983, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20996, 0, 1, null, 20983, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20997, 0, 1, null, 20983, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20998, 0, 1, null, 20983, null, 'EMAIL', 1, 0, 50, 'Адрес e-mail назначения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(20999, 0, 1, null, 20983, null, 'STATE', 3, 0, 0, 'Статус', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21000, 0, 1, null, 20983, null, 'ERROR', 1, 0, 255, 'Текст ошибок', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21001, 0, 1, null, 20983, null, 'SOURCEID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21002, 0, 1, null, 20983, null, 'SOURCEMAILID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21003, 0, 1, null, 20983, null, 'AUTOTASKSSERVER', 1, 0, 255, 'Способ сбора данных', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21004, 0, 1, null, 20983, null, 'DEPARTMENTCLS', 3, 0, 0, 'Отдел', '', 11, '99.99.99', '', '', 0, 0, null, 1, 19786, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21005, 0, 1, null, 20983, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21006, 0, 1, null, 20983, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21007, 0, 1, null, 20983, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21008, 0, 1, null, 20983, null, 'UTFRINDEX', 3, 0, 0, 'Реестр форм ввода', '', 11, '99.99.99.99', '', '', 0, 0, null, 1, 21608, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21009, 0, 1, null, 20983, null, 'REPORTDATE', 6, 0, 0, 'Дата отчета', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21010, 0, 1, null, 20983, null, 'SELF', 3, 0, 0, 'Собственные данные', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21011, 0, 1, null, 20983, null, 'PERIOD', 3, 0, 0, 'Период', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21012, 0, 1, null, 20983, null, 'CLIENTSTYPE', 3, 0, 0, 'Тип клиентов', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21013, 0, 1, null, 20983, null, 'SENDKIT', 3, 0, 0, 'Форма ввода', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21014, 0, 1, null, 20983, null, 'SENDSTS', 3, 0, 0, 'Отчет', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21015, 0, 1, null, 20983, null, 'SENDDOC', 3, 0, 0, 'Документ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21016, 0, 1, null, 20983, null, 'MANUALEXEC', 3, 0, 0, 'Виза пользователя', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21017, 0, 1, null, 20983, null, 'DATAMODE', 3, 0, 0, 'Тип отчета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21018, 0, 1, null, 20983, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21019, 0, 1, null, 20983, null, 'REPORTMONTH', 3, 0, 0, 'Месяц', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21020, 0, 1, null, 20983, null, 'REPORTYEAR', 3, 0, 0, 'Год', '', 11, '9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21021, 0, 1, null, 20983, null, 'ACTIVITYKIND', 3, 0, 0, 'Вид деятельности', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21022, 0, 1, null, 20983, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 11, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21023, 0, 1, null, 20983, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21024, 0, 1, null, 20983, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21025, 0, 1, null, 20983, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21026, 0, 1, null, 20983, null, 'LASTEXTRCHANGE', 11, 0, 0, 'Дата экстренного изменения', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21027, 0, 1, null, 20983, null, 'VERSIONID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25380, 0, 1, null, 20983, null, 'CONSCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23093, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25381, 0, 1, null, 20983, null, 'FINT1', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25382, 0, 1, null, 20983, null, 'FINT2', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25383, 0, 1, null, 20983, null, 'FINT3', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25384, 0, 1, null, 20983, null, 'FINT4', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25385, 0, 1, null, 20983, null, 'FINT5', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25386, 0, 1, null, 20983, null, 'FINT6', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25387, 0, 1, null, 20983, null, 'FINT7', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25388, 0, 1, null, 20983, null, 'PARAMS', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31782, 0, 1, null, 20983, null, 'FORMTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31783, 0, 1, null, 20983, null, 'PERIODTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, 31620, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31784, 0, 1, null, 20983, null, 'REGTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- TENDERPRODUCT
CALL FIELDSINFO_IMPORT(21029, 0, 1, null, 21028, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21030, 0, 1, null, 21028, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21031, 0, 1, null, 21028, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 21275, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21032, 0, 1, null, 21028, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21033, 0, 1, null, 21028, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21034, 0, 1, null, 21028, null, 'KFSR', 3, 0, 0, 'КФСР', '', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21035, 0, 1, null, 21028, null, 'KVSR', 3, 0, 0, 'КВСР', '', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21036, 0, 1, null, 21028, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21037, 0, 1, null, 21028, null, 'KVR', 3, 0, 0, 'КВР', '', 7, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21038, 0, 1, null, 21028, null, 'KESR', 3, 0, 0, 'ЭКР', '', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21039, 0, 1, null, 21028, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 10, '999', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21040, 0, 1, null, 21028, null, 'FACTCLS', 3, 0, 0, 'Мероприятие', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21041, 0, 1, null, 21028, null, 'FINSOURCECLS', 3, 0, 0, 'Источник финансирования', '', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21042, 0, 1, null, 21028, null, 'MEANSTYPECLS', 3, 0, 0, 'Тип средств', '', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21043, 0, 1, null, 21028, null, 'TENDEROBJECTCLS', 3, 0, 0, 'Предмет заявки', '', 11, '999999999', '', '', 0, 0, null, 1, 20694, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21045, 0, 1, null, 21028, null, 'ACCEPTAMOUNT', 6, 0, 0, 'Количество утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21047, 0, 1, null, 21028, null, 'ACCEPTPRICE', 6, 0, 0, 'Цена утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21048, 0, 1, null, 21028, null, 'OKATO', 3, 0, 0, 'Место поставки', '', 11, '99.999.999', '', '', 0, 0, null, 1, 20418, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21049, 0, 1, null, 21028, null, 'DELIVERYSPEC', 3, 0, 0, 'Условия поставки', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21050, 0, 1, null, 21028, null, 'DELIVERYDATE', 6, 0, 0, 'Дата поставки', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21051, 0, 1, null, 21028, null, 'DELIVERYENDDATE', 6, 0, 0, 'Дата окончания поставки', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21052, 0, 1, null, 21028, null, 'DELIVERYPERIOD', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21053, 0, 1, null, 21028, null, 'DELIVERYAMOUNT', 6, 0, 0, 'Объем поставки за период', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21054, 0, 1, null, 21028, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21055, 0, 1, null, 21028, null, 'FINSPEC', 1, 0, 255, 'Условия финансирования', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21056, 0, 1, null, 21028, null, 'RECIPIENTLIST', 1, 0, 255, 'Получатели продукции', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21058, 0, 1, null, 21028, null, 'ACCEPTMONTH01', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21060, 0, 1, null, 21028, null, 'ACCEPTMONTH02', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21062, 0, 1, null, 21028, null, 'ACCEPTMONTH03', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21064, 0, 1, null, 21028, null, 'ACCEPTMONTH04', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21066, 0, 1, null, 21028, null, 'ACCEPTMONTH05', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21068, 0, 1, null, 21028, null, 'ACCEPTMONTH06', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21070, 0, 1, null, 21028, null, 'ACCEPTMONTH07', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21072, 0, 1, null, 21028, null, 'ACCEPTMONTH08', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21074, 0, 1, null, 21028, null, 'ACCEPTMONTH09', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21076, 0, 1, null, 21028, null, 'ACCEPTMONTH10', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21078, 0, 1, null, 21028, null, 'ACCEPTMONTH11', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21080, 0, 1, null, 21028, null, 'ACCEPTMONTH12', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21082, 0, 1, null, 21028, null, 'ACCEPTQUARTER1', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21084, 0, 1, null, 21028, null, 'ACCEPTQUARTER2', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21086, 0, 1, null, 21028, null, 'ACCEPTQUARTER3', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21088, 0, 1, null, 21028, null, 'ACCEPTQUARTER4', 6, 0, 0, 'Стоимость утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21090, 0, 1, null, 21028, null, 'ACCEPTSUMMA', 6, 0, 0, 'Стоимость утв', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21092, 0, 1, null, 21028, null, 'REVIEWNOTE', 1, 0, 255, 'Расшифровка рассмотрения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21095, 0, 1, null, 21028, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21096, 0, 1, null, 21028, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21097, 0, 1, null, 21028, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21098, 0, 1, null, 21028, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21099, 0, 1, null, 21028, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21100, 0, 1, null, 21028, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21101, 0, 1, null, 21028, null, 'TENDEROPENDATE', 6, 0, 0, 'Дата начала торгов', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21102, 0, 1, null, 21028, null, 'TENDERCLOSEDATE', 6, 0, 0, 'Дата завершения торгов', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21103, 0, 1, null, 21028, null, 'POSITIONNUMBER', 3, 0, 0, 'Номер строки заявки', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21104, 0, 1, null, 21028, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21105, 0, 1, null, 21028, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21106, 0, 1, null, 21028, null, 'TRANSPORTTERMS', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21107, 0, 1, null, 21028, null, 'VATPERCENT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21109, 0, 1, null, 21028, null, 'ACCEPTVATSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21111, 0, 1, null, 21028, null, 'ACCEPTCOST', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21113, 0, 1, null, 21028, null, 'ACCEPTTOTALSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21114, 0, 1, null, 21028, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 5, '', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21115, 0, 1, null, 21028, null, 'LOTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22697, 0, 0, 0, '', 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21116, 0, 1, null, 21028, null, 'EQUIVALENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21117, 0, 1, null, 21028, null, 'OKATONOTE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21118, 0, 1, null, 21028, null, 'DELIVERYNOTE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21119, 0, 1, null, 21028, null, 'DELIVERYSPECNOTE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21120, 0, 1, null, 21028, null, 'GUARANTY', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21121, 0, 1, null, 21028, null, 'DELIVERYFORMNOTE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21122, 0, 1, null, 21028, null, 'FINNOTE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21123, 0, 1, null, 21028, null, 'PRICEVAT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21124, 0, 1, null, 21028, null, 'GUARANTYSIZE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25047, 0, 1, null, 21028, null, 'REALID', 1, 0, 127, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25048, 0, 1, null, 21028, null, 'TENDEROBJECTATTR', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26652, 0, 1, null, 21028, null, 'SUMMAYEAR2', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26653, 0, 1, null, 21028, null, 'SUMMAYEAR3', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27630, 0, 1, null, 21028, null, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29963, 0, 1, null, 21028, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29964, 0, 1, null, 21028, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29965, 0, 1, null, 21028, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', '', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31748, 0, 1, null, 21028, null, 'BUDALLOCATIONCLS', 3, 0, 0, '', '', 9, '', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31749, 0, 1, null, 21028, null, 'PAYPROMISECLS', 3, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- UTYPEDFORMSDETAIL
CALL FIELDSINFO_IMPORT(21132, 0, 1, null, 21131, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21133, 0, 1, null, 21131, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 20983, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21134, 0, 1, null, 21131, null, 'DETAILINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21135, 0, 1, null, 21131, null, 'CODESTR', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21136, 0, 1, null, 21131, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21137, 0, 1, null, 21131, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21138, 0, 1, null, 21131, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21139, 0, 1, null, 21131, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21140, 0, 1, null, 21131, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.9.9', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21141, 0, 1, null, 21131, null, 'CODEROW', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21142, 0, 1, null, 21131, null, 'FINT1', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21143, 0, 1, null, 21131, null, 'FINT2', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21144, 0, 1, null, 21131, null, 'FINT3', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21145, 0, 1, null, 21131, null, 'FINT4', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21146, 0, 1, null, 21131, null, 'FINT5', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21147, 0, 1, null, 21131, null, 'S00', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21148, 0, 1, null, 21131, null, 'S01', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21149, 0, 1, null, 21131, null, 'S02', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21150, 0, 1, null, 21131, null, 'S03', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21151, 0, 1, null, 21131, null, 'S04', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21152, 0, 1, null, 21131, null, 'S05', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21153, 0, 1, null, 21131, null, 'S06', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21154, 0, 1, null, 21131, null, 'S07', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21155, 0, 1, null, 21131, null, 'S08', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21156, 0, 1, null, 21131, null, 'S09', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21157, 0, 1, null, 21131, null, 'S10', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21158, 0, 1, null, 21131, null, 'S11', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21159, 0, 1, null, 21131, null, 'S12', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21160, 0, 1, null, 21131, null, 'S13', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21161, 0, 1, null, 21131, null, 'S14', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21162, 0, 1, null, 21131, null, 'S15', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21163, 0, 1, null, 21131, null, 'S16', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21164, 0, 1, null, 21131, null, 'S17', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21165, 0, 1, null, 21131, null, 'S18', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21166, 0, 1, null, 21131, null, 'S19', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21167, 0, 1, null, 21131, null, 'S20', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21168, 0, 1, null, 21131, null, 'NOTE', 1, 0, 2048, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21169, 0, 1, null, 21131, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21170, 0, 1, null, 21131, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21171, 0, 1, null, 21131, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21172, 0, 1, null, 21131, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21173, 0, 1, null, 21131, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21174, 0, 1, null, 21131, null, 'NUMSTR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21175, 0, 1, null, 21131, null, 'KD', 1, 0, 20, 'Ссылка на код дохода', '', 20, '9.9.99.999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21176, 0, 1, null, 21131, null, 'INNERFINSOURCE', 1, 0, 20, 'Вид источника', '', 20, '99.99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21177, 0, 1, null, 21131, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21178, 0, 1, null, 21131, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21179, 0, 1, null, 21131, null, 'CODESTR30', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21180, 0, 1, null, 21131, null, 'PROGRAMCODE', 3, 0, 0, 'Программа', '', 11, '9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21181, 0, 1, null, 21131, null, 'ITEMCODE', 3, 0, 0, 'Элемент', '', 11, '99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21182, 0, 1, null, 21131, null, 'DESCRIPTIONCODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21183, 0, 1, null, 21131, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '999.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21184, 0, 1, null, 21131, null, 'FINT6', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21185, 0, 1, null, 21131, null, 'FINT7', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21186, 0, 1, null, 21131, null, 'NOTE1', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21187, 0, 1, null, 21131, null, 'NOTE2', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21188, 0, 1, null, 21131, null, 'NOTE3', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21189, 0, 1, null, 21131, null, 'NOTE4', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21190, 0, 1, null, 21131, null, 'NOTE5', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21191, 0, 1, null, 21131, null, 'NOTE6', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21192, 0, 1, null, 21131, null, 'NOTE7', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21193, 0, 1, null, 21131, null, 'NOTE8', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21194, 0, 1, null, 21131, null, 'NOTE9', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21195, 0, 1, null, 21131, null, 'NOTE10', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21196, 0, 1, null, 21131, null, 'CURRENCYCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21197, 0, 1, null, 21131, null, 'OKATO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21198, 0, 1, null, 21131, null, 'CODEINT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21199, 0, 1, null, 21131, null, 'ROWORDER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21200, 0, 1, null, 21131, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21201, 0, 1, null, 21131, null, 'CLSTYPE', 3, 0, 0, 'Тип классификации', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21202, 0, 1, null, 21131, null, 'S21', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21203, 0, 1, null, 21131, null, 'S22', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21204, 0, 1, null, 21131, null, 'S23', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21205, 0, 1, null, 21131, null, 'S24', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21206, 0, 1, null, 21131, null, 'S25', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21207, 0, 1, null, 21131, null, 'S26', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21208, 0, 1, null, 21131, null, 'S27', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21209, 0, 1, null, 21131, null, 'S28', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21210, 0, 1, null, 21131, null, 'S29', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21211, 0, 1, null, 21131, null, 'S30', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21212, 0, 1, null, 21131, null, 'S31', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21213, 0, 1, null, 21131, null, 'S32', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21214, 0, 1, null, 21131, null, 'S33', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21215, 0, 1, null, 21131, null, 'S34', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21216, 0, 1, null, 21131, null, 'S35', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21217, 0, 1, null, 21131, null, 'S36', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21218, 0, 1, null, 21131, null, 'S37', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21219, 0, 1, null, 21131, null, 'S38', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21220, 0, 1, null, 21131, null, 'S39', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21221, 0, 1, null, 21131, null, 'S40', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21222, 0, 1, null, 21131, null, 'FINT8', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21223, 0, 1, null, 21131, null, 'FINT9', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21224, 0, 1, null, 21131, null, 'FINT10', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21225, 0, 1, null, 21131, null, 'NOTE11', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21226, 0, 1, null, 21131, null, 'NOTE12', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21227, 0, 1, null, 21131, null, 'NOTE13', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21228, 0, 1, null, 21131, null, 'NOTE14', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21229, 0, 1, null, 21131, null, 'NOTE15', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21230, 0, 1, null, 21131, null, 'NOTE16', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21231, 0, 1, null, 21131, null, 'NOTE17', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21232, 0, 1, null, 21131, null, 'NOTE18', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21233, 0, 1, null, 21131, null, 'NOTE19', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21234, 0, 1, null, 21131, null, 'NOTE20', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21235, 0, 1, null, 21131, null, 'DATE1', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21236, 0, 1, null, 21131, null, 'DATE2', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21237, 0, 1, null, 21131, null, 'DATE3', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21238, 0, 1, null, 21131, null, 'DATE4', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21239, 0, 1, null, 21131, null, 'DATE5', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21240, 0, 1, null, 21131, null, 'DATE6', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21241, 0, 1, null, 21131, null, 'DATE7', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21242, 0, 1, null, 21131, null, 'DATE8', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21243, 0, 1, null, 21131, null, 'DATE9', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21244, 0, 1, null, 21131, null, 'DATE10', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21245, 0, 1, null, 21131, null, 'PARENTINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 114, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21246, 0, 1, null, 21131, null, 'TYPEDFORM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32959, 0, 1, null, 21131, null, 'KCSRCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32960, 0, 1, null, 21131, null, 'KESRCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32961, 0, 1, null, 21131, null, 'KFSRCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32962, 0, 1, null, 21131, null, 'KVRCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32963, 0, 1, null, 21131, null, 'KVSRCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32964, 0, 1, null, 21131, null, 'OKATOCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32965, 0, 1, null, 21131, null, 'SUBKESRCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30779, 0, 1, null, 21131, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UTYPEDFORMSPLACES
CALL FIELDSINFO_IMPORT(21248, 0, 1, null, 21247, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21249, 0, 1, null, 21247, null, 'WORKPLACE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16734, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21250, 0, 1, null, 21247, null, 'TYPEDFORM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20957, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21251, 0, 1, null, 21247, null, 'ORDERBY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21252, 0, 1, null, 21247, null, 'LEVELBY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21253, 0, 1, null, 21247, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21254, 0, 1, null, 21247, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21255, 0, 1, null, 21247, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21256, 0, 1, null, 21247, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21257, 0, 1, null, 21247, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- TENDERCAPTION
CALL FIELDSINFO_IMPORT(21276, 0, 1, null, 21275, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21277, 0, 1, null, 21275, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21278, 0, 1, null, 21275, null, 'DOCNUMBER', 1, 0, 255, 'Номер заявки', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21279, 0, 1, null, 21275, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21280, 0, 1, null, 21275, null, 'MULTIPURPOSE', 3, 0, 0, 'Комплексность', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21281, 0, 1, null, 21275, null, 'DOCUMENTDATE', 6, 0, 0, 'Дата документа', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21282, 0, 1, null, 21275, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21283, 0, 1, null, 21275, null, 'PERIOD', 3, 0, 0, 'Период', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21284, 0, 1, null, 21275, null, 'AYEAR', 3, 0, 0, 'Год', '', 5, '9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21286, 0, 1, null, 21275, null, 'ACCEPTSUMMA', 6, 0, 0, 'Итого утв.', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21287, 0, 1, null, 21275, null, 'SALETYPE', 3, 0, 0, 'Способ закупки', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21288, 0, 1, null, 21275, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21289, 0, 1, null, 21275, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21290, 0, 1, null, 21275, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21291, 0, 1, null, 21275, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21292, 0, 1, null, 21275, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21295, 0, 1, null, 21275, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21296, 0, 1, null, 21275, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21297, 0, 1, null, 21275, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21298, 0, 1, null, 21275, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21299, 0, 1, null, 21275, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21300, 0, 1, null, 21275, null, 'INNERNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21301, 0, 1, null, 21275, null, 'ADJUSTMENTNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21302, 0, 1, null, 21275, null, 'LASTADJUSTMENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21303, 0, 1, null, 21275, null, 'LASTACCEPTED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21304, 0, 1, null, 21275, null, 'ADJUSTMENTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21275, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21305, 0, 1, null, 21275, null, 'ACCEPTED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21307, 0, 1, null, 21275, null, 'YEARACCEPTSUMMA', 6, 0, 0, 'Утв. фин-ие на год', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21308, 0, 1, null, 21275, null, 'TENDEROPTION', 3, 0, 0, 'Вид заявки', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21309, 0, 1, null, 21275, null, 'TENDERTARGET', 1, 0, 1000, 'Назначение заявки', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21310, 0, 1, null, 21275, null, 'NOTE', 1, 0, 4000, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21311, 0, 1, null, 21275, null, 'EXPORTDATE', 6, 0, 0, 'Дата экспорта', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21312, 0, 1, null, 21275, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21313, 0, 1, null, 21275, null, 'ALLOWANCE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21314, 0, 1, null, 21275, null, 'REFINEMENTCAUSE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21315, 0, 1, null, 21275, null, 'PREFERENCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21316, 0, 1, null, 21275, null, 'PREFERENCESIZE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21317, 0, 1, null, 21275, null, 'SECURITY', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21318, 0, 1, null, 21275, null, 'UNKNOWNAMOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21319, 0, 1, null, 21275, null, 'PERIODYEAR', 3, 0, 0, '', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21320, 0, 1, null, 21275, null, 'SUPPORTUNDERTAKER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25039, 0, 1, null, 21275, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25040, 0, 1, null, 21275, null, 'REALID', 1, 0, 127, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25041, 0, 1, null, 21275, null, 'REWORKCAUSE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29955, 0, 1, null, 21275, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29956, 0, 1, null, 21275, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30623, 0, 1, null, 21275, null, 'PROTOCOLREASON', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23083, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35803, 0, 1, null, 21275, null, 'AVANSSIZE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35370, 0, 1, null, 21275, null, 'PREFERENCERUSPRODUCT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35804, 0, 1, null, 21275, null, 'PREFERENCECRIPPLE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35805, 0, 1, null, 21275, null, 'PREFERENCEPRISON', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35806, 0, 1, null, 21275, null, 'PURCHASESOCIALNKO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35807, 0, 1, null, 21275, null, 'SECURITYASIZE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35808, 0, 1, null, 21275, null, 'SECURITYTSIZE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- TENDERSOURCEORG
CALL FIELDSINFO_IMPORT(21357, 0, 1, null, 21356, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21358, 0, 1, null, 21356, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21359, 0, 1, null, 21356, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 21275, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21360, 0, 1, null, 21356, null, 'ORGID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21361, 0, 1, null, 21356, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21362, 0, 1, null, 21356, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21363, 0, 1, null, 21356, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21364, 0, 1, null, 21356, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21365, 0, 1, null, 21356, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21366, 0, 1, null, 21356, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21367, 0, 1, null, 21356, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21368, 0, 1, null, 21356, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29976, 0, 1, null, 21356, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29977, 0, 1, null, 21356, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- TENDERRESULTCAPTION
CALL FIELDSINFO_IMPORT(21370, 0, 1, null, 21369, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21371, 0, 1, null, 21369, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21372, 0, 1, null, 21369, null, 'INNERDOCNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21374, 0, 1, null, 21369, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21376, 0, 1, null, 21369, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21381, 0, 1, null, 21369, null, 'PROTOCOLNUMBER', 1, 0, 50, '№ протокола', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21382, 0, 1, null, 21369, null, 'PROTOCOLDATE', 6, 0, 0, 'Дата протокола', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21385, 0, 1, null, 21369, null, 'STATEORDERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21387, 0, 1, null, 21369, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21388, 0, 1, null, 21369, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21389, 0, 1, null, 21369, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21390, 0, 1, null, 21369, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21391, 0, 1, null, 21369, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21394, 0, 1, null, 21369, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21395, 0, 1, null, 21369, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21396, 0, 1, null, 21369, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21397, 0, 1, null, 21369, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21398, 0, 1, null, 21369, null, 'POSITIONNUMBERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21399, 0, 1, null, 21369, null, 'ACCEPTDATEFO', 6, 0, 0, 'Дата принятия Финансовым органом', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21400, 0, 1, null, 21369, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21401, 0, 1, null, 21369, null, 'AGREEMENTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21402, 0, 1, null, 21369, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21403, 0, 1, null, 21369, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21404, 0, 1, null, 21369, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21405, 0, 1, null, 21369, null, 'PRIORITY', 3, 0, 0, 'Позиция поставщика', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21408, 0, 1, null, 21369, null, 'ALLOWANCE', 6, 0, 0, 'Допустимое отклонение суммы (%)', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21413, 0, 1, null, 21369, null, 'RESULTDOCSTATE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21414, 0, 1, null, 21369, null, 'PURCHASEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23037, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21415, 0, 1, null, 21369, null, 'PURCHASELOTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23023, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21416, 0, 1, null, 21369, null, 'RESULTORDER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21417, 0, 1, null, 21369, null, 'RESULTSALETYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21418, 0, 1, null, 21369, null, 'PROTOCOLREASON', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23083, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21419, 0, 1, null, 21369, null, 'PROTOCOLDOCTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23082, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21420, 0, 1, null, 21369, null, 'PROTOCOLDECISION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21421, 0, 1, null, 21369, null, 'PROPOSALID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22990, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21422, 0, 1, null, 21369, null, 'PROPOSALDETID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23004, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27631, 0, 1, null, 21369, null, 'AGREEMENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19795, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27632, 0, 1, null, 21369, null, 'STATEORDER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19795, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27633, 0, 1, null, 21369, null, 'TENDERPRODUCTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 21028, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29974, 0, 1, null, 21369, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29975, 0, 1, null, 21369, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKEXCH_SUBSTITUTION
CALL FIELDSINFO_IMPORT(21425, 0, 1, null, 21424, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21426, 0, 1, null, 21424, null, 'PROCLEVEL', 3, 0, 0, 'Уровень обработки', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21427, 0, 1, null, 21424, null, 'ORDERRULES', 3, 0, 0, 'Сортировка', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21428, 0, 1, null, 21424, null, 'SOURCEMFO', 1, 0, 20, 'БИК', '', 20, '!999999999;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21429, 0, 1, null, 21424, null, 'SOURCEINN', 6, 0, 0, 'ИНН', '', 13, '9999999999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21430, 0, 1, null, 21424, null, 'SOURCEKPP', 1, 0, 20, 'КПП', '', 20, '!999999999;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21431, 0, 1, null, 21424, null, 'SOURCEACC', 1, 0, 20, 'Счет', '', 20, '!0AAAALLLLLLLLLLLLLLL;1;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21432, 0, 1, null, 21424, null, 'SOURCENOTE', 1, 0, 255, 'Назначение платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21433, 0, 1, null, 21424, null, 'SOURCEKD', 3, 0, 0, 'КД', '', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21434, 0, 1, null, 21424, null, 'SOURCEIFS', 3, 0, 0, 'ИФС', '', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21435, 0, 1, null, 21424, null, 'SOURCEKVSR', 1, 0, 3, 'КВСР', '', 3, '999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21436, 0, 1, null, 21424, null, 'SOURCEKFSR', 1, 0, 4, 'КФСР ', '', 4, '99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21437, 0, 1, null, 21424, null, 'SOURCEKESR', 1, 0, 3, 'КЭСР', '', 3, '9.9.9', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21438, 0, 1, null, 21424, null, 'SOURCEKVR', 1, 0, 3, 'КВР', '', 3, '999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21439, 0, 1, null, 21424, null, 'SOURCEKCSR', 1, 0, 7, 'КЦСР ', '', 7, '999.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21440, 0, 1, null, 21424, null, 'SOURCEDIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21441, 0, 1, null, 21424, null, 'SOURCEBUHPAYMENTCLS', 3, 0, 0, 'Бух. проводка', '', 11, '999', '', '', 0, 0, null, 0, 17069, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21442, 0, 1, null, 21424, null, 'SOURCEKDFULL', 1, 0, 20, 'Код дохода', '', 20, 'aaa.a.aa.aa.aaa.aa.aaaa.aaa;0;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21443, 0, 1, null, 21424, null, 'SOURCEFINSOURCEFULL', 1, 0, 20, 'Источник финансирования', '', 20, '999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21444, 0, 1, null, 21424, null, 'SOURCEDFACCOUNT', 1, 0, 20, 'Счет ФО', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21445, 0, 1, null, 21424, null, 'SOURCEPROCDOCCLASS', 3, 0, 0, 'Класс документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21446, 0, 1, null, 21424, null, 'DESTNOTE', 1, 0, 255, 'Назначение платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21447, 0, 1, null, 21424, null, 'DESTKD', 3, 0, 0, 'КД', '', 11, '999.9.99.99.999.99.9999.999', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21448, 0, 1, null, 21424, null, 'DESTSUBKD', 3, 0, 0, 'СубКД', '', 11, '99.99.99', '', '', 0, 0, null, 0, 16928, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21449, 0, 1, null, 21424, null, 'DESTREGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21450, 0, 1, null, 21424, null, 'DESTGOSNI', 3, 0, 0, 'ГосНИ', '', 11, '99.99', '', '', 0, 0, null, 0, 16948, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21451, 0, 1, null, 21424, null, 'DESTFACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21452, 0, 1, null, 21424, null, 'DESTMEANSTYPE', 1, 0, 6, 'Тип средств', '', 6, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21453, 0, 1, null, 21424, null, 'DESTDOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '9.99.9', '', '', 0, 0, null, 0, 16814, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21454, 0, 1, null, 21424, null, 'DESTFINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '9.99', '', '', 0, 0, null, 0, 16955, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21455, 0, 1, null, 21424, null, 'DESTBUHPAYMENTCLS', 3, 0, 0, 'Бух. проводка', '', 11, '999', '', '', 0, 0, null, 0, 17069, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21456, 0, 1, null, 21424, null, 'DESTIFS', 3, 0, 0, 'ИФС', '', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21457, 0, 1, null, 21424, null, 'DESTKVSR', 3, 0, 0, 'КВСР ', '', 11, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21458, 0, 1, null, 21424, null, 'DESTKFSR', 3, 0, 0, 'КФСР ', '', 11, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21459, 0, 1, null, 21424, null, 'DESTKESR', 3, 0, 0, 'КЭСР', '', 11, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21460, 0, 1, null, 21424, null, 'DESTKVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21461, 0, 1, null, 21424, null, 'DESTKCSR', 3, 0, 0, 'КЦСР ', '', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21462, 0, 1, null, 21424, null, 'DESTDIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21463, 0, 1, null, 21424, null, 'DESTKDFULL', 1, 0, 20, 'Код дохода', '', 20, '999.9.99.99.999.99.9999.999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21464, 0, 1, null, 21424, null, 'DESTFINSOURCEFULL', 1, 0, 20, 'Источник финансирования', '', 20, 'aaa.a.aa.aa.aaa.aa.aaaa.aaa;0;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21465, 0, 1, null, 21424, null, 'DESTPROCDOCCLASS', 3, 0, 0, 'Класс документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21466, 0, 1, null, 21424, null, 'DESTORG_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21467, 0, 1, null, 21424, null, 'DESTACC_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21468, 0, 1, null, 21424, null, 'NAMERULE', 1, 0, 50, 'Название правила', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21469, 0, 1, null, 21424, null, 'NAMEABLACTION', 1, 0, 50, 'Имя действия', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21470, 0, 1, null, 21424, null, 'NOTERULE', 1, 0, 255, 'Описание правила', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21471, 0, 1, null, 21424, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бухгалтерская операция', '', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21472, 0, 1, null, 21424, null, 'DESTFACT', 3, 0, 0, 'Мероприятие', '', 11, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21473, 0, 1, null, 21424, null, 'FORMTYPE', 3, 0, 0, 'Тип обработки', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21474, 0, 1, null, 21424, null, 'DESTDFACCOUNT', 3, 0, 0, 'Счет ФО', '', 11, '', '', '', 0, 0, null, 0, 17265, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21475, 0, 1, null, 21424, null, 'SOURCEFACIALACC_CLS', 1, 0, 12, 'Лицевой счет', '', 12, '999.99.999.9', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21476, 0, 1, null, 21424, null, 'SOURCEFEDERALFUNDSREF', 3, 0, 0, 'Реестр федеральных средств', '', 11, '', '', '', 0, 0, null, 0, 17668, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21477, 0, 1, null, 21424, null, 'DESTFEDERALFUNDSREF', 3, 0, 0, 'Реестр федеральных средств', '', 11, '', '', '', 0, 0, null, 0, 17668, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21478, 0, 1, null, 21424, null, 'SOURCETARGETCLS', 3, 0, 0, 'Код цели', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21479, 0, 1, null, 21424, null, 'DESTSUBKESR', 3, 0, 0, 'СубКЭСР', '', 11, '999.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26797, 0, 1, null, 21424, null, 'DESTOPERATIONDIRECTION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26798, 0, 1, null, 21424, null, 'DESTTRANSFERTCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26799, 0, 1, null, 21424, null, 'SOURCEDOCUMENTNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27615, 0, 1, null, 21424, null, 'DESTSUBSIDYCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27616, 0, 1, null, 21424, null, 'SOURCEFACIALACC_ORG_TYPE', 1, 0, 6, '', '', 6, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27822, 0, 1, null, 21424, null, 'DESTBUDALLOCATIONCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27823, 0, 1, null, 21424, null, 'DESTPAYPROMISECLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29905, 0, 1, null, 21424, null, 'SOURCEDEREFERENCE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25264, 0, 1, null, 21424, null, 'DESTFUNDSSOURCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22632, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25265, 0, 1, null, 21424, null, 'DISABLED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25266, 0, 1, null, 21424, null, 'SOURCEKOD_IST', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25267, 0, 1, null, 21424, null, 'SOURCESUMMAKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30705, 0, 1, null, 21424, null, 'SOURCESUBSIDYCLS', 1, 0, 9, '', '', 9, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30706, 0, 1, null, 21424, null, 'SOURCETRANSFERTCLS', 1, 0, 9, '', '', 9, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31631, 0, 1, null, 21424, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31632, 0, 1, null, 21424, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31633, 0, 1, null, 21424, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31634, 0, 1, null, 21424, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35314, 0, 1, null, 21424, null, 'DESTCLSTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35315, 0, 1, null, 21424, null, 'SOURCECLSTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BUDSTRUCTRIGHTS
CALL FIELDSINFO_IMPORT(21481, 0, 1, null, 21480, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21482, 0, 1, null, 21480, null, 'USERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21483, 0, 1, null, 21480, null, 'ISGROUP', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21484, 0, 1, null, 21480, null, 'RIGHTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20756, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21485, 0, 1, null, 21480, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21486, 0, 1, null, 21480, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21487, 0, 1, null, 21480, null, 'KCSR', 1, 0, 20, 'КЦСР', '', 20, '999.99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21488, 0, 1, null, 21480, null, 'KVR', 1, 0, 20, 'КВР', '', 20, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21489, 0, 1, null, 21480, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.9.9', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21490, 0, 1, null, 21480, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21491, 0, 1, null, 21480, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21492, 0, 1, null, 21480, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '99.99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21493, 0, 1, null, 21480, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '9.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21494, 0, 1, null, 21480, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21495, 0, 1, null, 21480, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21496, 0, 1, null, 21480, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21497, 0, 1, null, 21480, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21498, 0, 1, null, 21480, null, 'KFSRUP', 3, 0, 0, 'КФСР', '', 11, '99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21499, 0, 1, null, 21480, null, 'KVSRUP', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21500, 0, 1, null, 21480, null, 'KCSRUP', 1, 0, 20, 'КЦСР', '', 20, '999.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21501, 0, 1, null, 21480, null, 'KVRUP', 1, 0, 20, 'КВР', '', 20, '999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21502, 0, 1, null, 21480, null, 'KESRUP', 3, 0, 0, 'КЭСР', '', 11, '9.9.9', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21503, 0, 1, null, 21480, null, 'SUBKESRUP', 3, 0, 0, 'Суб. КЭСР', '', 11, '999.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21504, 0, 1, null, 21480, null, 'REGIONCLSUP', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21505, 0, 1, null, 21480, null, 'DIRECTIONCLSUP', 3, 0, 0, 'Направление', '', 11, '999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21506, 0, 1, null, 21480, null, 'FACTUP', 3, 0, 0, 'Мероприятие', '', 11, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21507, 0, 1, null, 21480, null, 'FINTYPEUP', 3, 0, 0, 'Тип финансирования', '', 11, '9.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21508, 0, 1, null, 21480, null, 'MEANSTYPEUP', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30615, 0, 1, null, 21480, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30616, 0, 1, null, 21480, null, 'TRANSFERTCLSUP', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31638, 0, 1, null, 21480, null, 'BUDALLOCATIONCLS', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31639, 0, 1, null, 21480, null, 'BUDALLOCATIONCLSUP', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31640, 0, 1, null, 21480, null, 'PAYPROMISECLS', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31641, 0, 1, null, 21480, null, 'PAYPROMISECLSUP', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DESCRDOCUMENTFIELDS
CALL FIELDSINFO_IMPORT(21521, 0, 1, null, 21520, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21522, 0, 1, null, 21520, null, 'VISUALFIELDTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21523, 0, 1, null, 21520, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21524, 0, 1, null, 21520, null, 'DBFIELDNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21525, 0, 1, null, 21520, null, 'SOURCENAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21526, 0, 1, null, 21520, null, 'DOCTYPEREF', 3, 0, 0, '', '', 11, '9.99.9', '', '', 0, 0, null, 1, 21541, 1, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21527, 0, 1, null, 21520, null, 'GROUPTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21528, 0, 1, null, 21520, null, 'FIELDSIZE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21529, 0, 1, null, 21520, null, 'FIELDMASK', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21530, 0, 1, null, 21520, null, 'VALUEREQUIRED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21531, 0, 1, null, 21520, null, 'DEFAULTVALUE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21532, 0, 1, null, 21520, null, 'VISIBLE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21533, 0, 1, null, 21520, null, 'DISPLAYLABEL', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21534, 0, 1, null, 21520, null, 'SOURCEDOCTYPEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21541, 1, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21535, 0, 1, null, 21520, null, 'SYSTEMFIELDTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21536, 0, 1, null, 21520, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21537, 0, 1, null, 21520, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21538, 0, 1, null, 21520, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21539, 0, 1, null, 21520, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21540, 0, 1, null, 21520, null, 'FIELDTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DESCRDOCUMENTTYPES
CALL FIELDSINFO_IMPORT(21542, 0, 1, null, 21541, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21543, 0, 1, null, 21541, null, 'PARENTDOCTYPEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21541, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21544, 0, 1, null, 21541, null, 'CLASSNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21545, 0, 1, null, 21541, null, 'KINDOFDOC', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21546, 0, 1, null, 21541, null, 'DBTABLE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21547, 0, 1, null, 21541, null, 'KINDOFFORM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21548, 0, 1, null, 21541, null, 'NAMESPACE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21549, 0, 1, null, 21541, null, 'CLASSGUID', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21550, 0, 1, null, 21541, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21551, 0, 1, null, 21541, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21552, 0, 1, null, 21541, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21553, 0, 1, null, 21541, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21554, 0, 1, null, 21541, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DIRECTIONCLS
CALL FIELDSINFO_IMPORT(21556, 0, 1, null, 21555, null, 'ID', 3, 0, 0, 'Ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21557, 0, 1, null, 21555, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21558, 0, 1, null, 21555, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21559, 0, 1, null, 21555, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24715, 0, 1, null, 21555, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24716, 0, 1, null, 21555, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36861, 0, 1, null, 21555, null, 'CODE', 1, 0, 20, 'Код', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36862, 0, 1, null, 21555, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- PROGRAMCODE
CALL FIELDSINFO_IMPORT(21561, 0, 1, null, 21560, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21562, 0, 1, null, 21560, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21563, 0, 1, null, 21560, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21564, 0, 1, null, 21560, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24936, 0, 1, null, 21560, null, 'SHORTNAME', 1, 0, 1024, 'Краткое имя', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30727, 0, 1, null, 21560, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30728, 0, 1, null, 21560, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- STATE_ACTIONJUMPS
CALL FIELDSINFO_IMPORT(21566, 0, 1, null, 21565, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21567, 0, 1, null, 21565, null, 'ACTIONREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 21569, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21568, 0, 1, null, 21565, null, 'JUMPREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20851, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25321, 0, 1, null, 21565, null, 'FILTERCODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22802, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25322, 0, 1, null, 21565, null, 'OPTIONS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33057, 0, 1, null, 21565, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33058, 0, 1, null, 21565, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33059, 0, 1, null, 21565, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33060, 0, 1, null, 21565, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- STATE_ACTIONS
CALL FIELDSINFO_IMPORT(21570, 0, 1, null, 21569, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21571, 0, 1, null, 21569, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21572, 0, 1, null, 21569, null, 'INVISIBLE', 3, 0, 0, 'Без кнопки', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21573, 0, 1, null, 21569, null, 'HINT', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21574, 0, 1, null, 21569, null, 'ICONNAME', 1, 0, 255, 'Имя картинки', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21575, 0, 1, null, 21569, null, 'ACTIONNAME', 1, 0, 255, 'Имя макроса', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21576, 0, 1, null, 21569, null, 'ACTPOSITION', 3, 0, 0, 'Позиция кнопки', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21577, 0, 1, null, 21569, null, 'DOCTYPEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20598, 1, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21578, 0, 1, null, 21569, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21579, 0, 1, null, 21569, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21580, 0, 1, null, 21569, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21581, 0, 1, null, 21569, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21582, 0, 1, null, 21569, null, 'ACTEVENT', 1, 0, 255, 'Событие на формирование параметров', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21583, 0, 1, null, 21569, null, 'BACKACTION', 3, 0, 0, 'Обратное действие', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21584, 0, 1, null, 21569, null, 'ISBUDGET', 3, 0, 0, 'Принадлежность', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24995, 0, 1, null, 21569, null, 'OPTIONSPATH', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31743, 0, 1, null, 21569, null, 'EXCHACCEPT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31744, 0, 1, null, 21569, null, 'EXCHPACKETREM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31745, 0, 1, null, 21569, null, 'EXCHPACKETSEND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31746, 0, 1, null, 21569, null, 'EXCHREJECT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- STATEJUMPHISTORY
CALL FIELDSINFO_IMPORT(21586, 0, 1, null, 21585, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21587, 0, 1, null, 21585, null, 'DOCID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21588, 0, 1, null, 21585, null, 'BEGINSTATEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21589, 0, 1, null, 21585, null, 'ENDSTATEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21590, 0, 1, null, 21585, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21591, 0, 1, null, 21585, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21592, 0, 1, null, 21585, null, 'BACKJUMP', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21593, 0, 1, null, 21585, null, 'EDSREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- UTFCTREE
CALL FIELDSINFO_IMPORT(21600, 0, 1, null, 21599, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21601, 0, 1, null, 21599, null, 'UTFCPARENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20983, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21602, 0, 1, null, 21599, null, 'UTFCKID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20983, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21603, 0, 1, null, 21599, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21604, 0, 1, null, 21599, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21605, 0, 1, null, 21599, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21606, 0, 1, null, 21599, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21607, 0, 1, null, 21599, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- UTYPEDFORMSREGCAPTION
CALL FIELDSINFO_IMPORT(21609, 0, 1, null, 21608, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21610, 0, 1, null, 21608, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21611, 0, 1, null, 21608, null, 'RULES', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21612, 0, 1, null, 21608, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21613, 0, 1, null, 21608, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21614, 0, 1, null, 21608, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21615, 0, 1, null, 21608, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21616, 0, 1, null, 21608, null, 'CONSTEMPLATE', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21617, 0, 1, null, 21608, null, 'CONSRULES', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21618, 0, 1, null, 21608, null, 'UTFINDEX', 3, 0, 0, 'Код формы ввода', '', 11, '99.99.99.99', '', '', 0, 0, null, 0, 20957, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27938, 0, 1, null, 21608, null, 'ISCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27939, 0, 1, null, 21608, null, 'TEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31785, 0, 1, null, 21608, null, 'MDKTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- UTYPEDFORMSREGDETAIL
CALL FIELDSINFO_IMPORT(21620, 0, 1, null, 21619, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21621, 0, 1, null, 21619, null, 'UTFRINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 21608, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21622, 0, 1, null, 21619, null, 'TYPEDFORM', 3, 0, 0, 'Форма ввода', '', 11, '99.99.99.99', '', '', 0, 0, null, 1, 20957, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21623, 0, 1, null, 21619, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21624, 0, 1, null, 21619, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21625, 0, 1, null, 21619, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21626, 0, 1, null, 21619, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27940, 0, 1, null, 21619, null, 'FORMTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27941, 0, 1, null, 21619, null, 'ISCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27942, 0, 1, null, 21619, null, 'REGTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 1, 21608, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31786, 0, 1, null, 21619, null, 'BEGINDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31787, 0, 1, null, 21619, null, 'ENDDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- BUHACCPLAN
CALL FIELDSINFO_IMPORT(21628, 0, 1, null, 21627, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21629, 0, 1, null, 21627, null, 'BUHACC', 3, 0, 0, 'Бух счет', '', 7, '999.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21630, 0, 1, null, 21627, null, 'ECCLS', 3, 0, 0, 'КОСГУ счета', '', 4, '999', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21631, 0, 1, null, 21627, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21632, 0, 1, null, 21627, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21633, 0, 1, null, 21627, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26745, 0, 1, null, 21627, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26746, 0, 1, null, 21627, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- BUHOPERATIONCLS
CALL FIELDSINFO_IMPORT(21635, 0, 1, null, 21634, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 7, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21636, 0, 1, null, 21634, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21637, 0, 1, null, 21634, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21638, 0, 1, null, 21634, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21639, 0, 1, null, 21634, null, 'CORRECTIONFLAG', 3, 0, 0, 'Исправляющая операция', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24704, 0, 1, null, 21634, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24705, 0, 1, null, 21634, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26747, 0, 1, null, 21634, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26748, 0, 1, null, 21634, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29906, 0, 1, null, 21634, null, 'COUNTDETAILRECORDS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36047, 0, 1, null, 21634, null, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BALANCECLS
CALL FIELDSINFO_IMPORT(21641, 0, 1, null, 21640, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21642, 0, 1, null, 21640, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21643, 0, 1, null, 21640, null, 'SHORTNAME', 1, 0, 10, 'Обозначение', '', 10, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21644, 0, 1, null, 21640, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21645, 0, 1, null, 21640, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- ACCOUNTSCONFORMITY
CALL FIELDSINFO_IMPORT(21647, 0, 1, null, 21646, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21648, 0, 1, null, 21646, null, 'ACCOUNT15N', 3, 0, 0, 'Счет 15н', '', 11, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21649, 0, 1, null, 21646, null, 'ACCOUNT70N', 3, 0, 0, 'Счет 70н', '', 11, '', '', '', 0, 0, null, 0, 21627, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21650, 0, 1, null, 21646, null, 'BALANCECLS', 3, 0, 0, 'Баланс', '', 11, '9.9', '', '', 0, 0, null, 1, 21640, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BUHACCCORR
CALL FIELDSINFO_IMPORT(24703, 0, 1, null, 21651, null, 'HEADACTIVITYKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21652, 0, 1, null, 21651, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21653, 0, 1, null, 21651, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бухгалтерская операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21654, 0, 1, null, 21651, null, 'DEBITACCREF', 3, 0, 0, 'Дебит', '', 11, '', '', '', 0, 0, null, 1, 21627, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21655, 0, 1, null, 21651, null, 'CREDITACCREF', 3, 0, 0, 'Кредит', '', 11, '', '', '', 0, 0, null, 1, 21627, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21656, 0, 1, null, 21651, null, 'BALANCECLS', 3, 0, 0, 'Баланс', '', 11, '9.9', '', '', 0, 0, null, 1, 21640, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21657, 0, 1, null, 21651, null, 'DEBITBUDCLSKIND', 3, 0, 0, 'Источник БК дебета ', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21658, 0, 1, null, 21651, null, 'CREDITBUDCLSKIND', 3, 0, 0, 'Источник БК кредита', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21659, 0, 1, null, 21651, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21660, 0, 1, null, 21651, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21661, 0, 1, null, 21651, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21662, 0, 1, null, 21651, null, 'BACKNAME', 1, 0, 1024, 'Наименование обратной проводки', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21663, 0, 1, null, 21651, null, 'CORRECTIONFLAG', 3, 0, 0, 'Инверсия знака суммы проводки', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26545, 0, 1, null, 21651, null, 'ACTIVITYKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- INTERFACESBUHOP
CALL FIELDSINFO_IMPORT(21665, 0, 1, null, 21664, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21666, 0, 1, null, 21664, null, 'INTERFACECLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21667, 0, 1, null, 21664, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бухгалтерская операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21668, 0, 1, null, 21664, null, 'BUHOPERATIONPRIORITY', 3, 0, 0, 'Порядок', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21669, 0, 1, null, 21664, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21670, 0, 1, null, 21664, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21671, 0, 1, null, 21664, null, 'DETAILNUMBER', 3, 0, 0, 'Номер дет.', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- TRANSFER15NTO70N
CALL FIELDSINFO_IMPORT(21673, 0, 1, null, 21672, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21674, 0, 1, null, 21672, null, 'DEBIT', 3, 0, 0, 'Счет дебет 15н', '', 11, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21675, 0, 1, null, 21672, null, 'CREDIT', 3, 0, 0, 'Счет кредит 15н', '', 11, '9999.99', '', '', 0, 0, null, 1, 16920, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21676, 0, 1, null, 21672, null, 'DEBITECCLS', 3, 0, 0, 'Экономическая классификация по дебету', '', 11, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21677, 0, 1, null, 21672, null, 'CREDITECCLS', 3, 0, 0, 'Экономическая классификация по кредиту', '', 11, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21678, 0, 1, null, 21672, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бухгалтерская операция', '', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21679, 0, 1, null, 21672, null, 'DIRECTION', 3, 0, 0, 'Бух проводка 15н', '', 11, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21680, 0, 1, null, 21672, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UNIONNOTIFYCAPTION
CALL FIELDSINFO_IMPORT(21682, 0, 1, null, 21681, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21683, 0, 1, null, 21681, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21684, 0, 1, null, 21681, null, 'DOCNUMBER', 1, 0, 50, '№ документа', 'Номер документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21685, 0, 1, null, 21681, null, 'NOTIFYNUMBER', 3, 0, 0, 'Номер документа', 'Порядковый номер документа по распорядителю', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21686, 0, 1, null, 21681, null, 'INPUTDATE', 6, 0, 0, 'Дата формирования', 'Дата ввода', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21687, 0, 1, null, 21681, null, 'DFACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21688, 0, 1, null, 21681, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21689, 0, 1, null, 21681, null, 'ACCEPTDATEFK', 6, 0, 0, 'Дата принятия ФК', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21690, 0, 1, null, 21681, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21691, 0, 1, null, 21681, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21692, 0, 1, null, 21681, null, 'DOCUMENTFORMAT', 3, 0, 0, 'Формат документа', 'Формат документа', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21693, 0, 1, null, 21681, null, 'ORG_REF', 3, 0, 0, 'Организация', 'Организация', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21694, 0, 1, null, 21681, null, 'NOTIFYTYPE', 3, 0, 0, 'Тип уведомления', 'Тип уведомления', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21695, 0, 1, null, 21681, null, 'NOTE', 1, 0, 255, 'Приложение', 'Приложение', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21696, 0, 1, null, 21681, null, 'KFD', 1, 0, 20, 'Код приложения по КФД', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21697, 0, 1, null, 21681, null, 'SPECIALNOTE', 1, 0, 1024, 'Специальные указания', 'Специальные указания', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21698, 0, 1, null, 21681, null, 'SENDERID', 3, 0, 0, 'Код отправителя документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21699, 0, 1, null, 21681, null, 'SENDERRECORDID', 3, 0, 0, 'Код УРМ документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21700, 0, 1, null, 21681, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', 'Статус электронной цифровой подписи', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21701, 0, 1, null, 21681, null, 'DOCSTATEREF', 3, 0, 0, 'СостояниеДокумента', 'Состояние документа', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21702, 0, 1, null, 21681, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21703, 0, 1, null, 21681, null, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21704, 0, 1, null, 21681, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21705, 0, 1, null, 21681, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзмененийДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21706, 0, 1, null, 21681, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21707, 0, 1, null, 21681, null, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21708, 0, 1, null, 21681, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', 'Текст причины отклонения документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25049, 0, 1, null, 21681, null, 'CLSTYPE', 3, 0, 0, 'Тип классификации', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25050, 0, 1, null, 21681, null, 'DATE_PP', 6, 0, 0, 'Дата заявки на кассовый расход', 'Дата заявки на кассовый расход', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25051, 0, 1, null, 21681, null, 'DATE_UTV_BA', 6, 0, 0, 'Дата введения в действие ассигнований', 'Дата введения в действие ассигнований', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25052, 0, 1, null, 21681, null, 'DATE_UTV_LBO', 6, 0, 0, 'Дата введения в действие ЛБО', 'Дата введения в действие ЛБО', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25053, 0, 1, null, 21681, null, 'DATE_UTV_POF', 6, 0, 0, 'Дата введения в действие ОФ', 'Дата введения в действие ОФ', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25054, 0, 1, null, 21681, null, 'DATE_UTV_PP', 6, 0, 0, 'Дата введения в действие РР', 'Дата введения в действие РР', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25055, 0, 1, null, 21681, null, 'DATE_UTV_REESTR', 6, 0, 0, 'Дата введения в действие реестра', 'Дата введения в действие реестра', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25056, 0, 1, null, 21681, null, 'INPUTMONTH', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25057, 0, 1, null, 21681, null, 'NOM_PP', 1, 0, 20, 'Номер заявки на кассовый расход', 'Номер заявки на кассовый расход', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25058, 0, 1, null, 21681, null, 'REESTRDATE', 6, 0, 0, 'Дата реестра', 'Дата реестра', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25059, 0, 1, null, 21681, null, 'REESTRNUMBER', 1, 0, 20, '№ реестра', 'Номер реестра', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25060, 0, 1, null, 21681, null, 'SPECIALNOTECODE', 1, 0, 20, 'Код специальных указаний', 'Код специальных указаний', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25061, 0, 1, null, 21681, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25062, 0, 1, null, 21681, null, 'TIP_RR', 3, 0, 0, 'Тип расходного расписания', 'Тип расходного расписания', 3, '00', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32447, 0, 1, null, 21681, null, 'LASTEXTRCHANGE', 11, 0, 0, 'Дата экстренного изменения', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- UNIONNOTIFYDETAIL
CALL FIELDSINFO_IMPORT(21710, 0, 1, null, 21709, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21711, 0, 1, null, 21709, null, 'RECORDINDEX', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 0, 21681, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21712, 0, 1, null, 21709, null, 'KVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21713, 0, 1, null, 21709, null, 'KCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21714, 0, 1, null, 21709, null, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21715, 0, 1, null, 21709, null, 'KVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21716, 0, 1, null, 21709, null, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21717, 0, 1, null, 21709, null, 'IFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21718, 0, 1, null, 21709, null, 'ACTIVITYKIND', 3, 0, 0, 'Вид деятельности', 'Вид деятельности', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21719, 0, 1, null, 21709, null, 'TARGETCLS', 3, 0, 0, 'Код цели', 'Код цели', 4, '999', '', '', 0, 0, null, 0, 22385, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21720, 0, 1, null, 21709, null, 'CLSTYPE', 3, 0, 0, 'Признак классификации', 'Признак классификации: 0 - расходная (по умолчанию),1 - источниковая', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21721, 0, 1, null, 21709, null, 'NOTE', 1, 0, 255, 'Примечание', 'Примечание', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21722, 0, 1, null, 21709, null, 'SUMMALIMIT', 6, 0, 0, 'в том числе текущее изменение', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21723, 0, 1, null, 21709, null, 'SUMMAASSIGNMENT', 6, 0, 0, 'в том числе текущее изменение', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21724, 0, 1, null, 21709, null, 'SUMMAFIN', 6, 0, 0, 'Сумма ОФ', 'Сумма ОФ', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21725, 0, 1, null, 21709, null, 'SUMMALIMITYEAR', 6, 0, 0, 'на год', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21726, 0, 1, null, 21709, null, 'SUMMAASSIGNMENTYEAR', 6, 0, 0, 'на год', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21727, 0, 1, null, 21709, null, 'SUMMAFINYEAR', 6, 0, 0, 'с начала года', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21728, 0, 1, null, 21709, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21729, 0, 1, null, 21709, null, 'SENDERID', 3, 0, 0, 'Код отправителя записи', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21730, 0, 1, null, 21709, null, 'SENDERRECORDID', 3, 0, 0, 'Код УРМ записи', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21731, 0, 1, null, 21709, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21732, 0, 1, null, 21709, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21733, 0, 1, null, 21709, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21734, 0, 1, null, 21709, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзменений', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21735, 0, 1, null, 21709, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27636, 0, 1, null, 21709, null, 'SUBSIDYCLS', 3, 0, 0, 'Код субсидииКлюч', '', 12, '999.99.9999', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27637, 0, 1, null, 21709, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средствКлюч', '', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27930, 0, 1, null, 21709, null, 'BUDALLOCATIONCLS', 3, 0, 0, '', '', 9, '', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27931, 0, 1, null, 21709, null, 'PAYPROMISECLS', 3, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25357, 0, 1, null, 21709, null, 'BA_LBO_FLAG', 3, 0, 0, 'ПринадлежностьБА_ЛБО', 'Признак определяющий является ли документ лимитом или бюджетными ассигнованием(0- “БА, ЛБО”, 1- “БА”, 2- “ЛБО”)', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25358, 0, 1, null, 21709, null, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25359, 0, 1, null, 21709, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 4, '', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25360, 0, 1, null, 21709, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 9, '', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25361, 0, 1, null, 21709, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 9, '', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25362, 0, 1, null, 21709, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 9, '', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25363, 0, 1, null, 21709, null, 'STIMATEID', 3, 0, 0, 'Код документа(записи) в базе АС Смета', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25364, 0, 1, null, 21709, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 10, '', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25365, 0, 1, null, 21709, null, 'SUMMAYEAR1', 6, 0, 0, 'Сумма ассигнований на первый год', 'Сумма ассигнований на первый год', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25366, 0, 1, null, 21709, null, 'SUMMAYEAR2', 6, 0, 0, 'Сумма ассигнований на второй год', 'Сумма ассигнований на второй год', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25367, 0, 1, null, 21709, null, 'SUMMAYEAR3', 6, 0, 0, 'Сумма ассигнований на второй год', 'Сумма ассигнований на третий год', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36850, 0, 1, null, 21709, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования (ключ)', '', 9, '', '', '', 0, 0, null, 0, 16955, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- STATE_JUMPCONTROL
CALL FIELDSINFO_IMPORT(21877, 0, 1, null, 21876, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21878, 0, 1, null, 21876, null, 'JUMPREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 20851, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21879, 0, 1, null, 21876, null, 'CONTROLCODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21880, 0, 1, null, 21876, null, 'CONTROLOPTIONS', 3, 0, 0, 'Предупреждение', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21881, 0, 1, null, 21876, null, 'CONDITION', 1, 0, 1024, 'Параметры', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21882, 0, 1, null, 21876, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21883, 0, 1, null, 21876, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21884, 0, 1, null, 21876, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21885, 0, 1, null, 21876, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21886, 0, 1, null, 21876, null, 'RECORDTYPE', 3, 0, 0, 'Тип действия', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21887, 0, 1, null, 21876, null, 'EXECTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21888, 0, 1, null, 21876, null, 'EXECORDER', 3, 0, 0, 'Порядок', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21889, 0, 1, null, 21876, null, 'ENABLED', 3, 0, 0, 'Включить', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21890, 0, 1, null, 21876, null, 'ACTIONREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21569, 1, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21891, 0, 1, null, 21876, null, 'FILTERCODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22802, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21892, 0, 1, null, 21876, null, 'FILTERNOTE', 1, 0, 255, 'Причина фильтрации', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21893, 0, 1, null, 21876, null, 'ENDSTATEREF', 3, 0, 0, 'Конечное состояние', '', 11, '99.99.99', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21894, 0, 1, null, 21876, null, 'REFERENCEREF', 3, 0, 0, 'Внешняя связь', '', 11, '00.00.000.00', '', '', 0, 0, null, 0, 22428, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21895, 0, 1, null, 21876, null, 'STATICLINKREF', 3, 0, 0, 'Внутреняя связь', '', 11, '00.00.000.00', '', '', 0, 0, null, 0, 22787, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25323, 0, 1, null, 21876, null, 'BEGINSTATEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25324, 0, 1, null, 21876, null, 'ELEMENTSCENARIOREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23088, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25325, 0, 1, null, 21876, null, 'SCENARIOREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23088, 1, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30620, 0, 1, null, 21876, null, 'ISBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- CONTACTPERSONS
CALL FIELDSINFO_IMPORT(21897, 0, 1, null, 21896, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21898, 0, 1, null, 21896, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21899, 0, 1, null, 21896, null, 'ORGREF', 3, 0, 0, 'Организация', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21900, 0, 1, null, 21896, null, 'NAME', 1, 0, 255, 'Ф.И.О контактного лица', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21901, 0, 1, null, 21896, null, 'HOLDRANK', 1, 0, 255, 'Должность', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21902, 0, 1, null, 21896, null, 'PHONENO', 1, 0, 255, 'Номер телефона', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21903, 0, 1, null, 21896, null, 'EMAIL', 1, 0, 50, 'E-mail контактного лица', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21904, 0, 1, null, 21896, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21905, 0, 1, null, 21896, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 9, '99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21906, 0, 1, null, 21896, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21907, 0, 1, null, 21896, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21908, 0, 1, null, 21896, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21909, 0, 1, null, 21896, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21910, 0, 1, null, 21896, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21911, 0, 1, null, 21896, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21912, 0, 1, null, 21896, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21913, 0, 1, null, 21896, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21914, 0, 1, null, 21896, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21915, 0, 1, null, 21896, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- TENDERCONTACTS
CALL FIELDSINFO_IMPORT(21917, 0, 1, null, 21916, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21918, 0, 1, null, 21916, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 21275, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21919, 0, 1, null, 21916, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21920, 0, 1, null, 21916, null, 'CONTACTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 21896, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21921, 0, 1, null, 21916, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21922, 0, 1, null, 21916, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21923, 0, 1, null, 21916, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21924, 0, 1, null, 21916, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21925, 0, 1, null, 21916, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21926, 0, 1, null, 21916, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21927, 0, 1, null, 21916, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21928, 0, 1, null, 21916, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25042, 0, 1, null, 21916, null, 'STATUS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29957, 0, 1, null, 21916, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29958, 0, 1, null, 21916, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- YARDSTICKS
CALL FIELDSINFO_IMPORT(21930, 0, 1, null, 21929, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21931, 0, 1, null, 21929, null, 'NAME', 1, 0, 4000, 'Наименование критерия/требования', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21932, 0, 1, null, 21929, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21933, 0, 1, null, 21929, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21934, 0, 1, null, 21929, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21935, 0, 1, null, 21929, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21936, 0, 1, null, 21929, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21937, 0, 1, null, 21929, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21938, 0, 1, null, 21929, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21939, 0, 1, null, 21929, null, 'STATUS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21940, 0, 1, null, 21929, null, 'CONDITIONREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21941, 0, 1, null, 21929, null, 'YARDTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- TENDERYARDSTICKS
CALL FIELDSINFO_IMPORT(21943, 0, 1, null, 21942, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21944, 0, 1, null, 21942, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 21275, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21945, 0, 1, null, 21942, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21946, 0, 1, null, 21942, null, 'YARDSTICKREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21929, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21947, 0, 1, null, 21942, null, 'STARTVALUE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21948, 0, 1, null, 21942, null, 'YARDSTICKTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21949, 0, 1, null, 21942, null, 'NOTE', 1, 0, 1000, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21950, 0, 1, null, 21942, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21951, 0, 1, null, 21942, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21952, 0, 1, null, 21942, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21953, 0, 1, null, 21942, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21954, 0, 1, null, 21942, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21955, 0, 1, null, 21942, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21956, 0, 1, null, 21942, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21957, 0, 1, null, 21942, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21958, 0, 1, null, 21942, null, 'LOTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22697, 1, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21959, 0, 1, null, 21942, null, 'UYARDSTICK', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21960, 0, 1, null, 21942, null, 'YARDSTICKNOTE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21961, 0, 1, null, 21942, null, 'PONDERABILITY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21962, 0, 1, null, 21942, null, 'YSTERMSLIMIT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21929, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21963, 0, 1, null, 21942, null, 'PRODUCTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21028, 1, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29982, 0, 1, null, 21942, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29983, 0, 1, null, 21942, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- TENDERSUPPLEMENTS
CALL FIELDSINFO_IMPORT(21965, 0, 1, null, 21964, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21966, 0, 1, null, 21964, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 21275, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21967, 0, 1, null, 21964, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21968, 0, 1, null, 21964, null, 'DOCTYPECLS', 3, 0, 0, '', '', 7, '', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21969, 0, 1, null, 21964, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21970, 0, 1, null, 21964, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21971, 0, 1, null, 21964, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21972, 0, 1, null, 21964, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21973, 0, 1, null, 21964, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21974, 0, 1, null, 21964, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21975, 0, 1, null, 21964, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21976, 0, 1, null, 21964, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21977, 0, 1, null, 21964, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29980, 0, 1, null, 21964, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29981, 0, 1, null, 21964, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ENUMS
CALL FIELDSINFO_IMPORT(21979, 0, 1, null, 21978, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21980, 0, 1, null, 21978, null, 'NAME', 1, 0, 255, 'Имя перечисления', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21981, 0, 1, null, 21978, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет владельца', '', 11, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21982, 0, 1, null, 21978, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21983, 0, 1, null, 21978, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21984, 0, 1, null, 21978, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21985, 0, 1, null, 21978, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21986, 0, 1, null, 21978, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21987, 0, 1, null, 21978, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21988, 0, 1, null, 21978, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21989, 0, 1, null, 21978, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24724, 0, 1, null, 21978, null, 'ISSYSTEM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ENUMVALUES
CALL FIELDSINFO_IMPORT(21991, 0, 1, null, 21990, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21992, 0, 1, null, 21990, null, 'ENUMREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 21978, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21993, 0, 1, null, 21990, null, 'VAL', 3, 0, 0, 'Значение перечисляемого типа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21994, 0, 1, null, 21990, null, 'NAME', 1, 0, 255, 'Название значения', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21995, 0, 1, null, 21990, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21996, 0, 1, null, 21990, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21997, 0, 1, null, 21990, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21998, 0, 1, null, 21990, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(21999, 0, 1, null, 21990, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22000, 0, 1, null, 21990, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22001, 0, 1, null, 21990, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- STATE_CASCADEACTIONS
CALL FIELDSINFO_IMPORT(22003, 0, 1, null, 22002, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22004, 0, 1, null, 22002, null, 'SOURCEJUMPREF', 3, 0, 0, 'Ссылка на переход', '', 11, '', '', '', 0, 0, null, 1, 20851, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22005, 0, 1, null, 22002, null, 'MASTERFIELDNAME', 1, 0, 255, 'Ключевое поле заголовка', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22006, 0, 1, null, 22002, null, 'ENABLED', 3, 0, 0, 'Доступно/недоступно', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22007, 0, 1, null, 22002, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22008, 0, 1, null, 22002, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22009, 0, 1, null, 22002, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22010, 0, 1, null, 22002, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22011, 0, 1, null, 22002, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22012, 0, 1, null, 22002, null, 'DESTACTIONNAME', 1, 0, 255, 'Имя', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22013, 0, 1, null, 22002, null, 'DESTDOCTYPEREF', 3, 0, 0, 'Тип документа', '', 11, '99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- LAYERTYPES
CALL FIELDSINFO_IMPORT(22015, 0, 1, null, 22014, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22016, 0, 1, null, 22014, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22017, 0, 1, null, 22014, null, 'TABLENAME', 1, 0, 255, 'Имя таблицы', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22018, 0, 1, null, 22014, null, 'READONLY', 3, 0, 0, 'Только чтение', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22019, 0, 1, null, 22014, null, 'USEVERSIONS', 3, 0, 0, 'Многоверсионный слой', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22020, 0, 1, null, 22014, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22021, 0, 1, null, 22014, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22022, 0, 1, null, 22014, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22023, 0, 1, null, 22014, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LAYERS
CALL FIELDSINFO_IMPORT(22025, 0, 1, null, 22024, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22026, 0, 1, null, 22024, null, 'NAME', 1, 0, 255, 'Имя слоя', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22027, 0, 1, null, 22024, null, 'ALIAS', 1, 0, 255, 'Алиас', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22028, 0, 1, null, 22024, null, 'LAYERTYPE', 3, 0, 0, 'Тип слоя', '', 11, '99.99.99', '', '', 0, 0, null, 1, 22014, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22029, 0, 1, null, 22024, null, 'TABLENAME', 1, 0, 255, 'Имя таблицы', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22030, 0, 1, null, 22024, null, 'READONLY', 3, 0, 0, 'Только чтение', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22031, 0, 1, null, 22024, null, 'USEVERSIONS', 3, 0, 0, 'Многоверсионный слой', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22032, 0, 1, null, 22024, null, 'MACROSNAME', 1, 0, 255, 'Имя макроса', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22033, 0, 1, null, 22024, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22034, 0, 1, null, 22024, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22035, 0, 1, null, 22024, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22036, 0, 1, null, 22024, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22037, 0, 1, null, 22024, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22038, 0, 1, null, 22024, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22039, 0, 1, null, 22024, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22040, 0, 1, null, 22024, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22041, 0, 1, null, 22024, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24914, 0, 1, null, 22024, null, 'NOTE', 1, 0, 1024, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24915, 0, 1, null, 22024, null, 'VERSION', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31708, 0, 1, null, 22024, null, 'ISDEPRECATED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31709, 0, 1, null, 22024, null, 'ISGENERALIZED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- LAYERFIELDS
CALL FIELDSINFO_IMPORT(22043, 0, 1, null, 22042, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22044, 0, 1, null, 22042, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22045, 0, 1, null, 22042, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22046, 0, 1, null, 22042, null, 'FIELDNAME', 1, 0, 255, 'Имя поля', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22047, 0, 1, null, 22042, null, 'DISPLAYLABEL', 1, 0, 255, 'Название колонки', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22048, 0, 1, null, 22042, null, 'DBNAME', 1, 0, 255, 'Имя поля в БД', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22049, 0, 1, null, 22042, null, 'FIELDTYPE', 3, 0, 0, 'Тип поля', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22050, 0, 1, null, 22042, null, 'FIELDROLE', 3, 0, 0, 'Роль поля', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22051, 0, 1, null, 22042, null, 'DEFAULTVALUE', 1, 0, 255, 'Значение по-умолчанию', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22052, 0, 1, null, 22042, null, 'READONLY', 3, 0, 0, 'Редактируемость', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22053, 0, 1, null, 22042, null, 'REQUIRED', 3, 0, 0, 'Обязательное', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22054, 0, 1, null, 22042, null, 'HIDDEN', 3, 0, 0, 'Скрытое', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22055, 0, 1, null, 22042, null, 'FIELDSIZE', 3, 0, 0, 'Размер поля', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22056, 0, 1, null, 22042, null, 'MASK', 1, 0, 20, 'Маска', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22057, 0, 1, null, 22042, null, 'CLSNAME', 1, 0, 255, 'Имя классификатора', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22058, 0, 1, null, 22042, null, 'ENUMREF', 3, 0, 0, 'Перечисление', '', 11, '', '', '', 0, 0, null, 0, 21978, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22059, 0, 1, null, 22042, null, 'HANDLERNAME', 1, 0, 255, 'Обработчик разыменовок', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22060, 0, 1, null, 22042, null, 'LINKEDFIELD', 3, 0, 0, 'Главное поле', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22061, 0, 1, null, 22042, null, 'LINKEDNAME', 1, 0, 255, 'Тип разыменовки', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22062, 0, 1, null, 22042, null, 'AGGREGATEFUNC', 1, 0, 20, 'Агрегирующая функция', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22063, 0, 1, null, 22042, null, 'FORMULA1', 1, 0, 512, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22064, 0, 1, null, 22042, null, 'FORMULA2', 1, 0, 512, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22065, 0, 1, null, 22042, null, 'FIELDPOSITION', 3, 0, 0, 'Позиция', '', 11, '99.99.99.99.9', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22066, 0, 1, null, 22042, null, 'WIDTH', 3, 0, 0, 'Ширина', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22067, 0, 1, null, 22042, null, 'VALIDATEVALUES', 3, 0, 0, 'Проверять значение', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22068, 0, 1, null, 22042, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22069, 0, 1, null, 22042, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22070, 0, 1, null, 22042, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22071, 0, 1, null, 22042, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22072, 0, 1, null, 22042, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22073, 0, 1, null, 22042, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22074, 0, 1, null, 22042, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24912, 0, 1, null, 22042, null, 'AGGREGATIONTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24913, 0, 1, null, 22042, null, 'NATURALKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30726, 0, 1, null, 22042, null, 'CLSSTOREDNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35057, 0, 1, null, 22042, null, 'FIELDTYPEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- LAYERCONTROLRULES
CALL FIELDSINFO_IMPORT(22076, 0, 1, null, 22075, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22077, 0, 1, null, 22075, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22078, 0, 1, null, 22075, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22079, 0, 1, null, 22075, null, 'CONTROLRULE', 1, 0, 255, 'Соотношение', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22080, 0, 1, null, 22075, null, 'CONTROLMESSAGE', 1, 0, 255, 'Текст ошибки', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22081, 0, 1, null, 22075, null, 'SOFTCONTROL', 3, 0, 0, 'Мягкая проверка', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22082, 0, 1, null, 22075, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22083, 0, 1, null, 22075, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22084, 0, 1, null, 22075, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22085, 0, 1, null, 22075, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22086, 0, 1, null, 22075, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22087, 0, 1, null, 22075, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22088, 0, 1, null, 22075, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LAYERRELATIONS
CALL FIELDSINFO_IMPORT(22090, 0, 1, null, 22089, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22091, 0, 1, null, 22089, null, 'RELATIONTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22092, 0, 1, null, 22089, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22093, 0, 1, null, 22089, null, 'LEFTLAYER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22024, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22094, 0, 1, null, 22089, null, 'RIGHTLAYER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22024, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22095, 0, 1, null, 22089, null, 'MACROSNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22096, 0, 1, null, 22089, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22097, 0, 1, null, 22089, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22098, 0, 1, null, 22089, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22099, 0, 1, null, 22089, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22100, 0, 1, null, 22089, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22101, 0, 1, null, 22089, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22102, 0, 1, null, 22089, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22103, 0, 1, null, 22089, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22104, 0, 1, null, 22089, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LAYERFIELDSRELATIONS
CALL FIELDSINFO_IMPORT(22106, 0, 1, null, 22105, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22107, 0, 1, null, 22105, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 22089, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22108, 0, 1, null, 22105, null, 'RELATIONTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22109, 0, 1, null, 22105, null, 'LEFTFIELDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22042, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22110, 0, 1, null, 22105, null, 'RIGHTFIELDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22042, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22111, 0, 1, null, 22105, null, 'LEFTAGRFUNCTION', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22112, 0, 1, null, 22105, null, 'RIGHTAGRFUNCTION', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22113, 0, 1, null, 22105, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22114, 0, 1, null, 22105, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22115, 0, 1, null, 22105, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22116, 0, 1, null, 22105, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22117, 0, 1, null, 22105, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22118, 0, 1, null, 22105, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22119, 0, 1, null, 22105, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LAYERTASKS
CALL FIELDSINFO_IMPORT(22121, 0, 1, null, 22120, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22122, 0, 1, null, 22120, null, 'TASKNUMBER', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22123, 0, 1, null, 22120, null, 'LAYERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22024, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22124, 0, 1, null, 22120, null, 'LAYERVERSION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22125, 0, 1, null, 22120, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22126, 0, 1, null, 22120, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22127, 0, 1, null, 22120, null, 'DEADLINEDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22128, 0, 1, null, 22120, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22129, 0, 1, null, 22120, null, 'REJECTDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22130, 0, 1, null, 22120, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22131, 0, 1, null, 22120, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 11, '', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22132, 0, 1, null, 22120, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22133, 0, 1, null, 22120, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22134, 0, 1, null, 22120, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22135, 0, 1, null, 22120, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22136, 0, 1, null, 22120, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22137, 0, 1, null, 22120, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22138, 0, 1, null, 22120, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22139, 0, 1, null, 22120, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22140, 0, 1, null, 22120, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22141, 0, 1, null, 22120, null, 'OWNERUSER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16708, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22142, 0, 1, null, 22120, null, 'EXECUTERUSER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16708, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- LAYERDATA
CALL FIELDSINFO_IMPORT(22144, 0, 1, null, 22143, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22145, 0, 1, null, 22143, null, 'LAYERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22024, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22146, 0, 1, null, 22143, null, 'LAYERVERSION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22147, 0, 1, null, 22143, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22148, 0, 1, null, 22143, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22149, 0, 1, null, 22143, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22150, 0, 1, null, 22143, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22151, 0, 1, null, 22143, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22152, 0, 1, null, 22143, null, 'KCSR', 1, 0, 20, 'КЦСР', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22153, 0, 1, null, 22143, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22154, 0, 1, null, 22143, null, 'FINSOURCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22155, 0, 1, null, 22143, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22156, 0, 1, null, 22143, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22157, 0, 1, null, 22143, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22158, 0, 1, null, 22143, null, 'PRODUCTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 20694, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22159, 0, 1, null, 22143, null, 'INTFIELD00', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22160, 0, 1, null, 22143, null, 'INTFIELD01', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22161, 0, 1, null, 22143, null, 'INTFIELD02', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22162, 0, 1, null, 22143, null, 'INTFIELD03', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22163, 0, 1, null, 22143, null, 'INTFIELD04', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22164, 0, 1, null, 22143, null, 'INTFIELD05', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22165, 0, 1, null, 22143, null, 'INTFIELD06', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22166, 0, 1, null, 22143, null, 'INTFIELD07', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22167, 0, 1, null, 22143, null, 'INTFIELD08', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22168, 0, 1, null, 22143, null, 'INTFIELD09', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22169, 0, 1, null, 22143, null, 'INTFIELD10', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22170, 0, 1, null, 22143, null, 'INTFIELD11', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22171, 0, 1, null, 22143, null, 'INTFIELD12', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22172, 0, 1, null, 22143, null, 'INTFIELD13', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22173, 0, 1, null, 22143, null, 'INTFIELD14', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22174, 0, 1, null, 22143, null, 'INTFIELD15', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22175, 0, 1, null, 22143, null, 'INTFIELD16', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22176, 0, 1, null, 22143, null, 'INTFIELD17', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22177, 0, 1, null, 22143, null, 'INTFIELD18', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22178, 0, 1, null, 22143, null, 'INTFIELD19', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22179, 0, 1, null, 22143, null, 'SUMFIELD00', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22180, 0, 1, null, 22143, null, 'SUMFIELD01', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22181, 0, 1, null, 22143, null, 'SUMFIELD02', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22182, 0, 1, null, 22143, null, 'SUMFIELD03', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22183, 0, 1, null, 22143, null, 'SUMFIELD04', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22184, 0, 1, null, 22143, null, 'SUMFIELD05', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22185, 0, 1, null, 22143, null, 'SUMFIELD06', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22186, 0, 1, null, 22143, null, 'SUMFIELD07', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22187, 0, 1, null, 22143, null, 'SUMFIELD08', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22188, 0, 1, null, 22143, null, 'SUMFIELD09', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22189, 0, 1, null, 22143, null, 'SUMFIELD10', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22190, 0, 1, null, 22143, null, 'SUMFIELD11', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22191, 0, 1, null, 22143, null, 'SUMFIELD12', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22192, 0, 1, null, 22143, null, 'SUMFIELD13', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22193, 0, 1, null, 22143, null, 'SUMFIELD14', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22194, 0, 1, null, 22143, null, 'SUMFIELD15', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22195, 0, 1, null, 22143, null, 'SUMFIELD16', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22196, 0, 1, null, 22143, null, 'SUMFIELD17', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22197, 0, 1, null, 22143, null, 'SUMFIELD18', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22198, 0, 1, null, 22143, null, 'SUMFIELD19', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22199, 0, 1, null, 22143, null, 'SUMFIELD20', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22200, 0, 1, null, 22143, null, 'SUMFIELD21', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22201, 0, 1, null, 22143, null, 'SUMFIELD22', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22202, 0, 1, null, 22143, null, 'SUMFIELD23', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22203, 0, 1, null, 22143, null, 'SUMFIELD24', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22204, 0, 1, null, 22143, null, 'SUMFIELD25', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22205, 0, 1, null, 22143, null, 'SUMFIELD26', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22206, 0, 1, null, 22143, null, 'SUMFIELD27', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22207, 0, 1, null, 22143, null, 'SUMFIELD28', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22208, 0, 1, null, 22143, null, 'SUMFIELD29', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22209, 0, 1, null, 22143, null, 'DATEFIELD00', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22210, 0, 1, null, 22143, null, 'DATEFIELD01', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22211, 0, 1, null, 22143, null, 'DATEFIELD02', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22212, 0, 1, null, 22143, null, 'DATEFIELD03', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22213, 0, 1, null, 22143, null, 'DATEFIELD04', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22214, 0, 1, null, 22143, null, 'STRFIELD00', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22215, 0, 1, null, 22143, null, 'STRFIELD01', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22216, 0, 1, null, 22143, null, 'STRFIELD02', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22217, 0, 1, null, 22143, null, 'STRFIELD03', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22218, 0, 1, null, 22143, null, 'STRFIELD04', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22219, 0, 1, null, 22143, null, 'STRFIELD05', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22220, 0, 1, null, 22143, null, 'STRFIELD06', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22221, 0, 1, null, 22143, null, 'STRFIELD07', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22222, 0, 1, null, 22143, null, 'STRFIELD08', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22223, 0, 1, null, 22143, null, 'STRFIELD09', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22224, 0, 1, null, 22143, null, 'FLOATFIELD00', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22225, 0, 1, null, 22143, null, 'FLOATFIELD01', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22226, 0, 1, null, 22143, null, 'FLOATFIELD02', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22227, 0, 1, null, 22143, null, 'FLOATFIELD03', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22228, 0, 1, null, 22143, null, 'FLOATFIELD04', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22229, 0, 1, null, 22143, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22230, 0, 1, null, 22143, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22231, 0, 1, null, 22143, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22232, 0, 1, null, 22143, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 89, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22233, 0, 1, null, 22143, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 90, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22234, 0, 1, null, 22143, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 91, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22235, 0, 1, null, 22143, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22236, 0, 1, null, 22143, null, 'TASKREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22120, 1, 0, 0, '', 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22237, 0, 1, null, 22143, null, 'OWNERUSER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16708, 0, 0, 0, '', 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22238, 0, 1, null, 22143, null, 'EXECUTERUSER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16708, 0, 0, 0, '', 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22239, 0, 1, null, 22143, null, 'UPDATESTATUS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22240, 0, 1, null, 22143, null, 'UPDATEDRECORDINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 97, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22241, 0, 1, null, 22143, null, 'UPDATEGROUPINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22242, 0, 1, null, 22143, null, 'STRFIELD10', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22243, 0, 1, null, 22143, null, 'STRFIELD11', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22244, 0, 1, null, 22143, null, 'STRFIELD12', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22245, 0, 1, null, 22143, null, 'STRFIELD13', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22246, 0, 1, null, 22143, null, 'STRFIELD14', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 103, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22247, 0, 1, null, 22143, null, 'STRFIELD15', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22248, 0, 1, null, 22143, null, 'STRFIELD16', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22249, 0, 1, null, 22143, null, 'STRFIELD17', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 106, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22250, 0, 1, null, 22143, null, 'STRFIELD18', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22251, 0, 1, null, 22143, null, 'STRFIELD19', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22252, 0, 1, null, 22143, null, 'STRFIELD20', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22253, 0, 1, null, 22143, null, 'STRFIELD21', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22254, 0, 1, null, 22143, null, 'STRFIELD22', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22255, 0, 1, null, 22143, null, 'STRFIELD23', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 112, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22256, 0, 1, null, 22143, null, 'STRFIELD24', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24906, 0, 1, null, 22143, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 114, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24907, 0, 1, null, 22143, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24908, 0, 1, null, 22143, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24909, 0, 1, null, 22143, null, 'NATURALKEY', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24910, 0, 1, null, 22143, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 118, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24911, 0, 1, null, 22143, null, 'REJECTDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30719, 0, 1, null, 22143, null, 'DATECLOSE', 6, 0, 0, 'Дата закрытия', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30720, 0, 1, null, 22143, null, 'DATEOPEN', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30721, 0, 1, null, 22143, null, 'DEPARTMENTCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19786, 0, 0, 0, '', 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30722, 0, 1, null, 22143, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30723, 0, 1, null, 22143, null, 'SUBSIDYCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30724, 0, 1, null, 22143, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30725, 0, 1, null, 22143, null, 'VARIANT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 126, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31693, 0, 1, null, 22143, null, 'FLOATFIELD05', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31694, 0, 1, null, 22143, null, 'FLOATFIELD06', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31695, 0, 1, null, 22143, null, 'FLOATFIELD07', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31696, 0, 1, null, 22143, null, 'INTFIELD20', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 130, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31697, 0, 1, null, 22143, null, 'INTFIELD21', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31698, 0, 1, null, 22143, null, 'INTFIELD22', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31699, 0, 1, null, 22143, null, 'LOCKINFO', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31700, 0, 1, null, 22143, null, 'LOCKSTATUS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 134, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31701, 0, 1, null, 22143, null, 'ORG_REF', 3, 0, 0, 'Ссылка на организацию', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31702, 0, 1, null, 22143, null, 'STRFIELD25', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31703, 0, 1, null, 22143, null, 'SUMFIELD30', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31704, 0, 1, null, 22143, null, 'SUMFIELD31', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 138, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31705, 0, 1, null, 22143, null, 'SUMFIELD32', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 139, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31706, 0, 1, null, 22143, null, 'SUMFIELD33', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31707, 0, 1, null, 22143, null, 'SUMFIELD34', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 141, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35056, 0, 1, null, 22143, null, 'SENDERID_FORCHECK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 147, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LAYERNEEDCONTROL
CALL FIELDSINFO_IMPORT(22258, 0, 1, null, 22257, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22259, 0, 1, null, 22257, null, 'TASKREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22120, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22260, 0, 1, null, 22257, null, 'LAYERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22024, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22261, 0, 1, null, 22257, null, 'CONTROLREF', 3, 0, 0, 'Слой', '', 11, '', '', '', 0, 0, null, 1, 22024, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22262, 0, 1, null, 22257, null, 'SOFTCONTROL', 3, 0, 0, 'Мягкая проверка', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22263, 0, 1, null, 22257, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22264, 0, 1, null, 22257, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22265, 0, 1, null, 22257, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22266, 0, 1, null, 22257, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22267, 0, 1, null, 22257, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22268, 0, 1, null, 22257, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22269, 0, 1, null, 22257, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ED_DETAIL
CALL FIELDSINFO_IMPORT(22271, 0, 1, null, 22270, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22272, 0, 1, null, 22270, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22273, 0, 1, null, 22270, null, 'HEADERTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22274, 0, 1, null, 22270, null, 'KR', 1, 0, 20, 'Расходная классификация', '', 29, 'aaa.aaaa.aaaaaaa.aaa.aaa;0;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22275, 0, 1, null, 22270, null, 'IFS', 1, 0, 20, 'Источник финансирования', '', 31, '999.99.99.99.99.99.9999.999;0;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22276, 0, 1, null, 22270, null, 'KD', 1, 0, 20, 'Код дохода', '', 31, 'aaa.a.aa.aa.aaa.aa.aaaa.aaa;0;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22277, 0, 1, null, 22270, null, 'ADDCLS', 1, 0, 20, 'Добавочная классификация(Код цели)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22278, 0, 1, null, 22270, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22279, 0, 1, null, 22270, null, 'SUMMAKIND', 3, 0, 0, 'Направление платежа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24721, 0, 1, null, 22270, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24722, 0, 1, null, 22270, null, 'PROMISE', 1, 0, 20, 'Номер БО', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26599, 0, 1, null, 22270, null, 'PURPOSE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UTYPEDFORMSVERSION
CALL FIELDSINFO_IMPORT(22281, 0, 1, null, 22280, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22282, 0, 1, null, 22280, null, 'TYPEDFORM', 3, 0, 0, 'Код формы', '', 11, '', '', '', 0, 0, null, 1, 20957, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22283, 0, 1, null, 22280, null, 'VERSIONNUMBER', 3, 0, 0, 'Номер версии', '', 11, '99.999.99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22284, 0, 1, null, 22280, null, 'REPORTNUMBER', 3, 0, 0, 'Число отчетов', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22285, 0, 1, null, 22280, null, 'FORMCRC32', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22286, 0, 1, null, 22280, null, 'FORMTEMPLATE', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22287, 0, 1, null, 22280, null, 'ISCURRENT', 3, 0, 0, 'Текущая', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22288, 0, 1, null, 22280, null, 'VERSIONINFO', 1, 0, 255, 'Информация', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22289, 0, 1, null, 22280, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22290, 0, 1, null, 22280, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22291, 0, 1, null, 22280, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22292, 0, 1, null, 22280, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25084, 0, 1, null, 22280, null, 'ISCURRENTFORURM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25085, 0, 1, null, 22280, null, 'USEFORURM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LOANCREDITCONTRACTS
CALL FIELDSINFO_IMPORT(22294, 0, 1, null, 22293, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22295, 0, 1, null, 22293, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 17959, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22296, 0, 1, null, 22293, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22297, 0, 1, null, 22293, null, 'CONTRACTNUMBER', 1, 0, 50, 'Номер', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22298, 0, 1, null, 22293, null, 'CONTRACTDATE', 6, 0, 0, 'Дата договора', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22299, 0, 1, null, 22293, null, 'ENDDATE', 6, 0, 0, 'Дата окончания', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22300, 0, 1, null, 22293, null, 'CONTRACTTYPE', 3, 0, 0, 'Тип договора', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22301, 0, 1, null, 22293, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22302, 0, 1, null, 22293, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22303, 0, 1, null, 22293, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22304, 0, 1, null, 22293, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22305, 0, 1, null, 22293, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ED_SALDO
CALL FIELDSINFO_IMPORT(22307, 0, 1, null, 22306, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22308, 0, 1, null, 22306, null, 'PACKETNUMBER', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22309, 0, 1, null, 22306, null, 'GETDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22310, 0, 1, null, 22306, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22311, 0, 1, null, 22306, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22312, 0, 1, null, 22306, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22313, 0, 1, null, 22306, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22314, 0, 1, null, 22306, null, 'ACC', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22315, 0, 1, null, 22306, null, 'DEBIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22316, 0, 1, null, 22306, null, 'CREDIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22317, 0, 1, null, 22306, null, 'OUTBALANCEPASSIVE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22318, 0, 1, null, 22306, null, 'OUTBALANCEACTIVE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22319, 0, 1, null, 22306, null, 'INBALANCEPASSIVE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22320, 0, 1, null, 22306, null, 'INBALANCEACTIVE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22321, 0, 1, null, 22306, null, 'FORMDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22322, 0, 1, null, 22306, null, 'TIMEACCEPT', 1, 0, 5, '', '', 5, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22323, 0, 1, null, 22306, null, 'LASTDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22324, 0, 1, null, 22306, null, 'CODEFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22325, 0, 1, null, 22306, null, 'INYEARLIMIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22326, 0, 1, null, 22306, null, 'INCASHCHARGE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22327, 0, 1, null, 22306, null, 'INLIMIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22328, 0, 1, null, 22306, null, 'INFIN', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22329, 0, 1, null, 22306, null, 'OUTYEARLIMIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22330, 0, 1, null, 22306, null, 'OUTCASHCHARGE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22331, 0, 1, null, 22306, null, 'OUTLIMIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22332, 0, 1, null, 22306, null, 'OUTFIN', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22333, 0, 1, null, 22306, null, 'ELPACKETNUMBER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ED_OUTPAYDOC
CALL FIELDSINFO_IMPORT(22335, 0, 1, null, 22334, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22336, 0, 1, null, 22334, null, 'DOCNUMBER', 1, 0, 20, '№ документа', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22337, 0, 1, null, 22334, null, 'DOCDATE', 6, 0, 0, 'Дата документа', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22338, 0, 1, null, 22334, null, 'PAYQUEUE', 3, 0, 0, 'Очередность платежа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22339, 0, 1, null, 22334, null, 'PAYKIND', 3, 0, 0, 'Вид платежа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22340, 0, 1, null, 22334, null, 'NOTE', 1, 0, 255, 'Назначение платежа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22341, 0, 1, null, 22334, null, 'TAXNOTE', 1, 0, 150, 'Налоговая информация', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22342, 0, 1, null, 22334, null, 'BUDGETCLS', 1, 0, 512, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22343, 0, 1, null, 22334, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22344, 0, 1, null, 22334, null, 'SOURCEINN', 1, 0, 12, 'ИНН(Поля плательщика )', '', 12, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22345, 0, 1, null, 22334, null, 'SOURCEKPP', 1, 0, 20, 'КПП(Поля плательщика )', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22346, 0, 1, null, 22334, null, 'SOURCEUFKCODE', 1, 0, 20, 'Код в УФК(Поля плательщика )', '', 20, '', '00000', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22347, 0, 1, null, 22334, null, 'SOURCENAME', 1, 0, 255, 'Наименование(Поля плательщика )', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22348, 0, 1, null, 22334, null, 'SOURCEACC', 1, 0, 20, 'Счет(Поля плательщика )', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22349, 0, 1, null, 22334, null, 'SOURCETOFK', 1, 0, 20, 'Код ОФК(Поля плательщика )', '', 20, '', '0000', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22350, 0, 1, null, 22334, null, 'SOURCEUFK_INN', 1, 0, 12, 'ИНН организации ФК(Поля плательщика )', '', 12, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22351, 0, 1, null, 22334, null, 'SOURCEUFK_ORGNAME', 1, 0, 255, 'Наименование ОФК(Поля плательщика )', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22352, 0, 1, null, 22334, null, 'SOURCEUFK_ACC', 1, 0, 20, 'Счет ФК(Поля плательщика )', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22353, 0, 1, null, 22334, null, 'SOURCEBANKMFO', 1, 0, 20, 'БИК банка(Поля плательщика \Банк)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22354, 0, 1, null, 22334, null, 'SOURCEBANKNAME', 1, 0, 255, 'Наименование банка(Поля плательщика \Банк)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22355, 0, 1, null, 22334, null, 'SOURCEBANKCOR', 1, 0, 20, 'Корсчет банка(Поля плательщика \Банк)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22356, 0, 1, null, 22334, null, 'DESTINN', 1, 0, 12, 'ИНН(Поля получателя)', '', 12, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22357, 0, 1, null, 22334, null, 'DESTKPP', 1, 0, 20, 'КПП(Поля получателя)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22358, 0, 1, null, 22334, null, 'DESTNAME', 1, 0, 255, 'Наименование(Поля получателя)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22359, 0, 1, null, 22334, null, 'DESTUFK_INN', 1, 0, 12, 'ИНН организации ФК(Поля получателя)', '', 12, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22360, 0, 1, null, 22334, null, 'DESTUFK_ORGNAME', 1, 0, 255, 'Наименование ОФК(Поля получателя)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22361, 0, 1, null, 22334, null, 'DESTACC', 1, 0, 20, 'Счет(Поля получателя)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22362, 0, 1, null, 22334, null, 'DESTFACIALCODE', 1, 0, 20, 'Лицевой счет(Поля получателя)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22363, 0, 1, null, 22334, null, 'DESTBANKMFO', 1, 0, 20, 'БИК банка(Поля получателя\Банк)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22364, 0, 1, null, 22334, null, 'DESTBANKNAME', 1, 0, 255, 'Наименование банка(Поля получателя\Банк)', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22365, 0, 1, null, 22334, null, 'DESTBANKCOR', 1, 0, 20, 'Корсчет банка(Поля получателя\Банк)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22366, 0, 1, null, 22334, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22367, 0, 1, null, 22334, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22368, 0, 1, null, 22334, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22369, 0, 1, null, 22334, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22370, 0, 1, null, 22334, null, 'PACKETNUMBER', 1, 0, 255, 'Имя файла эл. пакета', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22371, 0, 1, null, 22334, null, 'ELDOCNUMBER', 1, 0, 255, 'Электронный номер', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22372, 0, 1, null, 22334, null, 'PACKETDATE', 6, 0, 0, 'Дата пакета', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22373, 0, 1, null, 22334, null, 'PROCSTATE', 3, 0, 0, 'Обработан', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22374, 0, 1, null, 22334, null, 'PROCDOCCLASS', 3, 0, 0, 'Класс документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22375, 0, 1, null, 22334, null, 'PROCUSEINFO', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22376, 0, 1, null, 22334, null, 'PROCNOTE', 1, 0, 4000, 'Примечание обработки', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22377, 0, 1, null, 22334, null, 'DOCSOURCE', 3, 0, 0, 'Источник документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22378, 0, 1, null, 22334, null, 'DOCREF', 3, 0, 0, 'Ссылка на документ ', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22379, 0, 1, null, 22334, null, 'ELDOCREF', 3, 0, 0, 'Ссылка на эл. документ', '', 11, '', '', '', 0, 0, null, 0, 17225, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22380, 0, 1, null, 22334, null, 'PROGINDEX', 3, 0, 0, 'Прогиндекс', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22381, 0, 1, null, 22334, null, 'ISLASTVERSION', 3, 0, 0, 'Последний', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22382, 0, 1, null, 22334, null, 'SOURCEFILIALBANKNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22383, 0, 1, null, 22334, null, 'DESTFILIALBANKNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22384, 0, 1, null, 22334, null, 'DOCUMENTNAME', 1, 0, 255, 'Наименование документа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24723, 0, 1, null, 22334, null, 'SOURCEFACIALACC_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26600, 0, 1, null, 22334, null, 'KOD_IST', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26605, 0, 1, null, 22334, null, 'VOS_DATE', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26606, 0, 1, null, 22334, null, 'VOS_GUID', 1, 0, 36, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26607, 0, 1, null, 22334, null, 'VOS_NOM', 1, 0, 10, '', '', 10, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26608, 0, 1, null, 22334, null, 'VOS_PAYERINN', 1, 0, 12, '', '', 12, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26609, 0, 1, null, 22334, null, 'VOS_PAYERKPP', 1, 0, 9, '', '', 9, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26610, 0, 1, null, 22334, null, 'VOS_SUM', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27015, 0, 1, null, 22334, null, 'DEPARTMENTCLS', 3, 0, 0, '', '', 9, '', '', '', 0, 0, null, 0, 19786, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27840, 0, 1, null, 22334, null, 'DOCOSN', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35366, 0, 1, null, 22334, null, 'UINCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- TARGETCLS
CALL FIELDSINFO_IMPORT(22386, 0, 1, null, 22385, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22387, 0, 1, null, 22385, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22388, 0, 1, null, 22385, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22389, 0, 1, null, 22385, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22390, 0, 1, null, 22385, null, 'STRCODE', 1, 0, 20, 'Строковый код', '', 20, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27865, 0, 1, null, 22385, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27866, 0, 1, null, 22385, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- ORGATTRIBUTES
CALL FIELDSINFO_IMPORT(22392, 0, 1, null, 22391, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22393, 0, 1, null, 22391, null, 'ACC_REF', 3, 0, 0, 'Ссылка на счет', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22394, 0, 1, null, 22391, null, 'ACC', 1, 0, 20, 'Счет', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22395, 0, 1, null, 22391, null, 'ORGNAME', 1, 0, 255, 'Организация', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22396, 0, 1, null, 22391, null, 'ORGINN', 6, 0, 0, 'ИНН', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22397, 0, 1, null, 22391, null, 'ORGINN20', 1, 0, 20, 'КПП', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22398, 0, 1, null, 22391, null, 'BANKNAME', 1, 0, 255, 'Банк', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22399, 0, 1, null, 22391, null, 'BANKMFO', 1, 0, 20, 'БИК', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22400, 0, 1, null, 22391, null, 'BANKCOR', 1, 0, 20, 'Кор. счет', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22401, 0, 1, null, 22391, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22402, 0, 1, null, 22391, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22403, 0, 1, null, 22391, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22404, 0, 1, null, 22391, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- DATAPACKETTYPES
CALL FIELDSINFO_IMPORT(22406, 0, 1, null, 22405, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22407, 0, 1, null, 22405, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22408, 0, 1, null, 22405, null, 'PERIOD', 3, 0, 0, 'Периодичность', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22409, 0, 1, null, 22405, null, 'PROCESSINGTYPE', 3, 0, 0, 'Тип обработки', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22410, 0, 1, null, 22405, null, 'CREATIONPERMISSIONS', 3, 0, 0, 'Права на создание', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22411, 0, 1, null, 22405, null, 'ENABLED', 3, 0, 0, 'Состояние', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22412, 0, 1, null, 22405, null, 'CONSTRAINTSCRIPTNAME', 1, 0, 255, 'Макрос ограничений', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22413, 0, 1, null, 22405, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22414, 0, 1, null, 22405, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22415, 0, 1, null, 22405, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22416, 0, 1, null, 22405, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31654, 0, 1, null, 22405, null, 'ARCHIVEDOCTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 30654, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37777, 0, 1, null, 22405, null, 'SIGNSCHEME', 3, 0, 0, 'Ссылка на схему подписания', '', 11, '', '', '', 0, 0, null, 0, 30659, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- REMOTEEDSRIGHT
CALL FIELDSINFO_IMPORT(22418, 0, 1, null, 22417, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22419, 0, 1, null, 22417, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22420, 0, 1, null, 22417, null, 'REMOTECLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20054, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22421, 0, 1, null, 22417, null, 'RIGHTTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22422, 0, 1, null, 22417, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22423, 0, 1, null, 22417, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22424, 0, 1, null, 22417, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22425, 0, 1, null, 22417, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22427, 0, 1, null, 22417, null, 'FACIALACCCLSUP', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25482, 0, 1, null, 22417, null, 'ARECURSIVE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25483, 0, 1, null, 22417, null, 'DATAPACKETTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22405, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- LINKTYPE
CALL FIELDSINFO_IMPORT(22429, 0, 1, null, 22428, null, 'ID', 3, 0, 0, 'Код связи', '', 11, '99.99.999.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22430, 0, 1, null, 22428, null, 'NAME', 1, 0, 50, 'Имя', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22431, 0, 1, null, 22428, null, 'LINKCOMMENT', 1, 0, 255, 'Комментарий', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22432, 0, 1, null, 22428, null, 'TEMPLATECLS', 3, 0, 0, 'Код шаблона', '', 11, '99.99.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22433, 0, 1, null, 22428, null, 'PARENTDOCCLS', 3, 0, 0, 'Код родительского набора', '', 11, '99.99.99', '', '', 0, 0, null, 1, 22823, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22434, 0, 1, null, 22428, null, 'CHILDDOCCLS', 3, 0, 0, 'Код дочернего набора', '', 11, '99.99.99', '', '', 0, 0, null, 1, 22823, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22435, 0, 1, null, 22428, null, 'BLOCKPARENT', 3, 0, 0, 'Блокировка родительской записи', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22436, 0, 1, null, 22428, null, 'BLOCKCHILD', 3, 0, 0, 'Блокировка дочерней записи', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22437, 0, 1, null, 22428, null, 'CANDELBLOCKPARENT', 3, 0, 0, 'Родительской записи(Удаление заблокированных)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22438, 0, 1, null, 22428, null, 'CANDELBLOCKCHILD', 3, 0, 0, 'Дочерней записи(Удаление заблокированных)', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22439, 0, 1, null, 22428, null, 'DISABLEDELPARENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22440, 0, 1, null, 22428, null, 'DISABLEDELCHILD', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22441, 0, 1, null, 22428, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22442, 0, 1, null, 22428, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22443, 0, 1, null, 22428, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22444, 0, 1, null, 22428, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22445, 0, 1, null, 22428, null, 'PARENTPICTURETYPE', 3, 0, 0, 'Тип картинки родителя', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22446, 0, 1, null, 22428, null, 'PARENTPICTURENAME', 1, 0, 255, 'Картинка родителя', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22447, 0, 1, null, 22428, null, 'CHILDPICTURETYPE', 3, 0, 0, 'Тип картинки дочернего', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22448, 0, 1, null, 22428, null, 'CHILDPICTURENAME', 1, 0, 255, 'Картинка дочернего', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22449, 0, 1, null, 22428, null, 'PICTURECOLLECTIONNAME', 1, 0, 255, 'Коллекция картинок', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22450, 0, 1, null, 22428, null, 'URMUSE', 3, 0, 0, 'Использовать на УРМ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22451, 0, 1, null, 22428, null, 'DELMACROSNAME', 1, 0, 255, 'Событие на удаление', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22452, 0, 1, null, 22428, null, 'NEEDDELCHILD', 3, 0, 0, 'Удалять дочерние при удалении связи', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22453, 0, 1, null, 22428, null, 'LINKKIND', 3, 0, 0, 'Вид связи', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31710, 0, 1, null, 22428, null, 'SHOWEVENT', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- UTYPEDCLSCAPTION
CALL FIELDSINFO_IMPORT(22455, 0, 1, null, 22454, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22456, 0, 1, null, 22454, null, 'CLSID', 3, 0, 0, 'Код классификатора', '', 11, '9999.99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22457, 0, 1, null, 22454, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22458, 0, 1, null, 22454, null, 'TEXTID', 1, 0, 255, 'Текстовый идентификатор', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22459, 0, 1, null, 22454, null, 'BEGINDATE', 6, 0, 0, 'Дата начала действия', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22460, 0, 1, null, 22454, null, 'ENDDATE', 6, 0, 0, 'Дата окончания действия', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22461, 0, 1, null, 22454, null, 'TEMPLATE', 15, 0, 0, 'Шаблон', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22462, 0, 1, null, 22454, null, 'OPTIONS', 3, 0, 0, 'Настройки классификатора', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22463, 0, 1, null, 22454, null, 'GROUPRIGHTS', 1, 0, 255, 'Группы пользователей', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22464, 0, 1, null, 22454, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22465, 0, 1, null, 22454, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22466, 0, 1, null, 22454, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22467, 0, 1, null, 22454, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25082, 0, 1, null, 22454, null, 'NOTE', 1, 0, 2048, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DATAPACKET
CALL FIELDSINFO_IMPORT(22469, 0, 1, null, 22468, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22470, 0, 1, null, 22468, null, 'PACKETTYPECLS', 3, 0, 0, 'Тип пакета', '', 11, '999', '', '', 0, 0, null, 0, 22405, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22471, 0, 1, null, 22468, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22472, 0, 1, null, 22468, null, 'CLIENTCODE', 3, 0, 0, 'Код удаленного клиента', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22473, 0, 1, null, 22468, null, 'PACKETID', 3, 0, 0, 'Код пакета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22474, 0, 1, null, 22468, null, 'RECIPIENTCODE', 3, 0, 0, 'Код получателя', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22475, 0, 1, null, 22468, null, 'PACKETCREATEDATE', 6, 0, 0, 'Дата создания пакета', '', 13, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22476, 0, 1, null, 22468, null, 'REPORTDATE', 6, 0, 0, 'Дата', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22477, 0, 1, null, 22468, null, 'REJECTDATE', 6, 0, 0, 'Дата отклонения', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22478, 0, 1, null, 22468, null, 'PACKETDELIVERYDATE', 6, 0, 0, 'Дата доставки пакета', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22479, 0, 1, null, 22468, null, 'REJECTDELIVERYDATE', 6, 0, 0, 'Дата доставки отклонения', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22480, 0, 1, null, 22468, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22481, 0, 1, null, 22468, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22482, 0, 1, null, 22468, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22483, 0, 1, null, 22468, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22484, 0, 1, null, 22468, null, 'PRIMARYDOCREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22485, 0, 1, null, 22468, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22486, 0, 1, null, 22468, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22487, 0, 1, null, 22468, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22488, 0, 1, null, 22468, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24706, 0, 1, null, 22468, null, 'DOCUMENTDATA', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24707, 0, 1, null, 22468, null, 'PACKETSTATE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24708, 0, 1, null, 22468, null, 'SIGNDATA', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27617, 0, 1, null, 22468, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30710, 0, 1, null, 22468, null, 'ARCHIVEDOCTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 30654, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30711, 0, 1, null, 22468, null, 'BINARYDATASIZE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30712, 0, 1, null, 22468, null, 'BINARYDOCDATA', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30713, 0, 1, null, 22468, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 0, 16803, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30714, 0, 1, null, 22468, null, 'DOCNUMBER', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30715, 0, 1, null, 22468, null, 'DOCPARAMS', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30716, 0, 1, null, 22468, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30717, 0, 1, null, 22468, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30718, 0, 1, null, 22468, null, 'RSFO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30978, 0, 1, null, 22468, null, 'DATALOCATION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31085, 0, 1, null, 22468, null, 'SPCONSTRAINTCRC', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31652, 0, 1, null, 22468, null, 'FILECRC', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31653, 0, 1, null, 22468, null, 'FORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- DATASECTIONTYPES
CALL FIELDSINFO_IMPORT(22490, 0, 1, null, 22489, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22491, 0, 1, null, 22489, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22492, 0, 1, null, 22489, null, 'CREATINGSCRIPTNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22493, 0, 1, null, 22489, null, 'PROCESSINGSCRIPTNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22494, 0, 1, null, 22489, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22495, 0, 1, null, 22489, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22496, 0, 1, null, 22489, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22497, 0, 1, null, 22489, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22498, 0, 1, null, 22489, null, 'PREVIEWSCRIPTNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DATAPACKETCONTENT
CALL FIELDSINFO_IMPORT(22500, 0, 1, null, 22499, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22501, 0, 1, null, 22499, null, 'DATAPACKETTYPE', 3, 0, 0, 'Тип пакета', '', 11, '', '', '', 0, 0, null, 1, 22405, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22502, 0, 1, null, 22499, null, 'DATASECTIONTYPE', 3, 0, 0, 'Тип секции', '', 11, '', '', '', 0, 0, null, 1, 22489, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22503, 0, 1, null, 22499, null, 'GENERATIONTEMPLATE', 1, 0, 255, 'Шаблон формирования', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22504, 0, 1, null, 22499, null, 'PROCESSINGTEMPLATE', 1, 0, 255, 'Шаблон обработки', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22505, 0, 1, null, 22499, null, 'CREATINGSCRIPTNAME', 1, 0, 255, 'Макрос формирования', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22506, 0, 1, null, 22499, null, 'PROCESSINGSCRIPTNAME', 1, 0, 255, 'Макрос обработки', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22507, 0, 1, null, 22499, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22508, 0, 1, null, 22499, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22509, 0, 1, null, 22499, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22510, 0, 1, null, 22499, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22511, 0, 1, null, 22499, null, 'NAME', 1, 0, 50, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22512, 0, 1, null, 22499, null, 'PREVIEWSCRIPTNAME', 1, 0, 255, 'Макрос предпросмотра', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- RECORDPARAMS
CALL FIELDSINFO_IMPORT(22514, 0, 1, null, 22513, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22515, 0, 1, null, 22513, null, 'DOCCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22516, 0, 1, null, 22513, null, 'CHILDCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22517, 0, 1, null, 22513, null, 'PARENTCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22518, 0, 1, null, 22513, null, 'DISABLEDELCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22519, 0, 1, null, 22513, null, 'PARENTBLOCKCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22520, 0, 1, null, 22513, null, 'CHILDBLOCKCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22521, 0, 1, null, 22513, null, 'COMMONPICTURECOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22522, 0, 1, null, 22513, null, 'UNIQUEPICTURECOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24948, 0, 1, null, 22513, null, 'REJECTCOUNT', 3, 0, 0, 'RejectCount', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- USERGENERATOROPT
CALL FIELDSINFO_IMPORT(22524, 0, 1, null, 22523, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22525, 0, 1, null, 22523, null, 'LIKESTR', 1, 0, 70, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22526, 0, 1, null, 22523, null, 'GENVALUEMIN', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22527, 0, 1, null, 22523, null, 'GENVALUEMAX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22528, 0, 1, null, 22523, null, 'PRIORITY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LINKRECORDS
CALL FIELDSINFO_IMPORT(22530, 0, 1, null, 22529, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22531, 0, 1, null, 22529, null, 'LINKTYPEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22428, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22532, 0, 1, null, 22529, null, 'PARENTID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22513, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22533, 0, 1, null, 22529, null, 'CHILDID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22513, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22534, 0, 1, null, 22529, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22535, 0, 1, null, 22529, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22536, 0, 1, null, 22529, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22537, 0, 1, null, 22529, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24916, 0, 1, null, 22529, null, 'ISREJECTED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24917, 0, 1, null, 22529, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24918, 0, 1, null, 22529, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- USERGENERATOR
CALL FIELDSINFO_IMPORT(22539, 0, 1, null, 22538, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22540, 0, 1, null, 22538, null, 'NAME', 1, 0, 80, 'Наименование генератора (список критериев)', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22541, 0, 1, null, 22538, null, 'GENVALUE', 3, 0, 0, 'Значение', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22542, 0, 1, null, 22538, null, 'GENVALUEMIN', 3, 0, 0, 'Нижнее значение', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22543, 0, 1, null, 22538, null, 'GENVALUEMAX', 3, 0, 0, 'Верхнее значение', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22544, 0, 1, null, 22538, null, 'LOCKID', 3, 0, 0, 'Отключить блокировку', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22545, 0, 1, null, 22538, null, 'LOCKUSER', 1, 0, 30, 'Имя пользователя, осуществляющего блокировку', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22546, 0, 1, null, 22538, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33069, 0, 1, null, 22538, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33070, 0, 1, null, 22538, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33071, 0, 1, null, 22538, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33072, 0, 1, null, 22538, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- USERGENERATORFIELDS
CALL FIELDSINFO_IMPORT(22548, 0, 1, null, 22547, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22549, 0, 1, null, 22547, null, 'GENREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22538, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22550, 0, 1, null, 22547, null, 'DOCREF', 3, 0, 0, 'Код документа', '', 6, '99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22551, 0, 1, null, 22547, null, 'DETAILNUM', 3, 0, 0, 'Детализация', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22552, 0, 1, null, 22547, null, 'FIELDNAME', 1, 0, 50, 'Имя поля', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22553, 0, 1, null, 22547, null, 'FORMAT', 1, 0, 50, 'Формат', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22554, 0, 1, null, 22547, null, 'REJECTEXP', 1, 0, 50, 'Недопустимые значения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22555, 0, 1, null, 22547, null, 'SETOF', 3, 0, 0, 'Использовать пропущенные номера', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22556, 0, 1, null, 22547, null, 'STEP', 3, 0, 0, 'Приращение', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22557, 0, 1, null, 22547, null, 'GENPOSITION', 3, 0, 0, 'Время генерации', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33073, 0, 1, null, 22547, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33074, 0, 1, null, 22547, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33075, 0, 1, null, 22547, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33076, 0, 1, null, 22547, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DOCLOCK
CALL FIELDSINFO_IMPORT(22559, 0, 1, null, 22558, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22560, 0, 1, null, 22558, null, 'NAME', 1, 0, 50, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22561, 0, 1, null, 22558, null, 'LOCKMASK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22562, 0, 1, null, 22558, null, 'DOCREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20598, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22563, 0, 1, null, 22558, null, 'DETAILNUM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22564, 0, 1, null, 22558, null, 'RUNPOS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22565, 0, 1, null, 22558, null, 'LOCKACTION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22566, 0, 1, null, 22558, null, 'USERIGHTS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22567, 0, 1, null, 22558, null, 'FORMULA', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22568, 0, 1, null, 22558, null, 'FORDELETE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22569, 0, 1, null, 22558, null, 'ISSYSTEM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22570, 0, 1, null, 22558, null, 'NOTE', 1, 0, 512, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22571, 0, 1, null, 22558, null, 'FORINSERT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22572, 0, 1, null, 22558, null, 'DOCPARAM', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22573, 0, 1, null, 22558, null, 'VALIDATEMESSAGE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22574, 0, 1, null, 22558, null, 'VALIDATELEVEL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22575, 0, 1, null, 22558, null, 'VALIDATEFILTER', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27618, 0, 1, null, 22558, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27619, 0, 1, null, 22558, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27620, 0, 1, null, 22558, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27621, 0, 1, null, 22558, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29908, 0, 1, null, 22558, null, 'ISBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- DOCLOCKFIELDS
CALL FIELDSINFO_IMPORT(22577, 0, 1, null, 22576, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22578, 0, 1, null, 22576, null, 'DOCLOCKREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22558, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22579, 0, 1, null, 22576, null, 'FIELDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20821, 1, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24717, 0, 1, null, 22576, null, 'ISSYSTEM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29909, 0, 1, null, 22576, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29910, 0, 1, null, 22576, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- UTYPEDCLSDETAIL
CALL FIELDSINFO_IMPORT(22581, 0, 1, null, 22580, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22582, 0, 1, null, 22580, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 22454, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22583, 0, 1, null, 22580, null, 'CODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22584, 0, 1, null, 22580, null, 'CODESTR', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22585, 0, 1, null, 22580, null, 'NOTE0', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22586, 0, 1, null, 22580, null, 'NOTE1', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22587, 0, 1, null, 22580, null, 'NOTE2', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22588, 0, 1, null, 22580, null, 'NOTE3', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22589, 0, 1, null, 22580, null, 'NOTE4', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22590, 0, 1, null, 22580, null, 'NOTE5', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22591, 0, 1, null, 22580, null, 'NOTE6', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22592, 0, 1, null, 22580, null, 'NOTE7', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22593, 0, 1, null, 22580, null, 'NOTE8', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22594, 0, 1, null, 22580, null, 'NOTE9', 1, 0, 2048, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22595, 0, 1, null, 22580, null, 'FINT0', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22596, 0, 1, null, 22580, null, 'FINT1', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22597, 0, 1, null, 22580, null, 'FINT2', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22598, 0, 1, null, 22580, null, 'FINT3', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22599, 0, 1, null, 22580, null, 'FINT4', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22600, 0, 1, null, 22580, null, 'FINT5', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22601, 0, 1, null, 22580, null, 'FINT6', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22602, 0, 1, null, 22580, null, 'FINT7', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22603, 0, 1, null, 22580, null, 'FINT8', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22604, 0, 1, null, 22580, null, 'FINT9', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22605, 0, 1, null, 22580, null, 'FLEVEL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22606, 0, 1, null, 22580, null, 'GROUPLIST', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22607, 0, 1, null, 22580, null, 'USERLIST', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22608, 0, 1, null, 22580, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22609, 0, 1, null, 22580, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22610, 0, 1, null, 22580, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22611, 0, 1, null, 22580, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22612, 0, 1, null, 22580, null, 'DETAILINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22613, 0, 1, null, 22580, null, 'NUMSTR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22614, 0, 1, null, 22580, null, 'CODEROW', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22615, 0, 1, null, 22580, null, 'ROWORDER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30778, 0, 1, null, 22580, null, 'VALUEDATA', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- CARDSDETAIL_FACC
CALL FIELDSINFO_IMPORT(22617, 0, 1, null, 22616, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22618, 0, 1, null, 22616, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 18937, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22619, 0, 1, null, 22616, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22620, 0, 1, null, 22616, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22621, 0, 1, null, 22616, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22622, 0, 1, null, 22616, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22623, 0, 1, null, 22616, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- CARDSDETAIL_KESR
CALL FIELDSINFO_IMPORT(22625, 0, 1, null, 22624, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22626, 0, 1, null, 22624, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 18937, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22627, 0, 1, null, 22624, null, 'KESR', 3, 0, 0, 'ЭКР', '', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22628, 0, 1, null, 22624, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22629, 0, 1, null, 22624, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22630, 0, 1, null, 22624, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22631, 0, 1, null, 22624, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FUNDSSOURCE
CALL FIELDSINFO_IMPORT(22633, 0, 1, null, 22632, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22634, 0, 1, null, 22632, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22635, 0, 1, null, 22632, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22636, 0, 1, null, 22632, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22637, 0, 1, null, 22632, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22638, 0, 1, null, 22632, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24814, 0, 1, null, 22632, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24815, 0, 1, null, 22632, null, 'NOTE', 1, 0, 1024, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24816, 0, 1, null, 22632, null, 'SHORTNAME', 1, 0, 255, 'Краткое имя', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24817, 0, 1, null, 22632, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ALLOWANCECAPTION
CALL FIELDSINFO_IMPORT(24622, 0, 1, null, 22639, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24623, 0, 1, null, 22639, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24624, 0, 1, null, 22639, null, 'INPUTDATE', 6, 0, 0, 'Дата ввода', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24625, 0, 1, null, 22639, null, 'LASTEXTRCHANGE', 11, 0, 0, 'Дата экстренного изменения', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24626, 0, 1, null, 22639, null, 'NOTE', 1, 0, 1000, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24627, 0, 1, null, 22639, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24628, 0, 1, null, 22639, null, 'REQUESTNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24629, 0, 1, null, 22639, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22640, 0, 1, null, 22639, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22641, 0, 1, null, 22639, null, 'ALLOWANCETYPE', 3, 0, 0, 'Вид', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22642, 0, 1, null, 22639, null, 'ACCEPTORORGREF', 3, 0, 0, 'Получатель', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22643, 0, 1, null, 22639, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 13, '', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22644, 0, 1, null, 22639, null, 'NUMBERGENERAL', 1, 0, 50, '№ ген. разрешения', '', 40, '000.000;0;_', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22645, 0, 1, null, 22639, null, 'NUMBERGENERALADD', 1, 0, 50, '№ дополнения к ген. разр.', '', 40, '99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22646, 0, 1, null, 22639, null, 'NUMBERDOC', 1, 0, 50, '№ разрешения', '', 40, '999.999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22647, 0, 1, null, 22639, null, 'NUMBERADD', 1, 0, 50, '№ дополнения к разрешению', '', 40, '99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22648, 0, 1, null, 22639, null, 'BEGINDATE', 6, 0, 0, 'Дата начала действия', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22649, 0, 1, null, 22639, null, 'ENDDATE', 6, 0, 0, 'Дата окончания действия', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22650, 0, 1, null, 22639, null, 'CONSTITUTIVEDOCTYPE', 1, 0, 255, 'Тип документа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22651, 0, 1, null, 22639, null, 'CONSTITUTIVEDATE', 6, 0, 0, 'Дата', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22652, 0, 1, null, 22639, null, 'CONSTITUTIVENUMBER', 1, 0, 50, 'Номер', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22653, 0, 1, null, 22639, null, 'CONSTITUTIVEORGAN', 1, 0, 255, 'Зарегистрировавший орган', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22654, 0, 1, null, 22639, null, 'REGISTERFIO', 1, 0, 255, 'ФИО', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22655, 0, 1, null, 22639, null, 'REGISTERJOB', 1, 0, 255, 'Должность', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22656, 0, 1, null, 22639, null, 'REGISTERDATE', 6, 0, 0, 'Дата выдачи', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22657, 0, 1, null, 22639, null, 'REGISTERORGAN', 3, 0, 0, 'Выдавший орган', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22658, 0, 1, null, 22639, null, 'RETURNNOTIFYNUMBER', 1, 0, 50, 'Номер уведомления', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22659, 0, 1, null, 22639, null, 'RETURNNOTIFYDATE', 6, 0, 0, 'Дата уведомления', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22660, 0, 1, null, 22639, null, 'RETURNREJECTCAUSE', 1, 0, 512, 'Причина отзыва', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22661, 0, 1, null, 22639, null, 'RETURNDATE', 6, 0, 0, 'Дата отзыва', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22662, 0, 1, null, 22639, null, 'RETURNFIO', 1, 0, 255, 'ФИО', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22663, 0, 1, null, 22639, null, 'RETURNJOB', 1, 0, 255, 'Должность', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22664, 0, 1, null, 22639, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22665, 0, 1, null, 22639, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22666, 0, 1, null, 22639, null, 'REJECT_CLS', 3, 0, 0, 'Код причины отклонения', '', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22667, 0, 1, null, 22639, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22668, 0, 1, null, 22639, null, 'NUMBERRETURNTRANZACTION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22669, 0, 1, null, 22639, null, 'NUMBERREJECTTRANZACTION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22670, 0, 1, null, 22639, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 0, 16803, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22671, 0, 1, null, 22639, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22672, 0, 1, null, 22639, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22673, 0, 1, null, 22639, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22674, 0, 1, null, 22639, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- ALLOWANCEDETAIL
CALL FIELDSINFO_IMPORT(22676, 0, 1, null, 22675, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22677, 0, 1, null, 22675, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 22639, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22678, 0, 1, null, 22675, null, 'NPACODE', 3, 0, 0, 'Код документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22679, 0, 1, null, 22675, null, 'NPANUMBER', 1, 0, 50, 'Номер документа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22680, 0, 1, null, 22675, null, 'NPADATE', 6, 0, 0, 'Дата документа', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22681, 0, 1, null, 22675, null, 'NPANAME', 1, 0, 255, 'Наименование документа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22682, 0, 1, null, 22675, null, 'NPACOMMENCEMENTDATE', 6, 0, 0, 'Дата вступления в силу', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22683, 0, 1, null, 22675, null, 'NPADURATION', 6, 0, 0, 'Срок действия', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22684, 0, 1, null, 22675, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22685, 0, 1, null, 22675, null, 'CLSTYPE', 3, 0, 0, 'Тип классификации', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22686, 0, 1, null, 22675, null, 'FUNDSSOURCE', 3, 0, 0, 'Источник образования', '', 11, '999.99.99', '', '', 0, 0, null, 1, 22632, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22687, 0, 1, null, 22675, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22688, 0, 1, null, 22675, null, 'KVSR', 3, 0, 0, 'КВСР', '', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22689, 0, 1, null, 22675, null, 'KFSR', 3, 0, 0, 'ФКР', '', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22690, 0, 1, null, 22675, null, 'KESR', 3, 0, 0, 'ЭКР', '', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22691, 0, 1, null, 22675, null, 'KVR', 3, 0, 0, 'КВР', '', 7, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22692, 0, 1, null, 22675, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22693, 0, 1, null, 22675, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22694, 0, 1, null, 22675, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22695, 0, 1, null, 22675, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22696, 0, 1, null, 22675, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25251, 0, 1, null, 22675, null, 'BEGINDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25252, 0, 1, null, 22675, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25253, 0, 1, null, 22675, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25254, 0, 1, null, 22675, null, 'ENDDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25255, 0, 1, null, 22675, null, 'LINENUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25256, 0, 1, null, 22675, null, 'NPADESCRIPTION', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25257, 0, 1, null, 22675, null, 'OPERATION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25258, 0, 1, null, 22675, null, 'PARENTID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22675, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25259, 0, 1, null, 22675, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25260, 0, 1, null, 22675, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25261, 0, 1, null, 22675, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25262, 0, 1, null, 22675, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25263, 0, 1, null, 22675, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- TENDERLOT
CALL FIELDSINFO_IMPORT(22698, 0, 1, null, 22697, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22699, 0, 1, null, 22697, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 21275, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22700, 0, 1, null, 22697, null, 'LOTNUMBER', 3, 0, 0, 'Номер лота / условия закупки', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22701, 0, 1, null, 22697, null, 'LOTNOTE', 1, 0, 1000, 'Наименование лота / условия закупки', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22702, 0, 1, null, 22697, null, 'DELIVERYDATE', 6, 0, 0, 'Дата начала', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22703, 0, 1, null, 22697, null, 'DELIVERYENDDATE', 6, 0, 0, 'Дата окончания', '', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22704, 0, 1, null, 22697, null, 'DELIVERYNOTE', 1, 0, 4000, 'Сроки (текст)', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22705, 0, 1, null, 22697, null, 'TERMSOFDELIVERY', 3, 0, 0, 'Условия (ИНКОТЕРМ)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22706, 0, 1, null, 22697, null, 'TERMSOFDELIVERYNOTE', 1, 0, 4000, 'Условия (текст)', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22707, 0, 1, null, 22697, null, 'OKATO', 3, 0, 0, 'ОКАТО', '', 11, '', '', '', 0, 0, null, 1, 20418, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22708, 0, 1, null, 22697, null, 'OKATONOTE', 1, 0, 4000, 'Место поставки (текст)', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22709, 0, 1, null, 22697, null, 'DELIVERYFORMNOTE', 1, 0, 4000, 'Форма, сроки и порядок оплаты товара, работ, услуг', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22710, 0, 1, null, 22697, null, 'SECURITYTNOTE', 1, 0, 4000, 'Обеспечение заявки на участие в размещении заказа', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22711, 0, 1, null, 22697, null, 'SECURITYANOTE', 1, 0, 4000, 'Обеспечение исполнения контракта', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22712, 0, 1, null, 22697, null, 'PREFERENCENOTE', 1, 0, 4000, 'Предоставляемые преимущества', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22713, 0, 1, null, 22697, null, 'GUARANTY', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22714, 0, 1, null, 22697, null, 'FINNOTE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22715, 0, 1, null, 22697, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22716, 0, 1, null, 22697, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22717, 0, 1, null, 22697, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22718, 0, 1, null, 22697, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22719, 0, 1, null, 22697, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22720, 0, 1, null, 22697, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22721, 0, 1, null, 22697, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22722, 0, 1, null, 22697, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22723, 0, 1, null, 22697, null, 'PREFERENCEPRISON', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22724, 0, 1, null, 22697, null, 'PREFERENCECRIPPLE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22725, 0, 1, null, 22697, null, 'GUARANTYSIZE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22726, 0, 1, null, 22697, null, 'STRETCHCONTRACT', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25043, 0, 1, null, 22697, null, 'REALID', 1, 0, 127, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25044, 0, 1, null, 22697, null, 'SECURITYASIZE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25045, 0, 1, null, 22697, null, 'SECURITYTSIZE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29959, 0, 1, null, 22697, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29960, 0, 1, null, 22697, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- SUPDOCTYPECLS
CALL FIELDSINFO_IMPORT(22728, 0, 1, null, 22727, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22729, 0, 1, null, 22727, null, 'NAME', 1, 0, 4000, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22730, 0, 1, null, 22727, null, 'YARDSTICKREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21929, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22731, 0, 1, null, 22727, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22732, 0, 1, null, 22727, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22733, 0, 1, null, 22727, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22734, 0, 1, null, 22727, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22735, 0, 1, null, 22727, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22736, 0, 1, null, 22727, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- OKP
CALL FIELDSINFO_IMPORT(22738, 0, 1, null, 22737, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22739, 0, 1, null, 22737, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22741, 0, 1, null, 22737, null, 'HASCHILDS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22742, 0, 1, null, 22737, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22743, 0, 1, null, 22737, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22744, 0, 1, null, 22737, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22745, 0, 1, null, 22737, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- TRANSFERTCLS
CALL FIELDSINFO_IMPORT(22774, 0, 1, null, 22773, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22775, 0, 1, null, 22773, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22782, 0, 1, null, 22773, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22783, 0, 1, null, 22773, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22784, 0, 1, null, 22773, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22785, 0, 1, null, 22773, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22786, 0, 1, null, 22773, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27634, 0, 1, null, 22773, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27635, 0, 1, null, 22773, null, 'NOTE', 1, 0, 1024, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25326, 0, 1, null, 22773, null, 'CODE', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25327, 0, 1, null, 22773, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25328, 0, 1, null, 22773, null, 'RECEIVEKCSR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25329, 0, 1, null, 22773, null, 'RECEIVEKD', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25330, 0, 1, null, 22773, null, 'RECEIVEKESR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25331, 0, 1, null, 22773, null, 'RECEIVEKFSR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25332, 0, 1, null, 22773, null, 'RECEIVEKVR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25333, 0, 1, null, 22773, null, 'RECEIVEKVSR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25334, 0, 1, null, 22773, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25335, 0, 1, null, 22773, null, 'TARGETCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 22385, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25336, 0, 1, null, 22773, null, 'TARGETMEANSSIGN', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25337, 0, 1, null, 22773, null, 'TRANSFERKCSR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25338, 0, 1, null, 22773, null, 'TRANSFERKDVALUE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25339, 0, 1, null, 22773, null, 'TRANSFERKESR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25340, 0, 1, null, 22773, null, 'TRANSFERKFSR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25341, 0, 1, null, 22773, null, 'TRANSFERKVR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25342, 0, 1, null, 22773, null, 'TRANSFERKVSR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31750, 0, 1, null, 22773, null, 'DESTLEVEL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31751, 0, 1, null, 22773, null, 'GRANTKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31752, 0, 1, null, 22773, null, 'SOURCELEVEL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31753, 0, 1, null, 22773, null, 'TRANSFERTKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31754, 0, 1, null, 22773, null, 'TRANSFERTYEAR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- STATICLINKS
CALL FIELDSINFO_IMPORT(22788, 0, 1, null, 22787, null, 'ID', 3, 0, 0, 'Код связи', '', 11, '99.99.999.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22789, 0, 1, null, 22787, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22790, 0, 1, null, 22787, null, 'PARENTFIELDREF', 3, 0, 0, 'Код родительского поля', '', 11, '99.99.9.9.999', '', '', 0, 0, null, 1, 20821, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22791, 0, 1, null, 22787, null, 'CHILDFIELDREF', 3, 0, 0, 'Код дочернего поля', '', 11, '99.99.9.9.999', '', '', 0, 0, null, 1, 20821, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22792, 0, 1, null, 22787, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22793, 0, 1, null, 22787, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22794, 0, 1, null, 22787, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22795, 0, 1, null, 22787, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22796, 0, 1, null, 22787, null, 'LINKKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24998, 0, 1, null, 22787, null, 'PARENTDELACTION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- OKFS
CALL FIELDSINFO_IMPORT(22798, 0, 1, null, 22797, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22799, 0, 1, null, 22797, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22800, 0, 1, null, 22797, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22801, 0, 1, null, 22797, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

-- STATE_FILTER
CALL FIELDSINFO_IMPORT(22803, 0, 1, null, 22802, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22804, 0, 1, null, 22802, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22805, 0, 1, null, 22802, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22806, 0, 1, null, 22802, null, 'FILTERVALUE', 1, 0, 1024, 'Значение', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22807, 0, 1, null, 22802, null, 'FILTERFORMAT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22808, 0, 1, null, 22802, null, 'FILTERACTIVE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22809, 0, 1, null, 22802, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22810, 0, 1, null, 22802, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22811, 0, 1, null, 22802, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22812, 0, 1, null, 22802, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24996, 0, 1, null, 22802, null, 'ISBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30777, 0, 1, null, 22802, null, 'FILTERVALUEURM', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- OKOPF
CALL FIELDSINFO_IMPORT(22814, 0, 1, null, 22813, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22815, 0, 1, null, 22813, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22816, 0, 1, null, 22813, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22817, 0, 1, null, 22813, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32936, 0, 1, null, 22813, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32937, 0, 1, null, 22813, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORG_TYPE
CALL FIELDSINFO_IMPORT(22819, 0, 1, null, 22818, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22820, 0, 1, null, 22818, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22821, 0, 1, null, 22818, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22822, 0, 1, null, 22818, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- DOCUMENTCLS
CALL FIELDSINFO_IMPORT(22824, 0, 1, null, 22823, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22825, 0, 1, null, 22823, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, 20598, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22826, 0, 1, null, 22823, null, 'DOCTYPENOTE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22827, 0, 1, null, 22823, null, 'TABLENAME', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22828, 0, 1, null, 22823, null, 'TABLENAMEURM', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22829, 0, 1, null, 22823, null, 'PRIMARYKEYNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22830, 0, 1, null, 22823, null, 'PRIMARYKEYNAMEURM', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22831, 0, 1, null, 22823, null, 'LINKFIELDNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22832, 0, 1, null, 22823, null, 'LINKFIELDNAMEURM', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22833, 0, 1, null, 22823, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22834, 0, 1, null, 22823, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22835, 0, 1, null, 22823, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22836, 0, 1, null, 22823, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22837, 0, 1, null, 22823, null, 'CLSTYPE', 3, 0, 0, 'Тип классификации', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24718, 0, 1, null, 22823, null, 'TEMPLATEVISIBLE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26550, 0, 1, null, 22823, null, 'SELECTIONREFBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23089, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26551, 0, 1, null, 22823, null, 'SELECTIONREFURM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23089, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29911, 0, 1, null, 22823, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- LAYERBLOBS
CALL FIELDSINFO_IMPORT(22839, 0, 1, null, 22838, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22840, 0, 1, null, 22838, null, 'RECORDID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22841, 0, 1, null, 22838, null, 'VALUEINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22842, 0, 1, null, 22838, null, 'VALUEDATA', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- CORRECTIONCAPTION
CALL FIELDSINFO_IMPORT(22844, 0, 1, null, 22843, null, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22845, 0, 1, null, 22843, null, 'PARENTID', 3, 0, 0, 'Ссылка на родительскую запись (CorrectionCaption)', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22846, 0, 1, null, 22843, null, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22847, 0, 1, null, 22843, null, 'DOCNUMBER', 1, 0, 50, '№ документа', 'Номер документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22848, 0, 1, null, 22843, null, 'INPUTDATE', 6, 0, 0, 'Дата ввода', 'Дата ввода', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22849, 0, 1, null, 22843, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия', 'Дата принятия', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22850, 0, 1, null, 22843, null, 'SUMMA', 6, 0, 0, 'Сумма уточнения', '', 13, '', ',0.00####', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22851, 0, 1, null, 22843, null, 'NOTE', 1, 0, 255, 'Примечание', 'Примечание', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22852, 0, 1, null, 22843, null, 'DOCTYPE', 3, 0, 0, 'Тип уведомления', 'Тип уведомления(по документу, по пакетной замене, на основе уведомления и тд)', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22853, 0, 1, null, 22843, null, 'PROGINDEX', 3, 0, 0, 'Класс', 'Индекс данных уведомления (поступление или выбытие)', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22854, 0, 1, null, 22843, null, 'OPERATIONDIRECTION', 3, 0, 0, 'НаправлениеОперации', 'Направление операции для исходной и новой классификаций (приход, расход, возрат прихода или возврат расхода)', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22855, 0, 1, null, 22843, null, 'SOURCETYPE', 3, 0, 0, 'Направления для исх.клас.', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22856, 0, 1, null, 22843, null, 'DESTTYPE', 3, 0, 0, 'Направление для нов.клс.', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22857, 0, 1, null, 22843, null, 'ORIGINALNUMBER', 1, 0, 50, 'Номер', 'Номер исходного  документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22858, 0, 1, null, 22843, null, 'ORIGINALDATE', 6, 0, 0, 'Дата', 'Дата принятия исходного документа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22859, 0, 1, null, 22843, null, 'ORIGINALSUMMA', 6, 0, 0, 'Сумма', 'Сумма исходного документа', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22860, 0, 1, null, 22843, null, 'ORIGINALNOTE', 1, 0, 255, 'Назначение', 'Назначение исходного документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22861, 0, 1, null, 22843, null, 'ORIGINALPROGINDEX', 3, 0, 0, 'КлассДокумента', 'Класс исходного документа', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22862, 0, 1, null, 22843, null, 'ORIGINALRECORDINDEX', 3, 0, 0, 'ИсхДокКлассДокументаСсылка', 'Ссылка на заголовок исходного документа', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22863, 0, 1, null, 22843, null, 'ORIGINALPAYERACC_REF', 3, 0, 0, 'Счет плательщика', 'Расчетный счет плательщика (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22864, 0, 1, null, 22843, null, 'ORIGINALPAYERACC', 1, 0, 20, 'Счет', 'Счет плательщика исходного документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22865, 0, 1, null, 22843, null, 'ORIGINALPAYERORGNAME', 1, 0, 255, 'Имя', 'Имя организации плательщика исходного документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22866, 0, 1, null, 22843, null, 'ORIGINALPAYERORGINN20', 1, 0, 20, 'КПП', 'КПП организации плательщика исходного документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22867, 0, 1, null, 22843, null, 'ORIGINALPAYERBANKNAME', 1, 0, 255, 'БанкИмя', 'Имя банка организации плательщика исходного документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22868, 0, 1, null, 22843, null, 'ORIGINALPAYERBANKMFO', 1, 0, 20, 'БанкБИК', 'БИК банка организации плательщика исходного документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22869, 0, 1, null, 22843, null, 'ORIGINALPAYERBANKCOR', 1, 0, 20, 'БанкКорСчет', 'Корсчет банка организации плательщика исходного документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22870, 0, 1, null, 22843, null, 'ORIGINALPAYERFKORGINN', 6, 0, 0, 'ОргУФКИНН', 'ИНН организации в УФК, обслуживающей организацию плательщика', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22871, 0, 1, null, 22843, null, 'ORIGINALPAYERFKORGNAME', 1, 0, 255, 'ОргУФКИмя', 'Имя организации в УФК, обслуживающей организацию плательщика', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22872, 0, 1, null, 22843, null, 'ORIGINALPAYERFKLS', 1, 0, 20, 'ОргУФКЛС', 'ЛС организации плательщика исходного документа в УФК ', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22873, 0, 1, null, 22843, null, 'ORIGINALACCEPTORACC_REF', 3, 0, 0, 'Счет получателя', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22874, 0, 1, null, 22843, null, 'ORIGINALACCEPTORACC', 1, 0, 20, 'Счет', 'Счет получателя исходного документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22875, 0, 1, null, 22843, null, 'ORIGINALACCEPTORORGNAME', 1, 0, 255, 'Имя', 'Имя организации получателя исходного документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22876, 0, 1, null, 22843, null, 'ORIGINALACCEPTORORGINN20', 1, 0, 20, 'КПП', 'КПП организации получателя исходного документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22877, 0, 1, null, 22843, null, 'ORIGINALACCEPTORBANKNAME', 1, 0, 255, 'БанкИмя', 'Имя банка организации получателя исходного документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22878, 0, 1, null, 22843, null, 'ORIGINALACCEPTORBANKMFO', 1, 0, 20, 'БанкБИК', 'БИК банка организации получателя исходного документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22879, 0, 1, null, 22843, null, 'ORIGINALACCEPTORBANKCOR', 1, 0, 20, 'БанкКорСчет', 'Корсчет банка организации получателя исходного документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22880, 0, 1, null, 22843, null, 'ORIGINALACCEPTORFKORGINN', 6, 0, 0, 'ОргУФКИНН', 'ИНН организации в УФК, обслуживающей организацию получателя', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22881, 0, 1, null, 22843, null, 'ORIGINALACCEPTORFKORGNAME', 1, 0, 255, 'ОргУФКИмя', 'Имя организации в УФК, обслуживающей организацию получателя', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22882, 0, 1, null, 22843, null, 'ORIGINALACCEPTORFKLS', 1, 0, 20, 'ОргУФКЛС', 'ЛС организации получателя исходного документа в УФК ', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22883, 0, 1, null, 22843, null, 'REJECT_CLS', 3, 0, 0, 'ПричинаОтклонКод', 'Код причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22884, 0, 1, null, 22843, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', 'Текст причины отклонения документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22885, 0, 1, null, 22843, null, 'SENDERID', 3, 0, 0, 'КодОтправителяДокумента', 'Код УРМотправителя из заголовка', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22886, 0, 1, null, 22843, null, 'SENDERRECORDID', 3, 0, 0, 'КодУРМДокумента', 'Код УРМдокумента из заголовка', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22887, 0, 1, null, 22843, null, 'DOCSTATEREF', 3, 0, 0, 'СостояниеДокумента', 'Состояние документа', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22888, 0, 1, null, 22843, null, 'RVERSION', 3, 0, 0, 'ДляОбновления', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22889, 0, 1, null, 22843, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22890, 0, 1, null, 22843, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22891, 0, 1, null, 22843, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзменений', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22892, 0, 1, null, 22843, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22893, 0, 1, null, 22843, null, 'ORIGINALACCEPTORFKCODE', 1, 0, 20, 'ОргУФККод', 'Код организации получателя исходного документа в УФК', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22894, 0, 1, null, 22843, null, 'ORIGINALPAYERFKCODE', 1, 0, 20, 'ОргУФККод', 'Код организации плательщика исходного документа в УФК', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22895, 0, 1, null, 22843, null, 'ADMINACCEPTORINN', 6, 0, 0, 'ОргАдминПостИНН', 'ИНН администратора поступлений', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22896, 0, 1, null, 22843, null, 'ADMINACCEPTORINN20', 1, 0, 20, 'ОргАдминПостКПП', 'КПП администратора поступлений', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22897, 0, 1, null, 22843, null, 'FKINN', 6, 0, 0, 'ИсхДокОргФКИНН', 'ИНН организации ФК, которое обработало уведомление', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22898, 0, 1, null, 22843, null, 'FKINN20', 1, 0, 20, 'ИсхДокОргФККПП', 'КПП организации ФК, которое обработало уведомление', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22899, 0, 1, null, 22843, null, 'FKNAME', 1, 0, 255, 'ИсхДокОргФКИмя', 'Название организации ФК, которое обработало уведомление', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22900, 0, 1, null, 22843, null, 'TERRITORIALFKINN', 6, 0, 0, 'ТерриторОргФКИНН', 'ИНН территориального отделения ФК', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22901, 0, 1, null, 22843, null, 'TERRITORIALFKINN20', 1, 0, 20, 'ТерриторОргФККПП', 'КПП территориального отделения ФК', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22902, 0, 1, null, 22843, null, 'ORIGINALPAYERORGINN', 1, 0, 20, 'ИНН', 'ИНН организации плательщика исходного документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22903, 0, 1, null, 22843, null, 'ORIGINALACCEPTORORGINN', 1, 0, 20, 'ИНН', 'ИНН организации получателя исходного документа', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22904, 0, 1, null, 22843, null, 'ORIGINALPAYERBANKFILNAME', 1, 0, 255, 'ИсхДокПлатБанкФилиалИмя', 'Название филиала банка плательщика', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22905, 0, 1, null, 22843, null, 'ORIGINALACCEPTORBANKFILNAME', 1, 0, 255, 'ИсхДокПолучБанкФилиалИмя', 'Название филиала банка получателя', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22906, 0, 1, null, 22843, null, 'RECORDDATE', 6, 0, 0, 'ДатаУчета', 'Эта дата является аналогом даты реестра в казначействе.', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22907, 0, 1, null, 22843, null, 'BASICNOTE', 1, 0, 255, 'Основание', 'Основание', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27837, 0, 1, null, 22843, null, 'DEPARTMENTCLS', 3, 0, 0, '', '', 9, '', '', '', 0, 0, null, 1, 19786, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25273, 0, 1, null, 22843, null, 'ADDOKATO', 3, 0, 0, 'ДопОКАТО', 'ОКАТО', 4, '000', '', '###', 0, 0, null, 0, null, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25274, 0, 1, null, 22843, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', 'Статус электронной цифровой подписи', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25275, 0, 1, null, 22843, null, 'ELDOCREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25276, 0, 1, null, 22843, null, 'ELNUM', 1, 0, 255, 'ИсхДокНомерЭлДокумента', 'Номер электронного документа исходного документа', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25277, 0, 1, null, 22843, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25278, 0, 1, null, 22843, null, 'LASTEXTRCHANGE', 11, 0, 0, 'Дата экстренного изменения', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25279, 0, 1, null, 22843, null, 'OKATO', 3, 0, 0, 'ОКАТО', 'ОКАТО', 11, '99.999.999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25280, 0, 1, null, 22843, null, 'PERSONALINFO', 1, 0, 512, 'ПаспортныеДанные', 'Паспортные данные', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25281, 0, 1, null, 22843, null, 'REQUESTNUMBER', 1, 0, 50, 'Номер заявки', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(36044, 0, 1, null, 22843, null, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- CORRECTIONDETAIL
CALL FIELDSINFO_IMPORT(22909, 0, 1, null, 22908, null, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22910, 0, 1, null, 22908, null, 'PARENTID', 3, 0, 0, 'СсылкаНаИсходнуюКлассификацию', 'Ссылка на строку с исходной классификацией ( у строки с исходной клс - ссылка на свой ид)', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22911, 0, 1, null, 22908, null, 'BUDGETREF', 3, 0, 0, 'Бюджет', '', 4, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22912, 0, 1, null, 22908, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', ',0.00', '0.00', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22913, 0, 1, null, 22908, null, 'CLSTYPE', 3, 0, 0, 'Тип клс.', 'Тип классификации', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22914, 0, 1, null, 22908, null, 'FACIALACC_CLS', 3, 0, 0, 'Л/с', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22915, 0, 1, null, 22908, null, 'KVSR', 3, 0, 0, 'КВСР', 'КВСР', 4, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22916, 0, 1, null, 22908, null, 'KFSR', 3, 0, 0, 'КФСР', 'КФСР', 6, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22917, 0, 1, null, 22908, null, 'KCSR', 3, 0, 0, 'КЦСР', 'КЦСР', 11, '999.99.99', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22918, 0, 1, null, 22908, null, 'KVR', 3, 0, 0, 'КВР', 'КВР', 7, '>AAA', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22919, 0, 1, null, 22908, null, 'KESR', 3, 0, 0, 'КЭСР', 'КЭСР', 6, '9.9.9', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22920, 0, 1, null, 22908, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Направление', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22921, 0, 1, null, 22908, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Тип средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22922, 0, 1, null, 22908, null, 'FACT', 3, 0, 0, 'Мероприятие', 'Мероприятие', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22923, 0, 1, null, 22908, null, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22924, 0, 1, null, 22908, null, 'FINSOURCE', 3, 0, 0, 'Источник финансирования', 'Источник финансирования', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22925, 0, 1, null, 22908, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', 'Тип финансирования', 5, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22926, 0, 1, null, 22908, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', 'Тип документа', 7, '9.99.9', '', '', 0, 0, null, 1, 16814, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22927, 0, 1, null, 22908, null, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'СубКЭСР', 10, '999.99.99', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22928, 0, 1, null, 22908, null, 'FUNDSSOURCE', 3, 0, 0, 'Источник образования', 'Источник образования средств', 11, '999.999.99', '', '', 0, 0, null, 1, 22632, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22929, 0, 1, null, 22908, null, 'KD', 3, 0, 0, 'КдКлюч', 'Ссылка на код дохода', 11, '', '', '', 0, 0, null, 1, 16824, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22930, 0, 1, null, 22908, null, 'IFS', 3, 0, 0, 'ИсточникВнутрФинансированияКлюч', 'Ссылка на источник внутреннего финансирования', 11, '999.99.99.99.99.99.9999.999', '', '', 0, 0, null, 1, 17043, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22931, 0, 1, null, 22908, null, 'BUHOPERATIONCLS', 3, 0, 0, 'БухОперация', 'Бухгалтерская операция 70н', 11, '', '', '', 0, 0, null, 1, 21634, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22932, 0, 1, null, 22908, null, 'CHANGEACC_REF', 3, 0, 0, 'НоваяОрганизацияСсылкаНаСчет', 'Ссылка на счет новой организации из детализации', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22933, 0, 1, null, 22908, null, 'CHANGEACC', 1, 0, 20, 'Счет', 'Счет новой организации из детализации', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22934, 0, 1, null, 22908, null, 'CHANGEORGNAME', 1, 0, 255, 'Имя', 'Имя новой организации из детализации', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22935, 0, 1, null, 22908, null, 'CHANGEORGINN', 6, 0, 0, 'ИНН', 'ИНН новой организации из детализации', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22936, 0, 1, null, 22908, null, 'CHANGEORGINN20', 1, 0, 20, 'КПП', 'КПП новой организации из детализации', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22937, 0, 1, null, 22908, null, 'PROGINDEX', 3, 0, 0, 'Индексы данных', 'Уникальный индекс, определяющий из какого блока взяты данные', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22938, 0, 1, null, 22908, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 22843, 1, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22939, 0, 1, null, 22908, null, 'DOCUMENTPROGINDEX', 3, 0, 0, 'ИндексыДанныхСвязанногоДокументаСтар', 'индекс данных связанного документа', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22940, 0, 1, null, 22908, null, 'DOCUMENTRECORDINDEX', 3, 0, 0, 'DocumentRecordIndex', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22941, 0, 1, null, 22908, null, 'ISBLOCKED', 3, 0, 0, 'Признак блокировки', 'Признак того что документ заблокирован (=1)', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22942, 0, 1, null, 22908, null, 'BLOCKEDCAUSE', 1, 0, 255, 'Причина блокировки', 'Причина блокировки', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22943, 0, 1, null, 22908, null, 'UNBLOCKEDDATE', 6, 0, 0, 'Дата разблокировки', 'Дата разблокировки документа', 11, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22944, 0, 1, null, 22908, null, 'UNBLOCKEDCAUSE', 1, 0, 255, 'Причина разблокировки', 'Причина разблокировки', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22945, 0, 1, null, 22908, null, 'SENDERID', 3, 0, 0, 'КодОтправителяЗаписи', 'Код УРМотправителя из детализации', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22946, 0, 1, null, 22908, null, 'SENDERRECORDID', 3, 0, 0, 'КодУРМЗаписи', 'Код УРМдокумента из детализации', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22947, 0, 1, null, 22908, null, 'RVERSION', 3, 0, 0, 'Для обновления', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22948, 0, 1, null, 22908, null, 'CREATERUSER', 1, 0, 30, 'Автор', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22949, 0, 1, null, 22908, null, 'CREATEDATE', 11, 0, 0, 'Дата и время создания', 'Дата создания', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22950, 0, 1, null, 22908, null, 'UPDATERUSER', 1, 0, 30, 'АвторИзменений', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22951, 0, 1, null, 22908, null, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22952, 0, 1, null, 22908, null, 'NOTE', 1, 0, 255, 'ПримечаниеДетализации', 'Примечание из детализации', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22953, 0, 1, null, 22908, null, 'ISCLSCHANGED', 3, 0, 0, 'КлассификацияИзменена', 'Признак того, что новая классификация отличается от исходной', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26546, 0, 1, null, 22908, null, 'CLSFIELFCHANGED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26547, 0, 1, null, 22908, null, 'EXECINNERNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32898, 0, 1, null, 22908, null, 'OKTMO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 32820, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27699, 0, 1, null, 22908, null, 'FAORGTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22818, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27700, 0, 1, null, 22908, null, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27838, 0, 1, null, 22908, null, 'BUDALLOCATIONCLS', 3, 0, 0, '', '', 9, '', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27839, 0, 1, null, 22908, null, 'PAYPROMISECLS', 3, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25282, 0, 1, null, 22908, null, 'ADDOKATO', 3, 0, 0, 'ДопОКАТОДеталь', 'ОКАТО', 4, '000', '', '###', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25283, 0, 1, null, 22908, null, 'BUDGETPROMISE', 3, 0, 0, 'Вн. номер БО', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25284, 0, 1, null, 22908, null, 'EXECDOC', 3, 0, 0, 'Номер Д.И. ссылка', '', 11, '', '', '', 0, 0, null, 0, 19736, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25285, 0, 1, null, 22908, null, 'NOTECLS', 1, 0, 255, 'Примечание для строки с новой классификацией', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25286, 0, 1, null, 22908, null, 'OKATO', 3, 0, 0, 'ОКАТОДеталь', 'ОКАТО из детализации', 11, '99.999.999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25287, 0, 1, null, 22908, null, 'OPERATIONTYPE', 3, 0, 0, 'Тип операции', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25288, 0, 1, null, 22908, null, 'ORIGINALCLSSUMMA', 6, 0, 0, 'Сумма по исходной классификации', '', 13, '', ',0.00####', '0.00', 0, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25289, 0, 1, null, 22908, null, 'PROMISE', 3, 0, 0, '№ БО', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25290, 0, 1, null, 22908, null, 'REVERSEFLAG', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25291, 0, 1, null, 22908, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30709, 0, 1, null, 22908, null, 'NOTEQUALEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35801, 0, 1, null, 22908, null, 'UINCODE', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PLANKIND
CALL FIELDSINFO_IMPORT(22955, 0, 1, null, 22954, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22956, 0, 1, null, 22954, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22957, 0, 1, null, 22954, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22958, 0, 1, null, 22954, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22959, 0, 1, null, 22954, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22960, 0, 1, null, 22954, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- TENDERSUPDOCUMENT
CALL FIELDSINFO_IMPORT(22962, 0, 1, null, 22961, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22963, 0, 1, null, 22961, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, null, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22964, 0, 1, null, 22961, null, 'YARDSTICKREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 21942, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22965, 0, 1, null, 22961, null, 'DOCTYPECLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22966, 0, 1, null, 22961, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22967, 0, 1, null, 22961, null, 'NAME', 1, 0, 1000, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22968, 0, 1, null, 22961, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22969, 0, 1, null, 22961, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22970, 0, 1, null, 22961, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22971, 0, 1, null, 22961, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22972, 0, 1, null, 22961, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22973, 0, 1, null, 22961, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22974, 0, 1, null, 22961, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22975, 0, 1, null, 22961, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29978, 0, 1, null, 22961, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29979, 0, 1, null, 22961, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ASSIGNMENTKIND
CALL FIELDSINFO_IMPORT(24630, 0, 1, null, 22976, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24631, 0, 1, null, 22976, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24632, 0, 1, null, 22976, null, 'UNRESTRICTED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22977, 0, 1, null, 22976, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22978, 0, 1, null, 22976, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22979, 0, 1, null, 22976, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22980, 0, 1, null, 22976, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22981, 0, 1, null, 22976, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22982, 0, 1, null, 22976, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27697, 0, 1, null, 22976, null, 'MARK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- ASSIGNMENTSOURCE
CALL FIELDSINFO_IMPORT(24633, 0, 1, null, 22983, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24634, 0, 1, null, 22983, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22984, 0, 1, null, 22983, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22985, 0, 1, null, 22983, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22986, 0, 1, null, 22983, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22987, 0, 1, null, 22983, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22988, 0, 1, null, 22983, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22989, 0, 1, null, 22983, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27698, 0, 1, null, 22983, null, 'MARK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- TENDERPROPOSAL
CALL FIELDSINFO_IMPORT(22991, 0, 1, null, 22990, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22992, 0, 1, null, 22990, null, 'SUPPLIERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22993, 0, 1, null, 22990, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22994, 0, 1, null, 22990, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22995, 0, 1, null, 22990, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22996, 0, 1, null, 22990, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22997, 0, 1, null, 22990, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22998, 0, 1, null, 22990, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(22999, 0, 1, null, 22990, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23000, 0, 1, null, 22990, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23001, 0, 1, null, 22990, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23002, 0, 1, null, 22990, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23003, 0, 1, null, 22990, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29966, 0, 1, null, 22990, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29967, 0, 1, null, 22990, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- TENDERPROPOSALDETAIL
CALL FIELDSINFO_IMPORT(23005, 0, 1, null, 23004, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23006, 0, 1, null, 23004, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 22990, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23007, 0, 1, null, 23004, null, 'PRODUCTCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20694, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23008, 0, 1, null, 23004, null, 'AMOUNT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23009, 0, 1, null, 23004, null, 'PRICE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23010, 0, 1, null, 23004, null, 'PRICEVAT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23011, 0, 1, null, 23004, null, 'COST', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23012, 0, 1, null, 23004, null, 'VATPERCENT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23013, 0, 1, null, 23004, null, 'VATSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23014, 0, 1, null, 23004, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23015, 0, 1, null, 23004, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23016, 0, 1, null, 23004, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23017, 0, 1, null, 23004, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23018, 0, 1, null, 23004, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23019, 0, 1, null, 23004, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23020, 0, 1, null, 23004, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23021, 0, 1, null, 23004, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23022, 0, 1, null, 23004, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29968, 0, 1, null, 23004, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29969, 0, 1, null, 23004, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- TENDERPURCHASELOT
CALL FIELDSINFO_IMPORT(23024, 0, 1, null, 23023, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23025, 0, 1, null, 23023, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 23037, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23026, 0, 1, null, 23023, null, 'LOTNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23027, 0, 1, null, 23023, null, 'LOTNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23028, 0, 1, null, 23023, null, 'LOTSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23029, 0, 1, null, 23023, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23030, 0, 1, null, 23023, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23031, 0, 1, null, 23023, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23032, 0, 1, null, 23023, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23033, 0, 1, null, 23023, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23034, 0, 1, null, 23023, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23035, 0, 1, null, 23023, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23036, 0, 1, null, 23023, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29972, 0, 1, null, 23023, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29973, 0, 1, null, 23023, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- TENDERPURCHASE
CALL FIELDSINFO_IMPORT(23038, 0, 1, null, 23037, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23039, 0, 1, null, 23037, null, 'PURCHASENUMBER', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23040, 0, 1, null, 23037, null, 'AGREEMENTOBJECT', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23041, 0, 1, null, 23037, null, 'SALETYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23042, 0, 1, null, 23037, null, 'PURCHASESTATE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23043, 0, 1, null, 23037, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23044, 0, 1, null, 23037, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23045, 0, 1, null, 23037, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23046, 0, 1, null, 23037, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23047, 0, 1, null, 23037, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23048, 0, 1, null, 23037, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23049, 0, 1, null, 23037, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23050, 0, 1, null, 23037, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23051, 0, 1, null, 23037, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23052, 0, 1, null, 23037, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(23053, 0, 1, null, 23037, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29970, 0, 1, null, 23037, null, 'SENDERIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29971, 0, 1, null, 23037, null, 'SENDERRECORDIDKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UNLOCKDATES
CALL FIELDSINFO_IMPORT(25368, 0, 1, null, 23058, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25369, 0, 1, null, 23058, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25370, 0, 1, null, 23058, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25371, 0, 1, null, 23058, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25372, 0, 1, null, 23058, null, 'JNUMBER', 3, 0, 0, '№', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25373, 0, 1, null, 23058, null, 'JOURNALFLAG', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25374, 0, 1, null, 23058, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25375, 0, 1, null, 23058, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25376, 0, 1, null, 23058, null, 'UNLOCK', 3, 0, 0, 'Открыть день', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25377, 0, 1, null, 23058, null, 'UNLOCKDATE', 6, 0, 0, 'Дата', '', 11, '99/99/9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25378, 0, 1, null, 23058, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25379, 0, 1, null, 23058, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30624, 0, 1, null, 23058, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30625, 0, 1, null, 23058, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- VARIANTCLS
CALL FIELDSINFO_IMPORT(25101, 0, 1, null, 23059, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25102, 0, 1, null, 23059, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25103, 0, 1, null, 23059, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25104, 0, 1, null, 23059, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25105, 0, 1, null, 23059, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25106, 0, 1, null, 23059, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- ACCCUROPERATIONVIEW
CALL FIELDSINFO_IMPORT(24541, 0, 1, null, 23060, null, 'ACC', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24542, 0, 1, null, 23060, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24543, 0, 1, null, 23060, null, 'ACCOUNTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24544, 0, 1, null, 23060, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24545, 0, 1, null, 23060, null, 'CURRENCY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24546, 0, 1, null, 23060, null, 'CURSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24547, 0, 1, null, 23060, null, 'DDFACCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24548, 0, 1, null, 23060, null, 'DFACCOUNT', 3, 0, 0, 'Счет финоргана', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24549, 0, 1, null, 23060, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24550, 0, 1, null, 23060, null, 'EXCHANGE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24551, 0, 1, null, 23060, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24552, 0, 1, null, 23060, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24553, 0, 1, null, 23060, null, 'FINACCEPTDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24554, 0, 1, null, 23060, null, 'FINNOTE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24555, 0, 1, null, 23060, null, 'FINREGIONCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24556, 0, 1, null, 23060, null, 'FINSOURCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24557, 0, 1, null, 23060, null, 'FINSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24558, 0, 1, null, 23060, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24559, 0, 1, null, 23060, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24560, 0, 1, null, 23060, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24561, 0, 1, null, 23060, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24562, 0, 1, null, 23060, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24563, 0, 1, null, 23060, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24564, 0, 1, null, 23060, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24565, 0, 1, null, 23060, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24566, 0, 1, null, 23060, null, 'NAME', 1, 0, 2000, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24567, 0, 1, null, 23060, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24568, 0, 1, null, 23060, null, 'OPERATION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24569, 0, 1, null, 23060, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24570, 0, 1, null, 23060, null, 'SDFACCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24571, 0, 1, null, 23060, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24572, 0, 1, null, 23060, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BANKSNAMES
CALL FIELDSINFO_IMPORT(24647, 0, 1, null, 23061, null, 'CITY', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24648, 0, 1, null, 23061, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24649, 0, 1, null, 23061, null, 'MFO', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24650, 0, 1, null, 23061, null, 'NAME', 1, 0, 2000, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BILLFINVIEW
CALL FIELDSINFO_IMPORT(24660, 0, 1, null, 23063, null, 'ACC', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24661, 0, 1, null, 23063, null, 'ACC_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24662, 0, 1, null, 23063, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24663, 0, 1, null, 23063, null, 'ACCOUNTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24664, 0, 1, null, 23063, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24665, 0, 1, null, 23063, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24666, 0, 1, null, 23063, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24667, 0, 1, null, 23063, null, 'DFACCOUNT', 3, 0, 0, 'Счет финоргана', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24668, 0, 1, null, 23063, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24669, 0, 1, null, 23063, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24670, 0, 1, null, 23063, null, 'FINSOURCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24671, 0, 1, null, 23063, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24672, 0, 1, null, 23063, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24673, 0, 1, null, 23063, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24674, 0, 1, null, 23063, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24675, 0, 1, null, 23063, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24676, 0, 1, null, 23063, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24677, 0, 1, null, 23063, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24678, 0, 1, null, 23063, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24679, 0, 1, null, 23063, null, 'NAME', 1, 0, 2000, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24680, 0, 1, null, 23063, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24681, 0, 1, null, 23063, null, 'ORG_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24682, 0, 1, null, 23063, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24683, 0, 1, null, 23063, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24684, 0, 1, null, 23063, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24685, 0, 1, null, 23063, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24686, 0, 1, null, 23063, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24687, 0, 1, null, 23063, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24688, 0, 1, null, 23063, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DFACCOUNTS
CALL FIELDSINFO_IMPORT(24711, 0, 1, null, 23065, null, 'ACC', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24712, 0, 1, null, 23065, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24713, 0, 1, null, 23065, null, 'BUHACC', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24714, 0, 1, null, 23065, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DOCUMENTTEMPLATE
CALL FIELDSINFO_IMPORT(25300, 0, 1, null, 23066, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25301, 0, 1, null, 23066, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25302, 0, 1, null, 23066, null, 'DOCUMENTCLSREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22823, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25303, 0, 1, null, 23066, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25304, 0, 1, null, 23066, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25305, 0, 1, null, 23066, null, 'TEMPLATEDOCUMENT', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25306, 0, 1, null, 23066, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25307, 0, 1, null, 23066, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DZACC
CALL FIELDSINFO_IMPORT(24719, 0, 1, null, 23067, null, 'ACC', 1, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24720, 0, 1, null, 23067, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FIELDSINFO
CALL FIELDSINFO_IMPORT(32922, 0, 1, null, 23069, null, 'ALIAS', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32923, 0, 1, null, 23069, null, 'ANNOTATION', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32924, 0, 1, null, 23069, null, 'AVAILABLEINDEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32925, 0, 1, null, 23069, null, 'DEREFNAME', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32926, 0, 1, null, 23069, null, 'ISBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32927, 0, 1, null, 23069, null, 'ISTIMESTAMPFIELD', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25510, 0, 1, null, 23069, null, 'AGRFUNCTION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25511, 0, 1, null, 23069, null, 'CANTEDIT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25512, 0, 1, null, 23069, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25513, 0, 1, null, 23069, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25514, 0, 1, null, 23069, null, 'DATATYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25515, 0, 1, null, 23069, null, 'DEFAULTWIDTH', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25516, 0, 1, null, 23069, null, 'DESCRIPTIONLEVEL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25517, 0, 1, null, 23069, null, 'DISPLAYFORMAT', 1, 0, 80, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25518, 0, 1, null, 23069, null, 'DISPLAYLABEL', 1, 0, 80, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25519, 0, 1, null, 23069, null, 'EDITFORMAT', 1, 0, 80, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25520, 0, 1, null, 23069, null, 'EDITMASK', 1, 0, 80, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25521, 0, 1, null, 23069, null, 'ENUMSREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25522, 0, 1, null, 23069, null, 'FIELDKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25523, 0, 1, null, 23069, null, 'FIELDNAME', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25524, 0, 1, null, 23069, null, 'FIELDSIZE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25525, 0, 1, null, 23069, null, 'FLAGAGRFUNCTION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25526, 0, 1, null, 23069, null, 'FLAGCANTEDIT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25527, 0, 1, null, 23069, null, 'FLAGDEFAULTWIDTH', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25528, 0, 1, null, 23069, null, 'FLAGDISPLAYLABEL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25529, 0, 1, null, 23069, null, 'FLAGFIELDNAME', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25530, 0, 1, null, 23069, null, 'FLAGLIMITPARAMNAMES', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25531, 0, 1, null, 23069, null, 'FLAGNOTE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25532, 0, 1, null, 23069, null, 'FLAGNOVISUALIZE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25533, 0, 1, null, 23069, null, 'FLAGREQUIRED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25534, 0, 1, null, 23069, null, 'FOLLOWORDER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25535, 0, 1, null, 23069, null, 'FOREIGNKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23089, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25536, 0, 1, null, 23069, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25537, 0, 1, null, 23069, null, 'ISRVERSION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25538, 0, 1, null, 23069, null, 'LIMITPARAMNAMES', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25539, 0, 1, null, 23069, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25540, 0, 1, null, 23069, null, 'NOVISUALIZE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25541, 0, 1, null, 23069, null, 'ONDELACTION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25542, 0, 1, null, 23069, null, 'PRIMARYKEY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25543, 0, 1, null, 23069, null, 'REQUIRED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25544, 0, 1, null, 23069, null, 'SELECTIONREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 23089, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25545, 0, 1, null, 23069, null, 'SORTDIRECTION', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25546, 0, 1, null, 23069, null, 'SORTORDER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25547, 0, 1, null, 23069, null, 'SUBDATATYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25548, 0, 1, null, 23069, null, 'TABLEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23090, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25549, 0, 1, null, 23069, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25550, 0, 1, null, 23069, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25551, 0, 1, null, 23069, null, 'ANCESTORREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23069, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- FINCLAIMTMP
CALL FIELDSINFO_IMPORT(24737, 0, 1, null, 23070, null, 'ACC_REF', 3, 0, 0, 'Ссылка на счет', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24738, 0, 1, null, 23070, null, 'DAT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FINCLAIMVIEW
CALL FIELDSINFO_IMPORT(24739, 0, 1, null, 23071, null, 'ACC', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24740, 0, 1, null, 23071, null, 'ACC_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24741, 0, 1, null, 23071, null, 'ACC_REF', 3, 0, 0, 'Ссылка на счет', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24742, 0, 1, null, 23071, null, 'ACCEPTSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24743, 0, 1, null, 23071, null, 'ADDRESS', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24744, 0, 1, null, 23071, null, 'BUD_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24745, 0, 1, null, 23071, null, 'DAT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24746, 0, 1, null, 23071, null, 'GOSNI', 3, 0, 0, 'ГОС. НИ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24747, 0, 1, null, 23071, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24748, 0, 1, null, 23071, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24749, 0, 1, null, 23071, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24750, 0, 1, null, 23071, null, 'KPP', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24751, 0, 1, null, 23071, null, 'NAME', 1, 0, 2000, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24752, 0, 1, null, 23071, null, 'NUM', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24753, 0, 1, null, 23071, null, 'SUBKD', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24754, 0, 1, null, 23071, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FINDETAILVIEW
CALL FIELDSINFO_IMPORT(24755, 0, 1, null, 23072, null, 'ACC', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24756, 0, 1, null, 23072, null, 'ACC_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24757, 0, 1, null, 23072, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24758, 0, 1, null, 23072, null, 'ACCOUNTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24759, 0, 1, null, 23072, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24760, 0, 1, null, 23072, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24761, 0, 1, null, 23072, null, 'CURRENCYCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24762, 0, 1, null, 23072, null, 'CURRENCYSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24763, 0, 1, null, 23072, null, 'DFACCOUNT', 3, 0, 0, 'Счет финоргана', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24764, 0, 1, null, 23072, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24765, 0, 1, null, 23072, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24766, 0, 1, null, 23072, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24767, 0, 1, null, 23072, null, 'FINSOURCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24768, 0, 1, null, 23072, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24769, 0, 1, null, 23072, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24770, 0, 1, null, 23072, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24771, 0, 1, null, 23072, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24772, 0, 1, null, 23072, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24773, 0, 1, null, 23072, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24774, 0, 1, null, 23072, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24775, 0, 1, null, 23072, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24776, 0, 1, null, 23072, null, 'NAME', 1, 0, 2000, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24777, 0, 1, null, 23072, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24778, 0, 1, null, 23072, null, 'ORG_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24779, 0, 1, null, 23072, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24780, 0, 1, null, 23072, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24781, 0, 1, null, 23072, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24782, 0, 1, null, 23072, null, 'SOURCEDOCNUM', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24783, 0, 1, null, 23072, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24784, 0, 1, null, 23072, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- FREEFINVIEW
CALL FIELDSINFO_IMPORT(24788, 0, 1, null, 23074, null, 'ACC', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24789, 0, 1, null, 23074, null, 'ACC_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24790, 0, 1, null, 23074, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24791, 0, 1, null, 23074, null, 'ACCOUNTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24792, 0, 1, null, 23074, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24793, 0, 1, null, 23074, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24794, 0, 1, null, 23074, null, 'DFACCOUNT', 3, 0, 0, 'Счет финоргана', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24795, 0, 1, null, 23074, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24796, 0, 1, null, 23074, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24797, 0, 1, null, 23074, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24798, 0, 1, null, 23074, null, 'FINSOURCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24799, 0, 1, null, 23074, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24800, 0, 1, null, 23074, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24801, 0, 1, null, 23074, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24802, 0, 1, null, 23074, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24803, 0, 1, null, 23074, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24804, 0, 1, null, 23074, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24805, 0, 1, null, 23074, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24806, 0, 1, null, 23074, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24807, 0, 1, null, 23074, null, 'NAME', 1, 0, 2000, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24808, 0, 1, null, 23074, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24809, 0, 1, null, 23074, null, 'ORG_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24810, 0, 1, null, 23074, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24811, 0, 1, null, 23074, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24812, 0, 1, null, 23074, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24813, 0, 1, null, 23074, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INCOMESLEFT
CALL FIELDSINFO_IMPORT(24838, 0, 1, null, 23075, null, 'ACCOUNTINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24839, 0, 1, null, 23075, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24840, 0, 1, null, 23075, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24841, 0, 1, null, 23075, null, 'CREDIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24842, 0, 1, null, 23075, null, 'DEBIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24843, 0, 1, null, 23075, null, 'DOCCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24844, 0, 1, null, 23075, null, 'DOCNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24845, 0, 1, null, 23075, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24846, 0, 1, null, 23075, null, 'GOSNI', 3, 0, 0, 'ГОС. НИ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24847, 0, 1, null, 23075, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24848, 0, 1, null, 23075, null, 'IDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24849, 0, 1, null, 23075, null, 'INCACCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24850, 0, 1, null, 23075, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24851, 0, 1, null, 23075, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24852, 0, 1, null, 23075, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24853, 0, 1, null, 23075, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24854, 0, 1, null, 23075, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24855, 0, 1, null, 23075, null, 'SUBKD', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24856, 0, 1, null, 23075, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INCOMESRIGHT
CALL FIELDSINFO_IMPORT(24860, 0, 1, null, 23077, null, 'ACCOUNTINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24861, 0, 1, null, 23077, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24862, 0, 1, null, 23077, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24863, 0, 1, null, 23077, null, 'CREDIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24864, 0, 1, null, 23077, null, 'DEBIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24865, 0, 1, null, 23077, null, 'DOCCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24866, 0, 1, null, 23077, null, 'DOCNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24867, 0, 1, null, 23077, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24868, 0, 1, null, 23077, null, 'GOSNI', 3, 0, 0, 'ГОС. НИ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24869, 0, 1, null, 23077, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24870, 0, 1, null, 23077, null, 'IDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24871, 0, 1, null, 23077, null, 'INCACCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24872, 0, 1, null, 23077, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24873, 0, 1, null, 23077, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24874, 0, 1, null, 23077, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24875, 0, 1, null, 23077, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24876, 0, 1, null, 23077, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24877, 0, 1, null, 23077, null, 'SUBKD', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24878, 0, 1, null, 23077, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INCOMES_REDIRECT
CALL FIELDSINFO_IMPORT(24818, 0, 1, null, 23078, null, 'ACCOUNTINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24819, 0, 1, null, 23078, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24820, 0, 1, null, 23078, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24821, 0, 1, null, 23078, null, 'CREDIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24822, 0, 1, null, 23078, null, 'DEBIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24823, 0, 1, null, 23078, null, 'DOCCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24824, 0, 1, null, 23078, null, 'DOCNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24825, 0, 1, null, 23078, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24826, 0, 1, null, 23078, null, 'GOSNI', 3, 0, 0, 'ГОС. НИ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24827, 0, 1, null, 23078, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24828, 0, 1, null, 23078, null, 'IDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24829, 0, 1, null, 23078, null, 'INCACCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24830, 0, 1, null, 23078, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24831, 0, 1, null, 23078, null, 'KDFROM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24832, 0, 1, null, 23078, null, 'KDTO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24833, 0, 1, null, 23078, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24834, 0, 1, null, 23078, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24835, 0, 1, null, 23078, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24836, 0, 1, null, 23078, null, 'SUBKDFROM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24837, 0, 1, null, 23078, null, 'SUBKDTO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INCTEMPLATETITLEVIEW
CALL FIELDSINFO_IMPORT(24879, 0, 1, null, 23079, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24880, 0, 1, null, 23079, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24881, 0, 1, null, 23079, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24882, 0, 1, null, 23079, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24883, 0, 1, null, 23079, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24884, 0, 1, null, 23079, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- INTERFACESVIEW
CALL FIELDSINFO_IMPORT(24888, 0, 1, null, 23080, null, 'GUID', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24889, 0, 1, null, 23080, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24890, 0, 1, null, 23080, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24891, 0, 1, null, 23080, null, 'PARAM', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORGNAMEINNACC
CALL FIELDSINFO_IMPORT(24930, 0, 1, null, 23081, null, 'ACC', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24931, 0, 1, null, 23081, null, 'ACC_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24932, 0, 1, null, 23081, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24933, 0, 1, null, 23081, null, 'INN', 6, 0, 0, 'ИНН', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24934, 0, 1, null, 23081, null, 'NAME', 1, 0, 2000, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24935, 0, 1, null, 23081, null, 'ORG_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PROTOCOLDOCTYPE
CALL FIELDSINFO_IMPORT(24937, 0, 1, null, 23082, null, 'ATYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24938, 0, 1, null, 23082, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24939, 0, 1, null, 23082, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24940, 0, 1, null, 23082, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24941, 0, 1, null, 23082, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24942, 0, 1, null, 23082, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- PROTOCOLREASON
CALL FIELDSINFO_IMPORT(24943, 0, 1, null, 23083, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24944, 0, 1, null, 23083, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24945, 0, 1, null, 23083, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24946, 0, 1, null, 23083, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24947, 0, 1, null, 23083, null, 'WEBID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- REG_JOURNAL
CALL FIELDSINFO_IMPORT(24949, 0, 1, null, 23084, null, 'DATEBEGIN', 11, 0, 0, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24950, 0, 1, null, 23084, null, 'DATEEND', 11, 0, 0, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24951, 0, 1, null, 23084, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24952, 0, 1, null, 23084, null, 'OBJECT_ID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24953, 0, 1, null, 23084, null, 'OBJECT_TYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24954, 0, 1, null, 23084, null, 'REGUSERS_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33053, 0, 1, null, 23084, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(33054, 0, 1, null, 23084, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- SCENARIO
CALL FIELDSINFO_IMPORT(24970, 0, 1, null, 23088, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24971, 0, 1, null, 23088, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24972, 0, 1, null, 23088, null, 'GENERATION', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24973, 0, 1, null, 23088, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24974, 0, 1, null, 23088, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24975, 0, 1, null, 23088, null, 'OPTIONSPATH', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24976, 0, 1, null, 23088, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24977, 0, 1, null, 23088, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29951, 0, 1, null, 23088, null, 'ISBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SELECTIONS
CALL FIELDSINFO_IMPORT(24978, 0, 1, null, 23089, null, 'ALIAS', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24979, 0, 1, null, 23089, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24980, 0, 1, null, 23089, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24981, 0, 1, null, 23089, null, 'DISCRIMVALUE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24982, 0, 1, null, 23089, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24983, 0, 1, null, 23089, null, 'KIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24984, 0, 1, null, 23089, null, 'MASTER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24985, 0, 1, null, 23089, null, 'NAME', 1, 0, 30, 'Наименование', '', 30, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24986, 0, 1, null, 23089, null, 'NEEDDISTINCT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24987, 0, 1, null, 23089, null, 'NEEDGROUPONDB', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24988, 0, 1, null, 23089, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24989, 0, 1, null, 23089, null, 'READONLY', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24990, 0, 1, null, 23089, null, 'TABLECODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24991, 0, 1, null, 23089, null, 'TABLENAME', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24992, 0, 1, null, 23089, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24993, 0, 1, null, 23089, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(24994, 0, 1, null, 23089, null, 'USEINDOC', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32952, 0, 1, null, 23089, null, 'ANNOTATION', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32953, 0, 1, null, 23089, null, 'AVAILABLEINDEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32954, 0, 1, null, 23089, null, 'CACHETYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32955, 0, 1, null, 23089, null, 'DELETEREFRTIME', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32956, 0, 1, null, 23089, null, 'DEREFNAME', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32957, 0, 1, null, 23089, null, 'FINDTIMEREFRESH', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32958, 0, 1, null, 23089, null, 'FULLORMODINSREFRTIME', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SELECTIONSDETAIL
CALL FIELDSINFO_IMPORT(25484, 0, 1, null, 23090, null, 'ADDCONDITION', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25485, 0, 1, null, 23090, null, 'ALIAS', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25486, 0, 1, null, 23090, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25487, 0, 1, null, 23090, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25488, 0, 1, null, 23090, null, 'DONTUSETABLELIMITS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25489, 0, 1, null, 23090, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25490, 0, 1, null, 23090, null, 'JOINCONDITION', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25491, 0, 1, null, 23090, null, 'JOINORDER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25492, 0, 1, null, 23090, null, 'JOINTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25493, 0, 1, null, 23090, null, 'LIMITNAMESLIST', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25494, 0, 1, null, 23090, null, 'RELATIONTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25495, 0, 1, null, 23090, null, 'SELECTIONREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 23089, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25496, 0, 1, null, 23090, null, 'TABLEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 23089, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25497, 0, 1, null, 23090, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25498, 0, 1, null, 23090, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- STATUSICONS
CALL FIELDSINFO_IMPORT(24999, 0, 1, null, 23091, null, 'DETAILNUM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25000, 0, 1, null, 23091, null, 'DOCPARAM', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25001, 0, 1, null, 23091, null, 'DOCREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25002, 0, 1, null, 23091, null, 'FORMULA', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25003, 0, 1, null, 23091, null, 'ICONHINT', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25004, 0, 1, null, 23091, null, 'ICONKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25005, 0, 1, null, 23091, null, 'ICONNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25006, 0, 1, null, 23091, null, 'ICONPOS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25007, 0, 1, null, 23091, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25008, 0, 1, null, 23091, null, 'ISSYSTEM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25009, 0, 1, null, 23091, null, 'LOCKMASK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25010, 0, 1, null, 23091, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25011, 0, 1, null, 23091, null, 'RESERVEPOS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25012, 0, 1, null, 23091, null, 'RUNPOS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29952, 0, 1, null, 23091, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29953, 0, 1, null, 23091, null, 'ISBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29954, 0, 1, null, 23091, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- SUMINPASSAGEVIEW
CALL FIELDSINFO_IMPORT(25015, 0, 1, null, 23092, null, 'ACCOUNTINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25016, 0, 1, null, 23092, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25017, 0, 1, null, 23092, null, 'BUHACCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25018, 0, 1, null, 23092, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25019, 0, 1, null, 23092, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25020, 0, 1, null, 23092, null, 'CREDIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25021, 0, 1, null, 23092, null, 'DEBIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25022, 0, 1, null, 23092, null, 'DOCCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25023, 0, 1, null, 23092, null, 'DOCNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25024, 0, 1, null, 23092, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25025, 0, 1, null, 23092, null, 'GOSNI', 3, 0, 0, 'ГОС. НИ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25026, 0, 1, null, 23092, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25027, 0, 1, null, 23092, null, 'IDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25028, 0, 1, null, 23092, null, 'INCACCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25029, 0, 1, null, 23092, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25030, 0, 1, null, 23092, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25031, 0, 1, null, 23092, null, 'ODATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25032, 0, 1, null, 23092, null, 'ORG_REF', 3, 0, 0, 'Ссылка на организацию', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25033, 0, 1, null, 23092, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25034, 0, 1, null, 23092, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25035, 0, 1, null, 23092, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25036, 0, 1, null, 23092, null, 'SUBKD', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25037, 0, 1, null, 23092, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25038, 0, 1, null, 23092, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UCONSCLIENTS
CALL FIELDSINFO_IMPORT(27884, 0, 1, null, 23093, null, 'BEGINDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27885, 0, 1, null, 23093, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27886, 0, 1, null, 23093, null, 'CODE', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27887, 0, 1, null, 23093, null, 'ENDDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27888, 0, 1, null, 23093, null, 'GRBSCODES', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27889, 0, 1, null, 23093, null, 'IFSADMCODES', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27890, 0, 1, null, 23093, null, 'INCOMESADMCODES', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27891, 0, 1, null, 23093, null, 'KVB', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27892, 0, 1, null, 23093, null, 'KVB_SKIF', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27893, 0, 1, null, 23093, null, 'OKATO', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27894, 0, 1, null, 23093, null, 'ORG', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27895, 0, 1, null, 23093, null, 'ORG_SKIF', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27897, 0, 1, null, 23093, null, 'PARAMS', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25343, 0, 1, null, 23093, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25344, 0, 1, null, 23093, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25345, 0, 1, null, 23093, null, 'EMAIL', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25346, 0, 1, null, 23093, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25347, 0, 1, null, 23093, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25348, 0, 1, null, 23093, null, 'IP', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25349, 0, 1, null, 23093, null, 'LOGIN', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25350, 0, 1, null, 23093, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25351, 0, 1, null, 23093, null, 'ORG_REF', 3, 0, 0, 'Ссылка на организацию', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25352, 0, 1, null, 23093, null, 'PASWORD', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25353, 0, 1, null, 23093, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25354, 0, 1, null, 23093, null, 'ROLES', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25355, 0, 1, null, 23093, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25356, 0, 1, null, 23093, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31755, 0, 1, null, 23093, null, 'ROWORDER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31756, 0, 1, null, 23093, null, 'SUBJECTTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- UNKNOWNREDIRECTMASTER
CALL FIELDSINFO_IMPORT(25063, 0, 1, null, 23094, null, 'ACCOUNTINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25064, 0, 1, null, 23094, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25065, 0, 1, null, 23094, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25066, 0, 1, null, 23094, null, 'CREDIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25067, 0, 1, null, 23094, null, 'DEBIT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25068, 0, 1, null, 23094, null, 'DOCCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25069, 0, 1, null, 23094, null, 'DOCNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25070, 0, 1, null, 23094, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25071, 0, 1, null, 23094, null, 'GOSNI', 3, 0, 0, 'ГОС. НИ', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25072, 0, 1, null, 23094, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25073, 0, 1, null, 23094, null, 'IDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25074, 0, 1, null, 23094, null, 'INCACCOUNT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25075, 0, 1, null, 23094, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25076, 0, 1, null, 23094, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25077, 0, 1, null, 23094, null, 'ORG_REF', 3, 0, 0, 'Ссылка на организацию', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25078, 0, 1, null, 23094, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25079, 0, 1, null, 23094, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25080, 0, 1, null, 23094, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25081, 0, 1, null, 23094, null, 'SUBKD', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- VZFINDETAIL
CALL FIELDSINFO_IMPORT(25107, 0, 1, null, 23095, null, 'DESTACC', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25108, 0, 1, null, 23095, null, 'DESTACC_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25109, 0, 1, null, 23095, null, 'DESTACCEPTDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25110, 0, 1, null, 23095, null, 'DESTACCOUNTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25111, 0, 1, null, 23095, null, 'DESTBUDGETREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25112, 0, 1, null, 23095, null, 'DESTCREATERUSER', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25113, 0, 1, null, 23095, null, 'DESTDOCTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25114, 0, 1, null, 23095, null, 'DESTFACIALACC_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25115, 0, 1, null, 23095, null, 'DESTFACT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25116, 0, 1, null, 23095, null, 'DESTFINSOURCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25117, 0, 1, null, 23095, null, 'DESTFINTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25118, 0, 1, null, 23095, null, 'DESTID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25119, 0, 1, null, 23095, null, 'DESTINN', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25120, 0, 1, null, 23095, null, 'DESTKCSR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25121, 0, 1, null, 23095, null, 'DESTKESR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25122, 0, 1, null, 23095, null, 'DESTKFSR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25123, 0, 1, null, 23095, null, 'DESTKVR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25124, 0, 1, null, 23095, null, 'DESTKVSR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25125, 0, 1, null, 23095, null, 'DESTNAME', 1, 0, 2000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25126, 0, 1, null, 23095, null, 'DESTNOTE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25127, 0, 1, null, 23095, null, 'DESTORG_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25128, 0, 1, null, 23095, null, 'DESTRECORDINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25129, 0, 1, null, 23095, null, 'DESTREGIONCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25130, 0, 1, null, 23095, null, 'DESTSUBKESR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25131, 0, 1, null, 23095, null, 'DESTSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25132, 0, 1, null, 23095, null, 'SRCACC', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25133, 0, 1, null, 23095, null, 'SRCACC_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25134, 0, 1, null, 23095, null, 'SRCACCEPTDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25135, 0, 1, null, 23095, null, 'SRCACCOUNTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25136, 0, 1, null, 23095, null, 'SRCBUDGETREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25137, 0, 1, null, 23095, null, 'SRCCREATERUSER', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25138, 0, 1, null, 23095, null, 'SRCDOCTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25139, 0, 1, null, 23095, null, 'SRCFACIALACC_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25140, 0, 1, null, 23095, null, 'SRCFACT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25141, 0, 1, null, 23095, null, 'SRCFINSOURCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25142, 0, 1, null, 23095, null, 'SRCFINTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25143, 0, 1, null, 23095, null, 'SRCID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25144, 0, 1, null, 23095, null, 'SRCINN', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25145, 0, 1, null, 23095, null, 'SRCKCSR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25146, 0, 1, null, 23095, null, 'SRCKESR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25147, 0, 1, null, 23095, null, 'SRCKFSR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25148, 0, 1, null, 23095, null, 'SRCKVR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25149, 0, 1, null, 23095, null, 'SRCKVSR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25150, 0, 1, null, 23095, null, 'SRCNAME', 1, 0, 2000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25151, 0, 1, null, 23095, null, 'SRCNOTE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25152, 0, 1, null, 23095, null, 'SRCORG_CLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25153, 0, 1, null, 23095, null, 'SRCRECORDINDEX', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25154, 0, 1, null, 23095, null, 'SRCREGIONCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25155, 0, 1, null, 23095, null, 'SRCSUBKESR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25156, 0, 1, null, 23095, null, 'SRCSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- V_FIN_BILLS_DET
CALL FIELDSINFO_IMPORT(25086, 0, 1, null, 23096, null, 'ANUMBER', 1, 0, 50, 'Номер документа', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25087, 0, 1, null, 23096, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25088, 0, 1, null, 23096, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25089, 0, 1, null, 23096, null, 'DATE_OUT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25090, 0, 1, null, 23096, null, 'DATEAMORTIZATION', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25091, 0, 1, null, 23096, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25092, 0, 1, null, 23096, null, 'NOMINAL', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25093, 0, 1, null, 23096, null, 'NOMINALPRICE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25094, 0, 1, null, 23096, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25095, 0, 1, null, 23096, null, 'PROGINDEX_BILL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25096, 0, 1, null, 23096, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25097, 0, 1, null, 23096, null, 'RECORDINDEX_BILL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25098, 0, 1, null, 23096, null, 'REF_ISSUE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25099, 0, 1, null, 23096, null, 'SERIES', 1, 0, 150, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25100, 0, 1, null, 23096, null, 'SUMMAOUT', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- WORKPLACESINTERFACES
CALL FIELDSINFO_IMPORT(25157, 0, 1, null, 23097, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25158, 0, 1, null, 23097, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25159, 0, 1, null, 23097, null, 'WORKPLACES_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- WORKPLACESUSER
CALL FIELDSINFO_IMPORT(25160, 0, 1, null, 23098, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25161, 0, 1, null, 23098, null, 'USERNAME', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25162, 0, 1, null, 23098, null, 'WORKPLACES_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- WORKPLACESVIEW
CALL FIELDSINFO_IMPORT(25163, 0, 1, null, 23099, null, 'HIDETABS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25164, 0, 1, null, 23099, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25165, 0, 1, null, 23099, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- DOCUMENTTEMPLATEFIELDS
CALL FIELDSINFO_IMPORT(25308, 0, 1, null, 23100, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25309, 0, 1, null, 23100, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25310, 0, 1, null, 23100, null, 'DOCUMENTCLSREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22823, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25311, 0, 1, null, 23100, null, 'FIELDS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20821, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25312, 0, 1, null, 23100, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25313, 0, 1, null, 23100, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25314, 0, 1, null, 23100, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- WRITEXECUTIONCAPTION
CALL FIELDSINFO_IMPORT(32144, 0, 1, null, 23400, null, 'INNERNUMBER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25391, 0, 1, null, 23400, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25392, 0, 1, null, 23400, null, 'COUNTDAYDURING', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25393, 0, 1, null, 23400, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25394, 0, 1, null, 23400, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25395, 0, 1, null, 23400, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25398, 0, 1, null, 23400, null, 'DOCNUMBER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25399, 0, 1, null, 23400, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25402, 0, 1, null, 23400, null, 'ENDDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25403, 0, 1, null, 23400, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25404, 0, 1, null, 23400, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25405, 0, 1, null, 23400, null, 'ISSUEDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25406, 0, 1, null, 23400, null, 'LASTEXTRCHANGE', 11, 0, 0, 'Дата экстренного изменения', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25407, 0, 1, null, 23400, null, 'LAWDEPARTMENTDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25408, 0, 1, null, 23400, null, 'LAWDEPARTMENTNUMBER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25409, 0, 1, null, 23400, null, 'LEVIERACC_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25410, 0, 1, null, 23400, null, 'LEVIERORG_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 16642, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25411, 0, 1, null, 23400, null, 'NAMEJUDICIALAGENCY', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25412, 0, 1, null, 23400, null, 'NAMEJUDICIALDECISION', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25413, 0, 1, null, 23400, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25416, 0, 1, null, 23400, null, 'NUMBERDOSSIER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25417, 0, 1, null, 23400, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25418, 0, 1, null, 23400, null, 'REJECT_CLS', 3, 0, 0, 'Код причины отклонения', '', 11, '', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25419, 0, 1, null, 23400, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25424, 0, 1, null, 23400, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25425, 0, 1, null, 23400, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25426, 0, 1, null, 23400, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25427, 0, 1, null, 23400, null, 'STARTDATE', 6, 0, 0, 'Дата начала срока действия', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25430, 0, 1, null, 23400, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25431, 0, 1, null, 23400, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25432, 0, 1, null, 23400, null, 'WRITEXECUTIONTOTALSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31829, 0, 1, null, 23400, null, 'CASECATEGORY', 3, 0, 0, 'Код категории дела', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31830, 0, 1, null, 23400, null, 'COURTSHEETSCOUNT', 3, 0, 0, 'Кол-во листов копий судебного акта', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31831, 0, 1, null, 23400, null, 'DEBTORNAME', 1, 0, 1024, 'Наименование организации должника', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31832, 0, 1, null, 23400, null, 'DELIVERYDATE', 6, 0, 0, 'Дата вручения уведомления должнику', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31833, 0, 1, null, 23400, null, 'ISINVALID', 3, 0, 0, 'Недействителен', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31834, 0, 1, null, 23400, null, 'PRESENTDATE', 6, 0, 0, 'Дата предьявления (дата ввода)', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31835, 0, 1, null, 23400, null, 'SHEETSCOUNT', 3, 0, 0, 'Количество листов приложения', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31836, 0, 1, null, 23400, null, 'UNIQUENUMBER', 3, 0, 0, 'Уникальный номер ИЛ', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31837, 0, 1, null, 23400, null, 'WRITPERIOD', 3, 0, 0, 'Периодичность', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31838, 0, 1, null, 23400, null, 'WRITTYPE', 3, 0, 0, 'Тип исп. документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- WRITEXECUTIONDETAIL
CALL FIELDSINFO_IMPORT(32969, 0, 1, null, 23401, null, 'BUDALLOCATIONCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32970, 0, 1, null, 23401, null, 'PAYPROMISECLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32971, 0, 1, null, 23401, null, 'SUBSIDYCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32972, 0, 1, null, 23401, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', '', 11, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25433, 0, 1, null, 23401, null, 'BUDGETPROMISE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25434, 0, 1, null, 23401, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25435, 0, 1, null, 23401, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25436, 0, 1, null, 23401, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25437, 0, 1, null, 23401, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25438, 0, 1, null, 23401, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25439, 0, 1, null, 23401, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25440, 0, 1, null, 23401, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '', '', '', 0, 0, null, 1, 16964, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25441, 0, 1, null, 23401, null, 'FINSOURCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25442, 0, 1, null, 23401, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25443, 0, 1, null, 23401, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25444, 0, 1, null, 23401, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '', '', '', 0, 0, null, 1, 16857, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25445, 0, 1, null, 23401, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25446, 0, 1, null, 23401, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25447, 0, 1, null, 23401, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25448, 0, 1, null, 23401, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25449, 0, 1, null, 23401, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '', '', '', 0, 0, null, 1, 17311, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25450, 0, 1, null, 23401, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25451, 0, 1, null, 23401, null, 'PROMISE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25452, 0, 1, null, 23401, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 23400, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25453, 0, 1, null, 23401, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '', '', '', 0, 0, null, 1, 16688, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25454, 0, 1, null, 23401, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25455, 0, 1, null, 23401, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25456, 0, 1, null, 23401, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25457, 0, 1, null, 23401, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '', '', '', 0, 0, null, 1, 16915, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25458, 0, 1, null, 23401, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25459, 0, 1, null, 23401, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(25460, 0, 1, null, 23401, null, 'WRITEXECUTIONSUMMA', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30626, 0, 1, null, 23401, null, 'EXECDOC', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 19736, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31839, 0, 1, null, 23401, null, 'MONTH01', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31840, 0, 1, null, 23401, null, 'MONTH02', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31841, 0, 1, null, 23401, null, 'MONTH03', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31842, 0, 1, null, 23401, null, 'MONTH04', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31843, 0, 1, null, 23401, null, 'MONTH05', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31844, 0, 1, null, 23401, null, 'MONTH06', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31845, 0, 1, null, 23401, null, 'MONTH07', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31846, 0, 1, null, 23401, null, 'MONTH08', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 37, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31847, 0, 1, null, 23401, null, 'MONTH09', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 38, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31848, 0, 1, null, 23401, null, 'MONTH10', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31849, 0, 1, null, 23401, null, 'MONTH11', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31850, 0, 1, null, 23401, null, 'MONTH12', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31851, 0, 1, null, 23401, null, 'MONTHLYDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31852, 0, 1, null, 23401, null, 'PARENTID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31853, 0, 1, null, 23401, null, 'PSCHEDULEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 20221, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31854, 0, 1, null, 23401, null, 'QUARTER1', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31855, 0, 1, null, 23401, null, 'QUARTER2', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31856, 0, 1, null, 23401, null, 'QUARTER3', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31857, 0, 1, null, 23401, null, 'QUARTER4', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31858, 0, 1, null, 23401, null, 'QUARTERLYMONTHDAY', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31859, 0, 1, null, 23401, null, 'QUARTERLYMONTHNUMBER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SUBSIDYCLS
CALL FIELDSINFO_IMPORT(26640, 0, 1, null, 26536, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26641, 0, 1, null, 26536, null, 'CODE', 1, 0, 20, 'Значимый код', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26642, 0, 1, null, 26536, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26643, 0, 1, null, 26536, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26644, 0, 1, null, 26536, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26645, 0, 1, null, 26536, null, 'ID', 3, 0, 0, 'Код', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26646, 0, 1, null, 26536, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26647, 0, 1, null, 26536, null, 'ORG_REF', 3, 0, 0, 'Ссылка на организацию', '', 11, '', '', '', 0, 0, null, 1, 16642, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26648, 0, 1, null, 26536, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26649, 0, 1, null, 26536, null, 'SUBSIDYKIND', 3, 0, 0, 'Вид субсидии', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26650, 0, 1, null, 26536, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26651, 0, 1, null, 26536, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30621, 0, 1, null, 26536, null, 'BELONGINGKIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30622, 0, 1, null, 26536, null, 'SUBSIDYYEAR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31747, 0, 1, null, 26536, null, 'DOCUMENTCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16973, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ED_CORRECTIONCAPTION
CALL FIELDSINFO_IMPORT(26553, 0, 1, null, 26537, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26554, 0, 1, null, 26537, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26555, 0, 1, null, 26537, null, 'DOCDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26556, 0, 1, null, 26537, null, 'DOCNUMBER', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26557, 0, 1, null, 26537, null, 'DOCUMENTNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26558, 0, 1, null, 26537, null, 'ELDOCNUMBER', 1, 0, 36, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26559, 0, 1, null, 26537, null, 'FACIALCODE', 1, 0, 11, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26560, 0, 1, null, 26537, null, 'FUND_SOURCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26561, 0, 1, null, 26537, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26562, 0, 1, null, 26537, null, 'INN', 1, 0, 20, 'ИНН', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26563, 0, 1, null, 26537, null, 'KPP', 1, 0, 9, '', '', 9, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26564, 0, 1, null, 26537, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26565, 0, 1, null, 26537, null, 'PACKETNUMBER', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26566, 0, 1, null, 26537, null, 'PROCDOCCLASS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26567, 0, 1, null, 26537, null, 'PROCNOTE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26568, 0, 1, null, 26537, null, 'PROCSTATE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26569, 0, 1, null, 26537, null, 'SOURCEACC', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26570, 0, 1, null, 26537, null, 'SOURCEINN', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26571, 0, 1, null, 26537, null, 'SOURCEKPP', 1, 0, 9, '', '', 9, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26572, 0, 1, null, 26537, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26573, 0, 1, null, 26537, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27006, 0, 1, null, 26537, null, 'DATE_POD', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27007, 0, 1, null, 26537, null, 'DEPARTMENTCLS', 3, 0, 0, '', '', 9, '', '', '', 0, 0, null, 0, 19786, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27008, 0, 1, null, 26537, null, 'DOL_ISP', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27009, 0, 1, null, 26537, null, 'DOL_RUK', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27010, 0, 1, null, 26537, null, 'NAME_ISP', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27011, 0, 1, null, 26537, null, 'NAME_RUK', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27012, 0, 1, null, 26537, null, 'PROCUSEINFO', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27013, 0, 1, null, 26537, null, 'SOURCENAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27014, 0, 1, null, 26537, null, 'TEL_ISP', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ED_CORRECTIONDETAIL
CALL FIELDSINFO_IMPORT(26574, 0, 1, null, 26538, null, 'ADDCLS', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26575, 0, 1, null, 26538, null, 'CLSTYPE', 3, 0, 0, 'Тип классификации', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26576, 0, 1, null, 26538, null, 'CLSVALUE', 1, 0, 20, '', '', 21, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26577, 0, 1, null, 26538, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26578, 0, 1, null, 26538, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26579, 0, 1, null, 26538, null, 'DATE_ZR', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26580, 0, 1, null, 26538, null, 'DESTINN', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26581, 0, 1, null, 26538, null, 'DESTKPP', 1, 0, 9, '', '', 9, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26582, 0, 1, null, 26538, null, 'DESTNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26583, 0, 1, null, 26538, null, 'ELDOCNUMBER', 1, 0, 36, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26584, 0, 1, null, 26538, null, 'FACIALCODE', 1, 0, 11, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26585, 0, 1, null, 26538, null, 'FUND_SOURCE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26586, 0, 1, null, 26538, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26587, 0, 1, null, 26538, null, 'KOD_DOC', 1, 0, 2, '', '', 2, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26588, 0, 1, null, 26538, null, 'NOM_ZR', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26589, 0, 1, null, 26538, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26590, 0, 1, null, 26538, null, 'OKATO', 1, 0, 11, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26591, 0, 1, null, 26538, null, 'ORIGINALDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26592, 0, 1, null, 26538, null, 'ORIGINALNUMBER', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26593, 0, 1, null, 26538, null, 'PARENTID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26594, 0, 1, null, 26538, null, 'PURPOSE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26595, 0, 1, null, 26538, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 26537, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26596, 0, 1, null, 26538, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26597, 0, 1, null, 26538, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26598, 0, 1, null, 26538, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35802, 0, 1, null, 26538, null, 'OKTMO', 1, 0, 11, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REPLACEMENTCLSCAPTION
CALL FIELDSINFO_IMPORT(26800, 0, 1, null, 26793, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26801, 0, 1, null, 26793, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26802, 0, 1, null, 26793, null, 'DOCNUMBER', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26803, 0, 1, null, 26793, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26804, 0, 1, null, 26793, null, 'INPUTDATE', 6, 0, 0, 'Дата ввода', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26805, 0, 1, null, 26793, null, 'NOTE', 1, 0, 512, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26807, 0, 1, null, 26793, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26808, 0, 1, null, 26793, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29926, 0, 1, null, 26793, null, 'ACCEPTDATE', 6, 0, 0, 'Дата принятия(проведения) документа', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29927, 0, 1, null, 26793, null, 'PROTOCOL', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29928, 0, 1, null, 26793, null, 'PZKENDDATE', 11, 0, 0, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29929, 0, 1, null, 26793, null, 'PZKSTARTDATE', 11, 0, 0, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29930, 0, 1, null, 26793, null, 'PZKUSER', 1, 0, 30, '', '', 30, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29931, 0, 1, null, 26793, null, 'REJECT_CAUSE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29932, 0, 1, null, 26793, null, 'REJECT_CLS', 3, 0, 0, 'Код причины отклонения', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31713, 0, 1, null, 26793, null, 'CLASSORIGINALDOC', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31714, 0, 1, null, 26793, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31715, 0, 1, null, 26793, null, 'NUMBERRECORDS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REPLACEMENTCLSDETAIL
CALL FIELDSINFO_IMPORT(26809, 0, 1, null, 26794, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26810, 0, 1, null, 26794, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26811, 0, 1, null, 26794, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26814, 0, 1, null, 26794, null, 'LINKID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26816, 0, 1, null, 26794, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 26793, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26817, 0, 1, null, 26794, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26818, 0, 1, null, 26794, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29933, 0, 1, null, 26794, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- REPLACEMENTCLSDETAILINFO
CALL FIELDSINFO_IMPORT(26819, 0, 1, null, 26795, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26820, 0, 1, null, 26795, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26839, 0, 1, null, 26795, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26840, 0, 1, null, 26795, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 26793, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26860, 0, 1, null, 26795, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 42, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26861, 0, 1, null, 26795, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 43, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(29939, 0, 1, null, 26795, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31716, 0, 1, null, 26795, null, 'ASSIGNMENTKIND', 3, 0, 0, '', '', 9, '', '', '', 0, 0, null, 0, 22976, 0, 0, 0, '', 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31717, 0, 1, null, 26795, null, 'BUDALLOCATIONCLS', 3, 0, 0, '', '', 9, '', '', '', 0, 0, null, 0, 27814, 0, 0, 0, '', 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31718, 0, 1, null, 26795, null, 'CLSTYPE', 3, 0, 0, 'Тип классификации', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 57, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31719, 0, 1, null, 26795, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 4, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31720, 0, 1, null, 26795, null, 'DOCBASE', 3, 0, 0, '', '', 10, '', '', '', 0, 0, null, 0, 16973, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31721, 0, 1, null, 26795, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 13, '', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31722, 0, 1, null, 26795, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 9, '', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31723, 0, 1, null, 26795, null, 'FINSOURCE', 3, 0, 0, '', '', 4, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31724, 0, 1, null, 26795, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 5, '', '', '', 0, 0, null, 0, 16955, 0, 0, 0, '', 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31725, 0, 1, null, 26795, null, 'IFS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31726, 0, 1, null, 26795, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31727, 0, 1, null, 26795, null, 'KD', 3, 0, 0, 'Ссылка на код дохода', '', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31728, 0, 1, null, 26795, null, 'KESR', 3, 0, 0, 'ЭКР', '', 6, '', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31729, 0, 1, null, 26795, null, 'KFSR', 3, 0, 0, 'ФКР', '', 6, '', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31730, 0, 1, null, 26795, null, 'KVR', 3, 0, 0, 'КВР', '', 7, '', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31731, 0, 1, null, 26795, null, 'KVSR', 3, 0, 0, 'КВСР', '', 4, '', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31732, 0, 1, null, 26795, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 9, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31733, 0, 1, null, 26795, null, 'PARENTID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31734, 0, 1, null, 26795, null, 'PAYPROMISECLS', 3, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, 27815, 0, 0, 0, '', 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31735, 0, 1, null, 26795, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31736, 0, 1, null, 26795, null, 'REESTRNUMBER', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31737, 0, 1, null, 26795, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 9, '', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31738, 0, 1, null, 26795, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 10, '', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31739, 0, 1, null, 26795, null, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31740, 0, 1, null, 26795, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', '', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31741, 0, 1, null, 26795, null, 'VARIANT', 3, 0, 0, '', '', 4, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UTYPEDIMPORTREGISTRY
CALL FIELDSINFO_IMPORT(26862, 0, 1, null, 26796, null, 'CRC32', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26863, 0, 1, null, 26796, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26864, 0, 1, null, 26796, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26865, 0, 1, null, 26796, null, 'FILEDATA', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26866, 0, 1, null, 26796, null, 'FILENAME', 1, 0, 1000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26867, 0, 1, null, 26796, null, 'FILESIZE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26868, 0, 1, null, 26796, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26869, 0, 1, null, 26796, null, 'ISACTIVE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26870, 0, 1, null, 26796, null, 'NOTE', 1, 0, 4000, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26871, 0, 1, null, 26796, null, 'PARAMS', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26872, 0, 1, null, 26796, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 20983, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26873, 0, 1, null, 26796, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(26874, 0, 1, null, 26796, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- BUDALLOCATIONCLS
CALL FIELDSINFO_IMPORT(27824, 0, 1, null, 27814, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27825, 0, 1, null, 27814, null, 'CODE', 1, 0, 20, '', '', 8, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27826, 0, 1, null, 27814, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27827, 0, 1, null, 27814, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27828, 0, 1, null, 27814, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27829, 0, 1, null, 27814, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27830, 0, 1, null, 27814, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27831, 0, 1, null, 27814, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27832, 0, 1, null, 27814, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27833, 0, 1, null, 27814, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- PAYPROMISECLS
CALL FIELDSINFO_IMPORT(27848, 0, 1, null, 27815, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27849, 0, 1, null, 27815, null, 'CODE', 1, 0, 20, '', '', 12, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27850, 0, 1, null, 27815, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27851, 0, 1, null, 27815, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27852, 0, 1, null, 27815, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27853, 0, 1, null, 27815, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27854, 0, 1, null, 27815, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27855, 0, 1, null, 27815, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27856, 0, 1, null, 27815, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27857, 0, 1, null, 27815, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UCONSCHAINSCAPTION
CALL FIELDSINFO_IMPORT(27867, 0, 1, null, 27816, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27868, 0, 1, null, 27816, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27869, 0, 1, null, 27816, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27870, 0, 1, null, 27816, null, 'ISCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27871, 0, 1, null, 27816, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27872, 0, 1, null, 27816, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27873, 0, 1, null, 27816, null, 'TEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27874, 0, 1, null, 27816, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27875, 0, 1, null, 27816, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UCONSCHAINSDETAIL
CALL FIELDSINFO_IMPORT(27876, 0, 1, null, 27817, null, 'CHILDREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 23093, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27877, 0, 1, null, 27817, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27878, 0, 1, null, 27817, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27879, 0, 1, null, 27817, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27880, 0, 1, null, 27817, null, 'PARENTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 23093, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27881, 0, 1, null, 27817, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 27816, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27882, 0, 1, null, 27817, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27883, 0, 1, null, 27817, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UCONSGROUPSCAPTION
CALL FIELDSINFO_IMPORT(27898, 0, 1, null, 27818, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27899, 0, 1, null, 27818, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27900, 0, 1, null, 27818, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27901, 0, 1, null, 27818, null, 'ISCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27902, 0, 1, null, 27818, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27903, 0, 1, null, 27818, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27904, 0, 1, null, 27818, null, 'TEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27905, 0, 1, null, 27818, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27906, 0, 1, null, 27818, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UCONSGROUPSDETAIL
CALL FIELDSINFO_IMPORT(27907, 0, 1, null, 27819, null, 'CONSCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 23093, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27908, 0, 1, null, 27819, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27909, 0, 1, null, 27819, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27910, 0, 1, null, 27819, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27911, 0, 1, null, 27819, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 27818, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27912, 0, 1, null, 27819, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27913, 0, 1, null, 27819, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UCONSSUBJECTFORMS
CALL FIELDSINFO_IMPORT(27914, 0, 1, null, 27820, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27915, 0, 1, null, 27820, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27916, 0, 1, null, 27820, null, 'FORMTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27917, 0, 1, null, 27820, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27918, 0, 1, null, 27820, null, 'ISCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27919, 0, 1, null, 27820, null, 'SUBJECTTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 1, 27821, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27920, 0, 1, null, 27820, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27921, 0, 1, null, 27820, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31757, 0, 1, null, 27820, null, 'BEGINDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31758, 0, 1, null, 27820, null, 'ENDDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31759, 0, 1, null, 27820, null, 'FINT1', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31760, 0, 1, null, 27820, null, 'FINT2', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31761, 0, 1, null, 27820, null, 'FINT3', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31762, 0, 1, null, 27820, null, 'FINT4', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31763, 0, 1, null, 27820, null, 'FINT5', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31764, 0, 1, null, 27820, null, 'FINT6', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31765, 0, 1, null, 27820, null, 'FINT7', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- UCONSSUBJECTTYPES
CALL FIELDSINFO_IMPORT(27922, 0, 1, null, 27821, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27923, 0, 1, null, 27821, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27924, 0, 1, null, 27821, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27925, 0, 1, null, 27821, null, 'ISCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27926, 0, 1, null, 27821, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27927, 0, 1, null, 27821, null, 'TEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27928, 0, 1, null, 27821, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(27929, 0, 1, null, 27821, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ARCHIVEDOCPARAMS
CALL FIELDSINFO_IMPORT(30661, 0, 1, null, 30653, null, 'CLOSEDATTR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30662, 0, 1, null, 30653, null, 'CLSTYPE', 3, 0, 0, 'Тип классификации', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30663, 0, 1, null, 30653, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30664, 0, 1, null, 30653, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30665, 0, 1, null, 30653, null, 'FIXEDATTR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30666, 0, 1, null, 30653, null, 'GROUPNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30667, 0, 1, null, 30653, null, 'HIDDENATTR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30668, 0, 1, null, 30653, null, 'HINT', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30669, 0, 1, null, 30653, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30670, 0, 1, null, 30653, null, 'KEYATTR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30671, 0, 1, null, 30653, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30672, 0, 1, null, 30653, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30673, 0, 1, null, 30653, null, 'PARAMORDER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30674, 0, 1, null, 30653, null, 'PARAMSIZE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30675, 0, 1, null, 30653, null, 'PARAMTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30676, 0, 1, null, 30653, null, 'PICKLIST', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30677, 0, 1, null, 30653, null, 'READONLYATTR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30678, 0, 1, null, 30653, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 30654, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30679, 0, 1, null, 30653, null, 'REQUIREDATTR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30680, 0, 1, null, 30653, null, 'STORAGENAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30681, 0, 1, null, 30653, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30682, 0, 1, null, 30653, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31083, 0, 1, null, 30653, null, 'VALUEATTR', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31626, 0, 1, null, 30653, null, 'BANMLTATTR', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31627, 0, 1, null, 30653, null, 'MAPPINGATTR', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ARCHIVEDOCTYPE
CALL FIELDSINFO_IMPORT(30683, 0, 1, null, 30654, null, 'BEGINDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30684, 0, 1, null, 30654, null, 'CODE', 1, 0, 20, '', '', 14, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30685, 0, 1, null, 30654, null, 'CONSTRAINTSCRIPTNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30686, 0, 1, null, 30654, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30687, 0, 1, null, 30654, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30688, 0, 1, null, 30654, null, 'CREATINGSCRIPTNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30689, 0, 1, null, 30654, null, 'ENDDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30690, 0, 1, null, 30654, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30691, 0, 1, null, 30654, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30692, 0, 1, null, 30654, null, 'PERIODTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30693, 0, 1, null, 30654, null, 'SECTIONTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22489, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30694, 0, 1, null, 30654, null, 'TEMPLATECODE', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30695, 0, 1, null, 30654, null, 'TEMPLATETYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30696, 0, 1, null, 30654, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30697, 0, 1, null, 30654, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30893, 0, 1, null, 30654, null, 'SIGNSCHEME', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 30659, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31084, 0, 1, null, 30654, null, 'ENABLEDIMPORTKINDS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31628, 0, 1, null, 30654, null, 'DYNSETNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31629, 0, 1, null, 30654, null, 'LIMITPARAMS', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31630, 0, 1, null, 30654, null, 'STORETOLINK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ARCHIVEOPLOG
CALL FIELDSINFO_IMPORT(30698, 0, 1, null, 30655, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30699, 0, 1, null, 30655, null, 'CREATERINFO', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30700, 0, 1, null, 30655, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30701, 0, 1, null, 30655, null, 'DATAPACKETREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 22468, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30702, 0, 1, null, 30655, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30703, 0, 1, null, 30655, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30704, 0, 1, null, 30655, null, 'OPTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- SIGNLOG
CALL FIELDSINFO_IMPORT(30729, 0, 1, null, 30656, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30730, 0, 1, null, 30656, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30731, 0, 1, null, 30656, null, 'DOCID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30732, 0, 1, null, 30656, null, 'EDS_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30733, 0, 1, null, 30656, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30735, 0, 1, null, 30656, null, 'SIGNREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 30660, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30736, 0, 1, null, 30656, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30737, 0, 1, null, 30656, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31742, 0, 1, null, 30656, null, 'CREATERINFO', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35116, 0, 1, null, 30656, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35118, 0, 1, null, 30656, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35119, 0, 1, null, 30656, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35120, 0, 1, null, 30656, null, 'SIGNDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35121, 0, 1, null, 30656, null, 'SIGNID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35338, 0, 1, null, 30656, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 0, 20598, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35339, 0, 1, null, 30656, null, 'STATEHISTORYREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21585, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SIGNPARAMS
CALL FIELDSINFO_IMPORT(30738, 0, 1, null, 30657, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30739, 0, 1, null, 30657, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30740, 0, 1, null, 30657, null, 'DOCID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30741, 0, 1, null, 30657, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30742, 0, 1, null, 30657, null, 'ISSIGNEND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30743, 0, 1, null, 30657, null, 'ISSTEPEND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30744, 0, 1, null, 30657, null, 'SIGNMASK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30745, 0, 1, null, 30657, null, 'SIGNREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 30660, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30746, 0, 1, null, 30657, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30747, 0, 1, null, 30657, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SIGNS
CALL FIELDSINFO_IMPORT(30748, 0, 1, null, 30658, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30749, 0, 1, null, 30658, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30750, 0, 1, null, 30658, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30751, 0, 1, null, 30658, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30752, 0, 1, null, 30658, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30753, 0, 1, null, 30658, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35136, 0, 1, null, 30658, null, 'ISBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35137, 0, 1, null, 30658, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SIGNSCHEMECAPTION
CALL FIELDSINFO_IMPORT(30755, 0, 1, null, 30659, null, 'CLOSEDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30756, 0, 1, null, 30659, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30757, 0, 1, null, 30659, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30759, 0, 1, null, 30659, null, 'DOCTYPEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 20598, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30761, 0, 1, null, 30659, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30762, 0, 1, null, 30659, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30763, 0, 1, null, 30659, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30764, 0, 1, null, 30659, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30765, 0, 1, null, 30659, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35138, 0, 1, null, 30659, null, 'ISBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SIGNSCHEMEDETAIL
CALL FIELDSINFO_IMPORT(30766, 0, 1, null, 30660, null, 'ACTIONREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 21569, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30767, 0, 1, null, 30660, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30768, 0, 1, null, 30660, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30769, 0, 1, null, 30660, null, 'FICTIVESIGN', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30770, 0, 1, null, 30660, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30771, 0, 1, null, 30660, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 30659, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30772, 0, 1, null, 30660, null, 'SIGNMASK', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30773, 0, 1, null, 30660, null, 'SIGNORDER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30774, 0, 1, null, 30660, null, 'SIGNREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 30658, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30775, 0, 1, null, 30660, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(30776, 0, 1, null, 30660, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- WRITEXECUTIONNOTIFY
CALL FIELDSINFO_IMPORT(31860, 0, 1, null, 31615, null, 'CREATEDATE', 11, 0, 0, 'Дата создания(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31861, 0, 1, null, 31615, null, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31862, 0, 1, null, 31615, null, 'DESCRIPTION', 1, 0, 1024, 'Описание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31863, 0, 1, null, 31615, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31864, 0, 1, null, 31615, null, 'NOTE', 1, 0, 1024, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31865, 0, 1, null, 31615, null, 'NOTIFYCLS', 3, 0, 0, 'Тип уведомления (код)', '', 11, '', '', '', 0, 0, null, 1, 31616, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31866, 0, 1, null, 31615, null, 'NOTIFYDATE', 6, 0, 0, 'Дата уведомления', '', 13, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31867, 0, 1, null, 31615, null, 'NOTIFYNUMBER', 1, 0, 255, 'Номер', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31868, 0, 1, null, 31615, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 23400, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31869, 0, 1, null, 31615, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31870, 0, 1, null, 31615, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31871, 0, 1, null, 31615, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения(Авторизация)', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31872, 0, 1, null, 31615, null, 'UPDATERUSER', 1, 0, 30, 'Изменил(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- WRITNOTIFYCLS
CALL FIELDSINFO_IMPORT(31873, 0, 1, null, 31616, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31874, 0, 1, null, 31616, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31875, 0, 1, null, 31616, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 5, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31876, 0, 1, null, 31616, null, 'NAME', 1, 0, 1024, 'Тип уведомления', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31877, 0, 1, null, 31616, null, 'NOTE', 1, 0, 1024, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31878, 0, 1, null, 31616, null, 'SHORTNAME', 1, 0, 1024, 'Тип уведомления (краткое наименование)', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31879, 0, 1, null, 31616, null, 'STATEFILTER', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31880, 0, 1, null, 31616, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31881, 0, 1, null, 31616, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- GENERALDOCSDETAIL
CALL FIELDSINFO_IMPORT(31660, 0, 1, null, 31617, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31661, 0, 1, null, 31617, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31662, 0, 1, null, 31617, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31663, 0, 1, null, 31617, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31664, 0, 1, null, 31617, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, 31618, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31665, 0, 1, null, 31617, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31666, 0, 1, null, 31617, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31667, 0, 1, null, 31617, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31668, 0, 1, null, 31617, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31669, 0, 1, null, 31617, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- GENERALDOCUMENTS
CALL FIELDSINFO_IMPORT(31670, 0, 1, null, 31618, null, 'ARCHIVEDOCTYPE', 3, 0, 0, '', '', 14, '', '', '', 0, 0, null, 0, 30654, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31671, 0, 1, null, 31618, null, 'BEGINDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31672, 0, 1, null, 31618, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31673, 0, 1, null, 31618, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31674, 0, 1, null, 31618, null, 'CRYPTOSTATUS', 3, 0, 0, 'Статус ЭЦП', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31675, 0, 1, null, 31618, null, 'DOCBASE', 3, 0, 0, '', '', 10, '', '', '', 0, 0, null, 1, 16973, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31676, 0, 1, null, 31618, null, 'DOCNUMBER', 1, 0, 50, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31677, 0, 1, null, 31618, null, 'DOCSTATEREF', 3, 0, 0, 'Код состояния документа', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31678, 0, 1, null, 31618, null, 'DOCTYPESLIST', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31679, 0, 1, null, 31618, null, 'ENDDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31680, 0, 1, null, 31618, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 13, '', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31681, 0, 1, null, 31618, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31682, 0, 1, null, 31618, null, 'LASTEXTRCHANGE', 11, 0, 0, 'Дата экстренного изменения', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31683, 0, 1, null, 31618, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31684, 0, 1, null, 31618, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31685, 0, 1, null, 31618, null, 'REGISTRATIONDATE', 6, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31686, 0, 1, null, 31618, null, 'REJECTCAUSE', 1, 0, 255, 'Текст причины отклонения', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31687, 0, 1, null, 31618, null, 'REJECTCLS', 3, 0, 0, 'Код причины отклонения', '', 9, '', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31688, 0, 1, null, 31618, null, 'RVERSION', 3, 0, 0, 'Версия записи', '', 11, '', '', '', 1, 0, null, 0, null, 0, 0, 1, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31689, 0, 1, null, 31618, null, 'SENDERID', 3, 0, 0, 'Код удаленного клиента, отославшего документ(запись)', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31690, 0, 1, null, 31618, null, 'SENDERRECORDID', 3, 0, 0, 'Код документа(записи) в базе удаленного клиента', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31691, 0, 1, null, 31618, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31692, 0, 1, null, 31618, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- UTYPEDDOCUMENTS
CALL FIELDSINFO_IMPORT(31766, 0, 1, null, 31619, null, 'BEGINDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31767, 0, 1, null, 31619, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31768, 0, 1, null, 31619, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31769, 0, 1, null, 31619, null, 'ENDDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31770, 0, 1, null, 31619, null, 'FORMTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31771, 0, 1, null, 31619, null, 'FORURM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31772, 0, 1, null, 31619, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31773, 0, 1, null, 31619, null, 'ISCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31774, 0, 1, null, 31619, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31775, 0, 1, null, 31619, null, 'PARAMS', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31776, 0, 1, null, 31619, null, 'PROGINDEX', 3, 0, 0, 'Индекс блока данных документа', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31777, 0, 1, null, 31619, null, 'TEMPLATE', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31778, 0, 1, null, 31619, null, 'TEMPLATEDATA', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31779, 0, 1, null, 31619, null, 'TEXTID', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31780, 0, 1, null, 31619, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31781, 0, 1, null, 31619, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UTYPEDPERIODCAPTION
CALL FIELDSINFO_IMPORT(31788, 0, 1, null, 31620, null, 'BEGINDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31789, 0, 1, null, 31620, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31790, 0, 1, null, 31620, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31791, 0, 1, null, 31620, null, 'ENDDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31792, 0, 1, null, 31620, null, 'EXPIRYDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31793, 0, 1, null, 31620, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31794, 0, 1, null, 31620, null, 'ISCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31795, 0, 1, null, 31620, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31796, 0, 1, null, 31620, null, 'PERIOD', 3, 0, 0, 'Период', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31797, 0, 1, null, 31620, null, 'REGULATIONDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31798, 0, 1, null, 31620, null, 'REPORTDATE', 6, 0, 0, '', '', 13, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31799, 0, 1, null, 31620, null, 'TEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31800, 0, 1, null, 31620, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31801, 0, 1, null, 31620, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UTYPEDPERIODDETAIL
CALL FIELDSINFO_IMPORT(31802, 0, 1, null, 31621, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31803, 0, 1, null, 31621, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31804, 0, 1, null, 31621, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31805, 0, 1, null, 31621, null, 'PERIODTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, 31620, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31806, 0, 1, null, 31621, null, 'REGTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31807, 0, 1, null, 31621, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31808, 0, 1, null, 31621, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UTYPEDSOURCESCAPTION
CALL FIELDSINFO_IMPORT(31809, 0, 1, null, 31622, null, 'CHAINTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, 27816, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31810, 0, 1, null, 31622, null, 'CHILDFORMTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31811, 0, 1, null, 31622, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31812, 0, 1, null, 31622, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31813, 0, 1, null, 31622, null, 'FILLINGTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31814, 0, 1, null, 31622, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31815, 0, 1, null, 31622, null, 'ISCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31816, 0, 1, null, 31622, null, 'KIND', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31817, 0, 1, null, 31622, null, 'PARENTFORMTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31818, 0, 1, null, 31622, null, 'TEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31819, 0, 1, null, 31622, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31820, 0, 1, null, 31622, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- UTYPEDSOURCESDETAIL
CALL FIELDSINFO_IMPORT(31821, 0, 1, null, 31623, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31822, 0, 1, null, 31623, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31823, 0, 1, null, 31623, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31824, 0, 1, null, 31623, null, 'ISCLIENT', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31825, 0, 1, null, 31623, null, 'REGTEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, 21608, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31826, 0, 1, null, 31623, null, 'SOURCETEXTID', 1, 0, 100, '', '', 40, '', '', '', 0, 0, null, 0, 31622, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31827, 0, 1, null, 31623, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31828, 0, 1, null, 31623, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- WRITNOTIFYCLSDETAIL
CALL FIELDSINFO_IMPORT(32145, 0, 1, null, 31624, null, 'ISREQUIRED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32146, 0, 1, null, 31624, null, 'ISSYSTEM', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32147, 0, 1, null, 31624, null, 'ISVISIBLE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31882, 0, 1, null, 31624, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31883, 0, 1, null, 31624, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31884, 0, 1, null, 31624, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31885, 0, 1, null, 31624, null, 'NOTE', 1, 0, 1024, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31886, 0, 1, null, 31624, null, 'NOTIFYCLSPART', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 31625, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31887, 0, 1, null, 31624, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31888, 0, 1, null, 31624, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31889, 0, 1, null, 31624, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- WRITNOTIFYCLSPART
CALL FIELDSINFO_IMPORT(32148, 0, 1, null, 31625, null, 'HANDBOOKID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31890, 0, 1, null, 31625, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31891, 0, 1, null, 31625, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31892, 0, 1, null, 31625, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31893, 0, 1, null, 31625, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31894, 0, 1, null, 31625, null, 'NOTE', 1, 0, 1024, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31895, 0, 1, null, 31625, null, 'NOTIFY_FIELDTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31896, 0, 1, null, 31625, null, 'SHORTNAME', 1, 0, 255, 'Краткое имя', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31897, 0, 1, null, 31625, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(31898, 0, 1, null, 31625, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- COMMDIRECTIONEXPENCECLS
CALL FIELDSINFO_IMPORT(32789, 0, 1, null, 32786, null, 'ID', 3, 0, 0, '', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32790, 0, 1, null, 32786, null, 'CODE', 1, 0, 10, '', '', 10, '9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32791, 0, 1, null, 32786, null, 'NAME', 1, 0, 1024, '', '', 60, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32792, 0, 1, null, 32786, null, 'OWNERLEVEL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32793, 0, 1, null, 32786, null, 'CREATERUSER', 1, 0, 30, '', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32794, 0, 1, null, 32786, null, 'UPDATERUSER', 1, 0, 30, '', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32795, 0, 1, null, 32786, null, 'CREATEDATE', 11, 0, 0, '', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32796, 0, 1, null, 32786, null, 'UPDATEDATE', 11, 0, 0, '', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32797, 0, 1, null, 32786, null, 'DELETEDATE', 11, 0, 0, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32798, 0, 1, null, 32786, null, 'STARTDATE', 11, 0, 0, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- OKTMO
CALL FIELDSINFO_IMPORT(32824, 0, 1, null, 32820, null, 'CODE1', 1, 0, 10, 'Код МО', '', 10, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32821, 0, 1, null, 32820, null, 'ID', 3, 0, 0, '', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32822, 0, 1, null, 32820, null, 'CODE', 1, 0, 20, 'Код', '', 14, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32825, 0, 1, null, 32820, null, 'CODE2', 3, 0, 0, 'Код населенного пункта', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32826, 0, 1, null, 32820, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32827, 0, 1, null, 32820, null, 'NAMEOKTMO8', 1, 0, 1024, 'Наименование МО', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32828, 0, 1, null, 32820, null, 'NOTEOKTMO8', 1, 0, 255, 'Дополнительная информация', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32829, 0, 1, null, 32820, null, 'STARTDATE', 11, 0, 0, 'Дата вступления в действие', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32830, 0, 1, null, 32820, null, 'DELETEDATE', 11, 0, 0, 'Дата закрытия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32831, 0, 1, null, 32820, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32832, 0, 1, null, 32820, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32833, 0, 1, null, 32820, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32834, 0, 1, null, 32820, null, 'UPDATERUSER', 1, 0, 30, 'Изменил', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32847, 0, 1, null, 32820, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- DFUCHANGELOG
CALL FIELDSINFO_IMPORT(32906, 0, 1, null, 32895, null, 'BEGINUPDATECODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32907, 0, 1, null, 32895, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32908, 0, 1, null, 32895, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32909, 0, 1, null, 32895, null, 'ENDUPDATECODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32910, 0, 1, null, 32895, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32911, 0, 1, null, 32895, null, 'INCLUDEBLOCKS', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32912, 0, 1, null, 32895, null, 'INCLUDEDEL', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32913, 0, 1, null, 32895, null, 'INCLUDEDOCS', 1, 0, 2000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32914, 0, 1, null, 32895, null, 'ISBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32915, 0, 1, null, 32895, null, 'LASTUPDATEDFU', 11, 0, 0, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32916, 0, 1, null, 32895, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32917, 0, 1, null, 32895, null, 'SCRIPTCREATEDATE', 11, 0, 0, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32918, 0, 1, null, 32895, null, 'SCRIPTCREATOR', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32919, 0, 1, null, 32895, null, 'VERSIONID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- SELECTIONEVENTS
CALL FIELDSINFO_IMPORT(32944, 0, 1, null, 32896, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32945, 0, 1, null, 32896, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32946, 0, 1, null, 32896, null, 'EVENTCODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32947, 0, 1, null, 32896, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32948, 0, 1, null, 32896, null, 'SCRIPTNAME', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32949, 0, 1, null, 32896, null, 'SELECTIONREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 23089, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32950, 0, 1, null, 32896, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32951, 0, 1, null, 32896, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SIGNDOCRECORDS
CALL FIELDSINFO_IMPORT(34685, 0, 1, null, 34683, null, 'ID', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34686, 0, 1, null, 34683, null, 'FUID', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34687, 0, 1, null, 34683, null, 'UNIQUENUMBER', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34688, 0, 1, null, 34683, null, 'DOCUMENTTYPE', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34689, 0, 1, null, 34683, null, 'STATE', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34690, 0, 1, null, 34683, null, 'FLAG', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34691, 0, 1, null, 34683, null, 'SENDERID', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34692, 0, 1, null, 34683, null, 'BEGINSTATE', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34693, 0, 1, null, 34683, null, 'CREATERUSER', 1, 0, 15, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34694, 0, 1, null, 34683, null, 'CREATEDATE', 11, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34695, 0, 1, null, 34683, null, 'FORMATTYPE', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34696, 0, 1, null, 34683, null, 'COMPRESSIONFLAGS', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(34697, 0, 1, null, 34683, null, 'BINARYDOCDATAREF', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- LAYERFIELDTYPESDETAIL
CALL FIELDSINFO_IMPORT(35064, 0, 1, null, 35044, null, 'ALIAS', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35065, 0, 1, null, 35044, null, 'CONTEXT', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35066, 0, 1, null, 35044, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35067, 0, 1, null, 35044, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35068, 0, 1, null, 35044, null, 'ERRORMESSAGE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35069, 0, 1, null, 35044, null, 'FIELDSIZE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35070, 0, 1, null, 35044, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35071, 0, 1, null, 35044, null, 'MASK', 1, 0, 20, '', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35072, 0, 1, null, 35044, null, 'MASTERFIELDTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35073, 0, 1, null, 35044, null, 'NOTE', 1, 0, 2000, 'Примечание', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35074, 0, 1, null, 35044, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35075, 0, 1, null, 35044, null, 'REGEXP', 1, 0, 4000, '', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35076, 0, 1, null, 35044, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35077, 0, 1, null, 35044, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- SIGNCERTIFICATE
CALL FIELDSINFO_IMPORT(35083, 0, 1, null, 35045, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35084, 0, 1, null, 35045, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35085, 0, 1, null, 35045, null, 'ENDDATE', 11, 0, 0, '', '', 25, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35086, 0, 1, null, 35045, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35087, 0, 1, null, 35045, null, 'ISENABLED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35088, 0, 1, null, 35045, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35089, 0, 1, null, 35045, null, 'OWNER', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35090, 0, 1, null, 35045, null, 'OWNERORGANIZATION', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35091, 0, 1, null, 35045, null, 'SERIALNUMBER', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35092, 0, 1, null, 35045, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 25, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35093, 0, 1, null, 35045, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35094, 0, 1, null, 35045, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35095, 0, 1, null, 35045, null, 'USERREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 16708, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SIGNDOCUMENTSGROUP
CALL FIELDSINFO_IMPORT(35096, 0, 1, null, 35046, null, 'CLIENTREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 20054, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35097, 0, 1, null, 35046, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35098, 0, 1, null, 35046, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35099, 0, 1, null, 35046, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35100, 0, 1, null, 35046, null, 'NAME', 1, 0, 255, 'Наименование', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35101, 0, 1, null, 35046, null, 'NOTE', 1, 0, 255, 'Примечание', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35102, 0, 1, null, 35046, null, 'SCHEMAREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 30659, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35103, 0, 1, null, 35046, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35104, 0, 1, null, 35046, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SIGNDOCUMENTSGROUPDETAIL
CALL FIELDSINFO_IMPORT(35105, 0, 1, null, 35047, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35106, 0, 1, null, 35047, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35107, 0, 1, null, 35047, null, 'DOCSTATE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 20836, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35108, 0, 1, null, 35047, null, 'DOCTYPE', 3, 0, 0, 'Тип документа', '', 11, '', '', '', 0, 0, null, 0, 20598, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35109, 0, 1, null, 35047, null, 'FACIALACCCLS', 3, 0, 0, 'Лицевой счет', '', 11, '', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35110, 0, 1, null, 35047, null, 'FACIALACCCLSUP', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35111, 0, 1, null, 35047, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35112, 0, 1, null, 35047, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 35046, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35113, 0, 1, null, 35047, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35114, 0, 1, null, 35047, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- LAYERFIELDTYPES
CALL FIELDSINFO_IMPORT(35058, 0, 1, null, 35048, null, 'ALIAS', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35059, 0, 1, null, 35048, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35060, 0, 1, null, 35048, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35061, 0, 1, null, 35048, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35062, 0, 1, null, 35048, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35063, 0, 1, null, 35048, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- SIGNPROFILE
CALL FIELDSINFO_IMPORT(35122, 0, 1, null, 35049, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35123, 0, 1, null, 35049, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35124, 0, 1, null, 35049, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35125, 0, 1, null, 35049, null, 'SIGNDOCUMENTSGROUPREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 35046, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35126, 0, 1, null, 35049, null, 'SIGNREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 30658, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35127, 0, 1, null, 35049, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35128, 0, 1, null, 35049, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- SIGNPROFILEDETAIL
CALL FIELDSINFO_IMPORT(35129, 0, 1, null, 35050, null, 'CERTIFICATEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 35045, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35130, 0, 1, null, 35050, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35131, 0, 1, null, 35050, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35132, 0, 1, null, 35050, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35133, 0, 1, null, 35050, null, 'RECORDINDEX', 3, 0, 0, 'Ссылка на заголовок', '', 11, '', '', '', 2, 0, null, 1, 35049, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35134, 0, 1, null, 35050, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35135, 0, 1, null, 35050, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- OKPD
CALL FIELDSINFO_IMPORT(35318, 0, 1, null, 35312, null, 'CODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35319, 0, 1, null, 35312, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35320, 0, 1, null, 35312, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35321, 0, 1, null, 35312, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35322, 0, 1, null, 35312, null, 'HASCHILDS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35323, 0, 1, null, 35312, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35324, 0, 1, null, 35312, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35325, 0, 1, null, 35312, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35326, 0, 1, null, 35312, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35327, 0, 1, null, 35312, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- OKVED
CALL FIELDSINFO_IMPORT(35328, 0, 1, null, 35313, null, 'CODE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35329, 0, 1, null, 35313, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35330, 0, 1, null, 35313, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35331, 0, 1, null, 35313, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35332, 0, 1, null, 35313, null, 'HASCHILDS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35333, 0, 1, null, 35313, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35334, 0, 1, null, 35313, null, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35335, 0, 1, null, 35313, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35336, 0, 1, null, 35313, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35337, 0, 1, null, 35313, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- CLSCORRESPONDENTS
CALL FIELDSINFO_IMPORT(35359, 0, 1, null, 35357, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35360, 0, 1, null, 35357, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35361, 0, 1, null, 35357, null, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35362, 0, 1, null, 35357, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '', '', '', 0, 0, null, 1, 16871, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35363, 0, 1, null, 35357, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35364, 0, 1, null, 35357, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35365, 0, 1, null, 35357, null, 'UPDATERUSER', 1, 0, 30, 'Автор изменений', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- CHANGELOGBYUPDDATE
CALL FIELDSINFO_IMPORT(36033, 0, 1, null, 36032, null, 'ID', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', '', '') ;

CALL FIELDSINFO_IMPORT(36034, 0, 1, null, 36032, null, 'TABLEID', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', '', '') ;

CALL FIELDSINFO_IMPORT(36035, 0, 1, null, 36032, null, 'OLDUPDATEDATE', 11, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', '', '') ;

CALL FIELDSINFO_IMPORT(36036, 0, 1, null, 36032, null, 'NEWUPDATEDATE', 11, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', '', '') ;

CALL FIELDSINFO_IMPORT(36037, 0, 1, null, 36032, null, 'NEWDELETEDATE', 11, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', '', '') ;

CALL FIELDSINFO_IMPORT(36038, 0, 1, null, 36032, null, 'CHANGEDATE', 11, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, '', '', '') ;

-- OKPD2
CALL FIELDSINFO_IMPORT(37808, 0, 1, null, 37806, null, 'ID', 3, 0, 0, 'Ключ', '', 0, '', '', '', 1, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37809, 0, 1, null, 37806, null, 'NAME', 1, 0, 1024, 'Наименование', '', 0, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37810, 0, 1, null, 37806, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 0, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37811, 0, 1, null, 37806, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 0, '', '', '', 1, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37812, 0, 1, null, 37806, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 0, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37813, 0, 1, null, 37806, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 0, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- OKVED2
CALL FIELDSINFO_IMPORT(37814, 0, 1, null, 37807, null, 'ID', 3, 0, 0, 'Ключ', '', 0, '', '', '', 0, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37815, 0, 1, null, 37807, null, 'NAME', 1, 0, 1024, 'Наименование', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37816, 0, 1, null, 37807, null, 'STARTDATE', 11, 0, 0, 'Дата начала срока действия', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37817, 0, 1, null, 37807, null, 'DELETEDATE', 11, 0, 0, 'Дата удаления(окончания срока действия)', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37818, 0, 1, null, 37807, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(37819, 0, 1, null, 37807, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, '', '', '') ;

-- INVESTOBJECT
CALL FIELDSINFO_IMPORT(38204, 0, 1, null, 38203, null, 'ID', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38205, 0, 1, null, 38203, null, 'CODE', 1, 0, 20, 'Код', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38206, 0, 1, null, 38203, null, 'SUBCODE', 1, 0, 20, 'Суб код', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38207, 0, 1, null, 38203, null, 'BUDGETFINSOURCEOBJECTCODE', 1, 0, 20, 'Код объекта финансирующего бюджета', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38208, 0, 1, null, 38203, null, 'NAME', 1, 0, 2000, 'Полное наименование объекта', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38209, 0, 1, null, 38203, null, 'SHORTNAME', 1, 0, 1024, 'Краткое наименование объекта', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38210, 0, 1, null, 38203, null, 'OWNERLEVEL', 3, 0, 0, 'Уровень собственника объекта', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38211, 0, 1, null, 38203, null, 'BUDGETREF', 3, 0, 0, 'Бюджет', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38212, 0, 1, null, 38203, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38213, 0, 1, null, 38203, null, 'BUDGETFINSOURCELEVEL', 3, 0, 0, 'Уровень источника средств', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38214, 0, 1, null, 38203, null, 'PARENTREF', 3, 0, 0, 'Код родительского объекта', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38215, 0, 1, null, 38203, null, 'STARTDATE', 11, 0, 0, 'Дата начала действия', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38216, 0, 1, null, 38203, null, 'DELETEDATE', 11, 0, 0, 'Дата окончания действия', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38217, 0, 1, null, 38203, null, 'KVSR', 3, 0, 0, 'КВСР', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38218, 0, 1, null, 38203, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38219, 0, 1, null, 38203, null, 'TARGETCLS', 3, 0, 0, 'Код цели', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38220, 0, 1, null, 38203, null, 'NOTE', 1, 0, 1024, 'Примечание', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38221, 0, 1, null, 38203, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38222, 0, 1, null, 38203, null, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38223, 0, 1, null, 38203, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 0, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38224, 0, 1, null, 38203, null, 'OKTMO', 3, 0, 0, 'ОКТМО', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38225, 0, 1, null, 38203, null, 'NPAID', 3, 0, 0, 'Классификатор НПА', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38226, 0, 1, null, 38203, null, 'NPADATE', 11, 0, 0, 'Дата НПА', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38227, 0, 1, null, 38203, null, 'NPANUMBER', 1, 0, 20, 'Номер НПА', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38228, 0, 1, null, 38203, null, 'NPAGROUP', 1, 0, 1024, 'Группа', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38229, 0, 1, null, 38203, null, 'NPANAME', 1, 0, 1024, 'Наименование', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 26, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38230, 0, 1, null, 38203, null, 'ADDRESS', 1, 0, 1024, 'Адрес', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38231, 0, 1, null, 38203, null, 'CREATEDATE', 11, 0, 0, 'Дата создания', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38232, 0, 1, null, 38203, null, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38233, 0, 1, null, 38203, null, 'CREATERUSER', 1, 0, 30, 'Автор', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 30, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(38234, 0, 1, null, 38203, null, 'UPDATERUSER', 1, 0, 30, 'Изменивший', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

-- CLS_302
CALL FIELDSINFO_IMPORT(32743, 0, 2, 18979, 32867, 32868, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(32870, 0, 2, 18983, 32867, 32868, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(32871, 0, 2, 18956, 32867, 32868, 'SOURCEACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет плательщика (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'ACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(32872, 0, 2, 18957, 32867, 32868, 'SOURCEFACIALACC_CLS', 3, 0, 0, 'л\с плательщика', 'Лицевой счет плательщика средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(32873, 0, 2, 18887, 32867, 32869, 'SOURCEKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(32874, 0, 2, 18888, 32867, 32869, 'SOURCEKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(32875, 0, 2, 18867, 32867, 32869, 'SOURCEKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(32876, 0, 2, 18886, 32867, 32869, 'SOURCEKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(32877, 0, 2, 18868, 32867, 32869, 'SOURCEKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(32878, 0, 2, 18919, 32867, 32869, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(32879, 0, 2, 18889, 32867, 32869, 'SOURCESUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(32880, 0, 2, 18913, 32867, 32869, 'SOURCEDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(32881, 0, 2, 18890, 32867, 32869, 'SOURCEFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(32884, 0, 2, 18920, 32867, 32869, 'SOURCEIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр. финансирования плательщика', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(32885, 0, 2, 18925, 32867, 32869, 'SOURCEKD', 3, 0, 0, 'Код дохода', 'Ссылка на код дохода плательщика', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(32886, 0, 2, 26626, 32867, 32869, 'SOURCESUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34908, 0, 2, 18891, 32867, 32869, 'SOURCEMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34909, 0, 2, 18927, 32867, 32869, 'SOURCEREGIONCLS', 3, 0, 0, 'Район плат.', '', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34910, 0, 2, 18935, 32867, 32869, 'SOURCETRANSFERTCLS', 3, 0, 0, 'Код целевых средств плательщика (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(34969, 0, 2, 34968, 32867, 32868, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(34982, 0, 2, 18972, 32867, 32868, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

CALL FIELDSINFO_IMPORT(35935, 0, 2, 18865, 32867, 32869, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 25, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36063, 0, 2, 18948, 32867, 32868, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 26, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_304
CALL FIELDSINFO_IMPORT(34404, 0, 2, 18979, 34400, 34401, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34405, 0, 2, 18983, 34400, 34401, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34407, 0, 2, 18956, 34400, 34401, 'SOURCEACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет плательщика (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'ACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(34408, 0, 2, 18957, 34400, 34401, 'SOURCEFACIALACC_CLS', 3, 0, 0, 'л\с плательщика', 'Лицевой счет плательщика средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34410, 0, 2, 18890, 34400, 34402, 'SOURCEFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34411, 0, 2, 18920, 34400, 34402, 'SOURCEIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр. финансирования плательщика', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34412, 0, 2, 18887, 34400, 34402, 'SOURCEKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34413, 0, 2, 18925, 34400, 34402, 'SOURCEKD', 3, 0, 0, 'Код дохода', 'Ссылка на код дохода плательщика', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(34414, 0, 2, 18868, 34400, 34402, 'SOURCEKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34415, 0, 2, 18888, 34400, 34402, 'SOURCEKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34416, 0, 2, 18867, 34400, 34402, 'SOURCEKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34417, 0, 2, 18886, 34400, 34402, 'SOURCEKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34419, 0, 2, 18889, 34400, 34402, 'SOURCESUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34420, 0, 2, 26626, 34400, 34402, 'SOURCESUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34422, 0, 2, 18919, 34400, 34402, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34423, 0, 2, 18913, 34400, 34402, 'SOURCEDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34915, 0, 2, 18972, 34400, 34401, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

CALL FIELDSINFO_IMPORT(34916, 0, 2, 18891, 34400, 34402, 'SOURCEMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34917, 0, 2, 18927, 34400, 34402, 'SOURCEREGIONCLS', 3, 0, 0, 'Район плат.', '', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34918, 0, 2, 18935, 34400, 34402, 'SOURCETRANSFERTCLS', 3, 0, 0, 'Код целевых средств плательщика (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(34972, 0, 2, 34968, 34400, 34401, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(35937, 0, 2, 18865, 34400, 34402, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 26, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36065, 0, 2, 18948, 34400, 34401, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 27, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_305
CALL FIELDSINFO_IMPORT(34428, 0, 2, 18983, 34424, 34426, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34429, 0, 2, 18958, 34424, 34426, 'DESTACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'ACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(34433, 0, 2, 18919, 34424, 34427, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34434, 0, 2, 18914, 34424, 34427, 'DESTDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34435, 0, 2, 18899, 34424, 34427, 'DESTFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34436, 0, 2, 18921, 34424, 34427, 'DESTIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр.финансирования получателя', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34437, 0, 2, 18896, 34424, 34427, 'DESTKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34438, 0, 2, 18926, 34424, 34427, 'DESTKD', 3, 0, 0, 'Код дохода', 'Ссылка на код дохода получателя', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(34439, 0, 2, 18871, 34424, 34427, 'DESTKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34440, 0, 2, 18897, 34424, 34427, 'DESTKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34441, 0, 2, 18870, 34424, 34427, 'DESTKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34442, 0, 2, 18895, 34424, 34427, 'DESTKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34443, 0, 2, 18898, 34424, 34427, 'DESTSUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34444, 0, 2, 26624, 34424, 34427, 'DESTSUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34446, 0, 2, 18869, 34424, 34427, 'DESTFACIALACC_CLS', 3, 0, 0, 'л\с получателя', 'Лицевой счет получателя средств', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34447, 0, 2, 18979, 34424, 34426, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34919, 0, 2, 18900, 34424, 34427, 'DESTMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34920, 0, 2, 18928, 34424, 34427, 'DESTREGIONCLS', 3, 0, 0, 'Район получ-ля', '', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34921, 0, 2, 18936, 34424, 34427, 'DESTTRANSFERTCLS', 3, 0, 0, 'Код целевых средств получателя (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(34973, 0, 2, 34968, 34424, 34426, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(34983, 0, 2, 18972, 34424, 34426, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

CALL FIELDSINFO_IMPORT(35938, 0, 2, 18865, 34424, 34427, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 26, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36066, 0, 2, 18948, 34424, 34426, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 27, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_303
CALL FIELDSINFO_IMPORT(34452, 0, 2, 18979, 34448, 34450, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34453, 0, 2, 18958, 34448, 34450, 'DESTACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'ACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(34456, 0, 2, 18919, 34448, 34451, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34457, 0, 2, 18914, 34448, 34451, 'DESTDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34458, 0, 2, 18869, 34448, 34451, 'DESTFACIALACC_CLS', 3, 0, 0, 'л\с получателя', 'Лицевой счет получателя средств', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34459, 0, 2, 18899, 34448, 34451, 'DESTFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34460, 0, 2, 18921, 34448, 34451, 'DESTIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр.финансирования получателя', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34461, 0, 2, 18896, 34448, 34451, 'DESTKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34462, 0, 2, 18871, 34448, 34451, 'DESTKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34463, 0, 2, 18897, 34448, 34451, 'DESTKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34464, 0, 2, 18870, 34448, 34451, 'DESTKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34465, 0, 2, 18895, 34448, 34451, 'DESTKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34466, 0, 2, 18898, 34448, 34451, 'DESTSUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34467, 0, 2, 26624, 34448, 34451, 'DESTSUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34469, 0, 2, 18983, 34448, 34450, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34911, 0, 2, 18972, 34448, 34450, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

CALL FIELDSINFO_IMPORT(34912, 0, 2, 18900, 34448, 34451, 'DESTMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34913, 0, 2, 18928, 34448, 34451, 'DESTREGIONCLS', 3, 0, 0, 'Район получ-ля', '', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34914, 0, 2, 18936, 34448, 34451, 'DESTTRANSFERTCLS', 3, 0, 0, 'Код целевых средств получателя (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(34971, 0, 2, 34968, 34448, 34450, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(35936, 0, 2, 18865, 34448, 34451, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 24, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36064, 0, 2, 18948, 34448, 34450, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 25, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_306
CALL FIELDSINFO_IMPORT(34475, 0, 2, 18983, 34471, 34473, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34476, 0, 2, 18979, 34471, 34473, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34477, 0, 2, 18958, 34471, 34473, 'DESTACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'ACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(34478, 0, 2, 18959, 34471, 34473, 'DESTFACIALACC_CLS', 3, 0, 0, 'л\с получателя', 'Лицевой счет получателя средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34481, 0, 2, 18919, 34471, 34474, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34482, 0, 2, 18914, 34471, 34474, 'DESTDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34483, 0, 2, 18899, 34471, 34474, 'DESTFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34484, 0, 2, 18921, 34471, 34474, 'DESTIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр.финансирования получателя', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34485, 0, 2, 18896, 34471, 34474, 'DESTKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34486, 0, 2, 18926, 34471, 34474, 'DESTKD', 3, 0, 0, 'Код дохода', 'Ссылка на код дохода получателя', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(34487, 0, 2, 18871, 34471, 34474, 'DESTKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34488, 0, 2, 18897, 34471, 34474, 'DESTKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34489, 0, 2, 18870, 34471, 34474, 'DESTKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34490, 0, 2, 18895, 34471, 34474, 'DESTKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34491, 0, 2, 18898, 34471, 34474, 'DESTSUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34492, 0, 2, 26624, 34471, 34474, 'DESTSUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34922, 0, 2, 18972, 34471, 34473, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

CALL FIELDSINFO_IMPORT(34923, 0, 2, 18900, 34471, 34474, 'DESTMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34924, 0, 2, 18928, 34471, 34474, 'DESTREGIONCLS', 3, 0, 0, 'Район получ-ля', '', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34925, 0, 2, 18936, 34471, 34474, 'DESTTRANSFERTCLS', 3, 0, 0, 'Код целевых средств получателя (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(34974, 0, 2, 34968, 34471, 34473, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(35939, 0, 2, 18865, 34471, 34474, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 25, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36067, 0, 2, 18948, 34471, 34473, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 26, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_312
CALL FIELDSINFO_IMPORT(34498, 0, 2, 18983, 34494, 34496, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34499, 0, 2, 18979, 34494, 34496, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34500, 0, 2, 18958, 34494, 34496, 'DESTACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'ACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(34503, 0, 2, 18919, 34494, 34497, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34504, 0, 2, 18914, 34494, 34497, 'DESTDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34505, 0, 2, 18869, 34494, 34497, 'DESTFACIALACC_CLS', 3, 0, 0, 'л\с получателя', 'Лицевой счет получателя средств', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34506, 0, 2, 18899, 34494, 34497, 'DESTFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34507, 0, 2, 18921, 34494, 34497, 'DESTIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр.финансирования получателя', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34508, 0, 2, 18896, 34494, 34497, 'DESTKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34509, 0, 2, 18926, 34494, 34497, 'DESTKD', 3, 0, 0, 'Код дохода', 'Ссылка на код дохода получателя', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(34510, 0, 2, 18871, 34494, 34497, 'DESTKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34511, 0, 2, 18897, 34494, 34497, 'DESTKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34512, 0, 2, 18870, 34494, 34497, 'DESTKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34513, 0, 2, 18895, 34494, 34497, 'DESTKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34514, 0, 2, 18898, 34494, 34497, 'DESTSUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34515, 0, 2, 26624, 34494, 34497, 'DESTSUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34930, 0, 2, 18972, 34494, 34496, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

CALL FIELDSINFO_IMPORT(34931, 0, 2, 18900, 34494, 34497, 'DESTMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34933, 0, 2, 18936, 34494, 34497, 'DESTTRANSFERTCLS', 3, 0, 0, 'Код целевых средств получателя (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(34976, 0, 2, 34968, 34494, 34496, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(35941, 0, 2, 18865, 34494, 34497, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 25, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36069, 0, 2, 18948, 34494, 34496, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 26, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_311
CALL FIELDSINFO_IMPORT(34521, 0, 2, 18983, 34517, 34519, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34522, 0, 2, 18979, 34517, 34519, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34525, 0, 2, 18919, 34517, 34520, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34526, 0, 2, 18913, 34517, 34520, 'SOURCEDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34527, 0, 2, 18866, 34517, 34520, 'SOURCEFACIALACC_CLS', 3, 0, 0, 'л\с плательщика', 'Лицевой счет плательщика средств', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34528, 0, 2, 18890, 34517, 34520, 'SOURCEFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34529, 0, 2, 18920, 34517, 34520, 'SOURCEIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр. финансирования плательщика', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34530, 0, 2, 18887, 34517, 34520, 'SOURCEKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34531, 0, 2, 18925, 34517, 34520, 'SOURCEKD', 3, 0, 0, 'Код дохода', 'Ссылка на код дохода плательщика', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(34532, 0, 2, 18868, 34517, 34520, 'SOURCEKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34533, 0, 2, 18888, 34517, 34520, 'SOURCEKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34534, 0, 2, 18867, 34517, 34520, 'SOURCEKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34535, 0, 2, 18886, 34517, 34520, 'SOURCEKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34536, 0, 2, 18889, 34517, 34520, 'SOURCESUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34537, 0, 2, 26626, 34517, 34520, 'SOURCESUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34926, 0, 2, 18972, 34517, 34519, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

CALL FIELDSINFO_IMPORT(34927, 0, 2, 18891, 34517, 34520, 'SOURCEMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34929, 0, 2, 18935, 34517, 34520, 'SOURCETRANSFERTCLS', 3, 0, 0, 'Код целевых средств плательщика (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(34975, 0, 2, 34968, 34517, 34519, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(35940, 0, 2, 18865, 34517, 34520, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 24, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36068, 0, 2, 18948, 34517, 34519, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 25, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_314
CALL FIELDSINFO_IMPORT(34543, 0, 2, 18983, 34539, 34541, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34544, 0, 2, 18979, 34539, 34541, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34545, 0, 2, 18958, 34539, 34541, 'DESTACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'ACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(34548, 0, 2, 18919, 34539, 34542, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34549, 0, 2, 18913, 34539, 34542, 'SOURCEDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34550, 0, 2, 18866, 34539, 34542, 'SOURCEFACIALACC_CLS', 3, 0, 0, 'л\с плательщика', 'Лицевой счет плательщика средств', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34551, 0, 2, 18890, 34539, 34542, 'SOURCEFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34552, 0, 2, 18920, 34539, 34542, 'SOURCEIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр. финансирования плательщика', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34553, 0, 2, 18887, 34539, 34542, 'SOURCEKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34554, 0, 2, 18925, 34539, 34542, 'SOURCEKD', 3, 0, 0, 'Код дохода', 'Ссылка на код дохода плательщика', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(34555, 0, 2, 18868, 34539, 34542, 'SOURCEKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34556, 0, 2, 18888, 34539, 34542, 'SOURCEKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34557, 0, 2, 18867, 34539, 34542, 'SOURCEKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34558, 0, 2, 18886, 34539, 34542, 'SOURCEKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34559, 0, 2, 18889, 34539, 34542, 'SOURCESUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34560, 0, 2, 26626, 34539, 34542, 'SOURCESUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34934, 0, 2, 18972, 34539, 34541, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

CALL FIELDSINFO_IMPORT(34935, 0, 2, 18891, 34539, 34542, 'SOURCEMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34937, 0, 2, 18935, 34539, 34542, 'SOURCETRANSFERTCLS', 3, 0, 0, 'Код целевых средств плательщика (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(34977, 0, 2, 34968, 34539, 34541, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(35942, 0, 2, 18865, 34539, 34542, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 25, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36070, 0, 2, 18948, 34539, 34541, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 26, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_315
CALL FIELDSINFO_IMPORT(34566, 0, 2, 18983, 34562, 34564, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34567, 0, 2, 18979, 34562, 34564, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34568, 0, 2, 18958, 34562, 34564, 'DESTACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'ACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(34571, 0, 2, 18919, 34562, 34565, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34572, 0, 2, 18914, 34562, 34565, 'DESTDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34573, 0, 2, 18869, 34562, 34565, 'DESTFACIALACC_CLS', 3, 0, 0, 'л\с получателя', 'Лицевой счет получателя средств', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34574, 0, 2, 18921, 34562, 34565, 'DESTIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр.финансирования получателя', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34575, 0, 2, 18896, 34562, 34565, 'DESTKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34576, 0, 2, 18926, 34562, 34565, 'DESTKD', 3, 0, 0, 'Код дохода', 'Ссылка на код дохода получателя', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(34577, 0, 2, 18871, 34562, 34565, 'DESTKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34578, 0, 2, 18897, 34562, 34565, 'DESTKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34579, 0, 2, 18870, 34562, 34565, 'DESTKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34580, 0, 2, 18895, 34562, 34565, 'DESTKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34581, 0, 2, 18898, 34562, 34565, 'DESTSUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34582, 0, 2, 26624, 34562, 34565, 'DESTSUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34584, 0, 2, 18899, 34562, 34565, 'DESTFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34938, 0, 2, 18972, 34562, 34564, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

CALL FIELDSINFO_IMPORT(34939, 0, 2, 18900, 34562, 34565, 'DESTMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34941, 0, 2, 18936, 34562, 34565, 'DESTTRANSFERTCLS', 3, 0, 0, 'Код целевых средств получателя (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(34978, 0, 2, 34968, 34562, 34564, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(35943, 0, 2, 18865, 34562, 34565, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 25, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36071, 0, 2, 18948, 34562, 34564, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 26, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_322
CALL FIELDSINFO_IMPORT(34592, 0, 2, 18983, 34588, 34590, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34593, 0, 2, 18979, 34588, 34590, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34595, 0, 2, 18956, 34588, 34590, 'SOURCEACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет плательщика (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'ACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(34596, 0, 2, 18957, 34588, 34590, 'SOURCEFACIALACC_CLS', 3, 0, 0, 'л\с плательщика', 'Лицевой счет плательщика средств', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34598, 0, 2, 18919, 34588, 34591, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34599, 0, 2, 18913, 34588, 34591, 'SOURCEDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34600, 0, 2, 18890, 34588, 34591, 'SOURCEFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34601, 0, 2, 18920, 34588, 34591, 'SOURCEIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр. финансирования плательщика', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34602, 0, 2, 18887, 34588, 34591, 'SOURCEKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34603, 0, 2, 18868, 34588, 34591, 'SOURCEKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34604, 0, 2, 18888, 34588, 34591, 'SOURCEKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34605, 0, 2, 18867, 34588, 34591, 'SOURCEKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34606, 0, 2, 18886, 34588, 34591, 'SOURCEKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34607, 0, 2, 18889, 34588, 34591, 'SOURCESUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34608, 0, 2, 26626, 34588, 34591, 'SOURCESUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(36021, 0, 2, 18892, 34588, 34591, 'SOURCEFINSOURCE', 3, 0, 0, 'Источник финансирования', 'Источник финансирования', 4, '999', '', '', 0, 0, null, 1, 16983, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'NOTIFYTYPE', '') ;

CALL FIELDSINFO_IMPORT(34942, 0, 2, 18972, 34588, 34590, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

CALL FIELDSINFO_IMPORT(34943, 0, 2, 18891, 34588, 34591, 'SOURCEMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34944, 0, 2, 18927, 34588, 34591, 'SOURCEREGIONCLS', 3, 0, 0, 'Район плат.', '', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34945, 0, 2, 18935, 34588, 34591, 'SOURCETRANSFERTCLS', 3, 0, 0, 'Код целевых средств плательщика (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(34979, 0, 2, 34968, 34588, 34590, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(35944, 0, 2, 18865, 34588, 34591, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 24, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36072, 0, 2, 18948, 34588, 34590, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 26, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_323
CALL FIELDSINFO_IMPORT(34614, 0, 2, 18983, 34610, 34612, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34615, 0, 2, 18979, 34610, 34612, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34616, 0, 2, 18958, 34610, 34612, 'DESTACCOUNT', 3, 0, 0, 'р\с финоргана', 'Расчетный счет получателя (ссылка)', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'ACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(34619, 0, 2, 18919, 34610, 34613, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34620, 0, 2, 18914, 34610, 34613, 'DESTDIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34621, 0, 2, 18869, 34610, 34613, 'DESTFACIALACC_CLS', 3, 0, 0, 'л\с получателя', 'Лицевой счет получателя средств', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34622, 0, 2, 18899, 34610, 34613, 'DESTFACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34623, 0, 2, 18921, 34610, 34613, 'DESTIFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ссылка на источник внутр.финансирования получателя', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34624, 0, 2, 18896, 34610, 34613, 'DESTKCSR', 3, 0, 0, 'КЦСР (ключ)', 'Ссылка на КЦСР', 11, '999.99.99', '', '', 0, 0, null, 0, 16857, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34625, 0, 2, 18871, 34610, 34613, 'DESTKESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34626, 0, 2, 18897, 34610, 34613, 'DESTKFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34627, 0, 2, 18870, 34610, 34613, 'DESTKVR', 3, 0, 0, 'КВР (ключ)', 'Ссылка на КВР', 7, '>AAA', '', '', 0, 0, null, 0, 16864, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34628, 0, 2, 18895, 34610, 34613, 'DESTKVSR', 3, 0, 0, 'КВСР (ключ)', 'Ссылка на КВСР', 4, '999', '', '', 0, 0, null, 0, 16851, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34629, 0, 2, 18898, 34610, 34613, 'DESTSUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '999.99.99', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34946, 0, 2, 18972, 34610, 34612, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

CALL FIELDSINFO_IMPORT(34947, 0, 2, 18900, 34610, 34613, 'DESTMEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34948, 0, 2, 18928, 34610, 34613, 'DESTREGIONCLS', 3, 0, 0, 'Район получ-ля', '', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34949, 0, 2, 18936, 34610, 34613, 'DESTTRANSFERTCLS', 3, 0, 0, 'Код целевых средств получателя (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(34980, 0, 2, 34968, 34610, 34612, 'DOCCHANGEDATE', 11, 0, 0, 'Дата и время редактирования', 'Дата редактирования, включая детали', 20, '99/99/9999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(35945, 0, 2, 18865, 34610, 34613, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 23, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36073, 0, 2, 18948, 34610, 34612, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 24, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_201
CALL FIELDSINFO_IMPORT(35715, 0, 2, 17474, 34631, 34632, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'VARIANT', '') ;

CALL FIELDSINFO_IMPORT(34634, 0, 2, 17451, 34631, 34633, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34635, 0, 2, 17450, 34631, 34633, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '000', '000', 0, 0, null, 0, 21555, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34636, 0, 2, 17419, 34631, 34633, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34637, 0, 2, 17413, 34631, 34633, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '000', '000', 0, 0, null, 0, 16857, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34638, 0, 2, 17415, 34631, 34633, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34639, 0, 2, 17411, 34631, 34633, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34640, 0, 2, 17414, 34631, 34633, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '000', '000', 0, 0, null, 0, 16864, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34641, 0, 2, 17412, 34631, 34633, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '000', '000', 0, 0, null, 0, 16851, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34642, 0, 2, 17416, 34631, 34633, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '9.9.9', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34643, 0, 2, 26542, 34631, 34633, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34645, 0, 2, 17472, 34631, 34632, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34646, 0, 2, 17477, 34631, 34632, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34649, 0, 2, 17418, 34631, 34633, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34871, 0, 2, 17485, 34631, 34632, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECTCLS', '') ;

CALL FIELDSINFO_IMPORT(34884, 0, 2, 17426, 34631, 34633, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34885, 0, 2, 17417, 34631, 34633, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34886, 0, 2, 17460, 34631, 34633, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(36042, 0, 2, 17464, 34631, 34632, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 23, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

CALL FIELDSINFO_IMPORT(35927, 0, 2, 17409, 34631, 34633, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 22, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36048, 0, 2, 36043, 34631, 34632, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

-- CLS_202
CALL FIELDSINFO_IMPORT(35716, 0, 2, 17474, 34650, 34652, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'VARIANT', '') ;

CALL FIELDSINFO_IMPORT(34665, 0, 2, 17451, 34650, 34653, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34666, 0, 2, 17450, 34650, 34653, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '000', '000', 0, 0, null, 0, 21555, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34667, 0, 2, 17419, 34650, 34653, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34668, 0, 2, 17418, 34650, 34653, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34669, 0, 2, 17413, 34650, 34653, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '000', '000', 0, 0, null, 0, 16857, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34670, 0, 2, 17415, 34650, 34653, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34671, 0, 2, 17411, 34650, 34653, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34672, 0, 2, 17414, 34650, 34653, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '000', '000', 0, 0, null, 0, 16864, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34673, 0, 2, 17412, 34650, 34653, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '000', '000', 0, 0, null, 0, 16851, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34674, 0, 2, 17416, 34650, 34653, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '9.9.9', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34675, 0, 2, 26542, 34650, 34653, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34677, 0, 2, 17472, 34650, 34652, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34678, 0, 2, 17477, 34650, 34652, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34876, 0, 2, 17485, 34650, 34652, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECTCLS', '') ;

CALL FIELDSINFO_IMPORT(34887, 0, 2, 17426, 34650, 34653, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34888, 0, 2, 17417, 34650, 34653, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34889, 0, 2, 17460, 34650, 34653, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(35928, 0, 2, 17409, 34650, 34653, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 22, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36049, 0, 2, 36043, 34650, 34652, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(36050, 0, 2, 17464, 34650, 34652, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 24, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CaptionID', '') ;

-- ДАННЫЕЭЦП
CALL FIELDSINFO_IMPORT(34702, 0, 2, 34692, 34700, 34701, 'BEGINSTATE', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'BEGINSTATE', '') ;

CALL FIELDSINFO_IMPORT(34703, 0, 2, 34697, 34700, 34701, 'BINARYDOCDATAREF', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'BINARYDOCDATAREF', '') ;

CALL FIELDSINFO_IMPORT(34704, 0, 2, 34696, 34700, 34701, 'COMPRESSIONFLAGS', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'COMPRESSIONFLAGS', '') ;

CALL FIELDSINFO_IMPORT(34705, 0, 2, 34694, 34700, 34701, 'CREATEDATE', 11, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'CREATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34706, 0, 2, 34693, 34700, 34701, 'CREATERUSER', 1, 0, 15, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34707, 0, 2, 34688, 34700, 34701, 'DOCUMENTTYPE', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'DOCUMENTTYPE', '') ;

CALL FIELDSINFO_IMPORT(34708, 0, 2, 34690, 34700, 34701, 'FLAG', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'FLAG', '') ;

CALL FIELDSINFO_IMPORT(34709, 0, 2, 34695, 34700, 34701, 'FORMATTYPE', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'FORMATTYPE', '') ;

CALL FIELDSINFO_IMPORT(34710, 0, 2, 34686, 34700, 34701, 'FUID', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'FUID', '') ;

CALL FIELDSINFO_IMPORT(34711, 0, 2, 34685, 34700, 34701, 'ID', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 1, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'ID', '') ;

CALL FIELDSINFO_IMPORT(34712, 0, 2, 34691, 34700, 34701, 'SENDERID', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'SENDERID', '') ;

CALL FIELDSINFO_IMPORT(34713, 0, 2, 34689, 34700, 34701, 'STATE', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'STATE', '') ;

CALL FIELDSINFO_IMPORT(34714, 0, 2, 34687, 34700, 34701, 'UNIQUENUMBER', 3, 0, 0, '', '', 0, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'UNIQUENUMBER', '') ;

-- CLS_203
CALL FIELDSINFO_IMPORT(35717, 0, 2, 17474, 34718, 34720, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'VARIANT', '') ;

CALL FIELDSINFO_IMPORT(34722, 0, 2, 17451, 34718, 34721, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34723, 0, 2, 17450, 34718, 34721, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '000', '000', 0, 0, null, 0, 21555, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34724, 0, 2, 17419, 34718, 34721, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34725, 0, 2, 17418, 34718, 34721, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34726, 0, 2, 17413, 34718, 34721, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '000', '000', 0, 0, null, 0, 16857, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34727, 0, 2, 17415, 34718, 34721, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34728, 0, 2, 17411, 34718, 34721, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34729, 0, 2, 17414, 34718, 34721, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '000', '000', 0, 0, null, 0, 16864, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34730, 0, 2, 17412, 34718, 34721, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '000', '000', 0, 0, null, 0, 16851, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34731, 0, 2, 17416, 34718, 34721, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '9.9.9', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34732, 0, 2, 26542, 34718, 34721, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34734, 0, 2, 17472, 34718, 34720, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34735, 0, 2, 17477, 34718, 34720, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34877, 0, 2, 17485, 34718, 34720, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECTCLS', '') ;

CALL FIELDSINFO_IMPORT(34890, 0, 2, 17426, 34718, 34721, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34891, 0, 2, 17417, 34718, 34721, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34892, 0, 2, 17460, 34718, 34721, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(35929, 0, 2, 17409, 34718, 34721, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 22, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36051, 0, 2, 36043, 34718, 34720, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(36052, 0, 2, 17464, 34718, 34720, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 24, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_204
CALL FIELDSINFO_IMPORT(35718, 0, 2, 17474, 34738, 34740, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'VARIANT', '') ;

CALL FIELDSINFO_IMPORT(34742, 0, 2, 17450, 34738, 34741, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '000', '000', 0, 0, null, 0, 21555, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34743, 0, 2, 17419, 34738, 34741, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34744, 0, 2, 17418, 34738, 34741, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34745, 0, 2, 17452, 34738, 34741, 'IFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34746, 0, 2, 17413, 34738, 34741, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '000', '000', 0, 0, null, 0, 16857, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34747, 0, 2, 25270, 34738, 34741, 'KD', 3, 0, 0, 'КД', 'Ссылка на код дохода', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(34748, 0, 2, 17415, 34738, 34741, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34749, 0, 2, 17411, 34738, 34741, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34750, 0, 2, 17414, 34738, 34741, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '000', '000', 0, 0, null, 0, 16864, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34751, 0, 2, 17412, 34738, 34741, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '000', '000', 0, 0, null, 0, 16851, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34752, 0, 2, 17416, 34738, 34741, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '9.9.9', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34753, 0, 2, 26542, 34738, 34741, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34755, 0, 2, 17472, 34738, 34740, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34756, 0, 2, 17477, 34738, 34740, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34878, 0, 2, 17485, 34738, 34740, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECTCLS', '') ;

CALL FIELDSINFO_IMPORT(34893, 0, 2, 17426, 34738, 34741, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34894, 0, 2, 17417, 34738, 34741, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34895, 0, 2, 17460, 34738, 34741, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(35930, 0, 2, 17409, 34738, 34741, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 23, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36053, 0, 2, 36043, 34738, 34740, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(36054, 0, 2, 17464, 34738, 34740, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 25, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_205
CALL FIELDSINFO_IMPORT(34763, 0, 2, 17450, 34759, 34762, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '000', '000', 0, 0, null, 0, 21555, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34764, 0, 2, 17418, 34759, 34762, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34765, 0, 2, 17452, 34759, 34762, 'IFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FINSOURCE', '') ;

CALL FIELDSINFO_IMPORT(34766, 0, 2, 17413, 34759, 34762, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '000', '000', 0, 0, null, 0, 16857, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34767, 0, 2, 25270, 34759, 34762, 'KD', 3, 0, 0, 'КД', 'Ссылка на код дохода', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(34768, 0, 2, 17415, 34759, 34762, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34769, 0, 2, 17411, 34759, 34762, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34770, 0, 2, 17414, 34759, 34762, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '000', '000', 0, 0, null, 0, 16864, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34771, 0, 2, 17412, 34759, 34762, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '000', '000', 0, 0, null, 0, 16851, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34772, 0, 2, 17416, 34759, 34762, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '9.9.9', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34774, 0, 2, 17472, 34759, 34761, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34775, 0, 2, 17477, 34759, 34761, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(35719, 0, 2, 17474, 34759, 34761, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'VARIANT', '') ;

CALL FIELDSINFO_IMPORT(34879, 0, 2, 17485, 34759, 34761, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECTCLS', '') ;

CALL FIELDSINFO_IMPORT(34896, 0, 2, 17426, 34759, 34762, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34897, 0, 2, 17417, 34759, 34762, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34898, 0, 2, 17460, 34759, 34762, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(35931, 0, 2, 17409, 34759, 34762, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 21, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36055, 0, 2, 36043, 34759, 34761, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 22, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(36056, 0, 2, 17464, 34759, 34761, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 23, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_206
CALL FIELDSINFO_IMPORT(34783, 0, 2, 17451, 34779, 34782, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34784, 0, 2, 17450, 34779, 34782, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '000', '000', 0, 0, null, 0, 21555, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34785, 0, 2, 17419, 34779, 34782, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34786, 0, 2, 17418, 34779, 34782, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34787, 0, 2, 17413, 34779, 34782, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '000', '000', 0, 0, null, 0, 16857, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34788, 0, 2, 17415, 34779, 34782, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34789, 0, 2, 17411, 34779, 34782, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34790, 0, 2, 17414, 34779, 34782, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '000', '000', 0, 0, null, 0, 16864, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34791, 0, 2, 17412, 34779, 34782, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '000', '000', 0, 0, null, 0, 16851, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34792, 0, 2, 17416, 34779, 34782, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '9.9.9', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34793, 0, 2, 26542, 34779, 34782, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34795, 0, 2, 17472, 34779, 34781, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34796, 0, 2, 17477, 34779, 34781, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(35720, 0, 2, 17474, 34779, 34781, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'VARIANT', '') ;

CALL FIELDSINFO_IMPORT(35932, 0, 2, 17409, 34779, 34782, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 22, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(34880, 0, 2, 17485, 34779, 34781, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECTCLS', '') ;

CALL FIELDSINFO_IMPORT(34899, 0, 2, 17426, 34779, 34782, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34900, 0, 2, 17417, 34779, 34782, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34901, 0, 2, 17460, 34779, 34782, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(36057, 0, 2, 36043, 34779, 34781, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(36058, 0, 2, 17464, 34779, 34781, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 24, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_207
CALL FIELDSINFO_IMPORT(34803, 0, 2, 17451, 34799, 34802, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34804, 0, 2, 17450, 34799, 34802, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '000', '000', 0, 0, null, 0, 21555, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34805, 0, 2, 17419, 34799, 34802, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34806, 0, 2, 17418, 34799, 34802, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34807, 0, 2, 17413, 34799, 34802, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '000', '000', 0, 0, null, 0, 16857, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34808, 0, 2, 25270, 34799, 34802, 'KD', 3, 0, 0, 'КД', 'Ссылка на код дохода', 11, '', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(34809, 0, 2, 17415, 34799, 34802, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34810, 0, 2, 17411, 34799, 34802, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34811, 0, 2, 17414, 34799, 34802, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '000', '000', 0, 0, null, 0, 16864, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34812, 0, 2, 17412, 34799, 34802, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '000', '000', 0, 0, null, 0, 16851, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34813, 0, 2, 17416, 34799, 34802, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '9.9.9', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34814, 0, 2, 26542, 34799, 34802, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34816, 0, 2, 17472, 34799, 34801, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34817, 0, 2, 17477, 34799, 34801, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34881, 0, 2, 17485, 34799, 34801, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECTCLS', '') ;

CALL FIELDSINFO_IMPORT(35721, 0, 2, 17474, 34799, 34801, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'VARIANT', '') ;

CALL FIELDSINFO_IMPORT(34902, 0, 2, 17426, 34799, 34802, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34903, 0, 2, 17417, 34799, 34802, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34904, 0, 2, 17460, 34799, 34802, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(36059, 0, 2, 36043, 34799, 34801, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(35933, 0, 2, 17409, 34799, 34802, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 23, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36060, 0, 2, 17464, 34799, 34801, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 25, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_208
CALL FIELDSINFO_IMPORT(34824, 0, 2, 17451, 34820, 34823, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34825, 0, 2, 17450, 34820, 34823, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '000', '000', 0, 0, null, 0, 21555, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34826, 0, 2, 17419, 34820, 34823, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34827, 0, 2, 17418, 34820, 34823, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(34828, 0, 2, 17413, 34820, 34823, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '000', '000', 0, 0, null, 0, 16857, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(34829, 0, 2, 17415, 34820, 34823, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(34830, 0, 2, 17411, 34820, 34823, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(34831, 0, 2, 17414, 34820, 34823, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '000', '000', 0, 0, null, 0, 16864, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(34832, 0, 2, 17412, 34820, 34823, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '000', '000', 0, 0, null, 0, 16851, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(34833, 0, 2, 17416, 34820, 34823, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '9.9.9', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34834, 0, 2, 26542, 34820, 34823, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34836, 0, 2, 17472, 34820, 34822, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34837, 0, 2, 17477, 34820, 34822, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34882, 0, 2, 17485, 34820, 34822, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECTCLS', '') ;

CALL FIELDSINFO_IMPORT(34905, 0, 2, 17426, 34820, 34823, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(34906, 0, 2, 17417, 34820, 34823, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(34907, 0, 2, 17460, 34820, 34823, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(35722, 0, 2, 17474, 34820, 34822, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'VARIANT', '') ;

CALL FIELDSINFO_IMPORT(35934, 0, 2, 17409, 34820, 34823, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 22, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36061, 0, 2, 36043, 34820, 34822, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 23, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(36062, 0, 2, 17464, 34820, 34822, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 24, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- CLS_4903
CALL FIELDSINFO_IMPORT(34843, 0, 2, 30710, 34841, 34842, 'ARCHIVEDOCTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 30654, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'ARCHIVEDOCTYPE', '') ;

CALL FIELDSINFO_IMPORT(34844, 0, 2, 30713, 34841, 34842, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '', '', '', 0, 0, null, 0, 16803, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(34845, 0, 2, 22482, 34841, 34842, 'CREATERUSER', 1, 0, 30, 'Автор', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34846, 0, 2, 22471, 34841, 34842, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34847, 0, 2, 24707, 34841, 34842, 'PACKETSTATE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'PACKETSTATE', '') ;

CALL FIELDSINFO_IMPORT(34848, 0, 2, 30718, 34841, 34842, 'RSFO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 17108, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'RSFO', '') ;

CALL FIELDSINFO_IMPORT(34849, 0, 2, 22481, 34841, 34842, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 7, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 0, '', 'UPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(35946, 0, 2, 22469, 34841, 34842, 'ID', 3, 0, 0, 'Первичный ключ', '', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 8, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

-- CLS_903
CALL FIELDSINFO_IMPORT(35025, 0, 2, 17649, 35019, 35023, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(35026, 0, 2, 17647, 35019, 35023, 'INCACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 1, 17108, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'INCACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(35027, 0, 2, 17663, 35019, 35023, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECTCLS', '') ;

CALL FIELDSINFO_IMPORT(35028, 0, 2, 17720, 35019, 35024, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(35029, 0, 2, 17733, 35019, 35024, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 0, 21555, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(35030, 0, 2, 17697, 35019, 35024, 'FACIALACC_CLS', 3, 0, 0, 'С лицевого счета', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(35031, 0, 2, 17710, 35019, 35024, 'FACT', 3, 0, 0, 'С мероприятия', 'Мероприятие', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(35032, 0, 2, 17721, 35019, 35024, 'IFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '', '', '', 0, 0, null, 0, 17043, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'IFS', '') ;

CALL FIELDSINFO_IMPORT(35033, 0, 2, 17680, 35019, 35024, 'KD', 3, 0, 0, 'КД', 'Ссылка на код дохода', 11, '9.99.99.99.99', '', '', 0, 0, null, 0, 16824, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(35034, 0, 2, 17699, 35019, 35024, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(35035, 0, 2, 17682, 35019, 35024, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(35036, 0, 2, 17681, 35019, 35024, 'SUBKD', 3, 0, 0, 'СубКД', 'Классификатор суб кода дохода', 9, '99.99.99', '', '', 0, 0, null, 0, 16928, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKD', '') ;

CALL FIELDSINFO_IMPORT(35037, 0, 2, 26627, 35019, 35024, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(35038, 0, 2, 17739, 35019, 35024, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '9.99.999.999', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(35041, 0, 2, 17650, 35019, 35023, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(35947, 0, 2, 17669, 35019, 35024, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 18, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(36074, 0, 2, 36046, 35019, 35023, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 19, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

CALL FIELDSINFO_IMPORT(36075, 0, 2, 17644, 35019, 35023, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 20, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

-- ГОСПРОГРАММА
CALL FIELDSINFO_IMPORT(36014, 0, 2, 16965, 36012, 36013, 'ID', 3, 0, 0, 'Ключ', '', 11, '99.99.99', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'ID', '') ;

CALL FIELDSINFO_IMPORT(36015, 0, 2, 16969, 36012, 36013, 'NAME', 1, 0, 1024, 'Наименование', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, '', 'NAME', '') ;

CALL FIELDSINFO_IMPORT(36016, 0, 2, 16971, 36012, 36013, 'UPDATEDATE', 11, 0, 0, 'Дата изменения', '', 20, '99/99/9999', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, '', 'UPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(36017, 1, 2, null, 36012, null, 'КОДГОСПРОГРАММЫ', 1, 0, 255, 'Код госпрограммы', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'КОДГОСПРОГРАММЫ', '') ;

CALL FIELDSINFO_IMPORT(36018, 1, 2, null, 36012, null, 'ИМЯГОСПРОГРАММЫ', 1, 0, 1024, 'Имя госпрограммы', '', 60, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'ИМЯГОСПРОГРАММЫ', '') ;

-- CLS_210
CALL FIELDSINFO_IMPORT(37753, 0, 2, 17474, 37748, 37751, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'VARIANT', '') ;

CALL FIELDSINFO_IMPORT(37754, 0, 2, 17451, 37748, 37752, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 0, 21634, 0, 0, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(37755, 0, 2, 17450, 37748, 37752, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '000', '000', 0, 0, null, 0, 21555, 0, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(37756, 0, 2, 17419, 37748, 37752, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 0, 17129, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(37757, 0, 2, 17413, 37748, 37752, 'KCSR', 3, 0, 0, 'КЦСРКлюч', '', 11, '999.99.99', '000', '000', 0, 0, null, 0, 16857, 0, 0, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KCSR', '') ;

CALL FIELDSINFO_IMPORT(37758, 0, 2, 17415, 37748, 37752, 'KESR', 3, 0, 0, 'КЭСР', 'Экономическая статья', 6, '9.9.9', '', '', 0, 0, null, 0, 16871, 0, 0, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KESR', '') ;

CALL FIELDSINFO_IMPORT(37759, 0, 2, 17411, 37748, 37752, 'KFSR', 3, 0, 0, 'КФСР', 'Функциональная статья', 6, '99.99', '', '', 0, 0, null, 0, 16844, 0, 0, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KFSR', '') ;

CALL FIELDSINFO_IMPORT(37760, 0, 2, 17414, 37748, 37752, 'KVR', 3, 0, 0, 'КВРКлюч', '', 7, '>AAA', '000', '000', 0, 0, null, 0, 16864, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVR', '') ;

CALL FIELDSINFO_IMPORT(37761, 0, 2, 17412, 37748, 37752, 'KVSR', 3, 0, 0, 'КВСРКлюч', '', 4, '999', '000', '000', 0, 0, null, 0, 16851, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'KVSR', '') ;

CALL FIELDSINFO_IMPORT(37762, 0, 2, 17416, 37748, 37752, 'SUBKESR', 3, 0, 0, 'СубКЭСР', 'Суб экономическая статья расхода', 10, '9.9.9', '', '', 0, 0, null, 0, 16915, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(37763, 0, 2, 26542, 37748, 37752, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(37764, 0, 2, 17472, 37748, 37751, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 0, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(37765, 0, 2, 17477, 37748, 37751, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 0, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(37766, 0, 2, 17418, 37748, 37752, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 0, 16964, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(37767, 0, 2, 17485, 37748, 37751, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECTCLS', '') ;

CALL FIELDSINFO_IMPORT(37768, 0, 2, 17426, 37748, 37752, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 0, 17311, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(37769, 0, 2, 17417, 37748, 37752, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 0, 16688, 0, 0, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(37770, 0, 2, 17460, 37748, 37752, 'TRANSFERTCLS', 3, 0, 0, 'Код целевых средств (ключ)', 'Ссылка на код целевых средств', 12, '', '', '', 0, 0, null, 0, 22773, 0, 0, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(37771, 0, 2, 17409, 37748, 37752, 'ID', 3, 0, 0, 'Код записи', 'Код записи детали документа', 11, '', '', '', 2, 0, null, 0, null, 0, 1, 0, '', 22, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'RECORDCOUNT', '') ;

CALL FIELDSINFO_IMPORT(37772, 0, 2, 17464, 37748, 37751, 'ID', 3, 0, 0, 'Код документа', 'Код заголовка (документа)', 11, '', '', '', 2, 0, null, 1, null, 0, 1, 0, '', 23, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 0, '', 'CAPTIONID', '') ;

CALL FIELDSINFO_IMPORT(37773, 0, 2, 36043, 37748, 37751, 'DOCCHANGEDATE', 11, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 24, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, '', 'DOCCHANGEDATE', '') ;

-- События выборок
CALL SELECTIONEVENTS_IMPORT(34700, 34700, 1, 'КриптоБДИнициализацияДанныхКэш') ;

CALL SELECTIONEVENTS_IMPORT(36012, 36012, 3, 'ПослеПолученияДанных') ;

DROP PROCEDURE SELECTIONS_IMPORT
/

DROP PROCEDURE SELECTIONSDETAIL_IMPORT
/

DROP PROCEDURE FIELDSINFO_IMPORT
/

DROP PROCEDURE SELECTIONEVENTS_IMPORT
/

DROP PROCEDURE FIELDSINFO_DELETE
/

DROP PROCEDURE SELECTIONSDETAIL_DELETE
/

DROP PROCEDURE SELECTIONS_DELETE
/

DROP PROCEDURE SELECTIONEVENTS_DELETE
/

CREATE OR REPLACE PROCEDURE ImportDocCLS (
   ID_                 NUMBER,
   DOCTYPE_            NUMBER,
   DOCTYPENOTE_        VARCHAR2,
   TABLENAME_          VARCHAR2,
   TABLENAMEURM_       VARCHAR2,
   PRIMARYKEYNAME_     VARCHAR2,
   PRIMARYKEYNAMEURM_  VARCHAR2,
   LINKFIELDNAME_      VARCHAR2,
   LINKFIELDNAMEURM_   VARCHAR2,
   CLSTYPE_            NUMBER,
   SELECTIONREFBUDGET_ NUMBER,
   SELECTIONREFURM_    NUMBER,
   PROGINDEX_          NUMBER
) IS IDExists$   NUMBER (10);
BEGIN
   SELECT COUNT (ID)
   INTO IDExists$
   FROM DOCUMENTCLS
   WHERE (ID = ID_);

   IF (IDExists$ = 0) THEN
   INSERT INTO DOCUMENTCLS
   (ID, DOCTYPE, DOCTYPENOTE, TABLENAME, TABLENAMEURM, PRIMARYKEYNAME, PRIMARYKEYNAMEURM, LINKFIELDNAME, LINKFIELDNAMEURM, CLSTYPE, 
     SELECTIONREFBUDGET, SELECTIONREFURM, PROGINDEX)
   VALUES (ID_, DOCTYPE_, DOCTYPENOTE_, TABLENAME_, TABLENAMEURM_, PRIMARYKEYNAME_, PRIMARYKEYNAMEURM_, LINKFIELDNAME_, LINKFIELDNAMEURM_, CLSTYPE_, 
     SELECTIONREFBUDGET_, SELECTIONREFURM_, PROGINDEX_);
   ELSE
   UPDATE DOCUMENTCLS 
   SET
     DOCTYPENOTE = DOCTYPENOTE_,
     TABLENAME = TABLENAME_,
     TABLENAMEURM = TABLENAMEURM_,
     PRIMARYKEYNAME = PRIMARYKEYNAME_,
     PRIMARYKEYNAMEURM = PRIMARYKEYNAMEURM_,
     LINKFIELDNAME = LINKFIELDNAME_,
     LINKFIELDNAMEURM = LINKFIELDNAMEURM_,
     CLSTYPE = CLSTYPE_,
     SELECTIONREFBUDGET = SELECTIONREFBUDGET_,
     SELECTIONREFURM = SELECTIONREFURM_,
     PROGINDEX = PROGINDEX_
   WHERE  
    (ID = ID_)
    AND NOT (
            (
                    ((DOCTYPENOTE IS NOT NULL AND DOCTYPENOTE_ IS NOT NULL) AND
                       (UPPER (DOCTYPENOTE) = UPPER (DOCTYPENOTE_))
                    )
                    OR (DOCTYPENOTE IS NULL AND DOCTYPENOTE_ IS NULL)
                )    
        AND (UPPER (TABLENAME) = UPPER (TABLENAME_))    
        AND (
                    ((TABLENAMEURM IS NOT NULL AND TABLENAMEURM_ IS NOT NULL) AND
                       (UPPER (TABLENAMEURM) = UPPER (TABLENAMEURM_))
                    )
                    OR (TABLENAMEURM IS NULL AND TABLENAMEURM_ IS NULL)
                )    
        AND (UPPER (PRIMARYKEYNAME) = UPPER (PRIMARYKEYNAME_))
        AND (
                    ((PRIMARYKEYNAMEURM IS NOT NULL AND PRIMARYKEYNAMEURM_ IS NOT NULL) AND
                       (UPPER (PRIMARYKEYNAMEURM) = UPPER (PRIMARYKEYNAMEURM_))
                    )
                    OR (PRIMARYKEYNAMEURM IS NULL AND PRIMARYKEYNAMEURM_ IS NULL)
                )    
        AND (
                    ((LINKFIELDNAME IS NOT NULL AND LINKFIELDNAME_ IS NOT NULL) AND
                       (UPPER (LINKFIELDNAME) = UPPER (LINKFIELDNAME_))
                    )
                    OR (LINKFIELDNAME IS NULL AND LINKFIELDNAME_ IS NULL)
                )    
        AND (
                    ((LINKFIELDNAMEURM IS NOT NULL AND LINKFIELDNAMEURM_ IS NOT NULL) AND
                       (UPPER (LINKFIELDNAMEURM) = UPPER (LINKFIELDNAMEURM_))
                    )
                    OR (LINKFIELDNAMEURM IS NULL AND LINKFIELDNAMEURM_ IS NULL)
                )    
        AND (
                    ((CLSTYPE IS NOT NULL AND CLSTYPE_ IS NOT NULL) AND
                       (UPPER (CLSTYPE) = UPPER (CLSTYPE_))
                    )
                    OR (CLSTYPE IS NULL AND CLSTYPE_ IS NULL)
                ) 
        AND (
                    ((PROGINDEX IS NOT NULL AND PROGINDEX_ IS NOT NULL) AND
                       (PROGINDEX = PROGINDEX_)
                    )
                    OR (PROGINDEX IS NULL AND PROGINDEX_ IS NULL)
                )   
            );
   
   END IF;
END;
/

-- Добавляем страницы документов
CALL ImportDocCLS(10100, 101, 'Заголовок', 'FINDOCCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 223) ;

CALL ImportDocCLS(10101, 101, 'Финансирование', 'FINDOCDETAIL', ' ', 'ID', ' ', 'TOTALREF', ' ', 0, null, null, 223) ;

CALL ImportDocCLS(10102, 101, 'Выдача ссуд', 'FINDOCDETAIL', ' ', 'ID', ' ', 'TOTALREF', ' ', 0, null, null, null) ;

CALL ImportDocCLS(10103, 101, 'Погашение кредита', 'DEBT', ' ', 'ID', ' ', 'TOTALREF', ' ', 0, null, null, null) ;

CALL ImportDocCLS(10104, 101, 'Уплата % по кредиту', 'FINDOCDETAIL', ' ', 'ID', ' ', 'TOTALREF', ' ', 0, null, null, null) ;

CALL ImportDocCLS(10105, 101, 'Возврат доходов', 'INCOMES32', ' ', 'ID', ' ', 'TOTALREF', ' ', 0, null, null, null) ;

CALL ImportDocCLS(20100, 201, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 32) ;

CALL ImportDocCLS(20101, 201, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 32) ;

CALL ImportDocCLS(30100, 301, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 66) ;

CALL ImportDocCLS(30101, 301, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 66) ;

CALL ImportDocCLS(30200, 302, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 63) ;

CALL ImportDocCLS(30201, 302, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 63) ;

CALL ImportDocCLS(30300, 303, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 65) ;

CALL ImportDocCLS(30301, 303, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 65) ;

CALL ImportDocCLS(30400, 304, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 64) ;

CALL ImportDocCLS(30401, 304, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 64) ;

CALL ImportDocCLS(30500, 305, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 61) ;

CALL ImportDocCLS(30501, 305, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 61) ;

CALL ImportDocCLS(30600, 306, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 62) ;

CALL ImportDocCLS(30601, 306, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 62) ;

CALL ImportDocCLS(30700, 307, 'Заголовок', 'FACIALFINREESTR', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(31100, 311, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 68) ;

CALL ImportDocCLS(31101, 311, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 68) ;

CALL ImportDocCLS(31200, 312, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 69) ;

CALL ImportDocCLS(31201, 312, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 69) ;

CALL ImportDocCLS(31400, 314, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 70) ;

CALL ImportDocCLS(31401, 314, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 70) ;

CALL ImportDocCLS(31500, 315, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 71) ;

CALL ImportDocCLS(31501, 315, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 71) ;

CALL ImportDocCLS(992500, 9925, 'Заголовок', 'Cards', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992501, 9925, 'Лицевые счета', 'CARDSDETAIL_FACC', ' ', 'ID', ' ', 'RecordIndex', '', 0, null, null, null) ;

CALL ImportDocCLS(490300, 4903, 'Заголовок', 'DATAPACKET', ' ', 'ID', ' ', '', ' ', 0, null, null, 527) ;

CALL ImportDocCLS(32200, 322, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 73) ;

CALL ImportDocCLS(32201, 322, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 73) ;

CALL ImportDocCLS(32300, 323, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 75) ;

CALL ImportDocCLS(32301, 323, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 75) ;

CALL ImportDocCLS(32400, 324, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 76) ;

CALL ImportDocCLS(32401, 324, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 76) ;

CALL ImportDocCLS(40100, 401, 'Заголовок', 'LOANCREDIT', ' ', 'ID', ' ', '', ' ', 0, null, null, 130) ;

CALL ImportDocCLS(40101, 401, 'Получение', 'DEBT', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 131) ;

CALL ImportDocCLS(40102, 401, 'График погашения', 'LOANCREDITPLAN', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 137) ;

CALL ImportDocCLS(40103, 401, 'Погашение', 'DEBT', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 132) ;

CALL ImportDocCLS(40104, 401, 'Начисление %', 'LOANCREDITPERCENTS', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 134) ;

CALL ImportDocCLS(40105, 401, 'График уплаты %', 'LOANCREDITPLAN', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 138) ;

CALL ImportDocCLS(40106, 401, 'Уплата %', 'FINDOCDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 133) ;

CALL ImportDocCLS(40107, 401, 'Журнал %', 'PERCENTJOURNAL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, null) ;

CALL ImportDocCLS(40108, 401, 'Курс. разница', 'DEBT', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, null) ;

CALL ImportDocCLS(40109, 401, 'Обеспечение', 'COLLATERAL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 340) ;

CALL ImportDocCLS(40110, 401, 'Доп.расходы', 'FINDOCDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 341) ;

CALL ImportDocCLS(40111, 401, 'Договора', 'LOANCREDITCONTRACTS', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 342) ;

CALL ImportDocCLS(50100, 501, 'Заголовок', 'LOANCREDIT', ' ', 'ID', ' ', '', ' ', 0, null, null, 120) ;

CALL ImportDocCLS(50101, 501, 'Выдача', 'FINDOCDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 121) ;

CALL ImportDocCLS(50102, 501, 'График погашения', 'LOANCREDITPLAN', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 127) ;

CALL ImportDocCLS(50103, 501, 'Погашение', 'FINDOCDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 122) ;

CALL ImportDocCLS(50104, 501, 'Начисление %', 'LOANCREDITPERCENTS', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 124) ;

CALL ImportDocCLS(50105, 501, 'График уплаты %', 'LOANCREDITPLAN', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 128) ;

CALL ImportDocCLS(50106, 501, 'Уплата %', 'INCOMES32', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 123) ;

CALL ImportDocCLS(50107, 501, 'Журнал %', 'PERCENTJOURNAL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, null) ;

CALL ImportDocCLS(50108, 501, 'Обеспечение', 'COLLATERAL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 321) ;

CALL ImportDocCLS(70100, 701, 'Заголовок', 'FINDOCCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 23) ;

CALL ImportDocCLS(70101, 701, 'Детализация', 'FINDOCDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 23) ;

CALL ImportDocCLS(70200, 702, 'Заголовок', 'PAYDOC32', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(70201, 702, 'Детализация', 'PAYDOC32', ' ', 'ID', ' ', 'PARENTINDEX', ' ', 0, null, null, null) ;

CALL ImportDocCLS(70300, 703, 'Заголовок', 'FINDOCDETAIL', ' ', 'ID', ' ', '', ' ', 0, null, null, 36) ;

CALL ImportDocCLS(80100, 801, 'Заголовок', 'LIMITNOTIFYCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(80101, 801, 'Детализация', 'LIMITFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 57) ;

CALL ImportDocCLS(80200, 802, 'Заголовок', 'LIMITFINDETAIL', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(80300, 803, 'Заголовок', 'REQUESTFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(80301, 803, 'Детализация', 'LIMITFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, null) ;

CALL ImportDocCLS(80400, 804, 'Заголовок', 'LIMITFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(90100, 901, 'Заголовок', 'QUOTESTITLE', ' ', 'ID', ' ', '', ' ', 0, null, null, 145) ;

CALL ImportDocCLS(90101, 901, 'Детализация', 'INCOMES32', ' ', 'ID', ' ', 'RecordIndex', ' ', 0, null, null, 45) ;

CALL ImportDocCLS(90300, 903, 'Заголовок', 'QUOTESTITLE', ' ', 'ID', ' ', '', ' ', 0, null, null, 45) ;

CALL ImportDocCLS(90301, 903, 'Детализация', 'INCOMES32', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 45) ;

CALL ImportDocCLS(90500, 905, 'Заголовок', 'INCOMES32', ' ', 'ID', ' ', '', ' ', 0, null, null, 44) ;

CALL ImportDocCLS(90600, 906, 'Заголовок', 'INCOMES32', ' ', 'ID', ' ', '', ' ', 0, null, null, 41) ;

CALL ImportDocCLS(90601, 906, 'Детализация', 'INCOMES32', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 42) ;

CALL ImportDocCLS(120100, 1201, 'Заголовок', 'BUH_JOURNAL', ' ', 'ID', ' ', '', ' ', 0, null, null, 309) ;

CALL ImportDocCLS(150100, 1501, 'Заголовок', 'ORGOPERAT', ' ', 'ID', ' ', '', ' ', 0, null, null, 35) ;

CALL ImportDocCLS(160100, 1601, 'Заголовок', 'PROMISE_CAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(160101, 1601, 'Детализация', 'PROMISE_DETAIL', ' ', 'ID', ' ', 'TITLE_REF', ' ', 0, null, null, 345) ;

CALL ImportDocCLS(160200, 1602, 'Заголовок', 'PROMISE_DETAIL', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(170100, 1701, 'Заголовок', 'REQUESTS', ' ', 'ID', ' ', '', ' ', 0, null, null, 222) ;

CALL ImportDocCLS(170200, 1702, 'Заголовок', 'REQUESTS', ' ', 'ID', ' ', '', ' ', 0, null, null, 221) ;

CALL ImportDocCLS(170201, 1702, 'Детализация', 'REQUESTSPAYMENTS', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, null) ;

CALL ImportDocCLS(190100, 1901, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 264) ;

CALL ImportDocCLS(190101, 1901, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 264) ;

CALL ImportDocCLS(220100, 2201, 'Заголовок', 'BUDNOTIFY', 'BUDNOTIFY', 'ID', ' ', '', ' ', 0, null, null, 46) ;

CALL ImportDocCLS(220101, 2201, 'Детализация', 'BUDGETDATA', 'BUDGETDATA', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 46) ;

CALL ImportDocCLS(280100, 2801, 'Заголовок', 'ACCSOPERTITLE', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(280101, 2801, 'Детализация', 'PAYDOC32', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 16) ;

CALL ImportDocCLS(280200, 2802, 'Заголовок', 'DFACCOUNTOPERATION', ' ', 'ID', ' ', '', ' ', 0, null, null, 50) ;

CALL ImportDocCLS(440100, 4401, 'Заголовок', 'UNIONNOTIFYCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 251) ;

CALL ImportDocCLS(440101, 4401, 'Детализация', 'UNIONNOTIFYDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 251) ;

CALL ImportDocCLS(0, 0, 'Заголовок', ' ', ' ', ' ', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(991304, 9913, 'Внутренние связи', 'STATICLINKS', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(440300, 4403, 'Заголовок', 'UNIONNOTIFYCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 254) ;

CALL ImportDocCLS(440301, 4403, 'Детализация', 'UNIONNOTIFYDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 254) ;

CALL ImportDocCLS(989500, 9895, 'КЭШ справочника', 'OKTMO', 'OKTMO', 'id', 'id', '', '', 95, null, null, null) ;

CALL ImportDocCLS(990300, 9903, 'Заголовок', 'ORGANIZATIONS', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(990301, 9903, 'Расчетные счета', 'ORG_ACCOUNTS', ' ', 'ID', ' ', 'ORG_REF', ' ', 0, null, null, null) ;

CALL ImportDocCLS(990302, 9903, 'Лицевые счета', 'FACIALACC_CLS', ' ', 'ID', ' ', 'ORG_REF', ' ', 0, null, null, null) ;

CALL ImportDocCLS(990500, 9905, 'Заголовок', 'ORGANIZATIONS', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(90200, 902, 'Заголовок', 'INCOMES32', ' ', 'ID', ' ', '', ' ', 0, null, null, 38) ;

CALL ImportDocCLS(20701, 207, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 272) ;

CALL ImportDocCLS(90700, 907, 'Заголовок', 'INCOMES32', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(181200, 1812, 'Заголовок', 'ED_CorrectionCaption', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(181000, 1810, 'Заголовок', 'ED_OUTPAYDOC', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(20700, 207, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 272) ;

CALL ImportDocCLS(181001, 1810, 'Детализация', 'ED_DETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, null) ;

CALL ImportDocCLS(992700, 9927, 'Заголовок', 'REMOTECLIENT', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(550100, 5501, 'Заголовок', 'CORRECTIONCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 312) ;

CALL ImportDocCLS(20801, 208, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 273) ;

CALL ImportDocCLS(30701, 307, 'Детализация', 'FACIALFINCAPTION', ' ', 'ID', ' ', 'REESTR_REF', ' ', 0, null, null, null) ;

CALL ImportDocCLS(21100, 211, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', '', 0, null, null, 275) ;

CALL ImportDocCLS(490100, 4901, 'Заголовок', 'DATAPACKET', ' ', 'ID', ' ', '', ' ', 0, null, null, 525) ;

CALL ImportDocCLS(992701, 9927, 'Права на чтение', 'REMOTEREADRIGHT', ' ', 'ID', ' ', 'REMOTECLIENT', '', 0, null, null, null) ;

CALL ImportDocCLS(550101, 5501, 'Детализация', 'CORRECTIONDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 312) ;

CALL ImportDocCLS(490301, 4903, 'Детализация', 'ARCHIVEOPLOG', ' ', 'ID', ' ', 'DATAPACKETREF', '', 0, null, null, null) ;

CALL ImportDocCLS(390100, 3901, 'Заголовок', 'DELOIN', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(21101, 211, 'Деталь', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, 275) ;

CALL ImportDocCLS(992300, 9923, 'Заголовок', 'SIGNSCHEMECAPTION', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(181201, 1812, 'Детализация', 'ED_CorrectionDetail', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(550200, 5502, 'Заголовок', 'CORRECTIONCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 313) ;

CALL ImportDocCLS(20800, 208, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 273) ;

CALL ImportDocCLS(550201, 5502, 'Детализация', 'CORRECTIONDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 313) ;

CALL ImportDocCLS(90000, 900, 'Заголовок', ' ', ' ', ' ', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992301, 9923, 'Детализация', 'SIGNSCHEMEDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(991600, 9916, 'Константы', ' ', ' ', ' ', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992200, 9922, 'Заголовок', 'ARCHIVEDOCTYPE', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(90001, 900, 'Детализация', ' ', ' ', ' ', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(390101, 3901, 'Детализация', 'DELOEXEC', ' ', 'ID', ' ', 'DOCID', ' ', 0, null, null, null) ;

CALL ImportDocCLS(180700, 1807, 'Заголовок', 'PayDocExchange', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(21102, 211, 'Деталь2', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, 275) ;

CALL ImportDocCLS(991700, 9917, 'Константы', ' ', ' ', ' ', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(991200, 9912, 'Заголовок', 'DFACCOUNTSBUHTABLE', ' ', 'ID', ' ', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(181600, 1816, 'Заголовок', 'FacialFinCaption', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(30800, 308, 'Заголовок', 'FACIALFINCAPTION', ' ', 'ID', ' ', '', ' ', 0, null, null, 67) ;

CALL ImportDocCLS(250100, 2501, 'Заголовок', 'AGREEMENTS', 'AGREEMENTS', 'ID', 'ID', '', ' ', 0, null, null, 305) ;

CALL ImportDocCLS(21200, 212, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', '', 0, null, null, 276) ;

CALL ImportDocCLS(250101, 2501, 'Спецификация государственного контракта', 'ESTIMATE', 'ESTIMATE', 'ID', 'ID', 'RECORDINDEX', 'RECORDINDEX', 0, null, null, 305) ;

CALL ImportDocCLS(30801, 308, 'Детализация', 'FACIALFINDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 67) ;

CALL ImportDocCLS(250200, 2502, 'Заголовок', 'AGREEMENTS', 'AGREEMENTS', 'ID', 'ID', '', ' ', 0, null, null, 304) ;

CALL ImportDocCLS(250201, 2502, 'Этапы договора', 'AGREEMENTSTEPS', 'AGREEMENTSTEPS', 'ID', 'ID', 'RECORDINDEX', 'RECORDINDEX', 0, null, null, null) ;

CALL ImportDocCLS(988900, 9889, 'КЭШ справочника', 'SubsidyCls', ' ', 'id', ' ', '', '', 89, null, null, null) ;

CALL ImportDocCLS(250203, 2502, 'Смета договора', 'ESTIMATE', 'ESTIMATE', 'ID', 'ID', 'RECORDINDEX', 'RECORDINDEX', 0, null, null, 304) ;

CALL ImportDocCLS(988700, 9887, 'КЭШ справочника', 'VariantCls', ' ', 'ID', ' ', '', '', 87, null, null, null) ;

CALL ImportDocCLS(520100, 5201, 'Заголовок', 'WritExecutionCaption', 'WritExecutionCaption', 'id', 'id', '', '', 0, null, null, 555) ;

CALL ImportDocCLS(990800, 9908, 'Заголовок', 'DocumentTypes', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(250300, 2503, 'Заголовок', 'EXECUTIONDOCUMENTSCAPTION', 'EXECUTIONDOCUMENTSCAPTION', 'ID', 'ID', '', ' ', 0, null, null, null) ;

CALL ImportDocCLS(21201, 212, 'Деталь', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, 276) ;

CALL ImportDocCLS(250301, 2503, 'Продукция', 'EXECUTIONDOCUMENTSDETAIL', 'EXECUTIONDOCUMENTSDETAIL', 'ID', 'ID', 'RECORDINDEX', 'RECORDINDEX', 0, null, null, null) ;

CALL ImportDocCLS(180500, 1805, 'Заголовок', 'BANKEXCH_MERDOC', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(20201, 202, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 260) ;

CALL ImportDocCLS(20301, 203, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 261) ;

CALL ImportDocCLS(20401, 204, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 262) ;

CALL ImportDocCLS(20501, 205, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 263) ;

CALL ImportDocCLS(20601, 206, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 268) ;

CALL ImportDocCLS(190201, 1902, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 215) ;

CALL ImportDocCLS(190301, 1903, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 265) ;

CALL ImportDocCLS(20000, 200, 'Заголовок', 'BUDNOTIFY', ' ', 'id', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(190601, 1906, 'Детализация', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, 271) ;

CALL ImportDocCLS(20200, 202, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 260) ;

CALL ImportDocCLS(20300, 203, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 261) ;

CALL ImportDocCLS(20400, 204, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 262) ;

CALL ImportDocCLS(20500, 205, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 263) ;

CALL ImportDocCLS(20600, 206, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 268) ;

CALL ImportDocCLS(190200, 1902, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 215) ;

CALL ImportDocCLS(190300, 1903, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 265) ;

CALL ImportDocCLS(180501, 1805, 'Детализация', 'ED_DETAIL', ' ', 'ID', ' ', 'RecordIndex', '', 0, null, null, null) ;

CALL ImportDocCLS(190600, 1906, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', ' ', 0, null, null, 271) ;

CALL ImportDocCLS(988400, 9884, 'КЭШ справочника', 'TransfertCLS', ' ', 'ID', ' ', '', '', 84, null, null, null) ;

CALL ImportDocCLS(988800, 9888, 'КЭШ справочника', 'OKP', ' ', 'ID', ' ', '', '', 88, null, null, null) ;

CALL ImportDocCLS(989900, 9899, 'КЭШ справочника', 'DBUsers', ' ', 'ID', ' ', '', '', 201, null, null, null) ;

CALL ImportDocCLS(990801, 9908, 'Поля документа', 'DOCUMENTFIELDS', ' ', 'ID', ' ', 'DOCTYPEREF', '', 0, null, null, null) ;

CALL ImportDocCLS(361000, 3610, 'Заголовок', 'UTYPEDFORMSCAPTION', ' ', 'ID', ' ', '', '', 0, null, null, 550) ;

CALL ImportDocCLS(987200, 9872, 'КЭШ справочника', 'BalanceCls', ' ', 'ID', ' ', '', '', 72, null, null, null) ;

CALL ImportDocCLS(984600, 9846, 'КЭШ справочника', 'BUHPAYMENTCLS', ' ', 'ID', ' ', '', '', 46, null, null, null) ;

CALL ImportDocCLS(981800, 9818, 'КЭШ справочника', 'CURRENCYCLS', ' ', 'ID', ' ', '', '', 18, null, null, null) ;

CALL ImportDocCLS(988500, 9885, 'КЭШ справочника', 'AssignmentKind', ' ', 'ID', ' ', '', '', 85, null, null, null) ;

CALL ImportDocCLS(983500, 9835, 'КЭШ справочника', 'BUDGETTYPE', ' ', 'ID', ' ', '', '', 35, null, null, null) ;

CALL ImportDocCLS(985800, 9858, 'КЭШ справочника', 'DEBTTYPE', ' ', 'ID', ' ', '', '', 58, null, null, null) ;

CALL ImportDocCLS(988600, 9886, 'КЭШ справочника', 'AssignmentSource', ' ', 'ID', ' ', ' ', ' ', 86, null, null, null) ;

CALL ImportDocCLS(988300, 9883, 'КЭШ справочника', 'Org_Type', ' ', 'ID', ' ', '', '', 83, null, null, null) ;

CALL ImportDocCLS(986400, 9864, 'КЭШ справочника', 'PlanDocType', ' ', 'ID', ' ', '', '', 64, null, null, null) ;

CALL ImportDocCLS(985700, 9857, 'КЭШ справочника', 'LOANTYPE', ' ', 'ID', ' ', '', '', 57, null, null, null) ;

CALL ImportDocCLS(984300, 9843, 'КЭШ справочника', 'PAYTYPECLS', ' ', 'ID', ' ', '', '', 43, null, null, null) ;

CALL ImportDocCLS(982300, 9823, 'КЭШ справочника', 'GOSNI', ' ', 'ID', ' ', '', '', 23, null, null, null) ;

CALL ImportDocCLS(982200, 9822, 'КЭШ справочника', 'GroupInf_CLS', ' ', 'ID', ' ', '', '', 22, null, null, null) ;

CALL ImportDocCLS(982900, 9829, 'КЭШ справочника', 'DocBase', ' ', 'ID', ' ', '', '', 29, null, null, null) ;

CALL ImportDocCLS(981100, 9811, 'КЭШ справочника', 'DocTypes', ' ', 'ID', ' ', '', '', 11, null, null, null) ;

CALL ImportDocCLS(986000, 9860, 'КЭШ справочника', 'MEASUREMENTCLS', ' ', 'ID', ' ', '', '', 60, null, null, null) ;

CALL ImportDocCLS(988000, 9880, 'КЭШ справочника', 'FundsSource', ' ', 'ID', ' ', '', '', 80, null, null, null) ;

CALL ImportDocCLS(985200, 9852, 'КЭШ справочника', 'InnerFinSource', ' ', 'ID', ' ', '', '', 52, null, null, null) ;

CALL ImportDocCLS(981300, 9813, 'КЭШ справочника', 'NOTIFYTYPES', ' ', 'ID', ' ', '', '', 13, null, null, null) ;

CALL ImportDocCLS(984500, 9845, 'КЭШ справочника', 'PAYSYMBOLCLS', ' ', 'ID', ' ', '', '', 45, null, null, null) ;

CALL ImportDocCLS(980400, 9804, 'КЭШ справочника', 'KVR', ' ', 'ID', ' ', '', '', 4, null, null, null) ;

CALL ImportDocCLS(980300, 9803, 'КЭШ справочника', 'KVSR', ' ', 'ID', ' ', '', '', 3, null, null, null) ;

CALL ImportDocCLS(980900, 9809, 'КЭШ справочника', 'KD', ' ', 'ID', ' ', '', '', 9, null, null, null) ;

CALL ImportDocCLS(984700, 9847, 'КЭШ справочника', 'TYPEOPERATIONCLS', ' ', 'ID', ' ', '', '', 47, null, null, null) ;

CALL ImportDocCLS(986800, 9868, 'КЭШ справочника', 'KESR', ' ', 'ID', ' ', '', '', 68, null, null, null) ;

CALL ImportDocCLS(987900, 9879, 'КЭШ справочника', 'TargetCls', ' ', 'ID', ' ', '', '', 79, null, null, null) ;

CALL ImportDocCLS(985100, 9851, 'КЭШ справочника', 'Error', ' ', 'ID', ' ', '', '', 51, null, null, null) ;

CALL ImportDocCLS(982100, 9821, 'КЭШ справочника', 'ACC_CLS', ' ', 'ID', ' ', '', '', 21, null, null, null) ;

CALL ImportDocCLS(981400, 9814, 'КЭШ справочника', 'KSHK', ' ', 'ID', ' ', '', '', 14, null, null, null) ;

CALL ImportDocCLS(980200, 9802, 'КЭШ справочника', 'kfsr', ' ', 'ID', ' ', '', '', 2, null, null, null) ;

CALL ImportDocCLS(980500, 9805, 'КЭШ справочника', 'KCSR', ' ', 'ID', ' ', '', '', 5, null, null, null) ;

CALL ImportDocCLS(984100, 9841, 'КЭШ справочника', 'FACIALACC_CLS', ' ', 'ID', ' ', '', '', 41, null, null, null) ;

CALL ImportDocCLS(981500, 9815, 'КЭШ справочника', 'VALUECLS', ' ', 'ID', ' ', '', '', 15, null, null, null) ;

CALL ImportDocCLS(982800, 9828, 'КЭШ справочника', 'FACT', ' ', 'ID', ' ', '', '', 28, null, null, null) ;

CALL ImportDocCLS(984800, 9848, 'КЭШ справочника', 'PAYDESTINATIONCLS', ' ', 'ID', ' ', '', '', 48, null, null, null) ;

CALL ImportDocCLS(986900, 9869, 'КЭШ справочника', 'DirectionCLS', ' ', 'ID', ' ', '', '', 69, null, null, null) ;

CALL ImportDocCLS(986200, 9862, 'КЭШ справочника', 'OKATO', ' ', 'ID', ' ', '', '', 62, null, null, null) ;

CALL ImportDocCLS(988200, 9882, 'КЭШ справочника', 'OKOPF', ' ', 'ID', ' ', '', '', 82, null, null, null) ;

CALL ImportDocCLS(988100, 9881, 'КЭШ справочника', 'OKFS', ' ', 'ID', ' ', '', '', 81, null, null, null) ;

CALL ImportDocCLS(981600, 9816, 'КЭШ справочника', 'MeansCLS', ' ', 'ID', ' ', '', '', 16, null, null, null) ;

CALL ImportDocCLS(985900, 9859, 'КЭШ справочника', 'DepartmentCLS', ' ', 'ID', ' ', '', '', 59, null, null, null) ;

CALL ImportDocCLS(986500, 9865, 'КЭШ справочника', 'BuhAccPlan', ' ', 'ID', ' ', '', '', 65, null, null, null) ;

CALL ImportDocCLS(986100, 9861, 'КЭШ справочника', 'TenderObjects', ' ', 'ID', ' ', '', '', 61, null, null, null) ;

CALL ImportDocCLS(985000, 9850, 'КЭШ справочника', 'RejectCLS', ' ', 'ID', ' ', '', '', 50, null, null, null) ;

CALL ImportDocCLS(987000, 9870, 'КЭШ справочника', 'ProgramCode', ' ', 'ID', ' ', '', '', 70, null, null, null) ;

CALL ImportDocCLS(981200, 9812, 'КЭШ справочника', 'RegionCLS', ' ', 'ID', ' ', '', '', 12, null, null, null) ;

CALL ImportDocCLS(982600, 9826, 'КЭШ справочника', 'BUDGETACCOUNTS', ' ', 'ID', ' ', '', '', 26, null, null, null) ;

CALL ImportDocCLS(981700, 9817, 'КЭШ справочника', 'REFCLS', ' ', 'ID', ' ', '', '', 17, null, null, null) ;

CALL ImportDocCLS(981000, 9810, 'КЭШ справочника', 'SubKD', ' ', 'ID', ' ', '', '', 10, null, null, null) ;

CALL ImportDocCLS(980600, 9806, 'КЭШ справочника', 'SUBKCSR', ' ', 'ID', ' ', '', '', 6, null, null, null) ;

CALL ImportDocCLS(980800, 9808, 'КЭШ справочника', 'KESRSubCode', ' ', 'ID', ' ', '', '', 8, null, null, null) ;

CALL ImportDocCLS(986300, 9863, 'КЭШ справочника', 'COLLATERALTYPE', ' ', 'ID', ' ', '', '', 63, null, null, null) ;

CALL ImportDocCLS(982000, 9820, 'КЭШ справочника', 'ORG_CLS', ' ', 'ID', ' ', '', '', 20, null, null, null) ;

CALL ImportDocCLS(983400, 9834, 'КЭШ справочника', 'ReportType', ' ', 'ID', ' ', '', '', 34, null, null, null) ;

CALL ImportDocCLS(985300, 9853, 'КЭШ справочника', 'REESTRTYPE', ' ', 'ID', ' ', '', '', 53, null, null, null) ;

CALL ImportDocCLS(984900, 9849, 'КЭШ справочника', 'MEANSTYPE', ' ', 'ID', ' ', '', '', 49, null, null, null) ;

CALL ImportDocCLS(982700, 9827, 'КЭШ справочника', 'FinType', ' ', 'ID', ' ', '', '', 27, null, null, null) ;

CALL ImportDocCLS(984400, 9844, 'КЭШ справочника', 'Org_AccDefaults', ' ', 'ID', ' ', '', '', 44, null, null, null) ;

CALL ImportDocCLS(960100, 9601, 'КЭШ справочника', 'ORGANIZATIONS', ' ', 'ID', ' ', '', '', 1000, null, null, null) ;

CALL ImportDocCLS(960200, 9602, 'КЭШ справочника', 'ORG_ACCOUNTS', ' ', 'ID', ' ', '', '', 1001, null, null, null) ;

CALL ImportDocCLS(960400, 9604, 'КЭШ справочника', 'DFACCOUNTSBUHTABLE', ' ', 'ID', ' ', '', '', 1003, null, null, null) ;

CALL ImportDocCLS(960300, 9603, 'КЭШ справочника', 'BANKS', ' ', 'ID', ' ', '', '', 1002, null, null, null) ;

CALL ImportDocCLS(987100, 9871, 'КЭШ справочника', 'BuhOperationCls', ' ', 'Id', ' ', '', '', 71, null, null, null) ;

CALL ImportDocCLS(987800, 9878, 'КЭШ справочника', 'budgets_s', ' ', 'id', ' ', '', '', 78, null, null, null) ;

CALL ImportDocCLS(991400, 9914, 'Заголовок', 'DATAPACKETTYPES', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(991401, 9914, 'Детализация', 'DATAPACKETCONTENT', ' ', 'ID', ' ', 'DATAPACKETTYPE', '', 0, null, null, null) ;

CALL ImportDocCLS(991500, 9915, 'Заголовок', 'UNLOCKDATES', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(991501, 9915, 'Детализация', 'UNLOCKDATES', ' ', 'ID', ' ', 'ID', '', 0, null, null, null) ;

CALL ImportDocCLS(20001, 200, 'Детализация', 'BUDGETDATA', ' ', 'id', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(30000, 300, 'Заголовок', ' ', ' ', ' ', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(30001, 300, 'Детализация', ' ', ' ', ' ', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(190000, 1900, 'Заголовок', 'BUDNOTIFY', ' ', 'id', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(190001, 1900, 'Детализация', 'BUDGETDATA', ' ', 'id', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(220000, 2200, 'Заголовок', 'BUDNOTIFY', ' ', 'id', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(220001, 2200, 'Детализация', 'BUDGETDATA', ' ', 'id', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(991300, 9913, 'Заголовок', 'INTERFACES', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(991301, 9913, 'Права', 'Permissions', ' ', 'ID', ' ', 'INTERFACEREF', '', 0, null, null, null) ;

CALL ImportDocCLS(991302, 9913, 'Связи', 'LinkType', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(991303, 9913, 'Параметры ограничений', ' ', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(490200, 4902, 'Заголовок', 'DATAPACKET', ' ', 'ID', ' ', '', ' ', 0, null, null, 526) ;

CALL ImportDocCLS(250400, 2504, 'Заголовок', 'AGREEMENTS', 'AGREEMENTS', 'ID', 'ID', '', '', 0, null, null, 314) ;

CALL ImportDocCLS(300100, 3001, 'Заголовок', 'TenderCaption', ' ', 'ID', ' ', '', '', 0, null, null, 230) ;

CALL ImportDocCLS(250401, 2504, 'Этапы муниципального контракта', 'AGREEMENTSTEPS', 'AGREEMENTSTEPS', 'ID', 'ID', 'RECORDINDEX', 'RECORDINDEX', 0, null, null, null) ;

CALL ImportDocCLS(250403, 2504, 'Смета муниципального контракта', 'ESTIMATE', 'ESTIMATE', 'ID', 'ID', 'RECORDINDEX', 'RECORDINDEX', 0, null, null, null) ;

CALL ImportDocCLS(250402, 2504, 'График выплат муниципального контракта', 'PAYMENTSCHEDULE', 'PAYMENTSCHEDULE', 'ID', 'ID', 'AGREEMENTREF', 'AGREEMENTREF', 0, null, null, null) ;

CALL ImportDocCLS(300600, 3006, 'Заголовок', 'TENDERCAPTION', ' ', 'ID', ' ', '', '', 0, null, null, 241) ;

CALL ImportDocCLS(250102, 2501, 'План финансирования гос. контракта', 'PAYMENTSCHEDULE', 'PAYMENTSCHEDULE', 'ID', 'ID', 'RECORDINDEX', 'RECORDINDEX', 0, null, null, 305) ;

CALL ImportDocCLS(70202, 702, 'Детализация', 'PAYDOCEXCHANGE', ' ', 'ID', ' ', 'PAYDOCREF', '', 0, null, null, null) ;

CALL ImportDocCLS(170101, 1701, 'Детализация', 'REQUESTSPAYMENTS', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, null) ;

CALL ImportDocCLS(20900, 209, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', '', 0, null, null, 274) ;

CALL ImportDocCLS(300601, 3006, 'Продукция плановых заявок', 'TENDERPRODUCT', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, 241) ;

CALL ImportDocCLS(300602, 3006, 'Контактные лица плановых заявок', 'TENDERCONTACTS', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(300300, 3003, 'Заголовок', 'TenderResultCaption', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(300101, 3001, 'Продукция заявок', 'TenderProduct', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, 230) ;

CALL ImportDocCLS(300102, 3001, 'Лоты заявок', 'TenderLot', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(300103, 3001, 'Предпологаемые поставщики для заявок', 'TENDERSOURCEORG', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(300104, 3001, 'Условия допуска для заявок', 'TENDERYARDSTICKS', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(300105, 3001, 'Кретерии оценки для заявок', 'TENDERYARDSTICKS', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(300106, 3001, 'Контактные лица', 'TENDERCONTACTS', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(300107, 3001, 'Документы заказчика для заявок', 'TENDERSUPPLEMENTS', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(300108, 3001, 'Документы, предаставляемые постащиком', 'TENDERSUPDOCUMENT', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(370100, 3701, 'Заголовок', 'TenderObjects', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(520101, 5201, 'Детализация', 'WritExecutionDetail', 'WritExecutionDetail', 'id', 'id', 'RecordIndex', '', 0, null, null, 556) ;

CALL ImportDocCLS(20901, 209, 'Деталь', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, 274) ;

CALL ImportDocCLS(21000, 210, 'Заголовок', 'BUDNOTIFY', ' ', 'ID', ' ', '', '', 0, null, null, 252) ;

CALL ImportDocCLS(21001, 210, 'БА, ЛБО', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, 252) ;

CALL ImportDocCLS(21002, 210, 'ПОФ', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, 253) ;

CALL ImportDocCLS(991800, 9918, 'Заголовок', 'USERGENERATOR', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(991801, 9918, 'Детализация', 'USERGENERATORFIELDS', ' ', 'ID', ' ', 'GENREF', '', 0, null, null, null) ;

CALL ImportDocCLS(992702, 9927, 'Права на ввод документов', 'REMOTEINPUTRIGHT', ' ', 'ID', ' ', 'REMOTECLIENT', '', 0, null, null, null) ;

CALL ImportDocCLS(21202, 212, 'Деталь2', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, 276) ;

CALL ImportDocCLS(990802, 9908, 'Состояния документа', 'STATE_DOCSTATES', ' ', 'ID', ' ', 'DOCTYPEREF', '', 0, null, null, null) ;

CALL ImportDocCLS(990803, 9908, 'Переходы', 'STATE_JUMPS', ' ', 'ID', ' ', 'DOCTYPEREF', '', 0, null, null, null) ;

CALL ImportDocCLS(990804, 9908, 'Действия', 'STATE_ACTIONS', ' ', 'ID', ' ', 'DOCTYPEREF', '', 0, null, null, null) ;

CALL ImportDocCLS(992703, 9927, 'Казначейские счета для документов', 'REMOTECLIENTACCOUNT', ' ', 'ID', ' ', 'REMOTECLIENT', '', 0, null, null, null) ;

CALL ImportDocCLS(992000, 9920, 'Заголовок', 'BUHOPERATIONCLS', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992001, 9920, 'Детализация', 'BUHACCCORR', ' ', 'ID', ' ', 'BUHOPERATIONCLS', '', 0, null, null, null) ;

CALL ImportDocCLS(992100, 9921, 'Заголовок', 'BUDGETS_S', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992101, 9921, 'Лицевые счета', 'FACIALACC_CLS', ' ', 'ID', ' ', 'BUDGETREF', '', 0, null, null, null) ;

CALL ImportDocCLS(992102, 9921, 'Расчетные счета', 'DFACCOUNTSBUHTABLE', ' ', 'ID', ' ', 'BUDGETREF', '', 0, null, null, null) ;

CALL ImportDocCLS(989000, 9890, 'КЭШ справочника', 'BudAllocationCls', ' ', 'id', ' ', '', '', 90, null, null, null) ;

CALL ImportDocCLS(989100, 9891, 'КЭШ справочника', 'PayPromiseCls', ' ', 'id', ' ', '', '', 91, null, null, null) ;

CALL ImportDocCLS(550300, 5503, 'Заголовок', 'ReplacementClsCaption', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(550301, 5503, 'Информация о классификации ПЗК', 'ReplacementClsDetail', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, null) ;

CALL ImportDocCLS(550302, 5503, 'Результат ПЗК', 'ReplacementClsDetailInfo', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(250302, 2503, 'График выплат', 'PAYMENTSCHEDULE', 'PAYMENTSCHEDULE', 'ID', 'ID', 'EXECUTIONREF', '', 0, null, null, 308) ;

CALL ImportDocCLS(181400, 1814, 'Заголовок', 'BANKEXCH_LS_KB', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(180900, 1809, 'Заголовок', 'BANKEXCH_SUBSTITUTION', 'BANKEXCH_SUBSTITUTION', 'ID', 'ID', '', '', 0, null, null, null) ;

CALL ImportDocCLS(181500, 1815, 'Заголовок', 'BANKEXCH_KO_SALDO', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992900, 9929, 'Заголовок', 'BudStruct', 'BudStruct', 'ID', 'ID', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992201, 9922, 'Детализация', 'ARCHIVEDOCPARAMS', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, null) ;

CALL ImportDocCLS(992400, 9924, 'Заголовок', 'SIGNS', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(480101, 4801, 'Деталь', 'GeneralDocsDetail', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992502, 9925, 'ЭКР', 'CARDSDETAIL_KESR', ' ', 'ID', ' ', 'RecordIndex', '', 0, null, null, null) ;

CALL ImportDocCLS(250202, 2502, 'График выплат договора', 'PAYMENTSCHEDULE', 'PAYMENTSCHEDULE', 'ID', 'ID', 'AGREEMENTREF', 'AGREEMENTREF', 0, null, null, 304) ;

CALL ImportDocCLS(250404, 2504, 'План финансирования', 'PAYMENTSCHEDULE', 'PAYMENTSCHEDULE', 'ID', 'ID', 'RECORDINDEX', 'RECORDINDEX', 0, null, null, null) ;

CALL ImportDocCLS(520102, 5201, 'Детализация2', 'WritExecutionNotify', 'WritExecutionNotify', 'id', 'id', 'RecordIndex', '', 0, null, null, null) ;

CALL ImportDocCLS(989200, 9892, 'КЭШ справочника', 'ArchiveDocType', ' ', 'id', ' ', '', '', 92, null, null, null) ;

CALL ImportDocCLS(480100, 4801, 'Заголовок', 'GeneralDocuments', ' ', 'ID', ' ', '', '', 0, null, null, 528) ;

CALL ImportDocCLS(992600, 9926, 'Заголовок', 'WritNotifyCls', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992601, 9926, 'Детализация', 'WRITNOTIFYCLSDETAIL', ' ', 'ID', ' ', 'RECORDINDEX', ' ', 0, null, null, null) ;

CALL ImportDocCLS(992602, 9926, 'Атрибуты уведомлений', 'WritNotifyClsPart', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(31600, 316, '', 'ManagerBid', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(20902, 209, 'Деталь2', 'BUDGETDATA', ' ', 'ID', ' ', 'RECORDINDEX', '', 0, null, null, 274) ;

CALL ImportDocCLS(992704, 9927, 'Типы документов + Л/С', 'DUALRIGHTS', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992705, 9927, 'Получение пакетов', 'REMOTEEDSRIGHT', ' ', 'ID', ' ', 'REMOTECLIENT', '', 0, null, null, null) ;

CALL ImportDocCLS(992706, 9927, 'Создание пакетов', 'REMOTEEDSRIGHT', ' ', 'ID', ' ', 'REMOTECLIENT', '', 0, null, null, null) ;

CALL ImportDocCLS(990400, 9904, 'Заголовок', 'CONTACTPERSONS', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992707, 9927, 'Сертификаты', 'SIGNCERTIFICATE', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(992708, 9927, 'Группы подписания документов', 'SIGNDOCUMENTSGROUP', ' ', 'ID', ' ', 'CLIENTREF', '', 0, null, null, null) ;

DROP PROCEDURE ImportDocCLS
/

COMMIT WORK
/


CREATE OR REPLACE PROCEDURE ImportField (
   ID_                NUMBER,
   NAME_              VARCHAR2,
   ITFFIELDNAME_      VARCHAR2,
   NOTE_              VARCHAR2,
   TEMPLATEFIELD_     VARCHAR2,
   ISBUDGET_          NUMBER,
   DOCTYPEREF_        NUMBER,
   DETAILNUMBER_      NUMBER,
   ONLYREAD_          NUMBER,
   ReportFieldName_   VARCHAR2,
   KIND_	      NUMBER,
   FIELDINFOREF_      NUMBER
) IS
   IDExists$   NUMBER (10);
BEGIN
   SELECT COUNT (ID)
     INTO IDExists$
     FROM DocumentFields
    WHERE (ID = ID_);

   IF (IDExists$ <> 0) THEN
      UPDATE DocumentFields
         SET NAME = NAME_,
             ITFFIELDNAME = ITFFIELDNAME_,
             NOTE = NOTE_,
             TEMPLATEFIELD = TEMPLATEFIELD_,
             ISBUDGET = ISBUDGET_,
             DOCTYPEREF = DOCTYPEREF_,
             DETAILNUMBER = DETAILNUMBER_,
             ONLYREAD = ONLYREAD_,
             ReportFieldName = ReportFieldName_,
			 FIELDINFOREF = FIELDINFOREF_
       WHERE (ID = ID_)
         AND NOT (
                      (
                          (
                           (NAME IS NOT NULL AND NAME_ IS NOT NULL) AND
                           (UPPER (NAME) = UPPER (NAME_))
                          )
                       OR (NAME IS NULL AND NAME_ IS NULL)
                      )

                  AND (
                          (
                           (ITFFIELDNAME_ IS NOT NULL AND ITFFIELDNAME IS NOT NULL) AND
                           (UPPER (ITFFIELDNAME_) = UPPER (ITFFIELDNAME))
                          )
                       OR (ITFFIELDNAME_ IS NULL AND ITFFIELDNAME IS NULL)
                      )
                      
                  AND (
                          (
                           (NOTE IS NOT NULL AND NOTE_ IS NOT NULL) AND
                           (UPPER (NOTE) = UPPER (NOTE_))
                          )
                       OR (NOTE IS NULL AND NOTE_ IS NULL)
                      )
                  AND (UPPER (TEMPLATEFIELD) = UPPER (TEMPLATEFIELD_))
                  AND (
                          (
                           (ISBUDGET IS NOT NULL AND ISBUDGET_ IS NOT NULL) AND
                           (ISBUDGET = ISBUDGET_)
                          )
                       OR (ISBUDGET IS NULL AND ISBUDGET_ IS NULL)
                      )
                  AND (
                          (
                           (FIELDINFOREF IS NOT NULL AND FIELDINFOREF_ IS NOT NULL) AND
                           (FIELDINFOREF = FIELDINFOREF_)
                          )
                       OR (FIELDINFOREF IS NULL AND FIELDINFOREF_ IS NULL)
                      )
                  AND (DOCTYPEREF = DOCTYPEREF_)
                  AND (DETAILNUMBER = DETAILNUMBER_)
                  AND (ONLYREAD = ONLYREAD_)
                  AND (
                          (
                           (ReportFieldName IS NOT NULL AND ReportFieldName_ IS NOT NULL) AND
                           (UPPER (ReportFieldName) = UPPER (ReportFieldName_))
                          )
                       OR (ReportFieldName IS NULL AND ReportFieldName_ IS NULL)
                      )
                 );
   ELSE
      INSERT INTO DocumentFields
                  (ID, NAME, ITFFIELDNAME, NOTE, TEMPLATEFIELD,
                   ISBUDGET, DOCTYPEREF, DETAILNUMBER, ONLYREAD, ReportFieldName, FIELDINFOREF
                  )
           VALUES (ID_, NAME_, ITFFIELDNAME_, NOTE_, TEMPLATEFIELD_,
                   ISBUDGET_, DOCTYPEREF_, DETAILNUMBER_, ONLYREAD_, ReportFieldName_, FIELDINFOREF_
                  );
   END IF;

   FOR tab_rec IN (
                   SELECT ID
                     FROM DocumentFields
                    WHERE (ID <> ID_)
                      AND (DOCTYPEREF = DOCTYPEREF_)
                      AND (
                              (
                               (ISBUDGET IS NOT NULL AND ISBUDGET_ IS NOT NULL) AND
                               (ISBUDGET = ISBUDGET_)
                              )
                           OR (ISBUDGET IS NULL AND ISBUDGET_ IS NULL)
                          )
                      AND (DETAILNUMBER = DETAILNUMBER_)
              AND ( /* если имя поля на интерфейсе пустое, а имя поля на шаблоне не пустое, то проверяем имя поля на шаблоне */
                            (
                             ((ITFFIELDNAME_ IS NULL)or(ITFFIELDNAME_=' '))
                 and not((TEMPLATEFIELD_ IS NULL)or(TEMPLATEFIELD_=' '))
                 and(TEMPLATEFIELD is NOT null) and (UPPER(TEMPLATEFIELD)=UPPER(TEMPLATEFIELD_))
                            )
                    or (
                        not ((ITFFIELDNAME_ IS NULL) or (ITFFIELDNAME_=' '))
                                and (ITFFIELDNAME IS NOT NULL) and (UPPER(ITFFIELDNAME)=UPPER(ITFFIELDNAME_)))
                            )
                       )
   LOOP
      UPDATE State_OpenFields
         SET DOCFIELDREF = ID_
       WHERE (DOCFIELDREF = tab_rec.ID);

      UPDATE DOCLOCKFIELDS
         SET FIELDREF = ID_
       WHERE (FIELDREF = tab_rec.ID);

      UPDATE staticlinks
         SET PARENTFIELDREF = ID_
      WHERE (PARENTFIELDREF = tab_rec.ID);

      UPDATE staticlinks
         SET CHILDFIELDREF = ID_
      WHERE (CHILDFIELDREF = tab_rec.ID);

      DELETE FROM DocumentFields
            WHERE (ID = tab_rec.ID);
   END LOOP;
END;
/

CREATE OR REPLACE PROCEDURE DeleteFields (ID$ NUMBER) IS
BEGIN
  DELETE FROM State_OpenFields
  WHERE (docfieldref = ID$);
  DELETE FROM DOCLOCKFIELDS
  WHERE (fieldref = ID$);

  DELETE FROM STATE_JUMPCONTROL
  WHERE STATICLINKREF IN(SELECT ID FROM staticlinks
                           WHERE (PARENTFIELDREF=ID$)OR(CHILDFIELDREF=ID$));
  DELETE FROM staticlinks
  WHERE (PARENTFIELDREF=ID$)OR(CHILDFIELDREF=ID$);
  
  DELETE FROM DOCUMENTTEMPLATEFIELDS
  WHERE (FIELDS=ID$);

  DELETE FROM DocumentFields
  WHERE (id = ID$);
END;
/

CREATE OR REPLACE PROCEDURE INSERTCONST (
  PROGINDEX_     NUMBER,
  CONSTINDEX_    NUMBER,
  CONSTTYPE_     NUMBER,
  NOTE_          VARCHAR2,
  VARCHARVALUE_  VARCHAR2,
  DOUBLEVALUE_   NUMBER,
  INTVALUE_      INTEGER,
  EDITDOCCODE_   INTEGER
) IS
  IDEXISTS$ NUMBER;
BEGIN
  IF (CONSTTYPE_ = 3) THEN
    SELECT COUNT (PROGINDEX)
    INTO IDExists$
    FROM IntConst
    WHERE (PROGINDEX = PROGINDEX_) AND (CONSTINDEX = CONSTINDEX_);

    IF (IDExists$ = 0) THEN
      INSERT INTO INTCONST
        (PROGINDEX,CONSTINDEX,CONSTVALUE,NOTE,EDITDOCCODE)
      VALUES
        (PROGINDEX_,CONSTINDEX_,INTVALUE_,NOTE_,EDITDOCCODE_);
    ELSE 
      UPDATE INTCONST SET
        NOTE = NOTE_,
        EDITDOCCODE = EDITDOCCODE_
      WHERE (PROGINDEX=PROGINDEX_) AND (CONSTINDEX=CONSTINDEX_);
    END IF;    
  END IF;

  IF (CONSTTYPE_ = 8) THEN
    SELECT COUNT (PROGINDEX)
    INTO IDExists$
    FROM VarcharConst
    WHERE (PROGINDEX = PROGINDEX_) AND (CONSTINDEX = CONSTINDEX_);

    IF (IDExists$ = 0) THEN
      INSERT INTO VARCHARCONST
        (PROGINDEX,CONSTINDEX,CONSTVALUE,NOTE,EDITDOCCODE)
      VALUES
        (PROGINDEX_,CONSTINDEX_,VARCHARVALUE_,NOTE_,EDITDOCCODE_);
    ELSE 
      UPDATE VARCHARCONST SET
        NOTE = NOTE_,
        EDITDOCCODE = EDITDOCCODE_
      WHERE (PROGINDEX=PROGINDEX_) AND (CONSTINDEX=CONSTINDEX_);
    END IF;    
  END IF;

  IF (CONSTTYPE_ = 5) THEN
    SELECT COUNT (PROGINDEX)
    INTO IDExists$
    FROM RealConst
    WHERE (PROGINDEX = PROGINDEX_) AND (CONSTINDEX = CONSTINDEX_);

    IF (IDExists$ = 0) THEN
      INSERT INTO REALCONST
        (PROGINDEX,CONSTINDEX,CONSTVALUE,NOTE,EDITDOCCODE)
      VALUES
        (PROGINDEX_,CONSTINDEX_,DOUBLEVALUE_,NOTE_,EDITDOCCODE_);
    ELSE 
      UPDATE REALCONST SET
        NOTE = NOTE_,
        EDITDOCCODE = EDITDOCCODE_
      WHERE (PROGINDEX=PROGINDEX_) AND (CONSTINDEX=CONSTINDEX_);
    END IF;   
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE DELETECONST (
  PROGINDEX_     NUMBER,
  CONSTINDEX_    NUMBER,
  CONSTTYPE_     NUMBER
) IS
BEGIN
  IF (CONSTTYPE_ = 3) THEN
    UPDATE IntConst
      SET CloseDate = systimestamp
    WHERE (PROGINDEX = PROGINDEX_) AND (CONSTINDEX = CONSTINDEX_);
  END IF;
  IF (CONSTTYPE_ = 8) THEN
    UPDATE VARCHARCONST
      SET CloseDate = systimestamp
    WHERE (PROGINDEX = PROGINDEX_) AND (CONSTINDEX = CONSTINDEX_); 
  END IF;
  IF (CONSTTYPE_ = 5) THEN
    UPDATE REALCONST
      SET CloseDate = systimestamp
    WHERE (PROGINDEX = PROGINDEX_) AND (CONSTINDEX = CONSTINDEX_);
  END IF;
END;
/

-- Отключаем триггеры авторизации на изменение для констант
ALTER TRIGGER TR_INTCONST_BU_500 DISABLE
/

ALTER TRIGGER TR_VARCHARCONST_BU_500 DISABLE
/

ALTER TRIGGER TR_REALCONST_BU_500 DISABLE
/

-- Удаляем ненужные поля и константы
CALL DeleteFields(20401136) ;

CALL DeleteFields(20701209) ;

CALL DeleteFields(20801211) ;

CALL DeleteFields(20901002) ;

CALL DeleteFields(20901003) ;

CALL DeleteFields(20900004) ;

CALL DeleteFields(20901013) ;

CALL DeleteFields(20901024) ;

CALL DeleteFields(20901026) ;

CALL DeleteFields(20901029) ;

CALL DeleteFields(20901030) ;

CALL DeleteFields(20901135) ;

CALL DeleteFields(20911144) ;

CALL DeleteFields(20901136) ;

CALL DeleteFields(21001057) ;

CALL DeleteFields(21002058) ;

CALL DeleteFields(21101047) ;

CALL DeleteFields(21201048) ;

CALL DeleteFields(30111170) ;

CALL DeleteFields(30101197) ;

CALL DeleteFields(30211155) ;

CALL DeleteFields(30201172) ;

CALL DeleteFields(30200168) ;

CALL DeleteFields(30210159) ;

CALL DeleteFields(30311094) ;

CALL DeleteFields(30301079) ;

CALL DeleteFields(30400032) ;

CALL DeleteFields(30410032) ;

CALL DeleteFields(90101063) ;

CALL DeleteFields(90101064) ;

CALL DeleteFields(90101054) ;

CALL DeleteFields(90101040) ;

CALL DeleteFields(90101007) ;

CALL DeleteFields(190110086) ;

CALL DeleteFields(190210085) ;

CALL DeleteFields(190310086) ;

CALL DeleteFields(220110066) ;

CALL DeleteFields(390110001) ;

CALL DeleteFields(390110002) ;

CALL DeleteFields(390110003) ;

CALL DeleteFields(390110004) ;

CALL DeleteFields(390110005) ;

CALL DeleteFields(390110006) ;

CALL DeleteFields(390110007) ;

CALL DeleteFields(390110008) ;

CALL DeleteFields(390110009) ;

CALL DeleteFields(390110010) ;

CALL DeleteFields(390110011) ;

CALL DeleteFields(390110012) ;

CALL DeleteFields(390110013) ;

CALL DeleteFields(390110014) ;

CALL DeleteFields(390111015) ;

CALL DeleteFields(390111016) ;

CALL DeleteFields(390111017) ;

CALL DeleteFields(390111018) ;

CALL DeleteFields(520100027) ;

CALL DeleteFields(520100028) ;

CALL DeleteFields(520100036) ;

CALL DeleteFields(520100040) ;

CALL DeleteFields(520100041) ;

CALL DeleteFields(520100042) ;

CALL DeleteFields(520110027) ;

CALL DeleteFields(520110028) ;

CALL DeleteFields(520110036) ;

CALL DeleteFields(520110040) ;

CALL DeleteFields(520110041) ;

CALL DeleteFields(520110042) ;

CALL DeleteFields(550312005) ;

CALL DeleteFields(550312028) ;

CALL DeleteFields(982710002) ;

CALL DeleteFields(982710003) ;

CALL DeleteFields(982810001) ;

CALL DeleteFields(982810002) ;

CALL DeleteFields(982810003) ;

CALL DeleteFields(982910001) ;

CALL DeleteFields(982910002) ;

CALL DeleteFields(982910003) ;

CALL DeleteFields(990310095) ;

CALL DeleteConst(-1, 26, 3) ;

CALL DeleteFields(991610100) ;

CALL DeleteConst(0, 0, 8) ;

CALL DeleteFields(991610122) ;

CALL DeleteConst(32, 28, 3) ;

CALL DeleteFields(991610211) ;

CALL DeleteConst(32, 26, 3) ;

CALL DeleteFields(991610198) ;

-- Сводные распоряжения на финансирование, Бюджет(1)
CALL ImportField(10111013, 'МероприятиеКлюч', 'FACT', 'Мероприятие', ' ', 1, 101, 1, 1, 'МероприятиеКлюч', 0, 17829) ;

CALL ImportField(10111014, 'НаправлениеКлюч', 'DirectionCLS', 'Направление', ' ', 1, 101, 1, 1, 'НаправлениеКлюч', 0, 17867) ;

CALL ImportField(10111015, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор', ' ', 1, 101, 1, 0, '', 0, 25472) ;

CALL ImportField(10111022, 'Тип(Классификация)', 'FINTYPECode', 'Тип', ' ', 1, 101, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(10111043, 'Документ-основание', 'DOCUMENTBASETYPECODE', 'Документ-основание', ' ', 1, 101, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(10111181, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 101, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(10111182, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 101, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(10111183, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 101, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(10111186, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 101, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(10111187, 'Мероприятие', 'FACTCode', 'Мероприятие', ' ', 1, 101, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(10111188, 'ТипКлюч', 'FINTYPE', 'Тип финансирования', ' ', 1, 101, 1, 0, 'ТипФинансированияКлюч', 0, 17833) ;

CALL ImportField(10111189, 'Документ-основаниеКлюч', 'DOCUMENTBASETYPE', 'Документ-основание', ' ', 1, 101, 1, 1, 'ТипДокОснованияКлюч', 0, 17863) ;

CALL ImportField(10112055, 'НаправлениеКлюч', 'DirectionCLS', 'Направление', ' ', 1, 101, 2, 1, 'НаправлениеКлюч', 0, 17867) ;

CALL ImportField(10112059, 'Тип(Классификация)', 'FINTYPECode', 'Тип', ' ', 1, 101, 2, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(10112061, 'МероприятиеКлюч', 'FACT', 'Мероприятие', ' ', 1, 101, 2, 1, 'МероприятиеКлюч', 0, 17829) ;

CALL ImportField(10112077, 'Документ-основание', 'DOCUMENTBASETYPECODE', 'Документ - основание', ' ', 1, 101, 2, 1, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(10112213, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор', ' ', 1, 101, 2, 0, '', 0, 25472) ;

CALL ImportField(10112214, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 101, 2, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(10112215, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 101, 2, 0, 'КВР', 0, 25467) ;

CALL ImportField(10112216, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 101, 2, 0, 'КВСР', 0, 25472) ;

CALL ImportField(10112217, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 101, 2, 0, 'Направление', 0, 36861) ;

CALL ImportField(10112218, 'Мероприятие', 'FACTCode', 'Мероприятие', ' ', 1, 101, 2, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(10112219, 'ТипКлюч', 'FINTYPE', 'Тип финансирования', ' ', 1, 101, 2, 0, 'ТипФинансированияКлюч', 0, 17833) ;

CALL ImportField(10112220, 'Документ-основаниеКлюч', 'DOCUMENTBASETYPE', 'Документ - основание', ' ', 1, 101, 2, 1, 'ТипДокОснованияКлюч', 0, 17863) ;

CALL ImportField(10113103, 'Администратор(Источники внутреннего и внешнего финансирования)', 'IFSKVSRCode', 'Администратор', ' ', 1, 101, 3, 0, '', 0, 25472) ;

CALL ImportField(10114117, 'НаправлениеКлюч', 'DirectionCLS', 'Направление', ' ', 1, 101, 4, 1, 'НаправлениеКлюч', 0, 17867) ;

CALL ImportField(10114121, 'Тип', 'FINTYPECode', 'Тип', ' ', 1, 101, 4, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(10114122, 'МероприятиеКлюч', 'FACT', 'Мероприятие', ' ', 1, 101, 4, 1, 'МероприятиеКлюч', 0, 17829) ;

CALL ImportField(10114135, 'Документ-основание', 'DOCUMENTBASETYPECODE', 'Документ - основание', ' ', 1, 101, 4, 1, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(10114216, 'КЦСР', 'KCSRCode', 'КЦСР', ' ', 1, 101, 4, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(10114217, 'КВР', 'KVRCode', 'КВР', ' ', 1, 101, 4, 0, 'КВР', 0, 25467) ;

CALL ImportField(10114218, 'КВСР', 'KVSRCode', 'КВСР', ' ', 1, 101, 4, 0, 'КВСР', 0, 25472) ;

CALL ImportField(10114219, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 101, 4, 0, 'Направление', 0, 36861) ;

CALL ImportField(10114220, 'Мероприятие', 'FACTCode', 'Мероприятие', ' ', 1, 101, 4, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(10114221, 'ТипКлюч', 'FINTYPE', 'Тип финансирования', ' ', 1, 101, 4, 0, 'ТипФинансированияКлюч', 0, 17833) ;

CALL ImportField(10114222, 'Документ-основаниеКлюч', 'DOCUMENTBASETYPE', 'Документ - основание', ' ', 1, 101, 4, 1, 'ТипДокОснованияКлюч', 0, 17863) ;

CALL ImportField(10115138, 'Администратор(Код дохода)', 'KDKVSRCode', 'Администратор', ' ', 1, 101, 5, 0, '', 0, 25472) ;

-- Все плановые документы(Расходы), Бюджет(1)
CALL ImportField(20011007, 'Код БА (ключ)', '{РусПоле("КодБюджАссигнованияКлюч")}', 'Код БА (ключ)', ' ', 1, 200, 1, 0, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(20011034, 'Вид ассигнований', '{РусПоле("ВидАссигнований")}', 'Вид ассигнований', ' ', 1, 200, 1, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(20011035, 'Мероприятие', '{РусПоле("Мероприятие")}', 'Мероприятие', ' ', 1, 200, 1, 0, 'Мероприятие', 0, null) ;

CALL ImportField(20011036, 'МероприятиеКлюч', '{РусПоле("МероприятиеКлюч")}', 'Мероприятие (ключ)', ' ', 1, 200, 1, 0, 'Мероприятие', 0, null) ;

-- Роспись по ПБС (расходы), Бюджет(1)
CALL ImportField(20110003, 'Дата НПА', 'DocDat', 'Дата НПА', 'DocDat', 1, 201, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(20110009, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 201, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(20110012, 'Номер НПА', 'DocNumber', 'Номер НПА', 'DocNumber', 1, 201, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(20110015, 'Главный распорядитель (ссылка)', 'OrgRef', 'Главный распорядитель(ссылка)', 'DestOrgRef', 1, 201, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20110023, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 201, 0, 0, '', 0, null) ;

CALL ImportField(20110082, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 201, 0, 0, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(20111011, 'Мероприятие', 'FactCode', 'Мероприятие', 'DestFactCls', 1, 201, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(20111019, 'Получатель (ссылка)', 'Org_Ref', 'Ссылка на орг. получ.', 'Org_Ref_Det', 1, 201, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(20111049, 'Направление', 'DirectionCLSCode', 'Направление', 'DestDirectionCLS', 1, 201, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(20111051, 'Получатель', 'OrgNameAndAcc', 'Получатель', ' ', 1, 201, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(20111057, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFINTYPECls', 1, 201, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(20111083, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 201, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(20111084, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 201, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(20111085, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 201, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(20111086, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 201, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(20111090, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 201, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(20111092, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 201, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(20111093, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 201, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(20111180, 'Получатель субсидии(трансферта)', 'TransfertOrg_CalcName', 'Получатель субсидии(трансферта) (Вычислимое поле)', ' ', 1, 201, 1, 0, '', 1, null) ;

CALL ImportField(20111181, 'Получатель субсидии(ИНН)', 'TransfertOrg_INN', 'Получатель субсидии(ИНН)', ' ', 1, 201, 1, 0, '', 0, 16645) ;

CALL ImportField(20111182, 'Получатель субсидии(КПП)', 'TransfertOrg_INN20', 'Получатель субсидии(КПП)', ' ', 1, 201, 1, 0, '', 0, 16653) ;

CALL ImportField(20111183, 'Направление (Ключ)', 'DirectionCLS', 'Направление', 'DestDirectionCLSKey', 1, 201, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(20111184, 'Мероприятие (Ключ)', 'Fact', 'Мероприятие', 'DestFactClsKey', 1, 201, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(20111185, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEKey', 1, 201, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(20111186, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 201, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(20111187, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 201, 1, 0, 'Объект', 0, null) ;

-- СБР (расходы), Бюджет(1)
CALL ImportField(20210014, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 202, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(20210037, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 202, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(20210039, 'Главный распорядитель (ссылка)', 'OrgRef', 'Главный распорядитель(ссылка)', 'DestOrgRef', 1, 202, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20210069, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 202, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(20210081, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 202, 0, 0, '', 0, null) ;

CALL ImportField(20210090, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 202, 0, 1, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(20211035, 'Мероприятие', 'FACTCODE', 'Мероприятие(Классификация)', 'DestFactCls', 1, 202, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(20211036, 'Направление(Классификация)', 'DirectionCLSCode', 'Направление(Классификация)', 'DestDirectionCLS', 1, 202, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(20211038, 'Главный распорядитель (ссылка)', 'Org_Ref', 'Организация', 'Org_Ref_Det', 1, 202, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(20211072, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFINTYPECls', 1, 202, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(20211091, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 202, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(20211092, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 202, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(20211093, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 202, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(20211094, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 202, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(20211097, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 202, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(20211100, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 202, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(20211101, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 202, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(20211105, 'Направление(Ключ)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 202, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(20211106, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Классификация)', 'DestFactClsKey', 1, 202, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(20211107, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 202, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(20211108, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 202, 1, 0, 'Объект', 0, null) ;

CALL ImportField(20211109, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 202, 1, 1, 'ОбъектКлюч', 0, null) ;

-- Кассовый план (расходы), Бюджет(1)
CALL ImportField(20310014, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 203, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(20310037, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 203, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(20310039, 'Главный распорядитель (ссылка)', 'OrgRef', 'Главный распорядитель', 'DestOrgRef', 1, 203, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20310069, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 203, 0, 0, 'ТипДокОснования', 0, 17473) ;

CALL ImportField(20310072, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 203, 0, 0, '', 0, null) ;

CALL ImportField(20310081, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 203, 0, 1, 'ТипДокОснованияКлюч', 0, 36865) ;

CALL ImportField(20311009, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 203, 1, 1, 'БухОперация', 0, 17451) ;

CALL ImportField(20311035, 'Мероприятие', 'FACTCODE', 'Мероприятие(Классификация)', 'DestFactCls', 1, 203, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(20311036, 'Направление(Классификация)', 'DirectionCLSCode', 'Направление(Классификация)', 'DestDirectionCLS', 1, 203, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(20311038, 'Организация', 'Org_Ref', 'Организация', 'Org_Ref_Det', 1, 203, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(20311071, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFINTYPECls', 1, 203, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(20311082, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 203, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(20311083, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 203, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(20311084, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 203, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(20311085, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 203, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(20311089, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 203, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(20311090, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 203, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(20311092, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 1, 203, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(20311095, 'Направление(Ключ)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 203, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(20311096, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Ключ)', 'DestFactClsKey', 1, 203, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(20311097, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации (Ключ)', 'DestFINTYPEClsKey', 1, 203, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(20311098, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 203, 1, 0, 'Объект', 0, null) ;

CALL ImportField(20311099, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 203, 1, 1, 'ОбъектКлюч', 0, null) ;

-- Сведения БУ, АУ, Бюджет(1)
CALL ImportField(20410002, 'Главный распорядитель', 'OrgName', 'Получатель', ' ', 1, 204, 0, 0, '', 0, 16646) ;

CALL ImportField(20410014, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 204, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(20410037, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 204, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(20410039, 'Организация (ссылка)', 'OrgRef', 'Главный распорядитель', 'DestOrgRef', 1, 204, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20410069, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 204, 0, 0, 'ТипДокОснования', 0, 17473) ;

CALL ImportField(20410080, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 204, 0, 0, '', 0, null) ;

CALL ImportField(20410086, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 204, 0, 1, 'ТипДокОснованияКлюч', 0, 36865) ;

CALL ImportField(20411005, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 204, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(20411035, 'Мероприятие', 'FACTCODE', 'Мероприятие(Классификация)', 'DestFactCls', 1, 204, 1, 0, 'Мероприятие', 0, 17418) ;

CALL ImportField(20411036, 'Направление', 'DirectionCLSCODE', 'Направление(Классификация)', 'DestDirectionCLS', 1, 204, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(20411038, 'Организация (ссылка)', 'Org_Ref', 'Организация (ссылка)', 'Org_Ref_Det', 1, 204, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(20411071, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFINTYPECls', 1, 204, 1, 0, 'ТипФинансирования', 0, 17425) ;

CALL ImportField(20411086, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 204, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(20411094, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', 'IFS_KVSRCode', 1, 204, 1, 0, '', 0, 25472) ;

CALL ImportField(20411095, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 204, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(20411098, 'Администратор доходов(Классификация)', 'KDKVSRCode', 'Администратор доходов(Классификация)', 'KDKVSRCode', 1, 204, 1, 0, '', 0, 25472) ;

CALL ImportField(20411099, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 204, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(20411100, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 204, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(20411105, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 204, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(20411108, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 204, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(20411109, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 204, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(20411110, 'Прежний код субсидии', 'SubsidyClsOldCode', '', ' ', 1, 204, 1, 0, '', 0, 26641) ;

CALL ImportField(20411114, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 204, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(20411115, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Ключ)', 'DestFactClsKey', 1, 204, 1, 1, 'МероприятиеКлюч', 0, 36863) ;

CALL ImportField(20411116, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 204, 1, 1, 'ТипФинансированияКлюч', 0, 36853) ;

CALL ImportField(20411117, 'ИФДБ', 'IFS_FinSourceValue', 'Источники финансирования дефицита бюджета', 'IFS_FinSourceValue', 1, 204, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(20411118, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 204, 1, 0, 'Объект', 0, null) ;

CALL ImportField(20411119, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 204, 1, 1, 'ОбъектКлюч', 0, null) ;

-- Бюджет, Бюджет(1)
CALL ImportField(20510015, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 205, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(20510038, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 205, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(20510067, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 205, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(20510070, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 205, 0, 0, '', 0, null) ;

CALL ImportField(20510089, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 205, 0, 1, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(20511036, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'DestFactCls', 1, 205, 1, 0, 'Мероприятие', 0, 17418) ;

CALL ImportField(20511037, 'Направление', 'DirectionCLSCode', 'Направление', 'DestDirectionCLS', 1, 205, 1, 0, 'Направление', 0, 17450) ;

CALL ImportField(20511069, 'Код доп. информации', 'FINTYPECode', 'Код дополнительной информации', 'DestFINTYPE', 1, 205, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(20511077, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 205, 1, 0, '', 0, 25472) ;

CALL ImportField(20511080, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор(Классификация)', ' ', 1, 205, 1, 0, '', 0, 25472) ;

CALL ImportField(20511087, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 205, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(20511090, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 205, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(20511092, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 205, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(20511093, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 205, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(20511094, 'Тип классификации', 'ClsType', 'Тип класссификации', 'ClsType', 1, 205, 1, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(20511096, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 205, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(20511097, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 205, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(20511101, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEKey', 1, 205, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(20511102, 'Направление (Ключ)', 'DirectionCLS', 'Направление (Ключ)', 'DestDirectionCLSKey', 1, 205, 1, 1, 'НаправлениеКлюч', 0, 36861) ;

CALL ImportField(20511103, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', 'DestFactClsKey', 1, 205, 1, 1, 'МероприятиеКлюч', 0, 36863) ;

CALL ImportField(20511104, 'ИФДБ', 'IFS_FinSourceValue', 'Источники финансирования дефицита бюджета', 'IFS_FinSourceValue', 1, 205, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(20511105, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 205, 1, 0, 'Объект', 0, null) ;

CALL ImportField(20511106, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 205, 1, 1, 'ОбъектКлюч', 0, null) ;

-- ПОФ по ПБС (расходы), Бюджет(1)
CALL ImportField(20610015, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 206, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(20610038, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 206, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(20610070, 'Код НПА', 'DocBaseCODE', 'Код НПА', 'DocBase', 1, 206, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(20610080, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 206, 0, 0, '', 0, null) ;

CALL ImportField(20610082, 'Период', 'KPPERIOD', 'Период', 'KPPeriod', 1, 206, 0, 0, 'ПериодКП', 0, 24700) ;

CALL ImportField(20610089, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 206, 0, 1, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(20611036, 'Мероприятие', 'FACTCODE', 'Мероприятие(Классификация)', 'DestFactCls', 1, 206, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(20611037, 'Направление', 'DirectionCLSCODE', 'Направление(Классификация)', 'DestDirectionCLS', 1, 206, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(20611039, 'Организация', 'Org_Ref', 'Организация', 'Org_Ref_Det', 1, 206, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(20611073, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFINTYPECls', 1, 206, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(20611090, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 206, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(20611091, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 206, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(20611092, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 206, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(20611093, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 206, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(20611097, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 206, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(20611099, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 206, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(20611100, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 206, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(20611180, 'Получатель субсидии(трансферта)', 'TransfertOrg_CalcName', 'Получатель субсидии(трансферта) (Вычислимое поле)', ' ', 1, 206, 1, 0, '', 1, null) ;

CALL ImportField(20611181, 'Получатель субсидии(ИНН)', 'TransfertOrg_INN', 'Получатель субсидии(ИНН)', ' ', 1, 206, 1, 0, '', 0, 16645) ;

CALL ImportField(20611182, 'Получатель субсидии(КПП)', 'TransfertOrg_INN20', 'Получатель субсидии(КПП)', ' ', 1, 206, 1, 0, '', 0, 16653) ;

CALL ImportField(20611183, 'НаправлениеКлюч', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 206, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(20611184, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Ключ)', 'DestFactClsKey', 1, 206, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(20611185, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 206, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(20611186, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 206, 1, 0, 'Объект', 0, null) ;

CALL ImportField(20611187, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 206, 1, 1, 'ОбъектКлюч', 0, null) ;

-- Помесячный кассовый план, Бюджет(1)
CALL ImportField(20710015, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 207, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(20710038, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 207, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(20710070, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 207, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(20710074, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 207, 0, 0, '', 0, null) ;

CALL ImportField(20710158, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 207, 0, 0, 'ТипКлассификации', 0, 24698) ;

CALL ImportField(20710160, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 207, 0, 1, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(20711005, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 207, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(20711036, 'Мероприятие', 'FACTCODE', 'Мероприятие(Классификация)', 'DestFactCls', 1, 207, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(20711037, 'Направление', 'DirectionCLSCODE', 'Направление(Классификация)', 'DestDirectionCLS', 1, 207, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(20711039, 'Организация', 'Org_Ref', 'Организация', 'Org_Ref_Det', 1, 207, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(20711073, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFINTYPECls', 1, 207, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(20711081, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', 'IFS_KVSRCode', 1, 207, 1, 0, '', 0, 25472) ;

CALL ImportField(20711161, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 207, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(20711163, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 207, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(20711164, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 207, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(20711165, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 207, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(20711169, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор(Классификация)', 'KDKVSRCode', 1, 207, 1, 0, '', 0, 25472) ;

CALL ImportField(20711176, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 207, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(20711177, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 207, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(20711179, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 1, 207, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(20711182, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 207, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(20711183, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Классификация)', 'DestFactClsKey', 1, 207, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(20711184, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 207, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(20711185, 'ИФДБ', 'IFS_FinSourceValue', 'Источники финансирования дефицита бюджета', 'IFS_FinSourceValue', 1, 207, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(20711186, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 207, 1, 0, 'Объект', 0, null) ;

CALL ImportField(20711187, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 207, 1, 1, 'ОбъектКлюч', 0, null) ;

-- Помесячные ПОФ по ПБС, Бюджет(1)
CALL ImportField(20810015, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 208, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(20810038, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 208, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(20810070, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 208, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(20810074, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 208, 0, 0, '', 0, null) ;

CALL ImportField(20810076, 'Период', 'KPPERIOD', 'период ', 'KPPERIOD', 1, 208, 0, 0, 'ПериодКП', 0, 24700) ;

CALL ImportField(20810160, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 208, 0, 1, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(20811005, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 208, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(20811036, 'Мероприятие', 'FACTCODE', 'Мероприятие(Классификация)', 'DestFactCls', 1, 208, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(20811037, 'Направление', 'DirectionCLSCode', 'Направление(Классификация)', 'DestDirectionCLS', 1, 208, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(20811039, 'Организация', 'Org_Ref', 'Организация', 'Org_Ref_Det', 1, 208, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(20811073, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFINTYPECls', 1, 208, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(20811164, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 208, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(20811166, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 208, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(20811167, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 208, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(20811168, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 208, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(20811171, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 208, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(20811174, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 208, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(20811175, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 208, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(20811180, 'Получатель субсидии(трансферта)', 'TransfertOrg_CalcName', 'Получатель субсидии(трансферта) (Вычислимое поле)', ' ', 1, 208, 1, 0, '', 1, null) ;

CALL ImportField(20811181, 'Получатель субсидии(ИНН)', 'TransfertOrg_INN', 'Получатель субсидии(ИНН)', ' ', 1, 208, 1, 0, '', 0, 16645) ;

CALL ImportField(20811182, 'Получатель субсидии(КПП)', 'TransfertOrg_INN20', 'Получатель субсидии(КПП)', ' ', 1, 208, 1, 0, '', 0, 16653) ;

CALL ImportField(20811183, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 208, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(20811184, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 208, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(20811185, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Классификация)', 'DestFactClsKey', 1, 208, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(20811186, 'ИФДБ', 'IFS_FinSourceValue', 'Источники финансирования дефицита бюджета', 'IFS_FinSourceValue', 1, 208, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(20811187, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 208, 1, 0, 'Объект', 0, null) ;

CALL ImportField(20811188, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 208, 1, 1, 'ОбъектКлюч', 0, null) ;

-- Подневный ПОФ, Бюджет(1)
CALL ImportField(20910007, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 209, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(20910008, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 209, 0, 0, '', 0, null) ;

CALL ImportField(20910009, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 209, 0, 0, 'ДатаДокОснования', 0, null) ;

CALL ImportField(20910010, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 209, 0, 0, 'НомерДокОснования', 0, null) ;

CALL ImportField(20910020, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 1, 209, 0, 0, '', 0, null) ;

CALL ImportField(20910027, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 209, 0, 1, 'ТипДокОснованияКлюч', 0, null) ;

CALL ImportField(20911001, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 209, 1, 1, 'ВидАссигнований', 0, null) ;

CALL ImportField(20911004, 'Дата', 'DayPlan', 'Дата', 'DayPlan', 1, 209, 1, 0, 'ДеньКП', 0, null) ;

CALL ImportField(20911006, 'Направление(Классификация)', 'DirectionCLSCode', 'Направление(Классификация)', 'DestDirectionCLS', 1, 209, 1, 1, 'Направление', 0, 36861) ;

CALL ImportField(20911007, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 209, 1, 1, 'ЛицевойСчет', 0, 17419) ;

CALL ImportField(20911008, 'л/с ФК', 'FACIALCODE', 'л/с ФК', ' ', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911009, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'DestFactCls', 1, 209, 1, 1, 'Мероприятие', 0, 36863) ;

CALL ImportField(20911010, 'Код доп. информации', 'FINTYPECode', 'Код дополнительной информации', 'DestFinTypeCls', 1, 209, 1, 1, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(20911011, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', 'IFS_DescriptionCode', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911012, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', 'IFS_KESR', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911013, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', 'IFS_KVSRCode', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911014, 'ИНН(Организация)', 'INN', 'ИНН(Организация)', 'DestFacialAccClsOrgINN', 1, 209, 1, 1, 'ИННОрганизацииДеталь', 0, null) ;

CALL ImportField(20911015, 'КПП(Организация)', 'INN20', 'КПП(Организация)', 'DestFacialAccClsOrgKPP', 1, 209, 1, 1, 'КППОрганизацииДеталь', 0, null) ;

CALL ImportField(20911016, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 209, 1, 1, 'КЦСР', 0, null) ;

CALL ImportField(20911017, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 209, 1, 1, 'КЭСР', 0, 17415) ;

CALL ImportField(20911018, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 209, 1, 1, 'КФСР', 0, 17411) ;

CALL ImportField(20911019, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 209, 1, 1, 'КВР', 0, null) ;

CALL ImportField(20911020, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 209, 1, 1, 'КВСР', 0, null) ;

CALL ImportField(20911021, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 209, 1, 1, 'ТипСредств', 0, 17426) ;

CALL ImportField(20911022, 'Наименование(Организация)', 'NAME', 'Наименование(Организация)', 'DestFacialAccClsOrgName', 1, 209, 1, 1, 'НаименованиеОрганизацииДеталь', 0, null) ;

CALL ImportField(20911023, 'Примечание', 'NOTE', 'Примечание', 'Note', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911024, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 209, 1, 1, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(20911025, 'Район трансферта', 'REGIONCLS', 'Район трансферта', 'RegionCLS', 1, 209, 1, 1, 'Регион,РайонТрансферта,РайонКонтрагента', 0, null) ;

CALL ImportField(20911026, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911027, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', 'DestSubkesr', 1, 209, 1, 1, 'СубКЭСР', 0, 17416) ;

CALL ImportField(20911028, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911031, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 209, 1, 1, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(20911032, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 209, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(20911041, 'Код записи', 'ID', 'Код записи', 'Id', 1, 209, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(20911134, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 209, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(20911135, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 209, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(20911136, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Ключ)', 'DestFactClsKey', 1, 209, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(20911137, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 209, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(20911138, 'Код бюджетного ассигнования', 'BudAllocationClsCode', 'Код бюджетного ассигнования', 'BudAllocationClsCode', 1, 209, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(20911139, 'Код бюджетного ассигнования Ключ', 'BudAllocationCls', 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', 1, 209, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(20911140, 'Код расходного обязательства', 'PayPromiseClsCode', 'Код расходного обязательства', 'PayPromiseClsCode', 1, 209, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(20911141, 'Код расходного обязательства Ключ', 'PayPromiseCls', 'Код расходного обязательства (ключ)', 'PayParomiseCls', 1, 209, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

CALL ImportField(20911142, 'ИФДБ', 'IFS_FinSourceValue', 'Источники финансирования дефицита бюджета', 'IFS_FinSourceValue', 1, 209, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(20911143, 'ИФДБ Ключ', 'IFS', 'Источники финансирования дефицита бюджета (ключ)', 'IFS', 1, 209, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(20912001, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', ' ', 1, 209, 2, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(20912006, 'Направление(Классификация)', 'DirectionCLSCode', 'Направление(Классификация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912007, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912008, 'л/с ФК', 'FACIALCODE', 'л/с ФК', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912009, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912010, 'Код доп. информации', 'FINTYPECode', 'Код дополнительной информации', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912011, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912012, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912013, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912014, 'ИНН(Организация)', 'INN', 'ИНН(Организация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912015, 'КПП(Организация)', 'INN20', 'КПП(Организация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912016, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912017, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912018, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912019, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912020, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912021, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912022, 'Наименование(Организация)', 'NAME', 'Наименование(Организация)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912023, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912024, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912025, 'Район трансферта', 'REGIONCLS', 'Район трансферта', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912026, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912027, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912028, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912031, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912032, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912035, 'Код целевых средств (ключ)', 'TransfertCls', 'Код целевых средств (ключ)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912036, 'Код субсидии (ключ)', 'SubsidyCls', 'Код субсидии (ключ)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912037, 'КЦСРКлюч', 'KCSR', 'КЦСР (ключ)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912038, 'КВРКлюч', 'KVR', 'КВР (ключ)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912039, 'КВСРКлюч', 'KVSR', 'КВСР (ключ)', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912040, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912041, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Ключ)', ' ', 1, 209, 2, 1, '', 0, null) ;

CALL ImportField(20912042, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', ' ', 1, 209, 2, 1, '', 0, null) ;

CALL ImportField(20912043, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', ' ', 1, 209, 2, 1, '', 0, null) ;

CALL ImportField(20912044, 'Код БА (ключ)', 'BudAllocationCls', 'Код бюджетного ассигнования (ключ)', ' ', 1, 209, 2, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

-- Внутренние РР, Бюджет(1)
CALL ImportField(21010010, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 210, 0, 1, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(21010011, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 210, 0, 1, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(21010012, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 210, 0, 1, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(21010022, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 210, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(21010027, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 210, 0, 1, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(21011005, 'Направление(Классификация)', 'DirectionCLSCode', 'Направление(Классификация)', 'DestDirectionCLS', 1, 210, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(21011008, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'DestFactCls', 1, 210, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(21011009, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFinTypeCls', 1, 210, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(21011014, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 210, 1, 0, '', 0, 25472) ;

CALL ImportField(21011016, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 210, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(21011021, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 210, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(21011023, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 210, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(21011036, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 210, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(21011037, 'Источники финансирования дефицита', 'IFS_FinSourceValue', '', 'IFS_FinSourceValue', 1, 210, 1, 1, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(21011038, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 210, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(21011041, 'Код бюджетного ассингования', 'BudAllocationClsCode', '', ' ', 1, 210, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(21011043, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 1, 210, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(21011044, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 210, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(21011045, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Ключ)', 'DestFactClsKey', 1, 210, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(21011046, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 210, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(21012006, 'Направление(Классификация)', 'DirectionCLSCode', 'Направление(Классификация)', 'DestDirectionCLS', 1, 210, 2, 0, 'Направление', 0, 36861) ;

CALL ImportField(21012009, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'DestFactCls', 1, 210, 2, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(21012010, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFinTypeCls', 1, 210, 2, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(21012014, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 210, 2, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(21012019, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 210, 2, 0, 'КВР', 0, 25467) ;

CALL ImportField(21012021, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 210, 2, 0, 'КВСР', 0, 25472) ;

CALL ImportField(21012046, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 210, 2, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(21012050, 'Администратор(Классификация)', 'IFS_KVSRCode', '', ' ', 1, 210, 2, 0, '', 0, 25472) ;

CALL ImportField(21012051, 'Источники финансирования дефицита', 'IFS_FinSourceValue', '', 'IFS_FinSourceValue', 1, 210, 2, 1, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(21012052, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 210, 2, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(21012055, 'Код бюджетного ассингования', 'BudAllocationClsCode', '', ' ', 1, 210, 2, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(21012057, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 1, 210, 2, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(21012058, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Ключ)', ' ', 1, 210, 2, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(21012059, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 210, 2, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(21012060, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 210, 2, 1, 'ТипФинансированияКлюч', 0, 17425) ;

-- Подневный КП, Бюджет(1)
CALL ImportField(21110001, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 211, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(21110002, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 211, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(21110003, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 211, 0, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(21110004, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 211, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(21110005, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 211, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(21110006, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 211, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(21110007, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 211, 0, 0, 'ДатаДокОснования', 0, null) ;

CALL ImportField(21110008, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 211, 0, 0, 'НомерДокОснования', 0, null) ;

CALL ImportField(21110009, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 211, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(21110010, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 211, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(21110011, 'Код документа', 'ID', 'Код документа', 'ID', 1, 211, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(21110012, 'Период', 'KPPERIOD', 'Период', 'KPPeriod', 1, 211, 0, 0, 'ПериодКП', 0, null) ;

CALL ImportField(21110013, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'note', 1, 211, 0, 0, 'Основание', 0, null) ;

CALL ImportField(21110014, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'note1 ', 1, 211, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(21110015, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'note2 ', 1, 211, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(21110016, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 211, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(21110017, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 211, 0, 0, '', 0, null) ;

CALL ImportField(21110018, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 1, 211, 0, 0, '', 0, null) ;

CALL ImportField(21110019, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 211, 0, 1, 'ОрганизацияЗаголовок', 0, null) ;

CALL ImportField(21110020, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 211, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(21110021, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 211, 0, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(21110022, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 211, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(21110023, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 211, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(21110024, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 211, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(21110025, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 211, 0, 0, 'ТипДокОснования', 0, null) ;

CALL ImportField(21110026, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 211, 0, 0, '', 0, null) ;

CALL ImportField(21110027, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 211, 0, 1, 'ТипДокОснованияКлюч', 0, null) ;

CALL ImportField(21111001, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 211, 1, 1, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(21111002, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 211, 1, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(21111003, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 211, 1, 1, 'ВидАссигнований', 0, null) ;

CALL ImportField(21111004, 'Дата создания(Авторизация)', 'CreateDate', 'Дата создания(Авторизация)', 'CreateDate_Det', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111005, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111006, 'Дата', 'DayPlan', 'Дата', 'DayPlan', 1, 211, 1, 0, 'ДеньКП', 0, null) ;

CALL ImportField(21111007, 'Сумма', 'DAYPLANSUMMA', 'Сумма', 'DayPlanSumma', 1, 211, 1, 0, '', 0, null) ;

CALL ImportField(21111008, 'Направление(Классификация)', 'DirectionCLSCODE', 'Направление(Классификация)', 'DestDirectionCLS', 1, 211, 1, 1, 'Направление', 0, 36861) ;

CALL ImportField(21111009, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111010, 'л/с ФК', 'FACIALCODE', 'л/с ФК', ' ', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111011, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'DestFactCls', 1, 211, 1, 1, 'Мероприятие', 0, 36863) ;

CALL ImportField(21111012, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFinTypeCls', 1, 211, 1, 1, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(21111013, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', 'IFS_DescriptionCode', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111014, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', 'IFS_KESR', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111015, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', 'IFS_KVSRCode', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111016, 'ИНН(Организация)', 'INN', 'ИНН(Организация)', 'DestFacialAccClsOrgINN', 1, 211, 1, 1, 'ИННОрганизацииДеталь', 0, null) ;

CALL ImportField(21111017, 'КПП(Организация)', 'INN20', 'КПП(Организация)', 'DestFacialAccClsOrgKPP', 1, 211, 1, 1, 'КППОрганизацииДеталь', 0, null) ;

CALL ImportField(21111018, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 211, 1, 1, 'КЦСР', 0, null) ;

CALL ImportField(21111019, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111020, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111021, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 211, 1, 1, 'КВР', 0, null) ;

CALL ImportField(21111022, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 211, 1, 1, 'КВСР', 0, null) ;

CALL ImportField(21111023, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111024, 'Наименование(Организация)', 'NAME', 'Наименование(Организация)', 'DestFacialAccClsOrgName', 1, 211, 1, 1, 'НаименованиеОрганизацииДеталь', 0, null) ;

CALL ImportField(21111025, 'Примечание', 'NOTE', 'Примечание', 'Note', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111026, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 211, 1, 1, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(21111027, 'Район трансферта', 'REGIONCLS', 'Район трансферта', 'RegionCLS', 1, 211, 1, 1, 'Регион,РайонТрансферта,РайонКонтрагента', 0, null) ;

CALL ImportField(21111028, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111029, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', 'DestSubkesr', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111030, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111031, 'Дата изменения(Авторизация)', 'UpdateDate', 'Дата изменения(Авторизация)', 'UpdateDate_Det', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111032, 'Изменил(Авторизация)', 'UpdaterUser', 'Изменил(Авторизация)', 'UpdaterUser_det', 1, 211, 1, 1, '', 0, null) ;

CALL ImportField(21111033, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 211, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(21111034, 'Код записи', 'ID', 'Код записи', 'Id', 1, 211, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(21111035, 'КД', 'KD', 'КД', 'KD', 1, 211, 1, 1, 'КДКлюч', 0, 25270) ;

CALL ImportField(21111036, 'ЭКД(Классификация)', 'KDKESR', 'ЭКД(Классификация)', 'KDKESR', 1, 211, 1, 0, '', 0, 16835) ;

CALL ImportField(21111037, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор(Классификация)', 'KDKVSRCode', 1, 211, 1, 0, '', 0, 25472) ;

CALL ImportField(21111038, 'Код дохода', 'KDValue', 'Код дохода', 'KDValue', 1, 211, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(21111039, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 211, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(21111040, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Ключ)', 'DestFactClsKey', 1, 211, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(21111041, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 211, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(21111042, 'Код бюджетного ассигнования', 'BudAllocationClsCode', 'Код бюджетного ассигнования', 'BudAllocationClsCode', 1, 211, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(21111043, 'Код бюджетного ассигнования Ключ', 'BudAllocationCls', 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', 1, 211, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(21111044, 'Код расходного обязательства', 'PayPromiseClsCode', 'Код расходного обязательства', 'PayPromiseClsCode', 1, 211, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(21111045, 'Код расходного обязательства Ключ', 'PayPromiseCls', 'Код расходного обязательства (ключ)', 'PayParomiseCls', 1, 211, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

CALL ImportField(21111046, 'ИФДБ', 'IFS_FinSourceValue', 'Источники финансирования дефицита бюджета', 'IFS_FinSourceValue', 1, 211, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(21111047, 'ИФДБ Ключ', 'IFS', 'Источники финансирования дефицита бюджета (ключ)', 'IFS', 1, 211, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(21112001, 'Число записей детали', 'RecordCount', 'Число записей детали', ' ', 1, 211, 2, 1, '', 0, null) ;

CALL ImportField(21112002, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112003, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112004, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', ' ', 1, 211, 2, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(21112005, 'Направление(Классификация)', 'DirectionCLSCODE', 'Направление(Классификация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112006, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112007, 'л/с ФК', 'FACIALCODE', 'л/с ФК', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112008, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112009, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112010, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112011, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112012, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112013, 'ИНН(Организация)', 'INN', 'ИНН(Организация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112014, 'КПП(Организация)', 'INN20', 'КПП(Организация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112015, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112016, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112017, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112018, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112019, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112020, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112021, 'Наименование(Организация)', 'NAME', 'Наименование(Организация)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112022, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112023, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112024, 'Район трансферта', 'REGIONCLS', 'Район трансферта', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112025, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112026, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112027, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112028, 'Код целевых средств (ключ)', 'TransfertCls', 'Код целевых средств (ключ)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112029, 'Код субсидии (ключ)', 'SubsidyCls', 'Код субсидии (ключ)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112030, 'КВРКлюч', 'KVR', 'КВР (ключ)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112031, 'КВСРКлюч', 'KVSR', 'КВСР (ключ)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112032, 'КЦСРКлюч', 'KCSR', 'КЦСР (ключ)', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112033, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', ' ', 1, 211, 2, 0, '', 0, null) ;

CALL ImportField(21112034, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Ключ)', ' ', 1, 211, 2, 1, '', 0, null) ;

CALL ImportField(21112035, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', ' ', 1, 211, 2, 1, '', 0, null) ;

CALL ImportField(21112036, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', ' ', 1, 211, 2, 1, '', 0, null) ;

CALL ImportField(21112037, 'Код БА (ключ)', 'BudAllocationCls', 'Код бюджетного ассигнования (ключ)', ' ', 1, 211, 2, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

-- Подневные сведения БУ, АУ, Бюджет(1)
CALL ImportField(21210001, 'Вид изменений', 'ASSIGNMENTSOURCE', 'Вид изменений', 'ASSIGNMENTSOURCE', 1, 212, 0, 0, 'ВидИзменений', 0, null) ;

CALL ImportField(21210002, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 212, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(21210003, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 212, 0, 1, 'ТипКлассификации', 0, null) ;

CALL ImportField(21210004, 'Статус ЭЦП', 'CryptoStatus', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 212, 0, 1, 'КриптоСтатус', 0, null) ;

CALL ImportField(21210005, 'Дата принятия', 'DAT', 'Дата принятия', 'Dat', 1, 212, 0, 0, 'ДатаПринятия', 0, null) ;

CALL ImportField(21210006, 'Дата ввода', 'DateInput', 'Дата ввода', 'DateInput', 1, 212, 0, 0, 'ДатаДокумента', 0, null) ;

CALL ImportField(21210007, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 212, 0, 0, 'ДатаДокОснования', 0, null) ;

CALL ImportField(21210008, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 212, 0, 0, 'НомерДокОснования', 0, null) ;

CALL ImportField(21210009, 'СостояниеДокумента', 'DocStateRef', 'СостояниеДокумента', 'DocStateRef', 1, 212, 0, 1, 'СостояниеДокумента', 0, null) ;

CALL ImportField(21210010, 'Л\С владельца документа', 'FacialAccCls', 'Л\С владельца документа', 'FacialAccCls', 1, 212, 0, 0, 'ЛицевойСчетЗаголовок', 0, null) ;

CALL ImportField(21210011, 'Код документа', 'ID', 'Код документа', 'ID', 1, 212, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(21210012, 'Период', 'KPPERIOD', 'Период', 'KPPeriod', 1, 212, 0, 0, 'ПериодКП', 0, null) ;

CALL ImportField(21210013, 'Основание(Основание)', 'NOTE', 'Основание(Основание)', 'note', 1, 212, 0, 0, 'Основание', 0, null) ;

CALL ImportField(21210014, 'Дополнительная информация', 'NOTE1', 'Дополнительная информация', 'note1 ', 1, 212, 0, 0, 'ПримечаниеДокумент', 0, null) ;

CALL ImportField(21210015, 'По вопросу(Основание)', 'NOTE2', 'По вопросу(Основание)', 'note2 ', 1, 212, 0, 0, 'ПоВопросу', 0, null) ;

CALL ImportField(21210016, 'Источник', 'NOTIFYTYPE', 'Источник', 'NotifyType', 1, 212, 0, 0, 'ИсточникФинансирования', 0, null) ;

CALL ImportField(21210017, 'Номер', 'NUMBER', 'Номер', 'Number', 1, 212, 0, 0, '', 0, null) ;

CALL ImportField(21210018, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 1, 212, 0, 0, '', 0, null) ;

CALL ImportField(21210019, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 212, 0, 1, 'ОрганизацияЗаголовок', 0, null) ;

CALL ImportField(21210020, 'Вид плана', 'PlanDocType', 'Вид плана', 'PlanDocType', 1, 212, 0, 0, 'ВидПлана', 0, null) ;

CALL ImportField(21210021, 'Индексы данных', 'ProgIndex', 'Индексы данных', 'ProgIndex', 1, 212, 0, 1, 'ИндексыДанных', 0, null) ;

CALL ImportField(21210022, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий)', 'RejectCause', 1, 212, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(21210023, 'Код причины отклонения', 'REJECTCLS', 'Код причины отклонения', 'RejectCls', 1, 212, 0, 0, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(21210024, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 212, 0, 0, 'ВариантРосписи', 0, null) ;

CALL ImportField(21210025, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 212, 0, 0, 'ТипДокОснования', 0, null) ;

CALL ImportField(21210026, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 212, 0, 0, '', 0, null) ;

CALL ImportField(21210027, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 212, 0, 1, 'ТипДокОснованияКлюч', 0, null) ;

CALL ImportField(21211001, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 212, 1, 1, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(21211002, 'Тип классификации', 'ClsType', 'Тип классификации', 'ClsType', 1, 212, 1, 0, 'ТипКлассификации', 0, null) ;

CALL ImportField(21211003, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', 'ASSIGNMENTKIND', 1, 212, 1, 1, 'ВидАссигнований', 0, null) ;

CALL ImportField(21211004, 'Дата создания(Авторизация)', 'CreateDate', 'Дата создания(Авторизация)', 'CreateDate_Det', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211005, 'Автор(Авторизация)', 'CREATERUSER', 'Автор(Авторизация)', 'CREATERUSER_DET', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211006, 'Дата', 'DayPlan', 'Дата', 'DayPlan', 1, 212, 1, 0, 'ДеньКП', 0, null) ;

CALL ImportField(21211007, 'Сумма', 'DAYPLANSUMMA', 'Сумма', 'DayPlanSumma', 1, 212, 1, 0, '', 0, null) ;

CALL ImportField(21211008, 'Направление(Классификация)', 'DirectionCLSCODE', 'Направление(Классификация)', 'DestDirectionCLS', 1, 212, 1, 1, 'Направление', 0, 36861) ;

CALL ImportField(21211009, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211010, 'л/с ФК', 'FACIALCODE', 'л/с ФК', ' ', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211011, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'DestFactCls', 1, 212, 1, 1, 'Мероприятие', 0, 36863) ;

CALL ImportField(21211012, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFinTypeCls', 1, 212, 1, 1, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(21211013, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', 'IFS_DescriptionCode', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211014, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', 'IFS_KESR', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211015, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', 'IFS_KVSRCode', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211016, 'ИНН(Организация)', 'INN', 'ИНН(Организация)', 'DestFacialAccClsOrgINN', 1, 212, 1, 1, 'ИННОрганизацииДеталь', 0, null) ;

CALL ImportField(21211017, 'КПП(Организация)', 'INN20', 'КПП(Организация)', 'DestFacialAccClsOrgKPP', 1, 212, 1, 1, 'КППОрганизацииДеталь', 0, null) ;

CALL ImportField(21211018, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'DestKcsr', 1, 212, 1, 1, 'КЦСР', 0, null) ;

CALL ImportField(21211019, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', 'DestKesr', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211020, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211021, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'DestKvr', 1, 212, 1, 1, 'КВР', 0, null) ;

CALL ImportField(21211022, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'DestKvsr', 1, 212, 1, 1, 'КВСР', 0, null) ;

CALL ImportField(21211023, 'Тип средств', 'MeansType', 'Тип средств', 'DestMeansTypeCls', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211024, 'Наименование(Организация)', 'NAME', 'Наименование(Организация)', 'DestFacialAccClsOrgName', 1, 212, 1, 1, 'НаименованиеОрганизацииДеталь', 0, null) ;

CALL ImportField(21211025, 'Примечание', 'NOTE', 'Примечание', 'Note', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211026, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 212, 1, 1, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(21211027, 'Район трансферта', 'REGIONCLS', 'Район трансферта', 'RegionCLS', 1, 212, 1, 1, 'Регион,РайонТрансферта,РайонКонтрагента', 0, null) ;

CALL ImportField(21211028, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211029, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', 'DestSubkesr', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211030, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211031, 'Дата изменения(Авторизация)', 'UpdateDate', 'Дата изменения(Авторизация)', 'UpdateDate_Det', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211032, 'Изменил(Авторизация)', 'UpdaterUser', 'Изменил(Авторизация)', 'UpdaterUser_det', 1, 212, 1, 1, '', 0, null) ;

CALL ImportField(21211033, 'Код документа', 'RECORDINDEX', 'Код документа', 'RecordIndex', 1, 212, 1, 1, 'КодДокумента', 0, 17433) ;

CALL ImportField(21211034, 'Код записи', 'ID', 'Код записи', 'Id', 1, 212, 1, 1, 'КодЗаписи', 0, 17409) ;

CALL ImportField(21211035, 'КД', 'KD', 'КД', 'KD', 1, 212, 1, 1, 'КДКлюч', 0, 25270) ;

CALL ImportField(21211036, 'ЭКД(Классификация)', 'KDKESR', 'ЭКД(Классификация)', 'KDKESR', 1, 212, 1, 0, '', 0, 16835) ;

CALL ImportField(21211037, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор(Классификация)', 'KDKVSRCode', 1, 212, 1, 0, '', 0, 25472) ;

CALL ImportField(21211038, 'Код дохода', 'KDValue', 'Код дохода', 'KDValue', 1, 212, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(21211039, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 212, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(21211040, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Ключ)', 'DestFactClsKey', 1, 212, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(21211041, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 212, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(21211042, 'Организация (ссылка)', 'Org_Ref', 'Организация (ссылка)', 'Org_Ref_Det', 1, 212, 1, 1, 'ОрганизацияДеталь', 0, null) ;

CALL ImportField(21211043, 'Код бюджетного ассигнования', 'BudAllocationClsCode', 'Код бюджетного ассигнования', 'BudAllocationClsCode', 1, 212, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(21211044, 'Код бюджетного ассигнования Ключ', 'BudAllocationCls', 'Код бюджетного ассигнования (ключ)', 'BudAllocationCls', 1, 212, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

CALL ImportField(21211045, 'Код расходного обязательства', 'PayPromiseClsCode', 'Код расходного обязательства', 'PayPromiseClsCode', 1, 212, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(21211046, 'Код расходного обязательства Ключ', 'PayPromiseCls', 'Код расходного обязательства (ключ)', 'PayParomiseCls', 1, 212, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27835) ;

CALL ImportField(21211047, 'ИФДБ', 'IFS_FinSourceValue', 'Источники финансирования дефицита бюджета', 'IFS_FinSourceValue', 1, 212, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(21211048, 'ИФДБ Ключ', 'IFS', 'Источники финансирования дефицита бюджета (ключ)', 'IFS', 1, 212, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 17452) ;

CALL ImportField(21212001, 'Число записей детали', 'RecordCount', 'Число записей детали', ' ', 1, 212, 2, 1, '', 0, null) ;

CALL ImportField(21212002, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212003, 'Тип классификации', 'ClsType', 'Тип классификации', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212004, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', ' ', 1, 212, 2, 0, 'ВидАссигнований', 0, null) ;

CALL ImportField(21212005, 'Направление(Классификация)', 'DirectionCLSCODE', 'Направление(Классификация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212006, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212007, 'л/с ФК', 'FACIALCODE', 'л/с ФК', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212008, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212009, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212010, 'Вид источника(Классификация)', 'IFS_DescriptionCode', 'Вид источника(Классификация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212011, 'ЭКИ(Классификация)', 'IFS_KESR', 'ЭКИ(Классификация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212012, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212013, 'ИНН(Организация)', 'INN', 'ИНН(Организация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212014, 'КПП(Организация)', 'INN20', 'КПП(Организация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212015, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212016, 'ЭКР(Классификация)', 'KESR', 'ЭКР(Классификация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212017, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212018, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212019, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212020, 'Тип средств', 'MeansType', 'Тип средств', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212021, 'Наименование(Организация)', 'NAME', 'Наименование(Организация)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212022, 'Примечание', 'NOTE', 'Примечание', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212023, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212024, 'Район трансферта', 'REGIONCLS', 'Район трансферта', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212025, 'Наименование района трансферта', 'RegionCls_name', 'Наименование района трансферта', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212026, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212027, 'Классификация', 'TreeOwner0', 'Классификация', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212028, 'Код целевых средств (ключ)', 'TransfertCls', 'Код целевых средств (ключ)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212029, 'Код субсидии (ключ)', 'SubsidyCls', 'Код субсидии (ключ)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212030, 'КВРКлюч', 'KVR', 'КВР (ключ)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212031, 'КВСРКлюч', 'KVSR', 'КВСР (ключ)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212032, 'КЦСРКлюч', 'KCSR', 'КЦСР (ключ)', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212033, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', ' ', 1, 212, 2, 0, '', 0, null) ;

CALL ImportField(21212034, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Ключ)', ' ', 1, 212, 2, 1, '', 0, null) ;

CALL ImportField(21212035, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', ' ', 1, 212, 2, 1, '', 0, null) ;

CALL ImportField(21212036, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', ' ', 1, 212, 2, 1, '', 0, null) ;

CALL ImportField(21212037, 'Организация (ссылка)', 'Org_Ref', 'Организация (ссылка)', ' ', 1, 212, 2, 1, '', 0, null) ;

CALL ImportField(21212038, 'Код БА (ключ)', 'BudAllocationCls', 'Код бюджетного ассигнования (ключ)', ' ', 1, 212, 2, 1, 'КодБюджАссигнованияКлюч', 0, 27834) ;

-- Все казначейские документы, Бюджет(1)
CALL ImportField(30010022, 'Код документа', '{РусПоле("КодДокумента")}', 'Код документа', ' ', 1, 300, 0, 1, 'КодДокумента', 0, null) ;

CALL ImportField(30011043, 'Мероприятие', '{РусПоле("Мероприятие")}', 'Мероприятие', ' ', 1, 300, 1, 0, 'Мероприятие', 0, null) ;

CALL ImportField(30011044, 'МероприятиеКлюч', '{РусПоле("МероприятиеКлюч")}', 'Мероприятие (ключ)', ' ', 1, 300, 1, 0, 'Мероприятие', 0, null) ;

CALL ImportField(30011045, 'Получатель субсидии', '{РусПоле("ОргПолучСубсидии")}', 'Организация-получатель субсидии(ссылка)', ' ', 1, 300, 1, 0, 'ОргПолучСубсидии', 0, null) ;

-- Внутренняя переброска, Бюджет(1)
CALL ImportField(30111010, 'Мероприятие плат.', 'SourceFactCode', 'Мероприятие плательщика', 'SourceFACTCLS', 1, 301, 1, 0, 'Мероприятие,МероприятиеПлат', 0, 36863) ;

CALL ImportField(30111012, 'Код доп. информации плат.', 'SourceFinTypeCode', 'Код дополнительной информации плательщика', 'SourceFINTYPECLS', 1, 301, 1, 0, 'ТипФинансирования,ТипФинансированияПлат', 0, 36853) ;

CALL ImportField(30111022, 'Мероприятие получ-ля', 'DestFactCode', 'Мероприятие получателя', 'DestFACTCLS', 1, 301, 1, 0, 'DestFact,МероприятиеПолуч', 0, 36863) ;

CALL ImportField(30111024, 'Код доп. информации получ-ля', 'DestFinTypeCode', 'Код дополнительной информации получателя', 'DestFINTYPECLS', 1, 301, 1, 0, 'DestFinType,ТипФинансированияПолуч', 0, 36853) ;

CALL ImportField(30111029, 'Направление плат.', 'SourceDirectionClsCode', 'Направление плательщика', 'SourceDirectionCls', 1, 301, 1, 0, 'Направление,НаправлениеПлат', 0, 36861) ;

CALL ImportField(30111030, 'Направление получ-ля', 'DestDirectionClsCode', 'Направление получателя', 'DestDirectionCls', 1, 301, 1, 0, 'DestDirectionCls,НаправлениеПолуч', 0, 36861) ;

CALL ImportField(30111031, 'НПА плательщика', 'SourceDocBaseCode', 'НПА плательщика', 'SOURCEDOCBASE', 1, 301, 1, 0, 'ТипДокОснования,ТипДокОснованияПлат', 0, 36865) ;

CALL ImportField(30111032, 'НПА получателя', 'DestDocBaseCode', 'НПА получателя', 'DESTDOCBASE', 1, 301, 1, 0, 'DestDocBase,ТипДокОснованияПолуч', 0, 36865) ;

CALL ImportField(30111078, 'Администратор(Классификация плат.)', 'SourceIFS_KVSRCode', 'Админстратор (плательщик)', ' ', 1, 301, 1, 0, '', 0, 25472) ;

CALL ImportField(30111081, 'Администратор(Классификация получ-ля)', 'DestIFS_KVSRCode', 'Администратор (получатель)', ' ', 1, 301, 1, 0, '', 0, 25472) ;

CALL ImportField(30111111, 'Администратор(Классификация плат.)', 'SourceKD_KVSRCode', 'Администратор', ' ', 1, 301, 1, 0, '', 0, 25472) ;

CALL ImportField(30111115, 'Администратор получ-ля(Классификация получ-ля)', 'DestKD_KVSRCode', 'Администратор1', ' ', 1, 301, 1, 0, '', 0, 25472) ;

CALL ImportField(30111137, 'Код целевых средств плат.', 'SourceTransfertClsCode', 'Код целевых средств плательщика', 'SourceTransfertClsValue', 1, 301, 1, 0, 'КодЦелевыхСредств,КодЦелевыхСредствПлат', 0, 25326) ;

CALL ImportField(30111138, 'Код целевых средств получ-ля', 'DestTransfertClsCode', 'Код целевых средств получателя', 'DestTransfertClsValue', 1, 301, 1, 0, 'КодЦелевыхСредствПолуч', 0, 25326) ;

CALL ImportField(30111140, 'КЦСР получ-ля(Классификация получ-ля)', 'DestKCSRCode', 'КЦСР получ-ля(Классификация получ-ля)', 'DestKCSR', 1, 301, 1, 0, 'КЦСРПолуч,DestKCSRCode', 0, 25462) ;

CALL ImportField(30111142, 'КВР получ-ля(Классификация получ-ля)', 'DESTKVRCode', 'КВР получ-ля(Классификация получ-ля)', 'DestKVR', 1, 301, 1, 0, 'КВРПолуч,DESTKVRCode', 0, 25467) ;

CALL ImportField(30111143, 'КВСР получ-ля(Классификация получ-ля)', 'DestKVSRCode', 'КВСР получ-ля(Классификация получ-ля)', 'DestKVSR', 1, 301, 1, 0, 'КВСРПолуч,DestKVSRCode', 0, 25472) ;

CALL ImportField(30111145, 'КЦСР плат.(Классификация плат.)', 'SourceKCSRCode', 'КЦСР плат.(Классификация плат.)', 'SourceKCSR', 1, 301, 1, 0, 'КЦСР,КЦСРПлат,SourceKCSRCode', 0, 25462) ;

CALL ImportField(30111147, 'КВР плат.(Классификация плат.)', 'SOURCEKVRCode', 'КВР плат.(Классификация плат.)', 'SourceKVR', 1, 301, 1, 0, 'КВР,КВРПлат,SOURCEKVRCode', 0, 25467) ;

CALL ImportField(30111148, 'КВСР плат.(Классификация плат.)', 'SourceKVSRCode', 'КВСР плат.(Классификация плат.)', 'SourceKVSR', 1, 301, 1, 0, 'КВСР,КВСРПлат,SourceKVSRCode', 0, 25472) ;

CALL ImportField(30111149, 'Код субсидии получ-ляКлюч', 'DestSubsidyCls', 'Код субсидии получател (ссылка)', 'DestSubsidyCls', 1, 301, 1, 1, 'DestSubsidyCls,КодСубсидииКлючПолуч', 0, 26624) ;

CALL ImportField(30111150, 'Код субсидии получ-ля', 'DestSubsidyClsCode', 'Код субсидии получателя', 'DestSubsidyClsCode', 1, 301, 1, 0, 'DestSubsidyClsCode,КодСубсидииПолуч', 0, 26641) ;

CALL ImportField(30111152, 'Код субсидии плат.', 'SourceSubsidyClsCode', 'Код субсидии плательщика', 'SourceSubsidyClsCode', 1, 301, 1, 0, 'КодСубсидии,КодСубсидииПлат', 0, 26641) ;

CALL ImportField(30111154, 'Код бюджетного ассигнования получ-ля', 'DestBudAllocationClsCode', '', 'DestBudAllocationClsCode', 1, 301, 1, 0, 'КодБюджАссигнованияПолуч', 0, 27825) ;

CALL ImportField(30111155, 'Код расходного обязательства получ-ля', 'DestPayPromiseClsCode', '', 'SourcePayPromiseClsCode', 1, 301, 1, 0, 'КодРасходногоОбязательстваПолуч', 0, 27849) ;

CALL ImportField(30111156, 'Код бюджетного ассигнования плат.', 'SourceBudAllocationClsCode', '', 'SourceBudAllocationClsCode', 1, 301, 1, 0, 'КодБюджАссигнованияПлат', 0, 27825) ;

CALL ImportField(30111157, 'Код расходного обязательства плат.', 'SourcePayPromiseClsCode', '', 'SourcePayPromiseClsCode', 1, 301, 1, 0, 'КодРасходногоОбязательстваПлат', 0, 27849) ;

CALL ImportField(30111162, 'Мероприятие плат.(Ключ)', 'SourceFact', 'Мероприятие плательщика', 'SourceFACTCLSKey', 1, 301, 1, 1, 'МероприятиеКлюч,МероприятиеПлатКлюч', 0, 18890) ;

CALL ImportField(30111163, 'Мероприятие получ-ля (Ключ)', 'DestFact', 'Мероприятие получателя', 'DestFACTCLSKey', 1, 301, 1, 1, 'DestFactKey,МероприятиеПолучКлюч', 0, 18899) ;

CALL ImportField(30111164, 'Направление плат.(Ключ)', 'SourceDirectionCls', 'Направление плательщика', 'SourceDirectionClsKey', 1, 301, 1, 1, 'НаправлениеКлюч,НаправлениеПлатКлюч', 0, 18913) ;

CALL ImportField(30111165, 'Направление получ-ля(Ключ)', 'DestDirectionCls', 'Направление получателя', 'DestDirectionClsKey', 1, 301, 1, 1, 'DestDirectionClsKey,НаправлениеПолучКлюч', 0, 18914) ;

CALL ImportField(30111166, 'Код доп. информации плат. (Ключ)', 'SourceFinType', 'Код дополнительной информации плательщика', 'SourceFINTYPECLSKey', 1, 301, 1, 1, 'ТипФинансированияКлюч,ТипФинансированияПлатКлюч', 0, 18893) ;

CALL ImportField(30111167, 'Код доп. информации получ-ля (Ключ)', 'DestFinType', 'Код дополнительной информации получателя', 'DestFINTYPECLSKey', 1, 301, 1, 1, 'DestFinTypeKey,ТипФинансированияПолучКлюч', 0, 18902) ;

CALL ImportField(30111168, 'НПА плательщика (Ключ)', 'SourceDocBase', 'НПА плательщика', 'SOURCEDOCBASEKey', 1, 301, 1, 1, 'ТипДокОснованияКлюч,ТипДокОснованияПлатКлюч', 0, 18915) ;

CALL ImportField(30111169, 'НПА получателя (Ключ)', 'DestDocBase', 'НПА получателя', 'DESTDOCBASEKey', 1, 301, 1, 1, 'DestDocBaseKey,ТипДокОснованияПолучКлюч', 0, 18916) ;

CALL ImportField(30111171, 'Объект плательщика (Ключ)', 'SourceInvestObject', 'Объект плательшика', 'ы', 1, 301, 1, 1, '', 0, null) ;

CALL ImportField(30111172, 'Объект получателя (Ключ)', 'DestInvestObject', 'Объект получателя', ' ', 1, 301, 1, 1, '', 0, null) ;

CALL ImportField(30111173, 'Объект плательщика', 'SourceInvestObjectCode', 'Объект плательшика', ' ', 1, 301, 1, 0, '', 0, null) ;

CALL ImportField(30111174, 'Объект получателя', 'DestInvestObjectCode', 'Объект получателя', ' ', 1, 301, 1, 0, '', 0, null) ;

-- Выбытия по п\п, Бюджет(1)
CALL ImportField(30210005, 'Очередность платежа', 'PAYPRIORITY', 'Очередность платежа', 'PayPriority', 1, 302, 0, 0, 'Очередность', 0, 18966) ;

CALL ImportField(30210026, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 1, 302, 0, 0, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(30210031, 'Номер карты', 'CardNumber', 'Номер пластиковой карты', 'CARDNUMBER', 1, 302, 0, 0, 'НомерКарточки', 0, 18985) ;

CALL ImportField(30210151, 'Номер карточки(ключ)', 'CardRef', 'Код пластиковой карты', 'CardRef', 1, 302, 0, 1, 'КлючПластиковойКарты', 0, 31656) ;

CALL ImportField(30210152, 'Номер карточки', 'CardRefName', '', ' ', 1, 302, 0, 0, '', 0, 18939) ;

CALL ImportField(30210157, 'УИН(Информация о платеже)', 'UINCode', 'Уникальный идентификатор начисления', 'UINCode', 1, 302, 0, 0, 'УИН', 0, 35367) ;

CALL ImportField(30210158, 'Документы основания', 'DocOsn', 'Документы основания', 'ДокументыОснования', 1, 302, 0, 0, 'ДокументыОснования', 0, null) ;

CALL ImportField(30210160, 'Подписи', 'Signers', '', 'Signers', 1, 302, 0, 0, 'ХранимыеПодписи', 0, 38174) ;

CALL ImportField(30211002, 'Направление', 'SourceDirectionClsCode', 'Направление', 'SourceDirectionCLS', 1, 302, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(30211008, 'Мероприятие', 'SOURCEFACTCODE', 'Мероприятие', 'SOURCEFACTCLS', 1, 302, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(30211011, 'Код доп. информации', 'SOURCEFINTYPECODE', 'Код дополнительной информации', 'SOURCEFINTYPECLS', 1, 302, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(30211016, 'НПА', 'SourceDocBaseCode', 'НПА', 'SourceDocBase', 1, 302, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(30211075, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор (расходный источник)', ' ', 1, 302, 1, 0, '', 0, 25472) ;

CALL ImportField(30211107, 'Администратор(Классификация)', 'SourceKD_KVSRCode', 'Администратор(КД)', ' ', 1, 302, 1, 0, '', 0, 25472) ;

CALL ImportField(30211138, 'Код целевых средств', 'SourceTransfertClsCode', 'Код целевых средств', 'SourceTransfertClsValue', 1, 302, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(30211140, 'КЦСР(Классификация)', 'SourceKCSRCode', 'КЦСР(Классификация)', 'SourceKCSR', 1, 302, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(30211142, 'КВР(Классификация)', 'SOURCEKVRCode', 'КВР(Классификация)', 'SourceKVR', 1, 302, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(30211143, 'КВСР(Классификация)', 'SourceKVSRCode', 'КВСР(Классификация)', 'SourceKVSR', 1, 302, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(30211145, 'Код субсидии', 'SourceSubsidyClsCode', 'Код субсидии', 'SourceSubsidyClsCode', 1, 302, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(30211147, 'Код бюджетного ассигнования', 'SourceBudAllocationClsCode', '', 'SourceBudAllocationClsCode', 1, 302, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(30211148, 'Код расходного обязательства', 'SourcePayPromiseClsCode', '', 'SourcePayPromiseClsCode', 1, 302, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(30211151, 'Мероприятие(Ключ)', 'SourceFact', 'Мероприятие', 'SourceFACTCLSKey', 1, 302, 1, 1, 'МероприятиеКлюч', 0, 18890) ;

CALL ImportField(30211152, 'Направление (Ключ)', 'SourceDirectionCls', 'Направление', 'SourceDirectionClsKey', 1, 302, 1, 1, 'НаправлениеКлюч', 0, 18913) ;

CALL ImportField(30211153, 'Код доп. информации (Ключ)', 'SOURCEFINTYPE', 'Код дополнительной информации', 'SourceFINTYPECLSKey', 1, 302, 1, 1, 'ТипФинансированияКлюч', 0, 18893) ;

CALL ImportField(30211154, 'НПА (Ключ)', 'SourceDocBase', 'НПА', 'SOURCEDOCBASEKey', 1, 302, 1, 1, 'ТипДокОснованияКлюч', 0, 18915) ;

CALL ImportField(30211156, 'ОбъектКлюч', 'SourceInvestObject', 'Объект', ' ', 1, 302, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(30211157, 'Объект', 'SourceInvestObjectCode', 'Объект', ' ', 1, 302, 1, 0, 'Объект', 0, null) ;

-- Внутренние зачисления(разассигновка), Бюджет(1)
CALL ImportField(30311018, 'Мероприятие', 'DestFactCode', 'Мероприятие', 'DestFactCLS', 1, 303, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(30311019, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор', ' ', 1, 303, 1, 0, '', 0, 25472) ;

CALL ImportField(30311024, 'Код доп. информации', 'DestFinTypeCode', 'Код дополнительной информации', 'DestFinTypeCLS', 1, 303, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(30311037, 'Направление', 'DestDirectionCLSCode', 'Направление', 'DestDirectionCLS', 1, 303, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(30311039, 'НПА', 'DestDocBaseCode', 'НПА', 'DESTDOCBASE', 1, 303, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(30311072, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств', 'DestTransfertClsValue', 1, 303, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(30311074, 'КЦСР(Классификация)', 'DestKCSRCode', 'КЦСР(Классификация)', 'DestKCSR', 1, 303, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(30311075, 'КВР (Классификация)', 'DESTKVRCode', 'КВР (Классификация)', 'DESTKVR', 1, 303, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(30311076, 'КВСР(Классификация)', 'DestKVSRCode', 'КВСР(Классификация)', 'DestKVSR', 1, 303, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(30311079, 'Причина блокировки(Состояние блокировки)', 'BlockedCause', '', ' ', 1, 303, 1, 1, 'ПричинаБлокировки', 0, 18932) ;

CALL ImportField(30311080, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', 'DestBudAllocationClsCode', 1, 303, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(30311081, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', 'DestPayPromiseClsCode', 1, 303, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(30311082, 'Код субсидийКлюч', 'DESTSUBSIDYCLS', 'Код субсидии (ссылка)', 'DESTSUBSIDYCLS', 1, 303, 1, 1, 'КодСубсидииКлюч', 0, 26624) ;

CALL ImportField(30311083, 'Код субсидий', 'DESTSUBSIDYCLSCode', 'Код субсидии', 'DESTSUBSIDYCLSCode', 1, 303, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(30311084, 'Заблокировано(Состояние блокировки)', 'IsBlocked', '', ' ', 1, 303, 1, 1, 'ПризнакБлокировки', 0, 18931) ;

CALL ImportField(30311085, 'Причина разблокировки(Состояние блокировки)', 'UnBlockedCause', '', ' ', 1, 303, 1, 1, 'ПричинаРазблокировки', 0, 18934) ;

CALL ImportField(30311086, 'Дата разблокировки(Состояние блокировки)', 'UnBlockedDate', '', ' ', 1, 303, 1, 1, 'ДатаРазблокировки', 0, 18933) ;

CALL ImportField(30311089, 'Мероприятие (Ключ)', 'DestFact', 'Мероприятие', 'DestFACTCLSKey', 1, 303, 1, 1, 'МероприятиеКлюч', 0, 18899) ;

CALL ImportField(30311090, 'Направление (Ключ)', 'DestDirectionCls', 'Направление', 'DestDirectionClsKey', 1, 303, 1, 1, 'НаправлениеКлюч', 0, 18914) ;

CALL ImportField(30311092, 'Код доп. информации получ-ля (Ключ)', 'DestFinType', 'Код дополнительной информации получателя', 'DestFINTYPECLSKey', 1, 303, 1, 1, 'ТипФинансированияКлюч', 0, 18902) ;

CALL ImportField(30311093, 'НПА (Ключ)', 'DestDocBase', 'НПА', 'DESTDOCBASEKey', 1, 303, 1, 1, 'ТипДокОснованияКлюч', 0, 18916) ;

CALL ImportField(30311095, 'ОбъектКлюч', 'DestInvestObject', 'Объект', ' ', 1, 303, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(30311096, 'Объект', 'DestInvestObjectCode', 'Объект', ' ', 1, 303, 1, 0, 'Объект', 0, null) ;

-- Выбытия по чекам, Бюджет(1)
CALL ImportField(30410107, 'Счет получателя', 'DestAccount', 'Счет получателя', 'DESTACCOUNT', 1, 304, 0, 1, 'СчетПолуч', 0, 18958) ;

CALL ImportField(30410129, 'Номер карты', 'CardNumber', 'Номер пластиковой карты (старый)', 'CARDNUMBER', 1, 304, 0, 0, 'НомерКарточки', 0, 18985) ;

CALL ImportField(30410141, 'Номер карточки(ключ)', 'CardRef', 'Код пластиковой карты', 'CardRef', 1, 304, 0, 1, 'КлючПластиковойКарты', 0, 31656) ;

CALL ImportField(30410142, 'Номер карточки', 'CardRefName', 'Номер пластиковой карты', 'CardRefName', 1, 304, 0, 0, 'НомерКарточки', 0, 18939) ;

CALL ImportField(30410143, 'Статус(Обмен с ФК)', 'Status', 'Статус', 'Status', 1, 304, 0, 1, 'Статус', 0, 17233) ;

CALL ImportField(30410144, 'Обмен с ФК', 'ParentElBank', 'Обмен с ФК', ' ', 1, 304, 0, 0, '', 0, null) ;

CALL ImportField(30410145, 'Ссылка(Обмен с ФК)', 'pdeID', '', ' ', 1, 304, 0, 1, '', 0, 17226) ;

CALL ImportField(30410146, 'Подписи', 'Signers', 'Подписи', 'Signers', 1, 304, 0, 0, 'ХранимыеПодписи', 0, 38174) ;

CALL ImportField(30411001, 'Мероприятие', 'SOURCEFACTCODE', 'Мероприятие', 'SOURCEFACTCLS', 1, 304, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(30411008, 'Код доп. информации', 'SOURCEFINTYPECODE', 'Код дополнительной информации', 'SOURCEFINTYPECLS', 1, 304, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(30411010, 'Направление', 'SourceDirectionClsCode', 'Направление', 'SourceDirectionCLS', 1, 304, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(30411018, 'НПА', 'SourceDocBaseCode', 'НПА', 'SourceDocBase', 1, 304, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(30411076, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор (расходный источник)', ' ', 1, 304, 1, 0, '', 0, 25472) ;

CALL ImportField(30411097, 'Администратор(Классификация)', 'SourceKD_KVSRCode', 'Администратор(КД)', ' ', 1, 304, 1, 0, '', 0, 25472) ;

CALL ImportField(30411128, 'Код целевых средств', 'SourceTransfertClsCode', 'Код целевых средств', 'SourceTransfertClsValue', 1, 304, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(30411130, 'КЦСР(Классификация)', 'SourceKCSRCode', 'КЦСР(Классификация)', 'SourceKCSR', 1, 304, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(30411132, 'КВР(Классификация)', 'SOURCEKVRCode', 'КВР(Классификация)', 'SourceKVR', 1, 304, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(30411133, 'КВСР(Классификация)', 'SourceKVSRCode', 'КВСР(Классификация)', 'SourceKVSR', 1, 304, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(30411135, 'Код субсидии', 'SourceSubsidyClsCode', 'Код субсидии', 'SourceSubsidyClsCode', 1, 304, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(30411137, 'Код бюджетного ассигнования', 'SourceBudAllocationClsCode', '', 'SourceBudAllocationClsCode', 1, 304, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(30411138, 'Код расходного обязательства', 'SourcePayPromiseClsCode', '', 'SourcePayPromiseClsCode', 1, 304, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(30411141, 'Мероприятие(Ключ)', 'SourceFact', 'Мероприятие', 'SourceFACTCLSKey', 1, 304, 1, 1, 'МероприятиеКлюч', 0, 18890) ;

CALL ImportField(30411142, 'Направление (Ключ)', 'SourceDirectionCls', 'Направление', 'SourceDirectionClsKey', 1, 304, 1, 1, 'НаправлениеКлюч', 0, 18913) ;

CALL ImportField(30411143, 'Код доп. информации (Ключ)', 'SOURCEFINTYPE', 'Код дополнительной информации', 'SourceFINTYPECLSKey', 1, 304, 1, 1, 'ТипФинансированияКлюч', 0, 18893) ;

CALL ImportField(30411144, 'НПА (Ключ)', 'SourceDocBase', 'НПА', 'SOURCEDOCBASEKey', 1, 304, 1, 1, 'ТипДокОснованияКлюч', 0, 18915) ;

CALL ImportField(30411145, 'ОбъектКлюч', 'SourceInvestObject', 'Объект', ' ', 1, 304, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(30411146, 'Объект', 'SourceInvestObjectCode', 'Объект', ' ', 1, 304, 1, 0, 'Объект', 0, null) ;

-- Поступления по п\п, Бюджет(1)
CALL ImportField(30510165, 'Номер карточки(ключ)', 'CardRef', 'Код пластиковой карты', 'CardRef', 1, 305, 0, 1, 'КлючПластиковойКарты', 0, 31656) ;

CALL ImportField(30510169, 'Номер пластиковой карты', 'CardRefName', 'Номер пластиковой карты', ' ', 1, 305, 0, 0, '', 0, 18939) ;

CALL ImportField(30510170, 'УИН', 'UINCode', 'Уникальный идентификатор начисления', 'UINCode', 1, 305, 0, 0, 'УИН', 0, 35367) ;

CALL ImportField(30510171, 'Назначение платежа(Хранимые реквизиты платежа)', 'StoredPaymentNote', '', ' ', 1, 305, 0, 0, 'ФорматНазначениеПлатежа', 0, 31659) ;

CALL ImportField(30510172, 'Номер карты', 'CardNumber', 'Номер пластиковой карты', 'CardNumber', 1, 305, 0, 0, 'НомерКарточки', 0, null) ;

CALL ImportField(30511019, 'Мероприятие', 'DestFactCode', 'Мероприятие получателя', 'DestFACTCLS', 1, 305, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(30511022, 'Код доп. информации', 'DestFinTypeCode', 'Код дополнительной информации', 'DestFINTYPECLS', 1, 305, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(30511024, 'Направление', 'DestDirectionCLSCode', 'Направление получателя', 'DestDirectionCLS', 1, 305, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(30511049, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор(расходный источник)', ' ', 1, 305, 1, 0, '', 0, 25472) ;

CALL ImportField(30511103, 'НПА', 'DestDocBaseCode', 'НПА', 'DestDocBase', 1, 305, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(30511109, 'Администратор(Классификация)', 'DestKD_KVSRCode', 'Администратор КД', ' ', 1, 305, 1, 0, '', 0, 25472) ;

CALL ImportField(30511128, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств', 'DestTransfertClsValue', 1, 305, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(30511130, 'КЦСР(Классификация)', 'DestKCSRCode', 'КЦСР(Классификация)', 'DestKCSR', 1, 305, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(30511132, 'КВР(Классификация)', 'DESTKVRCode', 'КВР(Классификация)', 'DestKVR', 1, 305, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(30511133, 'КВСР(Классификация)', 'DestKVSRCode', 'КВСР(Классификация)', 'DestKVSR', 1, 305, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(30511134, 'Источник образования', 'DestFundsSource', 'Источник образования', 'DestFundsSource', 1, 305, 1, 0, 'ИсточникОбразованияСредств', 0, 18929) ;

CALL ImportField(30511136, 'Код субсидии', 'DestSubsidyClsCode', 'Код субсидии', 'DestSubsidyClsCode', 1, 305, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(30511138, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', 'DestBudAllocationClsCode', 1, 305, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(30511139, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', 'DestPayPromiseClsCode', 1, 305, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(30511142, 'Мероприятие (Ключ)', 'DestFact', 'Мероприятие', 'DestFACTCLSKey', 1, 305, 1, 1, 'МероприятиеКлюч', 0, 18899) ;

CALL ImportField(30511143, 'Направление (Ключ)', 'DestDirectionCls', 'Направление получателя', 'DestDirectionClsKey', 1, 305, 1, 1, 'НаправлениеКлюч', 0, 18914) ;

CALL ImportField(30511144, 'Код доп. информации получ-ля (Ключ)', 'DestFinType', 'Код дополнительной информации', 'DestFINTYPECLSKey', 1, 305, 1, 1, 'ТипФинансированияКлюч', 0, 18902) ;

CALL ImportField(30511145, 'НПА (Ключ)', 'DestDocBase', 'НПА', 'DESTDOCBASEKey', 1, 305, 1, 1, 'ТипДокОснованияКлюч', 0, 18916) ;

CALL ImportField(30511146, 'ОбъектКлюч', 'DestInvestObject', 'Объект', ' ', 1, 305, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(30511147, 'Объект', 'DestInvestObjectCode', 'Объект', ' ', 1, 305, 1, 0, 'Объект', 0, null) ;

-- Поступление по объявлениям, Бюджет(1)
CALL ImportField(30610130, 'Номер карты', 'CARDNUMBER', 'Номер пластиковой карты (старый)', 'CARDNUMBER', 1, 306, 0, 0, 'НомерКарточки', 0, 18985) ;

CALL ImportField(30610144, 'Номер карточки(ключ)', 'CardRef', 'Код пластиковой карты', 'CardRef', 1, 306, 0, 1, 'КлючПластиковойКарты', 0, 31656) ;

CALL ImportField(30610145, 'Номер карточки', 'CardRefName', 'Номер пластиковой карты', ' ', 1, 306, 0, 0, 'НомерКарточки', 0, 18939) ;

CALL ImportField(30610146, 'УИН(Информация о платеже)', 'UINCode', 'Уникальный идентификатор начисления', 'UINCode', 1, 306, 0, 0, 'УИН', 0, 35367) ;

CALL ImportField(30610150, 'Статус(Обмен с ФК)', 'Status', 'Статус', 'Status', 1, 306, 0, 1, 'Статус', 0, 17233) ;

CALL ImportField(30610151, 'Обмен с ФК', 'ParentElBank', 'Обмен с ФК', ' ', 1, 306, 0, 0, '', 0, null) ;

CALL ImportField(30610152, 'Ссылка(Обмен с ФК)', 'pdeID', '', ' ', 1, 306, 0, 1, '', 0, 17226) ;

CALL ImportField(30611023, 'Мероприятие', 'DestFactCode', 'Мероприятие', 'DestFACTCLS', 1, 306, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(30611024, 'Направление', 'DestDirectionCLSCode', 'Направление', 'DestDirectionCLS', 1, 306, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(30611025, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор ИВФ', ' ', 1, 306, 1, 0, '', 0, 25472) ;

CALL ImportField(30611028, 'Администратор(Классификация)', 'DestKD_KVSRCode', 'Администратор КД', ' ', 1, 306, 1, 0, '', 0, 25472) ;

CALL ImportField(30611032, 'Код доп. информации', 'DestFinTypeCode', 'Код дополнительной информации', 'DestFINTYPECLS', 1, 306, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(30611049, 'НПА', 'DestDocBaseCode', 'НПА', 'DESTDOCBASE', 1, 306, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(30611131, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств', 'DestTransfertClsValue', 1, 306, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(30611133, 'КЦСР(Классификация)', 'DestKCSRCode', 'КЦСР(Классификация)', 'DestKCSR', 1, 306, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(30611135, 'КВР(Классификация)', 'DESTKVRCode', 'КВР(Классификация)', 'DestKVR', 1, 306, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(30611136, 'КВСР(Классификация)', 'DestKVSRCode', 'КВСР(Классификация)', 'DestKVSR', 1, 306, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(30611138, 'Код субсидии', 'DestSubsidyClsCode', 'Код субсидии', 'DestSubsidyClsCode', 1, 306, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(30611140, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', 'DestBudAllocationClsCode', 1, 306, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(30611141, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', 'DestPayPromiseClsCode', 1, 306, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(30611144, 'Мероприятие (Ключ)', 'DestFact', 'Мероприятие', 'DestFACTCLSKey', 1, 306, 1, 1, 'МероприятиеКлюч', 0, 18899) ;

CALL ImportField(30611145, 'Направление (Ключ)', 'DestDirectionCls', 'Направление получателя', 'DestDirectionClsKey', 1, 306, 1, 1, 'НаправлениеКлюч', 0, 18914) ;

CALL ImportField(30611146, 'Код доп. информации (Ключ)', 'DestFinType', 'Код дополнительной информации', 'DestFINTYPECLSKey', 1, 306, 1, 1, 'ТипФинансированияКлюч', 0, 18902) ;

CALL ImportField(30611147, 'НПА (Ключ)', 'DestDocBase', 'НПА', 'DESTDOCBASEKey', 1, 306, 1, 1, 'ТипДокОснованияКлюч', 0, 18916) ;

CALL ImportField(30611148, 'ОбъектКлюч', 'DestInvestObject', 'Объект', ' ', 1, 306, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(30611149, 'Объект', 'DestInvestObjectCode', 'Объект', ' ', 1, 306, 1, 0, 'Объект', 0, null) ;

-- Реестры казначейства, Бюджет(1)
CALL ImportField(30711018, 'Документ отправлен', 'DocSended', 'Признак отправленности документа', ' ', 1, 307, 1, 1, '', 0, null) ;

-- Внутренние платежи, Бюджет(1)
CALL ImportField(30810069, 'УИН(Информация о платеже)', 'UINCode', 'Уникальный идентификатор начисления', 'UINCode', 1, 308, 0, 0, 'УИН', 0, 35367) ;

CALL ImportField(30810070, 'Тип классификации', 'DestClsType', '', ' ', 1, 308, 0, 1, 'ТипКлассификацииПолуч', 0, 38187) ;

CALL ImportField(30811008, 'Направление получателя', 'DestDirectionCLSCode', 'Направление получ-ля', 'DestDirectionCLS', 1, 308, 1, 0, 'НаправлениеПолуч', 0, 36861) ;

CALL ImportField(30811009, 'НПА получателя', 'DestDocBaseCode', 'НПА получателя', 'DESTDOCBASE', 1, 308, 1, 0, 'ТипДокОснованияПолуч', 0, 36865) ;

CALL ImportField(30811016, 'Мероприятие получателя', 'DestFactCode', 'Мероприятие получ-ля', 'DestFACTCLS', 1, 308, 1, 0, 'МероприятиеПолуч', 0, 36863) ;

CALL ImportField(30811018, 'Код доп. информации получателя(Классификация получателя)', 'DestFinTypeCode', 'Код дополнительной информации получ-ля', 'DestFINTYPECLS', 1, 308, 1, 0, 'ТипФинансированияПолуч', 0, 36853) ;

CALL ImportField(30811019, 'Код дохода ключ получ.', 'DestKD', 'Код дохода получателя (ключ)', 'DESTKD', 1, 308, 1, 1, 'КДКлючПолуч', 0, 18926) ;

CALL ImportField(30811022, 'Администратор получателя(Классификация получателя)', 'DestKD_KVSRCode', 'Администратор получ-ля(Классификация получ-ля)', ' ', 1, 308, 1, 0, '', 0, 25472) ;

CALL ImportField(30811035, 'Направление плат.(Классификация плат.)', 'SourceDirectionCLSCode', 'Направление плат.(Классификация плат.)', 'SourceDirectionCLS', 1, 308, 1, 0, 'Направление,НаправлениеПлат', 0, 36861) ;

CALL ImportField(30811036, 'НПА плательщика', 'SourceDocBaseCode', 'НПА плательщика', 'SOURCEDOCBASE', 1, 308, 1, 0, 'ТипДокОснования,ТипДокОснованияПлат', 0, 36865) ;

CALL ImportField(30811041, 'Мероприятие плательщика', 'SourceFactCode', 'Мероприятие плат.', 'SourceFACTCLS', 1, 308, 1, 0, 'Мероприятие,МероприятиеПлат', 0, 36863) ;

CALL ImportField(30811043, 'Код доп. информации плат.', 'SourceFinTypeCode', 'Код дополнительной информации плат.', 'SourceFINTYPECLS', 1, 308, 1, 0, 'ТипФинансирования,ТипФинансированияПлат', 0, 36853) ;

CALL ImportField(30811060, 'КЦСР плательщика(Классификация плательщика)', 'SourceKCSRCode', 'КЦСР плат.(Классификация плат.)', 'SourceKCSR', 1, 308, 1, 0, 'КЦСР,КЦСРПлат', 0, 25462) ;

CALL ImportField(30811061, 'КВР плательщика(Классификация плательщика)', 'SOURCEKVRCode', 'КВР плат.(Классификация плат.)', 'SourceKVR', 1, 308, 1, 0, 'КВР,КВРПлат', 0, 25467) ;

CALL ImportField(30811062, 'КВСР плательщика(Классификация плательщика)', 'SourceKVSRCode', 'КВСР плат.(Классификация плат.)', 'SourceKVSR', 1, 308, 1, 0, 'КВСР,КВСРПлат', 0, 25472) ;

CALL ImportField(30811064, 'Код целевых средств получ-ля', 'DestTransfertClsCode', '', 'DestTransfertClsValue', 1, 308, 1, 0, 'КодЦелевыхСредствПолуч', 0, 25326) ;

CALL ImportField(30811066, 'Код целевых средств плательщика', 'SourceTransfertClsCode', '', 'SourceTransfertClsValue', 1, 308, 1, 0, 'КодЦелевыхСредств,КодЦелевыхСредствПлат', 0, 25326) ;

CALL ImportField(30811068, 'КЦСР получателя(Классификация получателя)', 'DestKCSRCode', '', 'DestKCSR', 1, 308, 1, 0, 'КЦСРПолуч', 0, 25462) ;

CALL ImportField(30811072, 'КВР получателя(Классификация получателя)', 'DESTKVRCode', '', 'DestKVR', 1, 308, 1, 0, 'КВРПолуч', 0, 25467) ;

CALL ImportField(30811074, 'КВСР получателя(Классификация получателя)', 'DestKVSRCode', '', 'DestKVSR', 1, 308, 1, 0, 'КВСРПолуч', 0, 25472) ;

CALL ImportField(30811075, 'Код дохода ключ плат.', 'SourceKD', 'Код дохода плательщика (ключ)', 'SOURCEKD', 1, 308, 1, 1, 'КДКлюч,КДКлючПлат', 0, 18925) ;

CALL ImportField(30811082, 'Код субсидии получателя', 'DestSubsidyClsCode', '', 'DestSubsidyClsCode', 1, 308, 1, 0, 'КодСубсидииПолуч', 0, 26641) ;

CALL ImportField(30811084, 'Код субсидии плательщика', 'SourceSubsidyClsCode', '', 'SourceSubsidyClsCode', 1, 308, 1, 0, 'КодСубсидии,КодСубсидииПлат', 0, 26641) ;

CALL ImportField(30811085, 'Код бюджетного ассигнования получателя', 'DestBudAllocationClsCode', '', 'DestBudAllocationClsCode', 1, 308, 1, 0, 'КодБюджАссигнованияПолуч', 0, 27825) ;

CALL ImportField(30811086, 'Код расходного обязательства получателя', 'DestPayPromiseClsCode', '', 'DestPayPromiseClsCode', 1, 308, 1, 0, 'КодРасходногоОбязательстваПолуч', 0, 27849) ;

CALL ImportField(30811087, 'Код бюджетного ассигнования плательщика', 'SourceBudAllocationClsCode', '', 'SourceBudAllocationClsCode', 1, 308, 1, 0, 'КодБюджАссигнования,КодБюджАссигнованияПлат', 0, 27825) ;

CALL ImportField(30811088, 'Код расходного обязательства плательщика', 'SourcePayPromiseClsCode', '', 'SourcePayPromiseClsCode', 1, 308, 1, 0, 'КодРасходногоОбязательства,КодРасходногоОбязательстваПлат', 0, 27849) ;

CALL ImportField(30811094, 'Источниковая классификация(Классификация получателя)', 'DestIFS', '', 'DestIFS', 1, 308, 1, 1, 'ИсточникВнутрФинансированияКлючПолуч', 0, 18921) ;

CALL ImportField(30811098, 'Источниковая классификация(Классификация плательщика)', 'SourceIFS', '', 'SourceIFS', 1, 308, 1, 1, 'ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПлат', 0, 18920) ;

CALL ImportField(30811102, 'Код дохода плат.', 'SourceKD_Value', 'Код дохода плательщика', 'SOURCEKDVALUE', 1, 308, 1, 1, 'КодДохода,КодДоходаПлат', 0, null) ;

CALL ImportField(30811103, 'Мероприятие плательщика (Ключ)', 'SourceFact', 'Мероприятие плательщика', 'SourceFACTCLSKey', 1, 308, 1, 1, 'МероприятиеКлюч,МероприятиеПлатКлюч', 0, 18890) ;

CALL ImportField(30811104, 'Мероприятие получателя (Ключ)', 'DestFact', 'Мероприятие получателя', 'DestFACTCLSKey', 1, 308, 1, 1, 'МероприятиеПолучКлюч', 0, 18899) ;

CALL ImportField(30811105, 'Направление плат.(Ключ)', 'SourceDirectionCLS', 'Направление плательщика', 'SourceDirectionClsKey', 1, 308, 1, 1, 'НаправлениеКлюч,НаправлениеПлатКлюч', 0, 18913) ;

CALL ImportField(30811106, 'Направление получ-ля(Ключ)', 'DestDirectionCLS', 'Направление получателя', 'DestDirectionClsKey', 1, 308, 1, 1, 'НаправлениеПолучКлюч', 0, 18914) ;

CALL ImportField(30811107, 'Код доп. информации плат. (Ключ)', 'SourceFinType', 'Код дополнительной информации плательщика', 'SourceFINTYPECLSKey', 1, 308, 1, 1, 'ТипФинансированияКлюч,ТипФинансированияПлатКлюч', 0, 18893) ;

CALL ImportField(30811108, 'Код доп. информации получателя(Ключ)', 'DestFinType', 'Код дополнительной информации получателя', 'DestFINTYPECLSKey', 1, 308, 1, 1, 'ТипФинансированияПолучКлюч', 0, 18902) ;

CALL ImportField(30811109, 'НПА плательщика (Ключ)', 'SourceDocBase', 'НПА плательщика', 'SOURCEDOCBASEKey', 1, 308, 1, 1, 'ТипДокОснованияКлюч,ТипДокОснованияПлатКлюч', 0, 18915) ;

CALL ImportField(30811110, 'НПА получателя (Ключ)', 'DestDocBase', 'НПА получателя', 'DESTDOCBASEKey', 1, 308, 1, 1, 'ТипДокОснованияПолучКлюч', 0, 18916) ;

CALL ImportField(30811111, 'Объект плательщика (Ключ)', 'SourceInvestObject', 'Объект плательшика', ' ', 1, 308, 1, 1, '', 0, null) ;

CALL ImportField(30811112, 'Объект получателя (Ключ)', 'DestInvestObject', 'Объект получателя', ' ', 1, 308, 1, 1, '', 0, null) ;

CALL ImportField(30811113, 'Объект плательщика', 'SourceInvestObjectCode', 'Объект плательшика', ' ', 1, 308, 1, 0, '', 0, null) ;

CALL ImportField(30811114, 'Объект получателя', 'DestInvestObjectCode', 'Объект получателя', ' ', 1, 308, 1, 0, '', 0, null) ;

-- Перечисление на счета наличности, Бюджет(1)
CALL ImportField(31110075, 'Номер пластиковой карты', 'CardRefName', 'Номер пластиковой карты', ' ', 1, 311, 0, 0, '', 0, 18939) ;

CALL ImportField(31110076, 'Получатель(Хранимые реквизиты платежа)', 'DestStoredPaymentProps', '', 'DestStoredPaymentProps', 1, 311, 0, 0, 'РеквизитыПлатежаПолуч', 0, 31657) ;

CALL ImportField(31110077, 'Плательщик(Хранимые реквизиты платежа)', 'SourceStoredPaymentProps', '', 'SourceStoredPaymentProps', 1, 311, 0, 0, 'РеквизитыПлатежаПлат', 0, 31658) ;

CALL ImportField(31110078, 'Назначение платежа(Хранимые реквизиты платежа)', 'StoredPaymentNote', '', 'StoredPaymentNote', 1, 311, 0, 0, 'ФорматНазначениеПлатежа', 0, 31659) ;

CALL ImportField(31110079, 'Хранимые реквизиты платежа', 'StoredPaymentProps', '', ' ', 1, 311, 0, 0, '', 0, null) ;

CALL ImportField(31110080, 'УИН', 'UINCode', 'Уникальный идентификатор начисления', 'UINCode', 1, 311, 0, 0, 'УИН', 0, 35367) ;

CALL ImportField(31110081, 'Номер карты', 'CardNumber', 'Номер пластиковой карты', 'CardNumber', 1, 311, 0, 0, 'НомерКарточки', 0, null) ;

CALL ImportField(31111010, 'Направление', 'SourceDirectionCLSCode', 'Направление', 'SourceDirectionCLS', 1, 311, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(31111011, 'Мероприятие', 'SourceFactCode', 'Мероприятие', 'SourceFactCls', 1, 311, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(31111013, 'Код доп. информации', 'SourceFinTypeCode', 'Код дополнительной информации', 'SourceFinTypeCls', 1, 311, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(31111023, 'Направление получателя', 'DestDirectionCLSCode', 'Направление получателя', 'DestDirectionCLS', 1, 311, 1, 1, 'НаправлениеПолуч', 0, 36861) ;

CALL ImportField(31111024, 'Мероприятие получателя', 'DestFactCode', 'Мероприятие получателя', 'DestFactCls', 1, 311, 1, 1, 'МероприятиеПолуч', 0, 36863) ;

CALL ImportField(31111026, 'Код доп. информации получателя', 'DestFinTypeCode', 'Код дополнительной информации получателя', 'DestFinTypeCls', 1, 311, 1, 1, 'ТипФинансированияПолуч', 0, 36853) ;

CALL ImportField(31111042, 'НПА', 'SourceDocBaseCode', 'НПА', 'SOURCEDOCBASE', 1, 311, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(31111051, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор(ИВнФ)', ' ', 1, 311, 1, 0, '', 0, 25472) ;

CALL ImportField(31111054, 'Администратор(Классификация)', 'SourceKD_KVSRCode', 'Администратор(КД)', ' ', 1, 311, 1, 0, '', 0, 25472) ;

CALL ImportField(31111078, 'Код целевых средств', 'SourceTransfertClsCode', 'Код целевых средств', 'SourceTransfertClsValue', 1, 311, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(31111080, 'КЦСР(Классификация)', 'SourceKCSRCode', 'КЦСР(Классификация)', 'SourceKCSR', 1, 311, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(31111082, 'КВР(Классификация)', 'SOURCEKVRCode', 'КВР(Классификация)', 'SOURCEKVR', 1, 311, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(31111083, 'КВСР(Классификация)', 'SourceKVSRCode', 'КВСР(Классификация)', 'SourceKVSR', 1, 311, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(31111089, 'Код субсидии', 'SourceSubsidyClsCode', 'Код субсидии', 'SourceSubsidyClsCode', 1, 311, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(31111091, 'Код бюджетного ассигнования', 'SourceBudAllocationClsCode', '', 'SourceBudAllocationClsCode', 1, 311, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(31111092, 'Код расходного обязательства', 'SourcePayPromiseClsCode', '', 'SourcePayPromiseClsCode', 1, 311, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(31111100, 'Мероприятие плательщика (Ключ)', 'SourceFact', 'Мероприятие плательщика', 'SourceFACTCLSKey', 1, 311, 1, 1, 'МероприятиеКлюч', 0, 18890) ;

CALL ImportField(31111101, 'Мероприятие получателя (Ключ)', 'DestFact', 'Мероприятие получателя', 'DestFACTCLSKey', 1, 311, 1, 1, 'МероприятиеПолучКлюч', 0, 18899) ;

CALL ImportField(31111102, 'Направление (Ключ)', 'SourceDirectionCLS', 'Направление', 'SourceDirectionClsKey', 1, 311, 1, 1, 'НаправлениеКлюч', 0, 18913) ;

CALL ImportField(31111103, 'Направление получателя (Ключ)', 'DestDirectionCLS', 'Направление получателя', 'DestDirectionClsKey', 1, 311, 1, 1, 'НаправлениеПолучКлюч', 0, 18914) ;

CALL ImportField(31111104, 'Код доп. информации (Ключ)', 'SourceFinType', 'Код дополнительной информации плательщика', 'SourceFINTYPECLSKey', 1, 311, 1, 1, 'ТипФинансированияКлюч', 0, 18893) ;

CALL ImportField(31111105, 'Код доп. информации получателя (Ключ)', 'DestFinType', 'Код дополнительной информации получателя', 'DestFINTYPECLSKey', 1, 311, 1, 1, 'ТипФинансированияПолучКлюч', 0, 18902) ;

CALL ImportField(31111106, 'НПА (Ключ)', 'SourceDocBase', 'НПА', 'SOURCEDOCBASEKey', 1, 311, 1, 1, 'ТипДокОснованияКлюч,ТипДокОснованияПлатКлюч', 0, 18915) ;

CALL ImportField(31111107, 'ОбъектКлюч', 'SourceInvestObject', 'Объект', ' ', 1, 311, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(31111108, 'Объект', 'SourceInvestObjectCode', 'Объект', ' ', 1, 311, 1, 0, 'Объект', 0, null) ;

-- Подтверждение перечисления на счета наличности, Бюджет(1)
CALL ImportField(31210001, 'Код документа', 'ID', 'Код документа', 'ID', 1, 312, 0, 1, 'КодДокумента', 0, 18948) ;

CALL ImportField(31210002, '№ п/п', 'DOCNUMBER', 'Номер документа', 'DocumentNumber', 1, 312, 0, 0, 'НомерДокумента', 0, 18949) ;

CALL ImportField(31210004, 'Код УРМ документа', 'SenderRecordID', 'Код УРМ документа', 'SenderRecordID', 1, 312, 0, 1, 'КодУРМДокумента', 0, 18970) ;

CALL ImportField(31210005, 'Код отправителя документа', 'SenderID', 'Код отправителя документа', 'SenderID', 1, 312, 0, 1, 'КодОтправителяДокумента', 0, 18969) ;

CALL ImportField(31210006, 'Дата п/п', 'DocumentDate', 'Дата документа', 'DocumentDate', 1, 312, 0, 0, 'ДатаДокумента', 0, 18953) ;

CALL ImportField(31210007, 'Срок платежа', 'PayDate', 'Срок платежа', 'PayDate', 1, 312, 0, 0, 'СрокПлатежа', 0, 18951) ;

CALL ImportField(31210008, 'Дата проводки', 'AcceptDate', 'Дата проводки', 'AcceptDate', 1, 312, 0, 0, 'ДатаПринятия', 0, 18952) ;

CALL ImportField(31210009, 'Номер реестра', 'ReestrNumber', 'Номер реестра', 'ReestrNumber', 1, 312, 0, 0, 'НомерРеестра', 0, 19090) ;

CALL ImportField(31210010, 'Дата реестра', 'REESTRDATE', 'Дата реестра', 'REESTRDATE', 1, 312, 0, 1, 'ДатаРеестра', 0, 19091) ;

CALL ImportField(31210011, 'Сумма(руб)', 'SUMMA', 'Сумма', 'SUMMA', 1, 312, 0, 0, 'СуммаЗаголовка', 0, 18955) ;

CALL ImportField(31210013, 'Вид платежа', 'PAYTYPECLS', 'Вид платежа', 'PAYTYPECLS', 1, 312, 0, 0, 'ВидПлатежа', 0, 18963) ;

CALL ImportField(31210014, 'Назначение платежа', 'NOTE', 'Назначение платежа', 'NOTE', 1, 312, 0, 0, 'Примечание', 0, 18964) ;

CALL ImportField(31210015, 'Очередность', 'PayPriority', 'Очередность ', 'PayPriority', 1, 312, 0, 0, 'Очередность', 0, 18966) ;

CALL ImportField(31210016, 'Вид операции', 'TYPEOPERATIONCLS', 'Вид операции', 'OperationTypeCls', 1, 312, 0, 0, 'ТипОперации', 0, 18967) ;

CALL ImportField(31210017, 'Вид учета (старый)', 'BUHPAYMENTCLS', 'Бух. проводка', 'BUHPAYMENTCLS', 1, 312, 0, 0, 'БухПроводка', 0, 18968) ;

CALL ImportField(31210019, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 312, 0, 0, 'ПричинаОтклонКод', 0, 18972) ;

CALL ImportField(31210020, 'Причина отклонения (комментарий)', 'RejectCause', 'Текст причины отклонения', 'RejectCause', 1, 312, 0, 0, 'ПричинаОтклонТекст', 0, 18973) ;

CALL ImportField(31210021, 'Ссылка на счет плательщика', 'SOURCEACCOUNT', 'Ссылка на счет плательщика', 'SOURCEACCOUNT', 1, 312, 0, 1, 'СчетПлат', 0, 18956) ;

CALL ImportField(31210022, 'Л/с средств в пути', 'SOURCEFACIALACC_CLS', 'л\с плательщика', 'SourceFacialAccCls', 1, 312, 0, 0, 'ЛицСчетПлатЗаголовок', 0, 18957) ;

CALL ImportField(31210023, 'Ссылка на счет организации-получателя', 'DESTACCOUNT', 'Ссылка на счет организации-получателя', 'DESTACCOUNT', 1, 312, 0, 1, 'РСФО,СчетПолуч', 0, 18958) ;

CALL ImportField(31210025, 'СостояниеДокумента', 'DocStateRef', 'Состояние документа', 'DocStateRef', 1, 312, 0, 1, 'СостояниеДокумента', 0, 18996) ;

CALL ImportField(31210037, 'Код реестра', 'Reestr_Ref', 'Код реестра', 'Reestr_Ref', 1, 312, 0, 1, 'КодРеестра', 0, 18971) ;

CALL ImportField(31210038, 'Статус ЭЦП', 'CRYPTOSTATUS', 'Статус ЭЦП', 'CRYPTOSTATUS', 1, 312, 0, 1, 'КриптоСтатус', 0, 18975) ;

CALL ImportField(31210043, 'Счет получателя', 'DestAccountName', 'Счет получателя', 'DestAccountName', 1, 312, 0, 0, '', 0, 17112) ;

CALL ImportField(31210069, 'р/с плательщика', 'SourceAccountName', 'р/с плательщика', 'SourceAccountName', 1, 312, 0, 0, '', 0, 17112) ;

CALL ImportField(31210094, 'Архив', 'ARHIVEDOC', 'Архив', 'ARHIVEDOC', 1, 312, 0, 0, 'ПризнакАрхивности', 0, 18961) ;

CALL ImportField(31210095, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 312, 0, 0, 'КодБюджета', 0, 18983) ;

CALL ImportField(31210100, 'Направление операции', 'OperationDirection', 'Направление операции', 'OperationDirection', 1, 312, 0, 0, 'НаправлениеОперации', 0, 19009) ;

CALL ImportField(31210105, 'Информация для налогового платежа', 'TaxNote', 'Информация для налогового платежа', 'TAXNOTE', 1, 312, 0, 0, 'ИнформацияОНалоге', 0, 18991) ;

CALL ImportField(31210108, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'CLSTYPE', 1, 312, 0, 0, 'ТипКлассификацииЗаголовок', 0, 19008) ;

CALL ImportField(31210116, 'Признак принятости реестра', 'Accepted', 'Признак принятости реестра', ' ', 1, 312, 0, 1, 'ПринятиеРеестра', 0, 19093) ;

CALL ImportField(31210117, 'Индекс данных', 'Progindex', 'Индекс данных (заголовок)', 'Progindex', 1, 312, 0, 1, 'ИндексыДанныхЗаголовок', 0, 18960) ;

CALL ImportField(31210118, 'Статус', 'Status', 'Статус', ' ', 1, 312, 0, 1, 'Статус', 0, 17233) ;

CALL ImportField(31210120, 'Отдел', 'DepartmentCLS', '', 'DEPARTMENTCLS', 1, 312, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(31210121, 'Получатель(Хранимые реквизиты платежа)', 'DestStoredPaymentProps', '', 'DestStoredPaymentProps', 1, 312, 0, 0, 'РеквизитыПлатежаПолуч', 0, 31657) ;

CALL ImportField(31210122, 'Плательщик(Хранимые реквизиты платежа)', 'SourceStoredPaymentProps', '', 'SourceStoredPaymentProps', 1, 312, 0, 0, 'РеквизитыПлатежаПлат', 0, 31658) ;

CALL ImportField(31210123, 'Назначение платежа(Хранимые реквизиты платежа)', 'StoredPaymentNote', '', 'StoredPaymentNote', 1, 312, 0, 0, 'ФорматНазначениеПлатежа', 0, 31659) ;

CALL ImportField(31210124, 'Хранимые реквизиты платежа', 'StoredPaymentProps', '', ' ', 1, 312, 0, 0, '', 0, null) ;

CALL ImportField(31210125, 'УИН', 'UINCode', 'Уникальный идентификатор начисления', 'UINCode', 1, 312, 0, 0, 'УИН', 0, 35367) ;

CALL ImportField(31210126, 'Номер карты', 'CardNumber', 'Номер пластиковой карты', 'CardNumber', 1, 312, 0, 0, 'НомерКарточки', 0, null) ;

CALL ImportField(31211001, 'Код записи', 'Id', 'Код записи', 'Id', 1, 312, 1, 1, 'КодЗаписи', 0, 18865) ;

CALL ImportField(31211005, 'Сумма(руб)', 'SUMMA', 'Сумма', 'SUMMA', 1, 312, 1, 0, 'СуммаЗаписи', 0, 18873) ;

CALL ImportField(31211008, 'Код документа', 'RecordIndex', 'Ссылка на заголовок', 'RecordIndex', 1, 312, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(31211009, 'Операция', 'BuhOperationCLS', 'Бух операция', 'BuhOperationCLS', 1, 312, 1, 0, 'БухОперация', 0, 18919) ;

CALL ImportField(31211010, 'Тип классификации', 'ClsType', 'Тип классификации(расходная, источниковая, доходная)', 'ClsType', 1, 312, 1, 1, 'ТипКлассификации,ТипКлассификацииПлат', 0, 18922) ;

CALL ImportField(31211011, '№ БО получателя', 'DestPROMISE', 'Номер БО получателя', 'DestPROMISE', 1, 312, 1, 0, 'БюджОбяз', 0, 18906) ;

CALL ImportField(31211012, 'Номер Д.И. получателя ссылка', 'DestExecDoc', 'Документ исполнения получателя', 'DestExecDoc', 1, 312, 1, 1, 'ДокИсполнения', 0, 18918) ;

CALL ImportField(31211013, 'Номер БО получателя(договора)', 'DestBudgetPROMISENum', 'Номер БО получателя(договора)', 'DestBudgetPROMISENum', 1, 312, 1, 0, 'ДоговораБОНомер,БОНомер', 0, 20223) ;

CALL ImportField(31211014, 'Вн. номер БО получателя', 'DestBUDGETPROMISE', 'Договора БО получателя', 'DestBUDGETPROMISE', 1, 312, 1, 1, 'ДоговораБОПолуч,БОВнутрНомер', 0, 18909) ;

CALL ImportField(31211015, 'Лицевой счет учреждения', 'DESTFACIALACC_CLS', 'л\с получателя', 'DestFacialAccCls', 1, 312, 1, 0, 'ЛицевойСчет', 0, 18869) ;

CALL ImportField(31211016, 'КВРКлюч', 'DestKVR', 'КВР получателя', 'DestKVRKey', 1, 312, 1, 1, 'КВРКлюч', 0, 18870) ;

CALL ImportField(31211017, 'ЭКР(Классификация)', 'DestKESR', 'КЭСР получателя', 'DestKESR', 1, 312, 1, 0, 'КЭСР', 0, 18871) ;

CALL ImportField(31211018, 'КВСРКлюч', 'DestKVSR', 'КВСР получателя', 'DestKVSRKey', 1, 312, 1, 1, 'КВСРКлюч', 0, 18895) ;

CALL ImportField(31211019, 'КЦСРКлюч', 'DestKCSR', 'КЦСР получателя', 'DestKCSRKey', 1, 312, 1, 1, 'КЦСРКлюч', 0, 18896) ;

CALL ImportField(31211020, 'ФКР(Классификация)', 'DestKFSR', 'КФСР получателя', 'DestKFSR', 1, 312, 1, 0, 'КФСР', 0, 18897) ;

CALL ImportField(31211021, 'Суб КОСГУ', 'DestSUBKESR', 'СубКЭСР получателя', 'DestSUBKESR', 1, 312, 1, 0, 'СубКЭСР', 0, 18898) ;

CALL ImportField(31211022, 'Мероприятие(Классификация)', 'DestFACTCode', 'Мероприятие получателя', 'DestFACTCLS', 1, 312, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(31211023, 'Тип средств', 'DestMEANSTYPE', 'Тип средств получателя', 'DestMEANSTYPECLS', 1, 312, 1, 0, 'ТипСредств', 0, 18900) ;

CALL ImportField(31211024, 'Источник финансирования', 'DestFINSOURCE', 'Источник финансирования получателя', 'DestFINSOURCECLS', 1, 312, 1, 0, 'ИсточникФинансирования', 0, 18901) ;

CALL ImportField(31211025, 'Код доп. информации', 'DestFINTYPECode', 'Код дополнительной информации', 'DestFINTYPECLS', 1, 312, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(31211026, 'Тип документа', 'DestDOCTYPE', 'Тип документа получателя', 'DestDOCTYPECLS', 1, 312, 1, 0, 'ТипДокумента', 0, 18903) ;

CALL ImportField(31211027, 'Направление(Классификация)', 'DestDirectionCLSCode', 'Направление получателя', 'DestDirectionCLS', 1, 312, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(31211045, 'Направление плательщика', 'SourceDirectionCLSCode', 'Направление плательщика', 'SourceDirectionCLS', 1, 312, 1, 1, 'НаправлениеПлат', 0, null) ;

CALL ImportField(31211060, '№ бюдж. обязат-ва получателя', 'DestBudgetPromiseCollaps', 'Бюджетное обязательство получателя', ' ', 1, 312, 1, 0, 'БОВнутрНомерГруппа', 0, null) ;

CALL ImportField(31211061, 'Сумма БО получателя', 'DestBudgetPromiseSumma', 'Сумма БО получателя', 'DestBudgetPromiseSumma', 1, 312, 1, 1, 'ДоговораБОСумма', 0, 20242) ;

CALL ImportField(31211067, 'Номер гос. контракта получателя', 'DestBudgetPromiseSONum', 'Номер гос. контракта получателя', 'DestBudgetPromiseAgrNum', 1, 312, 1, 1, 'ДоговораБОНомерКонтракта', 0, 19798) ;

CALL ImportField(31211068, 'Дата гос. контракта получателя', 'DestBudgetPromiseSODate', 'Дата гос. контракта получателя', 'DestBudgetPromiseAgrDate', 1, 312, 1, 1, 'ДоговораБОДатаКонтракта', 0, 19799) ;

CALL ImportField(31211070, 'Реестровый номер гос. контр получателя', 'DestBudgetPromiseSORNum', 'Реестровый номер гос. контр получателя', 'DestBudgetPromiseAgrReestrNum', 1, 312, 1, 1, 'ДоговораБОРеестрНомерКонтракта', 0, 19830) ;

CALL ImportField(31211071, 'Прим. гос. контракта получателя', 'DestBudgetPromiseSONote', 'Прим. гос. контракта получателя', 'DestBudgetPromiseAgrNote', 1, 312, 1, 1, 'ДоговораБОПримечаниеКонтракта', 0, 19821) ;

CALL ImportField(31211073, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор (расходный источник)', ' ', 1, 312, 1, 0, '', 0, 25472) ;

CALL ImportField(31211074, 'ЭКИ(Классификация)', 'DestIFS_KESR', 'ЭКИ (расходный источник)', ' ', 1, 312, 1, 0, '', 0, 17054) ;

CALL ImportField(31211075, 'Вид источника(Классификация)', 'DestIFS_DescriptionCode', 'Вид источника (расходный источник)', 'DestIFS_DescriptionCode', 1, 312, 1, 0, '', 0, 17050) ;

CALL ImportField(31211076, 'НПА', 'DestDocBaseCode', 'НПА', 'DESTDOCBASE', 1, 312, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(31211096, 'Администратор(Классификация)', 'DestKD_KVSRCode', 'Администратор(КД)', ' ', 1, 312, 1, 0, '', 0, 25472) ;

CALL ImportField(31211097, 'Вид дохода(Классификация)', 'DestKD_DescriptionCode', 'Вид дохода', ' ', 1, 312, 1, 0, '', 0, 16831) ;

CALL ImportField(31211098, 'Подвид дохода(Классификация)', 'DestKD_Program', 'Подвид дохода(КД)', ' ', 1, 312, 1, 0, '', 0, 16834) ;

CALL ImportField(31211099, 'ЭКД(Классификация)', 'DestKD_KESR', 'ЭКД', ' ', 1, 312, 1, 0, '', 0, 16835) ;

CALL ImportField(31211101, 'Район трансферта', 'DestRegionCls', 'Район', 'DESTREGIONCLS', 1, 312, 1, 1, 'Регион,РайонТрансферта', 0, 18928) ;

CALL ImportField(31211107, 'Номер(Док. исполнения получателя)', 'DestExecDocNum', 'Номер', 'DestExecDocNum', 1, 312, 1, 0, 'ДокИсполненияНомер', 0, 19739) ;

CALL ImportField(31211109, 'Источник образования', 'DestFundsSource', 'Источник образования', 'DestFundsSource', 1, 312, 1, 0, 'ИсточникОбразованияСредств', 0, 18929) ;

CALL ImportField(31211110, 'Источниковая классификация', 'DestIFS', 'Источниковая классификация', 'DestIFS', 1, 312, 1, 1, 'ИсточникВнутрФинансированияКлюч', 0, 18921) ;

CALL ImportField(31211111, 'Код дохода', 'DestKD', 'Код дохода', 'DESTKD', 1, 312, 1, 1, 'КДКлюч', 0, 18926) ;

CALL ImportField(31211112, 'Бюджет', 'BUDGETREF', 'Бюджет', ' ', 1, 312, 1, 1, '', 0, 18872) ;

CALL ImportField(31211117, 'Заявка', 'RequestsIndex', 'Заявка', ' ', 1, 312, 1, 1, 'Заявка', 0, 18904) ;

CALL ImportField(31211118, 'Код дохода', 'DestKD_Value', 'Код дохода', ' ', 1, 312, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(31211119, 'Индекс данных', 'Progindex', 'Индекс данных (деталь)', 'Progindex', 1, 312, 1, 1, 'ИндексыДанных', 0, 18877) ;

CALL ImportField(31211120, 'Код целевых средствКлюч', 'DestTransfertCls', 'Код целевых средств получателя (ссылка)', 'DestTransfertCls', 1, 312, 1, 1, 'КодЦелевыхСредствКлюч', 0, 18936) ;

CALL ImportField(31211122, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств получателя', 'DestTransfertClsValue', 1, 312, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(31211125, 'КЦСР(Классификация)', 'DestKCSRCode', 'КЦСР(Классификация)', 'DestKCSR', 1, 312, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(31211127, 'КВР(Классификация)', 'DESTKVRCode', 'КВР(Классификация)', 'DestKVR', 1, 312, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(31211128, 'КВСР(Классификация)', 'DestKVSRCode', 'КВСР(Классификация)', 'DestKVSR', 1, 312, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(31211130, 'Код субсидииКлюч', 'DestSubsidyCls', 'Код субсидии (ссылка)', 'DestSubsidyCls', 1, 312, 1, 1, 'КодСубсидииКлюч', 0, 26624) ;

CALL ImportField(31211131, 'Код субсидии', 'DestSubsidyClsCode', 'Код субсидии', 'DestSubsidyClsCode', 1, 312, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(31211132, 'Код бюджетного ассигнованияКлюч', 'DestBudAllocationCls', '', 'DestBudAllocationCls', 1, 312, 1, 1, 'КодБюджАссигнованияКлюч', 0, 27842) ;

CALL ImportField(31211133, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', 'DestBudAllocationClsCode', 1, 312, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(31211134, 'Код расходного обязательстваКлюч', 'DestPayPromiseCls', '', 'DestPayPromiseCls', 1, 312, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, 27843) ;

CALL ImportField(31211135, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', 'DestPayPromiseClsCode', 1, 312, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(31211136, 'Наименование района трансферта', 'DestRegionClsName', '', ' ', 1, 312, 1, 0, '', 0, null) ;

CALL ImportField(31211137, 'Мероприятие(Ключ)', 'DestFact', 'Мероприятие получателя', 'DestFACTCLSKey', 1, 312, 1, 1, 'МероприятиеКлюч', 0, 18899) ;

CALL ImportField(31211138, 'Направление плательщика (Ключ)', 'SourceDirectionCLS', 'Направление', 'SourceDirectionClsKey', 1, 312, 1, 1, 'НаправлениеПлатКлюч', 0, 18913) ;

CALL ImportField(31211139, 'Направление(Ключ)', 'DestDirectionCLS', 'Направление получателя', 'DestDirectionClsKey', 1, 312, 1, 1, 'НаправлениеКлюч', 0, 18914) ;

CALL ImportField(31211140, 'НПА (Ключ)', 'DestDocBase', 'НПА', 'DESTDOCBASEKEY', 1, 312, 1, 1, 'ТипДокОснованияКлюч', 0, 18916) ;

CALL ImportField(31211141, 'Код доп. информации', 'DestFINTYPE', 'Код дополнительной информации', 'DestFINTYPECLSKey', 1, 312, 1, 1, 'ТипФинансированияКлюч', 0, 18902) ;

CALL ImportField(31211142, 'ОбъектКлюч', 'DestInvestObject', 'Объект', ' ', 1, 312, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(31211143, 'Объект', 'DestInvestObjectCode', 'Объект', ' ', 1, 312, 1, 0, 'Объект', 0, null) ;

-- Возврат со счетов наличности, Бюджет(1)
CALL ImportField(31410121, 'Получатель(Хранимые реквизиты платежа)', 'DestStoredPaymentProps', '', 'DestStoredPaymentProps', 1, 314, 0, 0, 'РеквизитыПлатежаПолуч', 0, 31657) ;

CALL ImportField(31410122, 'Плательщик(Хранимые реквизиты платежа)', 'SourceStoredPaymentProps', '', 'SourceStoredPaymentProps', 1, 314, 0, 0, 'РеквизитыПлатежаПлат', 0, 31658) ;

CALL ImportField(31410123, 'Назначение платежа(Хранимые реквизиты платежа)', 'StoredPaymentNote', '', 'StoredPaymentNote', 1, 314, 0, 0, 'ФорматНазначениеПлатежа', 0, 31659) ;

CALL ImportField(31410124, 'Хранимые реквизиты платежа', 'StoredPaymentProps', '', ' ', 1, 314, 0, 0, '', 0, null) ;

CALL ImportField(31410125, 'УИН', 'UINCode', 'Уникальный идентификатор начисления', 'UINCode', 1, 314, 0, 0, 'УИН', 0, 35367) ;

CALL ImportField(31410126, 'Номер карты', 'CardNumber', 'Номер пластиковой карты', 'CardNumber', 1, 314, 0, 0, 'НомерКарточки', 0, null) ;

CALL ImportField(31411027, 'Направление получателя', 'DestDirectionCLSCode', 'Направление получателя', 'DestDirectionCLS', 1, 314, 1, 1, 'НаправлениеПолуч', 0, 36861) ;

CALL ImportField(31411040, 'Мероприятие', 'SourceFACTCode', 'Мероприятие плательщика', 'SourceFACTCLS', 1, 314, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(31411043, 'Код доп. информации', 'SourceFINTYPECode', 'Код дополнительной информации плательщика', 'SourceFINTYPECLS', 1, 314, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(31411045, 'Направление', 'SourceDirectionCLSCode', 'Направление плательщика', 'SourceDirectionCLS', 1, 314, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(31411075, 'Вид источника(Классификация)', 'SourceIFS_DescriptionCode', 'Вид источника(ИвнФ)', 'SourceIFS_DescriptionCode', 1, 314, 1, 0, '', 0, 17050) ;

CALL ImportField(31411076, 'НПА', 'SourceDocBaseCode', 'НПА', 'SourceDocBase', 1, 314, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(31411096, 'Администратор(Классификация)', 'SourceKD_KVSRCode', 'Администратор(КД)', ' ', 1, 314, 1, 0, '', 0, 25472) ;

CALL ImportField(31411118, 'Код дохода', 'SourceKD_Value', 'Код дохода', 'SourceKDValue', 1, 314, 1, 1, 'КодДохода', 0, 16836) ;

CALL ImportField(31411123, 'Код целевых средств', 'SourceTransfertClsCode', 'Код целевых средств плательщика', 'SourceTransfertClsValue', 1, 314, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(31411125, 'КЦСР(Классификация)', 'SourceKCSRCode', 'КЦСР(Классификация)', 'SourceKCSR', 1, 314, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(31411127, 'КВР(Классификация)', 'SOURCEKVRCode', 'КВР(Классификация)', 'SourceKVR', 1, 314, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(31411128, 'КВСР(Классификация)', 'SourceKVSRCode', 'КВСР(Классификация)', 'SourceKVSR', 1, 314, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(31411130, 'Код субсидии', 'SourceSubsidyClsCode', 'Код субсидии', 'SourceSubsidyClsCode', 1, 314, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(31411132, 'Код бюджетного ассигнования', 'SourceBudAllocationClsCode', '', 'SourceBudAllocationClsCode', 1, 314, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(31411133, 'Код расходного обязательства', 'SourcePayPromiseClsCode', '', 'SourcePayPromiseClsCode', 1, 314, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(31411136, 'Мероприятие (Ключ)', 'SourceFACT', 'Мероприятие плательщика', 'SourceFACTCLSKey', 1, 314, 1, 1, 'МероприятиеКлюч', 0, 18890) ;

CALL ImportField(31411137, 'Направление (Ключ)', 'SourceDirectionCLS', 'Направление плательщика', 'SourceDirectionCLSKey', 1, 314, 1, 1, 'НаправлениеКлюч', 0, 18913) ;

CALL ImportField(31411138, 'Направление получателя (Ключ)', 'DestDirectionCLS', 'Направление получателя', 'DestDirectionCLSKey', 1, 314, 1, 1, 'НаправлениеПолучКлюч', 0, 18914) ;

CALL ImportField(31411139, 'Код доп. информации (Ключ)', 'SourceFINTYPE', 'Код дополнительной информации плательщика', 'SourceFINTYPECLSKey', 1, 314, 1, 1, 'ТипФинансированияКлюч', 0, 18893) ;

CALL ImportField(31411140, 'НПА (Ключ)', 'SourceDocBase', 'НПА', 'SourceDocBaseKey', 1, 314, 1, 1, 'ТипДокОснованияКлюч', 0, 18915) ;

CALL ImportField(31411141, 'ИФДБ', 'SourceIFS_FullID', 'ИФДБ', 'SourceIFS_DescriptionCode', 1, 314, 1, 0, 'ИсточникВнутрФинансирования', 0, null) ;

CALL ImportField(31411142, 'ОбъектКлюч', 'SourceInvestObject', 'Объект', ' ', 1, 314, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(31411143, 'Объект', 'SourceInvestObjectCode', 'Объект', ' ', 1, 314, 1, 0, 'Объект', 0, null) ;

-- Подтверждение возврата со счетов для наличности, Бюджет(1)
CALL ImportField(31510092, 'Получатель(Хранимые реквизиты платежа)', 'DestStoredPaymentProps', '', 'DestStoredPaymentProps', 1, 315, 0, 0, 'РеквизитыПлатежаПолуч', 0, 31657) ;

CALL ImportField(31510093, 'Плательщик(Хранимые реквизиты платежа)', 'SourceStoredPaymentProps', '', 'SourceStoredPaymentProps', 1, 315, 0, 0, 'РеквизитыПлатежаПлат', 0, 31658) ;

CALL ImportField(31510094, 'Назначение платежа(Хранимые реквизиты платежа)', 'StoredPaymentNote', '', 'StoredPaymentNote', 1, 315, 0, 0, 'ФорматНазначениеПлатежа', 0, 31659) ;

CALL ImportField(31510095, 'Хранимые реквизиты платежа', 'StoredPaymentProps', '', ' ', 1, 315, 0, 0, '', 0, null) ;

CALL ImportField(31510096, 'УИН', 'UINCode', 'Уникальный идентификатор начисления', 'UINCode', 1, 315, 0, 0, 'УИН', 0, 35367) ;

CALL ImportField(31510097, 'Номер карты', 'CardNumber', 'Номер пластиковой карты', 'CARDNUMBER', 1, 315, 0, 0, 'НомерКарточки', 0, 18985) ;

CALL ImportField(31511021, 'Мероприятие', 'DestFactCode', 'Мероприятие', 'DestFACTCLS', 1, 315, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(31511022, 'Направление', 'DestDirectionCLSCode', 'Направление', 'DestDirectionCLS', 1, 315, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(31511023, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор ИВФ', ' ', 1, 315, 1, 0, '', 0, 25472) ;

CALL ImportField(31511026, 'Администратор(Классификация)', 'DestKD_KVSRCode', 'Администратор КД', ' ', 1, 315, 1, 0, '', 0, 25472) ;

CALL ImportField(31511045, 'Код доп. информации', 'DestFinTypeCode', 'Код дополнительной информации', 'DestFINTYPECLS', 1, 315, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(31511047, 'НПА', 'DestDocBaseCode', 'НПА', 'DestDocBase', 1, 315, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(31511071, 'Код документа', 'RECORDINDEX', 'Код документа', 'RECORDINDEX', 1, 315, 1, 1, 'КодДокумента', 0, 18878) ;

CALL ImportField(31511081, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств', ' ', 1, 315, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(31511083, 'КЦСР(Классификация)', 'DestKCSRCode', 'КЦСР(Классификация)', 'DestKCSR', 1, 315, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(31511085, 'КВР(Классификация)', 'DESTKVRCode', 'КВР(Классификация)', 'DestKVR', 1, 315, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(31511086, 'КВСР(Классификация)', 'DestKVSRCode', 'КВСР(Классификация)', 'DestKVSR', 1, 315, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(31511088, 'Код субсидии', 'DestSubsidyClsCode', 'Код субсидии', 'DestSubsidyClsCode', 1, 315, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(31511090, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', 'SourceBudAllocationClsCode', 1, 315, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(31511091, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', 'SourcePayPromiseClsCode', 1, 315, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(31511094, 'Направление (Ключ)', 'DestDirectionCLS', 'Направление', 'DestDirectionCLSKey', 1, 315, 1, 1, 'НаправлениеКлюч', 0, 18914) ;

CALL ImportField(31511095, 'Мероприятие', 'DestFact', 'Мероприятие', 'DestFACTCLSKey', 1, 315, 1, 1, 'МероприятиеКлюч', 0, 18899) ;

CALL ImportField(31511096, 'Код доп. информации (Ключ)', 'DestFinType', 'Код дополнительной информации', 'DestFINTYPECLSKey', 1, 315, 1, 1, 'ТипФинансированияКлюч', 0, 18902) ;

CALL ImportField(31511097, 'НПА (Ключ)', 'DestDocBase', 'НПА', 'DestDocBaseKey', 1, 315, 1, 1, 'ТипДокОснованияКлюч', 0, 18916) ;

CALL ImportField(31511098, 'ОбъектКлюч', 'DestInvestObject', 'Объект', ' ', 1, 315, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(31511099, 'Объект', 'DestInvestObjectCode', 'Объект', ' ', 1, 315, 1, 0, 'Объект', 0, null) ;

-- Учет кассовых выплат, Бюджет(1)
CALL ImportField(32210059, 'Счет получателя', 'DestAccount', 'Счет получателя', ' ', 1, 322, 0, 1, 'СчетПолуч', 0, 18958) ;

CALL ImportField(32210077, 'УИН(Информация о платеже)', 'UINCode', 'Уникальный идентификатор начисления', 'UINCode', 1, 322, 0, 0, 'УИН', 0, 35367) ;

CALL ImportField(32211028, 'Мероприятие', 'SourceFactCode', 'Мероприятие', ' ', 1, 322, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(32211029, 'Направление', 'SourceDirectionCLSCode', 'Направление', ' ', 1, 322, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(32211030, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор', ' ', 1, 322, 1, 0, '', 0, 25472) ;

CALL ImportField(32211042, 'Код доп. информации', 'SourceFinTypeCode', 'Код дополнительной информации', ' ', 1, 322, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(32211044, 'НПА', 'SourceDocBaseCode', 'НПА', ' ', 1, 322, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(32211075, 'Код целевых средств', 'SourceTransfertClsCode', 'Код целевых средств', ' ', 1, 322, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(32211077, 'КЦСР(Классификация)', 'SourceKCSRCode', 'КЦСР(Классификация)', ' ', 1, 322, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(32211078, 'КВР(Классификация)', 'SOURCEKVRCode', 'КВР(Классификация)', ' ', 1, 322, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(32211079, 'КВСР(Классификация)', 'SourceKVSRCode', 'КВСР(Классификация)', ' ', 1, 322, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(32211080, 'Код бюджетного ассигнования', 'SourceBudAllocationClsCode', '', ' ', 1, 322, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(32211081, 'Код расходного обязательства', 'SourcePayPromiseClsCode', '', ' ', 1, 322, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(32211085, 'Код субсидии', 'SourceSubsidyClsCode', '', ' ', 1, 322, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(32211086, 'Направление (Ключ)', 'SourceDirectionCLS', 'Направление', ' ', 1, 322, 1, 1, 'НаправлениеКлюч', 0, 18913) ;

CALL ImportField(32211087, 'Мероприятие (Ключ)', 'SourceFact', 'Мероприятие', ' ', 1, 322, 1, 1, 'МероприятиеКлюч', 0, 18890) ;

CALL ImportField(32211088, 'Код доп. информации (Ключ)', 'SourceFinType', 'Код дополнительной информации', ' ', 1, 322, 1, 1, 'ТипФинансированияКлюч', 0, 18893) ;

CALL ImportField(32211089, 'НПА (Ключ)', 'SourceDocBase', 'НПА', ' ', 1, 322, 1, 1, 'ТипДокОснованияКлюч', 0, 18915) ;

CALL ImportField(32211090, 'ОбъектКлюч', 'SourceInvestObject', 'Объект', ' ', 1, 322, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(32211091, 'Объект', 'SourceInvestObjectCode', 'Объект', ' ', 1, 322, 1, 0, 'Объект', 0, null) ;

-- Утверждение ОФ, Бюджет(1)
CALL ImportField(32311019, 'Мероприятие', 'DestFactCode', 'Мероприятие', 'DestFACTCLS', 1, 323, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(32311020, 'Направление', 'DestDirectionCLSCode', 'Направление', 'DestDirectionCLS', 1, 323, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(32311021, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор', ' ', 1, 323, 1, 0, '', 0, 25472) ;

CALL ImportField(32311034, 'Код доп. информации', 'DestFinTypeCode', 'Код дополнительной информации', 'DestFINTYPECLS', 1, 323, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(32311036, 'НПА', 'DestDocBaseCode', 'НПА', 'DESTDOCBASE', 1, 323, 1, 0, 'ТипДокОснования,ТипДокОснованияПолуч', 0, 36865) ;

CALL ImportField(32311038, '№ бюдж. обязат-ва', 'DestPromise', '№ бюдж. обязат-ва', 'DestPROMISE', 1, 323, 1, 0, 'БюджОбяз,БюджОбязПолуч', 0, 18906) ;

CALL ImportField(32311140, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств', 'DestTransfertClsValue', 1, 323, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(32311142, 'КЦСР(Классификация)', 'DestKCSRCode', 'КЦСР(Классификация)', 'DestKCSR', 1, 323, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(32311143, 'КВР (Классификация)', 'DESTKVRCode', 'КВР (Классификация)', 'DestKVR', 1, 323, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(32311144, 'КВСР(Классификация)', 'DestKVSRCode', 'КВСР(Классификация)', 'DestKVSR', 1, 323, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(32311147, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', 'DestBudAllocationClsCode', 1, 323, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(32311148, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', 'DestPayPromiseClsCode', 1, 323, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(32311150, 'Код субсидии', 'DestSubsidyClsCode', '', 'DestSubsidyClsCode', 1, 323, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(32311153, 'Направление (Ключ)', 'DestDirectionCLS', 'Направление', 'DestDirectionCLSKey', 1, 323, 1, 1, 'НаправлениеКлюч', 0, 18914) ;

CALL ImportField(32311154, 'Мероприятие (Ключ)', 'DestFact', 'Мероприятие', 'DestFACTCLSKey', 1, 323, 1, 1, 'МероприятиеКлюч', 0, 18899) ;

CALL ImportField(32311155, 'Код доп. информации (Ключ)', 'DestFinType', 'Код дополнительной информации', 'DestFINTYPECLSKey', 1, 323, 1, 1, 'ТипФинансированияКлюч', 0, 18902) ;

CALL ImportField(32311156, 'НПА (Ключ)', 'DestDocBase', 'НПА', 'DESTDOCBASEKEY', 1, 323, 1, 1, 'ТипДокОснованияКлюч,ТипДокОснованияПолучКлюч', 0, 18916) ;

CALL ImportField(32311157, 'ОбъектКлюч', 'DestInvestObject', 'Объект', ' ', 1, 323, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(32311158, 'Объект', 'DestInvestObjectCode', 'Объект', ' ', 1, 323, 1, 0, 'Объект', 0, null) ;

CALL ImportField(32311159, 'Получатель субсидии(трансферта)', 'TransfertOrg_CalcName', 'Получатель субсидии(трансферта) (Вычислимое поле)', ' ', 1, 323, 1, 0, '', 1, null) ;

CALL ImportField(32311160, 'Получатель субсидии(ИНН)', 'TransfertOrg_INN', 'Получатель субсидии(ИНН)', ' ', 1, 323, 1, 0, '', 0, 16645) ;

CALL ImportField(32311161, 'Получатель субсидии(КПП)', 'TransfertOrg_INN20', 'Получатель субсидии(КПП)', ' ', 1, 323, 1, 0, '', 0, 16653) ;

CALL ImportField(32311162, 'Получатель субсидии(трансферта)', 'TransfertOrg_Name', 'Получатель субсидии(трансферта)', ' ', 1, 323, 1, 0, '', 0, 16646) ;

CALL ImportField(32311163, 'Получатель субсидии(трансферта)', 'TransfertOrg_Ref', 'Получатель субсидии(трансферта)(ссылка)', 'TransfertOrg_Ref', 1, 323, 1, 1, 'ОргПолучСубсидии', 0, 38150) ;

-- Распределение ОФ, Бюджет(1)
CALL ImportField(32411072, 'Мероприятие', 'DestFactCode', 'Мероприятие получ-ля', 'DestFACTCLS', 1, 324, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(32411074, 'Код доп. информации', 'DestFinTypeCode', 'Код дополнительной информации получ-ля', 'DestFINTYPECLS', 1, 324, 1, 0, 'ТипФинансирования,ТипФинансированияПолуч', 0, 36853) ;

CALL ImportField(32411082, 'НПА', 'DestDocBaseCode', 'НПА', 'DESTDOCBASE', 1, 324, 1, 0, 'ТипДокОснования,ТипДокОснованияПолуч', 0, 36865) ;

CALL ImportField(32411084, 'Направление', 'DestDirectionCLSCode', 'Направление получ-ля', 'DestDirectionCLS', 1, 324, 1, 0, 'Направление,НаправлениеПолуч', 0, 36861) ;

CALL ImportField(32411091, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 324, 1, 0, '', 0, 25472) ;

CALL ImportField(32411179, 'Код целевых средств', 'DestTransfertClsCode', 'Код целевых средств получателя', 'DestTransfertClsValue', 1, 324, 1, 0, 'КодЦелевыхСредств,КодЦелевыхСредствПолуч', 0, 25326) ;

CALL ImportField(32411182, 'КЦСР(Классификация)', 'DestKCSRCode', 'КЦСР(Классификация)', 'DestKCSR', 1, 324, 1, 0, 'КЦСР,КЦСРПолуч', 0, 25462) ;

CALL ImportField(32411183, 'КВР(Классификация)', 'DESTKVRCode', 'КВР(Классификация)', 'DestKVR', 1, 324, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(32411184, 'КВСР(Классификация)', 'DestKVSRCode', 'КВСР(Классификация)', 'DestKVSR', 1, 324, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(32411185, 'Источниковая классификация', 'DestIFS_FullID', 'Источниковая классификация', 'DestIFS_DescriptionCode', 1, 324, 1, 1, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(32411188, 'Код бюджетного ассигнования', 'DestBudAllocationClsCode', '', 'DestBudAllocationClsCode', 1, 324, 1, 0, 'КодБюджАссигнования,КодБюджАссигнованияПолуч', 0, 27825) ;

CALL ImportField(32411189, 'Код расходного обязательства', 'DestPayPromiseClsCode', '', 'DestPayPromiseClsCode', 1, 324, 1, 0, 'КодРасходногоОбязательства,КодРасходногоОбязательстваПолуч', 0, 27849) ;

CALL ImportField(32411191, 'Код субсидии', 'DestSubsidyClsCode', '', 'DestSubsidyClsCode', 1, 324, 1, 0, 'КодСубсидии,КодСубсидииПолуч', 0, 26641) ;

CALL ImportField(32411194, 'Мероприятие (Ключ)', 'DestFact', 'Мероприятие получ-ля', 'DestFACTCLSKey', 1, 324, 1, 1, 'МероприятиеКлюч', 0, 18899) ;

CALL ImportField(32411195, 'Направление (Ключ)', 'DestDirectionCls', 'Направление получателя', 'DestDirectionClsKey', 1, 324, 1, 1, 'НаправлениеКлюч,НаправлениеПолучКлюч', 0, 18914) ;

CALL ImportField(32411196, 'Код доп. информации (Ключ)', 'DestFinType', 'Код дополнительной информации', 'DestFINTYPECLSKey', 1, 324, 1, 1, 'ТипФинансированияКлюч,ТипФинансированияПолучКлюч', 0, 18902) ;

CALL ImportField(32411197, 'НПА (Ключ)', 'DestDocBase', 'НПА', 'DESTDOCBASEKey', 1, 324, 1, 1, 'ТипДокОснованияКлюч,ТипДокОснованияПолучКлюч', 0, 18916) ;

CALL ImportField(32411198, 'ОбъектКлюч', 'DestInvestObject', 'Объект', ' ', 1, 324, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(32411199, 'Объект', 'DestInvestObjectCode', 'Объект', ' ', 1, 324, 1, 0, 'Объект', 0, null) ;

CALL ImportField(32411200, 'Получатель субсидии(ИНН)', 'TransfertOrg_INN', 'Получатель субсидии(ИНН)', ' ', 1, 324, 1, 0, '', 0, 16645) ;

CALL ImportField(32411201, 'Получатель субсидии(КПП)', 'TransfertOrg_INN20', 'Получатель субсидии(КПП)', ' ', 1, 324, 1, 0, '', 0, 16653) ;

CALL ImportField(32411202, 'Получатель субсидии(трансферта)', 'TransfertOrg_CalcName', 'Получатель субсидии(трансферта) (Вычислимое поле)', ' ', 1, 324, 1, 0, '', 1, null) ;

CALL ImportField(32411203, 'Получатель субсидии(трансферта)', 'TransfertOrg_Name', 'Получатель субсидии(трансферта)', ' ', 1, 324, 1, 0, '', 0, 16646) ;

CALL ImportField(32411204, 'Получатель субсидии(трансферта)', 'TransfertOrg_Ref', 'Получатель субсидии(трансферта)(ссылка)', 'TransfertOrg_Ref', 1, 324, 1, 1, 'ОргПолучСубсидии', 0, 38150) ;

-- Кредиты от кредитных организаций, Бюджет(1)
CALL ImportField(40110019, 'Мероприятие', 'FactCode', 'Мероприятие', ' ', 1, 401, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(40110034, 'Документ основание (Основание)', 'DocBaseCode', 'Документ основание ', ' ', 1, 401, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(40110221, 'Мероприятие (Ключ)', 'Fact', 'Мероприятие', ' ', 1, 401, 0, 1, 'МероприятиеКлюч', 0, 17980) ;

CALL ImportField(40110222, 'Документ основание (Ключ)', 'DocBase', 'Документ основание ', ' ', 1, 401, 0, 1, 'ТипДокОснованияКлюч', 0, 17995) ;

CALL ImportField(40111045, 'Администратор(Источники внутреннего и внешнего финансирования)', 'IFSKVSRCode', 'Администратор', ' ', 1, 401, 1, 0, '', 0, 25472) ;

CALL ImportField(40111226, 'Счет (*)', 'AccA', '', ' ', 1, 401, 1, 0, '', 0, 17112) ;

CALL ImportField(40111227, 'КПП (*)', 'INN20A', '', ' ', 1, 401, 1, 0, '', 0, 16653) ;

CALL ImportField(40111228, 'ИНН (*)', 'INNA', '', ' ', 1, 401, 1, 0, '', 0, 16645) ;

CALL ImportField(40111229, 'Организация (*)', 'OrgNameA', '', ' ', 1, 401, 1, 0, '', 0, 16646) ;

CALL ImportField(40113071, 'Администратор(Источники внутреннего и внешнего финансирования)', 'IFSKVSRCode', 'Администратор', ' ', 1, 401, 3, 0, '', 0, 25472) ;

CALL ImportField(40113233, 'Счет (*)', 'AccA', '', ' ', 1, 401, 3, 0, '', 0, 17112) ;

CALL ImportField(40113234, 'КПП (*)', 'INN20A', '', ' ', 1, 401, 3, 0, '', 0, 16653) ;

CALL ImportField(40113235, 'ИНН (*)', 'INNA', '', ' ', 1, 401, 3, 0, '', 0, 16645) ;

CALL ImportField(40113236, 'Организация (*)', 'OrgNameA', '', ' ', 1, 401, 3, 0, '', 0, 16646) ;

CALL ImportField(40114235, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 401, 4, 0, '', 0, 25462) ;

CALL ImportField(40114236, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 401, 4, 0, '', 0, 25467) ;

CALL ImportField(40114237, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 401, 4, 0, '', 0, 25472) ;

CALL ImportField(40116126, 'Мероприятие', 'FACTCode', 'Мероприятие', ' ', 1, 401, 6, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(40116127, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 401, 6, 0, '', 0, 36861) ;

CALL ImportField(40116128, 'Тип финансирования', 'FINTYPECode', 'Тип финансирования', ' ', 1, 401, 6, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(40116241, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 401, 6, 0, '', 0, 25462) ;

CALL ImportField(40116242, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 401, 6, 0, '', 0, 25467) ;

CALL ImportField(40116243, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 401, 6, 0, '', 0, 25472) ;

CALL ImportField(40116244, 'Счет (*)', 'AccA', '', ' ', 1, 401, 6, 0, '', 0, 17112) ;

CALL ImportField(40116245, 'КПП (*)', 'INN20A', '', ' ', 1, 401, 6, 0, '', 0, 16653) ;

CALL ImportField(40116246, 'ИНН (*)', 'INNA', '', ' ', 1, 401, 6, 0, '', 0, 16645) ;

CALL ImportField(40116247, 'Организация (*)', 'OrgNameA', '', ' ', 1, 401, 6, 0, '', 0, 16646) ;

CALL ImportField(40116248, 'Направление (Ключ)', 'DirectionCLS', 'Направление', ' ', 1, 401, 6, 1, '', 0, 17867) ;

CALL ImportField(40116249, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 401, 6, 1, 'МероприятиеКлюч', 0, 17829) ;

CALL ImportField(40116250, 'Тип финансирования (Ключ)', 'FINTYPE', 'Тип финансирования', ' ', 1, 401, 6, 1, 'ТипФинансированияКлюч', 0, 17833) ;

CALL ImportField(40118169, 'Администратор(Источники внутреннего и внешнего финансирования)', 'IFSKVSRCode', '', ' ', 1, 401, 8, 0, '', 0, 25472) ;

CALL ImportField(40110190, 'Тип финансирования', 'FINTYPECode', 'Тип финансирования', ' ', 1, 401, 10, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(40110197, 'Мероприятие', 'FACTCode', 'Мероприятие', ' ', 1, 401, 10, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(40110198, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 401, 10, 0, '', 0, 36861) ;

CALL ImportField(40110246, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 401, 10, 0, '', 0, 25462) ;

CALL ImportField(40110247, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 401, 10, 0, '', 0, 25467) ;

CALL ImportField(40110248, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 401, 10, 0, '', 0, 25472) ;

CALL ImportField(40110249, 'Счет (*)', 'AccA', '', ' ', 1, 401, 10, 0, '', 0, 17112) ;

CALL ImportField(40110250, 'КПП (*)', 'INN20A', '', ' ', 1, 401, 10, 0, '', 0, 16653) ;

CALL ImportField(40110251, 'ИНН (*)', 'INNA', '', ' ', 1, 401, 10, 0, '', 0, 16645) ;

CALL ImportField(40110252, 'Организация (*)', 'OrgNameA', '', ' ', 1, 401, 10, 0, '', 0, 16646) ;

CALL ImportField(40110253, 'Направление (Ключ)', 'DirectionCLS', 'Направление', ' ', 1, 401, 10, 1, '', 0, 17867) ;

CALL ImportField(40110254, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 401, 10, 1, 'МероприятиеКлюч', 0, 17829) ;

CALL ImportField(40110255, 'Тип финансирования (Ключ)', 'FINTYPE', 'Тип финансирования', ' ', 1, 401, 10, 1, 'ТипФинансированияКлюч', 0, 17833) ;

-- Ссуды юридическим лицам, Бюджет(1)
CALL ImportField(50110025, 'Мероприятие', 'FactCode', 'Мероприятие', ' ', 1, 501, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(50110029, 'Документ основание(Основание)', 'DocBaseCode', 'Документ основание', ' ', 1, 501, 0, 0, 'ДокументОснование', 0, 36865) ;

CALL ImportField(50110156, 'Мероприятие (Ключ)', 'Fact', 'Мероприятие', ' ', 1, 501, 0, 1, 'МероприятиеКлюч', 0, 17980) ;

CALL ImportField(50110157, 'Документ основание(Ключ)', 'DocBase', 'Документ основание', ' ', 1, 501, 0, 1, 'ДокументОснованиеКлюч', 0, 17995) ;

CALL ImportField(50111043, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 501, 1, 0, 'МероприятиеФин', 0, 36863) ;

CALL ImportField(50111044, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 501, 1, 0, '', 0, 36861) ;

CALL ImportField(50111048, 'Тип финансирования', 'FINTYPECODE', 'Тип финансирования', ' ', 1, 501, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(50111176, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 501, 1, 0, '', 0, 25472) ;

CALL ImportField(50111181, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 501, 1, 0, '', 0, 25462) ;

CALL ImportField(50111182, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 501, 1, 0, '', 0, 25467) ;

CALL ImportField(50111183, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 501, 1, 0, '', 0, 25472) ;

CALL ImportField(50111184, 'Направление (Ключ)', 'DirectionCLS', 'Направление', ' ', 1, 501, 1, 1, '', 0, 17867) ;

CALL ImportField(50111185, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 501, 1, 1, 'МероприятиеФинКлюч', 0, 17829) ;

CALL ImportField(50111186, 'Тип финансирования (Ключ)', 'FINTYPE', 'Тип финансирования', ' ', 1, 501, 1, 1, 'ТипФинансированияКлюч', 0, 17833) ;

CALL ImportField(50113079, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 501, 3, 0, 'МероприятиеФин', 0, 36863) ;

CALL ImportField(50113080, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 501, 3, 0, '', 0, 36861) ;

CALL ImportField(50113084, 'Тип финансирования', 'FINTYPECODE', 'Тип финансирования', ' ', 1, 501, 3, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(50113180, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 501, 3, 0, '', 0, 25472) ;

CALL ImportField(50113185, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 501, 3, 0, '', 0, 25462) ;

CALL ImportField(50113186, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 501, 3, 0, '', 0, 25467) ;

CALL ImportField(50113187, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 501, 3, 0, '', 0, 25472) ;

CALL ImportField(50113188, 'Направление (Ключ)', 'DirectionCLS', 'Направление', ' ', 1, 501, 3, 1, '', 0, 17867) ;

CALL ImportField(50113189, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 501, 3, 1, 'МероприятиеФинКлюч', 0, 17829) ;

CALL ImportField(50113190, 'Тип финансирования (Ключ)', 'FINTYPE', 'Тип финансирования', ' ', 1, 501, 3, 1, 'ТипФинансированияКлюч', 0, 17833) ;

CALL ImportField(50114170, 'КВСР(Код дохода)', 'KVSRCode', 'КВСР(Код дохода)', ' ', 1, 501, 4, 0, '', 0, 25472) ;

CALL ImportField(50116122, 'На счет ФО', 'INCACCOUNTName', 'На счет ФО', ' ', 1, 501, 6, 0, '', 0, 17112) ;

CALL ImportField(50116175, 'КВСР(Код дохода)', 'KVSRCode', 'КВСР(Код дохода)', ' ', 1, 501, 6, 0, '', 0, 25472) ;

-- Распоряжения на финансирование, Бюджет(1)
CALL ImportField(70111012, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 701, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(70111013, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 701, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(70111014, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор', ' ', 1, 701, 1, 0, '', 0, 25472) ;

CALL ImportField(70111021, 'Тип финансирования', 'FINTYPECODE', 'Тип финансирования', ' ', 1, 701, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(70111042, 'Документ-основание', 'DOCUMENTBASETYPECode', 'Документ-основание', ' ', 1, 701, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(70111066, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 701, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(70111067, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 701, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(70111068, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 701, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(70111069, 'Код целевых средcтв', 'TransfertClsCode', '', ' ', 1, 701, 1, 0, '', 0, 25326) ;

CALL ImportField(70111070, 'Направление', 'DirectionCLS', 'Направление', ' ', 1, 701, 1, 1, 'НаправлениеКлюч', 0, 17867) ;

CALL ImportField(70111071, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 701, 1, 1, 'МероприятиеКлюч', 0, 17829) ;

CALL ImportField(70111072, 'Тип финансирования', 'FINTYPE', 'Тип финансирования', ' ', 1, 701, 1, 1, 'ТипФинансированияКлюч', 0, 17833) ;

CALL ImportField(70111073, 'Документ-основание (Ключ)', 'DOCUMENTBASETYPE', 'Документ-основание', ' ', 1, 701, 1, 1, 'ТипДокОснованияКлюч', 0, 17863) ;

-- Свободное финансирование, Бюджет(1)
CALL ImportField(70310009, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 703, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(70310010, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 703, 0, 0, 'Направление', 0, 36861) ;

CALL ImportField(70310011, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор', ' ', 1, 703, 0, 0, '', 0, 25472) ;

CALL ImportField(70310020, 'Тип финансирования', 'FINTYPECode', 'Тип финансирования', ' ', 1, 703, 0, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(70310049, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 703, 0, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(70310050, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 703, 0, 0, 'КВР', 0, 25467) ;

CALL ImportField(70310051, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 703, 0, 0, 'КВСР', 0, 25472) ;

CALL ImportField(70310052, 'Направление', 'DirectionCLS', 'Направление', ' ', 1, 703, 0, 1, 'НаправлениеКлюч', 0, 17867) ;

CALL ImportField(70310053, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 703, 0, 1, 'МероприятиеКлюч', 0, 17829) ;

CALL ImportField(70310054, 'Тип финансирования', 'FINTYPE', 'Тип финансирования', ' ', 1, 703, 0, 1, 'ТипФинансированияКлюч', 0, 17833) ;

-- Объемы финансирования, Бюджет(1)
CALL ImportField(80111008, 'Направление', 'DIRECTIONCLSCODE', 'Направление', 'DIRECTIONCLS', 1, 801, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(80111009, 'Документ-основание', 'DocBaseCode', 'Документ-основание', 'DocBase', 1, 801, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(80111014, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'FactCLS', 1, 801, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(80111017, 'Тип финансирования', 'FINTYPECODE', 'Тип финансирования', 'FinTypeCLS', 1, 801, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(80111020, 'ИНН(Организация)', 'INN', 'ИНН', ' ', 1, 801, 1, 0, '', 0, 16645) ;

CALL ImportField(80111035, 'Район', 'REGIONCLS', 'Район', 'REGIONCLS', 1, 801, 1, 0, 'Регион,РайонТрансферта', 0, 18672) ;

CALL ImportField(80111045, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(ИВнФ)', ' ', 1, 801, 1, 0, '', 0, 25472) ;

CALL ImportField(80111056, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 801, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(80111058, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'KCSR', 1, 801, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(80111059, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'KVR', 1, 801, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(80111060, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'KVSR', 1, 801, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(80111076, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 801, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(80111080, 'Направление (Ключ)', 'DIRECTIONCLS', 'Направление', 'DIRECTIONCLSKEY', 1, 801, 1, 1, 'НаправлениеКлюч', 0, 18663) ;

CALL ImportField(80111081, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', 'FactCLSKey', 1, 801, 1, 1, 'МероприятиеКлюч', 0, 18636) ;

CALL ImportField(80111082, 'Тип финансирования (Ключ)', 'FINTYPE', 'Тип финансирования', 'FinTypeCLSKey', 1, 801, 1, 1, 'ТипФинансированияКлюч', 0, 18634) ;

CALL ImportField(80111083, 'Документ-основание (Ключ)', 'DocBase', 'Документ-основание', 'DocBaseKey', 1, 801, 1, 1, 'ТипДокОснованияКлюч', 0, 18664) ;

CALL ImportField(80111084, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 801, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(80111085, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 801, 1, 0, 'Объект', 0, null) ;

-- Объемы финансирования (линейно), Бюджет(1)
CALL ImportField(80210011, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 802, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(80210012, 'Направление(Классификация)', 'DirectionCLSCode', 'Направление', ' ', 1, 802, 0, 0, 'Направление', 0, 36861) ;

CALL ImportField(80210026, 'Тип финансирования', 'FinTypeCode', 'Тип финансирования', ' ', 1, 802, 0, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(80210036, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 802, 0, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(80210037, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 802, 0, 0, 'КВР', 0, 25467) ;

CALL ImportField(80210038, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 802, 0, 0, 'КВСР', 0, 25472) ;

CALL ImportField(80210039, 'Направление(Ключ)', 'DirectionCLS', 'Направление', ' ', 1, 802, 0, 1, 'НаправлениеКлюч', 0, 18663) ;

CALL ImportField(80210040, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 802, 0, 1, 'МероприятиеКлюч', 0, 18636) ;

CALL ImportField(80210041, 'Тип финансирования (Ключ)', 'FinType', 'Тип финансирования', ' ', 1, 802, 0, 1, 'ТипФинансированияКлюч', 0, 18634) ;

CALL ImportField(80210042, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 802, 0, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(80210043, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 802, 0, 0, 'Объект', 0, null) ;

-- Заявки на выделение объемов финансирования, Бюджет(1)
CALL ImportField(80311016, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 803, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(80311017, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор', ' ', 1, 803, 1, 0, '', 0, 25472) ;

CALL ImportField(80311028, 'Тип финансирования', 'FinTypeCode', 'Тип финансирования', ' ', 1, 803, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(80311036, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 803, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(80311049, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 803, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(80311050, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 803, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(80311051, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 803, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(80311052, 'Направление (Ключ)', 'DirectionCLS', 'Направление', ' ', 1, 803, 1, 1, 'НаправлениеКлюч', 0, 18663) ;

CALL ImportField(80311053, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 803, 1, 1, 'МероприятиеКлюч', 0, 18636) ;

CALL ImportField(80311054, 'Тип финансирования (Ключ)', 'FinType', 'Тип финансирования', ' ', 1, 803, 1, 1, 'ТипФинансированияКлюч', 0, 18634) ;

CALL ImportField(80311055, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 803, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(80311056, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 803, 1, 0, 'Объект', 0, null) ;

-- Доходы, Бюджет(1)
CALL ImportField(90010001, 'Счет ФО', '{РусПоле("РСФО")}', 'Счет ФО', ' ', 1, 900, 0, 0, 'РСФО', 0, null) ;

CALL ImportField(90011008, 'Лицевой счет', '{РусПоле("ЛицевойСчет")}', 'Лицевой счет', ' ', 1, 900, 1, 0, 'ЛицевойСчет', 0, null) ;

-- Распоряжение на возврат доходов, Бюджет(1)
CALL ImportField(90111014, 'Мероприятие', 'FactCode', 'Мероприятие', ' ', 1, 901, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(90111053, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 901, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(90111057, 'Администратор(Классификация)', 'KD_KVSRCode', 'Администратор', ' ', 1, 901, 1, 0, '', 0, 25472) ;

CALL ImportField(90111061, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 901, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(90111065, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 901, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(90111066, 'Администратор(Классификация)', 'IFS_KVSRCode', '', ' ', 1, 901, 1, 0, '', 0, 25472) ;

CALL ImportField(90111067, 'Направление (Ключ)', 'DirectionCLS', 'Направление', ' ', 1, 901, 1, 1, 'НаправлениеКлюч', 0, 17733) ;

CALL ImportField(90111068, 'Мероприятие (Ключ)', 'Fact', 'Мероприятие', ' ', 1, 901, 1, 1, 'МероприятиеКлюч', 0, 17710) ;

-- Внутренние операции (доходы), Бюджет(1)
CALL ImportField(90210033, 'С Мероприятия', 'FactFromCode', 'С Мероприятия', ' ', 1, 902, 0, 0, 'СМероприятия', 0, 36863) ;

CALL ImportField(90210034, 'На Мероприятие', 'FactToCode', 'На Мероприятие', ' ', 1, 902, 0, 0, 'НаМероприятие', 0, 36863) ;

CALL ImportField(90210044, 'Администратор(С Кода дохода)', 'KDKVSRFromCode', 'Администратор', ' ', 1, 902, 0, 0, '', 0, 25472) ;

CALL ImportField(90210045, 'Администратор(На Код дохода)', 'KDKVSRToCode', 'Администратор', ' ', 1, 902, 0, 0, '', 0, 25472) ;

CALL ImportField(90210046, 'С Кода целевых средств', 'TransfertClsFromCode', 'С Кода целевых средств', ' ', 1, 902, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(90210047, 'На Код целевых средств', 'TransfertClsToCode', 'На Код целевых средств', ' ', 1, 902, 0, 0, '', 0, 25326) ;

CALL ImportField(90210050, 'На Мероприятие (Ключ)', 'FactTo', 'На Мероприятие', ' ', 1, 902, 0, 1, 'НаМероприятиеКлюч', 0, 17710) ;

CALL ImportField(90210051, 'С Мероприятия (Ключ)', 'FactFrom', 'С Мероприятия', ' ', 1, 902, 0, 1, 'СМероприятияКлюч', 0, 17710) ;

-- Выписка по доходам, Бюджет(1)
CALL ImportField(90311016, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 903, 1, 0, '', 0, 25472) ;

CALL ImportField(90311019, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор', ' ', 1, 903, 1, 0, '', 0, 25472) ;

CALL ImportField(90311041, 'ОКАТО', 'OKATO', 'OKATO', 'OKATO', 1, 903, 1, 1, 'ОКАТО', 0, 17728) ;

CALL ImportField(90311042, 'Уточнение ОКАТО', 'ADDOKATO', 'Уточнение ОКАТО', 'AddOKATO', 1, 903, 1, 1, 'УточнениеОКАТО', 0, 17729) ;

CALL ImportField(90311048, 'Мероприятие', 'FactCode', 'Мероприятие', 'Fact', 1, 903, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(90311049, 'НПА', 'DocBaseCode', 'НПА', 'DocBase', 1, 903, 1, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(90311057, 'Направление', 'DirectionCLSCode', 'Направление', 'DirectionCls', 1, 903, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(90311068, 'Код причины отклонения', 'RejectCLS', 'Код причины отклонения(деталь)', ' ', 1, 903, 1, 0, '', 0, 17730) ;

CALL ImportField(90311076, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 903, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(90311080, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 903, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(90311086, 'УИН', 'UINCode', 'Уникальный идентификатор начисления', 'UINCode', 1, 903, 1, 0, 'УИН', 0, 35368) ;

CALL ImportField(90311087, 'Код доп. информации (Ключ)', 'FinType', 'Код дополнительной информации', 'FINTYPEKey', 1, 903, 1, 1, 'ТипФинансированияКлюч', 0, 36856) ;

CALL ImportField(90311088, 'Код доп. информации', 'FinTypeCode', 'Код дополнительной информации', 'FINTYPE', 1, 903, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(90311089, 'Направление (Ключ)', 'DirectionCLS', 'Направление', 'DirectionClsKey', 1, 903, 1, 1, 'НаправлениеКлюч', 0, 17733) ;

CALL ImportField(90311090, 'Мероприятие (Ключ)', 'Fact', 'Мероприятие', 'FactKey', 1, 903, 1, 1, 'МероприятиеКлюч', 0, 17710) ;

CALL ImportField(90311091, 'НПА (Ключ)', 'DocBase', 'НПА', 'DocBaseKey', 1, 903, 1, 1, 'ТипДокОснованияКлюч', 0, 17709) ;

CALL ImportField(90311092, 'Причина отклонения (комментарий)', 'RejectCause', 'Причина отклонения (комментарий) (деталь)', ' ', 1, 903, 1, 0, '', 0, null) ;

CALL ImportField(90311093, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 903, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(90311094, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 903, 1, 0, 'Объект', 0, null) ;

-- Суммы в пути, Бюджет(1)
CALL ImportField(90510005, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор', ' ', 1, 905, 0, 0, '', 0, 25472) ;

CALL ImportField(90510027, 'НПА', 'DocBaseCode', 'НПА', ' ', 1, 905, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(90510032, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 905, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(90510034, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 905, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(90510039, 'Администратор(Классификация)', 'IFS_KVSRCode', '', ' ', 1, 905, 0, 0, '', 0, 25472) ;

CALL ImportField(90510040, 'Код доп. информации (Ключ)', 'FinType', 'Код дополнительной информации', 'FINTYPEKey', 1, 905, 0, 1, '', 0, 36856) ;

CALL ImportField(90510041, 'Код доп. информации', 'FinTypeCode', 'Код дополнительной информации', 'FINTYPE', 1, 905, 0, 0, '', 0, 36853) ;

CALL ImportField(90510042, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 905, 0, 1, 'МероприятиеКлюч', 0, 17710) ;

CALL ImportField(90510043, 'НПА (Ключ)', 'DocBase', 'НПА', ' ', 1, 905, 0, 1, 'ТипДокОснованияКлюч', 0, 17709) ;

CALL ImportField(90510044, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 905, 0, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(90510045, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 905, 0, 0, 'Объект', 0, null) ;

-- Невыясненные поступления (устарел), Бюджет(1)
CALL ImportField(90610005, 'Администратор(Код дохода)', 'KDKVSRCode', 'Администратор', ' ', 1, 906, 0, 0, '', 0, 25472) ;

CALL ImportField(90610055, 'Мероприятие', 'FactCode', 'Мероприятие', ' ', 1, 906, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(90610075, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 906, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(90610077, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 906, 0, 0, 'Направление', 0, 36861) ;

CALL ImportField(90610078, 'Направление (Ключ)', 'DirectionCLS', 'Направление', ' ', 1, 906, 0, 1, 'НаправлениеКлюч', 0, 17733) ;

CALL ImportField(90610079, 'Мероприятие (Ключ)', 'Fact', 'Мероприятие', ' ', 1, 906, 0, 1, 'МероприятиеКлюч', 0, 17710) ;

CALL ImportField(90610080, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 906, 0, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(90610081, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 906, 0, 0, 'Объект', 0, null) ;

CALL ImportField(90611027, 'Администратор(Код дохода)', 'KDKVSRCode', 'Администратор', ' ', 1, 906, 1, 0, '', 0, 25472) ;

CALL ImportField(90611047, 'Мероприятие', 'FactCode', 'Мероприятие', ' ', 1, 906, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(90611076, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 906, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(90611078, 'Направление', 'DirectionClsCode', 'Направление', ' ', 1, 906, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(90611081, 'Код субсидии', 'SubsidyClsCode', '', ' ', 1, 906, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(90611082, 'Код доп. информации (Ключ)', 'FinType', 'Код дополнительной информации', ' ', 1, 906, 1, 1, '', 0, 36856) ;

CALL ImportField(90611083, 'Код доп. информации', 'FinTypeCode', 'Код дополнительной информации', ' ', 1, 906, 1, 0, '', 0, 36853) ;

CALL ImportField(90611084, 'Направление (Ключ)', 'DirectionCls', 'Направление', ' ', 1, 906, 1, 1, 'НаправлениеКлюч', 0, 17733) ;

CALL ImportField(90611085, 'Мероприятие (Ключ)', 'Fact', 'Мероприятие', ' ', 1, 906, 1, 1, 'МероприятиеКлюч', 0, 17710) ;

CALL ImportField(90611086, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 906, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(90611087, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 906, 1, 0, 'Объект', 0, null) ;

-- Оперативные данные (доходы), Бюджет(1)
CALL ImportField(90710004, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор', ' ', 1, 907, 0, 0, '', 0, 25472) ;

CALL ImportField(90710042, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 907, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(90710044, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 907, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(90710049, 'Направление', 'DirectionClsCode', 'Направление', ' ', 1, 907, 0, 0, 'Направление', 0, 36861) ;

CALL ImportField(90710050, 'Администратор(Классификация)', 'IFS_KVSRCode', '', ' ', 1, 907, 0, 0, '', 0, 25472) ;

CALL ImportField(90710052, 'Код субсидии', 'SubsidyClsCode', '', ' ', 1, 907, 0, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(90710053, 'ОКТМО', 'OKTMO', '', ' ', 1, 907, 0, 0, 'ОКТМО', 0, null) ;

CALL ImportField(90710054, 'Направление (Ключ)', 'DirectionCls', 'Направление', ' ', 1, 907, 0, 1, 'НаправлениеКлюч', 0, 17733) ;

CALL ImportField(90710055, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 907, 0, 1, 'МероприятиеКлюч', 0, 17710) ;

CALL ImportField(90710056, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 907, 0, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(90710057, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 907, 0, 0, 'Объект', 0, null) ;

-- Закрытие года, Бюджет(1)
CALL ImportField(120110010, 'Администратор(Прямая классификация)', 'IFS_KVSRCode', 'Администратор', ' ', 1, 1201, 0, 0, '', 0, 25472) ;

CALL ImportField(120110013, 'Администратор(Прямая классификация)', 'KDKVSRCode', 'Администратор', ' ', 1, 1201, 0, 0, '', 0, 25472) ;

CALL ImportField(120110034, 'Тип средств (прямой)', 'MeansType', 'Тип средств', ' ', 1, 1201, 0, 0, 'ТипСредств', 0, 17340) ;

CALL ImportField(120110045, 'КЦСР(Корреспондирующая классификация)', 'KCSR_corrCode', 'КЦСР(Корреспондирующая классификация)', ' ', 1, 1201, 0, 0, '', 0, 25462) ;

CALL ImportField(120110046, 'КЦСР(Прямая классификация)', 'KCSRCode', 'КЦСР(Прямая классификация)', ' ', 1, 1201, 0, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(120110047, 'Администратор(Корреспондирующая классификация)', 'KDKVSR_corrCode', 'Администратор', ' ', 1, 1201, 0, 0, '', 0, 25472) ;

CALL ImportField(120110049, 'КВР(Корреспондирующая классификация)', 'KVR_corrCode', 'КВР(Корреспондирующая классификация)', ' ', 1, 1201, 0, 0, '', 0, 25467) ;

CALL ImportField(120110050, 'КВР(Прямая классификация)', 'KVRCode', 'КВР(Прямая классификация)', ' ', 1, 1201, 0, 0, 'КВР', 0, 25467) ;

CALL ImportField(120110051, 'КВСР (Корреспондирующая классификация)', 'KVSR_corrCode', 'КВСР (Корреспондирующая классификация)', ' ', 1, 1201, 0, 0, '', 0, 25472) ;

CALL ImportField(120110052, 'КВСР(Прямая классификация)', 'KVSRCode', 'КВСР(Прямая классификация)', ' ', 1, 1201, 0, 0, 'КВСР', 0, 25472) ;

CALL ImportField(120110053, 'Направление(Прямая классификация)', 'DirectionCLSCode', 'Направление(Прямая классификация)', ' ', 1, 1201, 0, 1, 'Направление', 0, 36861) ;

CALL ImportField(120110054, 'Направление(Корреспондирующая классификация)', 'DirectionCLS_corrCode', 'Направление(Корреспондирующая классификация)', ' ', 1, 1201, 0, 1, 'НаправлениеНовый', 0, 36861) ;

CALL ImportField(120110057, 'Мероприятие', 'FactCode', 'Мероприятие', ' ', 1, 1201, 0, 1, 'Мероприятие', 0, 36863) ;

CALL ImportField(120110058, 'Мероприятие', 'Fact_corrCode', 'Мероприятие', ' ', 1, 1201, 0, 1, 'МероприятиеНовый', 0, 36863) ;

CALL ImportField(120110061, 'Тип финансирования', 'FinTypeCode', 'Тип финансирования', ' ', 1, 1201, 0, 1, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(120110062, 'Тип финансирования', 'FinType_corrCode', 'Тип финансирования', ' ', 1, 1201, 0, 1, 'ТипФинансированияНовый', 0, 36853) ;

CALL ImportField(120110065, 'Администратор(Корреспондирующая классификация)', 'IFS_KVSR_corrCode', 'Администратор(Корреспондирующая классификация)', ' ', 1, 1201, 0, 0, '', 0, 25472) ;

CALL ImportField(120110066, 'Тип средств (корренспондирующий)', 'MeansType_corr', 'Тип средств', ' ', 1, 1201, 0, 0, 'ТипСредствНовый', 0, 17372) ;

CALL ImportField(120110073, 'Направление(Корреспондирующая классификация)(Ключ)', 'DirectionCLS_corr', 'Направление(Корреспондирующая классификация)', ' ', 1, 1201, 0, 1, 'НаправлениеНовыйКлюч', 0, 17380) ;

CALL ImportField(120110074, 'Направление(Прямая классификация)(Ключ)', 'DirectionCLS', 'Направление(Прямая классификация)', ' ', 1, 1201, 0, 1, 'НаправлениеКлюч', 0, 17379) ;

CALL ImportField(120110075, 'Мероприятие (Ключ)', 'Fact', 'Мероприятие', ' ', 1, 1201, 0, 1, 'МероприятиеКлюч', 0, 17370) ;

CALL ImportField(120110076, 'Мероприятие (Ключ)', 'Fact_corr', 'Мероприятие', ' ', 1, 1201, 0, 1, 'МероприятиеНовыйКлюч', 0, 17371) ;

CALL ImportField(120110077, 'Тип финансирования (Ключ)', 'FinType', 'Тип финансирования', ' ', 1, 1201, 0, 1, 'ТипФинансированияКлюч', 0, 17381) ;

CALL ImportField(120110078, 'Тип финансирования (Ключ)', 'FinType_corr', 'Тип финансирования', ' ', 1, 1201, 0, 1, 'ТипФинансированияНовыйКлюч', 0, 17382) ;

-- Оперативные данные, Бюджет(1)
CALL ImportField(150110008, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 1501, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(150110009, 'Направление(Классификация)', 'DirectionCLSCode', 'Направление', ' ', 1, 1501, 0, 0, 'Направление', 0, 36861) ;

CALL ImportField(150110015, 'Тип финансирования', 'FINTYPECODE', 'Тип финансирования', ' ', 1, 1501, 0, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(150110017, 'Документ-основание', 'DocBaseCode', 'Документ-основание', ' ', 1, 1501, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(150110041, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', ' ', 1, 1501, 0, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(150110042, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', ' ', 1, 1501, 0, 0, 'КВР', 0, 25467) ;

CALL ImportField(150110043, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', ' ', 1, 1501, 0, 0, 'КВСР', 0, 25472) ;

CALL ImportField(150110049, 'Администратор(Классификация)', 'IFS_KVSRCode', '', ' ', 1, 1501, 0, 0, '', 0, 25472) ;

CALL ImportField(150110051, 'Код целевых средств', 'TransfertCLSCode', '', ' ', 1, 1501, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(150110052, 'Направление(Ключ)', 'DirectionCLS', 'Направление', ' ', 1, 1501, 0, 1, 'НаправлениеКлюч', 0, 18412) ;

CALL ImportField(150110053, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 1501, 0, 1, 'МероприятиеКлюч', 0, 18407) ;

CALL ImportField(150110054, 'Тип финансирования (Ключ)', 'FINTYPE', 'Тип финансирования', ' ', 1, 1501, 0, 1, 'ТипФинансированияКлюч', 0, 18387) ;

CALL ImportField(150110055, 'Документ-основание (Ключ)', 'DocBase', 'Документ-основание', ' ', 1, 1501, 0, 1, 'ТипДокОснованияКлюч', 0, 18413) ;

-- Бюджетные обязательства, Бюджет(1)
CALL ImportField(160110051, 'Причина отклонения', 'Reject_Cls', 'Причина отклонения', 'RejectCls', 1, 1601, 0, 0, 'ПричинаОтклонКод', 0, 17604) ;

CALL ImportField(160111026, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'FactCls', 1, 1601, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(160111028, 'Тип финансирования', 'FinTypeCode', 'Тип финансирования', 'FinTypeCls', 1, 1601, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(160111045, 'Район трансферта', 'RegionCls', 'Район', 'RegionCls', 1, 1601, 1, 1, 'Район,РайонТрансферта,Регион', 0, 19032) ;

CALL ImportField(160111052, 'Направление(Классификация)', 'DirectionCLSCode', 'Направление', 'DirectionCLS', 1, 1601, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(160111073, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 1601, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(160111074, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'KCSR', 1, 1601, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(160111075, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'KVR', 1, 1601, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(160111076, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'KVSR', 1, 1601, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(160111077, 'Код субсидий', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 1601, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(160111079, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 1601, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(160111082, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 1601, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(160111085, 'Направление(Ключ)', 'DirectionCLS', 'Направление', 'DirectionCLSKey', 1, 1601, 1, 1, 'НаправлениеКлюч', 0, 19057) ;

CALL ImportField(160111086, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', 'FactClsKey', 1, 1601, 1, 1, 'МероприятиеКлюч', 0, 19025) ;

CALL ImportField(160111087, 'Тип финансирования (Ключ)', 'FinType', 'Тип финансирования', 'FinTypeClsCode', 1, 1601, 1, 1, 'ТипФинансированияКлюч', 0, 19029) ;

-- БО.Обязательства - линейно, Бюджет(1)
CALL ImportField(160210016, 'Мероприятие', 'FACTCODE', 'Мероприятие', ' ', 1, 1602, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(160210023, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 1602, 0, 0, 'Направление', 0, 36861) ;

CALL ImportField(160210025, 'Тип финансирования', 'FinTypeCode', 'Тип финансирования', ' ', 1, 1602, 0, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(160210031, 'Второй плановый год', 'SUMMAYEAR2', 'Второй плановый год', ' ', 1, 1602, 0, 0, 'ОбязНаВторойГод', 0, 19073) ;

CALL ImportField(160210032, 'Третий плановый год', 'SUMMAYEAR3', 'Третий плановый год', ' ', 1, 1602, 0, 0, 'ОбязНаТретийГод', 0, 19074) ;

CALL ImportField(160210034, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 1602, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(160210035, 'КЦСР', 'KCSRCode', 'КЦСР', ' ', 1, 1602, 0, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(160210036, 'КВР', 'KVRCode', 'КВР', ' ', 1, 1602, 0, 0, 'КВР', 0, 25467) ;

CALL ImportField(160210037, 'КВСР', 'KVSRCode', 'КВСР', ' ', 1, 1602, 0, 0, 'КВСР', 0, 25472) ;

CALL ImportField(160210039, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 1, 1602, 0, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(160210043, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 1, 1602, 0, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(160210044, 'Код субсидий', 'SubsidyClsCode', '', ' ', 1, 1602, 0, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(160210045, 'Направление (Ключ)', 'DirectionCLS', 'Направление', ' ', 1, 1602, 0, 1, 'НаправлениеКлюч', 0, 19057) ;

CALL ImportField(160210046, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', ' ', 1, 1602, 0, 1, 'МероприятиеКлюч', 0, 19025) ;

CALL ImportField(160210047, 'Тип финансирования', 'FinType', 'Тип финансирования', ' ', 1, 1602, 0, 1, 'ТипФинансированияКлюч', 0, 19029) ;

-- Заявки, Бюджет(1)
CALL ImportField(170110008, 'Направление', 'DIRECTIONCLSCODE', 'Направление', 'DIRECTIONCLS', 1, 1701, 0, 0, 'Направление', 0, 36861) ;

CALL ImportField(170110011, 'НПА (ключ)', 'DOCUMENTBASETYPE', 'НПА (ключ)', 'DOCUMENTBASETYPEKey', 1, 1701, 0, 0, 'ТипДокОснованияКлюч', 0, 19157) ;

CALL ImportField(170110018, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'FACT', 1, 1701, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(170110021, 'Тип финансирования', 'FINTYPECODE', 'Тип финансирования', 'FINTYPE', 1, 1701, 0, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(170110062, 'Администратор(Классификация)', 'KDKVSRCode', 'администратор(КД)', ' ', 1, 1701, 0, 0, '', 0, 25472) ;

CALL ImportField(170110080, 'Администратор(Классификация)', 'FSKVSRCode', 'Администратор(ИВнФ)', ' ', 1, 1701, 0, 0, '', 0, 25472) ;

CALL ImportField(170110081, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'KCSR', 1, 1701, 0, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(170110083, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'KVR', 1, 1701, 0, 0, 'КВР', 0, 25467) ;

CALL ImportField(170110084, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'KVSR', 1, 1701, 0, 0, 'КВСР', 0, 25472) ;

CALL ImportField(170110086, 'Код субсидии', 'SubsidyClsCode', '', 'SUBSIDYCLS', 1, 1701, 0, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(170110088, 'Код бюджетного ассигнования', 'BudAllocationCLSCode', '', 'BudAllocationCLS', 1, 1701, 0, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(170110091, 'Код целевых средств', 'TransfertCLSCode', '', 'TransfertCLS', 1, 1701, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(170110092, 'Код расходного обязательства', 'PayPromiseCLSCode', '', 'PayPromiseCLS', 1, 1701, 0, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(170110093, 'Направление (Ключ)', 'DIRECTIONCLS', 'Направление', 'DIRECTIONCLSKEY', 1, 1701, 0, 1, 'НаправлениеКлюч', 0, 19174) ;

CALL ImportField(170110094, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', 'FACTKEY', 1, 1701, 0, 1, 'МероприятиеКлюч', 0, 19139) ;

CALL ImportField(170110095, 'Тип финансирования (Ключ)', 'FINTYPE', 'Тип финансирования', 'FINTYPEKEY', 1, 1701, 0, 1, 'ТипФинансированияКлюч', 0, 19141) ;

CALL ImportField(170110096, 'НПА', 'DocumentBaseTypeCode', 'НПА', 'DOCUMENTBASETYPE', 1, 1701, 0, 0, 'ТипДокОснования', 0, 36865) ;

-- Заявки(старые), Бюджет(1)
CALL ImportField(170210032, 'Мероприятие', 'FactCode', 'Мероприятие(Классификация)', ' ', 1, 1702, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(170210034, 'Направление(Классификация)', 'DirectionCLSCode', 'Направление(Классификация)', ' ', 1, 1702, 0, 0, 'Направление', 0, 36861) ;

CALL ImportField(170210047, 'Тип финансирования', 'FinTypeCode', 'Тип финансирования', ' ', 1, 1702, 0, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(170210051, 'Направление(Ключ)', 'DirectionCLS', 'Направление(Классификация)', ' ', 1, 1702, 0, 1, 'НаправлениеКлюч', 0, 19174) ;

CALL ImportField(170210052, 'Мероприятие (Ключ)', 'Fact', 'Мероприятие(Классификация)', ' ', 1, 1702, 0, 1, 'МероприятиеКлюч', 0, 19139) ;

CALL ImportField(170210053, 'Тип финансирования (Ключ)', 'FinType', 'Тип финансирования', ' ', 1, 1702, 0, 1, 'ТипФинансированияКлюч', 0, 19141) ;

-- Буферный интерфейс поступлений, Бюджет(1)
CALL ImportField(180510001, 'Статус', 'AutoProcessing', 'Статус', ' ', 1, 1805, 0, 0, '', 0, 19300) ;

CALL ImportField(180510007, 'Дата документа', 'DD', 'Дата документа', ' ', 1, 1805, 0, 0, '', 0, 19312) ;

CALL ImportField(180510010, 'Наименование банка(Поля получателя\Банк)', 'DestBankName', 'Банк получателя(Поля получателя\Банк)', ' ', 1, 1805, 0, 0, '', 0, 19381) ;

CALL ImportField(180510012, 'Наименование филиала(Поля получателя\Банк)', 'DestFilialBankName', 'Филиал банка получателя(Поля получателя\Банк)', ' ', 1, 1805, 0, 0, '', 0, 19379) ;

CALL ImportField(180510016, 'Наименование документа', 'DocumentName', 'Наименование документа', ' ', 1, 1805, 0, 0, '', 0, 19382) ;

CALL ImportField(180510017, 'Срок платежа', 'DPLAT', 'Срок платежа', ' ', 1, 1805, 0, 0, '', 0, 19342) ;

CALL ImportField(180510022, 'Эл. номер документа', 'ELNUM', 'Эл. номер документа', ' ', 1, 1805, 0, 0, '', 0, 19317) ;

CALL ImportField(180510024, '№ эл. пакета', 'ElPacketNumber', '№ эл. пакета', ' ', 1, 1805, 0, 0, '', 0, 19376) ;

CALL ImportField(180510025, 'Дата получения', 'GETDATE', 'Дата получения', ' ', 1, 1805, 0, 0, '', 0, 19298) ;

CALL ImportField(180510030, 'КПП(Поля получателя)', 'KPPB', 'КПП получателя(Поля получателя)', ' ', 1, 1805, 0, 0, '', 0, 19351) ;

CALL ImportField(180510034, 'Счет(Поля плательщика)', 'LSKL', 'Счет плательщика(Поля плательщика)', ' ', 1, 1805, 0, 0, '', 0, 19320) ;

CALL ImportField(180510035, 'Счет(Поля получателя)', 'LSKOR', 'Счет получателя (Поля получателя)', ' ', 1, 1805, 0, 0, '', 0, 19323) ;

CALL ImportField(180510036, 'БИК банка(Поля получателя\Банк)', 'MF', 'БИК банка получателя(Поля получателя\Банк)', ' ', 1, 1805, 0, 0, '', 0, 19322) ;

CALL ImportField(180510038, 'БИК банка(Поля плательщика\Банк)', 'MFKB', 'БИК банка плательщика (Поля плательщика\Банк)', ' ', 1, 1805, 0, 0, '', 0, 19319) ;

CALL ImportField(180510046, 'Наименование(Поля получателя)', 'NAMKOR', 'Наименование получателя(Поля получателя)', ' ', 1, 1805, 0, 0, '', 0, 19324) ;

CALL ImportField(180510047, 'Номер документа', 'ND', 'Номер документа', ' ', 1, 1805, 0, 0, '', 0, 19313) ;

CALL ImportField(180510053, 'Назначение платежа', 'NOTE', 'Назначение платежа', ' ', 1, 1805, 0, 0, '', 0, 19302) ;

CALL ImportField(180510054, 'Имя файла эл. пакета', 'PACKETNUMBER', 'Имя файла эл. пакета', ' ', 1, 1805, 0, 0, '', 0, 19297) ;

CALL ImportField(180510056, 'Наименование(Поля плательщика)', 'PAYERNAME', 'Наименование(Поля плательщика)', ' ', 1, 1805, 0, 0, '', 0, 19304) ;

CALL ImportField(180510057, 'Вид платежа', 'paykind', 'Вид платежа', ' ', 1, 1805, 0, 0, '', 0, 19347) ;

CALL ImportField(180510060, 'Порядковый номер', 'PRNUM', 'PRNUM', ' ', 1, 1805, 0, 0, '', 0, 19349) ;

CALL ImportField(180510061, 'Класс документа', 'ProcDocClass', 'Класс документа', ' ', 1, 1805, 0, 0, '', 0, 19374) ;

CALL ImportField(180510062, 'Примечание обработки', 'PROCNOTE', 'Примечание обработки', ' ', 1, 1805, 0, 0, '', 0, 19306) ;

CALL ImportField(180510063, 'Пользователи', 'PROCUSEINFO', 'Пользователи', ' ', 1, 1805, 0, 0, '', 0, 19375) ;

CALL ImportField(180510067, 'Наименование банка(Поля плательщика\Банк)', 'SourceBankName', 'Банк плательщика(Поля плательщика\Банк)', ' ', 1, 1805, 0, 0, '', 0, 19380) ;

CALL ImportField(180510069, 'Наименование филиала(Поля плательщика\Банк)', 'SourceFilialBankName', 'Филиал банка плательщика(Поля плательщика\Банк)', ' ', 1, 1805, 0, 0, '', 0, 19378) ;

CALL ImportField(180510072, 'Сумма', 'SU', 'Сумма', ' ', 1, 1805, 0, 0, '', 0, 19325) ;

CALL ImportField(180510076, 'Информация налогового платежа', 'TaxNote', 'Информация налогового платежа', ' ', 1, 1805, 0, 0, '', 0, 19369) ;

CALL ImportField(180510078, 'Вид операции', 'VO', 'Вид операции', ' ', 1, 1805, 0, 0, '', 0, 19318) ;

CALL ImportField(180510079, 'Дополнительный идентификатор платежа', 'ExtPayID', 'Дополнительный идентификатор платежа', ' ', 1, 1805, 0, 0, '', 0, 24646) ;

CALL ImportField(180510080, 'Счет в ФК(Поля получателя)', 'DestFacialCode', 'Счет в ФК(Поля получателя)', ' ', 1, 1805, 0, 0, '', 0, 19384) ;

CALL ImportField(180510081, 'Источник средств', 'KOD_IST', 'Источник средств', ' ', 1, 1805, 0, 0, '', 0, 19339) ;

CALL ImportField(180510085, 'ИНН(Поля получателя)', 'DestInn', '', ' ', 1, 1805, 0, 0, '', 0, 19386) ;

CALL ImportField(180510086, 'КПП(Поля плательщика)', 'PAYERKPP', '', ' ', 1, 1805, 0, 0, '', 0, 19303) ;

CALL ImportField(180510087, 'ИНН(Поля плательщика)', 'SourceInn', '', ' ', 1, 1805, 0, 0, '', 0, 19385) ;

CALL ImportField(180510088, 'Информация о платеже', 'InfoPay', '', ' ', 1, 1805, 0, 0, '', 0, null) ;

CALL ImportField(180510089, 'УИН(Информация о платеже)', 'UINCode', '', ' ', 1, 1805, 0, 0, '', 0, 35358) ;

CALL ImportField(180511001, 'Добавочная классификация(код цели)', 'AddCls', 'Добавочная классификация(код цели)', ' ', 1, 1805, 1, 0, '', 0, 22277) ;

CALL ImportField(180511002, 'Источник финансирования', 'IFS', 'Источник финансирования', ' ', 1, 1805, 1, 0, '', 0, 22275) ;

CALL ImportField(180511003, 'Код дохода', 'KD', 'Код дохода', ' ', 1, 1805, 1, 0, '', 0, 22276) ;

CALL ImportField(180511004, 'Расходная классификация', 'KR', 'Расходная классификация', ' ', 1, 1805, 1, 0, '', 0, 22274) ;

CALL ImportField(180511005, 'Сумма', 'Summa', 'Сумма', ' ', 1, 1805, 1, 0, '', 0, 22278) ;

CALL ImportField(180511006, 'Направление платежа', 'SummaKind', 'Направление платежа', ' ', 1, 1805, 1, 0, '', 0, 22279) ;

-- Экспорт электронных документов, Бюджет(1)
CALL ImportField(180710001, '№ реестра ЭПД', 'ReestrNumber', '', ' ', 1, 1807, 0, 0, '', 0, 17235) ;

CALL ImportField(180710002, 'Информация о платеже', 'InfoPay', '', ' ', 1, 1807, 0, 0, '', 0, null) ;

CALL ImportField(180710003, 'УИН(Информация о платеже)', 'UINCode', '', ' ', 1, 1807, 0, 0, '', 0, null) ;

-- Буферный интерфейс выбытий, Бюджет(1)
CALL ImportField(181010001, 'Статус', 'ProcState', 'Статус', ' ', 1, 1810, 0, 0, '', 0, 22373) ;

CALL ImportField(181010002, '№ документа', 'DocNumber', '№ документа', ' ', 1, 1810, 0, 0, '', 0, 22336) ;

CALL ImportField(181010003, 'Дата документа', 'DocDate', 'Дата документа', ' ', 1, 1810, 0, 0, '', 0, 22337) ;

CALL ImportField(181010004, 'Дата пакета', 'PacketDate', 'Дата пакета', ' ', 1, 1810, 0, 0, '', 0, 22372) ;

CALL ImportField(181010005, 'Сумма', 'Summa', 'Сумма', ' ', 1, 1810, 0, 0, '', 0, 22343) ;

CALL ImportField(181010007, 'Наименование(Поля плательщика )', 'SourceName', 'Наименование(Поля плательщика )', ' ', 1, 1810, 0, 0, '', 0, 22347) ;

CALL ImportField(181010008, 'ИНН(Поля плательщика )', 'SourceINN', 'ИНН(Поля плательщика )', ' ', 1, 1810, 0, 0, '', 0, 22344) ;

CALL ImportField(181010009, 'КПП(Поля плательщика )', 'SourceKPP', 'КПП(Поля плательщика )', ' ', 1, 1810, 0, 0, '', 0, 22345) ;

CALL ImportField(181010010, 'ИНН организации ФК(Поля плательщика )', 'SourceUFK_INN', 'ИНН организации ФК(Поля плательщика )', ' ', 1, 1810, 0, 0, '', 0, 22350) ;

CALL ImportField(181010011, 'Код в УФК(Поля плательщика )', 'SourceUFKCODE', 'Код в УФК(Поля плательщика )', ' ', 1, 1810, 0, 0, '', 0, 22346) ;

CALL ImportField(181010012, 'Код ОФК(Поля плательщика )', 'SourceTOFK', 'Код ОФК(Поля плательщика )', ' ', 1, 1810, 0, 0, '', 0, 22349) ;

CALL ImportField(181010013, 'Наименование ОФК(Поля плательщика )', 'SourceUFK_OrgName', 'Наименование ОФК(Поля плательщика )', ' ', 1, 1810, 0, 0, '', 0, 22351) ;

CALL ImportField(181010014, 'Счет в ФК(Поля плательщика )', 'SourceACC', 'Счет(Поля плательщика )', ' ', 1, 1810, 0, 0, '', 0, 22348) ;

CALL ImportField(181010015, 'Счет(Поля плательщика )', 'SourceUFK_Acc', 'Счет ФК(Поля плательщика )', ' ', 1, 1810, 0, 0, '', 0, 22352) ;

CALL ImportField(181010017, 'Наименование банка(Поля плательщика \Банк)', 'SourceBankName', 'Наименование банка(Банк)', ' ', 1, 1810, 0, 0, '', 0, 22354) ;

CALL ImportField(181010018, 'БИК банка(Поля плательщика \Банк)', 'SourceBankMFO', 'БИК банка(Банк)', ' ', 1, 1810, 0, 0, '', 0, 22353) ;

CALL ImportField(181010019, 'Корсчет банка(Поля плательщика \Банк)', 'SourceBankCor', 'Корсчет банка(Банк)', ' ', 1, 1810, 0, 0, '', 0, 22355) ;

CALL ImportField(181010021, 'Наименование(Поля получателя)', 'DestName', 'Наименование(Поля получателя)', ' ', 1, 1810, 0, 0, '', 0, 22358) ;

CALL ImportField(181010022, 'ИНН(Поля получателя)', 'DestINN', 'ИНН(Поля получателя)', ' ', 1, 1810, 0, 0, '', 0, 22356) ;

CALL ImportField(181010023, 'КПП(Поля получателя)', 'DestKPP', 'КПП(Поля получателя)', ' ', 1, 1810, 0, 0, '', 0, 22357) ;

CALL ImportField(181010024, 'ИНН организации ФК(Поля получателя)', 'DestUFK_INN', 'ИНН организации ФК(Поля получателя)', ' ', 1, 1810, 0, 0, '', 0, 22359) ;

CALL ImportField(181010025, 'Наименование ОФК(Поля получателя)', 'DestUFK_OrgName', 'Наименование ОФК(Поля получателя)', ' ', 1, 1810, 0, 0, '', 0, 22360) ;

CALL ImportField(181010026, 'Счет(Поля получателя)', 'DestACC', 'Счет(Поля получателя)', ' ', 1, 1810, 0, 0, '', 0, 22361) ;

CALL ImportField(181010027, 'Лицевой счет(Поля получателя)', 'DestFacialCode', 'Лицевой счет(Поля получателя)', ' ', 1, 1810, 0, 0, '', 0, 22362) ;

CALL ImportField(181010029, 'Наименование банка(Поля получателя\Банк)', 'DestBankName', 'Наименование банка(Банк)', ' ', 1, 1810, 0, 0, '', 0, 22364) ;

CALL ImportField(181010030, 'БИК банка(Поля получателя\Банк)', 'DestBankMFO', 'БИК банка(Банк)', ' ', 1, 1810, 0, 0, '', 0, 22363) ;

CALL ImportField(181010031, 'Корсчет банка(Поля получателя\Банк)', 'DestBankCor', 'Корсчет банка(Банк)', ' ', 1, 1810, 0, 0, '', 0, 22365) ;

CALL ImportField(181010032, 'Назначение платежа', 'Note', 'Назначение платежа', ' ', 1, 1810, 0, 0, '', 0, 22340) ;

CALL ImportField(181010033, 'Налоговая информация', 'TaxNote', 'Налоговая информация', ' ', 1, 1810, 0, 0, '', 0, 22341) ;

CALL ImportField(181010034, 'Очередность платежа', 'PayQueue', 'Очередность платежа', ' ', 1, 1810, 0, 0, '', 0, 22338) ;

CALL ImportField(181010035, 'Вид платежа', 'PayKind', 'Вид платежа', ' ', 1, 1810, 0, 0, '', 0, 22339) ;

CALL ImportField(181010036, 'id', 'id', 'id', ' ', 1, 1810, 0, 0, '', 0, 22335) ;

CALL ImportField(181010037, 'Имя файла эл. пакета', 'PacketNumber', 'Имя файла эл. пакета', ' ', 1, 1810, 0, 0, '', 0, 22370) ;

CALL ImportField(181010038, 'Электронный номер', 'ElDocNumber', 'Электронный номер', ' ', 1, 1810, 0, 0, '', 0, 22371) ;

CALL ImportField(181010039, 'Класс документа', 'ProcDocClass', 'Класс документа', ' ', 1, 1810, 0, 0, '', 0, 22374) ;

CALL ImportField(181010040, 'Примечание обработки', 'ProcNote', 'Примечание обработки', ' ', 1, 1810, 0, 0, '', 0, 22376) ;

CALL ImportField(181010041, 'Ссылка на документ ', 'DocRef', 'Ссылка на документ ', ' ', 1, 1810, 0, 0, '', 0, 22378) ;

CALL ImportField(181010042, 'Ссылка на эл. документ', 'ElDocRef', 'Ссылка на эл. документ', ' ', 1, 1810, 0, 0, '', 0, 22379) ;

CALL ImportField(181010043, 'Прогиндекс', 'ProgIndex', 'Прогиндекс', ' ', 1, 1810, 0, 0, '', 0, 22380) ;

CALL ImportField(181010045, 'Наименование документа', 'DocumentName', 'Наименование документа', ' ', 1, 1810, 0, 0, '', 0, 22384) ;

CALL ImportField(181010047, 'PROCUSEINFO', 'PROCUSEINFO', 'PROCUSEINFO', ' ', 1, 1810, 0, 0, '', 0, 22375) ;

CALL ImportField(181010048, 'Источник средств', 'kod_ist', 'Источник средств', ' ', 1, 1810, 0, 0, '', 0, 26600) ;

CALL ImportField(181010052, 'Документ-основание', 'DocOsn', '', ' ', 1, 1810, 0, 0, '', 0, 27840) ;

CALL ImportField(181010053, 'Дата(Возвращаемый документ)', 'Vos_Date', '', ' ', 1, 1810, 0, 0, '', 0, 26605) ;

CALL ImportField(181010054, 'Возвращаемый документ', 'Vos_group', '', ' ', 1, 1810, 0, 0, '', 0, null) ;

CALL ImportField(181010055, 'Идентификатор документа(Возвращаемый документ)', 'Vos_GUID', '', ' ', 1, 1810, 0, 0, '', 0, 26606) ;

CALL ImportField(181010056, 'Номер(Возвращаемый документ)', 'Vos_Nom', '', ' ', 1, 1810, 0, 0, '', 0, 26607) ;

CALL ImportField(181010057, 'ИНН плательщика(Возвращаемый документ)', 'Vos_PayerINN', '', ' ', 1, 1810, 0, 0, '', 0, 26608) ;

CALL ImportField(181010058, 'КПП плательщика(Возвращаемый документ)', 'Vos_PayerKPP', '', ' ', 1, 1810, 0, 0, '', 0, 26609) ;

CALL ImportField(181010059, 'Сумма(Возвращаемый документ)', 'Vos_Sum', '', ' ', 1, 1810, 0, 0, '', 0, 26610) ;

CALL ImportField(181010060, 'Информация о платеже', 'InfoPay', '', ' ', 1, 1810, 0, 0, '', 0, null) ;

CALL ImportField(181010061, 'УИН(Информация о платеже)', 'UINCode', '', ' ', 1, 1810, 0, 0, '', 0, 35366) ;

CALL ImportField(181011044, 'Расходная классификация', 'kr', 'Расходная классификация', ' ', 1, 1810, 1, 0, '', 0, 22274) ;

CALL ImportField(181011045, 'Источник финансирования', 'IFS', 'Источник финансирования', ' ', 1, 1810, 1, 0, '', 0, 22275) ;

CALL ImportField(181011046, 'Код дохода', 'KD', 'Код дохода', ' ', 1, 1810, 1, 0, '', 0, 22276) ;

CALL ImportField(181011047, 'Добавочная классификация(Код цели)', 'AddCls', 'Добавочная классификация(Код цели)', ' ', 1, 1810, 1, 0, '', 0, 22277) ;

CALL ImportField(181011048, 'Сумма', 'Summa', 'Сумма', ' ', 1, 1810, 1, 0, '', 0, 22278) ;

CALL ImportField(181011049, 'Номер БО', 'Promise', 'Номер БО', ' ', 1, 1810, 1, 0, '', 0, 24722) ;

CALL ImportField(181011050, 'Направление платежа', 'SummaKind', 'Направление платежа', ' ', 1, 1810, 1, 0, '', 0, 22279) ;

CALL ImportField(181011051, 'Примечание', 'Note', '', ' ', 1, 1810, 1, 0, '', 0, 24721) ;

CALL ImportField(181011052, 'Назначение платежа', 'Purpose', '', ' ', 1, 1810, 1, 0, '', 0, 26599) ;

-- Буферный интерфейс уведомлений, Бюджет(1)
CALL ImportField(181210001, 'Номер эл. документа', 'eldocnumber', 'Электронный номер документа', ' ', 1, 1812, 0, 0, '', 0, 26558) ;

CALL ImportField(181210002, 'Номер документа', 'docnumber', 'Номер документа', ' ', 1, 1812, 0, 0, '', 0, 26556) ;

CALL ImportField(181210003, 'Дата документа', 'docdate', 'Дата документа', ' ', 1, 1812, 0, 0, '', 0, 26555) ;

CALL ImportField(181210004, 'ИНН', 'inn', 'ИНН', ' ', 1, 1812, 0, 0, '', 0, 26562) ;

CALL ImportField(181210005, 'КПП', 'kpp', 'КПП', ' ', 1, 1812, 0, 0, '', 0, 26563) ;

CALL ImportField(181210006, 'Наименование', 'name', 'Наименование', ' ', 1, 1812, 0, 0, '', 0, 26564) ;

CALL ImportField(181210007, 'Лицевой счет', 'facialcode', 'Лицевой счет', ' ', 1, 1812, 0, 0, '', 0, 26559) ;

CALL ImportField(181210008, 'Вид средств', 'fund_source', 'Вид средств', ' ', 1, 1812, 0, 0, '', 0, 26560) ;

CALL ImportField(181210009, 'ИНН плательщика(Уточняемый документ)', 'sourceinn', 'ИНН плательщика', ' ', 1, 1812, 0, 0, '', 0, 26570) ;

CALL ImportField(181210010, 'КПП плательщика(Уточняемый документ)', 'sourcekpp', 'КПП плательщика', ' ', 1, 1812, 0, 0, '', 0, 26571) ;

CALL ImportField(181210011, 'Счет плательщика(Уточняемый документ)', 'sourceacc', 'Счет плательщика', ' ', 1, 1812, 0, 0, '', 0, 26569) ;

CALL ImportField(181210012, 'Статус', 'procstate', 'Статус', ' ', 1, 1812, 0, 0, '', 0, 26568) ;

CALL ImportField(181210013, 'Имя файла эл. пакета', 'packetnumber', 'Номер пакета', ' ', 1, 1812, 0, 0, '', 0, 26565) ;

CALL ImportField(181210014, 'Класс документа', 'procdocclass', 'Класс документа', ' ', 1, 1812, 0, 0, '', 0, 26566) ;

CALL ImportField(181210015, 'Наименование документа', 'documentname', 'Наименование документа', ' ', 1, 1812, 0, 0, '', 0, 26557) ;

CALL ImportField(181210016, 'Примечания обработки', 'procnote', 'Примечание обработки', ' ', 1, 1812, 0, 0, '', 0, 26567) ;

CALL ImportField(181210018, 'Наименование плательщика(Уточняемый документ)', 'sourcename', 'Наименование плательщика', ' ', 1, 1812, 0, 0, '', 0, 27013) ;

CALL ImportField(181210019, 'procuseinfo', 'procuseinfo', 'procuseinfo', ' ', 1, 1812, 0, 0, '', 0, 27012) ;

CALL ImportField(181210020, 'Должность руководителя(Подписи)', 'dol_ruk', 'Должность руководителя', ' ', 1, 1812, 0, 0, '', 0, 27009) ;

CALL ImportField(181210021, 'ФИО руководителя(Подписи)', 'name_ruk', 'Имя руководителя', ' ', 1, 1812, 0, 0, '', 0, 27011) ;

CALL ImportField(181210022, 'ФИО исполнителя(Подписи)', 'name_isp', 'ФИО исполнителя', ' ', 1, 1812, 0, 0, '', 0, 27010) ;

CALL ImportField(181210023, 'Должность исполнителя(Подписи)', 'dol_isp', 'Должность исполнителя', ' ', 1, 1812, 0, 0, '', 0, 27008) ;

CALL ImportField(181210024, 'Дата подписания(Подписи)', 'date_pod', 'Дата подписания', ' ', 1, 1812, 0, 0, '', 0, 27006) ;

CALL ImportField(181210025, 'Телефон исполнителя(Подписи)', 'tel_isp', 'Телефон исполнителя', ' ', 1, 1812, 0, 0, '', 0, 27014) ;

CALL ImportField(181210028, 'Подписи', 'Signatures', '', ' ', 1, 1812, 0, 0, '', 0, null) ;

CALL ImportField(181210029, 'Уточняемый документ', 'SourceField', '', ' ', 1, 1812, 0, 0, '', 0, null) ;

CALL ImportField(181211002, 'Номер эл. документа', 'eldocnumber', 'Электронный номер документа', ' ', 1, 1812, 1, 0, '', 0, 26583) ;

CALL ImportField(181211003, 'Код платежного документа', 'kod_doc', 'Код документа', ' ', 1, 1812, 1, 0, '', 0, 26587) ;

CALL ImportField(181211004, 'Уточняемый документ / Номер', 'originalnumber', 'Номер исходного документа', ' ', 1, 1812, 1, 0, '', 0, 26592) ;

CALL ImportField(181211005, 'Уточняемы документ / Дата', 'originaldate', 'Дата исходного документа', ' ', 1, 1812, 1, 0, '', 0, 26591) ;

CALL ImportField(181211006, 'Лицевой счет', 'facialcode', 'Лицевой счет', ' ', 1, 1812, 1, 0, '', 0, 26584) ;

CALL ImportField(181211007, 'ОКАТО', 'okato', 'ОКАТО', ' ', 1, 1812, 1, 0, '', 0, 26590) ;

CALL ImportField(181211008, 'Сумма', 'summa', 'Сумма', ' ', 1, 1812, 1, 0, '', 0, 26596) ;

CALL ImportField(181211009, 'Классификация', 'clsvalue', 'Классификация', ' ', 1, 1812, 1, 0, '', 0, 26576) ;

CALL ImportField(181211010, 'Тип классификации', 'clstype', 'Тип классификации', ' ', 1, 1812, 1, 0, '', 0, 26575) ;

CALL ImportField(181211011, 'Наименование получателя', 'destname', 'Наименование получателя', ' ', 1, 1812, 1, 0, '', 0, 26582) ;

CALL ImportField(181211012, 'ИНН получателя', 'destinn', 'ИНН получателя', ' ', 1, 1812, 1, 0, '', 0, 26580) ;

CALL ImportField(181211013, 'КПП получателя', 'destkpp', 'КПП получателя', ' ', 1, 1812, 1, 0, '', 0, 26581) ;

CALL ImportField(181211014, 'Код цели', 'addcls', 'Код цели', ' ', 1, 1812, 1, 0, '', 0, 26574) ;

CALL ImportField(181211015, 'Назначение платежа', 'purpose', 'Назначение платежа', ' ', 1, 1812, 1, 0, '', 0, 26594) ;

CALL ImportField(181211016, 'Вид средств', 'fund_source', 'Вид средств', ' ', 1, 1812, 1, 0, '', 0, 26585) ;

CALL ImportField(181211017, 'Номер заявки', 'nom_zr', 'Номер заявки', ' ', 1, 1812, 1, 0, '', 0, 26588) ;

CALL ImportField(181211019, 'Примечание', 'note', 'Примечание', ' ', 1, 1812, 1, 0, '', 0, 26589) ;

-- Буферная таблица выписки по счету, Бюджет(1)
CALL ImportField(181410001, 'Автообработка', 'AUTOPROCESSING', '', ' ', 1, 1814, 0, 0, '', 0, 19445) ;

CALL ImportField(181410002, 'DK', 'DK', '', ' ', 1, 1814, 0, 0, '', 0, 19459) ;

CALL ImportField(181410003, 'Дата документа', 'DVV', '', ' ', 1, 1814, 0, 0, '', 0, 19463) ;

CALL ImportField(181410004, 'ELNUM', 'ELNUM', '', ' ', 1, 1814, 0, 0, '', 0, 19462) ;

CALL ImportField(181410005, '№ эл. пакета', 'ElPacketNumber', '', ' ', 1, 1814, 0, 0, '', 0, 19475) ;

CALL ImportField(181410006, 'Дата получения', 'GETDATE', '', ' ', 1, 1814, 0, 0, '', 0, 19444) ;

CALL ImportField(181410007, 'ИНН получателя', 'INNMF', '', ' ', 1, 1814, 0, 0, '', 0, 19465) ;

CALL ImportField(181410008, 'ИНН плательщика', 'INNMFKB', '', ' ', 1, 1814, 0, 0, '', 0, 19464) ;

CALL ImportField(181410009, 'Счет выписки', 'KRSKB', '', ' ', 1, 1814, 0, 0, '', 0, 19458) ;

CALL ImportField(181410010, 'LSD', 'LSD', '', ' ', 1, 1814, 0, 0, '', 0, 19457) ;

CALL ImportField(181410011, 'LSK', 'LSK', '', ' ', 1, 1814, 0, 0, '', 0, 19456) ;

CALL ImportField(181410012, 'Счет плательщика', 'LSKL', '', ' ', 1, 1814, 0, 0, '', 0, 19468) ;

CALL ImportField(181410013, 'Cчет получателя', 'LSKOR', '', ' ', 1, 1814, 0, 0, '', 0, 19469) ;

CALL ImportField(181410014, 'MF', 'MF', '', ' ', 1, 1814, 0, 0, '', 0, 19454) ;

CALL ImportField(181410015, 'БИК плательщика', 'MFFIL', '', ' ', 1, 1814, 0, 0, '', 0, 19467) ;

CALL ImportField(181410016, 'MFKB', 'MFKB', '', ' ', 1, 1814, 0, 0, '', 0, 19455) ;

CALL ImportField(181410017, 'БИК получателя', 'MFKBFIL', '', ' ', 1, 1814, 0, 0, '', 0, 19466) ;

CALL ImportField(181410018, 'NA', 'NA', '', ' ', 1, 1814, 0, 0, '', 0, 19460) ;

CALL ImportField(181410019, 'Номер п/п', 'ND', '', ' ', 1, 1814, 0, 0, '', 0, 19453) ;

CALL ImportField(181410020, 'Имя файла эл. пакета', 'PACKETNUMBER', '', ' ', 1, 1814, 0, 0, '', 0, 19443) ;

CALL ImportField(181410021, 'PFA', 'PFA', '', ' ', 1, 1814, 0, 0, '', 0, 19470) ;

CALL ImportField(181410022, 'Обработан вручную', 'PROCESSING', '', ' ', 1, 1814, 0, 0, '', 0, 19446) ;

CALL ImportField(181410023, 'Обработчик', 'PROCNOTE', '', ' ', 1, 1814, 0, 0, '', 0, 19447) ;

CALL ImportField(181410024, 'Sender', 'Sender', '', ' ', 1, 1814, 0, 0, '', 0, 19472) ;

CALL ImportField(181410025, 'Сумма', 'SU', '', ' ', 1, 1814, 0, 0, '', 0, 19452) ;

CALL ImportField(181410026, 'T_EVENT', 'T_EVENT', '', ' ', 1, 1814, 0, 0, '', 0, 19471) ;

CALL ImportField(181410027, 'Вид операции', 'VO', '', ' ', 1, 1814, 0, 0, '', 0, 19461) ;

-- Буферная таблица остатков на счете, Бюджет(1)
CALL ImportField(181510001, 'D_LAST', 'D_LAST', '', ' ', 1, 1815, 0, 0, '', 0, 19494) ;

CALL ImportField(181510002, 'DF', 'DF', '', ' ', 1, 1815, 0, 0, '', 0, 19491) ;

CALL ImportField(181510003, 'Дебетовый оборот', 'DT', '', ' ', 1, 1815, 0, 0, '', 0, 19485) ;

CALL ImportField(181510004, '№ эл. пакета', 'ElPacketNumber', '', ' ', 1, 1815, 0, 0, '', 0, 19496) ;

CALL ImportField(181510005, 'Дата получения', 'GETDATE', '', ' ', 1, 1815, 0, 0, '', 0, 19479) ;

CALL ImportField(181510006, 'Исходящий остаток', 'IXSA', '', ' ', 1, 1815, 0, 0, '', 0, 19488) ;

CALL ImportField(181510007, 'IXSP', 'IXSP', '', ' ', 1, 1815, 0, 0, '', 0, 19487) ;

CALL ImportField(181510008, 'Кредитовый оборот', 'KT', '', ' ', 1, 1815, 0, 0, '', 0, 19486) ;

CALL ImportField(181510009, 'Номер счета', 'LS', '', ' ', 1, 1815, 0, 0, '', 0, 19484) ;

CALL ImportField(181510010, 'Имя файла эл. пакета', 'PACKETNUMBER', '', ' ', 1, 1815, 0, 0, '', 0, 19478) ;

CALL ImportField(181510011, 'Sender', 'Sender', '', ' ', 1, 1815, 0, 0, '', 0, 19493) ;

CALL ImportField(181510012, 'T_CLOCK', 'T_CLOCK', '', ' ', 1, 1815, 0, 0, '', 0, 19492) ;

CALL ImportField(181510013, 'Входящий остаток', 'VXSA', '', ' ', 1, 1815, 0, 0, '', 0, 19490) ;

CALL ImportField(181510014, 'VXSP', 'VXSP', '', ' ', 1, 1815, 0, 0, '', 0, 19489) ;

-- Модальная форма импорта, Бюджет(1)
CALL ImportField(181610001, 'FullKDValue', 'FullKDValue', 'Код дохода', ' ', 1, 1816, 0, 0, '', 0, null) ;

CALL ImportField(181610002, 'FullFinSourceValue', 'FullFinSourceValue', 'Источник дохода', ' ', 1, 1816, 0, 0, '', 0, null) ;

CALL ImportField(181610003, 'KVSR', 'KVSR', 'КВСР', ' ', 1, 1816, 0, 0, '', 0, null) ;

CALL ImportField(181610004, 'KFSR', 'KFSR', 'ФКР', ' ', 1, 1816, 0, 0, '', 0, null) ;

CALL ImportField(181610005, 'КЦСР', 'KCSR', 'КЦСР', ' ', 1, 1816, 0, 0, '', 0, null) ;

CALL ImportField(181610006, 'KVR', 'KVR', 'КВР', ' ', 1, 1816, 0, 0, '', 0, null) ;

CALL ImportField(181610007, 'KESR', 'KESR', 'ЭКР', ' ', 1, 1816, 0, 0, '', 0, null) ;

-- Все плановые документы(источники), Бюджет(1)
CALL ImportField(190011029, 'Организация', '{РусПоле("ОрганизацияДеталь")}', 'Ссылка на орг. получ.', ' ', 1, 1900, 1, 0, 'ОрганизацияДеталь', 0, null) ;

CALL ImportField(190011030, 'ИНН организации', '{РусПоле("ИННОрганизацииДеталь")}', 'ИНН организации', ' ', 1, 1900, 1, 0, 'ИННОрганизацииДеталь', 0, null) ;

CALL ImportField(190011031, 'КПП организации', '{РусПоле("КППОрганизацииДеталь")}', 'КПП организации', ' ', 1, 1900, 1, 0, 'КППОрганизацииДеталь', 0, null) ;

CALL ImportField(190011032, 'Наименование организации(деталь)', '{РусПоле("НаименованиеОрганизацииДеталь")}', 'Наименование организации', ' ', 1, 1900, 1, 0, 'НаименованиеОрганизацииДеталь', 0, null) ;

CALL ImportField(190011033, 'Наименование организации', '{РусПоле("НаименованиеОрганизации")}', 'Наименование организации', ' ', 1, 1900, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(190011034, 'Код БА (ключ)', '{РусПоле("КодБюджАссигнованияКлюч")}', 'Код БА (ключ)', ' ', 1, 1900, 1, 0, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(190011035, 'Вид ассигнований', '{РусПоле("ВидАссигнований")}', 'Вид ассигнований', ' ', 1, 1900, 1, 0, 'ВидАссигнований', 0, null) ;

-- СБР (источники), Бюджет(1)
CALL ImportField(190110007, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 1901, 0, 0, '', 0, null) ;

CALL ImportField(190110010, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 1901, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(190110011, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 1901, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(190110012, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 1901, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(190110087, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 1901, 0, 1, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(190111015, 'Источники финансирования дефицита', 'IFS_FinSourceValue', 'Источники финансирования дефицита', 'IFS_FinSourceValue', 1, 1901, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(190111016, 'Администратор(Источники финансирования дефицита)', 'IFS_KVSRCode', 'Администратор', ' ', 1, 1901, 1, 0, '', 0, 25472) ;

CALL ImportField(190111019, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', 'DestSubKesr', 1, 1901, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(190111020, 'Направление', 'DirectionCLSCode', 'Направление', 'DestDirectionCLS', 1, 1901, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(190111021, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 1901, 1, 0, 'Регион,РайонТрансферта', 0, 17417) ;

CALL ImportField(190111023, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'DestFactCls', 1, 1901, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(190111024, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFINTYPECls', 1, 1901, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(190111026, 'Главный распорядитель', 'OrgNameAndAcc', 'Организация', ' ', 1, 1901, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(190111027, 'ИНН(Главный распорядитель)', 'INN', 'ИНН', 'DestOrgInn', 1, 1901, 1, 0, 'ИННОрганизацииДеталь', 0, 16645) ;

CALL ImportField(190111028, 'КПП(Главный распорядитель)', 'INN20', 'КПП', 'DestOrgKpp', 1, 1901, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(190111030, 'Наименование(Главный распорядитель)', 'NAME', 'Наименование', 'DestOrgNAME', 1, 1901, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(190111095, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 1901, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(190111096, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 1901, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(190111098, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 1, 1901, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(190111102, 'Направление (Ключ)', 'DirectionCLS', 'Направление', 'DestDirectionCLSKEY', 1, 1901, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(190111103, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', 'DestFactClsKey', 1, 1901, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(190111104, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 1901, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(190111105, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 1901, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(190111106, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 1901, 1, 0, 'Объект', 0, null) ;

-- Роспись по АИФ (источники), Бюджет(1)
CALL ImportField(190210017, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 1902, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(190210041, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 1902, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(190210073, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 1902, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(190210080, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 1902, 0, 0, '', 0, null) ;

CALL ImportField(190210086, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 1902, 0, 1, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(190211004, 'Администратор(Источники финансирования дефицита)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 1902, 1, 0, '', 0, 25472) ;

CALL ImportField(190211008, 'Получатель', 'OrgNameAndAcc', 'Главный распорядитель', ' ', 1, 1902, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(190211009, 'ИНН(Получатель)', 'INN', 'ИНН(Главный распорядитель)', 'DestOrgInn', 1, 1902, 1, 0, 'ИННОрганизацииДеталь', 0, 16645) ;

CALL ImportField(190211010, 'КПП(Получатель)', 'INN20', 'КПП(Главный распорядитель)', 'DestOrgKpp', 1, 1902, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(190211011, 'Наименование(Получатель)', 'NAME', 'Наименование(Главный распорядитель)', 'DestOrgNAME', 1, 1902, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(190211039, 'Мероприятие', 'FACTCODE', 'Мероприятие(Классификация)', 'DestFactCls', 1, 1902, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(190211040, 'Направление', 'DirectionCLSCode', 'Направление(Классификация)', 'DestDirectionCLS', 1, 1902, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(190211050, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 1902, 1, 0, 'Регион,РайонТрансферта', 0, 17417) ;

CALL ImportField(190211056, 'Квартал 1', 'QUARTER1', 'Квартал 1', 'Quarter1', 1, 1902, 1, 1, 'РоспКвартал1', 0, 17421) ;

CALL ImportField(190211057, 'Квартал 2', 'QUARTER2', 'Квартал 2', 'Quarter2', 1, 1902, 1, 1, 'РоспКвартал2', 0, 17422) ;

CALL ImportField(190211058, 'Квартал 3', 'QUARTER3', 'Квартал 3', 'Quarter3', 1, 1902, 1, 1, 'РоспКвартал3', 0, 17423) ;

CALL ImportField(190211059, 'Квартал 4', 'QUARTER4', 'Квартал 4', 'Quarter4', 1, 1902, 1, 1, 'РоспКвартал4', 0, 17424) ;

CALL ImportField(190211071, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', 'DestSubKesr', 1, 1902, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(190211077, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFINTYPECls', 1, 1902, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(190211079, 'Источники финансирования дефицита', 'IFS_FinSourceValue', 'Источники финансирования дефицита(Источниковая классификация)', 'IFS_FinSourceValue', 1, 1902, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(190211094, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 1902, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(190211095, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 1902, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(190211097, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 1, 1902, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(190211100, 'Направление (Ключ)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLSKey', 1, 1902, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(190211101, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие(Классификация)', 'DestFactClsKey', 1, 1902, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(190211102, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 1902, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(190211103, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 1902, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(190211104, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 1902, 1, 0, 'Объект', 0, null) ;

-- Кассовый план (источники), Бюджет(1)
CALL ImportField(190310017, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 1903, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(190310040, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 1903, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(190310072, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 1903, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(190310082, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 1903, 0, 0, '', 0, null) ;

CALL ImportField(190310087, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 1903, 0, 1, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(190311004, 'Главный распорядитель', 'OrgNameAndAcc', 'Главный распорядитель', ' ', 1, 1903, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(190311005, 'ИНН(Главный распорядитель)', 'INN', 'ИНН(Главный распорядитель)', 'DestOrgInn', 1, 1903, 1, 0, 'ИННОрганизацииДеталь', 0, 16645) ;

CALL ImportField(190311006, 'КПП(Главный распорядитель)', 'INN20', 'КПП(Главный распорядитель)', 'DestOrgKpp', 1, 1903, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(190311007, 'Наименование(Главный распорядитель)', 'NAME', 'Наименование(Главный распорядитель)', 'DestOrgNAME', 1, 1903, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(190311038, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'DestFactCls', 1, 1903, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(190311039, 'Направление', 'DirectionCLSCode', 'Направление', 'DestDirectionCLS', 1, 1903, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(190311049, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 1903, 1, 0, 'Регион,РайонТрансферта', 0, 17417) ;

CALL ImportField(190311070, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', 'DestSubKesr', 1, 1903, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(190311075, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFINTYPECls', 1, 1903, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(190311076, 'Администратор(Источники финансирования дефицита)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 1903, 1, 0, '', 0, 25472) ;

CALL ImportField(190311081, 'Источники финансирования дефицита', 'IFS_FinSourceValue', 'Источники финансирования дефицита(Источниковая классификация)', 'IFS_FinSourceValue', 1, 1903, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(190311092, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 1903, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(190311095, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 1903, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(190311096, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 1903, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(190311098, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 1, 1903, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(190311101, 'Направление (Ключ)', 'DirectionCLS', 'Направление', 'DestDirectionCLSKey', 1, 1903, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(190311102, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', 'DestFactClsKey', 1, 1903, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(190311103, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 1903, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(190311104, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 1903, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(190311105, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 1903, 1, 0, 'Объект', 0, null) ;

-- ПОФ по АИФ (источники), Бюджет(1)
CALL ImportField(190610018, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 1906, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(190610041, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 1906, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(190610073, 'Код НПА', 'DocBaseCode', 'Код НПА', 'DocBase', 1, 1906, 0, 0, 'ТипДокОснования', 0, 17473) ;

CALL ImportField(190610084, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 1906, 0, 0, '', 0, null) ;

CALL ImportField(190610088, 'Код НПА (Ключ)', 'DocBase', 'Код НПА (Ключ)', 'DocBaseKey', 1, 1906, 0, 1, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(190611004, 'Получатель', 'OrgNameAndAcc', 'Получатель', ' ', 1, 1906, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(190611005, 'ИНН(Получатель)', 'INN', 'ИНН(Получатель)', 'DestOrgInn', 1, 1906, 1, 0, 'ИННОрганизацииДеталь', 0, 16645) ;

CALL ImportField(190611006, 'КПП(Получатель)', 'INN20', 'КПП(Получатель)', 'DestOrgKpp', 1, 1906, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(190611008, 'Наименование(Получатель)', 'NAME', 'Наименование(Получатель)', 'DestOrgNAME', 1, 1906, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(190611039, 'Мероприятие', 'FACTCODE', 'Мероприятие', 'DestFactCls', 1, 1906, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(190611040, 'Направление', 'DirectionCLSCode', 'Направление', 'DestDirectionCLS', 1, 1906, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(190611050, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 1906, 1, 0, 'Регион,РайонТрансферта', 0, 17417) ;

CALL ImportField(190611071, 'Суб КЭСР', 'SUBKESR', 'Суб КЭСР', 'DestSubKesr', 1, 1906, 1, 0, 'СубКЭСР', 0, 17416) ;

CALL ImportField(190611076, 'Код доп. информации', 'FINTYPECODE', 'Код дополнительной информации', 'DestFINTYPECls', 1, 1906, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(190611077, 'Администратор(Источники финансирования дефицита)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 1906, 1, 0, '', 0, 25472) ;

CALL ImportField(190611083, 'Источники финансирования дефицита', 'IFS_FinSourceValue', 'Источники финансирования дефицита(Источниковая классификация)', 'IFS_FinSourceValue', 1, 1906, 1, 0, 'ИсточникВнутрФинансирования', 0, 17055) ;

CALL ImportField(190611097, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 1906, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(190611098, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 1906, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(190611100, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 1, 1906, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(190611103, 'Направление (Ключ)', 'DirectionCLS', 'Направление', 'DestDirectionCLSKey', 1, 1906, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(190611104, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', 'DestFactClsKey', 1, 1906, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(190611105, 'Код доп. информации (Ключ)', 'FINTYPE', 'Код дополнительной информации', 'DestFINTYPEClsKey', 1, 1906, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(190611106, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 1906, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(190611107, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 1906, 1, 0, 'Объект', 0, null) ;

-- Кассовый план (доходы), Бюджет(1)
CALL ImportField(220110007, 'НПА (группа)', 'DocBaseParent', 'НПА (группа)', ' ', 1, 2201, 0, 0, '', 0, null) ;

CALL ImportField(220110009, 'Код НПА', 'DOCBASECODE', 'Код НПА', 'DocBase', 1, 2201, 0, 0, 'ТипДокОснования', 0, 36865) ;

CALL ImportField(220110010, 'Номер НПА', 'DOCNUMBER', 'Номер НПА', 'DocNumber', 1, 2201, 0, 0, 'НомерДокОснования', 0, 17467) ;

CALL ImportField(220110011, 'Дата НПА', 'DOCDAT', 'Дата НПА', 'DocDat', 1, 2201, 0, 0, 'ДатаДокОснования', 0, 17466) ;

CALL ImportField(220110070, 'Код НПА (Ключ)', 'DOCBASE', 'Код НПА (Ключ)', 'DocBaseKey', 1, 2201, 0, 1, 'ТипДокОснованияКлюч', 0, 17473) ;

CALL ImportField(220111013, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор', 'KDKVSRCode', 1, 2201, 1, 0, '', 0, 25472) ;

CALL ImportField(220111017, 'Суб. код дохода', 'SUBKD', 'Суб.код дохода', 'SubKD', 1, 2201, 1, 0, 'СубКД', 0, 25271) ;

CALL ImportField(220111040, 'Мероприятие', 'FactCode', 'Мероприятие', 'DestFactCls', 1, 2201, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(220111055, 'Направление', 'DirectionCLSCode', 'Направление', 'DestDirectionCLS', 1, 2201, 1, 0, 'Направление', 0, 21556) ;

CALL ImportField(220111056, 'ИНН(Организация)', 'INN', 'ИНН(Организация)', 'DestOrgInn', 1, 2201, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16645) ;

CALL ImportField(220111057, 'КПП(Организация)', 'INN20', 'КПП(Организация)', 'DestOrgKpp', 1, 2201, 1, 0, 'КППОрганизацииДеталь', 0, 16653) ;

CALL ImportField(220111058, 'Наименование(Организация)', 'NAME', 'Наименование(Организация)', 'DestOrgNAME', 1, 2201, 1, 0, 'НаименованиеОрганизацииДеталь', 0, 16646) ;

CALL ImportField(220111059, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 2201, 1, 0, 'НаименованиеОрганизацииДеталь', 0, null) ;

CALL ImportField(220111065, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 2201, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(220111073, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 1, 2201, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(220111074, 'Код доп. информации (Ключ)', 'FinType', 'Код дополнительной информации', 'DestFINTYPEKey', 1, 2201, 1, 1, 'ТипФинансированияКлюч', 0, 17425) ;

CALL ImportField(220111075, 'Код доп. информации', 'FinTypeCode', 'Код дополнительной информации', 'DestFINTYPECls', 1, 2201, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(220111076, 'Направление (Ключ)', 'DirectionCLS', 'Направление', 'DestDirectionCLSKey', 1, 2201, 1, 1, 'НаправлениеКлюч', 0, 17450) ;

CALL ImportField(220111077, 'Мероприятие (Ключ)', 'Fact', 'Мероприятие', 'DestFactClsKey', 1, 2201, 1, 1, 'МероприятиеКлюч', 0, 17418) ;

CALL ImportField(220111078, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 2201, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(220111079, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 2201, 1, 0, 'Объект', 0, null) ;

-- Государственные контракты, Бюджет(1)
CALL ImportField(250110072, 'Счет(Исполнитель)', 'EXECUTERACCNAME', '', ' ', 1, 2501, 0, 0, '', 0, 17112) ;

CALL ImportField(250110073, 'Номер контракта в предыдущем году', 'OLDDOCNUMBER', '', ' ', 1, 2501, 0, 0, '', 0, 19829) ;

CALL ImportField(250111022, 'НДС', 'NDS', '', ' ', 1, 2501, 1, 0, '', 0, null) ;

CALL ImportField(250112013, 'Классификация', 'TreeOwner0', '', ' ', 1, 2501, 2, 0, '', 0, null) ;

-- Государственные контракты, УРМ+Бюджет(2)
CALL ImportField(250110001, 'Тип сведений', 'DocBaseType', 'Тип сведений', 'DocBaseType', 2, 2501, 0, 0, '', 0, 19867) ;

CALL ImportField(250110002, 'Основание и причина', 'DocBaseText', 'Основание и причина', 'DocBaseText', 2, 2501, 0, 0, '', 0, 19866) ;

CALL ImportField(250110003, 'Дата исполнения / прекращения контракта', 'DocBaseDate', 'Дата исполнения / прекращения контракта', 'DocBaseDate', 2, 2501, 0, 0, '', 0, 19864) ;

CALL ImportField(250110004, 'Фактически оплачено', 'DocBaseSumma', 'Фактически оплачено', 'DocBaseSumma', 2, 2501, 0, 0, '', 0, 19868) ;

CALL ImportField(250110005, 'Дата подачи сведений об исполнении / прекращении', 'DocBaseNotifyDate', 'Дата подачи сведений об исполнении / прекращении', 'DocBaseNotifyDate', 2, 2501, 0, 0, '', 0, 19865) ;

CALL ImportField(250110006, 'Неопределенное количестов продукции', 'UnknownAmount', 'Неопределенное количестов продукции', 'UnknownAmount', 2, 2501, 0, 0, '', 0, 19869) ;

CALL ImportField(250110007, 'Сумма контракта на год', 'Summa', '', 'Summa', 2, 2501, 0, 0, '', 0, 19797) ;

CALL ImportField(250110008, 'Год', 'rnYear', 'Год', 'rnYear', 2, 2501, 0, 0, '', 0, 19854) ;

CALL ImportField(250110009, 'Номер', 'rnNumber', 'Номер', 'rnNumber', 2, 2501, 0, 0, '', 0, 19855) ;

CALL ImportField(250110010, 'Дата внесения в реестр', 'rnDate', 'Дата внесения в реестр', 'rnDate', 2, 2501, 0, 0, '', 0, 19856) ;

CALL ImportField(250110011, 'Код заказчика', 'rnClientID', 'Код заказчика', 'rnClientID', 2, 2501, 0, 0, '', 0, 19853) ;

CALL ImportField(250110012, 'Расшифровка рассмотрения', 'ReviewNote', '', 'ReviewNote', 2, 2501, 0, 0, '', 0, 19845) ;

CALL ImportField(250110013, 'Причина отклонения', 'RejectCls', '', 'RejectCls', 2, 2501, 0, 0, 'ПричинаОтклонКод', 0, 19836) ;

CALL ImportField(250110014, 'Причина отклонения (текст)', 'RejectCause', '', 'RejectCause', 2, 2501, 0, 0, 'ПричинаОтклонТекст', 0, 19837) ;

CALL ImportField(250110016, 'Уникальный номер', 'ReestrNumber', '', 'ReestrNumber', 2, 2501, 0, 0, '', 0, 19830) ;

CALL ImportField(250110017, 'Способ размещения заказа', 'protocolSaleType', 'Способ размещения заказа', 'protocolSaleType', 2, 2501, 0, 0, '', 0, 19860) ;

CALL ImportField(250110018, 'Дата подведения итогов', 'protocolResultDate', 'Дата подведения итогов', 'protocolResultDate', 2, 2501, 0, 0, '', 0, 19858) ;

CALL ImportField(250110021, 'Номер протокола', 'ProtocolNumber', '', 'ProtocolNumber', 2, 2501, 0, 0, '', 0, 19843) ;

CALL ImportField(250110022, 'Номер извещения о проведении торгов', 'protocolNotice', 'Номер извещения о проведении торгов', 'protocolNotice', 2, 2501, 0, 0, '', 0, 19857) ;

CALL ImportField(250110025, 'Дата протокола', 'ProtocolDate', '', 'ProtocolDate', 2, 2501, 0, 0, '', 0, 19844) ;

CALL ImportField(250110026, 'Дата оплаты', 'PaymentDate', '', 'PaymentDate', 2, 2501, 0, 0, '', 0, 19831) ;

CALL ImportField(250110027, 'Дата подачи сведений о контракте', 'NotifyDate', 'Дата подачи сведений о контракте', 'NotifyDate', 2, 2501, 0, 0, '', 0, 19861) ;

CALL ImportField(250110028, 'Примечание', 'Note', '', 'Note', 2, 2501, 0, 0, '', 0, 19821) ;

CALL ImportField(250110029, 'Наименование публично-правового образования', 'fsOrgan', 'Наименование публично-правового образования', 'fsOrgan', 2, 2501, 0, 0, '', 0, 19850) ;

CALL ImportField(250110030, 'Вид внебюджетных средств', 'fsOffBudget', 'Вид внебюджетных средств', 'fsOffBudget', 2, 2501, 0, 0, '', 0, 19852) ;

CALL ImportField(250110031, 'Наименование бюджета', 'fsBudgetName', 'Наименование бюджета', 'fsBudgetName', 2, 2501, 0, 0, '', 0, 19851) ;

CALL ImportField(250110032, 'Оплаченный аванс', 'FINCARDADVANCE', '', 'FINCARDADVANCE', 2, 2501, 0, 0, '', 0, 19833) ;

CALL ImportField(250110033, 'Мероприятие', 'FactCode', '', 'Fact', 2, 2501, 0, 0, '', 0, 36863) ;

CALL ImportField(250110035, 'Лицевой счет заказчика', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2501, 0, 0, '', 0, 19803) ;

CALL ImportField(250110036, 'Наименование поставщика', 'ExecuterName', '', 'Executer_Name', 2, 2501, 0, 0, '', 0, 24613) ;

CALL ImportField(250110037, 'КПП поставщика', 'ExecuterKPP', '', 'Executer_INN20', 2, 2501, 0, 0, '', 0, 24612) ;

CALL ImportField(250110038, 'ИНН поставщика', 'ExecuterINN', '', 'Executer_INN', 2, 2501, 0, 0, '', 0, 24611) ;

CALL ImportField(250110040, 'Номер контракта', 'DocNumber', '', 'DocNumber', 2, 2501, 0, 0, '', 0, 19798) ;

CALL ImportField(250110041, 'Метод авансирования', 'DeliveryRules', '', 'DeliveryRules', 2, 2501, 0, 0, '', 0, 19825) ;

CALL ImportField(250110042, 'Дата исполнения', 'CloseDate', '', 'CloseDate', 2, 2501, 0, 0, '', 0, 19824) ;

CALL ImportField(250110043, 'Наименование заказчика', 'ClientName', '', 'Client_Name', 2, 2501, 0, 0, '', 0, 24608) ;

CALL ImportField(250110044, 'КПП заказчика', 'ClientKPP', '', 'Client_INN20', 2, 2501, 0, 0, '', 0, 24607) ;

CALL ImportField(250110045, 'ИНН заказчика', 'ClientINN', '', 'Client_INN', 2, 2501, 0, 0, '', 0, 24606) ;

CALL ImportField(250110048, 'Процент аванса', 'CARDADVANCEPercent', '', 'CARDADVANCEPercent', 2, 2501, 0, 0, '', 0, 19807) ;

CALL ImportField(250110049, 'Аванс контракта на год', 'CARDADVANCE', '', 'CARDADVANCE', 2, 2501, 0, 0, '', 0, 19808) ;

CALL ImportField(250110052, 'Общая сумма контракта', 'AgreementSumma', '', 'AgreementSumma', 2, 2501, 0, 0, '', 0, 19826) ;

CALL ImportField(250110053, 'Оплачено за прошлые года', 'AGREEMENTFINSUMMA', '', 'AGREEMENTFINSUMMA', 2, 2501, 0, 0, '', 0, 19827) ;

CALL ImportField(250110054, 'Дата окончания срока действия', 'AgreementEndDate', '', 'AgreementEndDate', 2, 2501, 0, 0, '', 0, 19800) ;

CALL ImportField(250110055, 'Дата контракта', 'AgreementDate', '', 'AgreementDate', 2, 2501, 0, 0, '', 0, 19799) ;

CALL ImportField(250110056, 'Сумма аванса контракта', 'AgreementCARDADVANCE', '', 'AgreementCARDADVANCE', 2, 2501, 0, 0, '', 0, 19832) ;

CALL ImportField(250110057, 'Дата начала срока действия', 'AgreementBeginDate', '', 'AgreementBeginDate', 2, 2501, 0, 0, '', 0, 19841) ;

CALL ImportField(250110060, 'Дата рассмотрения Финансовым органом', 'AcceptDate', '', 'AcceptDate', 2, 2501, 0, 0, '', 0, 19806) ;

CALL ImportField(250110061, 'Страна исполнителя', 'ExecuterCountry', 'Страна исполнителя', 'Executer_Country', 2, 2501, 0, 0, '', 0, 24610) ;

CALL ImportField(250110062, 'Адрес исполнителя', 'ExecuterAddress', 'Адрес исполнителя', 'Executer_Address', 2, 2501, 0, 0, '', 0, 24609) ;

CALL ImportField(250110063, 'Телефон исполнителя', 'ExecuterPhone', 'Телефон исполнителя', 'Executer_Phone', 2, 2501, 0, 0, '', 0, 24614) ;

CALL ImportField(250110064, 'Статус исполнителя', 'ExecuterStatus', 'Статус исполнителя', 'Executer_Status', 2, 2501, 0, 0, '', 0, 24615) ;

CALL ImportField(250110065, 'Содержание гос.контракта', 'purportDoc', '', 'purportDoc', 2, 2501, 0, 0, '', 0, 19849) ;

CALL ImportField(250110066, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 2, 2501, 0, 0, '', 0, 19814) ;

CALL ImportField(250110070, 'EXECUTERACCREF_BANKBIK', 'EXECUTERACCREF_BANKBIK', '', 'EXECUTERACCREF_BANKBIK', 2, 2501, 0, 1, '', 0, null) ;

CALL ImportField(250110071, 'EXECUTERACCREF_BANKCOR', 'EXECUTERACCREF_BANKCOR', '', 'EXECUTERACCREF_BANKCOR', 2, 2501, 0, 1, '', 0, null) ;

CALL ImportField(250110074, 'Последнее уточнение', 'LastAdjustment', '', 'LastAdjustment', 2, 2501, 0, 1, '', 0, null) ;

CALL ImportField(250110075, 'Номер изменений', 'ReestrVersion', 'Номер реестровой записи. Номер изменений', 'ReestrVersion', 2, 2501, 0, 0, '', 0, null) ;

CALL ImportField(250110076, 'Мероприятие (Ключ)', 'Fact', '', 'FactKey', 2, 2501, 0, 1, '', 0, 19822) ;

CALL ImportField(250111001, 'Сумма НДС', 'VatSumma', '', 'VatSumma', 2, 2501, 1, 0, '', 0, 20134) ;

CALL ImportField(250111002, 'Процент НДС', 'VatPercent', '', 'VatPercent', 2, 2501, 1, 0, '', 0, 20133) ;

CALL ImportField(250111003, 'Сумма с учетом НДС', 'Summa', '', 'Summa', 2, 2501, 1, 0, '', 0, 20140) ;

CALL ImportField(250111005, 'Наименование продукции', 'ProductName', '', 'ProductName', 2, 2501, 1, 0, '', 0, 20697) ;

CALL ImportField(250111008, 'Цена с НДС', 'PriceVAT', 'Цена с НДС', 'PriceVAT', 2, 2501, 1, 0, '', 0, 20152) ;

CALL ImportField(250111009, 'Цена за единицу', 'Price', '', 'Price', 2, 2501, 1, 0, '', 0, 20131) ;

CALL ImportField(250111011, 'Примечание', 'Note', '', 'Note', 2, 2501, 1, 0, '', 0, 20146) ;

CALL ImportField(250111013, 'Сумма финансирования на год', 'FinSumma', '', 'FinSumma', 2, 2501, 1, 0, '', 0, 20150) ;

CALL ImportField(250111014, 'Лицевой счет УФК получателя', 'FacialCode', '', 'FacialCode', 2, 2501, 1, 0, '', 0, 17149) ;

CALL ImportField(250111015, 'Лицевой счет получателя', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2501, 1, 0, '', 0, 20143) ;

CALL ImportField(250111016, 'Стоимость', 'Cost', '', 'Cost', 2, 2501, 1, 0, '', 0, 20132) ;

CALL ImportField(250111021, 'Количество', 'Amount', '', 'Amount', 2, 2501, 1, 0, '', 0, 20130) ;

CALL ImportField(250112001, 'Год', 'FinYear', 'Год', 'FinYear', 2, 2501, 2, 0, '', 0, 20298) ;

CALL ImportField(250112002, 'Примечание', 'Note', 'Примечание', 'Note', 2, 2501, 2, 0, '', 0, 20297) ;

CALL ImportField(250112003, 'КФСР', 'KFSR', 'КФСР', 'KFSR', 2, 2501, 2, 0, '', 0, 20225) ;

CALL ImportField(250112004, 'КЭСР', 'KESR', 'КЭСР', 'KESR', 2, 2501, 2, 0, '', 0, 20226) ;

CALL ImportField(250112008, 'Тип средств', 'MEANSTYPE', 'Тип средств', 'MEANSTYPE', 2, 2501, 2, 0, '', 0, 20245) ;

CALL ImportField(250112009, 'Сумма', 'SUMMA', 'Сумма', 'SUMMA', 2, 2501, 2, 0, '', 0, 20242) ;

CALL ImportField(250112010, 'КВР', 'KVRCode', 'КВР', 'KVR', 2, 2501, 2, 0, '', 0, 25467) ;

CALL ImportField(250112011, 'КЦСР', 'KCSRCode', 'КЦСР', 'KCSR', 2, 2501, 2, 0, '', 0, 25462) ;

CALL ImportField(250112012, 'КВСР', 'KVSRCode', 'КВСР', 'KVSR', 2, 2501, 2, 0, '', 0, 25472) ;

-- Договора, УРМ+Бюджет(2)
CALL ImportField(250210001, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 2, 2502, 0, 0, '', 0, 19814) ;

CALL ImportField(250210002, 'Сумма на год', 'Summa', '', 'Summa', 2, 2502, 0, 0, '', 0, 19797) ;

CALL ImportField(250210003, '№ гос. контракта', 'StateOrderNumber', '', 'StateOrderNumber', 2, 2502, 0, 0, '', 0, 19798) ;

CALL ImportField(250210004, 'Результаты рассмотрения', 'ReviewNote', '', 'ReviewNote', 2, 2502, 0, 0, '', 0, 19845) ;

CALL ImportField(250210005, 'Причина отклонения', 'RejectCls', '', 'RejectCls', 2, 2502, 0, 0, 'ПричинаОтклонКод', 0, 19836) ;

CALL ImportField(250210006, 'Причина отклонения (текст)', 'RejectCause', '', 'RejectCause', 2, 2502, 0, 0, 'ПричинаОтклонТекст', 0, 19837) ;

CALL ImportField(250210008, 'Уникальный номер', 'ReestrNumber', '', 'ReestrNumber', 2, 2502, 0, 0, '', 0, 19830) ;

CALL ImportField(250210009, 'Дата оплаты', 'PaymentDate', '', 'PaymentDate', 2, 2502, 0, 0, '', 0, 19831) ;

CALL ImportField(250210010, 'Примечание', 'Note', '', 'Note', 2, 2502, 0, 0, '', 0, 19821) ;

CALL ImportField(250210011, 'Сумма оплаты аванса договора на начало года', 'FinCardAdvance', '', 'FinCardAdvance', 2, 2502, 0, 0, '', 0, 19833) ;

CALL ImportField(250210012, 'Мероприятие', 'FactCode', '', 'Fact', 2, 2502, 0, 0, '', 0, 36863) ;

CALL ImportField(250210013, 'Л/с ФК', 'FacialCode', '', 'FacialCode', 2, 2502, 0, 0, '', 0, null) ;

CALL ImportField(250210014, 'Л/c заказчика', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2502, 0, 0, '', 0, 19803) ;

CALL ImportField(250210015, 'Наименование исполнителя', 'ExecuterName', '', 'Executer_Name', 2, 2502, 0, 0, '', 0, 24613) ;

CALL ImportField(250210016, 'КПП исполнителя', 'ExecuterKPP', '', 'Executer_INN20', 2, 2502, 0, 0, '', 0, 24612) ;

CALL ImportField(250210017, 'ИНН исполнителя', 'ExecuterINN', '', 'Executer_INN', 2, 2502, 0, 0, '', 0, 24611) ;

CALL ImportField(250210019, 'Номер договора', 'DocNumber', '', 'DocNumber', 2, 2502, 0, 0, '', 0, 19798) ;

CALL ImportField(250210020, 'Условия поставки', 'DeliveryRules', '', 'DeliveryRules', 2, 2502, 0, 0, '', 0, 19825) ;

CALL ImportField(250210022, 'Номер документа закрытия', 'CloseDocNum', '', 'CloseDocNum', 2, 2502, 0, 0, '', 0, 19739) ;

CALL ImportField(250210023, 'Дата исполнения', 'CloseDate', '', 'CloseDate', 2, 2502, 0, 0, '', 0, 19824) ;

CALL ImportField(250210024, 'Наименование заказчика', 'ClientName', '', 'Client_Name', 2, 2502, 0, 0, '', 0, 24608) ;

CALL ImportField(250210025, 'КПП заказчика', 'ClientKPP', '', 'Client_INN20', 2, 2502, 0, 0, '', 0, 24607) ;

CALL ImportField(250210026, 'ИНН заказчика', 'ClientINN', '', 'Client_INN', 2, 2502, 0, 0, '', 0, 24606) ;

CALL ImportField(250210029, 'Процент аванса', 'CardAdvancePercent', '', 'CardAdvancePercent', 2, 2502, 0, 0, '', 0, 19807) ;

CALL ImportField(250210030, 'Аванс на год', 'CardAdvance', '', 'CardAdvance', 2, 2502, 0, 0, '', 0, 19808) ;

CALL ImportField(250210033, 'Сумма договора', 'AgreementSumma', '', 'AgreementSumma', 2, 2502, 0, 0, '', 0, 19826) ;

CALL ImportField(250210034, 'Сумма оплаты договора на начало года', 'AgreementFinSumma', '', 'AgreementFinSumma', 2, 2502, 0, 0, '', 0, 19827) ;

CALL ImportField(250210035, 'Дата окончания', 'AgreementEndDate', '', 'AgreementEndDate', 2, 2502, 0, 0, '', 0, 19800) ;

CALL ImportField(250210036, 'Дата договора', 'AgreementDate', '', 'AgreementDate', 2, 2502, 0, 0, '', 0, 19799) ;

CALL ImportField(250210037, 'Сумма аванса', 'AgreementCardAdvance', '', 'AgreementCardAdvance', 2, 2502, 0, 0, '', 0, 19832) ;

CALL ImportField(250210038, 'Дата начала', 'AgreementBeginDate', '', 'AgreementBeginDate', 2, 2502, 0, 0, '', 0, 19841) ;

CALL ImportField(250210041, 'Дата принятия/отклонения', 'AcceptDate', '', 'AcceptDate', 2, 2502, 0, 0, '', 0, 19806) ;

CALL ImportField(250210042, 'Содержание договора', 'PurportDoc', '', 'PurportDoc', 2, 2502, 0, 0, '', 0, 19849) ;

CALL ImportField(250210043, 'Неопределенное количество продукции', 'UnknownAmount', '', 'UnknownAmount', 2, 2502, 0, 0, '', 0, 19869) ;

CALL ImportField(250210044, 'Счет исполнителя', 'ExecuterAccName', '', 'ExecuterAccRef', 2, 2502, 0, 0, '', 0, 17112) ;

CALL ImportField(250210045, 'Страна исполнителя', 'ExecuterCountry', 'Страна исполнителя', 'Executer_Country', 2, 2502, 0, 0, '', 0, 24610) ;

CALL ImportField(250210046, 'Адрес исполнителя', 'ExecuterAddress', 'Адрес исполнителя', 'Executer_Address', 2, 2502, 0, 0, '', 0, 24609) ;

CALL ImportField(250210047, 'Телефон исполнителя', 'ExecuterPhone', 'Телефон исполнителя', 'Executer_Phone', 2, 2502, 0, 0, '', 0, 24614) ;

CALL ImportField(250210048, 'Статус исполнителя', 'ExecuterStatus', 'Статус исполнителя', 'Executer_Status', 2, 2502, 0, 0, '', 0, 24615) ;

CALL ImportField(250210049, 'Тип документа', 'DocType', '', 'DocType', 2, 2502, 0, 0, '', 0, 26539) ;

CALL ImportField(250210053, 'Номер сведения', 'InfoNumber', '', 'InfoNumber', 2, 2502, 0, 0, '', 0, 29903) ;

CALL ImportField(250210055, 'EXECUTERACCREF_BANKBIK', 'EXECUTERACCREF_BANKBIK', '', 'EXECUTERACCREF_BANKBIK', 2, 2502, 0, 1, '', 0, null) ;

CALL ImportField(250210056, 'EXECUTERACCREF_BANKCOR', 'EXECUTERACCREF_BANKCOR', '', 'EXECUTERACCREF_BANKCOR', 2, 2502, 0, 1, '', 0, null) ;

CALL ImportField(250210057, 'Последнее уточнение', 'LastAdjustment', '', 'LastAdjustment', 2, 2502, 0, 1, '', 0, null) ;

CALL ImportField(250210058, 'Мероприятие (Ключ)', 'Fact', '', 'FactKey', 2, 2502, 0, 1, '', 0, 19822) ;

CALL ImportField(250211001, 'Сумма на год', 'Summa', '', 'Summa', 2, 2502, 1, 0, '', 0, 20112) ;

CALL ImportField(250211002, 'Сумма этапа', 'StepSumma', '', 'StepSumma', 2, 2502, 1, 0, '', 0, 20121) ;

CALL ImportField(250211003, 'Оплачено', 'StepFinSumma', '', 'StepFinSumma', 2, 2502, 1, 0, '', 0, 20122) ;

CALL ImportField(250211004, 'Номер этапа', 'ANumber', '', 'ANumber', 2, 2502, 1, 0, '', 0, 20109) ;

CALL ImportField(250211005, 'Описание', 'Note', '', 'Note', 2, 2502, 1, 0, '', 0, 20113) ;

CALL ImportField(250211006, 'Дата окончания', 'EndStepDate', '', 'EndStepDate', 2, 2502, 1, 0, '', 0, 20111) ;

CALL ImportField(250211008, 'Номер документа закрытия', 'CloseDocNum', '', 'CloseDocNum', 2, 2502, 1, 0, '', 0, 19739) ;

CALL ImportField(250211009, 'Дата начала', 'BeginStepDate', '', 'BeginStepDate', 2, 2502, 1, 0, '', 0, 20110) ;

CALL ImportField(250211010, 'Дата исполнения', 'AcceptDate', '', 'AcceptDate', 2, 2502, 1, 0, '', 0, 20114) ;

CALL ImportField(250212001, 'Сумма БО в прошлом году', 'SummaPreviousYear', '', 'SummaPreviousYear', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212002, 'Сумма оплаты БО в прошлом году', 'SummaFinPreviousYear', '', 'SummaFinPreviousYear', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212003, 'Сумма', 'Summa', '', 'Summa', 2, 2502, 2, 0, '', 0, 20140) ;

CALL ImportField(250212004, 'Суб КЭСР', 'SubKESR', '', 'SubKESR', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212005, 'Район', 'Region', '', 'Region', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212006, 'Квартал IV', 'Quarter4', '', 'Quarter4', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212007, 'Квартал III', 'Quarter3', '', 'Quarter3', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212008, 'Квартал II', 'Quarter2', '', 'Quarter2', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212009, 'Квартал I', 'Quarter1', '', 'Quarter1', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212010, 'Тип обязательства', 'PromiseType', '', 'PromiseType', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212011, 'Номер уточняемого обязательства', 'ParentNumber', '', 'ParentNumber', 2, 2502, 2, 1, '', 0, null) ;

CALL ImportField(250212012, 'Номер обязательства', 'ANumber', '', 'ANumber', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212013, 'Декабрь', 'Month12', '', 'Month12', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212014, 'Ноябрь', 'Month11', '', 'Month11', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212015, 'Октябрь', 'Month10', '', 'Month10', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212016, 'Сентябрь', 'Month09', '', 'Month09', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212017, 'Август', 'Month08', '', 'Month08', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212018, 'Июль', 'Month07', '', 'Month07', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212019, 'Июнь', 'Month06', '', 'Month06', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212020, 'Май', 'Month05', '', 'Month05', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212021, 'Апрель', 'Month04', '', 'Month04', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212022, 'Март', 'Month03', '', 'Month03', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212023, 'Февраль', 'Month02', '', 'Month02', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212024, 'Январь', 'Month01', '', 'Month01', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212025, 'Тип средств', 'MeansType', '', 'MeansType', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212026, 'КВСР', 'KVSR', '', 'KVSR', 2, 2502, 2, 1, '', 0, null) ;

CALL ImportField(250212027, 'КВР', 'KVR', '', 'KVR', 2, 2502, 2, 1, '', 0, null) ;

CALL ImportField(250212028, 'КФСР', 'KFSR', '', 'KFSR', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212029, 'КЭСР', 'KESR', '', 'KESR', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212030, 'КЦСР', 'KCSR', '', 'KCSR', 2, 2502, 2, 1, '', 0, null) ;

CALL ImportField(250212031, 'Код доп. информации', 'FinTypeCode', '', 'FinType', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212032, 'Источник финансирования', 'FinSource', '', 'FinSource', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212033, 'Мероприятие', 'FactCode', '', 'Fact', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212034, 'Л/с ФК', 'FacialCode', '', 'FacialCode', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212035, 'Лицевой счет', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212036, 'Направление', 'DirectionCls', '', 'DirectionClsKey', 2, 2502, 2, 1, '', 0, null) ;

CALL ImportField(250212037, 'Операция', 'BuhOperationCls', 'Операция', 'BuhOperationCls', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212038, 'Классификация (+)', 'TreeOwner0', 'Классификация', 'BudTree', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212040, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsCode', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212041, 'КВСР', 'KVSRCode', '', 'KVSR', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212042, 'КВР', 'KVRCode', '', 'KVR', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212043, 'КЦСР', 'KCSRCode', '', 'KCSR', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212044, 'Номер этапа', 'StepNumber', '', 'StepNumber', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212045, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212046, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212047, 'Сумма второго года', 'SummaYear2', '', 'SummaYear2', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212048, 'Сумма третьего года', 'SummaYear3', '', 'SummaYear3', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212049, 'Номер обязательства', 'PromiseNumber', '', 'PromiseNumber', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212050, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212051, 'Направление (Ключ)', 'DirectionClsCode', '', 'DirectionCls', 2, 2502, 2, 0, '', 0, null) ;

CALL ImportField(250212052, 'Мероприятие (Ключ)', 'Fact', '', 'FactKey', 2, 2502, 2, 1, '', 0, null) ;

CALL ImportField(250212053, 'Код доп. информации', 'FinType', '', 'FinTypeKey', 2, 2502, 2, 1, '', 0, null) ;

CALL ImportField(250212054, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 2, 2502, 2, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(250212055, 'Объект', 'InvestObjectCode', 'Объект', ' ', 2, 2502, 2, 0, 'Объект', 0, null) ;

CALL ImportField(250213001, 'Размер НДС', 'VATSumma', '', 'VATSumma', 2, 2502, 3, 0, '', 0, null) ;

CALL ImportField(250213002, 'Процент НДС', 'VATPercent', '', 'VATPercent', 2, 2502, 3, 0, '', 0, null) ;

CALL ImportField(250213003, 'Сумма с учетом НДС', 'Summa', '', 'Summa', 2, 2502, 3, 0, '', 0, 20242) ;

CALL ImportField(250213004, 'Наименование предмета', 'ProductName', '', 'ProductName', 2, 2502, 3, 0, '', 0, null) ;

CALL ImportField(250213005, 'Предмет договора (+)', 'Product', '', 'Product', 2, 2502, 3, 0, '', 0, null) ;

CALL ImportField(250213006, 'Цена с НДС', 'PriceVAT', 'Цена с НДС', 'PriceVAT', 2, 2502, 3, 0, '', 0, null) ;

CALL ImportField(250213007, 'Цена за единицу', 'Price', '', 'Price', 2, 2502, 3, 0, '', 0, null) ;

CALL ImportField(250213008, 'Стоимость', 'Cost', '', 'Cost', 2, 2502, 3, 0, '', 0, null) ;

CALL ImportField(250213009, 'Количество', 'Amount', '', 'Amount', 2, 2502, 3, 1, '', 0, null) ;

-- Документы исполнения , Бюджет(1)
CALL ImportField(250310039, 'Сумма документа', 'ExecSumms', '', ' ', 1, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250310040, 'Л/с в ФК(Получатель)', 'FacialCode', '', ' ', 1, 2503, 0, 0, '', 0, null) ;

CALL ImportField(250311014, 'НДС', 'NDS', '', ' ', 1, 2503, 1, 0, '', 0, null) ;

CALL ImportField(250311015, 'Продукция', 'ProductCollaps', '', ' ', 1, 2503, 1, 0, '', 0, null) ;

-- Документы исполнения , УРМ+Бюджет(2)
CALL ImportField(250310001, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 2, 2503, 0, 0, '', 0, 19749) ;

CALL ImportField(250310002, 'Наименование поставщика', 'SupplierName', '', 'SupplierName', 2, 2503, 0, 0, '', 0, 16646) ;

CALL ImportField(250310003, 'КПП поставщика', 'SupplierKPP', '', 'SupplierKPP', 2, 2503, 0, 0, '', 0, 16653) ;

CALL ImportField(250310004, 'ИНН поставщика', 'SupplierINN', '', 'SupplierINN', 2, 2503, 0, 0, '', 0, 16645) ;

CALL ImportField(250310005, 'Расчетный счет поставщика', 'SupplierAcc', '', 'SupplierAcc', 2, 2503, 0, 0, '', 0, 17112) ;

CALL ImportField(250310006, 'Сумма документа', 'Summa', '', 'Summa', 2, 2503, 0, 0, '', 0, 19744) ;

CALL ImportField(250310007, 'Номер этапа договора', 'StepNumber', '', 'StepNumber', 2, 2503, 0, 0, '', 0, 19752) ;

CALL ImportField(250310008, 'Результаты рассмотрения', 'ReviewNote', '', 'ReviewNote', 2, 2503, 0, 0, '', 0, 19763) ;

CALL ImportField(250310014, 'Причина отклонения', 'RejectCls', '', 'RejectCls', 2, 2503, 0, 0, 'ПричинаОтклонКод', 0, 19757) ;

CALL ImportField(250310015, 'Причина отклонения (текст)', 'RejectCause', '', 'RejectCause', 2, 2503, 0, 0, 'ПричинаОтклонТекст', 0, 19758) ;

CALL ImportField(250310017, 'Реестровый номер документа', 'ReestrNumber', '', 'ReestrNumber', 2, 2503, 0, 0, '', 0, 19756) ;

CALL ImportField(250310018, 'Наименование получателя', 'RecipientName', '', 'RecipientName', 2, 2503, 0, 0, '', 0, 16646) ;

CALL ImportField(250310019, 'КПП получателя', 'RecipientKPP', '', 'RecipientKPP', 2, 2503, 0, 0, '', 0, 16653) ;

CALL ImportField(250310020, 'ИНН получателя', 'RecipientINN', '', 'RecipientINN', 2, 2503, 0, 0, '', 0, 16645) ;

CALL ImportField(250310025, 'Примечание', 'Note', '', 'Note', 2, 2503, 0, 0, '', 0, 19762) ;

CALL ImportField(250310026, 'Мероприятие', 'FactCode', '', 'Fact', 2, 2503, 0, 0, '', 0, 36863) ;

CALL ImportField(250310027, 'Лицевой счет получателя', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2503, 0, 0, '', 0, 19754) ;

CALL ImportField(250310028, 'Сумма финансирования в прошлом году', 'ExecDocFinSumma', '', 'ExecDocFinSumma', 2, 2503, 0, 0, '', 0, 19767) ;

CALL ImportField(250310029, 'Дата документа', 'DocumentDate', '', 'DocumentDate', 2, 2503, 0, 0, '', 0, 19740) ;

CALL ImportField(250310030, 'Тип документа', 'DocType', '', 'DocType', 2, 2503, 0, 0, '', 0, 19738) ;

CALL ImportField(250310031, 'Номер документа', 'DocNumber', '', 'DocNumber', 2, 2503, 0, 0, '', 0, 19739) ;

CALL ImportField(250310034, 'Номер договора', 'AgreementNumber', '', 'AgreementNumber', 2, 2503, 0, 0, '', 0, 19798) ;

CALL ImportField(250310036, 'Дата рассмотрения ФО', 'AcceptDate', '', 'AcceptDate', 2, 2503, 0, 0, '', 0, 19741) ;

CALL ImportField(250310041, 'Последнее уточнение', 'LastAdjustment', '', 'LastAdjustment', 2, 2503, 0, 1, '', 0, null) ;

CALL ImportField(250310042, 'Мероприятие (Ключ)', 'Fact', '', 'FactKey', 2, 2503, 0, 1, '', 0, 19769) ;

CALL ImportField(250310043, 'Ссылка на р/с поставщика', 'SupplierAcc_Ref', '', 'Supplieracc_ref', 2, 2503, 0, 1, '', 0, 17109) ;

CALL ImportField(250311001, 'Сумма НДС', 'VATSumma', '', 'VATSumma', 2, 2503, 1, 0, '', 0, 20160) ;

CALL ImportField(250311002, 'Процент НДС', 'VATPercent', '', 'VATPercent', 2, 2503, 1, 0, '', 0, 20159) ;

CALL ImportField(250311004, 'Сумма с учетом НДС', 'Summa', '', 'Summa', 2, 2503, 1, 0, '', 0, 20166) ;

CALL ImportField(250311005, 'Наименование продукции', 'ProductName', '', 'ProductName', 2, 2503, 1, 0, '', 0, 20697) ;

CALL ImportField(250311007, 'Цена с НДС', 'PriceVAT', 'Цена с НДС', 'PriceVAT', 2, 2503, 1, 0, '', 0, 20172) ;

CALL ImportField(250311008, 'Цена единицы продукции', 'Price', '', 'Price', 2, 2503, 1, 0, '', 0, 20157) ;

CALL ImportField(250311012, 'Стоимость поставленной продукции', 'Cost', '', 'Cost', 2, 2503, 1, 0, '', 0, 20158) ;

CALL ImportField(250311013, 'Количество продукции', 'Amount', '', 'Amount', 2, 2503, 1, 0, '', 0, 20156) ;

CALL ImportField(250312002, 'Номер обязательства', 'ANumber', '', 'ANumber', 2, 2503, 2, 0, '', 0, 20223) ;

CALL ImportField(250312003, 'Операция', 'BuhOperationCls', '', 'BuhOperationCls', 2, 2503, 2, 0, '', 0, 20279) ;

CALL ImportField(250312004, 'Направление', 'DirectionClsCode', '', 'DirectionCls', 2, 2503, 2, 0, '', 0, 36861) ;

CALL ImportField(250312005, 'Лицевой счет', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2503, 2, 0, '', 0, 20249) ;

CALL ImportField(250312007, 'Мероприятие', 'FactCode', '', 'Fact', 2, 2503, 2, 0, '', 0, 36863) ;

CALL ImportField(250312008, 'Источник финансирования', 'FinSource', '', 'FinSource', 2, 2503, 2, 0, '', 0, 20246) ;

CALL ImportField(250312009, 'Код доп. информации', 'FinTypeCode', '', 'FinType', 2, 2503, 2, 0, '', 0, 36853) ;

CALL ImportField(250312010, 'КЦСР', 'KCSRCode', '', 'KCSRCode', 2, 2503, 2, 0, '', 0, 25462) ;

CALL ImportField(250312011, 'КЭСР', 'KESR', '', 'KESR', 2, 2503, 2, 0, '', 0, 20226) ;

CALL ImportField(250312012, 'КФСР', 'KFSR', '', 'KFSR', 2, 2503, 2, 0, '', 0, 20225) ;

CALL ImportField(250312013, 'КВР', 'KVRCode', '', 'KVRCode', 2, 2503, 2, 0, '', 0, 25467) ;

CALL ImportField(250312014, 'КВСР', 'KVSRCode', '', 'KVSRCode', 2, 2503, 2, 0, '', 0, 25472) ;

CALL ImportField(250312015, 'Тип средств', 'MeansType', '', 'MeansType', 2, 2503, 2, 0, '', 0, 20245) ;

CALL ImportField(250312016, 'Январь', 'Month01', '', 'Month01', 2, 2503, 2, 0, '', 0, 20230) ;

CALL ImportField(250312017, 'Февраль', 'Month02', '', 'Month02', 2, 2503, 2, 0, '', 0, 20231) ;

CALL ImportField(250312018, 'Март', 'Month03', '', 'Month03', 2, 2503, 2, 0, '', 0, 20232) ;

CALL ImportField(250312019, 'Апрель', 'Month04', '', 'Month04', 2, 2503, 2, 0, '', 0, 20233) ;

CALL ImportField(250312020, 'Май', 'Month05', '', 'Month05', 2, 2503, 2, 0, '', 0, 20234) ;

CALL ImportField(250312021, 'Июнь', 'Month06', '', 'Month06', 2, 2503, 2, 0, '', 0, 20235) ;

CALL ImportField(250312022, 'Июль', 'Month07', '', 'Month07', 2, 2503, 2, 0, '', 0, 20236) ;

CALL ImportField(250312023, 'Август', 'Month08', '', 'Month08', 2, 2503, 2, 0, '', 0, 20237) ;

CALL ImportField(250312024, 'Сентябрь', 'Month09', '', 'Month09', 2, 2503, 2, 0, '', 0, 20238) ;

CALL ImportField(250312025, 'Октябрь', 'Month10', '', 'Month10', 2, 2503, 2, 0, '', 0, 20239) ;

CALL ImportField(250312026, 'Ноябрь', 'Month11', '', 'Month11', 2, 2503, 2, 0, '', 0, 20240) ;

CALL ImportField(250312027, 'Декабрь', 'Month12', '', 'Month12', 2, 2503, 2, 0, '', 0, 20241) ;

CALL ImportField(250312029, 'Тип обязательства', 'PromiseType', '', 'PromiseType', 2, 2503, 2, 0, '', 0, 20261) ;

CALL ImportField(250312030, 'Квартал I', 'Quarter1', '', 'Quarter1', 2, 2503, 2, 0, '', 0, 20266) ;

CALL ImportField(250312031, 'Квартал II', 'Quarter2', '', 'Quarter2', 2, 2503, 2, 0, '', 0, 20267) ;

CALL ImportField(250312032, 'Квартал III', 'Quarter3', '', 'Quarter3', 2, 2503, 2, 0, '', 0, 20268) ;

CALL ImportField(250312033, 'Квартал IV', 'Quarter4', '', 'Quarter4', 2, 2503, 2, 0, '', 0, 20269) ;

CALL ImportField(250312034, 'Район', 'Region', '', 'Region', 2, 2503, 2, 0, '', 0, 20243) ;

CALL ImportField(250312035, 'Суб КЭСР', 'SubKESR', '', 'SubKESR', 2, 2503, 2, 0, '', 0, 20244) ;

CALL ImportField(250312037, 'Сумма оплаты БО в прошлом году', 'SummaFinPreviousYear', '', 'SummaFinPreviousYear', 2, 2503, 2, 0, '', 0, 20265) ;

CALL ImportField(250312038, 'Сумма БО в прошлом году', 'SummaPreviousYear', '', 'SummaPreviousYear', 2, 2503, 2, 0, '', 0, 20264) ;

CALL ImportField(250312039, 'Код целевых средств', 'TransfertClsCode', '', 'TransfertClsCode', 2, 2503, 2, 0, '', 0, 25326) ;

CALL ImportField(250312041, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 2, 2503, 2, 0, '', 0, 27825) ;

CALL ImportField(250312042, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 2, 2503, 2, 0, '', 0, 27849) ;

CALL ImportField(250312043, 'Сумма третьего года', 'SummaYear3', '', 'SummaYear3', 2, 2503, 2, 0, '', 0, 20301) ;

CALL ImportField(250312044, 'Сумма второго года', 'SummaYear2', '', 'SummaYear2', 2, 2503, 2, 0, '', 0, 20300) ;

CALL ImportField(250312045, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 2, 2503, 2, 0, '', 0, 26641) ;

CALL ImportField(250312046, 'Направление (Ключ)', 'DirectionCls', '', 'DirectionClsKey', 2, 2503, 2, 1, '', 0, 20277) ;

CALL ImportField(250312047, 'Мероприятие (Ключ)', 'Fact', '', 'FactKey', 2, 2503, 2, 1, '', 0, 20248) ;

CALL ImportField(250312048, 'Код доп. информации', 'FinType', '', 'FinTypeKey', 2, 2503, 2, 1, '', 0, 20247) ;

CALL ImportField(250312049, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 2, 2503, 2, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(250312050, 'Объект', 'InvestObjectCode', 'Объект', ' ', 2, 2503, 2, 0, 'Объект', 0, null) ;

-- Муниципальные контракты, УРМ+Бюджет(2)
CALL ImportField(250410001, 'Страна исполнителя', 'ExecuterCountry', 'Страна исполнителя', 'Executer_Country', 2, 2504, 0, 0, '', 0, 24610) ;

CALL ImportField(250410002, 'Адрес исполнителя', 'ExecuterAddress', 'Адрес исполнителя', 'Executer_Address', 2, 2504, 0, 0, '', 0, 24609) ;

CALL ImportField(250410003, 'Телефон исполнителя', 'ExecuterPhone', 'Телефон исполнителя', 'Executer_Phone', 2, 2504, 0, 0, '', 0, 24614) ;

CALL ImportField(250410004, 'Статус исполнителя', 'ExecuterStatus', 'Статус исполнителя', 'Executer_Status', 2, 2504, 0, 0, '', 0, 24615) ;

CALL ImportField(250410005, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 2, 2504, 0, 0, '', 0, 19814) ;

CALL ImportField(250410006, 'Неопределенное количестов продукции', 'UnknownAmount', 'Неопределенное количестов продукции', 'UnknownAmount', 2, 2504, 0, 0, '', 0, 19869) ;

CALL ImportField(250410007, 'Сумма на год', 'Summa', '', 'Summa', 2, 2504, 0, 0, '', 0, 19797) ;

CALL ImportField(250410009, 'Год', 'rnYear', 'Год', 'rnYear', 2, 2504, 0, 0, '', 0, 19854) ;

CALL ImportField(250410010, 'Номер', 'rnNumber', 'Номер', 'rnNumber', 2, 2504, 0, 0, '', 0, 19855) ;

CALL ImportField(250410011, 'Дата внесения в реестр', 'rnDate', 'Дата внесения в реестр', 'rnDate', 2, 2504, 0, 0, '', 0, 19856) ;

CALL ImportField(250410012, 'Код заказчика', 'rnClientID', 'Код заказчика', 'rnClientID', 2, 2504, 0, 0, '', 0, 19853) ;

CALL ImportField(250410013, 'Результаты рассмотрения', 'ReviewNote', '', 'ReviewNote', 2, 2504, 0, 0, '', 0, 19845) ;

CALL ImportField(250410014, 'Причина отклонения', 'RejectCls', '', 'RejectCls', 2, 2504, 0, 0, 'ПричинаОтклонКод', 0, 19836) ;

CALL ImportField(250410015, 'Причина отклонения (текст)', 'RejectCause', '', 'RejectCause', 2, 2504, 0, 0, 'ПричинаОтклонТекст', 0, 19837) ;

CALL ImportField(250410017, 'Уникальный номер', 'ReestrNumber', '', 'ReestrNumber', 2, 2504, 0, 0, '', 0, 19830) ;

CALL ImportField(250410018, 'Содержание муп.контракта', 'PurportDoc', 'Содержание муп.контракта', 'PurportDoc', 2, 2504, 0, 0, '', 0, 19849) ;

CALL ImportField(250410020, 'Способ размещения заказа', 'protocolSaleType', 'Способ размещения заказа', 'protocolSaleType', 2, 2504, 0, 0, '', 0, 19860) ;

CALL ImportField(250410021, 'Дата подведения итогов', 'protocolResultDate', 'Дата подведения итогов', 'protocolResultDate', 2, 2504, 0, 0, '', 0, 19858) ;

CALL ImportField(250410024, 'Протокол (+)', 'ProtocolNumberTop', 'Протокол', 'ProtocolNumberTop', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410025, 'Номер протокола', 'ProtocolNumber', 'Номер протокола', 'ProtocolNumber', 2, 2504, 0, 0, '', 0, 19843) ;

CALL ImportField(250410026, 'Номер извещения о проведении торгов', 'protocolNotice', 'Номер извещения о проведении торгов', 'protocolNotice', 2, 2504, 0, 0, '', 0, 19857) ;

CALL ImportField(250410030, 'Дата протокола', 'ProtocolDate', '', 'ProtocolDate', 2, 2504, 0, 0, '', 0, 19844) ;

CALL ImportField(250410031, 'Дата оплаты', 'PaymentDate', '', 'PaymentDate', 2, 2504, 0, 0, '', 0, 19831) ;

CALL ImportField(250410032, 'Дата подачи сведений о контракте', 'NotifyDate', 'Дата подачи сведений о контракте', 'NotifyDate', 2, 2504, 0, 0, '', 0, 19861) ;

CALL ImportField(250410033, 'Примечание', 'Note', '', 'Note', 2, 2504, 0, 0, '', 0, 19821) ;

CALL ImportField(250410036, 'Наименование публично-правового образования', 'fsOrgan', 'Наименование публично-правового образования', 'fsOrgan', 2, 2504, 0, 0, '', 0, 19850) ;

CALL ImportField(250410039, 'Вид внебюджетных средств', 'fsOffBudget', 'Вид внебюджетных средств', 'fsOffBudget', 2, 2504, 0, 0, '', 0, 19852) ;

CALL ImportField(250410042, 'Наименование бюджета', 'fsBudgetName', 'Наименование бюджета', 'fsBudgetName', 2, 2504, 0, 0, '', 0, 19851) ;

CALL ImportField(250410043, 'Сумма оплаты аванса договора на начало года', 'FinCardAdvance', '', 'FinCardAdvance', 2, 2504, 0, 0, '', 0, 19833) ;

CALL ImportField(250410044, 'Мероприятие', 'FactCode', '', 'Fact', 2, 2504, 0, 0, '', 0, 36863) ;

CALL ImportField(250410046, 'Л/c заказчика', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2504, 0, 0, '', 0, 19803) ;

CALL ImportField(250410047, 'Наименование исполнителя', 'ExecuterName', '', 'Executer_Name', 2, 2504, 0, 0, '', 0, 24613) ;

CALL ImportField(250410048, 'КПП исполнителя', 'ExecuterKPP', '', 'Executer_INN20', 2, 2504, 0, 0, '', 0, 24612) ;

CALL ImportField(250410049, 'ИНН исполнителя', 'ExecuterINN', '', 'Executer_INN', 2, 2504, 0, 0, '', 0, 24611) ;

CALL ImportField(250410053, 'Счет исполнителя', 'ExecuterAccName', '', 'ExecuterAccName', 2, 2504, 0, 0, '', 0, 17112) ;

CALL ImportField(250410057, 'Номер договора', 'DocNumber', '', 'DocNumber', 2, 2504, 0, 0, '', 0, 19798) ;

CALL ImportField(250410058, 'Тип сведений', 'DocBaseType', 'Тип сведений', 'DocBaseType', 2, 2504, 0, 0, '', 0, 19867) ;

CALL ImportField(250410059, 'Основание и причина', 'DocBaseText', 'Основание и причина', 'DocBaseText', 2, 2504, 0, 0, '', 0, 19866) ;

CALL ImportField(250410060, 'Фактически оплачено', 'DocBaseSumma', 'Фактически оплачено', 'DocBaseSumma', 2, 2504, 0, 0, '', 0, 19868) ;

CALL ImportField(250410061, 'Дата подачи сведений об исполнении / прекращении', 'DocBaseNotifyDate', 'Дата подачи сведений об исполнении / прекращении', 'DocBaseNotifyDate', 2, 2504, 0, 0, '', 0, 19865) ;

CALL ImportField(250410062, 'Дата исполнения / прекращения контракта', 'DocBaseDate', 'Дата исполнения / прекращения контракта', 'DocBaseDate', 2, 2504, 0, 0, '', 0, 19864) ;

CALL ImportField(250410063, 'Условия поставки', 'DeliveryRules', '', 'DeliveryRules', 2, 2504, 0, 0, '', 0, 19825) ;

CALL ImportField(250410065, 'Номер документа закрытия', 'CloseDocNum', '', 'CloseDocNum', 2, 2504, 0, 0, '', 0, 19739) ;

CALL ImportField(250410066, 'Дата исполнения', 'CloseDate', '', 'CloseDate', 2, 2504, 0, 0, '', 0, 19824) ;

CALL ImportField(250410067, 'Наименование заказчика', 'ClientName', '', 'Client_Name', 2, 2504, 0, 0, '', 0, 24608) ;

CALL ImportField(250410068, 'КПП заказчика', 'ClientKPP', '', 'Client_INN20', 2, 2504, 0, 0, '', 0, 24607) ;

CALL ImportField(250410069, 'ИНН заказчика', 'ClientINN', '', 'Client_INN', 2, 2504, 0, 0, '', 0, 24606) ;

CALL ImportField(250410079, 'Процент аванса', 'CardAdvancePercent', '', 'CardAdvancePercent', 2, 2504, 0, 0, '', 0, 19807) ;

CALL ImportField(250410080, 'Аванс на год', 'CardAdvance', '', 'CardAdvance', 2, 2504, 0, 0, '', 0, 19808) ;

CALL ImportField(250410081, 'Сумма договора', 'AgreementSumma', '', 'AgreementSumma', 2, 2504, 0, 0, '', 0, 19826) ;

CALL ImportField(250410082, 'Сумма оплаты договора на начало года', 'AgreementFinSumma', '', 'AgreementFinSumma', 2, 2504, 0, 0, '', 0, 19827) ;

CALL ImportField(250410083, 'Дата окончания', 'AgreementEndDate', '', 'AgreementEndDate', 2, 2504, 0, 0, '', 0, 19800) ;

CALL ImportField(250410084, 'Дата договора', 'AgreementDate', '', 'AgreementDate', 2, 2504, 0, 0, '', 0, 19799) ;

CALL ImportField(250410085, 'Сумма аванса', 'AgreementCardAdvance', '', 'AgreementCardAdvance', 2, 2504, 0, 0, '', 0, 19832) ;

CALL ImportField(250410086, 'Дата начала', 'AgreementBeginDate', '', 'AgreementBeginDate', 2, 2504, 0, 0, '', 0, 19841) ;

CALL ImportField(250410088, 'Дата принятия/отклонения', 'AcceptDate', '', 'AcceptDate', 2, 2504, 0, 0, '', 0, 19806) ;

CALL ImportField(250410092, 'Номер сведения', 'InfoNumber', '', 'InfoNumber', 2, 2504, 0, 0, '', 0, 29903) ;

CALL ImportField(250410094, 'Тип документа', 'DocType', '', 'DocType', 2, 2504, 0, 0, '', 0, 26539) ;

CALL ImportField(250410095, 'EXECUTERACCREF_BANKCOR', 'EXECUTERACCREF_BANKCOR', '', 'EXECUTERACCREF_BANKCOR', 2, 2504, 0, 1, '', 0, null) ;

CALL ImportField(250410096, 'Последнее уточнение', 'LastAdjustment', '', 'LastAdjustment', 2, 2504, 0, 1, '', 0, null) ;

CALL ImportField(250410055, 'EXECUTERACCREF_BANKBIK', 'EXECUTERACCREF_BANKBIK', '', 'EXECUTERACCREF_BANKBIK', 2, 2504, 0, 1, '', 0, null) ;

CALL ImportField(250410097, 'Номер изменений', 'ReestrVersion', 'Номер реестровой записи. Номер изменений', 'ReestrVersion', 2, 2504, 0, 0, '', 0, null) ;

CALL ImportField(250410098, 'Мероприятие (Ключ)', 'Fact', '', 'FactKey', 2, 2504, 0, 1, '', 0, 19822) ;

CALL ImportField(250411001, 'Сумма на год', 'Summa', '', 'Summa', 2, 2504, 1, 0, '', 0, 20112) ;

CALL ImportField(250411002, 'Сумма этапа', 'StepSumma', '', 'StepSumma', 2, 2504, 1, 0, '', 0, 20121) ;

CALL ImportField(250411003, 'Оплачено', 'StepFinSumma', '', 'StepFinSumma', 2, 2504, 1, 0, '', 0, 20122) ;

CALL ImportField(250411004, 'Описание', 'Note', '', 'Note', 2, 2504, 1, 0, '', 0, 20113) ;

CALL ImportField(250411005, 'Дата окончания', 'EndStepDate', '', 'EndStepDate', 2, 2504, 1, 0, '', 0, 20111) ;

CALL ImportField(250411007, 'Номер документа закрытия', 'CloseDocNum', '', 'CloseDocNum', 2, 2504, 1, 0, '', 0, 19739) ;

CALL ImportField(250411008, 'Дата начала', 'BeginStepDate', '', 'BeginStepDate', 2, 2504, 1, 0, '', 0, 20110) ;

CALL ImportField(250411009, 'Номер этапа', 'ANumber', '', 'ANumber', 2, 2504, 1, 0, '', 0, 20109) ;

CALL ImportField(250411010, 'Дата исполнения', 'AcceptDate', '', 'AcceptDate', 2, 2504, 1, 0, '', 0, 20114) ;

CALL ImportField(250412001, 'Номер этапа', 'StepNumber', 'Номер этапа', 'StepNumber', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412002, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsCode', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412003, 'Классификация (+)', 'TreeOwner0', 'Классификация', 'BudTree', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412004, 'Сумма третьего года', 'summayear3', '', 'summayear3', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412005, 'Сумма второго года', 'summayear2', '', 'summayear2', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412006, 'Сумма БО в прошлом году', 'SummaPreviousYear', '', 'SummaPreviousYear', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412007, 'Сумма оплаты БО в прошлом году', 'SummaFinPreviousYear', '', 'SummaFinPreviousYear', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412008, 'Сумма', 'Summa', '', 'Summa', 2, 2504, 2, 0, '', 0, 20140) ;

CALL ImportField(250412009, 'Код субсидии', 'SubsidyClsCode', '', 'SubsidyClsCode', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412010, 'Суб КЭСР', 'SubKESR', '', 'SubKESR', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412011, 'Район', 'Region', '', 'Region', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412012, 'Квартал IV', 'Quarter4', '', 'Quarter4', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412013, 'Квартал III', 'Quarter3', '', 'Quarter3', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412014, 'Квартал II', 'Quarter2', '', 'Quarter2', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412015, 'Квартал I', 'Quarter1', '', 'Quarter1', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412016, 'Тип обязательства', 'PromiseType', '', 'PromiseType', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412017, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412018, 'Декабрь', 'Month12', '', 'Month12', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412019, 'Ноябрь', 'Month11', '', 'Month11', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412020, 'Октябрь', 'Month10', '', 'Month10', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412021, 'Сентябрь', 'Month09', '', 'Month09', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412022, 'Август', 'Month08', '', 'Month08', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412023, 'Июль', 'Month07', '', 'Month07', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412024, 'Июнь', 'Month06', '', 'Month06', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412025, 'Май', 'Month05', '', 'Month05', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412026, 'Апрель', 'Month04', '', 'Month04', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412027, 'Март', 'Month03', '', 'Month03', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412028, 'Февраль', 'Month02', '', 'Month02', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412029, 'Январь', 'Month01', '', 'Month01', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412030, 'Тип средств', 'MeansType', '', 'MeansType', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412031, 'КВСР', 'KVSRCode', '', 'KVSR', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412032, 'КВСР', 'KVSR', '', 'KVSR', 2, 2504, 2, 1, '', 0, null) ;

CALL ImportField(250412033, 'КВР', 'KVRCode', '', 'KVR', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412034, 'КВР', 'KVR', '', 'KVR', 2, 2504, 2, 1, '', 0, null) ;

CALL ImportField(250412035, 'КФСР', 'KFSR', '', 'KFSR', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412036, 'КЭСР', 'KESR', '', 'KESR', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412037, 'КЦСР', 'KCSRCode', '', 'KCSR', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412038, 'КЦСР', 'KCSR', '', 'KCSR', 2, 2504, 2, 1, '', 0, null) ;

CALL ImportField(250412039, 'Код доп. информации', 'FinTypeCode', '', 'FinType', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412040, 'Источник финансирования', 'FinSource', '', 'FinSource', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412041, 'Мероприятие', 'FactCode', '', 'Fact', 2, 2504, 2, 0, '', 0, 36863) ;

CALL ImportField(250412042, 'Л/с ФК', 'FacialCode', '', 'FacialCode', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412043, 'Лицевой счет', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412044, 'Направление', 'DirectionClsCode', '', 'DirectionCls', 2, 2504, 2, 0, '', 0, 36861) ;

CALL ImportField(250412045, 'Операция', 'BuhOperationCls', 'Операция', 'BuhOperationCls', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412046, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412047, 'Номер обязательства', 'ANumber', '', 'ANumber', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412049, 'Номер обязательства', 'PromiseNumber', '', 'PromiseNumber', 2, 2504, 2, 0, '', 0, null) ;

CALL ImportField(250412050, 'Направление (Ключ)', 'DirectionCls', '', 'DirectionClsKey', 2, 2504, 2, 1, '', 0, null) ;

CALL ImportField(250412051, 'Мероприятие (Ключ)', 'Fact', '', 'FactKey', 2, 2504, 2, 1, '', 0, 20248) ;

CALL ImportField(250412052, 'Код доп. информации (Ключ)', 'FinType', '', 'FinTypeKey', 2, 2504, 2, 1, '', 0, null) ;

CALL ImportField(250412053, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 2, 2504, 2, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(250412054, 'Объект', 'InvestObjectCode', 'Объект', ' ', 2, 2504, 2, 0, 'Объект', 0, null) ;

CALL ImportField(250413001, 'Размер НДС', 'VATSumma', '', 'VATSumma', 2, 2504, 3, 0, '', 0, null) ;

CALL ImportField(250413002, 'Процент НДС', 'VATPercent', '', 'VATPercent', 2, 2504, 3, 0, '', 0, null) ;

CALL ImportField(250413003, 'Сумма с учетом НДС', 'Summa', '', 'Summa', 2, 2504, 3, 0, '', 0, 20242) ;

CALL ImportField(250413004, 'Наименование предмета', 'ProductName', '', 'ProductName', 2, 2504, 3, 0, '', 0, null) ;

CALL ImportField(250413005, 'Предмет договора', 'Product', '', 'Product', 2, 2504, 3, 0, '', 0, null) ;

CALL ImportField(250413006, 'Цена с НДС', 'PriceVAT', 'Цена с НДС', 'PriceVAT', 2, 2504, 3, 0, '', 0, null) ;

CALL ImportField(250413007, 'Цена за единицу', 'Price', '', 'Price', 2, 2504, 3, 0, '', 0, null) ;

CALL ImportField(250413008, 'Лицевой счет получателя', 'FacialAcc_Cls', 'Лицевой счет получателя', 'FacialAcc_Cls', 2, 2504, 3, 0, '', 0, 20249) ;

CALL ImportField(250413009, 'Стоимость', 'Cost', '', 'Cost', 2, 2504, 3, 0, '', 0, null) ;

CALL ImportField(250413010, 'Наименование получателя', 'ClientName', 'Наименование получателя', 'ClientName', 2, 2504, 3, 0, '', 0, null) ;

CALL ImportField(250413011, 'КПП получателя', 'ClientKPP', 'КПП получателя', 'ClientKPP', 2, 2504, 3, 0, '', 0, null) ;

CALL ImportField(250413012, 'ИНН получателя', 'ClientINN', 'ИНН получателя', 'ClientINN', 2, 2504, 3, 0, '', 0, null) ;

CALL ImportField(250413013, 'Получатель (+)', 'ClientAll', 'Получатель', 'ClientAll', 2, 2504, 3, 0, '', 0, null) ;

CALL ImportField(250413014, 'Количество', 'Amount', '', 'Amount', 2, 2504, 3, 0, '', 0, null) ;

-- Операции со счетами через распоряжение на финансирование, Бюджет(1)
CALL ImportField(280111023, 'Код целевых средств', 'TransfertCLSCode', '', ' ', 1, 2801, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

-- Операции со счетами, Бюджет(1)
CALL ImportField(280210014, 'Мероприятие', 'FactCode', 'Меропритие', ' ', 1, 2802, 0, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(280210016, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 2802, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(280210017, 'Мероприятие (Ключ)', 'Fact', 'Меропритие', ' ', 1, 2802, 0, 0, 'Мероприятие', 0, 25295) ;

-- Заявка на закупку продукции, УРМ+Бюджет(2)
CALL ImportField(300110001, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 2, 3001, 0, 0, '', 0, 21277) ;

CALL ImportField(300110003, 'Утв. фин-ие за год', 'YearAcceptSumma', 'Утв. фин-ие за год', 'YearAcceptSumma', 2, 3001, 0, 0, '', 0, 21307) ;

CALL ImportField(300110004, 'Год', 'AYear', 'Год', 'AYear', 2, 3001, 0, 0, '', 0, 21284) ;

CALL ImportField(300110005, 'Неопределенное количество продукции', 'UnknownAmount', 'Неопределенное количество продукции', 'UnknownAmount', 2, 3001, 0, 0, '', 0, 21318) ;

CALL ImportField(300110006, 'Назначение заявки', 'TenderTarget', 'Назначение заявки', 'TenderTarget', 2, 3001, 0, 0, '', 0, 21309) ;

CALL ImportField(300110008, 'Вид заявки', 'TenderOption', 'Вид заявки', 'TenderOption', 2, 3001, 0, 0, '', 0, 21308) ;

CALL ImportField(300110009, 'Закупка для субъектов малого предпринимательства', 'SupportUndertaker', 'Закупка для субъектов малого предпринимательства', 'SupportUndertaker', 2, 3001, 0, 0, '', 0, 21320) ;

CALL ImportField(300110012, 'Способ закупки', 'SaleType', 'Способ закупки', 'SaleType', 2, 3001, 0, 0, '', 0, 21287) ;

CALL ImportField(300110013, 'Причина отклонения', 'REJECTCLS', 'Причина отклонения', 'REJECTCLS', 2, 3001, 0, 0, '', 0, 21288) ;

CALL ImportField(300110014, 'Причина отклонения (текст)', 'REJECTCAUSE', 'Причина отклонения (текст)', 'REJECTCAUSE', 2, 3001, 0, 0, '', 0, 21289) ;

CALL ImportField(300110015, 'Основание изменения', 'RefinementCause', '', 'RefinementCause', 2, 3001, 0, 0, '', 0, 21314) ;

CALL ImportField(300110018, 'Год размещения заказа', 'PeriodYear', 'Год размещения заказа', 'PeriodYear', 2, 3001, 0, 0, '', 0, 21319) ;

CALL ImportField(300110019, 'Период', 'Period', 'Период', 'Period', 2, 3001, 0, 0, '', 0, 21283) ;

CALL ImportField(300110021, 'Примечание', 'Note', 'Примечание', 'Note', 2, 3001, 0, 0, '', 0, 21310) ;

CALL ImportField(300110022, 'Сводная заявка', 'MultiPurpose', 'Сводная заявка', 'MultiPurpose', 2, 3001, 0, 0, '', 0, 21280) ;

CALL ImportField(300110024, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 2, 3001, 0, 0, '', 0, 21279) ;

CALL ImportField(300110025, 'Дата документа', 'DOCUMENTDATE', 'Дата документа', 'DOCUMENTDATE', 2, 3001, 0, 0, '', 0, 21281) ;

CALL ImportField(300110026, '№ заявки', 'DocNumber', '№ заявки', 'DocNumber', 2, 3001, 0, 0, '', 0, 21278) ;

CALL ImportField(300110028, 'Допустимое отклонение суммы (%)', 'Allowance', '', 'Allowance', 2, 3001, 0, 0, '', 0, 21313) ;

CALL ImportField(300110029, 'Итого утв.', 'ACCEPTSUMMA', 'Итого утв.', 'ACCEPTSUMMA', 2, 3001, 0, 0, '', 0, 21286) ;

CALL ImportField(300110030, 'Дата утверждения', 'ACCEPTDATE', 'Дата уверждения', 'ACCEPTDATE', 2, 3001, 0, 0, '', 0, 21282) ;

CALL ImportField(300110031, 'Причина отправки на доработку', 'ReworkCause', 'Причина отправки на доработку', 'ReworkCause', 2, 3001, 0, 0, '', 0, 25041) ;

CALL ImportField(300110032, 'Последнее уточнение', 'LastAdjustment', '', 'LastAdjustment', 2, 3001, 0, 1, '', 0, null) ;

CALL ImportField(300111002, 'Процент НДС', 'VatPercent', '', 'VatPercent', 2, 3001, 1, 0, '', 0, 21107) ;

CALL ImportField(300111008, 'СубКЭСР', 'SubKESR', 'СубКЭСР', 'SubKESR', 2, 3001, 1, 0, '', 0, 21039) ;

CALL ImportField(300111014, 'Наименование продукции', 'ProductName', 'Наименование предмета заявки', 'ProductName', 2, 3001, 1, 0, '', 0, 20697) ;

CALL ImportField(300111017, 'Цена на продукцию с налогами', 'PriceVAT', 'Цена на продукцию с налогами', 'PriceVAT', 2, 3001, 1, 0, '', 0, 21123) ;

CALL ImportField(300111020, 'Место поставки. Текст', 'OKATONote', 'Место поставки. Текст', 'OKATONote', 2, 3001, 1, 0, '', 0, 21117) ;

CALL ImportField(300111021, 'Место поставки', 'OKATO', 'Место поставки', 'OKATO', 2, 3001, 1, 0, '', 0, 21048) ;

CALL ImportField(300111022, 'Примечание', 'Note', 'Примечание', 'Note', 2, 3001, 1, 0, '', 0, 21054) ;

CALL ImportField(300111035, 'Тип средств', 'MeansTypeCls', 'Тип средств', 'MeansTypeCls', 2, 3001, 1, 0, '', 0, 21042) ;

CALL ImportField(300111036, 'Номер лота', 'LotNumber', 'Номер лота', 'LotNumber', 2, 3001, 1, 0, '', 0, 22700) ;

CALL ImportField(300111040, 'КФСР', 'KFSR', 'КФСР', 'KFSR', 2, 3001, 1, 0, '', 0, 21034) ;

CALL ImportField(300111041, 'КЭСР', 'KESR', 'КЭСР', 'KESR', 2, 3001, 1, 0, '', 0, 21038) ;

CALL ImportField(300111043, 'Сроки и объем предоставляемых гарантий (объем)', 'GuarantySize', 'Сроки и объем предоставляемых гарантий (объем)', 'GuarantySize', 2, 3001, 1, 0, '', 0, 21124) ;

CALL ImportField(300111044, 'Сроки и объем предоставляемых гарантий', 'Guaranty', 'Сроки и объем предоставляемых гарантий', 'Guaranty', 2, 3001, 1, 0, '', 0, 21120) ;

CALL ImportField(300111045, 'Код доп. информации', 'FinTypeCode', 'Тип финансирования', 'FinType', 2, 3001, 1, 0, '', 0, 36853) ;

CALL ImportField(300111047, 'Источник финансирования', 'FinSourceCls', '', 'FinSourceCls', 2, 3001, 1, 0, '', 0, 21041) ;

CALL ImportField(300111048, 'Сведения о расходах, включенных в цену товара, работы, услуги', 'FinNote', 'Сведения о расходах, включенных в цену товара, работы, услуги', 'FinNote', 2, 3001, 1, 0, '', 0, 21122) ;

CALL ImportField(300111049, 'Мероприятие', 'FactClsCode', 'Мероприятие', 'FactCls', 2, 3001, 1, 0, '', 0, 36863) ;

CALL ImportField(300111051, 'Лицевой счет', 'FacialAccCls', 'Лицевой счет', 'FacialAccCls', 2, 3001, 1, 0, '', 0, 21033) ;

CALL ImportField(300111052, 'Возможность эквивалента', 'Equivalent', 'Возможность эквивалента', 'Equivalent', 2, 3001, 1, 0, '', 0, 21116) ;

CALL ImportField(300111053, 'Направление', 'DirectionClsCode', '', 'DirectionCls', 2, 3001, 1, 0, '', 0, 36861) ;

CALL ImportField(300111054, 'Условия поставки. Текст', 'DeliverySpecNote', 'Условия поставки. Текст', 'DeliverySpecNote', 2, 3001, 1, 0, '', 0, 21119) ;

CALL ImportField(300111058, 'Сроки поставки. Текст', 'DeliveryNote', 'Сроки поставки. Текст', 'DeliveryNote', 2, 3001, 1, 0, '', 0, 21118) ;

CALL ImportField(300111059, 'Форма, сроки и порядок оплаты продукции, работ, услуг', 'DeliveryFormNote', 'Форма, сроки и порядок оплаты продукции, работ, услуг', 'DeliveryFormNote', 2, 3001, 1, 0, '', 0, 21121) ;

CALL ImportField(300111060, 'Дата окончания поставки', 'DeliveryEndDate', 'Дата окончания поставки', 'DeliveryEndDate', 2, 3001, 1, 0, '', 0, 21051) ;

CALL ImportField(300111061, 'Дата поставки', 'DeliveryDate', 'Дата поставки', 'DeliveryDate', 2, 3001, 1, 0, '', 0, 21050) ;

CALL ImportField(300111065, 'Сумма НДС утв.', 'AcceptVatSumma', '', 'AcceptVatSumma', 2, 3001, 1, 0, '', 0, 21109) ;

CALL ImportField(300111066, 'Сумма утв.', 'AcceptTotalSumma', '', 'AcceptTotalSumma', 2, 3001, 1, 0, '', 0, 21113) ;

CALL ImportField(300111067, 'Стоимость утв.', 'AcceptSumma', 'Стоимость утв.', 'AcceptSumma', 2, 3001, 1, 0, '', 0, 21090) ;

CALL ImportField(300111068, 'Стоимость утв.', 'AcceptQuarter4', 'Стоимость утв.', 'AcceptQuarter4', 2, 3001, 1, 0, '', 0, 21088) ;

CALL ImportField(300111069, 'Стоимость утв.', 'AcceptQuarter3', 'Стоимость утв.', 'AcceptQuarter3', 2, 3001, 1, 0, '', 0, 21086) ;

CALL ImportField(300111070, 'Стоимость утв.', 'AcceptQuarter2', 'Стоимость утв.', 'AcceptQuarter2', 2, 3001, 1, 0, '', 0, 21084) ;

CALL ImportField(300111071, 'Стоимость утв.', 'AcceptQuarter1', 'Стоимость утв.', 'AcceptQuarter1', 2, 3001, 1, 0, '', 0, 21082) ;

CALL ImportField(300111072, 'Цена утв.', 'AcceptPrice', 'Цена утв.', 'AcceptPrice', 2, 3001, 1, 0, '', 0, 21047) ;

CALL ImportField(300111073, 'Стоимость утв.', 'AcceptMonth12', 'Стоимость утв.', 'AcceptMonth12', 2, 3001, 1, 0, '', 0, 21080) ;

CALL ImportField(300111074, 'Стоимость утв.', 'AcceptMonth11', 'Стоимость утв.', 'AcceptMonth11', 2, 3001, 1, 0, '', 0, 21078) ;

CALL ImportField(300111075, 'Стоимость утв.', 'AcceptMonth10', 'Стоимость утв.', 'AcceptMonth10', 2, 3001, 1, 0, '', 0, 21076) ;

CALL ImportField(300111076, 'Стоимость утв.', 'AcceptMonth09', 'Стоимость утв.', 'AcceptMonth09', 2, 3001, 1, 0, '', 0, 21074) ;

CALL ImportField(300111077, 'Стоимость утв.', 'AcceptMonth08', 'Стоимость утв.', 'AcceptMonth08', 2, 3001, 1, 0, '', 0, 21072) ;

CALL ImportField(300111078, 'Стоимость утв.', 'AcceptMonth07', 'Стоимость утв.', 'AcceptMonth07', 2, 3001, 1, 0, '', 0, 21070) ;

CALL ImportField(300111079, 'Стоимость утв.', 'AcceptMonth06', 'Стоимость утв.', 'AcceptMonth06', 2, 3001, 1, 0, '', 0, 21068) ;

CALL ImportField(300111080, 'Стоимость утв.', 'AcceptMonth05', 'Стоимость утв.', 'AcceptMonth05', 2, 3001, 1, 0, '', 0, 21066) ;

CALL ImportField(300111081, 'Стоимость утв.', 'AcceptMonth04', 'Стоимость утв.', 'AcceptMonth04', 2, 3001, 1, 0, '', 0, 21064) ;

CALL ImportField(300111082, 'Стоимость утв.', 'AcceptMonth03', 'Стоимость утв.', 'AcceptMonth03', 2, 3001, 1, 0, '', 0, 21062) ;

CALL ImportField(300111083, 'Стоимость утв.', 'AcceptMonth02', 'Стоимость утв.', 'AcceptMonth02', 2, 3001, 1, 0, '', 0, 21060) ;

CALL ImportField(300111084, 'Стоимость утв.', 'AcceptMonth01', 'Стоимость утв.', 'AcceptMonth01', 2, 3001, 1, 0, '', 0, 21058) ;

CALL ImportField(300111085, 'Стоимость по цене утв.', 'AcceptCost', '', 'AcceptCost', 2, 3001, 1, 0, '', 0, 21111) ;

CALL ImportField(300111086, 'Количество утв.', 'AcceptAmount', 'Количество утв.', 'AcceptAmount', 2, 3001, 1, 0, '', 0, 21045) ;

CALL ImportField(300111087, 'Характеристика продукции', 'TenderObjectAttr', 'Характеристика продукции', 'TenderObjectAttr', 2, 3001, 1, 0, '', 0, 25048) ;

CALL ImportField(300111088, 'КВСР', 'KVSRCode', 'КВСР', 'KVSR', 2, 3001, 1, 0, '', 0, 25472) ;

CALL ImportField(300111089, 'КВР', 'KVRCode', 'КВР', 'KVR', 2, 3001, 1, 0, '', 0, 25467) ;

CALL ImportField(300111090, 'КЦСР', 'KCSRCode', 'КЦСР', 'KCSR', 2, 3001, 1, 0, '', 0, 25462) ;

CALL ImportField(300111091, 'Сумма второго года', 'SummaYear2', '', 'SummaYear2', 2, 3001, 1, 0, '', 0, 26652) ;

CALL ImportField(300111092, 'Сумма третьего года', 'SummaYear3', '', 'SummaYear3', 2, 3001, 1, 0, '', 0, 26653) ;

CALL ImportField(300111093, 'Код бюджетного ассигнования', 'BudAllocationClsCode', 'Код бюджетного ассигнования', 'BudAllocationClsCode', 2, 3001, 1, 0, '', 0, 27825) ;

CALL ImportField(300111094, 'Код расходного обязательства', 'PayPromiseClsCode', 'Код расходного обязательства', 'PayPromiseClsCode', 2, 3001, 1, 0, '', 0, 27849) ;

CALL ImportField(300111095, 'Направление (Ключ)', 'DirectionCls', '', 'DirectionClsKey', 2, 3001, 1, 1, '', 0, 21104) ;

CALL ImportField(300111096, 'Мероприятие (Ключ)', 'FactCls', 'Мероприятие', 'FactClsKey', 2, 3001, 1, 1, '', 0, 21040) ;

CALL ImportField(300111097, 'Код доп. информации (Ключ)', 'FinType', 'Тип финансирования', 'FinTypeKey', 2, 3001, 1, 1, '', 0, 21114) ;

CALL ImportField(300111098, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 2, 3001, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(300111099, 'Объект', 'InvestObjectCode', 'Объект', ' ', 2, 3001, 1, 0, 'Объект', 0, null) ;

CALL ImportField(300114007, 'Начальное значение критерия/требования', 'StartValue', '', 'StartValue', 2, 3001, 4, 0, '', 0, 21947) ;

CALL ImportField(300114008, 'Наименование продукции', 'ProductName', 'Наименование продукции', 'ProductName', 2, 3001, 4, 0, '', 0, 20697) ;

CALL ImportField(300114012, 'Примечание', 'Note', '', 'Note', 2, 3001, 4, 0, '', 0, 21949) ;

CALL ImportField(300114013, 'Номер лота', 'LotNumber', 'Номер лота', 'LotNumber', 2, 3001, 4, 0, '', 0, 22700) ;

CALL ImportField(300117006, 'Примечание', 'Note', 'Примечание', 'Note', 2, 3001, 7, 0, '', 0, 21969) ;

CALL ImportField(300118001, 'Условие допуска', 'SDTermsLimitName', 'Условие допуска', 'SDTermsLimitName', 2, 3001, 8, 0, '', 0, 21931) ;

CALL ImportField(300118004, 'Примечание', 'Note', 'Примечание', 'Note', 2, 3001, 8, 0, '', 0, 22966) ;

CALL ImportField(300118005, 'Наименование', 'Name', 'Наименование', 'Name', 2, 3001, 8, 0, '', 0, 22967) ;

-- Итоги конкурса, Бюджет(1)
CALL ImportField(300310047, 'Стоимость без НДС(Предложение поставщика)', 'Cost', '', ' ', 1, 3003, 0, 0, '', 0, 23011) ;

CALL ImportField(300310048, 'Цена с налогами(Предложение поставщика)', 'PriceVat', '', ' ', 1, 3003, 0, 0, '', 0, 23010) ;

CALL ImportField(300310049, 'Состояние заявки в УО(Заявка на закупку)', 'ResultDocState', '', ' ', 1, 3003, 0, 0, '', 0, 21413) ;

-- Итоги конкурса, УРМ+Бюджет(2)
CALL ImportField(300310001, 'Сумма НДС', 'VatSumma', '', 'VatSumma', 2, 3003, 0, 0, '', 0, 23013) ;

CALL ImportField(300310002, 'Процент НДС', 'VatPercent', '', 'VatPercent', 2, 3003, 0, 0, '', 0, 23012) ;

CALL ImportField(300310012, 'ИНН поставщика', 'SupplierINN', '', 'SupplierINN', 2, 3003, 0, 0, '', 0, 16645) ;

CALL ImportField(300310014, 'Стоимость', 'Summa', '', 'Summa', 2, 3003, 0, 0, '', 0, 23014) ;

CALL ImportField(300310015, 'Способ закупки после размещения заказа', 'ResultSaleType', '', 'ResultSaleType', 2, 3003, 0, 0, '', 0, 21417) ;

CALL ImportField(300310016, 'Результат размещения заказа', 'ResultOrder', '', 'ResultOrder', 2, 3003, 0, 0, '', 0, 21416) ;

CALL ImportField(300310018, 'Причина отклонения', 'RejectCls', '', 'RejectCls', 2, 3003, 0, 0, '', 0, 21387) ;

CALL ImportField(300310019, 'Причина отклонения (текст)', 'RejectCause', '', 'RejectCause', 2, 3003, 0, 0, '', 0, 21388) ;

CALL ImportField(300310023, '№ протокола', 'ProtocolNumber', '', 'ProtocolNumber', 2, 3003, 0, 0, '', 0, 21381) ;

CALL ImportField(300310025, 'Решение комиссии', 'ProtocolDecision', '', 'ProtocolDecision', 2, 3003, 0, 0, '', 0, 21420) ;

CALL ImportField(300310026, 'Дата протокола', 'ProtocolDate', '', 'ProtocolDate', 2, 3003, 0, 0, '', 0, 21382) ;

CALL ImportField(300310027, 'Позиция поставщика', 'Priority', '', 'Priority', 2, 3003, 0, 0, '', 0, 21405) ;

CALL ImportField(300310028, 'Цена по конкурсу', 'Price', '', 'Price', 2, 3003, 0, 0, '', 0, 23009) ;

CALL ImportField(300310031, 'Примечание', 'Note', '', 'Note', 2, 3003, 0, 0, '', 0, 21404) ;

CALL ImportField(300310037, 'Количество по конкурсу', 'Amount', '', 'Amount', 2, 3003, 0, 0, '', 0, 23008) ;

CALL ImportField(300310038, 'Процент допустимого отклонения', 'Allowance', '', 'Allowance', 2, 3003, 0, 0, '', 0, 21408) ;

CALL ImportField(300310044, 'Дата принятия ГРБС', 'AcceptDate', '', 'AcceptDate', 2, 3003, 0, 0, '', 0, 21376) ;

CALL ImportField(300310046, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 2, 3003, 0, 0, '', 0, 21371) ;

-- План-график, Бюджет(1)
CALL ImportField(300610023, 'Дата экспорта', 'ExportDate', '', ' ', 1, 3006, 0, 0, '', 0, 21311) ;

CALL ImportField(300610024, 'Л/с в ФК(Организация - Заказчик)', 'FacialCode', '', ' ', 1, 3006, 0, 0, '', 0, null) ;

CALL ImportField(300610025, 'Организация - Заказчик', 'OrgRecipient', '', ' ', 1, 3006, 0, 0, '', 0, null) ;

CALL ImportField(300611046, 'Направление', 'DirectionClsCode', '', ' ', 1, 3006, 1, 0, '', 0, 36861) ;

CALL ImportField(300611047, 'Л/с в ФК(Организация - Заказчик)', 'FacialCode', '', ' ', 1, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611048, 'Наименование(Организация - Заказчик)', 'FacialOrgName', '', ' ', 1, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611049, 'Код доп. информации', 'FinTypeCode', '', ' ', 1, 3006, 1, 0, '', 0, 36853) ;

CALL ImportField(300611050, 'Продукция', 'ProductCollaps', '', ' ', 1, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611051, 'Суб КОСГУ', 'subkesr', '', ' ', 1, 3006, 1, 0, '', 0, 21039) ;

CALL ImportField(300611052, 'Код субсидии', 'SubsidyClsCode', '', ' ', 1, 3006, 1, 0, '', 0, 26641) ;

CALL ImportField(300611053, 'Направление (Ключ)', 'DirectionCls', '', ' ', 1, 3006, 1, 1, '', 0, 21104) ;

CALL ImportField(300611054, 'Код доп. информации (Ключ)', 'FinType', '', ' ', 1, 3006, 1, 1, '', 0, 21114) ;

-- План-график, УРМ+Бюджет(2)
CALL ImportField(300610001, 'Бюджет', 'BudgetRef', 'Бюджет', 'BudgetRef', 2, 3006, 0, 0, '', 0, 21277) ;

CALL ImportField(300610002, 'Утв. фин-ие за год', 'YearAcceptSumma', '', 'YearAcceptSumma', 2, 3006, 0, 0, '', 0, 21307) ;

CALL ImportField(300610003, 'Назначение заявки', 'TenderTarget', '', 'TenderTarget', 2, 3006, 0, 0, '', 0, 21309) ;

CALL ImportField(300610004, 'Вариант размещения', 'TenderOption', '', 'TenderOption', 2, 3006, 0, 0, '', 0, 21308) ;

CALL ImportField(300610005, 'Закупка субъектами малого предпринимательства', 'SupportUnderTaker', '', 'SupportUnderTaker', 2, 3006, 0, 0, '', 0, 21320) ;

CALL ImportField(300610006, 'Способ закупки', 'SaleType', '', 'SaleType', 2, 3006, 0, 0, '', 0, 21287) ;

CALL ImportField(300610007, 'Причина отклонения', 'RejectCls', '', 'RejectCls', 2, 3006, 0, 0, 'ПричинаОтклонКод', 0, 21288) ;

CALL ImportField(300610008, 'Причина отклонения (текст)', 'RejectCause', '', 'RejectCause', 2, 3006, 0, 0, 'ПричинаОтклонТекст', 0, 21289) ;

CALL ImportField(300610009, 'Год размещения заказа', 'PeriodYear', '', 'PeriodYear', 2, 3006, 0, 0, '', 0, 21319) ;

CALL ImportField(300610010, 'Период', 'Period', '', 'Period', 2, 3006, 0, 0, '', 0, 21283) ;

CALL ImportField(300610012, 'Примечание', 'Note', '', 'Note', 2, 3006, 0, 0, '', 0, 21310) ;

CALL ImportField(300610014, 'Лицевой счет', 'FacialAccCls', '', 'FacialAccCls', 2, 3006, 0, 0, '', 0, 21279) ;

CALL ImportField(300610015, 'Дата документа', 'DocumentDate', '', 'DocumentDate', 2, 3006, 0, 0, '', 0, 21281) ;

CALL ImportField(300610016, '№ заявки', 'DocNumber', '', 'DocNumber', 2, 3006, 0, 0, '', 0, 21278) ;

CALL ImportField(300610017, 'Год', 'AYear', '', 'AYear', 2, 3006, 0, 0, '', 0, 21284) ;

CALL ImportField(300610018, 'Стоимость', 'AcceptSumma', '', 'AcceptSumma', 2, 3006, 0, 0, '', 0, 21286) ;

CALL ImportField(300610019, 'Дата уверждения', 'AcceptDate', '', 'AcceptDate', 2, 3006, 0, 0, '', 0, 21282) ;

CALL ImportField(300610020, 'Причина отправки на доработку', 'ReworkCause', 'Причина отправки на доработку', 'ReworkCause', 2, 3006, 0, 0, '', 0, 25041) ;

CALL ImportField(300610026, 'Последнее уточнение', 'LastAdjustment', '', 'LastAdjustment', 2, 3006, 0, 1, '', 0, null) ;

CALL ImportField(300610027, 'Дата исполнения контракта', 'AgreementExecutionDate', '', 'AgreementExecutionDate', 2, 3006, 0, 0, '', 0, null) ;

CALL ImportField(300610046, 'Обеспечение заявки на участие, %', 'SecurityTSize', '', 'SecurityTSize', 2, 3006, 0, 0, '', 0, null) ;

CALL ImportField(300610047, 'Обеспечение исполнения контракта, %', 'SecurytiASize', '', 'SecurytiASize', 2, 3006, 0, 0, '', 0, null) ;

CALL ImportField(300610048, 'Размер аванса, %', 'AvansSize', '', 'AvansSize', 2, 3006, 0, 0, '', 0, null) ;

CALL ImportField(300611002, 'Наименование продукции', 'ProductName', '', 'ProductName', 2, 3006, 1, 0, '', 0, 20697) ;

CALL ImportField(300611003, 'Цена с налогами', 'PriceVAT', '', 'PriceVAT', 2, 3006, 1, 0, '', 0, 21123) ;

CALL ImportField(300611005, 'ОКПД', 'OKPD', '', 'OKPD', 2, 3006, 1, 0, '', 0, 35318) ;

CALL ImportField(300611006, 'Примечание', 'Note', '', 'Note', 2, 3006, 1, 0, '', 0, 21054) ;

CALL ImportField(300611008, 'КЭСР', 'KESR', '', 'KESR', 2, 3006, 1, 0, '', 0, 21038) ;

CALL ImportField(300611009, 'КЦСР', 'KCSR', '', 'KCSRKey', 2, 3006, 1, 1, '', 0, null) ;

CALL ImportField(300611010, 'Мероприятие', 'FactCLSCode', '', 'FactCLS', 2, 3006, 1, 0, '', 0, 36863) ;

CALL ImportField(300611012, 'Лицевой счет', 'FacialAccCls', '', 'FacialAccCls', 2, 3006, 1, 0, '', 0, 21033) ;

CALL ImportField(300611014, 'Стоимость с НДС', 'AcceptTotalSumma', '', 'AcceptTotalSumma', 2, 3006, 1, 0, '', 0, 21113) ;

CALL ImportField(300611015, 'План-график оплаты', 'AcceptSumma', '', 'AcceptSumma', 2, 3006, 1, 0, '', 0, 21090) ;

CALL ImportField(300611016, 'IV квартал', 'AcceptQuarter4', '', 'AcceptQuarter4', 2, 3006, 1, 0, '', 0, 21088) ;

CALL ImportField(300611017, 'III квартал', 'AcceptQuarter3', '', 'AcceptQuarter3', 2, 3006, 1, 0, '', 0, 21086) ;

CALL ImportField(300611018, 'II квартал', 'AcceptQuarter2', '', 'AcceptQuarter2', 2, 3006, 1, 0, '', 0, 21084) ;

CALL ImportField(300611019, 'I квартал', 'AcceptQuarter1', '', 'AcceptQuarter1', 2, 3006, 1, 0, '', 0, 21082) ;

CALL ImportField(300611021, 'Декабрь', 'AcceptMonth12', '', 'AcceptMonth12', 2, 3006, 1, 0, '', 0, 21080) ;

CALL ImportField(300611022, 'Ноябрь', 'AcceptMonth11', '', 'AcceptMonth11', 2, 3006, 1, 0, '', 0, 21078) ;

CALL ImportField(300611023, 'Октябрь', 'AcceptMonth10', '', 'AcceptMonth10', 2, 3006, 1, 0, '', 0, 21076) ;

CALL ImportField(300611024, 'Сентябрь', 'AcceptMonth09', '', 'AcceptMonth09', 2, 3006, 1, 0, '', 0, 21074) ;

CALL ImportField(300611025, 'Август', 'AcceptMonth08', '', 'AcceptMonth08', 2, 3006, 1, 0, '', 0, 21072) ;

CALL ImportField(300611026, 'Июль', 'AcceptMonth07', '', 'AcceptMonth07', 2, 3006, 1, 0, '', 0, 21070) ;

CALL ImportField(300611027, 'Июнь', 'AcceptMonth06', '', 'AcceptMonth06', 2, 3006, 1, 0, '', 0, 21068) ;

CALL ImportField(300611028, 'Май', 'AcceptMonth05', '', 'AcceptMonth05', 2, 3006, 1, 0, '', 0, 21066) ;

CALL ImportField(300611029, 'Апрель', 'AcceptMonth04', '', 'AcceptMonth04', 2, 3006, 1, 0, '', 0, 21064) ;

CALL ImportField(300611030, 'Март', 'AcceptMonth03', '', 'AcceptMonth03', 2, 3006, 1, 0, '', 0, 21062) ;

CALL ImportField(300611031, 'Февраль', 'AcceptMonth02', '', 'AcceptMonth02', 2, 3006, 1, 0, '', 0, 21060) ;

CALL ImportField(300611032, 'Январь', 'AcceptMonth01', '', 'AcceptMonth01', 2, 3006, 1, 0, '', 0, 21058) ;

CALL ImportField(300611034, 'Количество', 'AcceptAmount', '', 'AcceptAmount', 2, 3006, 1, 0, '', 0, 21045) ;

CALL ImportField(300611037, 'КФСР', 'KFSR', 'КФСР', 'KFSR', 2, 3006, 1, 0, '', 0, 21034) ;

CALL ImportField(300611039, 'MEANSTYPECls', 'MEANSTYPECls', 'MEANSTYPECls', 'MEANSTYPECls', 2, 3006, 1, 0, '', 0, 21042) ;

CALL ImportField(300611041, 'КЦСР', 'KCSRCode', '', 'KCSR', 2, 3006, 1, 0, '', 0, 25462) ;

CALL ImportField(300611042, 'КВСР', 'KVSRCode', 'КВСР', 'KVSR', 2, 3006, 1, 0, '', 0, 25472) ;

CALL ImportField(300611043, 'КВР', 'KVRCode', 'КВР', 'KVR', 2, 3006, 1, 0, '', 0, 25467) ;

CALL ImportField(300611044, 'Сумма второго года', 'SummaYear2', '', 'SummaYear2', 2, 3006, 1, 0, '', 0, 26652) ;

CALL ImportField(300611045, 'Сумма третьего года', 'SummaYear3', '', 'SummaYear3', 2, 3006, 1, 0, '', 0, 26653) ;

CALL ImportField(300611055, 'Источник финансирования', 'FinSourceCls', '', 'FinSourceCls', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611056, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 2, 3006, 1, 0, 'ОбъектКлюч', 0, null) ;

CALL ImportField(300611057, 'Объект', 'InvestObjectCode', 'Объект', ' ', 2, 3006, 1, 0, 'Объект', 0, null) ;

CALL ImportField(300611058, 'Мероприятие (ключ)', 'FactCls', '', 'FactClsKey', 2, 3006, 1, 0, '', 0, 21040) ;

CALL ImportField(300611059, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsCode', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611060, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611061, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 2, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300612002, 'ФИО', 'Name', '', 'Name', 2, 3006, 2, 0, '', 0, 21900) ;

CALL ImportField(300612003, 'Статус контактного лица', 'Status', 'Статус контактного лица', 'Status', 2, 3006, 2, 0, '', 0, 25042) ;

-- Консолидация бюджетной отчетности, Бюджет(1)
CALL ImportField(361010007, 'ЛицевойСчет', 'FacialAcc_CLS', 'Лицевой cчет', 'FacialAcc_CLS', 1, 3610, 0, 0, 'ЛицевойСчет', 0, null) ;

-- Каталогизация продукции, Бюджет(1)
CALL ImportField(370110022, 'Наименование по ОКЕИ', 'MeasurementCptName', '', ' ', 1, 3701, 0, 0, '', 0, 20729) ;

CALL ImportField(370110023, 'Наименование ОКП', 'OKPName', '', ' ', 1, 3701, 0, 0, '', 0, 22739) ;

-- Каталогизация продукции, УРМ+Бюджет(2)
CALL ImportField(370110002, 'Причина доработки', 'UpdateCause', '', 'UpdateCause', 2, 3701, 0, 0, '', 0, 20716) ;

CALL ImportField(370110003, 'Краткое наименование', 'ShortName', '', 'ShortName', 2, 3701, 0, 0, '', 0, 20698) ;

CALL ImportField(370110004, 'Причина отклонения', 'RejectCls', '', 'RejectCls', 2, 3701, 0, 0, '', 0, 20708) ;

CALL ImportField(370110005, 'Причина отклонения (текст)', 'RejectCause', '', 'RejectCause', 2, 3701, 0, 0, '', 0, 20709) ;

CALL ImportField(370110006, 'ОКП', 'OKPCLS', 'ОКП', 'OKPCLS', 2, 3701, 0, 0, '', 0, 20725) ;

CALL ImportField(370110007, 'ОКДП', 'OKDPCode', '', 'OKDPCode', 2, 3701, 0, 0, '', 0, 24924) ;

CALL ImportField(370110008, 'Спецификация', 'ObjectSpec', '', 'ObjectSpec', 2, 3701, 0, 0, '', 0, 20700) ;

CALL ImportField(370110009, 'Примечание', 'Note', '', 'Note', 2, 3701, 0, 0, '', 0, 20715) ;

CALL ImportField(370110010, 'Наименование продукции', 'Name', '', 'Name', 2, 3701, 0, 0, '', 0, 20697) ;

CALL ImportField(370110011, 'Единицы измерения', 'MeasurementCls', '', 'MeasurementCls', 2, 3701, 0, 0, '', 0, 20707) ;

CALL ImportField(370110013, 'Автор (лиц. счет) ', 'FacialAccCls', '', 'FacialAccCls', 2, 3701, 0, 0, '', 0, 20714) ;

CALL ImportField(370110014, 'Дата формирования', 'DocumentDate', '', 'DocumentDate', 2, 3701, 0, 0, '', 0, 20718) ;

CALL ImportField(370110017, 'Марка', 'Brand', '', 'Brand', 2, 3701, 0, 0, '', 0, 20701) ;

CALL ImportField(370110018, 'Характеристика продукции', 'Attribute', 'Характеристика продукции', 'Attribute', 2, 3701, 0, 0, '', 0, 20726) ;

CALL ImportField(370110019, 'Дата рассмотрения', 'AcceptDate', '', 'AcceptDate', 2, 3701, 0, 0, '', 0, 20717) ;

CALL ImportField(370110020, 'ОКПД', 'OKPD', '', 'OKPD', 2, 3701, 0, 0, '', 0, null) ;

CALL ImportField(370110021, 'ОКВЭД', 'OKVED', '', 'OKVED', 2, 3701, 0, 0, '', 0, null) ;

CALL ImportField(370110024, 'ОКВЭД2', 'OKVED2', 'ОКВЭД2 (ОК 029-2014)', 'OKVED2', 2, 3701, 0, 0, '', 0, null) ;

CALL ImportField(370110025, 'ОКПД2', 'OKPD2', 'ОКПД2 (ОК 034-2014)', 'OKPD2', 2, 3701, 0, 0, '', 0, null) ;

-- Расходные расписания, Бюджет(1)
CALL ImportField(440110012, 'Дата формирования', 'InputDate', 'Дата ввода', 'InputDate', 1, 4401, 0, 0, 'ДатаВвода', 0, 21686) ;

CALL ImportField(440110059, 'Отдел', 'DEPARTMENTCLS', 'Отдел', 'DEPARTMENTCLS', 1, 4401, 0, 1, 'Отдел', 0, 18989) ;

CALL ImportField(440110060, 'Тип финансирования', 'FinTypeCode', '', 'FINTYPE', 1, 4401, 0, 1, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(440111058, 'Направление', 'DirectionCLSCode', '', ' ', 1, 4401, 1, 1, 'Направление', 0, 36861) ;

CALL ImportField(440111059, 'Мероприятие', 'FactCode', '', ' ', 1, 4401, 1, 1, 'Мероприятие', 0, 36863) ;

CALL ImportField(440111067, 'Тип финансирования (Ключ)', 'FinType', 'Тип финансирования', 'FINTYPEKey', 1, 4401, 1, 1, 'ТипФинансированияКлюч', 0, 36850) ;

CALL ImportField(440111068, 'Направление (Ключ)', 'DirectionCLS', '', ' ', 1, 4401, 1, 1, 'Направление', 0, 25359) ;

CALL ImportField(440111069, 'Мероприятие (Ключ)', 'Fact', '', ' ', 1, 4401, 1, 1, 'Мероприятие', 0, 25360) ;

CALL ImportField(440111070, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 4401, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(440111071, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 4401, 1, 0, 'Объект', 0, null) ;

-- Внутренние КУ,РР, Бюджет(1)
CALL ImportField(440311058, 'Направление', 'DirectionCLSCode', 'Направление', ' ', 1, 4403, 1, 1, 'Направление', 0, null) ;

CALL ImportField(440311059, 'Мероприятие', 'FactCode', 'Мероприятие', ' ', 1, 4403, 1, 1, 'Мероприятие', 0, null) ;

CALL ImportField(440311065, 'Направление (Ключ)', 'DirectionCLS', 'Направление', ' ', 1, 4403, 1, 1, 'НаправлениеКлюч', 0, null) ;

CALL ImportField(440311066, 'Мероприятие (Ключ)', 'Fact', 'Мероприятие', ' ', 1, 4403, 1, 1, 'МероприятиеКлюч', 0, null) ;

CALL ImportField(440311067, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 4403, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(440311068, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 4403, 1, 0, 'Объект', 0, null) ;

-- Обуславливающие документы, Бюджет(1)
CALL ImportField(480110032, 'Л/с в ФК', 'FacialCode', '', ' ', 1, 4801, 0, 0, '', 0, null) ;

-- Обуславливающие документы, УРМ+Бюджет(2)
CALL ImportField(480110001, 'Дата начала действия', 'BeginDate', '', 'BeginDate', 2, 4801, 0, 0, 'ДатаНачалаДействия', 0, 31671) ;

CALL ImportField(480110002, 'Дата окончания действия', 'EndDate', '', 'EndDate', 2, 4801, 0, 0, 'ДатаОкончанияДействия', 0, 31679) ;

CALL ImportField(480110004, 'Категория документа', 'ArchiveDocTypeCode', 'Категория архивного документа', 'ArchiveDocType', 2, 4801, 0, 0, 'КатегорияДокумента', 0, 30684) ;

CALL ImportField(480110006, 'Коды типов документов', 'DocTypesList', '', 'DocTypesList', 2, 4801, 0, 0, 'КодыТиповДокументов', 0, 31678) ;

CALL ImportField(480110007, 'Л/с владельца документа', 'FacialAccCls', '', 'FacialAccCls', 2, 4801, 0, 0, 'ЛицевойСчетЗаголовок,ЛицевойСчет', 0, 31680) ;

CALL ImportField(480110008, 'Наименование документа', 'Name', '', 'Name', 2, 4801, 0, 0, 'НаименованиеДокумента', 0, 31683) ;

CALL ImportField(480110009, 'Дата регистрации', 'RegistrationDate', '', 'RegistrationDate', 2, 4801, 0, 0, 'ДатаДокумента', 0, 31685) ;

CALL ImportField(480110015, '№ документа', 'DocNumber', '', 'DocNumber', 2, 4801, 0, 0, 'НомерДокумента', 0, 31676) ;

CALL ImportField(480110016, 'Причина отклонения (комментарий)', 'RejectCause', '', 'RejectCause', 2, 4801, 0, 0, 'ПричинаОтклонТекст', 0, 31686) ;

CALL ImportField(480110030, 'Причина отклонения', 'RejectCls', '', 'RejectCls', 2, 4801, 0, 0, 'ПричинаОтклонКод', 0, 31687) ;

CALL ImportField(480110031, 'Документ основание', 'DocBase', '', 'DocBase', 2, 4801, 0, 0, 'ТипДокОснования', 0, 31675) ;

-- Пакеты документов для УРМ, Бюджет(1)
CALL ImportField(490110021, 'Размер бинарных данных', 'BinaryDataSize', '', ' ', 1, 4901, 0, 1, 'РазмерДокумента', 0, 30711) ;

CALL ImportField(490110022, 'Причина отклонения', 'RejectCause', '', ' ', 1, 4901, 0, 1, 'ПричинаОтклонТекст', 0, 30717) ;

-- Исполнительные листы, Бюджет(1)
CALL ImportField(520110026, 'Бюджет', 'BUDGETREF', 'Бюджет', 'BudgetRef', 1, 5201, 0, 0, 'КодБюджета', 0, 25391) ;

CALL ImportField(520111003, 'Направление', 'DIRECTIONCLSCode', 'Направление', 'DIRECTIONCLS', 1, 5201, 1, 0, 'Направление', 0, null) ;

CALL ImportField(520111006, 'Мероприятие', 'FACTCode', 'Мероприятие', 'FACT', 1, 5201, 1, 0, 'Мероприятие', 0, null) ;

CALL ImportField(520111008, 'Тип финансирования(Классификация)', 'FINTYPECode', 'Тип финансирования', 'FINTYPE', 1, 5201, 1, 0, 'ТипФинансирования', 0, null) ;

CALL ImportField(520111050, 'Код субсидииКлюч', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 5201, 1, 1, 'КодСубсидииКлюч', 0, null) ;

CALL ImportField(520111051, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 5201, 1, 0, 'КодСубсидии', 0, null) ;

CALL ImportField(520111052, 'Код целевых средствКлюч', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 5201, 1, 1, 'КодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(520111053, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 5201, 1, 0, 'КодЦелевыхСредств', 0, null) ;

CALL ImportField(520111054, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 5201, 1, 0, 'КодБюджАссигнования', 0, null) ;

CALL ImportField(520111055, 'Код бюджетного ассигнованияКлюч', 'BudAllocationCls', '', 'BudAllocationCls', 1, 5201, 1, 1, 'КодБюджАссигнованияКлюч', 0, null) ;

CALL ImportField(520111056, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 5201, 1, 0, 'КодРасходногоОбязательства', 0, null) ;

CALL ImportField(520111057, 'Код расходного обязательстваКлюч', 'PayPromiseCls', '', 'PayPromiseCls', 1, 5201, 1, 1, 'КодРасходногоОбязательстваКлюч', 0, null) ;

CALL ImportField(520111058, 'Код записи', 'id', 'Код записи', 'id', 1, 5201, 1, 1, 'КодЗаписи', 0, null) ;

CALL ImportField(520111059, 'Направление (Ключ)', 'DIRECTIONCLS', 'Направление', 'DIRECTIONCLSKey', 1, 5201, 1, 1, 'НаправлениеКлюч', 0, null) ;

CALL ImportField(520111060, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', 'FACTKey', 1, 5201, 1, 1, 'МероприятиеКлюч', 0, null) ;

CALL ImportField(520111061, 'Тип финансирования(Ключ)', 'FINTYPE', 'Тип финансирования', 'FINTYPEKey', 1, 5201, 1, 1, 'ТипФинансированияКлюч', 0, null) ;

CALL ImportField(520111062, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 5201, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(520111063, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 5201, 1, 0, 'Объект', 0, null) ;

-- Уведомление об уточнении поступлений, Бюджет(1)
CALL ImportField(550110165, 'Район контрагента', 'RegionContractor', 'Район контрагента', 'RegionContractor', 1, 5501, 0, 1, 'РайонКонтрагента', 0, null) ;

CALL ImportField(550111067, 'Направление(Классификация)', 'DirectionClsCode', 'Направление', 'DirectionCls', 1, 5501, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(550111068, 'Мероприятие', 'FACTCode', 'Мероприятие', 'Fact', 1, 5501, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(550111071, 'Код доп. информации', 'FinTypeCode', 'Код дополнительной информации', 'FinType', 1, 5501, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(550111077, 'Класс документа', 'DocumentProgIndex', 'Класс документа', 'DocumentProgindex', 1, 5501, 1, 0, 'ИндексыДанныхСвязанногоДокументаНов', 0, 22939) ;

CALL ImportField(550111125, 'Дата гос. контракта', 'BudgetPromiseSODate', 'Дата гос. контракта', 'BudgetPromiseAgrDate', 1, 5501, 1, 1, 'ДоговораБОДатаДоговора', 0, 19799) ;

CALL ImportField(550111126, 'Прим. гос. контракта', 'BudgetPromiseSONote', 'Прим. гос. контракта', 'BudgetPromiseAgrNote', 1, 5501, 1, 1, 'ДоговораБОПримечаниеДоговора', 0, 19821) ;

CALL ImportField(550111127, 'Номер гос. контракта', 'BudgetPromiseSONum', 'Номер гос. контракта', 'BudgetPromiseAgrNum', 1, 5501, 1, 1, 'ДоговораБОНомерДоговора', 0, 19798) ;

CALL ImportField(550111129, 'Реестровый номер гос. контр', 'BudgetPromiseSORNum', 'Реестровый номер гос. контр', 'BudgetPromiseAgrReestrNum', 1, 5501, 1, 1, 'ДоговораБОРеестрНомерДоговора', 0, 19830) ;

CALL ImportField(550111138, 'Уточнение ОКАТО', 'ADDOKATO', 'Уточнение ОКАТО', 'ADDOKATO', 1, 5501, 1, 1, 'ДопОКАТОДеталь', 0, 25282) ;

CALL ImportField(550111139, 'ОКАТО', 'OKATO', 'ОКАТО', 'OKATO', 1, 5501, 1, 1, 'ОКАТОДеталь', 0, 25286) ;

CALL ImportField(550111145, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 5501, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(550111146, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'KCSR', 1, 5501, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(550111147, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'KVR', 1, 5501, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(550111148, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'KVSR', 1, 5501, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(550111155, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 5501, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(550111156, 'Код дохода', 'KDValue', '', 'KDValue', 1, 5501, 1, 0, 'КодДохода', 0, null) ;

CALL ImportField(550111158, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 1, 5501, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(550111160, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 1, 5501, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(550111161, 'ОКТМО', 'OKTMOCode', '', ' ', 1, 5501, 1, 0, '', 0, 32822) ;

CALL ImportField(550111162, 'ОКТМОКлюч', 'OKTMO', '', ' ', 1, 5501, 1, 1, 'ОКТМОНов', 0, 32898) ;

CALL ImportField(550111163, 'Направление(Ключ)', 'DirectionCls', 'Направление', 'DirectionClsKey', 1, 5501, 1, 1, 'НаправлениеКлюч', 0, 22920) ;

CALL ImportField(550111164, 'Код доп. информации (Ключ)', 'FinType', 'Код дополнительной информации', 'FinTypeKey', 1, 5501, 1, 1, 'ТипФинансированияКлюч', 0, 22925) ;

CALL ImportField(550111165, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', 'FactKey', 1, 5501, 1, 1, 'МероприятиеКлюч', 0, 22922) ;

CALL ImportField(550111166, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 5501, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(550111167, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 5501, 1, 0, 'Объект', 0, null) ;

-- Уведомление об уточнении выбытий, Бюджет(1)
CALL ImportField(550210149, 'Район контрагента', 'RegionContractor', 'Район контрагента', 'RegionContractor', 1, 5502, 0, 1, 'РайонКонтрагента', 0, null) ;

CALL ImportField(550211067, 'Направление', 'DirectionClsCode', 'Направление', 'DirectionCls', 1, 5502, 1, 0, 'Направление', 0, 36861) ;

CALL ImportField(550211068, 'Мероприятие', 'FACTCode', 'Мероприятие', 'Fact', 1, 5502, 1, 0, 'Мероприятие', 0, 36863) ;

CALL ImportField(550211071, 'Код доп. информации', 'FinTypeCode', 'Код дополнительной информации', 'FinType', 1, 5502, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(550211077, 'Класс документа', 'DocumentProgIndex', 'Класс документа', 'DocumentProgindex', 1, 5502, 1, 0, 'ИндексыДанныхСвязанногоДокументаНов', 0, 22939) ;

CALL ImportField(550211110, 'Вн. номер БО', 'BudgetPromise', 'Вн. номер БО', 'BUDGETPROMISE', 1, 5502, 1, 1, 'ДоговораБО', 0, 25283) ;

CALL ImportField(550211118, 'Уточнение ОКАТО', 'ADDOKATO', 'Уточнение ОКАТО', 'ADDOKATO', 1, 5502, 1, 1, 'ДопОКАТОДеталь', 0, 25282) ;

CALL ImportField(550211119, 'ОКАТО', 'OKATO', 'ОКАТО', 'OKATO', 1, 5502, 1, 1, 'ОКАТОДеталь', 0, 25286) ;

CALL ImportField(550211126, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 5502, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(550211127, 'КЦСР(Классификация)', 'KCSRCode', 'КЦСР(Классификация)', 'KCSR', 1, 5502, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(550211128, 'КВР(Классификация)', 'KVRCode', 'КВР(Классификация)', 'KVR', 1, 5502, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(550211129, 'КВСР(Классификация)', 'KVSRCode', 'КВСР(Классификация)', 'KVSR', 1, 5502, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(550211133, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 5502, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(550211137, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 1, 5502, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(550211139, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 1, 5502, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(550211140, 'ОКТМО', 'OKTMOCode', '', ' ', 1, 5502, 1, 0, '', 0, 32822) ;

CALL ImportField(550211141, 'ОКТМОКлюч', 'OKTMO', '', ' ', 1, 5502, 1, 1, 'ОКТМОНов', 0, 32898) ;

CALL ImportField(550211142, 'Направление (Ключ)', 'DirectionCls', 'Направление', 'DirectionClsKey', 1, 5502, 1, 1, 'НаправлениеКлюч', 0, 22920) ;

CALL ImportField(550211143, 'Мероприятие (Ключ)', 'FACT', 'Мероприятие', 'FactKey', 1, 5502, 1, 1, 'МероприятиеКлюч', 0, 22922) ;

CALL ImportField(550211144, 'Код доп. информации (Ключ)', 'FinType', 'Код дополнительной информации', 'FinTypeKey', 1, 5502, 1, 1, 'ТипФинансированияКлюч', 0, 22925) ;

CALL ImportField(550211145, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 5502, 1, 1, 'ОбъектКлюч', 0, null) ;

CALL ImportField(550211146, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 5502, 1, 0, 'Объект', 0, null) ;

-- Протокол пакетной замены классификации, Бюджет(1)
CALL ImportField(550310005, 'Дата утверждения', 'AcceptDate', 'Дата принятия ПЗК', 'AcceptDate', 1, 5503, 0, 0, 'ПротоколДатаПринятия', 0, null) ;

CALL ImportField(550310006, 'Лог ПЗК', 'Protocol', 'Лог ПЗК', 'Protocol', 1, 5503, 0, 0, 'ПротоколЛог', 0, null) ;

CALL ImportField(550310013, 'Краткая информация о ПЗК ', 'BriefInfo', '', ' ', 1, 5503, 0, 0, '', 0, null) ;

CALL ImportField(550310014, 'Список исходных документов(Краткая информация о ПЗК )', 'ClassOriginalDoc', '', ' ', 1, 5503, 0, 0, '', 0, null) ;

CALL ImportField(550310015, 'Количество созданных докуметов(Краткая информация о ПЗК )', 'NumberRecords', '', ' ', 1, 5503, 0, 0, '', 0, null) ;

CALL ImportField(550310056, 'Бюджет', 'BudgetRef', '', ' ', 1, 5503, 0, 0, 'КодБюджета', 0, null) ;

CALL ImportField(550311001, 'Код записи', 'ID', 'Код записи', 'ID', 1, 5503, 1, 1, 'КодДокумента', 0, null) ;

CALL ImportField(550311002, 'Ссылка на исходный документ', 'RecordIndex', 'Ссылка на исходный документ', 'RecordIndex', 1, 5503, 1, 1, 'ПротоколИсхДокСсылка', 0, null) ;

CALL ImportField(550311003, 'Примечание', 'Note', 'Примечание', 'Note', 1, 5503, 1, 0, 'ПротоколПримечаниеИнф', 0, 29939) ;

CALL ImportField(550311004, 'Код субсидии', 'SubsidyCls', 'Код субсидии (ссылка)', 'SubsidyCls', 1, 5503, 1, 1, 'ПротоколКодСубсидииКлюч', 0, null) ;

CALL ImportField(550311005, 'Код бюджетного ассигнования', 'BudAllocationCls', 'Код бюджетного ассигнования (ссылка)', 'BudAllocationCls', 1, 5503, 1, 1, 'ПротоколКодБюджАссигнКлюч', 0, null) ;

CALL ImportField(550311006, 'Код расходного обязательства', 'PayPromiseCls', 'Код расходного обязательства (ссылка)', 'PayPromiseCls', 1, 5503, 1, 1, 'ПротоколКодРасхОбязКлюч', 0, null) ;

CALL ImportField(550311007, 'Район трансферта', 'RegionCls', 'Район трансферта', 'RegionCls', 1, 5503, 1, 0, 'ПротоколРайон', 0, 31737) ;

CALL ImportField(550311008, 'Тип классификации', 'ClsType', 'Тип классификации (расходная, источниковая, доходная)', 'ClsType', 1, 5503, 1, 0, 'ПротоколТипКлассификации', 0, 31718) ;

CALL ImportField(550311009, 'Класс документа', 'Progindex', 'Прогиндекс', 'Progindex', 1, 5503, 1, 1, 'ПротоколКлассДокумента', 0, null) ;

CALL ImportField(550311010, 'Ссылка на родительский документ', 'ParentID', 'Ссылка на родительский документ', 'ParentID', 1, 5503, 1, 1, 'ПротоколСсылкаНаИсхДокумент', 0, null) ;

CALL ImportField(550311011, 'КВСР', 'KVSR', 'КВСР', 'KVSR', 1, 5503, 1, 1, 'ПротоколКВСР', 0, null) ;

CALL ImportField(550311012, 'ФКР(Классификация)', 'Kfsr', 'ФКР', 'Kfsr', 1, 5503, 1, 0, 'ПротоколКФСР', 0, 31729) ;

CALL ImportField(550311013, 'КЦСР', 'KCSR', 'КЦСР', 'KCSR', 1, 5503, 1, 1, 'ПротоколКЦСР', 0, null) ;

CALL ImportField(550311014, 'КВР', 'KVR', 'КВР', 'KVR', 1, 5503, 1, 1, 'ПротоколКВР', 0, null) ;

CALL ImportField(550311015, 'КОСГУ(Классификация)', 'Kesr', 'КОСГУ', 'Kesr', 1, 5503, 1, 0, 'ПротоколКЭСР', 0, 31728) ;

CALL ImportField(550311016, 'СубКосгу', 'SubKESR', 'СубКосгу', 'SubKESR', 1, 5503, 1, 0, 'ПротоколСубКЭСР', 0, 31738) ;

CALL ImportField(550311017, 'Мероприятие', 'FactCode', 'Мероприятие', 'Fact', 1, 5503, 1, 0, 'ПротоколМероприятие', 0, 36863) ;

CALL ImportField(550311018, 'Направление', 'DirectionClsCode', 'Направление', 'DirectionCls', 1, 5503, 1, 0, 'ПротоколНаправление', 0, 36861) ;

CALL ImportField(550311019, 'Тип средств', 'MeansType', 'Тип средств', 'MeansType', 1, 5503, 1, 0, 'ТипСредств', 0, 31732) ;

CALL ImportField(550311020, 'Код доп. информации', 'FinTypeCode', 'Код дополнительной информации', 'FinType', 1, 5503, 1, 0, 'ПротоколТипФинансирования', 0, 36853) ;

CALL ImportField(550311021, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'FacialAcc_Cls', 1, 5503, 1, 0, 'ПротоколЛицевойСчет', 0, 31721) ;

CALL ImportField(550311022, 'Код дохода', 'KD', 'Код дохода', 'KD', 1, 5503, 1, 1, 'ПротоколКдКлюч', 0, null) ;

CALL ImportField(550311023, 'Источник внутреннего финансирования', 'IFS', 'Источниковая классификация', 'IFS', 1, 5503, 1, 1, 'ПротоколИсточникВнутрФинансированияКлюч', 0, null) ;

CALL ImportField(550311024, 'Источник', 'FinSource', 'Источник финансирования', 'FinSource', 1, 5503, 1, 0, 'ПротоколИсточникФинансирования', 0, 31723) ;

CALL ImportField(550311025, 'Код целевых средств', 'TransfertCls', 'Код целевых средств (ссылка)', 'TransfertCls', 1, 5503, 1, 1, 'ПротоколКодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(550311026, 'НПА', 'DocBaseCode', 'НПА', 'DocBase', 1, 5503, 1, 0, 'ПротоколТипДокументаОснования', 0, 36865) ;

CALL ImportField(550311027, 'Вид ассигнований', 'AssignmentKind', 'Вид ассигнований', 'AssignmentKind', 1, 5503, 1, 0, 'ПротоколВидАссигнований', 0, 31716) ;

CALL ImportField(550311028, 'Вариант', 'Variant', 'Вариант', 'Variant', 1, 5503, 1, 0, 'ПротоколВариант', 0, 31741) ;

CALL ImportField(550311029, 'Уникальный номер договора', 'ReestrNumber', 'Уникальный номер договора', 'ReestrNumber', 1, 5503, 1, 0, 'ПротоколУникальныйНомерДоговора', 0, 31736) ;

CALL ImportField(550311030, 'Код бюджетного ассигнования', 'BudAllocationClsCode', 'Код бюджетного ассигнования', 'BudAllocationClsCode', 1, 5503, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(550311033, 'Вид источника(Классификация)', 'IFS_DescriptionCode', '', ' ', 1, 5503, 1, 0, '', 0, null) ;

CALL ImportField(550311034, 'ЭКИ(Классификация)', 'IFS_KESR', '', ' ', 1, 5503, 1, 0, '', 0, null) ;

CALL ImportField(550311035, 'Администратор(Классификация)', 'IFS_KVSRCode', '', ' ', 1, 5503, 1, 0, '', 0, null) ;

CALL ImportField(550311036, 'КЦСР(Классификация)', 'KcsrCode', '', ' ', 1, 5503, 1, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(550311037, 'Вид дохода(Классификация)', 'KDDescriptionCode', '', ' ', 1, 5503, 1, 0, '', 0, null) ;

CALL ImportField(550311038, 'ЭКД(Классификация)', 'KDKESR', '', ' ', 1, 5503, 1, 0, '', 0, null) ;

CALL ImportField(550311039, 'Администратор(Классификация)', 'KDKVSRCode', '', ' ', 1, 5503, 1, 0, '', 0, null) ;

CALL ImportField(550311040, 'Подвид дохода(Классификация)', 'KDProgramCode', '', ' ', 1, 5503, 1, 0, '', 0, null) ;

CALL ImportField(550311041, 'КВР(Классификация)', 'KvrCode', '', ' ', 1, 5503, 1, 0, 'КВР', 0, 25467) ;

CALL ImportField(550311042, 'КВСР(Классификация)', 'KvsrCode', '', ' ', 1, 5503, 1, 0, 'КВСР', 0, 25472) ;

CALL ImportField(550311043, 'Код расходного обязательсва', 'PayPromiseClsCode', 'Код расходного обязательства', 'PayPromiseClsCode', 1, 5503, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(550311044, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', 'SubsidyClsCode', 1, 5503, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(550311046, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsCode', 1, 5503, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(550311047, 'Классификация', 'TreeOwner0', '', ' ', 1, 5503, 1, 0, '', 0, null) ;

CALL ImportField(550311048, 'БК кода целевых средств', 'TransfertClassification', '', ' ', 1, 5503, 1, 1, '', 0, null) ;

CALL ImportField(550311049, 'Классификация', 'TreeOwner1', '', ' ', 1, 5503, 1, 0, '', 0, null) ;

CALL ImportField(550311057, 'Бюджет', 'BudgetRef', '', ' ', 1, 5503, 1, 0, '', 0, null) ;

CALL ImportField(550311058, 'Направление (Ключ)', 'DirectionCls', 'Направление', 'DirectionClsKey', 1, 5503, 1, 1, 'ПротоколНаправлениеКлюч', 0, 31719) ;

CALL ImportField(550311059, 'Мероприятие (Ключ)', 'Fact', 'МероприятиеКлюч', 'FactKey', 1, 5503, 1, 1, 'ПротоколМероприятиеКлюч', 0, 31722) ;

CALL ImportField(550311060, 'Код доп. информации (Ключ)', 'FinType', 'Код дополнительной информации', 'FinTypeKey', 1, 5503, 1, 1, 'ПротоколТипФинансированияКлюч', 0, 31724) ;

CALL ImportField(550311061, 'НПА (Ключ)', 'DocBase', 'НПА', 'DocBaseKey', 1, 5503, 1, 1, 'ПротоколТипДокументаОснованияКлюч', 0, 31720) ;

CALL ImportField(550311062, 'ОбъектКлюч', 'InvestObject', 'Объект', ' ', 1, 5503, 1, 1, '', 0, null) ;

CALL ImportField(550311063, 'Объект', 'InvestObjectCode', 'Объект', ' ', 1, 5503, 1, 0, '', 0, null) ;

CALL ImportField(550312001, 'Код записи', 'ID', 'Код записи', 'ID', 1, 5503, 2, 1, 'КодДокумента', 0, null) ;

CALL ImportField(550312002, 'Ссылка на исходный документ', 'RecordIndex', 'Ссылка на исходный документ', 'RecordIndex', 1, 5503, 2, 1, 'ПротоколСсылкаНаЗагИзДет', 0, null) ;

CALL ImportField(550312003, 'ИД связи', 'DocIDLink', 'Ссылка на связь, содержащую ссылки на документы', 'LinkID', 1, 5503, 2, 1, 'ПротоколИДСвязи', 0, null) ;

CALL ImportField(550312004, 'Примечание', 'Note', 'Примечание', 'Note', 1, 5503, 2, 1, 'ПротоколПримечаниеДеталь', 0, 29939) ;

CALL ImportField(550312006, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 1, 5503, 2, 0, '', 0, 27825) ;

CALL ImportField(550312007, 'Тип классификации', 'ClsType', '', ' ', 1, 5503, 2, 0, '', 0, 17453) ;

CALL ImportField(550312008, 'Направление', 'DirectionClsCode', '', ' ', 1, 5503, 2, 0, '', 0, 36861) ;

CALL ImportField(550312009, 'НПА', 'DocBaseCode', 'НПА', ' ', 1, 5503, 2, 0, '', 0, 36865) ;

CALL ImportField(550312010, 'Лицевой счет', 'FacialAcc_Cls', '', ' ', 1, 5503, 2, 0, '', 0, 17419) ;

CALL ImportField(550312011, 'Мероприятие', 'FactCode', '', ' ', 1, 5503, 2, 0, '', 0, 36863) ;

CALL ImportField(550312012, 'Источник', 'FinSource', '', ' ', 1, 5503, 2, 0, '', 0, 17471) ;

CALL ImportField(550312013, 'Код доп. информации', 'FinTypeCode', 'Код дополнительной информации', ' ', 1, 5503, 2, 0, '', 0, 36853) ;

CALL ImportField(550312014, 'Вид источника(Классификация)', 'IFS_DescriptionCode', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312015, 'ЭКИ(Классификация)', 'IFS_KESR', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312016, 'Администратор(Классификация)', 'IFS_KVSRCode', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312017, 'КЦСР(Классификация)', 'KcsrCode', '', ' ', 1, 5503, 2, 0, 'КЦСР', 0, 25462) ;

CALL ImportField(550312018, 'Вид дохода(Классификация)', 'KDDescriptionCode', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312019, 'ЭКД(Классификация)', 'KDKESR', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312020, 'Администратор(Классификация)', 'KDKVSRCode', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312021, 'Подвид дохода(Классификация)', 'KDProgramCode', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312022, 'КОСГУ(Классификация)', 'Kesr', '', ' ', 1, 5503, 2, 0, '', 0, 17415) ;

CALL ImportField(550312023, 'ФКР(Классификация)', 'Kfsr', '', ' ', 1, 5503, 2, 0, '', 0, 17411) ;

CALL ImportField(550312024, 'КВР(Классификация)', 'KvrCode', '', ' ', 1, 5503, 2, 0, 'КВР', 0, 25467) ;

CALL ImportField(550312025, 'КВСР(Классификация)', 'KvsrCode', '', ' ', 1, 5503, 2, 0, 'КВСР', 0, 25472) ;

CALL ImportField(550312026, 'Тип средств', 'MeansType', '', ' ', 1, 5503, 2, 0, '', 0, 17426) ;

CALL ImportField(550312027, 'Код расходного обязательсва', 'PayPromiseClsCode', '', ' ', 1, 5503, 2, 0, '', 0, 27849) ;

CALL ImportField(550312029, 'Район трансферта', 'RegionCls', '', ' ', 1, 5503, 2, 0, '', 0, 17417) ;

CALL ImportField(550312030, 'СубКосгу', 'SubKesr', '', ' ', 1, 5503, 2, 0, '', 0, 17416) ;

CALL ImportField(550312031, 'Код субсидии', 'SubsidyClsCode', 'Код субсидии', ' ', 1, 5503, 2, 0, '', 0, 26641) ;

CALL ImportField(550312032, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 5503, 2, 0, '', 0, 25326) ;

CALL ImportField(550312033, 'Классификация', 'TreeOwner1', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312034, 'Вариант', 'Variant', '', ' ', 1, 5503, 2, 0, '', 0, 17474) ;

CALL ImportField(550312035, 'Класс документа', 'Class', '', ' ', 1, 5503, 2, 0, '', 0, 22837) ;

CALL ImportField(550312036, 'Номер документа', 'DocNumber', '', ' ', 1, 5503, 2, 0, '', 0, 17467) ;

CALL ImportField(550312037, 'Имя связи', 'NameLink', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312038, 'Информация о связи', 'InfoLink', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312039, 'ИД исходного документа', 'IDOriginalDoc', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312040, 'ИД нового документа', 'IDNewDoc', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312041, 'КВСР', 'Kvsr', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312042, 'КВР', 'Kvr', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312043, 'КЦСР', 'Kcsr', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312044, 'Код целевых средств', 'TransfertCls', 'Код целевых средств (ссылка)', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312045, 'Сумма', 'summaCalc', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312046, 'Код субсидии', 'SubsidyCls', 'Код субсидии (ссылка)', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312047, 'Код бюджетного ассигнования', 'BudAllocationCls', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312048, 'Код расходного обязательсва', 'PayPromiseCls', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312049, 'Класс документа', 'Progindex', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312050, 'Ссылка на родительский документ', 'ParentID', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312051, 'Сумма', 'Summa', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312052, 'Сумма на год', 'summaYear', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312053, 'Сумма на квартал', 'summaQuarter', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312054, 'Сумма на месяц', 'summaMonth', '', ' ', 1, 5503, 2, 1, '', 0, null) ;

CALL ImportField(550312055, 'Классификация', 'TreeOwner0', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312056, 'Направление (Ключ)', 'DirectionCls', '', ' ', 1, 5503, 2, 1, '', 0, 17450) ;

CALL ImportField(550312057, 'Мероприятие (Ключ)', 'Fact', '', ' ', 1, 5503, 2, 1, '', 0, 17418) ;

CALL ImportField(550312058, 'Код доп. информации (Ключ)', 'FinType', 'Код дополнительной информации', ' ', 1, 5503, 2, 1, '', 0, 17425) ;

CALL ImportField(550312059, 'НПА (Ключ)', 'DocBase', 'НПА', ' ', 1, 5503, 2, 1, '', 0, 17473) ;

-- Организации, Бюджет(1)
CALL ImportField(960110052, 'ОКТМОКлюч', 'OKTMO', '', ' ', 1, 9601, 0, 0, '', 0, 32858) ;

CALL ImportField(960110053, 'ОКТМО', 'OKTMOCODE', '', ' ', 1, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110055, 'ОГРН', 'OGRN', '', ' ', 1, 9601, 0, 1, '', 0, null) ;

-- Организации, УРМ+Бюджет(2)
CALL ImportField(960110004, 'Бюджет', 'BUDGETREF', '', ' ', 2, 9601, 0, 0, '', 0, 16683) ;

CALL ImportField(960110021, 'Организация-распорядитель(ссылка)', 'GENERALORG_REF', '', ' ', 2, 9601, 0, 0, '', 0, 16680) ;

CALL ImportField(960110024, 'КПП', 'KPP', '', ' ', 2, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110030, 'Город', 'ORG_CITY', '', ' ', 2, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110033, 'Ключ организации(ссылка)', 'ID', '', ' ', 2, 9601, 0, 0, '', 0, 16643) ;

CALL ImportField(960110054, 'ОКПО', 'OKPO', '', ' ', 2, 9601, 0, 0, '', 0, 32938) ;

CALL ImportField(960110056, 'УПБС', 'RemotePBSCode', '', ' ', 2, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110057, 'НУБП', 'RemoteNotPBSCode', '', ' ', 2, 9601, 0, 0, '', 0, null) ;

-- Счета организаций, УРМ+Бюджет(2)
CALL ImportField(960210003, 'Ключ счета(ссылка)', 'ID', '', ' ', 2, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210008, 'Ссылка на банк', 'BANKREF', '', ' ', 2, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210010, 'Счет органа ФК(Обслуживающая организация\Орган ФК)', 'FACIALCODE', '', ' ', 2, 9602, 0, 0, '', 0, 17122) ;

CALL ImportField(960210014, 'Ссылка на организацию', 'ORGREF', '', ' ', 2, 9602, 0, 0, '', 0, null) ;

CALL ImportField(960210016, 'Ссылка на обслуживающую организацию', 'SERVICE_ORG_REF', '', ' ', 2, 9602, 0, 0, '', 0, 17123) ;

-- Банки, УРМ+Бюджет(2)
CALL ImportField(960310004, 'Ключ банка(ссылка)', 'BANK_REF', '', ' ', 2, 9603, 0, 0, '', 0, 17100) ;

CALL ImportField(960310005, 'Признак закрытия', 'CLOSED', '', ' ', 2, 9603, 0, 0, '', 0, 17103) ;

-- Счета ФО, Бюджет(1)
CALL ImportField(960410034, 'Район выдачи наличности', 'REGIONCLS', '', ' ', 1, 9604, 0, 0, '', 0, 17285) ;

-- ФКР, Бюджет(1)
CALL ImportField(980210012, '', '_FAVORITE', '', ' ', 1, 9802, 0, 0, '', 0, null) ;

-- КВСР, Бюджет(1)
CALL ImportField(980310013, '', '_FAVORITE', '', ' ', 1, 9803, 0, 0, '', 0, null) ;

-- КВР, Бюджет(1)
CALL ImportField(980410012, '', '_FAVORITE', '', ' ', 1, 9804, 0, 0, '', 0, null) ;

-- КВР, УРМ+Бюджет(2)
CALL ImportField(980410002, '', 'ID', '', ' ', 2, 9804, 0, 0, '', 0, 16865) ;

CALL ImportField(980410006, 'Код', 'CODE', '', ' ', 2, 9804, 0, 0, '', 0, 25467) ;

-- КЦСР, Бюджет(1)
CALL ImportField(980510012, '', 'CONFORMITYCODE', '', ' ', 1, 9805, 0, 0, '', 0, 32934) ;

CALL ImportField(980510013, '', 'DIRECTIONEXPENCE', '', ' ', 1, 9805, 0, 0, '', 0, 32935) ;

CALL ImportField(980510014, '', '_FAVORITE', '', ' ', 1, 9805, 0, 0, '', 0, null) ;

-- КЦСР, УРМ+Бюджет(2)
CALL ImportField(980510002, '', 'ID', '', ' ', 2, 9805, 0, 0, '', 0, 16858) ;

CALL ImportField(980510006, 'Код', 'CODE', '', ' ', 2, 9805, 0, 0, '', 0, 25462) ;

-- Суб КЦСР, Бюджет(1)
CALL ImportField(980610003, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9806, 0, 0, '', 0, 33061) ;

CALL ImportField(980610004, 'Автор', 'CREATERUSER', '', ' ', 1, 9806, 0, 0, '', 0, 33062) ;

CALL ImportField(980610005, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9806, 0, 0, '', 0, 33063) ;

CALL ImportField(980610006, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9806, 0, 0, '', 0, 33064) ;

CALL ImportField(980610007, '', '_FAVORITE', '', ' ', 1, 9806, 0, 0, '', 0, null) ;

-- Суб КОСГУ, Бюджет(1)
CALL ImportField(980810007, '', '_FAVORITE', '', ' ', 1, 9808, 0, 0, '', 0, null) ;

-- КД, Бюджет(1)
CALL ImportField(980910024, '', '_FAVORITE', '', ' ', 1, 9809, 0, 0, '', 0, null) ;

-- КД, УРМ+Бюджет(2)
CALL ImportField(980910004, 'Вид дохода', 'DESCRIPTIONCODE', '', ' ', 2, 9809, 0, 0, '', 0, 16831) ;

CALL ImportField(980910007, 'Элемент', 'ITEMCODE', '', ' ', 2, 9809, 0, 0, '', 0, 16833) ;

CALL ImportField(980910012, 'Код программы', 'PROGRAMCODE', '', ' ', 2, 9809, 0, 0, '', 0, 16834) ;

CALL ImportField(980910015, 'Признак обобщения', 'UNIONFLAG', '', ' ', 2, 9809, 0, 0, '', 0, 16840) ;

-- Суб КД, Бюджет(1)
CALL ImportField(981010011, '', '_FAVORITE', '', ' ', 1, 9810, 0, 0, '', 0, null) ;

-- Документы, Бюджет(1)
CALL ImportField(981110010, '', '_FAVORITE', '', ' ', 1, 9811, 0, 0, '', 0, null) ;

-- Районы, Бюджет(1)
CALL ImportField(981210014, '', '_FAVORITE', '', ' ', 1, 9812, 0, 0, '', 0, null) ;

-- Источники финансирования, Бюджет(1)
CALL ImportField(981310005, '', '_FAVORITE', '', ' ', 1, 9813, 0, 0, '', 0, null) ;

-- КСШК, Бюджет(1)
CALL ImportField(981410003, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9814, 0, 0, '', 0, 33037) ;

CALL ImportField(981410004, 'Автор', 'CREATERUSER', '', ' ', 1, 9814, 0, 0, '', 0, 33038) ;

CALL ImportField(981410005, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9814, 0, 0, '', 0, 33039) ;

CALL ImportField(981410006, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9814, 0, 0, '', 0, 33040) ;

CALL ImportField(981410007, '', '_FAVORITE', '', ' ', 1, 9814, 0, 0, '', 0, null) ;

-- Материальные ценности, Бюджет(1)
CALL ImportField(981510003, '', '_FAVORITE', '', ' ', 1, 9815, 0, 0, '', 0, null) ;

-- Основные средства, Бюджет(1)
CALL ImportField(981610003, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9816, 0, 0, '', 0, 33041) ;

CALL ImportField(981610004, 'Автор', 'CREATERUSER', '', ' ', 1, 9816, 0, 0, '', 0, 33042) ;

CALL ImportField(981610005, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9816, 0, 0, '', 0, 33043) ;

CALL ImportField(981610006, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9816, 0, 0, '', 0, 33044) ;

CALL ImportField(981610007, '', '_FAVORITE', '', ' ', 1, 9816, 0, 0, '', 0, null) ;

-- Справочно, Бюджет(1)
CALL ImportField(981710003, '', '_FAVORITE', '', ' ', 1, 9817, 0, 0, '', 0, null) ;

-- Валюты, Бюджет(1)
CALL ImportField(981810008, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9818, 0, 0, '', 0, 33021) ;

CALL ImportField(981810009, 'Автор', 'CREATERUSER', '', ' ', 1, 9818, 0, 0, '', 0, 33022) ;

CALL ImportField(981810010, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9818, 0, 0, '', 0, 33023) ;

CALL ImportField(981810011, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9818, 0, 0, '', 0, 33024) ;

CALL ImportField(981810012, '', '_FAVORITE', '', ' ', 1, 9818, 0, 0, '', 0, null) ;

-- Тип организации (старый), Бюджет(1)
CALL ImportField(982010008, '', '_FAVORITE', '', ' ', 1, 9820, 0, 0, '', 0, null) ;

-- Коды расчетных счетов, Бюджет(1)
CALL ImportField(982110009, '', '_FAVORITE', '', ' ', 1, 9821, 0, 0, '', 0, null) ;

-- Группы информации, Бюджет(1)
CALL ImportField(982210005, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9822, 0, 0, '', 0, 33025) ;

CALL ImportField(982210006, 'Автор', 'CREATERUSER', '', ' ', 1, 9822, 0, 0, '', 0, 33026) ;

CALL ImportField(982210007, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9822, 0, 0, '', 0, 33027) ;

CALL ImportField(982210008, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9822, 0, 0, '', 0, 33028) ;

CALL ImportField(982210009, '', '_FAVORITE', '', ' ', 1, 9822, 0, 0, '', 0, null) ;

-- ГосНИ, Бюджет(1)
CALL ImportField(982310007, '', '_FAVORITE', '', ' ', 1, 9823, 0, 0, '', 0, null) ;

-- Слой доходов, Бюджет(1)
CALL ImportField(982610005, '', '_FAVORITE', '', ' ', 1, 9826, 0, 0, '', 0, null) ;

-- Код дополнительной информации, Бюджет(1)
CALL ImportField(982710009, '', '_FAVORITE', '', ' ', 1, 9827, 0, 0, '', 0, null) ;

-- Мероприятия, Бюджет(1)
CALL ImportField(982810010, 'Автор', 'CREATERUSER', '', ' ', 1, 9828, 0, 0, '', 0, 32920) ;

CALL ImportField(982810011, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9828, 0, 0, '', 0, 32921) ;

CALL ImportField(982810012, '', '_FAVORITE', '', ' ', 1, 9828, 0, 0, '', 0, null) ;

-- Мероприятия, УРМ+Бюджет(2)
CALL ImportField(982810013, 'Значимый код', 'CODE', '', ' ', 2, 9828, 0, 0, '', 0, 36863) ;

-- Нормативно-правовые акты, Бюджет(1)
CALL ImportField(982910010, '', '_FAVORITE', '', ' ', 1, 9829, 0, 0, '', 0, null) ;

-- Тип отчета, Бюджет(1)
CALL ImportField(983410003, '', '_FAVORITE', '', ' ', 1, 9834, 0, 0, '', 0, null) ;

-- Вид бюджета (счета по взаимным), Бюджет(1)
CALL ImportField(983510007, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9835, 0, 0, '', 0, 33017) ;

CALL ImportField(983510008, 'Автор', 'CREATERUSER', '', ' ', 1, 9835, 0, 0, '', 0, 33018) ;

CALL ImportField(983510009, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9835, 0, 0, '', 0, 33019) ;

CALL ImportField(983510010, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9835, 0, 0, '', 0, 33020) ;

CALL ImportField(983510011, '', '_FAVORITE', '', ' ', 1, 9835, 0, 0, '', 0, null) ;

-- Лицевые счета, Бюджет(1)
CALL ImportField(984110051, '', '_FAVORITE', '', ' ', 1, 9841, 0, 0, '', 0, null) ;

-- ОКВЭД2, УРМ+Бюджет(2)
CALL ImportField(984210001, 'Код', 'ID', '', ' ', 2, 9842, 0, 1, '', 0, 37814) ;

CALL ImportField(984210002, 'Наименование', 'Name', '', ' ', 2, 9842, 0, 1, '', 0, 37815) ;

CALL ImportField(984210003, 'Дата начала срока действия', 'StartDate', '', ' ', 2, 9842, 0, 1, '', 0, 37816) ;

CALL ImportField(984210004, 'Дата удаления(окончания срока действия)', 'DeleteDate', '', ' ', 2, 9842, 0, 1, '', 0, 37817) ;

CALL ImportField(984210005, 'Дата создания', 'CreateDate', '', ' ', 2, 9842, 0, 1, '', 0, 37818) ;

CALL ImportField(984210006, 'Дата изменения', 'UpdateDate', '', ' ', 2, 9842, 0, 1, '', 0, 37819) ;

-- Виды платежей, Бюджет(1)
CALL ImportField(984310005, '', '_FAVORITE', '', ' ', 1, 9843, 0, 0, '', 0, null) ;

-- Умолчания расчетных счетов, Бюджет(1)
CALL ImportField(984410005, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9844, 0, 0, '', 0, 33045) ;

CALL ImportField(984410006, 'Автор', 'CREATERUSER', '', ' ', 1, 9844, 0, 0, '', 0, 33046) ;

CALL ImportField(984410007, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9844, 0, 0, '', 0, 33047) ;

CALL ImportField(984410008, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9844, 0, 0, '', 0, 33048) ;

CALL ImportField(984410009, '', '_FAVORITE', '', ' ', 1, 9844, 0, 0, '', 0, null) ;

-- Кассовые символы, Бюджет(1)
CALL ImportField(984510007, '', '_FAVORITE', '', ' ', 1, 9845, 0, 0, '', 0, null) ;

-- Бухгалтерская операция(старая), Бюджет(1)
CALL ImportField(984610005, '', '_FAVORITE', '', ' ', 1, 9846, 0, 0, '', 0, null) ;

-- Код операции, Бюджет(1)
CALL ImportField(984710005, '', '_FAVORITE', '', ' ', 1, 9847, 0, 0, '', 0, null) ;

-- Назначения платежа, Бюджет(1)
CALL ImportField(984810010, '', '_FAVORITE', '', ' ', 1, 9848, 0, 0, '', 0, null) ;

-- Тип средств бюджета, Бюджет(1)
CALL ImportField(984910014, '', '_FAVORITE', '', ' ', 1, 9849, 0, 0, '', 0, null) ;

-- Причина отклонения, Бюджет(1)
CALL ImportField(985010008, '', '_FAVORITE', '', ' ', 1, 9850, 0, 0, '', 0, null) ;

-- Коды ошибок, Бюджет(1)
CALL ImportField(985110009, '', '_FAVORITE', '', ' ', 1, 9851, 0, 0, '', 0, null) ;

-- Источники финансирования дефицита бюджета, Бюджет(1)
CALL ImportField(985210022, 'Автор', 'CREATERUSER', '', ' ', 1, 9852, 0, 0, '', 0, 32929) ;

CALL ImportField(985210023, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9852, 0, 0, '', 0, 32930) ;

CALL ImportField(985210024, '', '_FAVORITE', '', ' ', 1, 9852, 0, 0, '', 0, null) ;

-- Источники финансирования дефицита бюджета, УРМ+Бюджет(2)
CALL ImportField(985210005, 'Вид источника', 'DESCRIPTIONCODE', '', ' ', 2, 9852, 0, 0, '', 0, 17050) ;

CALL ImportField(985210006, 'Направление', 'DIRECTION', '', ' ', 2, 9852, 0, 0, '', 0, 17048) ;

CALL ImportField(985210009, 'Элемент', 'ITEMCODE', '', ' ', 2, 9852, 0, 0, '', 0, 17052) ;

CALL ImportField(985210012, 'код источника(20 разрядов)', 'MAINDESCRIPTIONCODE', '', ' ', 2, 9852, 0, 0, '', 0, 17051) ;

CALL ImportField(985210014, 'Код программы', 'PROGRAMCODE', '', ' ', 2, 9852, 0, 0, '', 0, 17053) ;

CALL ImportField(985210016, 'Признак обобщения', 'UNIONFLAG', '', ' ', 2, 9852, 0, 0, '', 0, 17057) ;

-- Тип реестра, Бюджет(1)
CALL ImportField(985310009, '', '_FAVORITE', '', ' ', 1, 9853, 0, 0, '', 0, null) ;

-- Объекты, Бюджет(1)
CALL ImportField(985410008, '', '_FAVORITE', '', ' ', 1, 9854, 0, 1, '', 0, null) ;

-- Объекты, УРМ+Бюджет(2)
CALL ImportField(985410001, 'Дата создания', 'CREATEDATE', '', ' ', 2, 9854, 0, 1, '', 0, 38231) ;

CALL ImportField(985410002, 'Автор', 'CREATERUSER', '', ' ', 2, 9854, 0, 1, '', 0, 38233) ;

CALL ImportField(985410003, 'Код', 'CODE', '', ' ', 2, 9854, 0, 0, '', 0, 38205) ;

CALL ImportField(985410004, 'Наименование', 'NAME', '', ' ', 2, 9854, 0, 0, '', 0, 38208) ;

CALL ImportField(985410005, 'Краткое имя', 'SHORTNAME', '', ' ', 2, 9854, 0, 0, '', 0, 38209) ;

CALL ImportField(985410006, 'Дата изменения', 'UPDATEDATE', '', ' ', 2, 9854, 0, 0, '', 0, 38232) ;

CALL ImportField(985410007, 'Изменивший', 'UPDATERUSER', '', ' ', 2, 9854, 0, 0, '', 0, 38234) ;

CALL ImportField(985410009, 'Код объекта финансирующего бюджета', 'BudgetFinSourceObjectCode', '', ' ', 2, 9854, 0, 0, '', 0, 38207) ;

CALL ImportField(985410010, 'Субкод объекта', 'SubCode', '', ' ', 2, 9854, 0, 0, '', 0, 38206) ;

CALL ImportField(985410011, 'Бюджет', 'BudgetRef', '', ' ', 2, 9854, 0, 0, '', 0, 38211) ;

CALL ImportField(985410012, 'Район', 'RegionCls', '', ' ', 2, 9854, 0, 0, '', 0, 38212) ;

CALL ImportField(985410013, 'Уровень источника средств', 'BudgetFinSourceLevel', '', ' ', 2, 9854, 0, 0, '', 0, 38213) ;

CALL ImportField(985410014, 'Код родительского объекта', 'ParentRef', '', ' ', 2, 9854, 0, 0, '', 0, 38214) ;

CALL ImportField(985410015, 'Дата начала действия', 'StartDate', '', ' ', 2, 9854, 0, 0, '', 0, 38215) ;

CALL ImportField(985410016, 'Дата окончания действия', 'DeleteDate', '', ' ', 2, 9854, 0, 0, '', 0, 38216) ;

CALL ImportField(985410017, 'КВСР', 'KVSR', '', ' ', 2, 9854, 0, 1, '', 0, 38217) ;

CALL ImportField(985410018, 'КЦСР', 'KCSR', '', ' ', 2, 9854, 0, 0, '', 0, 38218) ;

CALL ImportField(985410019, 'Код цели', 'TARGETCLS', '', ' ', 2, 9854, 0, 0, '', 0, 38219) ;

CALL ImportField(985410020, 'Примечание', 'Note', '', ' ', 2, 9854, 0, 0, '', 0, 38220) ;

CALL ImportField(985410021, 'Тип средств', 'MeansType', '', ' ', 2, 9854, 0, 0, '', 0, 38221) ;

CALL ImportField(985410022, 'Код целевых средств', 'TransfertCLS', '', ' ', 2, 9854, 0, 0, '', 0, 38222) ;

CALL ImportField(985410023, 'Мероприятие', 'Fact', '', ' ', 2, 9854, 0, 0, '', 0, 38223) ;

CALL ImportField(985410024, 'ОКТМО', 'OKTMO', '', ' ', 2, 9854, 0, 0, '', 0, 38224) ;

CALL ImportField(985410025, 'Классификатор НПА', 'NPAId', '', ' ', 2, 9854, 0, 0, '', 0, 38225) ;

CALL ImportField(985410026, 'Дата НПА', 'NPADate', '', ' ', 2, 9854, 0, 0, '', 0, 38226) ;

CALL ImportField(985410027, 'Номер НПА', 'NPANumber', '', ' ', 2, 9854, 0, 0, '', 0, 38227) ;

CALL ImportField(985410028, 'Группа', 'NPAGroup', '', ' ', 2, 9854, 0, 0, '', 0, 38228) ;

CALL ImportField(985410029, '', 'KVSRCODE', '', ' ', 2, 9854, 0, 0, '', 0, null) ;

CALL ImportField(985410030, 'Наименование', 'NPAName', '', ' ', 2, 9854, 0, 0, '', 0, 38229) ;

CALL ImportField(985410031, 'Адрес', 'Address', '', ' ', 2, 9854, 0, 0, '', 0, 38230) ;

-- Вид ссуды, Бюджет(1)
CALL ImportField(985710004, '', '_FAVORITE', '', ' ', 1, 9857, 0, 0, '', 0, null) ;

-- Вид заимствования, Бюджет(1)
CALL ImportField(985810004, '', '_FAVORITE', '', ' ', 1, 9858, 0, 0, '', 0, null) ;

-- Отдел, Бюджет(1)
CALL ImportField(985910009, '', '_FAVORITE', '', ' ', 1, 9859, 0, 0, '', 0, null) ;

-- Единицы измерения, Бюджет(1)
CALL ImportField(986010008, '', '_FAVORITE', '', ' ', 1, 9860, 0, 0, '', 0, null) ;

-- Предмет заявки, Бюджет(1)
CALL ImportField(986110036, '', 'OKPD', '', ' ', 1, 9861, 0, 0, '', 0, 35340) ;

CALL ImportField(986110037, '', 'OKVED', '', ' ', 1, 9861, 0, 0, '', 0, 35341) ;

CALL ImportField(986110038, '', '_FAVORITE', '', ' ', 1, 9861, 0, 0, '', 0, null) ;

-- ОКАТО, Бюджет(1)
CALL ImportField(986210004, '', '_FAVORITE', '', ' ', 1, 9862, 0, 0, '', 0, null) ;

-- Тип обеспечения, Бюджет(1)
CALL ImportField(986310003, '', '_FAVORITE', '', ' ', 1, 9863, 0, 0, '', 0, null) ;

-- Вид плана, Бюджет(1)
CALL ImportField(986410005, '', '_FAVORITE', '', ' ', 1, 9864, 0, 0, '', 0, null) ;

-- План счетов, Бюджет(1)
CALL ImportField(986510010, '', '_FAVORITE', '', ' ', 1, 9865, 0, 0, '', 0, null) ;

-- План счетов, УРМ+Бюджет(2)
CALL ImportField(986510001, 'Бух счет', 'BUHACC', '', ' ', 2, 9865, 0, 0, '', 0, 21629) ;

CALL ImportField(986510003, 'КОСГУ счета', 'ECCLS', '', ' ', 2, 9865, 0, 0, '', 0, 21630) ;

-- ОКПД2, УРМ+Бюджет(2)
CALL ImportField(986710001, 'Код', 'ID', '', ' ', 2, 9867, 0, 1, '', 0, 37808) ;

CALL ImportField(986710002, 'Наименование', 'Name', '', ' ', 2, 9867, 0, 1, '', 0, 37809) ;

CALL ImportField(986710003, 'Дата начала срока действия', 'StartDate', '', ' ', 2, 9867, 0, 1, '', 0, 37810) ;

CALL ImportField(986710004, 'Дата удаления(окончания срока действия)', 'DeleteDate', '', ' ', 2, 9867, 0, 1, '', 0, 37811) ;

CALL ImportField(986710005, 'Дата создания', 'CreateDate', '', ' ', 2, 9867, 0, 1, '', 0, 37812) ;

CALL ImportField(986710006, 'Дата изменения', 'UpdateDate', '', ' ', 2, 9867, 0, 1, '', 0, 37813) ;

-- Код операции сектора государственного управления, Бюджет(1)
CALL ImportField(986810017, '', '_FAVORITE', '', ' ', 1, 9868, 0, 0, '', 0, null) ;

-- Направление, Бюджет(1)
CALL ImportField(986910007, '', '_FAVORITE', '', ' ', 1, 9869, 0, 0, '', 0, null) ;

-- Направление, УРМ+Бюджет(2)
CALL ImportField(986910008, 'Значимый код', 'CODE', '', ' ', 2, 9869, 0, 0, '', 0, 36861) ;

-- Подвид дохода, Бюджет(1)
CALL ImportField(987010008, '', '_FAVORITE', '', ' ', 1, 9870, 0, 0, '', 0, null) ;

-- Операция, Бюджет(1)
CALL ImportField(987110026, '', '_FAVORITE', '', ' ', 1, 9871, 0, 0, '', 0, null) ;

-- Баланс, Бюджет(1)
CALL ImportField(987210006, '', '_FAVORITE', '', ' ', 1, 9872, 0, 0, '', 0, null) ;

-- Бюджет, Бюджет(1)
CALL ImportField(987810016, '', '_FAVORITE', '', ' ', 1, 9878, 0, 0, '', 0, null) ;

-- Код цели, Бюджет(1)
CALL ImportField(987910008, '', '_FAVORITE', '', ' ', 1, 9879, 0, 0, '', 0, null) ;

-- Источник образования средств, Бюджет(1)
CALL ImportField(988010011, '', '_FAVORITE', '', ' ', 1, 9880, 0, 0, '', 0, null) ;

-- ОКФС, Бюджет(1)
CALL ImportField(988110005, '', '_FAVORITE', '', ' ', 1, 9881, 0, 0, '', 0, null) ;

-- ОКОПФ, Бюджет(1)
CALL ImportField(988210005, 'Дата удаления(окончания срока действия)', 'DELETEDATE', '', ' ', 1, 9882, 0, 0, '', 0, 32936) ;

CALL ImportField(988210006, 'Дата начала срока действия', 'STARTDATE', '', ' ', 1, 9882, 0, 0, '', 0, 32937) ;

CALL ImportField(988210007, '', '_FAVORITE', '', ' ', 1, 9882, 0, 0, '', 0, null) ;

-- Вид организации, Бюджет(1)
CALL ImportField(988310005, '', '_FAVORITE', '', ' ', 1, 9883, 0, 0, '', 0, null) ;

-- Код целевых средств, Бюджет(1)
CALL ImportField(988410041, '', '_FAVORITE', '', ' ', 1, 9884, 0, 0, '', 0, null) ;

-- Код целевых средств, УРМ+Бюджет(2)
CALL ImportField(988410006, 'Код дохода (ключ)', 'RECEIVEKD', '', ' ', 2, 9884, 0, 0, '', 0, 25329) ;

CALL ImportField(988410008, 'Код дохода', 'RECEIVEKD_FULLID', '', ' ', 2, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410016, 'Признак', 'TARGETMEANSSIGN', '', ' ', 2, 9884, 0, 0, '', 0, 25336) ;

CALL ImportField(988410018, 'КЦСРКлюч', 'TRANSFERKCSR', '', ' ', 2, 9884, 0, 0, '', 0, 25337) ;

CALL ImportField(988410019, 'КЦСР', 'TRANSFERKCSRCODE', '', ' ', 2, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410021, 'ЭКР', 'TRANSFERKESR', '', ' ', 2, 9884, 0, 0, '', 0, 25339) ;

CALL ImportField(988410022, 'ФКР', 'TRANSFERKFSR', '', ' ', 2, 9884, 0, 0, '', 0, 25340) ;

CALL ImportField(988410023, 'КВРКлюч', 'TRANSFERKVR', '', ' ', 2, 9884, 0, 0, '', 0, 25341) ;

CALL ImportField(988410024, 'КВР', 'TRANSFERKVRCODE', '', ' ', 2, 9884, 0, 0, '', 0, null) ;

CALL ImportField(988410025, 'КВСРКлюч', 'TRANSFERKVSR', '', ' ', 2, 9884, 0, 0, '', 0, 25342) ;

CALL ImportField(988410026, 'КВСР', 'TRANSFERKVSRCODE', '', ' ', 2, 9884, 0, 0, '', 0, null) ;

-- Вид ассигнований, Бюджет(1)
CALL ImportField(988510011, '', '_FAVORITE', '', ' ', 1, 9885, 0, 0, '', 0, null) ;

-- Вид ассигнований, УРМ+Бюджет(2)
CALL ImportField(988510009, 'Признак лимитируемости', 'UNRESTRICTED', '', ' ', 2, 9885, 0, 0, '', 0, 24632) ;

-- Вид изменений, Бюджет(1)
CALL ImportField(988610010, '', '_FAVORITE', '', ' ', 1, 9886, 0, 0, '', 0, null) ;

-- Вариант, Бюджет(1)
CALL ImportField(988710003, '', '_FAVORITE', '', ' ', 1, 9887, 0, 0, '', 0, null) ;

-- Общероссийский классификатор продукции, Бюджет(1)
CALL ImportField(988810001, '', '_FAVORITE', '', ' ', 1, 9888, 0, 0, '', 0, null) ;

CALL ImportField(988810002, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9888, 0, 0, '', 0, 22742) ;

CALL ImportField(988810003, 'Автор', 'CREATERUSER', '', ' ', 1, 9888, 0, 0, '', 0, 22745) ;

CALL ImportField(988810004, '', 'HASCHILDS', '', ' ', 1, 9888, 0, 0, '', 0, 22741) ;

CALL ImportField(988810005, 'Код', 'ID', '', ' ', 1, 9888, 0, 0, '', 0, 22738) ;

CALL ImportField(988810006, 'Наименование', 'NAME', '', ' ', 1, 9888, 0, 0, '', 0, 22739) ;

CALL ImportField(988810007, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9888, 0, 0, '', 0, 22743) ;

CALL ImportField(988810008, 'Изменивший', 'UPDATERUSER', '', ' ', 1, 9888, 0, 0, '', 0, 22744) ;

-- Код субсидии, Бюджет(1)
CALL ImportField(988910016, '', '_FAVORITE', '', ' ', 1, 9889, 0, 0, '', 0, null) ;

-- Код бюджетного ассигнования, Бюджет(1)
CALL ImportField(989010011, '', '_FAVORITE', '', ' ', 1, 9890, 0, 0, '', 0, null) ;

-- Код расходного обязательства, Бюджет(1)
CALL ImportField(989110011, '', '_FAVORITE', '', ' ', 1, 9891, 0, 0, '', 0, null) ;

-- Категории архивных документов (справочник), Бюджет(1)
CALL ImportField(989210018, '', '_FAVORITE', '', ' ', 1, 9892, 0, 0, '', 0, null) ;

-- Направления расходов вышестоящих бюджетов , Бюджет(1)
CALL ImportField(989410001, 'Ключ', 'ID', '', ' ', 1, 9894, 0, 1, '', 0, 32789) ;

CALL ImportField(989410002, 'Код', 'CODE', '', ' ', 1, 9894, 0, 1, '', 0, 32790) ;

CALL ImportField(989410003, 'Наименование', 'NAME', '', ' ', 1, 9894, 0, 1, '', 0, 32791) ;

CALL ImportField(989410004, 'Источник средств', 'OWNERLEVEL', '', ' ', 1, 9894, 0, 1, '', 0, 32792) ;

CALL ImportField(989410005, 'Автор', 'CREATERUSER', '', ' ', 1, 9894, 0, 1, '', 0, 32793) ;

CALL ImportField(989410006, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9894, 0, 1, '', 0, 32795) ;

CALL ImportField(989410007, 'Изменил', 'UPDATERUSER', '', ' ', 1, 9894, 0, 1, '', 0, 32794) ;

CALL ImportField(989410008, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9894, 0, 1, '', 0, 32796) ;

CALL ImportField(989410009, 'Дата закрытия', 'DELETEDATE', '', ' ', 1, 9894, 0, 1, '', 0, 32797) ;

CALL ImportField(989410010, 'Дата начала', 'STARTDATE', '', ' ', 1, 9894, 0, 1, '', 0, 32798) ;

-- ОКТМО, Бюджет(1)
CALL ImportField(989510001, 'Ключ', 'ID', '', ' ', 1, 9895, 0, 1, '', 0, 32821) ;

CALL ImportField(989510002, 'Код', 'CODE', '', ' ', 1, 9895, 0, 1, '', 0, 32822) ;

CALL ImportField(989510003, 'Код МО', 'CODE1', '', ' ', 1, 9895, 0, 0, '', 0, 32824) ;

CALL ImportField(989510004, 'Код населенного пункта', 'CODE2', '', ' ', 1, 9895, 0, 0, '', 0, 32825) ;

CALL ImportField(989510005, 'Наименование', 'NAME', '', ' ', 1, 9895, 0, 0, '', 0, 32826) ;

CALL ImportField(989510006, 'Наименование МО', 'NAMEOKTMO8', '', ' ', 1, 9895, 0, 0, '', 0, 32827) ;

CALL ImportField(989510007, 'Дополнительная информация', 'NOTEOKTMO8', '', ' ', 1, 9895, 0, 0, '', 0, 32828) ;

CALL ImportField(989510008, 'Район', 'REGIONCLS', '', ' ', 1, 9895, 0, 0, '', 0, 32847) ;

CALL ImportField(989510009, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9895, 0, 1, '', 0, 32831) ;

CALL ImportField(989510010, 'Автор', 'CREATERUSER', '', ' ', 1, 9895, 0, 1, '', 0, 32832) ;

CALL ImportField(989510011, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9895, 0, 1, '', 0, 32833) ;

CALL ImportField(989510012, 'Изменил', 'UPDATERUSER', '', ' ', 1, 9895, 0, 1, '', 0, 32834) ;

CALL ImportField(989510013, 'Дата начала', 'STARTDATE', '', ' ', 1, 9895, 0, 0, '', 0, 32829) ;

CALL ImportField(989510014, 'Дата закрытия', 'DELETEDATE', '', ' ', 1, 9895, 0, 0, '', 0, 32830) ;

-- Пользователи системы, Бюджет(1)
CALL ImportField(989910001, 'Дата создания', 'CREATEDATE', '', ' ', 1, 9899, 0, 0, '', 0, 16720) ;

CALL ImportField(989910002, '', 'CRYPTOPARAMS', '', ' ', 1, 9899, 0, 0, '', 0, 24710) ;

CALL ImportField(989910003, '', 'DEPARTMENTCLS', '', ' ', 1, 9899, 0, 0, '', 0, 16716) ;

CALL ImportField(989910004, '', 'DESCRIPTION', '', ' ', 1, 9899, 0, 0, '', 0, 16715) ;

CALL ImportField(989910005, 'Фамилия', 'FIRSTNAME', '', ' ', 1, 9899, 0, 0, '', 0, 16710) ;

CALL ImportField(989910006, 'Код', 'ID', '', ' ', 1, 9899, 0, 0, '', 0, 16709) ;

CALL ImportField(989910007, 'Имя', 'LASTNAME', '', ' ', 1, 9899, 0, 0, '', 0, 16712) ;

CALL ImportField(989910008, '', 'MIDDLENAME', '', ' ', 1, 9899, 0, 0, '', 0, 16711) ;

CALL ImportField(989910009, '', 'NOTE', '', ' ', 1, 9899, 0, 0, '', 0, 16713) ;

CALL ImportField(989910010, '', 'PHONE', '', ' ', 1, 9899, 0, 0, '', 0, 16714) ;

CALL ImportField(989910011, '', 'REMOTECLIENTREF', '', ' ', 1, 9899, 0, 0, '', 0, 16718) ;

CALL ImportField(989910012, '', 'REMOTEID', '', ' ', 1, 9899, 0, 0, '', 0, 16719) ;

CALL ImportField(989910013, 'Дата изменения', 'UPDATEDATE', '', ' ', 1, 9899, 0, 0, '', 0, 16721) ;

CALL ImportField(989910014, 'Логин', 'USERNAME', '', ' ', 1, 9899, 0, 0, '', 0, 16717) ;

-- Справочник организаций, Бюджет(1)
CALL ImportField(990310085, 'ППП', 'KVSRCode', 'ППП', ' ', 1, 9903, 0, 0, '', 0, 25472) ;

CALL ImportField(990310092, 'ОКПО', 'OKPO', 'Общероссийский классификатор предприятий и организаций', ' ', 1, 9903, 0, 0, '', 0, 32938) ;

CALL ImportField(990310094, 'ОГРН', 'OGRN', '', ' ', 1, 9903, 0, 0, 'ОГРН', 0, null) ;

CALL ImportField(990310096, 'Причина отклонения', 'REJECT_CLS', 'Причина отклонения', 'REJECTCLS', 1, 9903, 0, 1, 'ПричинаОтклонКод', 0, null) ;

CALL ImportField(990310097, 'Причина отклонения (пояснение)', 'RejectCause', 'Причина отклонения (пояснение)', 'RejectCause', 1, 9903, 0, 0, 'ПричинаОтклонТекст', 0, null) ;

CALL ImportField(990311029, 'Тип финансирования рс (ключ)', 'FinType', 'Тип финансирования рс (ключ)', 'FINTYPEKey', 1, 9903, 1, 0, 'ТипФинансированияКлюч', 0, 17114) ;

CALL ImportField(990311098, 'Тип финансирования рс', 'FinTypeCode', 'Тип финансирования рс', 'FINTYPE', 1, 9903, 1, 0, 'ТипФинансирования', 0, 36853) ;

CALL ImportField(990311100, 'Дата закрытия', 'DateClose', '', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990311101, 'Дата открытия', 'DATEOPEN', '', ' ', 1, 9903, 1, 0, '', 0, null) ;

CALL ImportField(990312047, 'Тип финансирования лс (ключ)', 'FINTYPE', 'Тип финансирования лс (ключ)', 'FINTYPEKey', 1, 9903, 2, 0, 'ТипФинансированияКлюч', 0, 17141) ;

CALL ImportField(990312083, 'КЦСР', 'KCSRCode', 'КЦСР', ' ', 1, 9903, 2, 0, '', 0, 25462) ;

CALL ImportField(990312084, 'КВР', 'KVRCode', 'КВР', ' ', 1, 9903, 2, 0, '', 0, 25467) ;

CALL ImportField(990312085, 'КВСР', 'KVSRCode', 'КВСР', ' ', 1, 9903, 2, 0, '', 0, 25472) ;

CALL ImportField(990312099, 'Консолидирующая организация', 'HigherOrg_Name', 'Консолидирующая организация', ' ', 1, 9903, 2, 0, '', 0, null) ;

CALL ImportField(990312100, 'Номер прежнего л/с', 'PrevCls', '', ' ', 1, 9903, 2, 0, '', 0, null) ;

CALL ImportField(990312101, 'Тип финансирования лс', 'FinTypeCode', 'Тип финансирования lс', 'FINTYPE', 1, 9903, 2, 0, 'ТипФинансирования', 0, 36853) ;

-- Справочник организаций, УРМ+Бюджет(2)
CALL ImportField(990310001, 'ИНН', 'INN', 'ИНН', ' ', 2, 9903, 0, 0, 'ИНН', 0, 16645) ;

CALL ImportField(990310002, 'КПП', 'INN20', 'КПП', ' ', 2, 9903, 0, 0, 'КПП', 0, 16653) ;

CALL ImportField(990310003, 'Наименование', 'NAME', 'Наименование', ' ', 2, 9903, 0, 0, 'Имя', 0, 16646) ;

CALL ImportField(990310004, 'Сокращенное наименование', 'ShortName', 'Сокращенное наименование', ' ', 2, 9903, 0, 0, 'КраткоеИмя', 0, 16670) ;

CALL ImportField(990310008, 'Район', 'RegionCLS', 'Район', ' ', 2, 9903, 0, 0, 'Район', 0, 16644) ;

CALL ImportField(990310009, 'Город', 'CITY', 'Город', ' ', 2, 9903, 0, 0, 'Город', 0, 16648) ;

CALL ImportField(990310010, 'Адрес', 'ADDRESS', 'Адрес', ' ', 2, 9903, 0, 0, 'Адрес', 0, 16651) ;

CALL ImportField(990310011, 'Страна', 'COUNTRY', 'Страна', ' ', 2, 9903, 0, 0, 'Страна', 0, 16649) ;

CALL ImportField(990310012, 'Телефон', 'PHONE', 'Телефон', ' ', 2, 9903, 0, 0, 'Телефон', 0, 16650) ;

CALL ImportField(990310057, 'Вид организации', 'Org_Type', 'Вид использования организаци', ' ', 2, 9903, 0, 0, 'ВидИспользования', 0, 16682) ;

CALL ImportField(990310078, 'Статус поставщика', 'SupplierStatus', 'Статус поставщика', ' ', 2, 9903, 0, 0, '', 0, 16685) ;

CALL ImportField(990310079, 'Код страны', 'CountryCode', 'Код страны', ' ', 2, 9903, 0, 0, '', 0, 16686) ;

CALL ImportField(990310093, 'ОКТМО', 'OKTMOCode', '', ' ', 2, 9903, 0, 0, '', 0, 32822) ;

-- Справочник контактных лиц, Бюджет(1)
CALL ImportField(990410012, 'E-mail контактного лица', 'EMAIL', '', ' ', 1, 9904, 0, 0, '', 0, 21903) ;

CALL ImportField(990410013, 'Лиц. счет', 'FACIALACCCLS', '', ' ', 1, 9904, 0, 0, '', 0, 21898) ;

CALL ImportField(990410014, 'Должность', 'HOLDRANK', '', ' ', 1, 9904, 0, 0, '', 0, 21901) ;

CALL ImportField(990410015, 'Ф.И.О контактного лица', 'NAME', '', ' ', 1, 9904, 0, 0, '', 0, 21900) ;

CALL ImportField(990410016, 'Примечание', 'NOTE', '', ' ', 1, 9904, 0, 0, '', 0, 21904) ;

CALL ImportField(990410017, 'Организация', 'OrgCollaps', '', ' ', 1, 9904, 0, 0, '', 0, null) ;

CALL ImportField(990410018, 'ИНН(Организация)', 'OrgINN', '', ' ', 1, 9904, 0, 0, 'ИНН', 0, 16645) ;

CALL ImportField(990410019, 'КПП(Организация)', 'OrgKPP', '', ' ', 1, 9904, 0, 0, 'КПП', 0, 16653) ;

CALL ImportField(990410020, 'Наименование(Организация)', 'OrgName', '', ' ', 1, 9904, 0, 0, 'Имя', 0, 16646) ;

CALL ImportField(990410021, 'Номер телефона', 'PHONENO', '', ' ', 1, 9904, 0, 0, '', 0, 21902) ;

CALL ImportField(990410022, 'Причина отклонения(текст)', 'REJECTCAUSE', '', ' ', 1, 9904, 0, 0, '', 0, 21906) ;

CALL ImportField(990410023, 'Причина отклонения', 'REJECTCLS', '', ' ', 1, 9904, 0, 0, '', 0, 21905) ;

-- Объекты, Бюджет(1)
CALL ImportField(991310003, 'Пользовательское название', 'Note', 'Название', ' ', 1, 9913, 0, 0, '', 0, 16725) ;

CALL ImportField(991313007, 'Поле кэша', 'CacheField', '', ' ', 1, 9913, 3, 0, '', 0, null) ;

CALL ImportField(991313008, 'Фильтр кэша', 'CacheFilter', '', ' ', 1, 9913, 3, 0, '', 0, null) ;

-- Константы системы, Бюджет(1)
CALL ImportField(991610001, 'Настройки бухгалтерии\Санкционирование расходов бухгалтерии\Варианты росписи расходов, заимствований, учитываемые в бухгалтерии', 'НастройкиБухгалтерии_СанкционированиеРасходовБухгалтерии_ВариантыРосписиРасходовЗаимствованийУчитываемыеВБухгалтерии', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 24, 8, 'Настройки бухгалтерии\Санкционирование расходов бухгалтерии\Варианты росписи расходов, заимствований, учитываемые в бухгалтерии', '', 0, 0, 9916) ;

CALL ImportField(991610003, 'Настройки бухгалтерии\Использование операций\Контроль значений связанных полей', 'НастройкиБухгалтерии_ИспользованиеОпераций_КонтрольЗначенийСвязанныхПолей', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 14, 3, 'Настройки бухгалтерии\Использование операций\Контроль значений связанных полей', '', 0, 0, 9916) ;

CALL ImportField(991610004, 'Настройки бухгалтерии\Использование операций\Фильтрация справочников связанных полей', 'НастройкиБухгалтерии_ИспользованиеОпераций_ФильтрацияСправочниковСвязанныхПолей', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 13, 3, 'Настройки бухгалтерии\Использование операций\Фильтрация справочников связанных полей', '', 0, 0, 9916) ;

CALL ImportField(991610005, 'Настройки бухгалтерии\Использовать расширенный план счетов', 'НастройкиБухгалтерии_ИспользоватьРасширенныйПланСчетов', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 6, 3, 'Настройки бухгалтерии\Использовать расширенный план счетов', '', 0, 0, 9916) ;

CALL ImportField(991610006, 'Настройки бухгалтерии\Классификация остатков средств', 'НастройкиБухгалтерии_КлассификацияОстатковСредств', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 19, 3, 'Настройки бухгалтерии\Классификация остатков средств', '', 0, 0, 9916) ;

CALL ImportField(991610007, 'Настройки бухгалтерии\Расширение счета для кассовых поступлений и выбытий через банковские счета бюджетных учреждений', 'НастройкиБухгалтерии_РасширениеСчетаДляКассовыхПоступленийИВыбытийЧерезБанковскиеСчетаБюджетныхУчреждений', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 27, 8, 'Настройки бухгалтерии\Расширение счета для кассовых поступлений и выбытий через банковские счета бюджетных учреждений', '', 0, 0, 9916) ;

CALL ImportField(991610008, 'Настройки бухгалтерии\Расширение счета для кассовых поступлений и выбытий через лицевые счета бюджетных учреждений', 'НастройкиБухгалтерии_РасширениеСчетаДляКассовыхПоступленийИВыбытийЧерезЛицевыеСчетаБюджетныхУчреждений', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 26, 8, 'Настройки бухгалтерии\Расширение счета для кассовых поступлений и выбытий через лицевые счета бюджетных учреждений', '', 0, 0, 9916) ;

CALL ImportField(991610009, 'Настройки бухгалтерии\Счет, включающий проводки без Р/C', 'НастройкиБухгалтерии_СчетВключающийПроводкиБезРC', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(16, 2, 3, 'Настройки бухгалтерии\Счет, включающий проводки без Р/C', '', 0, 0, 9916) ;

CALL ImportField(991610010, 'Настройки бухгалтерии\Счет ФО для гарантий', 'НастройкиБухгалтерии_СчетФОДляГарантий', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(380, 1, 3, 'Настройки бухгалтерии\Счет ФО для гарантий', '', 0, 0, 9916) ;

CALL ImportField(991610011, 'Настройки бухгалтерии\Типы документов по дополнительным операциям', 'НастройкиБухгалтерии_ТипыДокументовПоДополнительнымОперациям', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 19, 8, 'Настройки бухгалтерии\Типы документов по дополнительным операциям', '', 0, 0, 9916) ;

CALL ImportField(991610012, 'Настройки бухгалтерии\Транзитный бух. счет для внутренних оборотов    ', 'НастройкиБухгалтерии_ТранзитныйБухСчетДляВнутреннихОборотов', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 23, 3, 'Настройки бухгалтерии\Транзитный бух. счет для внутренних оборотов    ', '', 0, 0, 9916) ;

CALL ImportField(991610013, 'Настройки финоргана\Должности и подписи\Главный бухгалтер', 'НастройкиФиноргана_ДолжностиИПодписи_ГлавныйБухгалтер', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 2, 8, 'Настройки финоргана\Должности и подписи\Главный бухгалтер', '', 0, 0, 9916) ;

CALL ImportField(991610014, 'Настройки финоргана\Должности и подписи\Главный бухгалтер\Наименование должности главного бухгалтера', 'НастройкиФиноргана_ДолжностиИПодписи_ГлавныйБухгалтер_НаименованиеДолжностиГлавногоБухгалтера', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 20, 8, 'Настройки финоргана\Должности и подписи\Главный бухгалтер\Наименование должности главного бухгалтера', '', 0, 0, 9916) ;

CALL ImportField(991610015, 'Настройки финоргана\Должности и подписи\Начальник отдела операционно-кассового обслуживания', 'НастройкиФиноргана_ДолжностиИПодписи_НачальникОтделаОперационноКассовогоОбслуживания', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 10, 8, 'Настройки финоргана\Должности и подписи\Начальник отдела операционно-кассового обслуживания', '', 0, 0, 9916) ;

CALL ImportField(991610016, 'Настройки финоргана\Должности и подписи\Начальник отдела операционно-кассового обслуживания\Должность', 'НастройкиФиноргана_ДолжностиИПодписи_НачальникОтделаОперационноКассовогоОбслуживания_Должность', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 9, 8, 'Настройки финоргана\Должности и подписи\Начальник отдела операционно-кассового обслуживания\Должность', '', 0, 0, 9916) ;

CALL ImportField(991610017, 'Настройки финоргана\Должности и подписи\Подпись исполнителя', 'НастройкиФиноргана_ДолжностиИПодписи_ПодписьИсполнителя', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 6, 8, 'Настройки финоргана\Должности и подписи\Подпись исполнителя', '', 0, 0, 9916) ;

CALL ImportField(991610018, 'Настройки финоргана\Должности и подписи\Руководитель планово-финансовой службы', 'НастройкиФиноргана_ДолжностиИПодписи_РуководительПлановоФинансовойСлужбы', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 23, 8, 'Настройки финоргана\Должности и подписи\Руководитель планово-финансовой службы', '', 0, 0, 9916) ;

CALL ImportField(991610019, 'Настройки финоргана\Должности и подписи\Руководитель планово-финансовой службы\Должность', 'НастройкиФиноргана_ДолжностиИПодписи_РуководительПлановоФинансовойСлужбы_Должность', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 24, 8, 'Настройки финоргана\Должности и подписи\Руководитель планово-финансовой службы\Должность', '', 0, 0, 9916) ;

CALL ImportField(991610020, 'Настройки финоргана\Должности и подписи\Руководитель финансового органа', 'НастройкиФиноргана_ДолжностиИПодписи_РуководительФинансовогоОргана', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 1, 8, 'Настройки финоргана\Должности и подписи\Руководитель финансового органа', '', 0, 0, 9916) ;

CALL ImportField(991610021, 'Настройки финоргана\Должности и подписи\Руководитель финансового органа\Должность', 'НастройкиФиноргана_ДолжностиИПодписи_РуководительФинансовогоОргана_Должность', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 8, 8, 'Настройки финоргана\Должности и подписи\Руководитель финансового органа\Должность', '', 0, 0, 9916) ;

CALL ImportField(991610022, 'Настройки финоргана\Должности и подписи\Управляющий казначейства', 'НастройкиФиноргана_ДолжностиИПодписи_УправляющийКазначейства', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 3, 8, 'Настройки финоргана\Должности и подписи\Управляющий казначейства', '', 0, 0, 9916) ;

CALL ImportField(991610023, 'Настройки финоргана\Название финансового органа', 'НастройкиФиноргана_НазваниеФинансовогоОргана', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 4, 8, 'Настройки финоргана\Название финансового органа', '', 0, 0, 9916) ;

CALL ImportField(991610024, 'Настройки финоргана\Наименование бюджета', 'НастройкиФиноргана_НаименованиеБюджета', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 21, 8, 'Настройки финоргана\Наименование бюджета', 'Задайте наименование бюджета в константах системы', 0, 0, 9916) ;

CALL ImportField(991610025, 'Настройки финоргана\Наименование бюджета\Город финоргана', 'НастройкиФиноргана_НаименованиеБюджета_ГородФиноргана', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 7, 8, 'Настройки финоргана\Наименование бюджета\Город финоргана', '', 0, 0, 9916) ;

CALL ImportField(991610026, 'Настройки финоргана\Наименование бюджета\ИНН финансового органа', 'НастройкиФиноргана_НаименованиеБюджета_ИННФинансовогоОргана', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 0, 5, 'Настройки финоргана\Наименование бюджета\ИНН финансового органа', '', null, 0, 9916) ;

CALL ImportField(991610027, 'Настройки финоргана\Наименование бюджета\Код региона', 'НастройкиФиноргана_НаименованиеБюджета_КодРегиона', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 27, 3, 'Настройки финоргана\Наименование бюджета\Код региона', '', 0, 0, 9916) ;

CALL ImportField(991610028, 'Настройки финоргана\Наименование бюджета\Региональный код', 'НастройкиФиноргана_НаименованиеБюджета_РегиональныйКод', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(34, 1, 3, 'Настройки финоргана\Наименование бюджета\Региональный код', '', 0, 0, 9916) ;

CALL ImportField(991610032, 'Отчеты\Использовать данные аудита', 'Отчеты_ИспользоватьДанныеАудита', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 7, 3, 'Отчеты\Использовать данные аудита', '', 0, 0, 9916) ;

CALL ImportField(991610037, 'Первичные документы\Бюджетные обязательства\Контролируемая классификация', 'ПервичныеДокументы_БюджетныеОбязательства_КонтролируемаяКлассификация', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 1601, 8, 'Первичные документы\Бюджетные обязательства\Контролируемая классификация', '', 0, 0, 9916) ;

CALL ImportField(991610038, 'Первичные документы\Бюджетные обязательства\Контроль иерархии лицевых счетов', 'ПервичныеДокументы_БюджетныеОбязательства_КонтрольИерархииЛицевыхСчетов', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 4, 3, 'Первичные документы\Бюджетные обязательства\Контроль иерархии лицевых счетов', '', 0, 0, 9916) ;

CALL ImportField(991610039, 'Первичные документы\Внебюджетные фонды\Тип средств для внебюджетных фондов', 'ПервичныеДокументы_ВнебюджетныеФонды_ТипСредствДляВнебюджетныхФондов', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 21, 3, 'Первичные документы\Внебюджетные фонды\Тип средств для внебюджетных фондов', '', 0, 0, 9916) ;

CALL ImportField(991610041, 'Первичные документы\Доходы\Код невыясненных доходов по бюджетным средствам с:', 'ПервичныеДокументы_Доходы_КодНевыясненныхДоходовС:', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(3, 0, 8, 'Первичные документы\Доходы\Код невыясненных доходов по бюджетным средствам с:', '___11701____________', 0, 0, 9916) ;

CALL ImportField(991610054, 'Первичные документы\Казначейство\Вид учета обязательств', 'ПервичныеДокументы_Казначейство_ВидУчетаОбязательств', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(30, 15, 3, 'Первичные документы\Казначейство\Вид учета обязательств', '', 0, 0, 9916) ;

CALL ImportField(991610055, 'Первичные документы\Казначейство\Контролируемая классификация\Расход по п\п (казенные учреждения)', 'ПервичныеДокументы_Казначейство_КонтролируемаяКлассификация_РасходПоППБюджетнаяДеятельность', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 63, 8, 'Первичные документы\Казначейство\Контролируемая классификация\Расход по п\п (казенные учреждения)', '', 0, 0, 9916) ;

CALL ImportField(991610056, 'Первичные документы\Казначейство\Контролируемая классификация\Расход по п\п (БУ/АУ)', 'ПервичныеДокументы_Казначейство_КонтролируемаяКлассификация_РасходПоПППредпринимательскаяДеятельность', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(34, 63, 8, 'Первичные документы\Казначейство\Контролируемая классификация\Расход по п\п (БУ/АУ)', '', 0, 0, 9916) ;

CALL ImportField(991610057, 'Первичные документы\Казначейство\Основной счет казначейства', 'ПервичныеДокументы_Казначейство_ОсновнойРасчетныйСчетКазначейства', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(30, 1, 3, 'Первичные документы\Казначейство\Основной счет казначейства', '', 0, 0, 9916) ;

CALL ImportField(991610058, 'Первичные документы\Объемы финансирования(Limits.ocx устарело)\Контролируемая классификация\Уведомления по ОФ', 'ПервичныеДокументы_ОбъемыФинансированияLimitsOcx_КонтролируемаяКлассификация_УведомленияПоОФ', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 57, 8, 'Первичные документы\Объемы финансирования(Limits.ocx устарело)\Контролируемая классификация\Уведомления по ОФ', '', 0, 0, 9916) ;

CALL ImportField(991610065, 'Первичные документы\Планирование расходов, доходов, источников\Детализация показателей СБР по ГРБС\Детализация в части КОСГУ', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ДетализацияЭКПриРаспределенииПоПодведомственным_БюджетнаяРосписьГРБС', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 25, 3, 'Первичные документы\Планирование расходов, доходов, источников\Детализация показателей СБР по ГРБС\Детализация в части КОСГУ', '', 0, 0, 9916) ;

CALL ImportField(991610066, 'Первичные документы\Планирование расходов, доходов, источников\Единицы измерения сумм росписи и кассового плана\Доходы', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ЕдиницыИзмеренияСуммРосписиИКассовогоПлана_Доходы', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 11, 3, 'Первичные документы\Планирование расходов, доходов, источников\Единицы измерения сумм росписи и кассового плана\Доходы', '', 0, 0, 9916) ;

CALL ImportField(991610067, 'Первичные документы\Планирование расходов, доходов, источников\Единицы измерения сумм росписи и кассового плана\Источники финансирования', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ЕдиницыИзмеренияСуммРосписиИКассовогоПлана_ИсточникиФинансирования', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 12, 3, 'Первичные документы\Планирование расходов, доходов, источников\Единицы измерения сумм росписи и кассового плана\Источники финансирования', '', 0, 0, 9916) ;

CALL ImportField(991610068, 'Первичные документы\Планирование расходов, доходов, источников\Единицы измерения сумм росписи и кассового плана\Расходы', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ЕдиницыИзмеренияСуммРосписиИКассовогоПлана_Расходы', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 10, 3, 'Первичные документы\Планирование расходов, доходов, источников\Единицы измерения сумм росписи и кассового плана\Расходы', '', 0, 0, 9916) ;

CALL ImportField(991610070, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Источники\Кассовый план', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Источники_КассовыйПлан', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 265, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Источники\Кассовый план', '', 0, 0, 9916) ;

CALL ImportField(991610071, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Источники\ПОФ по АИФ', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Источники_ПОФПоАИФ', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 271, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Источники\ПОФ по АИФ', '', 0, 0, 9916) ;

CALL ImportField(991610074, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Бюджет', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Расходы_Бюджет', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 263, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Бюджет', '', 0, 0, 9916) ;

CALL ImportField(991610075, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Кассовый план', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Расходы_КассовыйПлан', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 261, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Кассовый план', '', 0, 0, 9916) ;

CALL ImportField(991610079, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Субсидии БУ, АУ', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Расходы_СметаПоПД', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 262, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Субсидии БУ, АУ', '', 0, 0, 9916) ;

CALL ImportField(991610080, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\БР ГРБС(ГАИФ), ПОФ по ПБС(АИФ)\Источники финансирования', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_БРГРБСГАИФКассовыйПланПоПБСАИФ_ИсточникиФинансирования', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 35, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\БР ГРБС(ГАИФ), ПОФ по ПБС(АИФ)\Источники финансирования', '', 0, 0, 9916) ;

CALL ImportField(991610081, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\БР ГРБС(ГАИФ), ПОФ по ПБС(АИФ)\Расходы', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_БРГРБСГАИФКассовыйПланПоПБСАИФ_Расходы', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 31, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\БР ГРБС(ГАИФ), ПОФ по ПБС(АИФ)\Расходы', '', 0, 0, 9916) ;

CALL ImportField(991610082, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Бюджет', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_Бюджет', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 33, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Бюджет', '', 0, 0, 9916) ;

CALL ImportField(991610083, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\СБР, кассовый план\Источники финансирования', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_СБРКассовыйПлан_ИсточникиФинансирования', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 34, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\СБР, кассовый план\Источники финансирования', '', 0, 0, 9916) ;

CALL ImportField(991610084, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\СБР, кассовый план\Расходы', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_СБРКассовыйПлан_Расходы', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 30, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\СБР, кассовый план\Расходы', '', 0, 0, 9916) ;

CALL ImportField(991610085, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Субсидии БУ, АУ', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_СметаПоПредпринимательскойДеятельности', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 32, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Субсидии БУ, АУ', '', 0, 0, 9916) ;

CALL ImportField(991610086, 'Первичные документы\Планирование расходов, доходов, источников\Основной вариант росписи', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ОсновнойВариантРосписи', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(18, 1, 3, 'Первичные документы\Планирование расходов, доходов, источников\Основной вариант росписи', '', 0, 0, 9916) ;

CALL ImportField(991610087, 'Первичные документы\Планирование расходов, доходов, источников\Период планирования ассигнований, лимитов и обязательств', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ПериодПланированияАссигнованийЛимитовИОбязательств', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 19, 3, 'Первичные документы\Планирование расходов, доходов, источников\Период планирования ассигнований, лимитов и обязательств', '', 0, 0, 9916) ;

CALL ImportField(991610088, 'Первичные документы\Планирование расходов, доходов, источников\Поддержка совместимости\СБР, КП (расходы, источники)', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ПоддержкаСовместимостиСВедениемПлановыхПоказателейВ2007Г_СБРКПРасходыИсточники', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 27, 3, 'Первичные документы\Планирование расходов, доходов, источников\Поддержка совместимости\СБР, КП (расходы, источники)', '', 0, 0, 9916) ;

CALL ImportField(991610089, 'Первичные документы\Планирование расходов, доходов, источников\Уведомления по варианту росписи', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_УведомленияПоВариантуРосписи', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 1, 3, 'Первичные документы\Планирование расходов, доходов, источников\Уведомления по варианту росписи', '', 0, 0, 9916) ;

CALL ImportField(991610090, 'Первичные документы\Платежные поручения\Вид платежа', 'ПервичныеДокументы_ПлатежныеПоручения_ВидПлатежа', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(11, 1, 3, 'Первичные документы\Платежные поручения\Вид платежа', '', 0, 0, 9916) ;

CALL ImportField(991610091, 'Первичные документы\Платежные поручения\Максимальная разрешенная очередность платежа', 'ПервичныеДокументы_ПлатежныеПоручения_ОчередностьПлатежа', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(11, 2, 3, 'Первичные документы\Платежные поручения\Максимальная разрешенная очередность платежа', '', 0, 5, 9916) ;

CALL ImportField(991610092, 'Первичные документы\Работа с валютой\Код дохода', 'ПервичныеДокументы_РаботаСВалютой_КодДохода', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(19, 2, 8, 'Первичные документы\Работа с валютой\Код дохода', '', 0, 0, 9916) ;

CALL ImportField(991610093, 'Первичные документы\Работа с валютой\Код национальной валюты', 'ПервичныеДокументы_РаботаСВалютой_КодНациональнойВалюты', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(19, 4, 3, 'Первичные документы\Работа с валютой\Код национальной валюты', '', 0, 0, 9916) ;

CALL ImportField(991610094, 'Первичные документы\Работа с валютой\Признак дохода', 'ПервичныеДокументы_РаботаСВалютой_ПризнакДохода', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(19, 3, 3, 'Первичные документы\Работа с валютой\Признак дохода', '', 0, 0, 9916) ;

CALL ImportField(991610095, 'Первичные документы\Работа с валютой\Тип документа', 'ПервичныеДокументы_РаботаСВалютой_ТипДокумента', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(19, 1, 3, 'Первичные документы\Работа с валютой\Тип документа', '', 0, 0, 9916) ;

CALL ImportField(991610096, 'Первичные документы\Уведомления об уточнении\Тип документа для отправки уведомлений в ФК', 'ПервичныеДокументы_УведомленияОбУточнении_ТипДокументаДляОтправкиУведомленийВФК', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(1, 55, 3, 'Первичные документы\Уведомления об уточнении\Тип документа для отправки уведомлений в ФК', '', 0, 0, 9916) ;

CALL ImportField(991610098, 'Последняя дата, закрытая для редактирования:', 'ПоследняяДатаРедактирования:', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(3, 2, 3, 'Последняя дата, закрытая для редактирования:', '', 0, 0, 9916) ;

CALL ImportField(991610099, 'Системные настройки\Адрес информационного сервера', 'СистемныеНастройки_АдресИнформационногоСервера', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 26, 8, 'Системные настройки\Адрес информационного сервера', '', 0, 0, 9916) ;

CALL ImportField(991610101, 'Системные настройки\Настройки прав\Использовать видимость документов по правам', 'СистемныеНастройки_ИспользоватьВидимостьДокументовНаИнтерфейсахПоПравам', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 24, 3, 'Системные настройки\Настройки прав\Использовать видимость документов по правам', '', 0, 0, 9916) ;

CALL ImportField(991610102, 'Системные настройки\Кэшировать константы', 'СистемныеНастройки_КэшироватьКонстанты', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 61, 3, 'Системные настройки\Кэшировать константы', '', 0, 0, 9916) ;

CALL ImportField(991610103, 'Системные настройки\Многобюджетность на УРМ', 'СистемныеНастройки_МногобюджетностьНаУРМ', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(1000, 47, 3, 'Системные настройки\Многобюджетность на УРМ', '', 0, 0, 9916) ;

CALL ImportField(991610104, 'Системные настройки\Подтверждение на отмену изменений', 'СистемныеНастройки_ПодтверждениеНаОтменуИзменений', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 6, 3, 'Системные настройки\Подтверждение на отмену изменений', '', 0, 0, 9916) ;

CALL ImportField(991610105, 'Системные настройки\Подтягивание Т/Ф по', 'СистемныеНастройки_ПодтягиваниеТФПо', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 5, 3, 'Системные настройки\Подтягивание Т/Ф по', '', 0, 0, 9916) ;

CALL ImportField(991610106, 'Системные настройки\Показывать Л/С УФК', 'СистемныеНастройки_ПоказыватьЛСУФК', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 8, 3, 'Системные настройки\Показывать Л/С УФК', '', 0, 0, 9916) ;

CALL ImportField(991610107, 'Системные настройки\Настройки прав\Права на лицевые счета', 'СистемныеНастройки_ПраваНаЛицевыеСчета', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 30, 3, 'Системные настройки\Настройки прав\Права на лицевые счета', '', 0, 0, 9916) ;

CALL ImportField(991610108, 'Системные настройки\Сетевой путь до справки', 'СистемныеНастройки_СетевойПутьДоСправки', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 0, 8, 'Системные настройки\Сетевой путь до справки', '', 0, 0, 9916) ;

CALL ImportField(991610111, 'Системные настройки\Удаленный реестр\Пароль', 'СистемныеНастройки_УдаленныйРеестр_Пароль', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 15, 8, 'Системные настройки\Удаленный реестр\Пароль', '', 0, 0, 9916) ;

CALL ImportField(991610112, 'Системные настройки\Удаленный реестр\Пользователь', 'СистемныеНастройки_УдаленныйРеестр_Пользователь', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 14, 8, 'Системные настройки\Удаленный реестр\Пользователь', '', 0, 0, 9916) ;

CALL ImportField(991610113, 'Системные настройки\Удаленный реестр\Путь к базе', 'СистемныеНастройки_УдаленныйРеестр_ПутьКБазе', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 13, 8, 'Системные настройки\Удаленный реестр\Путь к базе', '', 0, 0, 9916) ;

CALL ImportField(991610114, 'Системные настройки\ЭЦП\Внедрение ЭЦП', 'СистемныеНастройки_ЭЦП_ВнедрениеЭЦП', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(40, 1, 3, 'Системные настройки\ЭЦП\Внедрение ЭЦП', '', 0, 0, 9916) ;

CALL ImportField(991610115, 'Справочники\Бюджетная классификация\Добавлять в справочник доходов и источников код с новым администратором без предупреждения', 'Справочники_БюджетнаяКлассификация_ДобавлятьВСправочникДоходовИИсточниковКодСНовымАдминистраторомБезПредупреждения', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 50, 3, 'Справочники\Бюджетная классификация\Добавлять в справочник доходов и источников код с новым администратором без предупреждения', '', 0, 0, 9916) ;

CALL ImportField(991610116, 'Справочники\Бюджетная классификация\Значение элемента для источников финансирования по умолчанию', 'Справочники_БюджетнаяКлассификация_ЗначениеЭлементаДляИсточниковФинансированияПоУмолчанию', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 5, 8, 'Справочники\Бюджетная классификация\Значение элемента для источников финансирования по умолчанию', '', 0, 0, 9916) ;

CALL ImportField(991610117, 'Справочники\Бюджетная классификация\Значение элемента для справочника КД по умолчанию', 'Справочники_БюджетнаяКлассификация_ЗначениеЭлементаДляСправочникаКДПоУмолчанию', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 4, 8, 'Справочники\Бюджетная классификация\Значение элемента для справочника КД по умолчанию', '', 0, 0, 9916) ;

CALL ImportField(991610118, 'Справочники\Бюджетная классификация\Режим фильтрации дерева БК по Л/С и организациям', 'Справочники_БюджетнаяКлассификация_РежимФильтрацииДереваБКПоЛСИОрганизациям', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 3, 3, 'Справочники\Бюджетная классификация\Режим фильтрации дерева БК по Л/С и организациям', '', 0, 0, 9916) ;

CALL ImportField(991610119, 'Справочники\Справочник банков, организаций и счетов\Длина поля "наименование организации"', 'Справочники_СправочникБанковОрганизацийИСчетов_ДлинаПоляНаименованиеОрганизации', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 20, 3, 'Справочники\Справочник банков, организаций и счетов\Длина поля "наименование организации"', '', 0, 0, 9916) ;

CALL ImportField(991610120, 'Справочники\Справочник банков, организаций и счетов\Контроль ввода расчетных счетов организаций', 'Справочники_СправочникБанковОрганизацийИСчетов_КонтрольВводаРасчетныхСчетовОрганизаций', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 10, 3, 'Справочники\Справочник банков, организаций и счетов\Контроль ввода расчетных счетов организаций', '', 0, 0, 9916) ;

CALL ImportField(991610121, 'Справочники\Справочник банков, организаций и счетов\Контроль уникальности БИК и Корр.счёт в справочнике банков', 'Справочники_СправочникБанковОрганизацийИСчетов_КонтрольУникальностиБИКИКоррСчётВСправочникеБанков', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 11, 3, 'Справочники\Справочник банков, организаций и счетов\Контроль уникальности БИК и Корр.счёт в справочнике банков', '', 0, 0, 9916) ;

CALL ImportField(991610123, 'Справочники\Справочник банков, организаций и счетов\Оптимизация\Минимум сохраняемых изменений', 'Справочники_СправочникБанковОрганизацийИСчетов_Оптимизация_МинимумСохраняемыхИзменений', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(0, 0, 8, 'Справочники\Справочник банков, организаций и счетов\Оптимизация\Минимум сохраняемых изменений', '', 0, 0, 9916) ;

CALL ImportField(991610124, 'Справочники\Справочник банков, организаций и счетов\Оптимизация\Не сохранять ручные обновления', 'Справочники_СправочникБанковОрганизацийИСчетов_Оптимизация_НеСохранятьРучныеОбновления', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(0, 0, 8, 'Справочники\Справочник банков, организаций и счетов\Оптимизация\Не сохранять ручные обновления', '', 0, 0, 9916) ;

CALL ImportField(991610125, 'Справочники\Справочник банков, организаций и счетов\Оптимизация\Обновление справочника при открытии', 'Справочники_СправочникБанковОрганизацийИСчетов_Оптимизация_ОбновлениеСправочникаПриОткрытии', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(0, 0, 8, 'Справочники\Справочник банков, организаций и счетов\Оптимизация\Обновление справочника при открытии', '', 0, 0, 9916) ;

CALL ImportField(991610126, 'Справочники\Справочник банков, организаций и счетов\Отображать организации УРМ в модальном справочнике организаций', 'Справочники_СправочникБанковОрганизацийИСчетов_ОтображатьОрганизацииУРМВМодальномСправочникеОрганизаций', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(2, 1, 3, 'Справочники\Справочник банков, организаций и счетов\Отображать организации УРМ в модальном справочнике организаций', '', 0, 0, 9916) ;

CALL ImportField(991610127, 'Справочники\Справочник банков, организаций и счетов\Поле "сокращенное наименование организации"\Длина поля', 'Справочники_СправочникБанковОрганизацийИСчетов_ПолеСокращенноеНаименованиеОрганизации_ДлинаПоля', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 22, 3, 'Справочники\Справочник банков, организаций и счетов\Поле "сокращенное наименование организации"\Длина поля', '', 0, 0, 9916) ;

CALL ImportField(991610128, 'Справочники\Справочник банков, организаций и счетов\Поле "сокращенное наименование организации"\Обязательно к заполнению', 'Справочники_СправочникБанковОрганизацийИСчетов_ПолеСокращенноеНаименованиеОрганизации_ОбязательноКЗаполнению', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 23, 3, 'Справочники\Справочник банков, организаций и счетов\Поле "сокращенное наименование организации"\Обязательно к заполнению', '', 0, 0, 9916) ;

CALL ImportField(991610129, 'Справочники\Справочник банков, организаций и счетов\Процент допустимых различий наименования при поиске дублированных организаций', 'Справочники_СправочникБанковОрганизацийИСчетов_ПроцентДопустимыхРазличийНаименованияПриПоискеДублированныхОрганизаций', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 60, 3, 'Справочники\Справочник банков, организаций и счетов\Процент допустимых различий наименования при поиске дублированных организаций', '', 0, 0, 9916) ;

CALL ImportField(991610130, 'Справочники\Справочник банков, организаций и счетов\Уникальность ИНН-КПП', 'Справочники_СправочникБанковОрганизацийИСчетов_УникальностьИННКПП', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 15, 3, 'Справочники\Справочник банков, организаций и счетов\Уникальность ИНН-КПП', '', 0, 0, 9916) ;

CALL ImportField(991610131, 'Первичные документы\Планирование расходов, доходов, источников\Ввод данных по самостоятельным л/с в БР (ПОФ по ПБС) при одновременном ведении СБР и БР (КП и ПОФ по ПБС)', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ВводБРпоСамостоятельнымЛС', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 39, 3, 'Первичные документы\Планирование расходов, доходов, источников\Ввод данных по самостоятельным л/с в БР (ПОФ по ПБС) при одновременном ведении СБР и БР (КП и ПОФ по ПБС)', '', 0, 0, 9916) ;

CALL ImportField(991610132, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка поквартального/помесячного ведения кассового плана\Автозаполнение месячных и квартальных сумм при совмещенном ведении', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_ВводКассовогоПланаПоМесяцам_АвтозаполнениеМесячныхИКвартальныхСумм', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 17, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка поквартального/помесячного ведения кассового плана\Автозаполнение месячных и квартальных сумм при совмещенном ведении', '', 0, 0, 9916) ;

CALL ImportField(991610133, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка поквартального/помесячного ведения кассового плана\Расходы, доходы, источники', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_ВводКассовогоПланаПоМесяцам_РасходыДоходыИсточники', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 13, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка поквартального/помесячного ведения кассового плана\Расходы, доходы, источники', '', 0, 0, 9916) ;

CALL ImportField(991610134, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка поквартального/помесячного ведения ПОФ\Автозаполнение месячных и квартальных сумм при совмещенном ведении', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_ВводКассовогоПланаПоПБСПоМесяцам_АвтозаполнениеМесячныхИКвартальныхСумм_ПриСовмещВедении', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 2, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка поквартального/помесячного ведения ПОФ\Автозаполнение месячных и квартальных сумм при совмещенном ведении', '', 0, 0, 9916) ;

CALL ImportField(991610135, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка поквартального/помесячного ведения ПОФ\Расходы, источники', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_ВводКассовогоПланаПоПБСПоМесяцам_РасходыИсточники', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 3, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка поквартального/помесячного ведения ПОФ\Расходы, источники', '', 0, 0, 9916) ;

CALL ImportField(991610136, 'Первичные документы\Планирование расходов, доходов, источников\Период планирования  КП', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ПериодПланированияКПиПОФ', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 38, 3, 'Первичные документы\Планирование расходов, доходов, источников\Период планирования  КП', '', 0, 0, 9916) ;

CALL ImportField(991610137, 'Системные настройки\Вариант открытия операционных дней', 'СистемныеНастройки_ВариантОткрытияОперационныхДней', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(3, 10, 3, 'Системные настройки\Вариант открытия операционных дней', '', 0, 0, 9916) ;

CALL ImportField(991610138, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Помесячный кассовый план', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Расходы_КассовыйПланПомесячно', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 272, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Помесячный кассовый план', '', 0, 0, 9916) ;

CALL ImportField(991610139, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Помесячный ПОФ по ПБС', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Расходы_ПОФПоПБСПомесячно', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 273, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Помесячный ПОФ по ПБС', '', 0, 0, 9916) ;

CALL ImportField(991610140, 'Настройки бухгалтерии\Санкционирование расходов бухгалтерии\Вариант для ввода очередного трехлетнего периода', 'НастройкиБухгалтерии_СанкционированиеРасходовБухгалтерии_ВариантДляВводаОчередногоТрехлетнегоПериода', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 25, 3, 'Настройки бухгалтерии\Санкционирование расходов бухгалтерии\Вариант для ввода очередного трехлетнего периода', '', 0, -1, 9916) ;

CALL ImportField(991610141, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Источники\Роспись по АИФ', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Источники_БюджетнаяРоспись', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 215, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Источники\Роспись по АИФ', '', 0, 0, 9916) ;

CALL ImportField(991610142, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Источники\СБР', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Источники_СБР', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 264, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Источники\СБР', '', 0, 0, 9916) ;

CALL ImportField(991610143, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Роспись по ПБС (БА по ПБС)', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Расходы_БюджетнаяРосписьАссигнования', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(34, 32, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Роспись по ПБС (БА по ПБС)', '', 0, 0, 9916) ;

CALL ImportField(991610144, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\СБР (ЛБО по ГРБС)', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Расходы_ЛБОпоГРБС', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 260, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\СБР (ЛБО по ГРБС)', '', 0, 0, 9916) ;

CALL ImportField(991610145, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Роспись по ПБС (ЛБО по ПБС)', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Расходы_ЛБОпоПБС', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 32, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Роспись по ПБС (ЛБО по ПБС)', '', 0, 0, 9916) ;

CALL ImportField(991610146, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\СБР (БА по ГРБС)', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Расходы_СБРАссигнования', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(34, 260, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\СБР (БА по ГРБС)', '', 0, 0, 9916) ;

CALL ImportField(991610148, 'Первичные документы\Расходные расписания\Не использовать Утверждение ОФ и Разассигновку для учета ПОФ в РР', 'ПервичныеДокументы_РасходныеРасписания_НеИспользоватьУтверждениеОФиРазасигновкуДляВводаПОФРР', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(44, 4, 3, 'Первичные документы\Расходные расписания\Не использовать Утверждение ОФ и Разассигновку для учета ПОФ в РР', '', 0, 0, 9916) ;

CALL ImportField(991610149, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\ПОФ по ПБС', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_Расходы_ПОФПоПБС', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 268, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\ПОФ по ПБС', '', 0, 0, 9916) ;

CALL ImportField(991610150, 'Первичные документы\Расходные расписания\БА по расходам не доводятся', 'ПервичныеДокументы_РасходныеРасписания_БАнедоводятся', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(44, 1, 3, 'Первичные документы\Расходные расписания\БА по расходам не доводятся', '', 0, 0, 9916) ;

CALL ImportField(991610151, 'Первичные документы\Расходные расписания\ЛБО не доводятся', 'ПервичныеДокументы_РасходныеРасписания_ЛБОнедоводятся', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(44, 2, 3, 'Первичные документы\Расходные расписания\ЛБО не доводятся', '', 0, 0, 9916) ;

CALL ImportField(991610152, 'Первичные документы\Расходные расписания\ПОФ не доводятся', 'ПервичныеДокументы_РасходныеРасписания_ПОФнедоводятся', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(44, 3, 3, 'Первичные документы\Расходные расписания\ПОФ не доводятся', '', 0, 0, 9916) ;

CALL ImportField(991610153, 'Первичные документы\Доходы\Код невыясненных доходов по внебюджетным средствам с:', 'ПервичныеДокументы_Доходы_КодНевыясненныхДоходовПоВнеБюджетнымСредствамС:', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(3, 11, 8, 'Первичные документы\Доходы\Код невыясненных доходов по внебюджетным средствам с:', '___30398____________', 0, 0, 9916) ;

CALL ImportField(991610155, 'Параметры прикрепляемых файлов\Режим прикрепления изображений', 'ПараметрыПрикрепляемыхФайлов_ЗапретитьПрикреплениеКартинокСДиска', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 71, 3, 'Параметры прикрепляемых файлов\Режим прикрепления изображений', '', 0, 0, 9916) ;

CALL ImportField(991610156, 'Параметры прикрепляемых файлов\Макс. размер прикрепляемого файла (КБ)', 'ПараметрыПрикрепляемыхФайлов_МаксимальныйРазмерПрикрепляемогоФайла', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 72, 3, 'Параметры прикрепляемых файлов\Макс. размер прикрепляемого файла (КБ)', '', 0, 0, 9916) ;

CALL ImportField(991610157, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Подневный ПОФ по ПБС', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_ПОФПоПБСПодневно', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 274, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Подневный ПОФ по ПБС', '', 0, 0, 9916) ;

CALL ImportField(991610158, 'Первичные документы\Уведомления об уточнении\Тип документа для внутренних уведомлений', 'ПервичныеДокументы_УведомленияОбУточнении_ТипДокументаДляВнутреннихУведомлений', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(1, 56, 3, 'Первичные документы\Уведомления об уточнении\Тип документа для внутренних уведомлений', '', 0, 0, 9916) ;

CALL ImportField(991610159, 'Системные настройки\Криптографическая схема\Путь к базе', 'СистемныеНастройки_КриптоСхема_ПутьКБазе', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 28, 8, 'Системные настройки\Криптографическая схема\Путь к базе', '', 0, 0, 9916) ;

CALL ImportField(991610160, 'Системные настройки\Криптографическая схема\Пользователь', 'СистемныеНастройки_КриптоСхема_Пользователь', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 29, 8, 'Системные настройки\Криптографическая схема\Пользователь', '', 0, 0, 9916) ;

CALL ImportField(991610161, 'Системные настройки\Криптографическая схема\Пароль', 'СистемныеНастройки_КриптоСхема_Пароль', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 30, 8, 'Системные настройки\Криптографическая схема\Пароль', '', 0, 0, 9916) ;

CALL ImportField(991610162, 'Настройки финоргана\Текущий финансовый год', 'НастройкиФиноргана_ТекущийФинансовыйГод', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 73, 3, 'Настройки финоргана\Текущий финансовый год', '', 0, 0, 9916) ;

CALL ImportField(991610163, 'Первичные документы\Планирование расходов, доходов, источников\Период планирования ПОФ', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ПериодПланированияПОФ', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 36, 3, 'Первичные документы\Планирование расходов, доходов, источников\Период планирования ПОФ', '', 0, 0, 9916) ;

CALL ImportField(991610164, 'Параметры прикрепляемых файлов\Качество изображения после сжатия', 'ПараметрыПрикрепляемыхФайлов_КачествоПреобразованияКартинки', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 74, 3, 'Параметры прикрепляемых файлов\Качество изображения после сжатия', '', 0, 0, 9916) ;

CALL ImportField(991610165, 'Системные настройки\Получение кода цели', 'СистемныеНастройки_ПолучениеКодаЦели', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 41, 3, 'Системные настройки\Получение кода цели', '', 0, 0, 9916) ;

CALL ImportField(991610166, 'Первичные документы\Бюджетные обязательства\Использовать номер БО в заголовке', 'ПервичныеДокументы_БюджетныеОбязательства_ИспользоватьНомерБОвЗаголовке', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(30, 37, 3, 'Первичные документы\Бюджетные обязательства\Использовать номер БО в заголовке', '', 0, 0, 9916) ;

CALL ImportField(991610167, 'Первичные документы\Расходные расписания\БА по источникам не доводятся', 'ПервичныеДокументы_РасходныеРасписания_БАпоИстНедоводятся', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(44, 5, 3, 'Первичные документы\Расходные расписания\БА по источникам не доводятся', '', 0, 0, 9916) ;

CALL ImportField(991610168, 'Настройки бухгалтерии\Формировать проводки ПОФ по расходным расписаниям', 'НастройкиБухгалтерии_ФормироватьПроводкиПОФРР', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 31, 3, 'Настройки бухгалтерии\Формировать проводки ПОФ по расходным расписаниям', '', 0, 0, 9916) ;

CALL ImportField(991610169, 'Справочники\Справочник банков, организаций и счетов\Формат номера р/счета, сопоставленного с л/с', 'Справочники_СправочникБанковОрганизацийИСчетов_ФорматНомераРС', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 75, 3, 'Справочники\Справочник банков, организаций и счетов\Формат номера р/счета, сопоставленного с л/с', '', 0, 0, 9916) ;

CALL ImportField(991610170, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка периодичности ведения субсидий БУ,АУ', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_НастрокаВеденияСметПД', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 43, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка периодичности ведения субсидий БУ,АУ', '', 0, 0, 9916) ;

CALL ImportField(991610171, 'Системные настройки\Показывать номер лицевого счета', 'СистемныеНастройки_ПоказыватьНомерЛицевогоСчета', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 42, 3, 'Системные настройки\Показывать номер лицевого счета', '', 0, 0, 9916) ;

CALL ImportField(991610172, 'Параметры прикрепляемых файлов\Макс. суммарный размер файлов, прикрепляемых к одному документу (КБ)', 'ПараметрыПрикрепляемыхФайлов_МаксимальныйРазмерВсехПрикрепленныхФайлов', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 76, 3, 'Параметры прикрепляемых файлов\Макс. суммарный размер файлов, прикрепляемых к одному документу (КБ)', '', 0, 0, 9916) ;

CALL ImportField(991610173, 'Системные настройки\ЭЦП\За сколько дней предупреждать об окончании срока действия пользовательского сертификата', 'СистемныеНастройки_ЭЦП_ПредупреждениеОСрокеСертификата', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 80, 3, 'Системные настройки\ЭЦП\За сколько дней предупреждать об окончании срока действия пользовательского сертификата', '', 0, 0, 9916) ;

CALL ImportField(991610174, 'Первичные документы\Казначейство\Сквозной учет поступлений между казначейством и блоком доходов', 'ПервичныеДокументы_Казначейство_СквознойУчетПоступленийМеждуКазначействомИБлокомДоходов', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(30, 31, 3, 'Первичные документы\Казначейство\Сквозной учет поступлений между казначейством и блоком доходов', '', 0, 0, 9916) ;

CALL ImportField(991610175, 'Справочники\Справочник банков, организаций и счетов\Проверять уникальность ИНН-КПП в закрытых организациях', 'Справочники_СправочникБанковОрганизацийИСчетов_УникальностьИННКПП_ПроверятьВЗакрытых', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 44, 3, 'Справочники\Справочник банков, организаций и счетов\Проверять уникальность ИНН-КПП в закрытых организациях', '', 0, 0, 9916) ;

CALL ImportField(991610176, 'Первичные документы\Уведомления об уточнении\Контролируемая классификация\Корректирующая классификация', 'ПервичныеДокументы_УведомленияОбУточнении_КонтролируемаяКлассификация_Корректирующая', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 315, 8, 'Первичные документы\Уведомления об уточнении\Контролируемая классификация\Корректирующая классификация', '', 0, 0, 9916) ;

CALL ImportField(991610177, 'Первичные документы\Уведомления об уточнении\Контролируемая классификация\Новая классификация', 'ПервичныеДокументы_УведомленияОбУточнении_КонтролируемаяКлассификация_Новая', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 316, 8, 'Первичные документы\Уведомления об уточнении\Контролируемая классификация\Новая классификация', '', 0, 0, 9916) ;

CALL ImportField(991610178, 'Параметры прикрепляемых файлов\Чем просматривать', 'ПараметрыПрикрепляемыхФайлов_ВидОткрытия', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 70, 8, 'Параметры прикрепляемых файлов\Чем просматривать', '', 0, 0, 9916) ;

CALL ImportField(991610179, 'Параметры прикрепляемых файлов\Разрешать прикреплять только файлы с расширениями (через запятую)', 'ПараметрыПрикрепляемыхФайлов_ДопустимыеРасширения', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 71, 8, 'Параметры прикрепляемых файлов\Разрешать прикреплять только файлы с расширениями (через запятую)', '', 0, 0, 9916) ;

CALL ImportField(991610180, 'Системные настройки\Путь к реестру УРМ', 'СистемныеНастройки_ПутьКРееструУРМ', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 80, 8, 'Системные настройки\Путь к реестру УРМ', '', 0, 0, 9916) ;

CALL ImportField(991610181, 'Настройки электронного архива\Использовать электронный архив', 'НастройкиЭлектронногоАрхива_ИспользоватьЭлектронныйАрхив', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(527, 1, 3, 'Настройки электронного архива\Использовать электронный архив', '', 0, 0, 9916) ;

CALL ImportField(991610182, 'Справочники\Бюджетная классификация\Разрешить использование букв в классификаторах', 'Справочники_БюджетнаяКлассификация_РазрешитьИспользованиеБуквВКлассификаторах', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 6, 8, 'Справочники\Бюджетная классификация\Разрешить использование букв в классификаторах', '', 0, 0, 9916) ;

CALL ImportField(991610183, 'Настройки электронного архива\Открывать http-ссылки в браузере', 'НастройкиЭлектронногоАрхива_ОткрыватьHTTPСсылкиВБраузере', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(527, 2, 3, 'Настройки электронного архива\Открывать http-ссылки в браузере', '', 0, 0, 9916) ;

CALL ImportField(991610184, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для чтения\Учетная запись', 'НастройкиЭлектронногоАрхива_НастройкиFTPСоединения_НастройкиДляЧтения_УчетнаяЗапись', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(527, 3, 8, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для чтения\Учетная запись', '', 0, 0, 9916) ;

CALL ImportField(991610185, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для чтения\Пароль', 'НастройкиЭлектронногоАрхива_НастройкиFTPСоединения_НастройкиДляЧтения_Пароль', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(527, 4, 8, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для чтения\Пароль', '', 0, 0, 9916) ;

CALL ImportField(991610186, 'Настройки электронного архива\Настройки FTP-соединения\Сервер [:Порт]', 'НастройкиЭлектронногоАрхива_НастройкиFTPСоединения_СерверПорт', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(527, 5, 8, 'Настройки электронного архива\Настройки FTP-соединения\Сервер [:Порт]', '', 0, 0, 9916) ;

CALL ImportField(991610187, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для записи\Учетная запись', 'НастройкиЭлектронногоАрхива_НастройкиFTPСоединения_НастройкиДляЗаписи_УчетнаяЗапись', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(527, 6, 8, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для записи\Учетная запись', '', 0, 0, 9916) ;

CALL ImportField(991610188, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для записи\Пароль', 'НастройкиЭлектронногоАрхива_НастройкиFTPСоединения_НастройкиДляЗаписи_Пароль', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(527, 7, 8, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для записи\Пароль', '', 0, 0, 9916) ;

CALL ImportField(991610189, 'Настройки электронного архива\Настройки FTP-соединения\Кодировка имен файлов', 'НастройкиЭлектронногоАрхива_НастройкиFTPСоединения_КодировкаИменФайлов', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(527, 8, 3, 'Настройки электронного архива\Настройки FTP-соединения\Кодировка имен файлов', '', 0, 0, 9916) ;

CALL ImportField(991610190, 'Настройки электронного архива\Настройки FTP-соединения\FTP-папка документов текущей базы', 'НастройкиЭлектронногоАрхива_НастройкиFTPСоединения_FTPПапка', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(527, 9, 8, 'Настройки электронного архива\Настройки FTP-соединения\FTP-папка документов текущей базы', '', 0, 0, 9916) ;

CALL ImportField(991610191, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для удаления\Учетная запись', 'НастройкиЭлектронногоАрхива_НастройкиFTPСоединения_НастройкиДляУдаления_УчетнаяЗапись', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(527, 10, 8, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для удаления\Учетная запись', '', 0, 0, 9916) ;

CALL ImportField(991610192, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для удаления\Пароль', 'НастройкиЭлектронногоАрхива_НастройкиFTPСоединения_НастройкиДляУдаления_Пароль', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(527, 11, 8, 'Настройки электронного архива\Настройки FTP-соединения\Настройки для удаления\Пароль', '', 0, 0, 9916) ;

CALL ImportField(991610193, 'Настройки для работы с БУ, АУ\КВР, используемые для кодирования средств на финансирование БУ, АУ', 'НастройкиДляРаботыСБУАУ_КВРиспользуемыеДляКодированияСредствНаФинансированиеБУ, АУ', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(30, 45, 8, 'Настройки для работы с БУ, АУ\КВР, используемые для кодирования средств на финансирование БУ, АУ', '400-499,610-629', 0, 0, null) ;

CALL ImportField(991610194, 'Настройки для работы с БУ, АУ\Разрешать использовать отдельные Р/С для обслуживания БУ и АУ (не рекомендуется)', 'НастройкиДляРаботыСБУАУ_РазрешатьОтдельныеРСБУАУ', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(30, 44, 3, 'Настройки для работы с БУ, АУ\Разрешать использовать отдельные Р/С для обслуживания БУ и АУ (не рекомендуется)', '', 0, 0, 9916) ;

CALL ImportField(991610195, 'Настройки финоргана\Наименование бюджета\Единый счет бюджета', 'НастройкиФиноргана_НаименованиеБюджета_ЕдиныйСчетБюджета', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(-1, 2, 3, 'Настройки финоргана\Наименование бюджета\Единый счет бюджета', '', 0, 0, null) ;

CALL ImportField(991610196, 'Справочники\Справочник банков, организаций и счетов\Оптимизация', 'Справочники_СправочникБанковОрганизацийИСчетов_Оптимизация', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(-1, 4, 3, 'Справочники\Справочник банков, организаций и счетов\Оптимизация', '', 0, 0, null) ;

CALL ImportField(991610197, 'Справочники\Бюджетная классификация\Структура бюджетных классификаторов', 'Справочники_БюджетнаяКлассификация_СтруктураБюджетныхКлассификаторов', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(6, 1, 8, 'Справочники\Бюджетная классификация\Структура бюджетных классификаторов', '', 0, 0, null) ;

CALL ImportField(991610199, 'Первичные документы\Планирование расходов, доходов, источников\Поддержка совместимости\Разрешать поквартальную/помесячную разбивку БА при совмещенном ведении СБР и КП, БР и ПОФ', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ПоддержкаСовместимостиСВедениемПлановыхПоказателейВ2007Г_РазрешатьРазбивкуБАПриСовмещенномВеденииСБРиКП', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(32, 40, 3, 'Первичные документы\Планирование расходов, доходов, источников\Поддержка совместимости\Разрешать поквартальную/помесячную разбивку БА при совмещенном ведении СБР и КП, БР и ПОФ', '', 0, 0, null) ;

CALL ImportField(991610200, 'Системные настройки\Использовать блок "Учет разрешений"', 'СистемныеНастройки_ИспользоватьБлокУчетРазрешений', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(51, 1, 3, 'Системные настройки\Использовать блок "Учет разрешений"', '', 0, 0, null) ;

CALL ImportField(991610201, 'Справочники\Бюджетная классификация\Список классификаторов для задания прав', 'Справочники_БюджетнаяКлассификация_СписокКлассификаторовДляЗаданияПрав', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(60, 1, 8, 'Справочники\Бюджетная классификация\Список классификаторов для задания прав', '', 0, 0, null) ;

CALL ImportField(991610202, 'Настройки бухгалтерии\ЭКИ для поступления средств', 'НастройкиБухгалтерии_ЭКИДляПоступленияСредств', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(60, 9, 3, 'Настройки бухгалтерии\ЭКИ для поступления средств', '', 0, 0, null) ;

CALL ImportField(991610203, 'Настройки бухгалтерии\ЭКИ для выбытия средств', 'НастройкиБухгалтерии_ЭКИДляВыбытияСредств', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(60, 10, 3, 'Настройки бухгалтерии\ЭКИ для выбытия средств', '', 0, 0, null) ;

CALL ImportField(991610204, 'Настройки бухгалтерии\Операция по умолчанию', 'НастройкиБухгалтерии_ОперацияПоУмолчанию', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(60, 15, 3, 'Настройки бухгалтерии\Операция по умолчанию', '', 0, 0, null) ;

CALL ImportField(991610205, 'Настройки бухгалтерии\Синтетические счета для фильтрации', 'НастройкиБухгалтерии_СинтетическиеСчетаДляФильтрации', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(60, 18, 8, 'Настройки бухгалтерии\Синтетические счета для фильтрации', '', 0, 0, null) ;

CALL ImportField(991610206, 'Настройки бухгалтерии\Код синтетического счета ФО', 'НастройкиБухгалтерии_КодСинтетическогоСчетаФО', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(60, 20, 3, 'Настройки бухгалтерии\Код синтетического счета ФО', '', 0, 0, null) ;

CALL ImportField(991610207, 'Настройки бухгалтерии\Код синтетического счета казначейства', 'НастройкиБухгалтерии_КодСинтетическогоСчетаКазначейства', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(60, 21, 3, 'Настройки бухгалтерии\Код синтетического счета казначейства', '', 0, 0, null) ;

CALL ImportField(991610208, 'Константы УРМ, требующие инициализации\Длина отката начальной даты (ч)', 'КонстантыУРМТребующиеИнициализации_ДлинаОткатаДачальнойДаты', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(1000, 53, 3, 'Константы УРМ, требующие инициализации\Длина отката начальной даты (ч)', '', 0, 1, null) ;

CALL ImportField(991610209, 'Константы УРМ, требующие инициализации\Скрывать персональные данные физ. лиц', 'КонстантыУРМТребующиеИнициализации_СкрыватьПерсональныеДанныеФизЛиц', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(1000, 109, 3, 'Константы УРМ, требующие инициализации\Скрывать персональные данные физ. лиц', '', 0, 0, null) ;

CALL ImportField(991610210, 'Первичные документы\Казначейство\Разрешенные для нумерации расчетных счетов коды валют', 'ПервичныеДокументы_Казначейство_РазрешенныеДляРСКодыВалют', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(30, 46, 8, 'Первичные документы\Казначейство\Разрешенные для нумерации расчетных счетов коды валют', '810', 0, 0, 9916) ;

CALL ImportField(991610211, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка подневного ПОФ\Обязательность указания лицевого счета в заголовке', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_НастройкаПодневногоПОФ_ОбязательностьУказанияЛицевогоСчетаВЗаголовке', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 46, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка подневного ПОФ\Обязательность указания лицевого счета в заголовке', '', 0, 0, 9916) ;

CALL ImportField(991610212, 'Первичные документы\Планирование расходов, доходов, источников\Детализация показателей СБР по ГРБС\Детализация в части КВР', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ДетализацияПоказателейСБРПоГРБС_ДетализацияВЧастиКВР', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 45, 3, 'Первичные документы\Планирование расходов, доходов, источников\Детализация показателей СБР по ГРБС\Детализация в части КВР', '', 0, 0, 9916) ;

CALL ImportField(991610213, 'Первичные документы\Казначейство\Максимальное рекомендуемое число документов обрабатываемых на интерфейсе ввода', 'ПервичныеДокументы_Казначейство_МаксРекомендуемоеЧислоДокументовНаИнтерфейсе', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(30, 47, 3, 'Первичные документы\Казначейство\Максимальное рекомендуемое число документов обрабатываемых на интерфейсе ввода', '', 0, 30000, 9916) ;

CALL ImportField(991610214, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Подневный кассовый план', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_КонтролируемаяКлассификация_КППодневно', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(33, 275, 8, 'Первичные документы\Планирование расходов, доходов, источников\Контролируемая классификация\Расходы\Подневный кассовый план', '', 0, 0, 9916) ;

CALL ImportField(991610215, 'Системные настройки\Идентификатор текущей базы данных\Хранимый идентификатор, не зависящий от строки подключения', 'СистемныеНастройки_ИдентификаторТекущейБазыДанных_ХранимыйИдентификаторНеЗависящийОтСтрокиПодключения', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 16, 8, 'Системные настройки\Идентификатор текущей базы данных\Хранимый идентификатор, не зависящий от строки подключения', '', 0, 0, 9916) ;

CALL ImportField(991610216, 'Справочники\Справочник банков организаций и счетов\Типы р/счетов по наличности', 'Справочники_СправочникБанковОрганизацийИСчетов_ТипыРССчетовПоНаличности', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 81, 8, 'Справочники\Справочник банков организаций и счетов\Типы р/счетов по наличности', '', 0, 0, 9916) ;

-- Константы казначейства, Бюджет(1)
CALL ImportField(991710001, 'Вариант блокировки поступлений для интерфейса "Подтверждение возврата со счетов для наличности"', 'ВариантБлокировкиПоступленийДляИнтерфейсаПодтверждениеВозвратаСоСчетовДляНаличности', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 55, 3, 'Вариант блокировки поступлений для интерфейса "Подтверждение возврата со счетов для наличности"', '', 0, 0, 9917) ;

CALL ImportField(991710003, 'Используются интерфейсы подкрепления на р/с наличности, возврата с р/с наличности', 'ИспользуютсяИнтерфейсыПодкрепленияНаРСНаличностиВозвратаСРСНаличности', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(58, 0, 3, 'Используются интерфейсы подкрепления на р/с наличности, возврата с р/с наличности', '', 0, 0, 9917) ;

CALL ImportField(991710004, 'Казначейский отдел', 'КазначейскийОтдел', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 20, 3, 'Казначейский отдел', '', 0, 0, 9917) ;

CALL ImportField(991710005, 'Количество знаков в номере чека', 'КоличествоЗнаковВНомереЧека', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 11, 3, 'Количество знаков в номере чека', '', 0, 0, 9917) ;

CALL ImportField(991710007, 'Л/С (НРС) для внебюджетных средств', 'ЛСНРСДляВнебюджетныхСредств', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 14, 3, 'Л/С (НРС) для внебюджетных средств', '', 0, 0, 9917) ;

CALL ImportField(991710008, 'Л/С (НРС) нераспределенные средства', 'ЛСНРСНераспределенныеСредства', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 8, 3, 'Л/С (НРС) нераспределенные средства', '', 0, 0, 9917) ;

CALL ImportField(991710009, 'Л.с. обобщающий счет прямых получателей', 'ЛСОбобщающийСчетПрямыхПолучателей', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 3, 3, 'Л.с. обобщающий счет прямых получателей', '', 0, 0, 9917) ;

CALL ImportField(991710010, 'Л/С (РВС) расчеты с внешними счетами ', 'ЛСРВСРасчетыСВнешнимиСчетами', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 7, 3, 'Л/С (РВС) расчеты с внешними счетами ', '', 0, 0, 9917) ;

CALL ImportField(991710011, 'Л/С (СНС) для внебюджетных средств', 'ЛССНСДляВнебюджетныхСредств', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 33, 3, 'Л/С (СНС) для внебюджетных средств', '', 0, 0, 9917) ;

CALL ImportField(991710012, 'Л/С (СНС) счет невыясненных средств', 'ЛССНССчетНевыясненныхСредств', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 12, 3, 'Л/С (СНС) счет невыясненных средств', '', 0, 0, 9917) ;

CALL ImportField(991710013, 'Л/С "Средства в пути"', 'ЛССредстваВПути', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(1000, 20, 3, 'Л/С "Средства в пути"', '', 0, 0, 9917) ;

CALL ImportField(991710015, 'Наименование казначейства', 'НаименованиеКазначейства', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 22, 8, 'Наименование казначейства', 'Задайте наименование казначейства в константах казначейства', 0, 0, 9917) ;

CALL ImportField(991710016, 'Начальник отдела операционно-кассового обслуживания', 'НачальникОтделаОперационноКассовогоОбслуживания', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 10, 8, 'Начальник отдела операционно-кассового обслуживания', '', 0, 0, 9917) ;

CALL ImportField(991710017, 'Начальник отдела операционно-кассового обслуживания\Должность', 'НачальникОтделаОперационноКассовогоОбслуживания_Должность', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 9, 8, 'Начальник отдела операционно-кассового обслуживания\Должность', '', 0, 0, 9917) ;

CALL ImportField(991710018, 'Основной счет казначейства', 'ОсновнойРасчетныйСчетКазначейства', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 1, 3, 'Основной счет казначейства', '', 0, 0, 9917) ;

CALL ImportField(991710019, 'Поддержка пластиковых карт\Использовать пластиковые карты', 'ПоддержкаКорпоративныхКарт_ОтключениеПроверкиКорректностиИнформацииПоКорпоративнымКартам', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(63, 1, 3, 'Поддержка пластиковых карт\Использовать пластиковые карты', '', 0, 0, 9917) ;

CALL ImportField(991710020, 'Последняя дата, закрытая для редактирования:', 'ПоследняяДатаРедактирования:', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 2, 3, 'Последняя дата, закрытая для редактирования:', '', 0, 0, 9917) ;

CALL ImportField(991710021, 'Настройка ведения интерфейсов "Утверждение ОФ", "Распределение ОФ"\Проверка характера л/с на интерфейсах "Утверждение ОФ" и "Распределение ОФ"', 'ПроверкаХарактераЛСНаИнтерфейсахУтверждениеОФИРаспределениеОФ', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 29, 3, 'Настройка ведения интерфейсов "Утверждение ОФ", "Распределение ОФ"\Проверка характера л/с на интерфейсах "Утверждение ОФ" и "Распределение ОФ"', '', 0, 0, 9917) ;

CALL ImportField(991710022, 'Специальные реестры казначейства\Реестр отклоненных документов', 'СпециальныеРеестрыКазначейства_РеестрОтклоненныхДокументов', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(56, 10, 3, 'Специальные реестры казначейства\Реестр отклоненных документов', '', 0, 0, 9917) ;

CALL ImportField(991710023, 'Счет кассы', 'СчетКассы', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 16, 3, 'Счет кассы', '', 0, 0, 9917) ;

CALL ImportField(991710024, 'Тип документа для целевого финансирования', 'ТипДокументаДляЦелевогоФинансирования', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 6, 3, 'Тип документа для целевого финансирования', '', 0, 0, 9917) ;

CALL ImportField(991710025, 'Код доп. информации', 'КодДопИнформации', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 10, 3, 'Код доп. информации', '', 0, 0, 9917) ;

CALL ImportField(991710029, 'Специальные реестры казначейства\Реестр для приема от УРМ', 'СпециальныеРеестрыКазначейства_РеестрДляПриемаОтУРМ', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(56, 0, 3, 'Специальные реестры казначейства\Реестр для приема от УРМ', '', 0, 0, 9917) ;

CALL ImportField(991710030, 'Настройка ведения интерфейсов "Утверждение ОФ", "Распределение ОФ"\Заводить отдельный документ на каждый л/с в интерфейсе "Утверждение ОФ"', 'ЗаводитьОтдельныйДокументНаКаждыйЛсВИнтерфейсеУтверждениеОФ', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 41, 3, 'Настройка ведения интерфейсов "Утверждение ОФ", "Распределение ОФ"\Заводить отдельный документ на каждый л/с в интерфейсе "Утверждение ОФ"', '', 0, 0, 9917) ;

CALL ImportField(991710031, 'Настройка ведения интерфейсов "Утверждение ОФ", "Распределение ОФ"\Заводить отдельный документ на каждый л/с в интерфейсе "Распределение ОФ"', 'ЗаводитьОтдельныйДокументНаКаждыйЛсВИнтерфейсеРаспределениеОФ', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 39, 3, 'Настройка ведения интерфейсов "Утверждение ОФ", "Распределение ОФ"\Заводить отдельный документ на каждый л/с в интерфейсе "Распределение ОФ"', '', 0, 0, 9917) ;

CALL ImportField(991710033, 'Настройки интерфейса "Внутренние платежи"\Заводить л/с получателя в детализации', 'ЗаводитьЛсПолучателяВДетализации', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(30, 43, 3, 'Настройки интерфейса "Внутренние платежи"\Заводить л/с получателя в детализации', '', 0, 0, 9917) ;

CALL ImportField(991710035, 'Основной счет казначейства по учету средств от предпр. деят.', 'ОсновнойСчетКазначействаПоУчетуСредствОтПредпрДеят', '', ' ', 1, 9917, 0, 1, '', 0, null) ;

CALL InsertConst(30, 17, 3, 'Основной счет казначейства по учету средств от предпр. деят.', '', 0, 0, null) ;

-- Редактор справочника операций , Бюджет(1)
CALL ImportField(992011010, 'Кредит', 'CreditAccRef', '', ' ', 1, 9920, 1, 1, '', 0, 21655) ;

CALL ImportField(992011011, 'Дебет', 'DebitAccRef', '', ' ', 1, 9920, 1, 1, '', 0, 21654) ;

-- Редактор справочника бюджетов, Бюджет(1)
CALL ImportField(992111020, 'КЦСР', 'KCSRCode', '', ' ', 1, 9921, 1, 0, '', 0, 25462) ;

CALL ImportField(992111025, 'КВР', 'KVRCode', '', ' ', 1, 9921, 1, 0, '', 0, 25467) ;

CALL ImportField(992111027, 'КВСР', 'KVSRCode', '', ' ', 1, 9921, 1, 0, '', 0, 25472) ;

-- Редактор схем подписания, Бюджет(1)
CALL ImportField(992310005, 'Принадлежность', 'IsBudget', '', ' ', 1, 9923, 0, 0, '', 0, 35138) ;

CALL ImportField(992311003, 'Порядок подписи', 'SignOrder', '', ' ', 1, 9923, 1, 0, '', 0, 30773) ;

CALL ImportField(992311005, 'Роль подписывающего', 'SignName', '', ' ', 1, 9923, 1, 0, '', 0, 30751) ;

-- Редактор справочника ролей, Бюджет(1)
CALL ImportField(992410002, 'Доступ', 'Rights', '', ' ', 1, 9924, 0, 0, '', 0, null) ;

CALL ImportField(992410003, 'Примечание', 'Note', '', ' ', 1, 9924, 0, 0, '', 0, 35137) ;

CALL ImportField(992410004, 'Принадлежность', 'IsBudget', '', ' ', 1, 9924, 0, 0, '', 0, 35136) ;

-- Редактор справочника типов уведомлений, Бюджет(1)
CALL ImportField(992611006, 'Видимый', 'IsVisible', 'Признак видимости аттрибута уведомления', 'IsVisible', 1, 9926, 1, 0, '', 0, 32147) ;

CALL ImportField(992611007, 'Проверять на заполнение', 'IsRequired', 'Аттрибут уведомления обязателен к заполнению', 'IsRequired', 1, 9926, 1, 0, '', 0, 32145) ;

-- Права удаленных клиентов, Бюджет(1)
CALL ImportField(992710001, 'Разрешено копий', 'AllowedCopies', '', ' ', 1, 9927, 0, 0, '', 0, 27862) ;

CALL ImportField(992710002, 'Блоки для синхронизации', 'BlockListDisplay', '', ' ', 1, 9927, 0, 0, '', 0, null) ;

CALL ImportField(992710003, 'Дата окончания действия сертификата', 'CertExpirationDate', '', ' ', 1, 9927, 0, 0, '', 0, 31712) ;

CALL ImportField(992710004, 'Предупреждать об истечнии срока действия за (дней)', 'CertExpirationDays', '', ' ', 1, 9927, 0, 0, '', 0, 24958) ;

CALL ImportField(992710005, 'Ф.И.О. владельцев сертификатов', 'CertOwnerNames', '', ' ', 1, 9927, 0, 0, '', 0, 24959) ;

CALL ImportField(992710006, 'Код клиента', 'ClientID', '', ' ', 1, 9927, 0, 0, '', 0, 20056) ;

CALL ImportField(992710007, 'Тип удаленного клиента', 'ClientTypeName', '', ' ', 1, 9927, 0, 0, '', 0, 20640) ;

CALL ImportField(992710008, 'Криптографический идентификатор', 'CryptoID', '', ' ', 1, 9927, 0, 0, '', 0, 20059) ;

CALL ImportField(992710009, 'Использует исполнение', 'IsExecutionUsed', '', ' ', 1, 9927, 0, 0, '', 0, 27863) ;

CALL ImportField(992710010, 'Тип соединения', 'LinkSpeedName', '', ' ', 1, 9927, 0, 0, '', 0, null) ;

CALL ImportField(992710011, 'Примечание', 'Note', '', ' ', 1, 9927, 0, 0, '', 0, 20061) ;

CALL ImportField(992710012, 'ИНН', 'OrgINN', '', ' ', 1, 9927, 0, 0, 'ИНН', 0, 16645) ;

CALL ImportField(992710013, 'КПП', 'OrgKpp', '', ' ', 1, 9927, 0, 0, 'КПП', 0, 16653) ;

CALL ImportField(992710014, 'Организация', 'OrgName', '', ' ', 1, 9927, 0, 0, 'Имя', 0, 16646) ;

CALL ImportField(992710015, 'Блоки для синхронизации прикрепленных файлов', 'PacketBlockListDisplay', '', ' ', 1, 9927, 0, 0, '', 0, null) ;

CALL ImportField(992710016, 'Пароль', 'Pass', '', ' ', 1, 9927, 0, 0, '', 0, 20057) ;

CALL ImportField(992710017, 'Использовать подпись', 'UseSign', '', ' ', 1, 9927, 0, 0, '', 0, 20068) ;

CALL ImportField(992711001, 'Лицевой счет', 'FacialAccCls', '', ' ', 1, 9927, 1, 0, '', 0, 20203) ;

CALL ImportField(992712001, 'Исключая', 'Exclude', '', ' ', 1, 9927, 2, 0, '', 0, 20196) ;

CALL ImportField(992712002, 'Лицевой счет', 'FacialAccCls', '', ' ', 1, 9927, 2, 0, '', 0, 20193) ;

CALL ImportField(992712003, 'Наименование документа', 'RemoteDocumentName', '', ' ', 1, 9927, 2, 0, '', 0, 19731) ;

CALL ImportField(992713001, 'Казначейский счет', 'AccountName', '', ' ', 1, 9927, 3, 0, 'Имя', 0, 17112) ;

CALL ImportField(992713002, 'Счет по умолчанию', 'DefaultAccount', '', ' ', 1, 9927, 3, 0, '', 0, 20215) ;

CALL ImportField(992713003, 'Наименование документа', 'RemoteDocumentName', '', ' ', 1, 9927, 3, 0, '', 0, 19731) ;

CALL ImportField(992714001, 'Запрет', 'ISREJECT', '', ' ', 1, 9927, 4, 0, '', 0, 20882) ;

CALL ImportField(992714002, 'Тип документа', 'OBJREF1', '', ' ', 1, 9927, 4, 0, '', 0, 20883) ;

CALL ImportField(992714003, 'Лицевой счет', 'ObjRef2', '', ' ', 1, 9927, 4, 0, '', 0, 20884) ;

CALL ImportField(992715001, 'Вложенные', 'ARecursive', '', ' ', 1, 9927, 5, 0, '', 0, 25482) ;

CALL ImportField(992715002, 'Тип пакета', 'DataPacketTypeName', '', ' ', 1, 9927, 5, 0, '', 0, null) ;

CALL ImportField(992715003, 'Лицевой счет', 'FacialAccCls', '', ' ', 1, 9927, 5, 0, '', 0, 22419) ;

CALL ImportField(992716001, 'Вложенные', 'ARecursive', '', ' ', 1, 9927, 6, 0, '', 0, 25482) ;

CALL ImportField(992716002, 'Тип пакета', 'DataPacketTypeName', '', ' ', 1, 9927, 6, 0, '', 0, null) ;

CALL ImportField(992716003, 'Лицевой счет', 'FacialAccCls', '', ' ', 1, 9927, 6, 0, '', 0, 22419) ;

CALL ImportField(992717001, 'Окончание действия', 'EndDate', '', ' ', 1, 9927, 7, 0, '', 0, 35085) ;

CALL ImportField(992717002, 'Можно подписывать', 'IsEnabled', '', ' ', 1, 9927, 7, 0, '', 0, 35087) ;

CALL ImportField(992717003, 'Примечание', 'Note', '', ' ', 1, 9927, 7, 0, '', 0, 35088) ;

CALL ImportField(992717004, 'Владелец', 'Owner', '', ' ', 1, 9927, 7, 0, '', 0, 35089) ;

CALL ImportField(992717005, 'Организация владелец', 'OwnerOrganization', '', ' ', 1, 9927, 7, 0, '', 0, 35090) ;

CALL ImportField(992717006, 'Номер сертификата', 'SerialNumber', '', ' ', 1, 9927, 7, 0, '', 0, 35091) ;

CALL ImportField(992717007, 'Начало действия', 'StartDate', '', ' ', 1, 9927, 7, 0, '', 0, 35092) ;

CALL ImportField(992718001, 'Сертификаты', 'Certificates', '', ' ', 1, 9927, 8, 0, '', 0, null) ;

CALL ImportField(992718002, 'Фильтр', 'DocsFilter', '', ' ', 1, 9927, 8, 0, '', 0, null) ;

CALL ImportField(992718003, 'Наименование группы', 'Name', '', ' ', 1, 9927, 8, 0, '', 0, 35100) ;

CALL ImportField(992718004, 'Примечание', 'Note', '', ' ', 1, 9927, 8, 0, '', 0, 35101) ;

CALL ImportField(992718005, 'Схема', 'SchemaName', '', ' ', 1, 9927, 8, 0, '', 0, 30762) ;

-- Соответствие КВР КОСГУ, Бюджет(1)
CALL ImportField(992810001, 'Ключ', 'ID', '', ' ', 1, 9928, 0, 1, '', 0, null) ;

CALL ImportField(992810002, 'КВР', 'KVR', '', ' ', 1, 9928, 0, 0, '', 0, null) ;

CALL ImportField(992810003, 'КОСГУ', 'KESR', '', ' ', 1, 9928, 0, 0, '', 0, null) ;

-- Редактор справочника структуры расходов бюджета, Бюджет(1)
CALL ImportField(992910001, 'Ключ', 'ID', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

CALL ImportField(992910002, 'КВСР', 'KVSRCode', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910003, 'ФКР', 'KFSR', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910004, 'КЦСР', 'KCSRCode', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910005, 'КВР', 'KVRCode', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910006, 'ЭКР', 'KESR', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910007, 'Код целевых средств', 'TransfertClsCode', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910008, 'Суб. КОСГУ', 'SubKESR', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910009, 'Направление', 'DirectionCLSCode', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910010, 'Район', 'RegionCls', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910011, 'Мероприятие', 'FactCode', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910012, 'Код доп. информации', 'FinTypeCode', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910013, 'Тип средств', 'MeansType', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910014, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910015, 'Код расходного обязательства', 'PayPromiseClsCode', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910016, 'Код субсидии', 'SubsidyClsCode', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910017, 'Дата вступления в действие', 'StartDate', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910018, 'Дата закрытия', 'ActualDate', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910019, 'Используется для лимитируемых расходов', 'IsLimitSpend', '', ' ', 1, 9929, 0, 0, '', 0, null) ;

CALL ImportField(992910020, 'Бюджет', 'BudgetRef', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

CALL ImportField(992910021, 'КВСР (Ключ)', 'KVSR', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

CALL ImportField(992910022, 'КЦСР (Ключ)', 'KCSR', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

CALL ImportField(992910023, 'КВР (Ключ)', 'KVR', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

CALL ImportField(992910024, 'Направление (Ключ)', 'DirectionCLS', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

CALL ImportField(992910025, 'Мероприятие (Ключ)', 'Fact', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

CALL ImportField(992910026, 'Код доп. информации (Ключ)', 'FinType', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

CALL ImportField(992910027, 'Код целевых средств (Ключ)', 'TransfertCls', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

CALL ImportField(992910028, 'Код бюджетного ассигнования (Ключ)', 'BudAllocationCls', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

CALL ImportField(992910029, 'Код расходного обязательства (Ключ)', 'PayPromiseCls', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

CALL ImportField(992910030, 'Код субсидии (Ключ)', 'SubsidyCls', '', ' ', 1, 9929, 0, 1, '', 0, null) ;

-- Включаем триггеры авторизации на изменение для констант
ALTER TRIGGER TR_INTCONST_BU_500 ENABLE
/

ALTER TRIGGER TR_VARCHARCONST_BU_500 ENABLE
/

ALTER TRIGGER TR_REALCONST_BU_500 ENABLE
/

DROP PROCEDURE ImportField
/

/* Начальное заполнение ссылки на страницу поля*/
ALTER TRIGGER TR_DOCUMENTFIELDS_BU_500 DISABLE
/

Update TB_DocumentFields df
set documentcls=doctyperef*100+detailnumber
where (detailnumber<100)and(documentcls is null)
 and(exists(select dc.id from documentcls dc where id=df.doctyperef*100+df.detailnumber))
/

ALTER TRIGGER TR_DOCUMENTFIELDS_BU_500 ENABLE
/

DROP PROCEDURE DeleteFields
/

DROP PROCEDURE InsertConst
/

DROP PROCEDURE DELETECONST
/




CREATE OR REPLACE PROCEDURE DOCLOCK_IMPORT(
  NAME_              VARCHAR2,
  LOCKMASK_          NUMBER,
  DOCREF_            NUMBER,
  DETAILNUM_         NUMBER,
  RUNPOS_            NUMBER,
  LOCKACTION_        NUMBER,
  USERIGHTS_        NUMBER,
  FORMULA_           VARCHAR2,
  FORDELETE_         NUMBER,
  ISSYSTEM_          NUMBER,
  NOTE_              VARCHAR2,
  FORINSERT_         NUMBER,
  VALIDATEMESSAGE_ VARCHAR2,
  VALIDATELEVEL_   NUMBER,
  VALIDATEFILTER_  VARCHAR2,
  ISBUDGET_ NUMBER)
IS
  DOCLOCKID$ Number(10);
BEGIN
   BEGIN
     SELECT ID
     INTO DOCLOCKID$
     FROM DOCLOCK
     WHERE (DOCREF = DOCREF_) AND(DETAILNUM = DETAILNUM_) AND (NAME = NAME_) AND (ISBUDGET = ISBUDGET_);
   EXCEPTION
     WHEN NO_DATA_FOUND THEN
       DOCLOCKID$ := NULL;  
   END;
   
   IF (DOCLOCKID$ is not null) THEN
     IF (ISSYSTEM_ = 3) THEN
       UPDATE DOCLOCK SET
         NAME = NAME_,
         LOCKMASK = LOCKMASK_,
         DOCREF = DOCREF_,
         DETAILNUM = DETAILNUM_,
         RUNPOS = RUNPOS_,
         LOCKACTION = LOCKACTION_,
         FORMULA = FORMULA_,
         FORDELETE = FORDELETE_,
         ISSYSTEM = ISSYSTEM_,
         NOTE = NOTE_,
         FORINSERT = FORINSERT_,
         VALIDATEMESSAGE = VALIDATEMESSAGE_,
         VALIDATELEVEL = VALIDATELEVEL_,
         VALIDATEFILTER = VALIDATEFILTER_,
         ISBUDGET = ISBUDGET_,
         USERIGHTS = USERIGHTS_
       WHERE ID = DOCLOCKID$;  
     ELSE
       UPDATE DOCLOCK SET
         NAME = NAME_,
         LOCKMASK = LOCKMASK_,
         DOCREF = DOCREF_,
         DETAILNUM = DETAILNUM_,
         RUNPOS = RUNPOS_,
         LOCKACTION = LOCKACTION_,
         FORMULA = FORMULA_,
         FORDELETE = FORDELETE_,
         ISSYSTEM = ISSYSTEM_,
         NOTE = NOTE_,
         FORINSERT = FORINSERT_,
         VALIDATEMESSAGE = VALIDATEMESSAGE_,
         VALIDATELEVEL = VALIDATELEVEL_,
         VALIDATEFILTER = VALIDATEFILTER_,
         ISBUDGET = ISBUDGET_
       WHERE ID = DOCLOCKID$;    
     END IF;  
   ELSE
     INSERT INTO DOCLOCK
       (ISBUDGET,NAME,LOCKMASK,DOCREF,DETAILNUM,RUNPOS,LOCKACTION,USERIGHTS,FORMULA,FORDELETE,ISSYSTEM,NOTE,FORINSERT,VALIDATEMESSAGE,VALIDATELEVEL,VALIDATEFILTER)
     VALUES
       (ISBUDGET_,NAME_,LOCKMASK_,DOCREF_,DETAILNUM_,RUNPOS_,LOCKACTION_,USERIGHTS_,FORMULA_,FORDELETE_,ISSYSTEM_,NOTE_,FORINSERT_,VALIDATEMESSAGE_,VALIDATELEVEL_,VALIDATEFILTER_);
   END IF;
END;
/

CREATE OR REPLACE PROCEDURE DOCLOCKFIELDS_INSERTFIELD(
  NAME_      VARCHAR2,
  DOCREF_    NUMBER,
  DETAILNUM_ NUMBER,
  FIELDREF_  NUMBER,
  ISBUDGET_ NUMBER)
IS
  NID$ NUMBER(10);
  cnt$ number(10);
BEGIN
  BEGIN
    SELECT ID
    INTO NID$
    FROM DOCLOCK
    WHERE (DOCREF = DOCREF_) AND (DETAILNUM = DETAILNUM_) AND (NAME = NAME_) AND (ISBUDGET = ISBUDGET_);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      NID$ := NULL;  
  END;

  IF (NID$ is not null) THEN
    CNT$ := 0;
    SELECT count(ID)
    into cnt$
    FROM DOCLOCKFIELDS
    WHERE (DOCLOCKREF = NID$) AND (FIELDREF = FIELDREF_) ;
    
    IF (cnt$ = 0) THEN
      INSERT INTO DOCLOCKFIELDS
        (DOCLOCKREF,FIELDREF,ISSYSTEM)
      VALUES
        (NID$,FIELDREF_,1);
    ELSE
      UPDATE DOCLOCKFIELDS SET
        ISSYSTEM = 1
      WHERE (DOCLOCKREF = NID$) AND (FIELDREF = FIELDREF_) ;
    END IF;
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE DOCLOCK_DELETE(NAME_ VARCHAR2, DOCREF_ NUMBER, DETAILNUM_ NUMBER, ISBUDGET_ NUMBER) IS
   DOCLOCKID$ NUMBER(10);
BEGIN
  BEGIN
    SELECT ID
    INTO DOCLOCKID$
    FROM DOCLOCK
    WHERE (DOCREF = DOCREF_) AND (DETAILNUM = DETAILNUM_) AND (NAME = NAME_) AND (ISBUDGET = ISBUDGET_);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      DOCLOCKID$ := NULL;
  END;

  IF (DOCLOCKID$ is not null) THEN
    DELETE FROM DOCLOCK
    WHERE ID = DOCLOCKID$;
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE DOCLOCKFIELDS_DELETE(NAME_ VARCHAR2, DOCREF_ NUMBER, DETAILNUM_ NUMBER, CANCHANGEFIELDS_ NUMBER, ISBUDGET_ NUMBER) IS
   DOCLOCKID$ NUMBER(10);
BEGIN
  BEGIN
    SELECT ID
    INTO DOCLOCKID$
    FROM DOCLOCK
    WHERE (DOCREF = DOCREF_) AND (DETAILNUM = DETAILNUM_) AND (NAME = NAME_) AND (ISBUDGET = ISBUDGET_);
  EXCEPTION  
    WHEN NO_DATA_FOUND THEN
      DOCLOCKID$ := NULL;
  END;  

  IF (DOCLOCKID$ is not null) THEN
    DELETE FROM DOCLOCKFIELDS
    WHERE (DOCLOCKREF = DOCLOCKID$) AND ((ISSYSTEM = 1) OR ((ISSYSTEM = 0) AND (CANCHANGEFIELDS_ = 0) ));
  END IF;
END;
/

-- Блокировки
CALL DOCLOCK_DELETE('Фильтр кода целевых средств по получению,передаче',210, 2, 1) ;

CALL DOCLOCK_DELETE('Проверка заполненности лицевого счета',211, 0, 1) ;

CALL DOCLOCK_DELETE('Отметки о блокировании\разблокировании поступлений',303, 1, 1) ;

CALL DOCLOCK_DELETE('По дате разблокировки',303, 1, 1) ;

CALL DOCLOCK_DELETE('Блокировка даты и причины разблокировки',303, 1, 1) ;

CALL DOCLOCK_DELETE('Блокировка ввода документа',1601, -1, 1) ;

CALL DOCLOCK_DELETE('Фильтр кода субсидии по значения лицевого счета',1601, 1, 1) ;

CALL DOCLOCK_DELETE('Фильтр кода субсидии по значению лицевого счета',1601, 1, 1) ;

CALL DOCLOCK_DELETE('Изменение данных',1816, -1, 1) ;

CALL DOCLOCK_DELETE('Блокировка по отклоненности',4401, -1, 1) ;

CALL DOCLOCK_DELETE('fgh',5201, -1, 1) ;

CALL DOCLOCK_DELETE('9',5503, 1, 1) ;

CALL DOCLOCK_DELETE('На изменение кода ОКПО',9903, 0, 1) ;

CALL DOCLOCK_DELETE('Фильтр для счетов 5-го раздела дебит',9920, 1, 1) ;

CALL DOCLOCK_IMPORT('Фильтр по получателю субсидии',0,200,1,0,11,0,'',0,1,'Получатель субсидии должен быть бюджетным или автономным учреждением учредителя-владельца л\с. Для КОСГУ=251 получатель субсидии должен иметь вид 02.03.00 "Финорганы других бюджетов" или 02.04.00 "ГУП, МУП других бюджетов"',0,'Указанная организация не может использоваться в качестве получателя субсидии',null,'Документ.[020011021] = 251?
([960110035] between 020300 and 020499)
:
(([960110035] between 010800 and 010999)
и([960110021]=Разыменовать("Лицевой_Счет.ОрганизацияВладелец",Документ.[20011008])))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по получателю субсидии', 200, 1, 0, 1) ;

-- Поле "Получатель субсидии"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по получателю субсидии',200,1,20011028,1) ;

CALL DOCLOCK_IMPORT('Фильтр для субсидий на госзадания',0,200,1,0,11,0,'((КодИнтерфейса=204)или(КодИнтерфейса=212))и(не(Разыменовать("ЕстьЛицензия.ДопУчетБУАУ",КодИнтерфейса)))',0,3,'Для использования субсидий на выполнение госзадания требуется наличие блока "Доп. учет БУ, АУ"',0,'Субсидии на выполнение госзадания не могут использоваться на данном интерфейсе',null,'не([988910010]=0)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр для субсидий на госзадания', 200, 1, 0, 1) ;

-- Поле "Код субсидии (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр для субсидий на госзадания',200,1,20011015,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по КД',0,200,1,0,11,0,'[20011012] = 2',0,3,'При доходной классификации справочник кодов целевых средств фильтруется по коду дохода. Допустимы для выбора КЦС с 0-вым кодом дохода, КЦС с таким же кодом дохода, как в документе, а также КЦС с 0-вым администратором и таким же (как в документе) видом дохода, подвидом, ЭКД. Если в документе  указан код дохода, применяемый для возврата трансфертов, то допустимы для выбора любые КЦС поступления.',0,'Код целевых средтв не соответствует доходной классификации',null,'([988410006] = 0) или (Документ.[20011017] = 0) или ([988410008] = Документ.[20011026]) или
   ((Разыменовать("КДКлюч.КВСР.Код",[988410006])=0)
   и(Разыменовать("КДКлюч.ВидДохода",[988410006])=Разыменовать("КДКлюч.ВидДохода",Документ.[20011017]))
   и((Разыменовать("КДКлюч.Программа",[988410006])=Разыменовать("КДКлюч.Программа",Документ.[20011017]))
     или(Разыменовать("КДКлюч.Программа",[988410006])=0))
   и(Разыменовать("КДКлюч.КЭСР",[988410006])=Разыменовать("КДКлюч.КЭСР",Документ.[20011017]))) или
((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[20011017]) div 100000) between 218 and 219) или
((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[20011017]) div 1000) = 11302)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по КД', 200, 1, 0, 1) ;

-- Поле "Код целевых средств (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по КД',200,1,20011011,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду ассигнований',0,200,1,0,11,0,'[20011007] <> 0',0,1,'Если в справочнике кода БА указан вид ассигнований, вид ассигнований документа должен ему соответствовать',0,'Указанный вид ассигнований не может использоваться для данного кода БА',null,'(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20011007]) = 0) или
(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20011007]) = [988510003]) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20011007]) mod 100) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20011007]) div 100) = ([988510003] div 100))) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20011007]) mod 10000) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20011007]) div 10000) = ([988510003] div 10000)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду ассигнований', 200, 1, 0, 1) ;

-- Поле "Вид ассигнований"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду ассигнований',200,1,20011034,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду субсидии для БУ,АУ',0,200,1,0,11,0,'Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[20011008])  или Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",[20011008])  или Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",[20011008])',0,3,'Бюджетным, автономным учреждениям доступны только субсидии у которых учредитель=организации-распорядителю л\с, либо учредитель=ФО.  Для отдельных л\с БУ\АУ, доступны только субсидии с видом<>госзадания. Для прочих л\с БУ\АУ доступны только коды субсидий на госзадания.',0,'Указанный код субсидии не может использоваться для данного лицевого счета',null,'([988910008] = Разыменовать("Лицевой_Счет.Распорядитель",Документ.[20011008])
или ((Разыменовать("Организация.ВидОрганизации",[988910008]) between 10100 и 10199)
или (Разыменовать("Организация.ВидОрганизации",[988910008]) between 11000 и 11099)))
и   
((не Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[20011008])
и ([988910010] = 0))
или
(Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[20011008])
и ([988910010] <> 0)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду субсидии для БУ,АУ', 200, 1, 0, 1) ;

-- Поле "Код субсидии (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду субсидии для БУ,АУ',200,1,20011015,1) ;

CALL DOCLOCK_IMPORT('Фильтр для ограничения использования л/с БУ,АУ',0,200,1,0,11,0,'не ((КодИнтерфейса=204)или(КодИнтерфейса=212))',0,3,'Для использования л\с, открытых бюджетным, автономным учреждениям предназначен интерфейс сведений о субсидиях',0,'Лицевые счета с характером л/с БУ, АУ, отдельный л/с БУ, АУ, л/с ОМС не могут использоваться на данном интерфейсе',null,'([984110041]=0)и([984110045]=0)и([984110046]=0)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр для ограничения использования л/с БУ,АУ', 200, 1, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр для ограничения использования л/с БУ,АУ',200,1,20011008,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования кода субсидии',32768,200,1,0,3,0,'не((Разыменовать("Организация.ВидОрганизации.Код",[20010014]) between 10800 и 11099)    или(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[20011008]) between 10800 и 11099)     или((Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[20011008]) between 10000 и 10499)        и не(КодИнтерфейса=204) ))',0,1,'Блокировка поля "Код субсидии" для л\с с видом организации-владельца вне диапазона 01.08.00-01.10.99 либо 01.01.00-01.04.99 (не финорганы, не распорядители, не бюдж.(авт.) учреждения). Для смет по ПД код субсидии не блокируется только для БУ,АУ',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования кода субсидии', 200, 1, 0, 1) ;

-- Поле "Код субсидии"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования кода субсидии',200,1,20011014,1) ;

CALL DOCLOCK_IMPORT('Фильтр лимитируемости ассигнований',0,201,1,0,11,0,'[20110076]=2',0,1,'Фильтр по признаку лимитируемости. В случае отнесения данных к ЛБО запрещается выбирать нелимитируемые виды ассигнований',0,'Данный вид ассигнований не лимитируется',null,'[988510009]=0',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр лимитируемости ассигнований', 201, 1, 0, 1) ;

-- Поле "Вид ассигнований"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр лимитируемости ассигнований',201,1,20111068,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования получателя субсидии',32768,201,1,0,3,0,'не Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", КодИнтерфейса)',0,3,'Блокировка поля "Получатель субсидии" для документов, не относящихся к передаче субсидий. Для редактирования получателя субсидии требуется лицензия на расширенный учет БУ, АУ.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования получателя субсидии', 201, 1, 0, 1) ;

-- Поле "Получатель субсидии(КПП)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',201,1,20111182,1) ;

-- Поле "Получатель субсидии(ИНН)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',201,1,20111181,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',201,1,20111180,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',201,1,20111096,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования получателя субсидии(2)',32768,201,1,0,3,0,'не(([20111007] in(241,530,251))    и (([20111089] is not null)  или (ЕстьПодстрока([20111085],Константа(30,45,8),"9.9.9")))   или ([20111085] between 500 and 599)    или (([20111082] is not null) и (tonumber([020111083],1) <> 0))   )',0,1,'Блокировка поля "Получатель субсидии" для документов, не относящихся к передаче субсидий. Для редактирования получателя субсидии требуется, чтобы ЭКР =(241 или 530) и (был непустой код субсидии либо КВР находился в диапазоне кодов (задается константой), разрешенных для  финансирования на БУ, АУ ).',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования получателя субсидии(2)', 201, 1, 0, 1) ;

-- Поле "Получатель субсидии(КПП)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',201,1,20111182,1) ;

-- Поле "Получатель субсидии(ИНН)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',201,1,20111181,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',201,1,20111180,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',201,1,20111096,1) ;

CALL DOCLOCK_IMPORT('Фильтр лимитируемости ассигнований',0,202,1,0,11,0,'[20210084]=2',0,1,'Фильтр по признаку лимитируемости. В случае отнесения данных к ЛБО запрещается выбирать нелимитируемые виды ассигнований',0,'Данный вид ассигнований не лимитируется',null,'[988510009]=0',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр лимитируемости ассигнований', 202, 1, 0, 1) ;

-- Поле "Вид ассигнований"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр лимитируемости ассигнований',202,1,20211011,1) ;

CALL DOCLOCK_IMPORT('Фильтр по уровню детализации КВР',0,202,1,0,11,0,'([20211096]=0)и (Константа(32,45,3) between 0 and 2)',0,3,'Фильтр запрещает использование кодов КВР не соответствующих уровню детализации КВР, заданному в константе "Детализация в части КВР"',0,'Фильтр по уровню детализации КВР. Значение КВР не удовлетворяет уровню КВР, заданному в константе "Детализация в части КВР"',null,'((Константа(32,45,3) = 0) и не ([980410006] like "?00") 
  и не(([980410006] like "??0") и Разыменовать("Таблица.KVR[CODE].{COUNTNOTNULL(CODE)}",
  ЗадатьФильтр(''CODE like "''+ [980410006] div 1 +''_"''))>1))
или ((Константа(32,45,3) = 1) и ([980410006] like "??0") и не ([980410006] like "?00")) 
или ((Константа(32,45,3) = 2) и ([980410006] like "?00") и ([980410006] <> "000"))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по уровню детализации КВР', 202, 1, 0, 1) ;

-- Поле "КВРКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по уровню детализации КВР',202,1,20211021,1) ;

CALL DOCLOCK_IMPORT('Фильтрация по характеру л/с',0,202,1,0,11,0,'',0,3,'Фильтр по характеру л/с в детализации. Допускается использовать только распорядительные и самостоятельные л\с.',0,'Лицевой счет должен быть распорядительным или самостоятельным',null,'([984110044] = 1)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтрация по характеру л/с', 202, 1, 0, 1) ;

-- Поле "Лицевой счет ГРБС"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтрация по характеру л/с',202,1,20211033,1) ;

CALL DOCLOCK_IMPORT('Правка документов, пришедших с УРМ',65540,203,-1,0,4,2,'',0,2,'Разрешение на внесение изменений в документы, присланые с УРМ. Изменять документы разрешается только указанному списку пользователей. Колонки, разрешенные для изменения указываются администратором.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Правка документов, пришедших с УРМ', 203, -1, 1, 1) ;

-- Поле "Тип средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20311070,1) ;

-- Поле "Суб КОСГУ"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20311067,1) ;

-- Поле "Район трансферта"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20311046,1) ;

-- Поле "Направление(Классификация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20311036,1) ;

-- Поле "Мероприятие"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20311035,1) ;

-- Поле "Код НПА"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310069,1) ;

-- Поле "Причина отклонения (комментарий)"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310045,1) ;

-- Поле "Код причины отклонения"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310044,1) ;

-- Поле "Дополнительная информация"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310043,1) ;

-- Поле "По вопросу(Основание)"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310041,1) ;

-- Поле "Основание(Основание)"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310040,1) ;

-- Поле "Номер НПА"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310037,1) ;

-- Поле "Источник"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310020,1) ;

-- Поле "Дата принятия"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310016,1) ;

-- Поле "Дата НПА"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310014,1) ;

-- Поле "Вид плана"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310013,1) ;

-- Поле "Вариант"
CALL DOCLOCKFIELDS_INSERTFIELD('Правка документов, пришедших с УРМ',203,-1,20310010,1) ;

CALL DOCLOCK_IMPORT('Фильтр по характеру л/с',0,203,1,0,11,0,'',0,3,'Фильтр по характеру л/с в детализации. Допускается использовать только распорядительные и самостоятельные л\с. ',0,'Лицевой счет должен быть распорядительным или самостоятельным',null,'([984110044] = 1)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по характеру л/с', 203, 1, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по характеру л/с',203,1,20311033,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду организации',0,204,0,0,11,0,'',0,1,'Фильтр по виду организации заголовка. Организация должна быть бюджетным(автономным) учреждением, то есть иметь вид организации в диапазоне от 01.08.00 до 01.10.99',0,'Неверный вид организации. Организация должна быть бюджетным (автономным) учреждением либо МУП(ГУП)',null,'([960110035] between 10800 and 11099)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду организации', 204, 0, 0, 1) ;

-- Поле "Организация (ссылка)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду организации',204,0,20410039,1) ;

CALL DOCLOCK_IMPORT('Фильтр по владельцу л/с',0,204,1,0,11,0,'',0,1,'Фильтр по организации-владельцу л\с. Организация-владелец лицевого счета должна иметь вид организации в диапазоне от 01.08.00 до 01.10.99',0,'Организация-владелец лицевого счета должна быть быть бюджетным (автономным) учреждением либо МУП(ГУП)',null,'(Разыменовать("Организация.ВидОрганизации.Код",[984110031]) between 10800 and 11099)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по владельцу л/с', 204, 1, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по владельцу л/с',204,1,20411033,1) ;

CALL DOCLOCK_IMPORT('Фильтр по л/с для БУ,АУ',0,204,1,0,11,0,'(Разыменовать("Организация.ВидОрганизации.Код",[20410039]) between 10800 and 11099)',0,3,'Фильтр по организации-владельцу л\с. Организацией-владельцем л\с должна быть организация из заголовка',0,'Организацией-владельцем л\с должна быть организация из заголовка',null,'([984110031]=Документ.[20410039])',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по л/с для БУ,АУ', 204, 1, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по л/с для БУ,АУ',204,1,20411033,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования прежнего кода субсидии',32768,204,1,0,3,0,'не((Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код", [20411033]) between 10800 и 11099)или (Разыменовать("Организация.ВидОрганизации.Код", [20410039]) between 10800 и 11099))',0,1,'Блокировка поля "Прежний код субсидии" для л\с с видом организации-владельца вне диапазона 01.08.00-01.10.99',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования прежнего кода субсидии', 204, 1, 0, 1) ;

-- Поле "Прежний код субсидии"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования прежнего кода субсидии',204,1,20411110,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования получателя субсидии',32768,206,1,0,3,0,'не Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", КодИнтерфейса)',0,3,'Блокировка поля "Получатель субсидии" для документов, не относящихся к передаче субсидий. Для редактирования получателя субсидии требуется лицензия на расширенный учет БУ, АУ.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования получателя субсидии', 206, 1, 0, 1) ;

-- Поле "Получатель субсидии(КПП)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',206,1,20611182,1) ;

-- Поле "Получатель субсидии(ИНН)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',206,1,20611181,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',206,1,20611180,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',206,1,20611103,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования получателя субсидии(2)',32768,206,1,0,3,0,'не(([20611033] in(241,530,251)) и    (([20611096] is not null) или (ЕстьПодстрока([20611092],Константа(30,45,8),"9.9.9")))     или ([20611092] between 500 and 599)   или (([20611089] is not null) и (tonumber([20611090],1) <> 0))   )',0,1,'Блокировка поля "Получатель субсидии" для документов, не относящихся к передаче субсидий. Для редактирования получателя субсидии требуется, чтобы ЭКР =(241 или 530), и (был непустой код субсидии либо КВР находился в диапазоне кодов (задается константой), разрешенных для  финансирования на БУ, АУ ).',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования получателя субсидии(2)', 206, 1, 0, 1) ;

-- Поле "Получатель субсидии(КПП)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',206,1,20611182,1) ;

-- Поле "Получатель субсидии(ИНН)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',206,1,20611181,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',206,1,20611180,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',206,1,20611103,1) ;

CALL DOCLOCK_IMPORT('Запрет изменения типа классификации',0,207,0,0,9,0,'ПолеНеПустое([20710026])?(Количество([20711028])=0):1',0,3,'Запрет изменения типа классификации, при заполненной детализации',0,'Нельзя изменять тип классификации у документа с введенной детализацией',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет изменения типа классификации', 207, 0, 0, 1) ;

-- Поле "Тип классификации"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет изменения типа классификации',207,0,20710158,1) ;

CALL DOCLOCK_IMPORT('Фильтр по характеру л/с',0,207,1,0,11,0,'',0,3,'Фильтр по характеру л/с в детализации. Допускается использовать только распорядительные и самостоятельные л\с.',0,'Лицевой счет должен быть распорядительным или самостоятельным',null,'([984110044] = 1)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по характеру л/с', 207, 1, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по характеру л/с',207,1,20711034,1) ;

CALL DOCLOCK_IMPORT('Запрет изменения типа классификации',0,208,0,0,9,0,'ПолеНеПустое([20810026])?(Количество([20811028])=0):1',0,3,'Запрет изменения типа классификации для документов с заполненной детализацией',0,'Нельзя изменять тип классификации у документа с введенной детализацией',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет изменения типа классификации', 208, 0, 0, 1) ;

-- Поле "Тип классификации"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет изменения типа классификации',208,0,20810158,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования получателя субсидии',32768,208,1,0,3,0,'не Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", КодИнтерфейса)',0,3,'Блокировка поля "Получатель субсидии" для документов, не относящихся к передаче субсидий. Для редактирования получателя субсидии требуется лицензия на расширенный учет БУ, АУ.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования получателя субсидии', 208, 1, 0, 1) ;

-- Поле "Получатель субсидии(КПП)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',208,1,20811182,1) ;

-- Поле "Получатель субсидии(ИНН)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',208,1,20811181,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',208,1,20811180,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',208,1,20811179,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования получателя субсидии(2)',32768,208,1,0,3,0,'не(([20811033] in(241,530,251))   и (([20811170] is not null) или (ЕстьПодстрока([20811167],Константа(30,45,8),"9.9.9")))   или ([20811167] between 500 and 599)   или (([20811163] is not null) и (tonumber([20811164],1) <> 0))   )',0,1,'Блокировка поля "Получатель субсидии" для документов, не относящихся к передаче субсидий. Для редактирования получателя субсидии требуется, чтобы ЭКР =(241 или 530) и (был непустой код субсидии либо КВР находился в диапазоне кодов (задается константой), разрешенных для  финансирования на БУ, АУ ).',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования получателя субсидии(2)', 208, 1, 0, 1) ;

-- Поле "Получатель субсидии(КПП)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',208,1,20811182,1) ;

-- Поле "Получатель субсидии(ИНН)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',208,1,20811181,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',208,1,20811180,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',208,1,20811179,1) ;

CALL DOCLOCK_IMPORT('Проверка заполненности лицевого счета',0,209,0,0,10,0,'(Константа(32,46,3) = 0) или ((Константа(32,46,3) = 1) и (([20910012] is not null) и ([20910012] <> 0)))',0,3,'Проверка на заполненность лицевого счета владельца документа. Проверяется в случае, если константа "Обязательность указания лицевого счета в заголовке" равна 1.',0,'Должен быть указан ненулевой лицевой счет',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка заполненности лицевого счета', 209, 0, 0, 1) ;

-- Поле "Л\С владельца документа"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка заполненности лицевого счета',209,0,20910012,1) ;

CALL DOCLOCK_IMPORT('Запрет изменения типа классификации',0,209,0,0,9,0,'ПолеНеПустое([20910013])?(Количество([20911041])=0):1',0,3,'Запрет изменения типа классификации для документов с заполненной детализацией',0,'Нельзя изменять тип классификации у документа с введенной детализацией',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет изменения типа классификации', 209, 0, 0, 1) ;

-- Поле "Тип классификации"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет изменения типа классификации',209,0,20910003,1) ;

CALL DOCLOCK_IMPORT('Фильтр справочника л/с детали по л/с заголовка',0,209,2,0,11,0,'[20910012] > 0',0,3,'Лицевой счет в детализации фильтруется в зависимости от л/с владельца, указанного в заголовке. Если л/с в заголовке пустой, то доступны все счета, иначе только подведомстенные либо лицевой счет, указанный в заголовке.',0,'Указанный лицевой счет не является подведомственным счетом организации владельца',null,'[984110018]=Разыменовать("Лицевой_Счет.ОрганизацияВладелец",Документ.[20910012])
или [984110021]=Документ.[20910012]',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр справочника л/с детали по л/с заголовка', 209, 2, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр справочника л/с детали по л/с заголовка',209,2,20912007,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду ассигнований',0,209,2,0,11,0,'[20912044] <> 0',0,1,'Если в справочнике кода БА указан вид ассигнований, вид ассигнований документа должен ему соответствовать',0,'Указанный вид ассигнований не может использоваться для данного кода БА',null,'(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20912044]) = 0) или
(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20912044]) = [988510003]) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20912044]) mod 100) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20912044]) div 100) = ([988510003] div 100))) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20912044]) mod 10000) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[20912044]) div 10000) = ([988510003] div 10000)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду ассигнований', 209, 2, 0, 1) ;

-- Поле "Вид ассигнований"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду ассигнований',209,2,20912001,1) ;

CALL DOCLOCK_IMPORT('Фильтр по характеру л/с(2)',0,209,2,0,11,0,'(Константа(32,39,3)=0) и (Константа(32,27,3) <> 1)',0,3,'Фильтр по характеру л/с в детализации. В случае, если ведение ПОФ по самостоятельным л\с запрещено, допускается использовать только подведомственные л\с.',0,'Лицевой счет должен быть подведомственным',null,'[984110044] = 0',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по характеру л/с(2)', 209, 2, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по характеру л/с(2)',209,2,20912007,1) ;

CALL DOCLOCK_IMPORT('Фильтр по характеру л/с(1)',0,209,2,0,11,0,'(Константа(32,39,3)=0) и (Константа(32,27,3) <> 1)',0,3,'Фильтр по характеру л/с в детализации. В случае ведение ПОФ по самостоятельным л\с разрешено, допускается использовать только подведомственные и самостоятельные л\с.',0,'Лицевой счет должен быть подведомственным или самостоятельным',null,'([984110042] = 1) или ([984110041] = 1) или ([984110045] = 1) или  ([984110043] = 1)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по характеру л/с(1)', 209, 2, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по характеру л/с(1)',209,2,20912007,1) ;

CALL DOCLOCK_IMPORT('Фильтр для ограничения использования л/с БУ,АУ',0,209,2,0,11,0,'',0,3,'Для использования л\с, открытых бюджетным, автономным учреждениям предназначен интерфейс сведений о субсидиях',0,'Лицевые счета с характером л/с БУ, АУ, отдельный л/с БУ, АУ, л/с ОМС не могут использоваться на данном интерфейсе',null,'([984110041]=0)и([984110045]=0)и([984110046]=0)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр для ограничения использования л/с БУ,АУ', 209, 2, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр для ограничения использования л/с БУ,АУ',209,2,20912007,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по получению,передаче',0,209,2,0,11,0,'',0,1,'При доходной классификации справочник кодов целевых средств фильтруется по признаку "получение", при расходной - по признаку "передача"',0,'Нельзя выбирать код целевых средств с признаком "передача" при доходной классификации и код целевых средств с признаком "поступление" при расходной',null,'((Документ.[20912032]=2) и ([988410016] = 0)) 
или
((Документ.[20912032]=0) и ([988410016] = 1))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по получению,передаче', 209, 2, 0, 1) ;

-- Поле "Код целевых средств (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по получению,передаче',209,2,20912035,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по расходной БК',0,209,2,0,11,0,'[20912032] = 0',0,1,'При расходной классификации справочник кодов целевых средств фильтруется по КВСР, ФКР, КВР, КЦСР, ЭКР. Классификатор не считается различающимся, если в документе для данного классификатора прописано нулевое значение, а в справочнике ненулевое или наоборот',0,'Код целевых средств не соответствует расходной классификации документа',null,'(([988410025] = 0) или (Документ.[20912039] = 0) или (Документ.[20912020] = [988410026]))
и
(([988410022] = 0) или (Документ.[20912018] = 0) или (Документ.[20912018] = [988410022]))
и
(([988410023] = 0) или (Документ.[20912038] = 0) или (Документ.[20912019] = [988410024]))
и
(([988410018] = 0) или (Документ.[20912037] = 0) или (Документ.[20912016] = [988410019]))
и
(([988410021] = 0) или (Документ.[20912017] = 0) или (Документ.[20912017] = [988410021]))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по расходной БК', 209, 2, 0, 1) ;

-- Поле "Код целевых средств (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по расходной БК',209,2,20912035,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду субсидии',0,209,2,0,11,0,'Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[20912007])  или Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС",[20912007])',0,1,'Для учредителей(организации с видом ФО, ГРБС, РБС) доступны только субсидии этого учредителя плюс все субсидии финансового органа.  Для остальных вледельцев л\с ПБС субсидии недоступны. Для распорядительных л\с ГРБСа также доступны субсидии его РБСов.',0,'Указанный код субсидии не может использоваться для данного лицевого счета',null,'(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",Документ.[20912007]) between 10000 и 10499)
и
((Разыменовать("Организация.ВидОрганизации",[988910008]) between 10100 и 10199)
или
([988910008] = Разыменовать("Лицевой_Счет.ОрганизацияВладелец",Документ.[20912007]))
или ((Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС",Документ.[20912007])<>0)
     и (Разыменовать("Лицевой_Счет.ЭтоЛСПБС",Документ.[20912007])=0)
     и(Разыменовать("Организация.Распорядитель",[988910008])= Разыменовать("Лицевой_Счет.ОрганизацияВладелец",Документ.[20912007])))
)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду субсидии', 209, 2, 0, 1) ;

-- Поле "Код субсидии (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду субсидии',209,2,20912036,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду субсидии для БУ,АУ',0,209,2,0,11,0,'Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[20912007])  или Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",[20912007])  или Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",[20912007])',0,3,'Бюджетным, автономным учреждениям доступны только субсидии у которых учредитель=организации-распорядителю л\с, либо учредитель=ФО.  Для отдельных л\с БУ\АУ, доступны только субсидии с видом<>госзадания. Для прочих л\с БУ\АУ доступны только коды субсидий на госзадания.',0,'Указанный код субсидии не может использоваться для данного лицевого счета',null,'([988910008] = Разыменовать("Лицевой_Счет.Распорядитель",Документ.[20912007])
или (Разыменовать("Организация.ВидОрганизации",[988910008]) between 10100 и 10199))
и   
((не Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[20912007])
и ([988910010] = 0))
или
(Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[20912007])
и ([988910010] <> 0)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду субсидии для БУ,АУ', 209, 2, 0, 1) ;

-- Поле "Код субсидии (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду субсидии для БУ,АУ',209,2,20912036,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования организации',32768,209,2,0,3,0,'',0,1,'Запрет редактирования организации',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования организации', 209, 2, 0, 1) ;

-- Поле "Организация"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',209,2,20912024,1) ;

-- Поле "Наименование(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',209,2,20912022,1) ;

-- Поле "КПП(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',209,2,20912015,1) ;

-- Поле "ИНН(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',209,2,20912014,1) ;

CALL DOCLOCK_IMPORT('По источниковой классификации',32768,209,2,0,3,0,'[20912032] = 1',0,1,'Блокировка поля "Код целевых средств" при источниковой классификации',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По источниковой классификации', 209, 2, 0, 1) ;

-- Поле "Код целевых средств"
CALL DOCLOCKFIELDS_INSERTFIELD('По источниковой классификации',209,2,20912031,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования кода субсидии',32768,209,2,0,3,0,'не((Разыменовать("Организация.ВидОрганизации.Код",[20910021]) between 10800 и 10999)    или(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[20912007]) between 10800 и 10999)     или((Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[20912007]) between 10000 и 10499)     и не(КодИнтерфейса=204) ))',0,1,'Блокировка поля "Код субсидии" для л\с с видом организации-владельца вне диапазона 01.08.00-01.09.99 либо 01.01.00-01.04.99 (не финорганы, не распорядители, не бюдж.(авт.) учреждения). Для смет по ПД код субсидии не блокируется только для БУ,АУ',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования кода субсидии', 209, 2, 0, 1) ;

-- Поле "Код субсидии"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования кода субсидии',209,2,20912040,1) ;

CALL DOCLOCK_IMPORT('Запрет изменения типа классификации',0,210,0,0,9,0,'ПолеНеПустое([21010015])?(Количество([21011011])=0):1',0,3,'Запрет изменения типа классификации для документов с заполненной детализацией',0,'',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет изменения типа классификации', 210, 0, 0, 1) ;

-- Поле "Тип классификации"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет изменения типа классификации',210,0,21010005,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по расходной БК',0,210,2,0,11,0,'[21010005] = 0',0,1,'При расходной классификации справочник кодов целевых средств фильтруется по КВСР, ФКР, КВР, КЦСР, ЭКР. Классификатор не считается различающимся, если в документе для данного классификатора прописано нулевое значение, а в справочнике ненулевое или наоборот',0,'Код целевых средств не соответствует расходной классификации документа',null,'(([988410025] = 0) или (Документ.[21012020] = 0) или (Документ.[21012021] = [988410026]))
и
(([988410022] = 0) или (Документ.[21012017] = 0) или (Документ.[21012017] = [988410022]))
и
(([988410023] = 0) или (Документ.[21012018] = 0) или (Документ.[21012019] = [988410024]))
и
(([988410018] = 0) или (Документ.[21012013] = 0) или (Документ.[21012014] = [988410019]))
и
(([988410021] = 0) или (Документ.[21012015] = 0) или (Документ.[21012015] = [988410021]))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по расходной БК', 210, 2, 0, 1) ;

-- Поле "Код целевых средствКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по расходной БК',210,2,21012045,1) ;

CALL DOCLOCK_IMPORT('По источниковой классификации',32768,210,2,0,3,0,'[21012004] = 1',0,1,'Блокировка поля "Код целевых средств" при источниковой классификации',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По источниковой классификации', 210, 2, 0, 1) ;

-- Поле "Код целевых средств"
CALL DOCLOCKFIELDS_INSERTFIELD('По источниковой классификации',210,2,21012046,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования кода субсидии',32768,210,2,0,3,0,'не((Разыменовать("Организация.ВидОрганизации.Код",[21010021]) between 10800 и 10999)  или (Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[21010014]) between 10000 и 10499))',0,1,'Блокировка поля "Код субсидии" для л\с с видом организации-владельца вне диапазона 01.08.00-01.09.99 либо 01.01.00-01.04.99 (не финорганы, не распорядители, не бюдж.(авт.) учреждения). Для смет по ПД код субсидии не блокируется только для БУ,АУ',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования кода субсидии', 210, 2, 0, 1) ;

-- Поле "Код субсидии"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования кода субсидии',210,2,21012052,1) ;

CALL DOCLOCK_IMPORT('Запрет изменения типа классификации',0,211,0,0,9,0,'ПолеНеПустое([21110011])?(Количество([21111034])=0):1',0,3,'Запрет изменения типа классификации для документов с заполненной детализацией',0,'Нельзя изменять тип классификации у документа с введенной детализацией',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет изменения типа классификации', 211, 0, 0, 1) ;

-- Поле "Тип классификации"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет изменения типа классификации',211,0,21110003,1) ;

CALL DOCLOCK_IMPORT('Фильтр характера лс распорядительный',0,211,0,0,11,0,'',0,1,'Допустимы только распорядительные лицевые счета',0,'На данном интерфейсе может быть выбран только распорядительный лицевой счет',null,'([984110044]=1)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр характера лс распорядительный', 211, 0, 0, 1) ;

-- Поле "Л\С владельца документа"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр характера лс распорядительный',211,0,21110010,1) ;

CALL DOCLOCK_IMPORT('Фильтр справочника л/с детали по л/с заголовка',0,211,2,0,11,0,'[21110010] > 0',0,3,'Лицевой счет в детализации фильтруется в зависимости от л/с владельца, указанного в заголовке. Если л/с в заголовке пустой, то доступны все счета, иначе только подведомстенные либо лицевой счет, указанный в заголовке.',0,'Указанный лицевой счет не является подведомственным счетом организации владельца',null,'[984110018]=Разыменовать("Лицевой_Счет.ОрганизацияВладелец",Документ.[21110010])
или [984110021]=Документ.[21110010]',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр справочника л/с детали по л/с заголовка', 211, 2, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр справочника л/с детали по л/с заголовка',211,2,21112006,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду ассигнований',0,211,2,0,11,0,'[21112037] <> 0',0,1,'Если в справочнике кода БА указан вид ассигнований, вид ассигнований документа должен ему соответствовать',0,'Указанный вид ассигнований не может использоваться для данного кода БА',null,'(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21112037]) = 0) или
(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21112037]) = [988510003]) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21112037]) mod 100) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21112037]) div 100) = ([988510003] div 100))) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21112037]) mod 10000) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21112037]) div 10000) = ([988510003] div 10000)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду ассигнований', 211, 2, 0, 1) ;

-- Поле "Вид ассигнований"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду ассигнований',211,2,21112004,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду субсидии',0,211,2,0,11,0,'Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[21112006])  или Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС",[21112006])',0,1,'Для учредителей(организации с видом ФО, ГРБС, РБС) доступны только субсидии этого учредителя плюс все субсидии финансового органа. ',0,'Указанный код субсидии не может использоваться для данного лицевого счета',null,'(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",Документ.[21112006]) between 10000 и 10499)
и
((Разыменовать("Организация.ВидОрганизации",[988910008]) between 10100 и 10199)
или
([988910008] = Разыменовать("Лицевой_Счет.ОрганизацияВладелец",Документ.[21112006]))
или ((Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС",Документ.[21112006])<>0)
     и (Разыменовать("Лицевой_Счет.ЭтоЛСПБС",Документ.[21112006])=0)
     и(Разыменовать("Организация.Распорядитель",[988910008])= Разыменовать("Лицевой_Счет.ОрганизацияВладелец",Документ.[21112006])))
)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду субсидии', 211, 2, 0, 1) ;

-- Поле "Код субсидии (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду субсидии',211,2,21112029,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду субсидии для БУ,АУ',0,211,2,0,11,0,'Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[21112006])  или Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",[21112006])  или Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",[21112006])',0,3,'Бюджетным, автономным учреждениям доступны только субсидии у которых учредитель=организации-распорядителю л\с, либо учредитель=ФО. ',0,'Указанный код субсидии не может использоваться для данного лицевого счета',null,'([988910008] = Разыменовать("Лицевой_Счет.Распорядитель",Документ.[21112006])
или (Разыменовать("Организация.ВидОрганизации",[988910008]) between 10100 и 10199))
и   
((не Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[21112006])
и ([988910010] = 0))
или
(Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[21112006])
и ([988910010] <> 0)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду субсидии для БУ,АУ', 211, 2, 0, 1) ;

-- Поле "Код субсидии (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду субсидии для БУ,АУ',211,2,21112029,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по расходной БК',0,211,2,0,11,0,'[21112003] = 0',0,1,'При расходной классификации справочник кодов целевых средств фильтруется по КВСР, ФКР, КВР, КЦСР, ЭКР. Классификатор не считается различающимся, если в документе для данного классификатора прописано нулевое значение, а в справочнике ненулевое или наоборот',0,'Код целевых средств не соответствует расходной классификации документа',null,'(([988410025] = 0) или (Документ.[21112031] = 0) или (Документ.[21112019] = [988410026]))
и
(([988410022] = 0) или (Документ.[21112017] = 0) или (Документ.[21112017] = [988410022]))
и
(([988410023] = 0) или (Документ.[21112030] = 0) или (Документ.[21112018] = [988410024]))
и
(([988410018] = 0) или (Документ.[21112032] = 0) или (Документ.[21112015] = [988410019]))
и
(([988410021] = 0) или (Документ.[21112016] = 0) или (Документ.[21112016] = [988410021]))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по расходной БК', 211, 2, 0, 1) ;

-- Поле "Код целевых средств (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по расходной БК',211,2,21112028,1) ;

CALL DOCLOCK_IMPORT('По источниковой классификации',32768,211,2,0,3,0,'[21112003] = 1',0,1,'Блокировка поля "Код целевых средств" при источниковой классификации',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По источниковой классификации', 211, 2, 0, 1) ;

-- Поле "Код целевых средств"
CALL DOCLOCKFIELDS_INSERTFIELD('По источниковой классификации',211,2,21112002,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования кода субсидии',32768,211,2,0,3,0,'не((Разыменовать("Организация.ВидОрганизации.Код",[21110019]) between 10800 и 10999)    или(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[21112006]) between 10800 и 10999)     или((Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[21112006]) between 10000 и 10499)     и не(КодИнтерфейса=204) ))',0,1,'Блокировка поля "Код субсидии" для л\с с видом организации-владельца вне диапазона 01.08.00-01.09.99 либо 01.01.00-01.04.99 (не финорганы, не распорядители, не бюдж.(авт.) учреждения). Для смет по ПД код субсидии не блокируется только для БУ,АУ',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования кода субсидии', 211, 2, 0, 1) ;

-- Поле "Код субсидии"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования кода субсидии',211,2,21112033,1) ;

CALL DOCLOCK_IMPORT('Фильтр для ограничения использования л/с БУ,АУ',0,211,2,0,11,0,'',0,1,'Допустимы только распорядительные лицевые счета',0,'На данном интерфейсе может быть выбран только распорядительный лицевой счет',null,'([984110044]=1)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр для ограничения использования л/с БУ,АУ', 211, 2, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр для ограничения использования л/с БУ,АУ',211,2,21112006,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по получению,передаче',0,211,2,0,11,0,'',0,1,'При доходной классификации справочник кодов целевых средств фильтруется по признаку "получение", при расходной - по признаку "передача"',0,'Нельзя выбирать код целевых средств с признаком "передача" при доходной классификации и код целевых средств с признаком "поступление" при расходной',null,'((Документ.[21112003]=2) и ([988410016] = 0)) 
или
((Документ.[21112003]=0) и ([988410016] = 1))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по получению,передаче', 211, 2, 0, 1) ;

-- Поле "Код целевых средств (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по получению,передаче',211,2,21112028,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования организации',32768,211,2,0,3,0,'',0,1,'Запрет редактирования организации',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования организации', 211, 2, 0, 1) ;

-- Поле "Организация"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',211,2,21112023,1) ;

-- Поле "Наименование(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',211,2,21112021,1) ;

-- Поле "КПП(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',211,2,21112014,1) ;

-- Поле "ИНН(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',211,2,21112013,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду ассигнований',0,212,2,0,11,0,'[21212038] <> 0',0,1,'Если в справочнике кода БА указан вид ассигнований, вид ассигнований документа должен ему соответствовать',0,'Указанный вид ассигнований не может использоваться для данного кода БА',null,'(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21212038]) = 0) или
(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21212038]) = [988510003]) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21212038]) mod 100) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21212038]) div 100) = ([988510003] div 100))) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21212038]) mod 10000) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[21212038]) div 10000) = ([988510003] div 10000)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду ассигнований', 212, 2, 0, 1) ;

-- Поле "Вид ассигнований"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду ассигнований',212,2,21212004,1) ;

CALL DOCLOCK_IMPORT('Фильтр по л/с для распорядителей',0,212,2,0,11,0,'(Разыменовать("Организация.ВидОрганизации.Код",[21210019]) between 10000 and 10499)',0,3,'Фильтр по организации-распорядителю л\с. Организацией-распорядителем л\с должна быть организация из заголовка',0,'Организацией-распорядителем л\с должна быть организация из заголовка',null,'([984110018]=Документ.[21210019])',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по л/с для распорядителей', 212, 2, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по л/с для распорядителей',212,2,21212006,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности для БУ, АУ',0,212,2,0,11,0,'Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[21212006])  или Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",[21212006])  или Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",[21212006])',0,1,'Для л\с БУ, АУ допустимыми являются типы средств с видами деятельности 2,3,4,7,8; ',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'(Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",Документ.[21212006])
и (([984910001] between 2 и 4)или([984910001] between 7 и 8)))
или
(Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",Документ.[21212006])
и ([984910001] between 7 и 8))
или
(Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[21212006])
и (([984910001] between 5 и 6)или([984910001] = 9)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности для БУ, АУ', 212, 2, 0, 1) ;

-- Поле "Тип средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности для БУ, АУ',212,2,21212020,1) ;

CALL DOCLOCK_IMPORT('Фильтр для ограничения нецелевых л/с БУ, АУ ',0,212,2,0,11,0,'не(Разыменовать("ЕстьЛицензия.ДопУчетБУАУ",КодИнтерфейса))',0,3,'Для использования л\с с характером л\с БУ,АУ, л\с ОМС  требуется наличие блока "Доп. учет БУ, АУ"',0,'Лицевые счета с характером л/с БУ, АУ, л/с ОМС не могут использоваться на данном интерфейсе',null,'([984110041]=0)и([984110046]=0)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр для ограничения нецелевых л/с БУ, АУ ', 212, 2, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр для ограничения нецелевых л/с БУ, АУ ',212,2,21212006,1) ;

CALL DOCLOCK_IMPORT('По источниковой классификации',32768,212,2,0,3,0,'[21212003] = 1',0,1,'Блокировка поля "Код целевых средств" при источниковой классификации',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По источниковой классификации', 212, 2, 0, 1) ;

-- Поле "Код целевых средств"
CALL DOCLOCKFIELDS_INSERTFIELD('По источниковой классификации',212,2,21212002,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования кода субсидии',32768,212,2,0,3,0,'не((Разыменовать("Организация.ВидОрганизации.Код",[21210019]) between 10800 и 10999)    или(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[21212006]) between 10800 и 10999)     или((Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[21212006]) between 10000 и 10499)     и не(КодИнтерфейса=204) ))',0,1,'Блокировка поля "Код субсидии" для л\с с видом организации-владельца вне диапазона 01.08.00-01.09.99 либо 01.01.00-01.04.99 (не финорганы, не распорядители, не бюдж.(авт.) учреждения). Для смет по ПД код субсидии не блокируется только для БУ,АУ',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования кода субсидии', 212, 2, 0, 1) ;

-- Поле "Код субсидии"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования кода субсидии',212,2,21212033,1) ;

CALL DOCLOCK_IMPORT('Фильтр по характеру л/с',0,212,2,0,11,0,'',0,1,'Фильтр по характеру л/с в детализации. ',0,'Лицевой счет должен быть с характером л/с БУ, АУ, отдельный л/с БУ, АУ или л/с ОМС',null,'([984110041] <> 0) или ([984110045] <> 0) или ([984110046] <> 0)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по характеру л/с', 212, 2, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по характеру л/с',212,2,21212006,1) ;

CALL DOCLOCK_IMPORT('Фильтр по владельцу л/с',0,212,2,0,11,0,'',0,1,'Фильтр по организации-владельцу л\с. Организация-владелец лицевого счета должна иметь вид организации в диапазоне от 01.08.00 до 01.10.99',0,'Организация-владелец лицевого счета должна быть быть бюджетным (автономным) учреждением либо МУП(ГУП)',null,'(Разыменовать("Организация.ВидОрганизации.Код",[984110031]) between 10800 and 11099)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по владельцу л/с', 212, 2, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по владельцу л/с',212,2,21212006,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования организации',32768,212,2,0,3,0,'',0,1,'Запрет редактирования организации',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования организации', 212, 2, 0, 1) ;

-- Поле "Организация"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',212,2,21212023,1) ;

-- Поле "Наименование(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',212,2,21212021,1) ;

-- Поле "КПП(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',212,2,21212014,1) ;

-- Поле "ИНН(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',212,2,21212013,1) ;

CALL DOCLOCK_IMPORT('Проверка контрольной суммы',0,300,0,0,9,0,'(ЕстьИзмененияВДокументе(1)?  (   (([30010015]-Сумма([30011016]))<0.005)   и((Сумма([30011016])-[30010015])<0.005)  ):  (   (([30010015]- Разыменовать("Таблица.FACIALFINDETAIL[CREDIT,RecordIndex].{SUM(CREDIT)}",ЗадатьФильтр("RecordIndex=" + [30010022])))<0.005)   и((Разыменовать("Таблица.FACIALFINDETAIL[CREDIT,RecordIndex].{SUM(CREDIT)}",ЗадатьФильтр("RecordIndex=" + [30010022]))-[30010015])<0.005)  ) ) или([30010001] is null)',0,3,'Проверка равенства суммы записи заголовка и суммы детализации',0,'Cуммы не совпадают с контрольной',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка контрольной суммы', 300, 0, 0, 1) ;

-- Поле "Дата принятия"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка контрольной суммы',300,0,30010001,1) ;

CALL DOCLOCK_IMPORT('Фильтр справочника лицевых счетов по характеру(2)',0,300,0,0,11,0,'(КодИнтерфейса<>323) и (Разыменовать("Р/с.ДляБУ_АУ",[30010021]) = 0) и  не ((Разыменовать("Р/с.ДляАУ",[30010021]) <> 0) и Константа(30,44,3) = 1) и  (Разыменовать("Р/с.ДляСВРБУ_АУ",[30010021]) = 0) и (Разыменовать("Р/с.ДляГУП_МУП",[30010021]) = 0)',0,1,'Если в качестве счета финоргана выбран расчетный счет не для бюджетных(автономных) учреждений, то допустимы самостоятельные, подведомственные, распорядителльные л/c и л/c по переданным полномочиям',0,'Для данного расчетного счета выбор лицевых счетов с характером "БУ, АУ" или "Отдельный БУ, АУ" недопустим',null,'не(([984110041] = 1) или ([984110045] = 1) или ([984110046]=1)) и
не( ([984110044] = 0) и ([984110042] = 0) и ([984110043] = 0) )',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр справочника лицевых счетов по характеру(2)', 300, 0, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр справочника лицевых счетов по характеру(2)',300,0,30010008,1) ;

CALL DOCLOCK_IMPORT('Фильтр справочника лицевых счетов по характеру',0,300,0,0,11,0,'(Разыменовать("Р/с.ДляСВР",[30010021]) = 0)и (Разыменовать("Р/с.Бюджетный",[30010021])=0)',0,1,'Если в качестве счета финоргана выбран расчетный счет для  БУ или АУ, то разрешены л/c с харакетром "БУ, АУ" или "Отдельный БУ, АУ" или "ОМС"',0,'Для данного расчетного счета выбор подведомственных, распорядительных, самостоятельных лицевых счетов и лицевых счетов по переданным полномочиям недопустим',null,'не(([984110042] = 1) или ([984110044] = 1) или ([984110043] = 1)) и
не( ([984110044] = 0) и ([984110042] = 0) и ([984110041] = 0) и 
    ([984110045] = 0) и ([984110046] = 0) и ([984110043] = 0) )',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр справочника лицевых счетов по характеру', 300, 0, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр справочника лицевых счетов по характеру',300,0,30010008,1) ;

CALL DOCLOCK_IMPORT('Фильтр справочника лицевых счетов по характеру(3)',0,300,0,0,11,0,'(Разыменовать("Р/с.ДляГУП_МУП",[30010021]) = 1) и  (Разыменовать("Р/с.ДляАУ",[30010021]) = 0) и  (Разыменовать("Р/с.ДляБУ_АУ",[30010021]) = 0) и (Разыменовать("Р/с.ДляСВР",[30010021]) = 0) и (Разыменовать("Р/с.Бюджетный",[30010021])=0)',0,1,'Если в качестве счета финоргана выбран расчетный счет для ГУП/МУП, то разрешены л/c, открытые организациям с видом организации ГУП(МУП)',0,'Для данного расчетного счета допустим только выбор счетов организаций ГУП(МУП)',null,'(Разыменовать("Организация.ВидОрганизации",[984110031]) between 011000 and 011099)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр справочника лицевых счетов по характеру(3)', 300, 0, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр справочника лицевых счетов по характеру(3)',300,0,30010008,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по КД',0,300,1,0,11,0,'([30011019] = 2) и  (((КодИнтерфейса <> 305) и (КодИнтерфейса <> 302)) или   не(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации",[30010008]) between 010800 and 011099))',0,3,'При доходной классификации справочник кодов целевых средств фильтруется по коду дохода, исключая записи с бюджетными/автономными учреждениями, МУП(ГУП) на интерфейсах Приход от прочих и Расход по п/п. Допустимы для выбора КЦС с 0-вым кодом дохода, КЦС с таким же кодом дохода, как в документе, а также КЦС с 0-вым администратором и таким же (как в документе) видом дохода, подвидом, ЭКД. Если в документе  указан код дохода, применяемый для возврата трансфертов, то допустимы для выбора любые КЦС поступления.',0,'Код целевых средств не соответствует доходной классификации',null,'([988410006] = 0) или (Документ.[30011025] = 0) или (Документ.[30011034] = [988410008])
или ((Разыменовать("КДКлюч.КВСР.Код",[988410006])=0)
   и(Разыменовать("КДКлюч.ВидДохода",[988410006])=Разыменовать("КДКлюч.ВидДохода",Документ.[30011025]))
   и((Разыменовать("КДКлюч.Программа",[988410006])=Разыменовать("КДКлюч.Программа",Документ.[30011025]))
     или(Разыменовать("КДКлюч.Программа",[988410006])=0))
   и(Разыменовать("КДКлюч.КЭСР",[988410006])=Разыменовать("КДКлюч.КЭСР",Документ.[30011025])))
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[30011025]) div 100000) between 218 and 219) 
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[30011025]) div 1000) = 11302)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по КД', 300, 1, 0, 1) ;

-- Поле "Код целевых средств (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по КД',300,1,30011018,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности',0,300,1,0,11,0,'(Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[30010008])   или Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС",[30010008])) и не(КодИнтерфейса in(0323,0324))',0,1,'Для л\с ПБС и распорядительных л\с допустимыми являются типы средств с видами деятельности 1,2,3',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'[984910001] between 1 и 3',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности', 300, 1, 0, 1) ;

-- Поле "Тип средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности',300,1,30011035,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования кода субсидии',32768,300,1,0,3,0,'не((Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[30010008]) between 10800 и 11099)    или(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[30010008]) between 10000 и 10499)   или(КодИнтерфейса in(0323,0324)))',0,1,'Блокировка поля "Код субсидии" для лицевых счетов с видом организации-владельца вне диапазона 01.08.00-01.10.99 либо 01.01.00-01.04.99 (не финорганы, не распорядители, не бюджетные(автономные) учреждения, не ГУП (МУП)). Не блокируем документы 3.23,3.24(перекрыто)',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования кода субсидии', 300, 1, 0, 1) ;

-- Поле "Код субсидии"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования кода субсидии',300,1,30011022,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств получ. по КД',0,301,1,0,11,0,'[30110110] = 2',0,3,'При доходной классификации справочник кодов целевых средств фильтруется по коду дохода. Допустимы для выбора КЦС с 0-вым кодом дохода, КЦС с таким же кодом дохода, как в документе, а также КЦС с 0-вым администратором и таким же (как в документе) видом дохода, подвидом, ЭКД. Если в документе  указан код дохода, применяемый для возврата трансфертов, то допустимы для выбора любые КЦС поступления.',0,'Код целевых средств не соответствует доходной классификации',null,'([988410006] = 0) или (Документ.[30111122] = 0) или (Документ.[30111130] = [988410008])
или ((Разыменовать("КДКлюч.КВСР.Код",[988410006])=0)
   и(Разыменовать("КДКлюч.ВидДохода",[988410006])=Разыменовать("КДКлюч.ВидДохода",Документ.[30111122]))
   и((Разыменовать("КДКлюч.Программа",[988410006])=Разыменовать("КДКлюч.Программа",Документ.[30111122]))
     или(Разыменовать("КДКлюч.Программа",[988410006])=0))
   и(Разыменовать("КДКлюч.КЭСР",[988410006])=Разыменовать("КДКлюч.КЭСР",Документ.[30111122])))
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[30111122]) div 100000) between 218 and 219)
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[30111122]) div 1000) = 11302)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств получ. по КД', 301, 1, 0, 1) ;

-- Поле "Код целевых средств получ.Ключ"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств получ. по КД',301,1,30111136,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности (получ.)',0,301,1,0,11,0,'Разыменовать("Лицевой_Счет.ЭтоЛСПБС", [30111014]) или Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС",[30111014])',0,1,'Для л\с ПБС и распорядительных л\с допустимыми являются типы средств с видами деятельности 1,2,3',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'[984910001] between 1 и 3',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности (получ.)', 301, 1, 0, 1) ;

-- Поле "Тип средств получ-ля"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности (получ.)',301,1,30111023,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности для БУ, АУ (получ.)',0,301,1,0,11,0,'Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[30111014]) или Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",[30111014]) или Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",[30111014])',0,1,'Для л\с БУ, АУ допустимыми являются типы средств с видами деятельности 2,3,4,7,8;  для отдельных л\с БУ,АУ допустимы типы средств с видами деятельности 5,6,9;  для л\с ОМС допустимы типы средств в видами деятельности 7 или 8.',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'(Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",Документ.[30111014])
и (([984910001] between 2 и 4)или([984910001] between 7 и 8)))
или
(Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",Документ.[30111014])
и ([984910001] between 7 и 8))
или
(Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[30111014])
и (([984910001] between 5 и 6)или([984910001] = 9)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности для БУ, АУ (получ.)', 301, 1, 0, 1) ;

-- Поле "Тип средств получ-ля"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности для БУ, АУ (получ.)',301,1,30111023,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования кода субсидии получателя',32768,301,1,0,3,0,'не((Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[30111014]) between 10800 и 11099)  или  (Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[30111014]) between 10000 и 10499) )',0,1,'Блокировка поля "Код субсидии получателя" для л\с получателя с видом организации-владельца вне диапазона 01.08.00-01.10.99 либо 01.01.00-01.04.99 (не финорганы, не распорядители, не бюджетные(автономные) учреждения, не МУП(ГУП)).',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования кода субсидии получателя', 301, 1, 0, 1) ;

-- Поле "Код субсидии получ-ля"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования кода субсидии получателя',301,1,30111150,1) ;

CALL DOCLOCK_IMPORT('Проверка очередности платежа',0,302,0,0,9,0,'([30210005] >= 1) и ([30210005] <= Константа(11,2,3))',0,3,'Проверка очередности платежа на вхождение в разрешенный диапазон. Значение должно быть от 1 до значения из константы системы Первичные документы\Платежные поручения\Максимальная разрешенная очередность платежа',0,'Значение очередности должно быть в диапазоне от 1 до максимальной разрешенной в константах системы очередности платежа',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка очередности платежа', 302, 0, 0, 1) ;

-- Поле "Очередность платежа"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка очередности платежа',302,0,30210005,1) ;

CALL DOCLOCK_IMPORT('Проверка соотв-вия направления операции и типа БК',0,302,0,0,10,0,'([30210104]=0) и ([30210113] in(0,1)) или ([30210104]=3) и ([30210113] in(1,2))',0,1,'Проверка на соответствие направления операции и типа классификации.  Для Направления операции Расход разрешается только расходная и источниковая классификация.  Для направления операции Возврат разрешается только доходная и источниковая классификации.',0,'Направление операции не соответствует типу классификации',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка соотв-вия направления операции и типа БК', 302, 0, 0, 1) ;

-- Поле "Направление операции"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка соотв-вия направления операции и типа БК',302,0,30210104,1) ;

CALL DOCLOCK_IMPORT('Проверка контрольной суммы',0,302,0,0,9,0,'не ПолеНеПустое([30210122])или  (  (([30210024]-Разыменовать("Таблица.FACIALFINDETAIL[CREDIT,RecordIndex].{SUM(CREDIT)}",ЗадатьФильтр("RecordIndex=" + [30210114])))<0.005)  и((Разыменовать("Таблица.FACIALFINDETAIL[CREDIT,RecordIndex].{SUM(CREDIT)}",ЗадатьФильтр("RecordIndex=" + [30210114]))-[30210024])<0.005) )или  ([30210025] = "") или  ([30210023] is not null)',0,3,'Проверка равенства суммы записи заголовка и суммы детализации',0,'Cуммы не совпадают с контрольной',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка контрольной суммы', 302, 0, 0, 1) ;

-- Поле "Номер реестра"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка контрольной суммы',302,0,30210025,1) ;

CALL DOCLOCK_IMPORT('Проверка соотв-вия направления операции и типа БК',0,304,0,0,10,0,'([30410096]=0) и ([30410104] in(0,1)) или ([30410096]=3) и ([30410104] in(1,2))',0,1,'Проверка на соответствие направления операции и типа классификации.  Для Направления операции Расход разрешается только расходная и источниковая классификация.  Для направления операции Возврат разрешается только доходная и источниковая классификации.',0,'Направление операции не соответствует типу классификации',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка соотв-вия направления операции и типа БК', 304, 0, 0, 1) ;

-- Поле "Направление операции"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка соотв-вия направления операции и типа БК',304,0,30410096,1) ;

CALL DOCLOCK_IMPORT('По отправленности в ФК',32768,304,0,0,3,0,'ПолеНеПустое([30410145])',0,3,'Блокировка поля "Дата проводки" для документов, которые были отправлены в ФК',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По отправленности в ФК', 304, 0, 0, 1) ;

-- Поле "Дата проводки"
CALL DOCLOCKFIELDS_INSERTFIELD('По отправленности в ФК',304,0,30410006,1) ;

CALL DOCLOCK_IMPORT('По виду организации-владельца л\с',32768,304,1,0,3,0,'(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации",[30410017]) < 10800) или (Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации",[30410017]) > 11099)',0,3,'Блокировка поля "Код субсидии" для лицевых счетов с видом организации-владельца вне диапазона 01.08.00-01.10.99.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По виду организации-владельца л\с', 304, 1, 0, 1) ;

CALL DOCLOCK_IMPORT('Ввод документов',2097152,305,-1,0,6,0,'',1,1,'Роль ввода документов. Вводить документы разрешается только указанному списку пользователей.',2,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Ввод документов', 305, -1, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ввод документов',305,-1,30510137,1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ввод документов',305,-1,30510135,1) ;

-- Поле "Заблокировано(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ввод документов',305,-1,30510134,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ввод документов',305,-1,30510136,1) ;

-- Поле "Причина отклонения (комментарий)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ввод документов',305,-1,30510017,1) ;

-- Поле "Причина отклонения"
CALL DOCLOCKFIELDS_INSERTFIELD('Ввод документов',305,-1,30510016,1) ;

-- Поле "Дата проводки"
CALL DOCLOCKFIELDS_INSERTFIELD('Ввод документов',305,-1,30510008,1) ;

CALL DOCLOCK_IMPORT('Проверка соотв-вия направления операции и типа БК',0,305,0,0,10,0,'([30510099]=0) и ([30510114] in(1,2)) или ([30510099]=3) и ([30510114] in(0,1))',0,1,'Проверка на соответствие направления операции и типа классификации.  Для Направления операции Поступление разрешается только доходная и источниковая классификация.  Для направления операции Восстановление расхода разрешается только расходная и источниковая классификации.',0,'Направление операции не соответствует типу классификации',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка соотв-вия направления операции и типа БК', 305, 0, 0, 1) ;

-- Поле "Направление операции"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка соотв-вия направления операции и типа БК',305,0,30510099,1) ;

CALL DOCLOCK_IMPORT('По дате разблокировки',262144,305,0,0,3,0,'[30510136] is not null',0,3,'Если установлена дата разблокировки нельзя редактировать поля признака и причины блокировки',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По дате разблокировки', 305, 0, 0, 1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('По дате разблокировки',305,0,30510135,1) ;

-- Поле "Заблокировано(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('По дате разблокировки',305,0,30510134,1) ;

CALL DOCLOCK_IMPORT('Блокировка даты и причины разблокировки',4194304,305,0,0,3,0,'([30510134]<>1) или (не ПолеНеПустое([30510008]))',0,3,'Блокировка даты и причины разблокировки, если документ не заблокирован или не принят',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Блокировка даты и причины разблокировки', 305, 0, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки',305,0,30510137,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки',305,0,30510136,1) ;

CALL DOCLOCK_IMPORT('Отметки о блокировании\разблокировании поступлений',2228261,305,0,0,4,2,'(Разыменовать("ЕстьЛицензия.ПДД_СВР", 305)   или Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", 305))  и ((Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ", [30510021]) = 1)    или(Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ", [30510021]) = 1)    или(Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС", [30510021]) = 1))  и ([30510114] = 2)',0,1,'Роль блокирования\разблокирования документов.  Разрешается изменение отметок о блокировании\разблокировании только у документов с типом класификации=доходная,  только с лицевыми счетами бюджетных, автономных учреждений и только указанному списку пользователей.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Отметки о блокировании\разблокировании поступлений', 305, 0, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',305,0,30510137,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',305,0,30510136,1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',305,0,30510135,1) ;

-- Поле "Заблокировано(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',305,0,30510134,1) ;

CALL DOCLOCK_IMPORT('Проверка соотв-вия направления операции и типа БК',0,306,0,0,10,0,'([30610011]=0) и ([30610105] in(1,2)) или ([30610011]=3) и ([30610105] in(0,1))',0,1,'Проверка на соответствие направления операции и типа классификации.  Для Направления операции Поступление разрешается только доходная и источниковая классификация.  Для направления операции Восстановление расхода разрешается только расходная и источниковая классификации.',0,'Направление операции не соответствует типу классификации',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка соотв-вия направления операции и типа БК', 306, 0, 0, 1) ;

-- Поле "Направление операции"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка соотв-вия направления операции и типа БК',306,0,30610011,1) ;

CALL DOCLOCK_IMPORT('Проверка карты для р/с',0,306,0,0,10,0,'(Константа(63,1,3) и ([30610144] is null) и ([30610108] is not null))?   (Разыменовать("Таблица.Cards[].{RecordCount}", ЗадатьФильтр("ACCOUNT=" + [30610108])) = 0)     или (Разыменовать("Р/с.лс_АДБ", [30610108]) = [30610002]):   (1 = 1)',0,3,'Проверка существования пластиковой карты для расчетного счета. Ошибка, если номер пласт. карты не заполнен и существуют пласт.катры для р/с и л/с АДБ для р/с не равен л/с получателя',0,'Значение поля "Счет" является счетом корпоративных карт, поэтому поле "Номер карточки" должно быть заполнено',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка карты для р/с', 306, 0, 0, 1) ;

-- Поле "Номер карточки"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка карты для р/с',306,0,30610145,1) ;

CALL DOCLOCK_IMPORT('Отметки о блокировании\разблокировании поступлений',4325413,306,0,0,4,2,'(Разыменовать("ЕстьЛицензия.ПДД_СВР", 306)   или Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", 306))  и ((Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ", [30610002]) = 1)    или(Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ", [30610002]) = 1)    или(Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС", [30610002]) = 1))  и ([30610105] = 2)',0,1,'Роль блокирования\разблокирования документов.  Разрешается изменение отметок о блокировании\разблокировании только у документов с типом класификации=доходная,  только с лицевыми счетами бюджетных, автономных учреждений и только указанному списку пользователей.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Отметки о блокировании\разблокировании поступлений', 306, 0, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',306,0,30610104,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',306,0,30610103,1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',306,0,30610102,1) ;

-- Поле "Заблокировано(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',306,0,30610101,1) ;

CALL DOCLOCK_IMPORT('По дате разблокировки',262144,306,0,0,3,0,'[30610103] is not null',0,3,'Если установлена дата разблокировки нельзя редактировать поля признака и причины блокировки',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По дате разблокировки', 306, 0, 0, 1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('По дате разблокировки',306,0,30610102,1) ;

-- Поле "Заблокировано(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('По дате разблокировки',306,0,30610101,1) ;

CALL DOCLOCK_IMPORT('Блокировка даты и причины разблокировки',1048576,306,0,0,3,0,'([30610101]<>1) или (не ПолеНеПустое([30610010]))',0,3,'Блокировка даты и причины разблокировки, если документ не заблокирован или не принят',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Блокировка даты и причины разблокировки', 306, 0, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки',306,0,30610104,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки',306,0,30610103,1) ;

CALL DOCLOCK_IMPORT('По отправленности в ФК',32768,306,0,0,3,0,'ПолеНеПустое([30610152])',0,3,'Блокировка поля "Дата проводки" для документов, которые были отправлены в ФК',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По отправленности в ФК', 306, 0, 0, 1) ;

-- Поле "Дата проводки"
CALL DOCLOCKFIELDS_INSERTFIELD('По отправленности в ФК',306,0,30610010,1) ;

CALL DOCLOCK_IMPORT('Проверка факта выгрузки реестра при распринятии',0,307,0,0,9,0,'([30710001] = 1) или (КоличествоНеПустых([30711018]) = 0)',0,1,'Проверка при распринятии реестра факта отправки в банк либо федеральное казначейство. Отправленные ранее реестры распринимать запрещено. Отправленным считается реестр, если в него входит хотя бы один выгруженный документ.',0,'Нельзя распринимать реестр, если он был отправлен в банк(федеральное казначейство)',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка факта выгрузки реестра при распринятии', 307, 0, 0, 1) ;

-- Поле "Принятие"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка факта выгрузки реестра при распринятии',307,0,30710001,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств получ (получ,передача)',0,308,1,0,11,0,'',0,1,'При доходной классификации справочник кодов целевых средств фильтруется по признаку "получение", при расходной - по признаку "передача"',0,'Нельзя выбирать код целевых средств с признаком "передача" при доходной классификации и код целевых средств с признаком "поступление" при расходной',null,'(((Документ.[30811007]=2)или
((Документ.[30811007]=1) и (Разыменовать("ИсточникВнутр_ФинансированияКлюч.КЭСР",Документ.[30811094])=0)))
и ([988410016] = 0))
или
((Документ.[30811007]=0) и ([988410016] = 1))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств получ (получ,передача)', 308, 1, 0, 1) ;

-- Поле "Код целевых средствКлюч получ"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств получ (получ,передача)',308,1,30811063,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности (получ.)',0,308,1,0,11,0,'((Константа(30,43,3) <> 0) и    (Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[30811014]) или    Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС", [30811014]))) или ((Константа(30,43,3) = 0) и   (Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[30810064]) или   Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС", [30810064])))',0,1,'Для л\с ПБС и распорядительных л\с допустимыми являются типы средств с видами деятельности 1,2,3',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'[984910001] between 1 и 3',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности (получ.)', 308, 1, 0, 1) ;

-- Поле "Тип средств получателя"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности (получ.)',308,1,30811024,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности для БУ, АУ (получ.)',0,308,1,0,11,0,'((Константа(30,43,3) <> 0) и    (Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[30811014]) или     Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",[30811014]) или     Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",[30811014]))) или ((Константа(30,43,3) = 0) и    (Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ", [30810064]) или     Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",[30810064]) или     Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",[30810064])))',0,1,'Для л\с БУ, АУ допустимыми являются типы средств с видами деятельности 2,3,4,7,8;  для отдельных л\с БУ,АУ допустимы типы средств с видами деятельности 5,6,9;  для л\с ОМС допустимы типы средств в видами деятельности 7 или 8.',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'((Константа(30,43,3) <> 0) и (
(Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",Документ.[30811014])
и (([984910001] between 2 и 4)или([984910001] between 7 и 8)))
или
(Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",Документ.[30811014])
и ([984910001] between 7 и 8))
или
(Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[30811014])
и (([984910001] between 5 и 6)или([984910001] = 9)))
)) 
или
((Константа(30,43,3) = 0) и (
(Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",Документ.[30810064])
и (([984910001] between 2 и 4)или([984910001] between 7 и 8)))
или
(Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",Документ.[30810064])
и ([984910001] between 7 и 8))
или
(Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[30810064])
и (([984910001] between 5 и 6)или([984910001] = 9)))
))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности для БУ, АУ (получ.)', 308, 1, 0, 1) ;

-- Поле "Тип средств получателя"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности для БУ, АУ (получ.)',308,1,30811024,1) ;

CALL DOCLOCK_IMPORT('Фильтр ИФДБ плательщика по поступлению/выбытию',0,308,1,0,11,0,'[30811003] = 1',0,3,'Источник финансирования дефицита бюджета фильтруется по признаку направления выбытия в соотсветствии с указанным в заголовке направлением операции',0,'Для данного направления операции недоступен выбор источника финансирования дефицита бюджета плательщика с таким направлением',null,'((Документ.[30810013] = 0) и ([985210006] = -1)) или
((Документ.[30810013] = 1) и ([985210006] = -1)) или
((Документ.[30810013] = 2) и ([985210006] = 1)) или
((Документ.[30810013] = 3) и ([985210006] = 1))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр ИФДБ плательщика по поступлению/выбытию', 308, 1, 0, 1) ;

-- Поле "Источниковая классификация(Классификация плательщика)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр ИФДБ плательщика по поступлению/выбытию',308,1,30811098,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств получ. по КД',0,308,1,0,11,0,'[30811003] = 2',0,1,'При доходной классификации справочник кодов целевых средств фильтруется по коду дохода. Допустимы для выбора КЦС с 0-вым кодом дохода, КЦС с таким же кодом дохода, как в документе, а также КЦС с 0-вым администратором и таким же (как в документе) видом дохода, подвидом, ЭКД. Если в документе  указан код дохода, применяемый для возврата трансфертов, то допустимы для выбора любые КЦС поступления.',0,'Код целевых средств не соответствует доходной классификации',null,'([988410006] = 0) или (Документ.[30811019] = 0) или (Документ.[30811093] = [988410008]) 
или ((Разыменовать("КДКлюч.КВСР.Код",[988410006])=0)
   и(Разыменовать("КДКлюч.ВидДохода",[988410006])=Разыменовать("КДКлюч.ВидДохода",Документ.[30811019]))
   и((Разыменовать("КДКлюч.Программа",[988410006])=Разыменовать("КДКлюч.Программа",Документ.[30811019]))
     или(Разыменовать("КДКлюч.Программа",[988410006])=0))
   и(Разыменовать("КДКлюч.КЭСР",[988410006])=Разыменовать("КДКлюч.КЭСР",Документ.[30811019])))
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[30811019]) div 100000) between 218 and 219)
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[30811019]) div 1000) = 11302)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств получ. по КД', 308, 1, 0, 1) ;

-- Поле "Код целевых средствКлюч получ"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств получ. по КД',308,1,30811063,1) ;

CALL DOCLOCK_IMPORT('Фильтр ИФДБ получателя по поступлению/выбытию',0,308,1,0,11,0,'[30811007] = 1',0,3,'Источник финансирования дефицита бюджета фильтруется по признаку направления выбытия в соотсветствии с указанным в заголовке направлением операции',0,'Для данного направления операции недоступен выбор источника финансирования дефицита бюджета получателя с таким направлением',null,'((Документ.[30810013] = 0) и ([985210006] = 1)) или
((Документ.[30810013] = 1) и ([985210006] = -1)) или
((Документ.[30810013] = 2) и ([985210006] = 1)) или
((Документ.[30810013] = 3) и ([985210006] = -1))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр ИФДБ получателя по поступлению/выбытию', 308, 1, 0, 1) ;

-- Поле "Источниковая классификация(Классификация получателя)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр ИФДБ получателя по поступлению/выбытию',308,1,30811094,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования кода субсидии',32768,308,1,0,3,0,'не((Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код", [30810064]) between 10800 и 11099)     или(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[30810064]) between 10000 и 10499))',0,1,'Блокировка поля "Код субсидии" для лицевых счетов с видом организации-владельца вне диапазона 01.08.00-01.10.99 либо 01.01.00-01.04.99 (не финорганы, не распорядители, не бюджетные(автономные) учреждения, не ГУП (МУП)). Не блокируем документы 3.23,3.24(перекрыто)',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования кода субсидии', 308, 1, 0, 1) ;

-- Поле "Код субсидии получателя"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования кода субсидии',308,1,30811082,1) ;

CALL DOCLOCK_IMPORT('Проверка лицевого счета',0,311,1,0,10,0,'Разыменовать("Лицевой_Счет.СостояниеСчета",[31111003]) = 0 или ([31110010] is not null)',0,3,'Проверка лицевого счета на открытость',0,'Лицевой счет организации закрыт или блокирован',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка лицевого счета', 311, 1, 0, 1) ;

-- Поле "Лицевой счет учреждения"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка лицевого счета',311,1,31111003,1) ;

CALL DOCLOCK_IMPORT('Проверка лицевого счета',0,312,1,0,10,0,'Разыменовать("Лицевой_Счет.СостояниеСчета",[31211015]) = 0 или ([31210019] is not null)',0,3,'Проверка лицевого счета на открытость',0,'Лицевой счет организации закрыт или блокирован',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка лицевого счета', 312, 1, 0, 1) ;

-- Поле "Лицевой счет учреждения"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка лицевого счета',312,1,31211015,1) ;

CALL DOCLOCK_IMPORT('Проверка лицевого счета',0,314,1,0,10,0,'Разыменовать("Лицевой_Счет.СостояниеСчета",[31411033]) = 0 или ([31410019] is not null)',0,3,'Проверка лицевого счета на открытость',0,'Лицевой счет организации закрыт или блокирован',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка лицевого счета', 314, 1, 0, 1) ;

-- Поле "Лицевой счет плательщика"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка лицевого счета',314,1,31411033,1) ;

CALL DOCLOCK_IMPORT('Отметки о блокировании\разблокировании поступлений',3145741,315,-1,0,4,2,'(Разыменовать("ЕстьЛицензия.ПДД_СВР", 315)   или Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", 315))  и ([31510060] <> 0) и ([31510040] = 0)',0,1,'Роль блокирования\разблокирования документов. Разрешается изменение отметок о блокировании\разблокировании только у документов с не раходным типом класификации и направлением операции "Подтверждение передачи прихода".   ',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Отметки о блокировании\разблокировании поступлений', 315, -1, 0, 1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',315,-1,31511054,1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',315,-1,31511055,1) ;

-- Поле "Заблокировано(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',315,-1,31511052,1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',315,-1,31511053,1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',315,-1,31510059,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',315,-1,31510058,1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',315,-1,31510057,1) ;

-- Поле "Заблокировано(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',315,-1,31510056,1) ;

CALL DOCLOCK_IMPORT('Блокировка даты и причины разблокировки',131072,315,0,0,3,0,'([31510056]<>1) или (не ПолеНеПустое([31510010]))',0,3,'Блокировка даты и причины разблокировки документов заголовка если документ не заблокирован',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Блокировка даты и причины разблокировки', 315, 0, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки',315,0,31510059,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки',315,0,31510058,1) ;

CALL DOCLOCK_IMPORT('Проверка лицевого счета',0,315,1,0,10,0,'Разыменовать("Лицевой_Счет.СостояниеСчета",[31511014]) = 0 или ([31510038] is not null)',0,3,'Проверка лицевого счета на открытость',0,'Лицевой счет организации закрыт или блокирован',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка лицевого счета', 315, 1, 0, 1) ;

-- Поле "Лицевой счет участника операции"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка лицевого счета',315,1,31511014,1) ;

CALL DOCLOCK_IMPORT('Блокировка даты и причины разблокировки(деталь)',8388608,315,1,0,3,0,'([31511052]<>1) или (не ПолеНеПустое([31510010]))',0,3,'Блокировка даты и причины разблокировки документов детали если документ не заблокирован',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Блокировка даты и причины разблокировки(деталь)', 315, 1, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки(деталь)',315,1,31511055,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки(деталь)',315,1,31511054,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования получателя субсидии',32768,323,-1,0,3,0,'не Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", КодИнтерфейса)',0,3,'Блокировка поля "Получатель субсидии" для документов, не относящихся к передаче субсидий. Для редактирования получателя субсидии требуется лицензия на расширенный учет БУ, АУ.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования получателя субсидии', 323, -1, 0, 1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',323,-1,32311162,1) ;

-- Поле "Получатель субсидии(КПП)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',323,-1,32311161,1) ;

-- Поле "Получатель субсидии(ИНН)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',323,-1,32311160,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',323,-1,32311159,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования получателя субсидии(2)',32768,323,-1,0,3,0,'не(([32311018] in(241,530,251))    и (([32311149] is not null)  или (ЕстьПодстрока([32311143],Константа(30,45,8),"9.9.9")))   или ([32311143] between 500 and 599)    или (([32311139] is not null) и (tonumber([32311140],1) <> 0))   )',0,1,'Блокировка поля "Получатель субсидии" для документов, не относящихся к передаче субсидий. Для редактирования получателя субсидии требуется, чтобы ЭКР =(241 или 530) и (был непустой код субсидии либо КВР находился в диапазоне кодов (задается константой), разрешенных для  финансирования на БУ, АУ ).',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования получателя субсидии(2)', 323, -1, 0, 1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',323,-1,32311162,1) ;

-- Поле "Получатель субсидии(КПП)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',323,-1,32311161,1) ;

-- Поле "Получатель субсидии(ИНН)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',323,-1,32311160,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',323,-1,32311159,1) ;

CALL DOCLOCK_IMPORT('Фильтр справочника лицевых счетов по характеру Заг',0,323,0,0,11,0,'(Константа(30,41,3) = 1) и (Разыменовать("Р/с.ДляБУ_АУ",[32310052]) = 0) и  не ((Разыменовать("Р/с.ДляАУ",[32310052]) <> 0) и Константа(30,44,3) = 1) и  (Разыменовать("Р/с.ДляСВРБУ_АУ",[32310052]) = 0) и (Разыменовать("Р/с.ДляГУП_МУП",[32310052]) = 0)',0,1,'Если в качестве счета финоргана выбран расчетный счет не для бюджетных(автономных) учреждений, то допустимы самостоятельные, подведомственные, распорядителльные л/c и л/c по переданным полномочиям',0,'Для данного расчетного счета выбор лицевых счетов с характером "БУ, АУ" или "Отдельный БУ, АУ" недопустим',null,'не(([984110041] = 1) или ([984110045] = 1) или ([984110046]=1)) и
не( ([984110044] = 0) и ([984110042] = 0) и ([984110043] = 0) )',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр справочника лицевых счетов по характеру Заг', 323, 0, 0, 1) ;

-- Поле "Л/с получ. (заг.)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр справочника лицевых счетов по характеру Заг',323,0,32310138,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду ассигнований',0,323,1,0,11,0,'[32311151] <> 0',0,1,'Если в справочнике кода БА указан вид ассигнований, вид ассигнований документа должен ему соответствовать',0,'Указанный вид ассигнований не может использоваться для данного кода БА',null,'(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32311151]) = 0) или
(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32311151]) = [988510003]) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32311151]) mod 100) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32311151]) div 100) = ([988510003] div 100))) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32311151]) mod 10000) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32311151]) div 10000) = ([988510003] div 10000)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду ассигнований', 323, 1, 0, 1) ;

-- Поле "Вид ассигнований"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду ассигнований',323,1,32311137,1) ;

CALL DOCLOCK_IMPORT('Фильтр по характеру л/с',0,323,1,0,11,0,'(Константа(30,29,3) = 0) и (Константа(30,41,3) = 0)',0,3,'Фильтр по характеру л/с получателя. Допускается использовать только распорядительные и самостоятельные л\с.',0,'Лицевой счет должен быть распорядительным или самостоятельным',null,'([984110044] = 1)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по характеру л/с', 323, 1, 0, 1) ;

-- Поле "Л/с получателя"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по характеру л/с',323,1,32311012,1) ;

CALL DOCLOCK_IMPORT('Фильтр справочника лицевых счетов по характеру(2)',0,323,1,0,11,0,'(Константа(30,41,3) = 0) и (Разыменовать("Р/с.ДляБУ_АУ",[32310052]) = 0) и  не ((Разыменовать("Р/с.ДляАУ",[32310052]) <> 0) и Константа(30,44,3) = 1) и  (Разыменовать("Р/с.ДляСВРБУ_АУ",[32310052]) = 0) и (Разыменовать("Р/с.ДляГУП_МУП",[32310052]) = 0)',0,1,'Если в качестве счета финоргана выбран расчетный счет не для бюджетных(автономных) учреждений, то допустимы самостоятельные, подведомственные, распорядителльные л/c и л/c по переданным полномочиям',0,'Для данного расчетного счета выбор лицевых счетов с характером "БУ, АУ" или "Отдельный БУ, АУ" недопустим',null,'не(([984110041] = 1) или ([984110045] = 1) или ([984110046]=1)) и
не( ([984110044] = 0) и ([984110042] = 0) и ([984110043] = 0) )',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр справочника лицевых счетов по характеру(2)', 323, 1, 0, 1) ;

-- Поле "Л/с получателя"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр справочника лицевых счетов по характеру(2)',323,1,32311012,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности',0,323,1,0,11,0,'Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[32311012])  или Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС",[32311012])',0,1,'Для л\с ПБС и распорядительных л\с допустимыми являются типы средств с видами деятельности 1,2,3. Фильтр перекрыт для работы по л\с детали.',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'[984910001] between 1 и 3',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности', 323, 1, 0, 1) ;

-- Поле "Тип средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности',323,1,32311024,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования кода субсидии',32768,323,1,0,3,0,'не((Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код", [32311012]) between 10800 и 11099) или  (Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[32311012]) between 10000 и 10499))',0,1,'Блокировка поля "Код субсидии" для лицевых счетов с видом организации-владельца вне диапазона 01.08.00-01.10.99 либо 01.01.00-01.04.99 (не финорганы, не распорядители, не бюджетные(автономные) учреждения, не ГУП (МУП)).',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования кода субсидии', 323, 1, 0, 1) ;

-- Поле "Код субсидии"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования кода субсидии',323,1,32311150,1) ;

CALL DOCLOCK_IMPORT('Фильтр по получателю субсидии',0,323,1,0,11,0,'',0,1,'Получатель субсидии должен быть бюджетным или автономным учреждением учредителя-владельца л\с. Для КОСГУ=251 получатель субсидии должен иметь вид 02.03.00 "Финорганы других бюджетов" или 02.04.00 "ГУП, МУП других бюджетов"',0,'Указанная организация не может использоваться в качестве получателя субсидии',null,'Документ.[32311018] = 251?
([960110035] between 020300 and 020499)
:
(([960110035] between 010800 and 010999)
и([960110021]=Разыменовать("Лицевой_Счет.ОрганизацияВладелец",Документ.[32311012])))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по получателю субсидии', 323, 1, 0, 1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по получателю субсидии',323,1,32311163,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования получателя субсидии',32768,324,-1,0,3,0,'не Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", КодИнтерфейса)',0,3,'Блокировка поля "Получатель субсидии" для документов, не относящихся к передаче субсидий. Для редактирования получателя субсидии требуется лицензия на расширенный учет БУ, АУ.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования получателя субсидии', 324, -1, 0, 1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',324,-1,32411203,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',324,-1,32411202,1) ;

-- Поле "Получатель субсидии(КПП)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',324,-1,32411201,1) ;

-- Поле "Получатель субсидии(ИНН)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии',324,-1,32411200,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования кода субсидии',32768,324,-1,0,3,0,'не((Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[32411026]) between 10800 и 11099)  или  (Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[32411026]) between 10000 и 10499) )',0,1,'Блокировка поля "Код субсидии" для лицевых счетов с видом организации-владельца вне диапазона 01.08.00-01.10.99 либо 01.01.00-01.04.99 (не финорганы, не распорядители, не бюджетные(автономные) учреждения, не ГУП (МУП)).',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования кода субсидии', 324, -1, 0, 1) ;

-- Поле "Код субсидии"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования кода субсидии',324,-1,32411191,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования получателя субсидии(2)',32768,324,-1,0,3,0,'не(([32411076] in(241,530,251))    и (([32411190] is not null)  или (ЕстьПодстрока([32411183],Константа(30,45,8),"9.9.9")))   или ([32411183] between 500 and 599)    или (([32411178] is not null) и (tonumber([32411179],1) <> 0))   )',0,1,'Блокировка поля "Получатель субсидии" для документов, не относящихся к передаче субсидий. Для редактирования получателя субсидии требуется, чтобы ЭКР =(241 или 530) и (был непустой код субсидии либо КВР находился в диапазоне кодов (задается константой), разрешенных для  финансирования на БУ, АУ ).',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования получателя субсидии(2)', 324, -1, 0, 1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',324,-1,32411203,1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',324,-1,32411202,1) ;

-- Поле "Получатель субсидии(КПП)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',324,-1,32411201,1) ;

-- Поле "Получатель субсидии(ИНН)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования получателя субсидии(2)',324,-1,32411200,1) ;

CALL DOCLOCK_IMPORT('Фильтр по характеру л/с',0,324,0,0,11,0,'Константа(30,29,3) = 0',0,3,'Фильтр по характеру л/с плательщика. Допускается использовать только распорядительные и самостоятельные л\с.',0,'Лицевой счет должен быть распорядительным или самостоятельным',null,'([984110044] = 1)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по характеру л/с', 324, 0, 0, 1) ;

-- Поле "Л/с плательщика"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по характеру л/с',324,0,32410005,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду ассигнований',0,324,1,0,11,0,'[32411192] <> 0',0,1,'Если в справочнике кода БА указан вид ассигнований, вид ассигнований документа должен ему соответствовать',0,'Указанный вид ассигнований не может использоваться для данного кода БА',null,'(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32411192]) = 0) или
(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32411192]) = [988510003]) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32411192]) mod 100) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32411192]) div 100) = ([988510003] div 100))) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32411192]) mod 10000) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[32411192]) div 10000) = ([988510003] div 10000)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду ассигнований', 324, 1, 0, 1) ;

-- Поле "Вид ассигнований"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду ассигнований',324,1,32411175,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности',0,324,1,0,11,0,'Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[32411026])   или Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС",[32411026])',0,1,'Для л\с ПБС и распорядительных л\с допустимыми являются типы средств с видами деятельности 1,2,3. Фильтр перекрыт для работы по л\с получателя из детали.',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'[984910001] between 1 и 3',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности', 324, 1, 0, 1) ;

-- Поле "Тип средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности',324,1,32411080,1) ;

CALL DOCLOCK_IMPORT('Фильтр по получателю субсидии',0,324,1,0,11,0,'',0,1,'Получатель субсидии должен быть бюджетным или автономным учреждением учредителя-владельца л\с. Для КОСГУ=251 получатель субсидии должен иметь вид 02.03.00 "Финорганы других бюджетов" или 02.04.00 "ГУП, МУП других бюджетов"',0,'Указанная организация не может использоваться в качестве получателя субсидии',null,'Документ.[32411076] = 251?
([960110035] between 020300 and 020499)
:
(([960110035] between 010800 and 010999)
и([960110021]=Разыменовать("Лицевой_Счет.ОрганизацияВладелец",Документ.[32411026])))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по получателю субсидии', 324, 1, 0, 1) ;

-- Поле "Получатель субсидии(трансферта)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по получателю субсидии',324,1,32411204,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по КД',0,900,1,0,11,0,'([90011001] = 2) и ((КодИнтерфейса <> 903) или   не(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации",[90011008]) between 010800 and 011099))',0,3,'При доходной классификации справочник кодов целевых средств фильтруется по коду дохода, исключая бюджетные/автономные учреждения, МУП(ГУП) на интерфейсе (09.03) Выписка по доходам. Допустимы для выбора КЦС с 0-вым кодом дохода, КЦС с таким же кодом дохода, как в документе, а также КЦС с 0-вым администратором и таким же (как в документе) видом дохода, подвидом, ЭКД. Если в документе  указан код дохода, применяемый для возврата трансфертов, то допустимы для выбора любые КЦС поступления.',0,'Код целевых средств не соответсвтует доходной классификации',null,'([988410006] = 0) или (Документ.[90011004] = 0) или (Документ.[90011005] = [988410008]) 
или ((Разыменовать("КДКлюч.КВСР.Код",[988410006])=0)
   и(Разыменовать("КДКлюч.ВидДохода",[988410006])=Разыменовать("КДКлюч.ВидДохода",Документ.[90011004]))
   и((Разыменовать("КДКлюч.Программа",[988410006])=Разыменовать("КДКлюч.Программа",Документ.[90011004]))
     или(Разыменовать("КДКлюч.Программа",[988410006])=0))
   и(Разыменовать("КДКлюч.КЭСР",[988410006])=Разыменовать("КДКлюч.КЭСР",Документ.[90011004])))
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[90011004]) div 100000) between 218 and 219) 
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[90011004]) div 1000) = 11302)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по КД', 900, 1, 0, 1) ;

-- Поле "Код целевых средств (ключ)"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по КД',900,1,90011002,1) ;

CALL DOCLOCK_IMPORT('Отметки о блокировании\разблокировании поступлений',196645,903,1,0,4,2,'(Разыменовать("ЕстьЛицензия.ПДД_СВР", 903)   или Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", 903))  и ([90311036] > 0) и ([90311035] = 2) и ([90311029] <> 0)',0,1,'Роль блокирования\разблокирования документов.  Разрешается изменение отметок о блокировании\разблокировании только у документов с типом класификации=доходная и только указанному списку пользователей.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Отметки о блокировании\разблокировании поступлений', 903, 1, 0, 1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',903,1,90311054,1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',903,1,90311055,1) ;

-- Поле "Заблокирован(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',903,1,90311052,1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',903,1,90311053,1) ;

CALL DOCLOCK_IMPORT('По электронному документу',131072,903,1,0,7,0,'ПолеНеПустое([90311072])',1,3,'Блокировка документов, созданных автоматически на основании электронных копий',1,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По электронному документу', 903, 1, 0, 1) ;

CALL DOCLOCK_IMPORT('По дате разблокировки',262144,903,1,0,3,0,'[90311054] is not null',0,3,'Если установлена дата разблокировки нельзя редактировать поля признака и причины блокировки',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По дате разблокировки', 903, 1, 0, 1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('По дате разблокировки',903,1,90311053,1) ;

-- Поле "Заблокирован(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('По дате разблокировки',903,1,90311052,1) ;

CALL DOCLOCK_IMPORT('Блокировка даты и причины разблокировки',524288,903,1,0,3,0,'([90311052]<>1) или (не ПолеНеПустое([90310002]))',0,3,'Блокировка даты и причины разблокировки, если документ не заблокирован или не принят',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Блокировка даты и причины разблокировки', 903, 1, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки',903,1,90311055,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки',903,1,90311054,1) ;

CALL DOCLOCK_IMPORT('Изменение импортированной записи',196608,903,1,0,4,2,'',0,2,'Разрешение на частичное изменение документов, созданных на основании электронной копии.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Изменение импортированной записи', 903, 1, 1, 1) ;

-- Поле "Информация о налоговом платеже"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311058,1) ;

-- Поле "Направление"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311057,1) ;

-- Поле "Источник образования"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311056,1) ;

-- Поле "Уточнение ОКАТО"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311042,1) ;

-- Поле "ОКАТО"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311041,1) ;

-- Поле "Операция"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311040,1) ;

-- Поле "Вид источника(Классификация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311017,1) ;

-- Поле "Документ"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311038,1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311029,1) ;

-- Поле "Тип средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311026,1) ;

-- Поле "НДС"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311025,1) ;

-- Поле "Суб.код дохода"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311024,1) ;

-- Поле "ГосНИ"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311020,1) ;

-- Поле "ЭКИ(Классификация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311018,1) ;

-- Поле "Л/с ФК"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311050,1) ;

-- Поле "НПА"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311049,1) ;

-- Поле "Мероприятие"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311048,1) ;

-- Поле "Слой"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311047,1) ;

-- Поле "Вид учёта (старый)"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311046,1) ;

-- Поле "Район трансферта"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311045,1) ;

-- Поле "Администратор(Классификация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Изменение импортированной записи',903,1,90311016,1) ;

CALL DOCLOCK_IMPORT('Блокировка даты и причины разблокировки',524288,906,-1,0,3,0,'([90611051]<>1) или (не ПолеНеПустое([90611024]))',0,3,'Блокировка даты и причины разблокировки, если документ не заблокирован или не принят',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Блокировка даты и причины разблокировки', 906, -1, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки',906,-1,90611054,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка даты и причины разблокировки',906,-1,90611053,1) ;

CALL DOCLOCK_IMPORT('Отметки о блокировании\разблокировании поступлений',131109,906,1,0,4,2,'(Разыменовать("ЕстьЛицензия.ПДД_СВР", 906)   или Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", 906))  и ([90611034] > 0) и ([90611035] <> 0)',0,1,'Роль блокирования\разблокирования документов.  Разрешается изменение отметок о блокировании\разблокировании только у документов с типом класификации=доходная и только указанному списку пользователей.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Отметки о блокировании\разблокировании поступлений', 906, 1, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',906,1,90611054,1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',906,1,90611052,1) ;

-- Поле "Заблокировано(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',906,1,90611051,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',906,1,90611053,1) ;

CALL DOCLOCK_IMPORT('По дате разблокировки',262144,906,1,0,3,0,'[90611053] is not null',0,3,'Если установлена дата разблокировки нельзя редактировать поля признака и причины блокировки',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('По дате разблокировки', 906, 1, 0, 1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('По дате разблокировки',906,1,90611052,1) ;

-- Поле "Заблокировано(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('По дате разблокировки',906,1,90611051,1) ;

CALL DOCLOCK_IMPORT('Проверка наличия значения в поле Уникальный код ст',0,1601,0,0,10,0,'(Константа(30,37,3)=0) или([160110002] is null) или([160111018] is not null) или([160110051] is not null)',0,3,'Проверка наличия значения в поле № обязательства в детали',0,'Необходимо указать Уникальный код строки',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка наличия значения в поле Уникальный код ст', 1601, 0, 0, 1) ;

-- Поле "Дата принятия/отклонения"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка наличия значения в поле Уникальный код ст',1601,0,160110002,1) ;

CALL DOCLOCK_IMPORT('Проверка наличия значения в поле № обязательства д',0,1601,0,0,10,0,'(Константа(30,37,3)=1) или([160110002] is null) или([160111018] is not null) или([160110051] is not null)',0,3,'Проверка наличия значения в поле № обязательства в детали',0,'Необходимо указать № обязательства',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка наличия значения в поле № обязательства д', 1601, 0, 0, 1) ;

-- Поле "Дата принятия/отклонения"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка наличия значения в поле № обязательства д',1601,0,160110002,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по расходной БК',0,1601,1,0,11,0,'',0,1,'При расходной классификации справочник кодов целевых средств фильтруется по КВСР, ФКР, КВР, КЦСР, ЭКР. Классификатор не считается различающимся, если в документе для данного классификатора прописано нулевое значение, а в справочнике ненулевое или наоборот',0,'Код целевых средств не соответствует расходной классификации документа',null,'(([988410025] = 0) или (Документ.[160111021] = 0) или (Документ.[160111076] = [988410026]))
и
(([988410022] = 0) или (Документ.[160111022] = 0) или (Документ.[160111022] = [988410022]))
и
(([988410023] = 0) или (Документ.[160111024] = 0) или (Документ.[160111075] = [988410024]))
и
(([988410018] = 0) или (Документ.[160111023] = 0) или (Документ.[160111074] = [988410019]))
и
(([988410021] = 0) или (Документ.[160111025] = 0) или (Документ.[160111025] = [988410021]))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по расходной БК', 1601, 1, 0, 1) ;

-- Поле "Код целевых средствКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по расходной БК',1601,1,160111072,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования кода субсидии',32768,1601,1,0,3,0,'(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[160111019]) = 10500)',0,1,'',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования кода субсидии', 1601, 1, 0, 1) ;

-- Поле "Код субсидий"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования кода субсидии',1601,1,160111077,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода мубсибии по значению лицевого счета',0,1601,1,0,11,0,'',0,1,'Бюджетным, автономным учреждениям доступны только субсидии у которых учредитель=организации-распорядителю л\с, либо учредитель=ФО.  Для отдельных л\с БУ\АУ, доступны только субсидии с видом<>госзадания. Для прочих л\с БУ\АУ доступны только коды субсидий на госзадания.',0,'Код субсидии не соответствует данному лицевому счету',null,'([988910008] = Разыменовать("Лицевой_Счет.Распорядитель",Документ.[160111019])
или (Разыменовать("Организация.ВидОрганизации",[988910008]) = 10100))
и   
((не Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[160111019])
и ([988910010] = 0))
или
(Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[160111019])
и ([988910010] <> 0)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода мубсибии по значению лицевого счета', 1601, 1, 0, 1) ;

-- Поле "Код субсидийКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода мубсибии по значению лицевого счета',1601,1,160111078,1) ;

CALL DOCLOCK_IMPORT('Блокировка суммы к исполнению',32768,1701,0,0,3,0,'[170110066] <> 2',0,1,'Сумма к исполнению доступна для редактирования только в состоянии "принят"',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Блокировка суммы к исполнению', 1701, 0, 0, 1) ;

-- Поле "Сумма к исполнению"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка суммы к исполнению',1701,0,170110051,1) ;

CALL DOCLOCK_IMPORT('Изменение чужих данных',2,1807,-1,0,8,2,'',1,1,'Разрешение на внесение изменений в документы, созданные другими пользователями. Изменять документы разрешается только указанному списку пользователей.',2,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Изменение чужих данных', 1807, -1, 0, 1) ;

CALL DOCLOCK_IMPORT('Изменение данных',2,1816,0,0,8,2,'',1,1,'Разрешение на внесение изменений в документы. Изменять документы разрешается только указанному списку пользователей.',2,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Изменение данных', 1816, 0, 0, 1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду ассигнований',0,1900,1,0,11,0,'[190011034] <> 0',0,1,'Если в справочнике кода БА указан вид ассигнований, вид ассигнований документа должен ему соответствовать',0,'Указанный вид ассигнований не может использоваться для данного кода БА',null,'(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[190011034]) = 0) или
(Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[190011034]) = [988510003]) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[190011034]) mod 100) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[190011034]) div 100) = ([988510003] div 100))) или
(((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[190011034]) mod 10000) = 0) и
 ((Разыменовать("КодБюджетногоАссигнованияКлюч.ВидАссигнований", Документ.[190011034]) div 10000) = ([988510003] div 10000)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду ассигнований', 1900, 1, 0, 1) ;

-- Поле "Вид ассигнований"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду ассигнований',1900,1,190011035,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования организации',32768,1900,1,0,3,0,'',0,1,'Запрет редактирования организации',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования организации', 1900, 1, 0, 1) ;

-- Поле "Наименование организации(деталь)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',1900,1,190011032,1) ;

-- Поле "Наименование организации"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',1900,1,190011033,1) ;

-- Поле "КПП организации"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',1900,1,190011031,1) ;

-- Поле "ИНН организации"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',1900,1,190011030,1) ;

CALL DOCLOCK_IMPORT('Фильтрация по характеру л/с',0,1901,1,0,11,0,'',0,3,'Фильтр по характеру л/с в детализации. Допускается использовать только распорядительные и самостоятельные л\с.',0,'Лицевой счет должен быть распорядительным или самостоятельным',null,'([984110044] = 1)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтрация по характеру л/с', 1901, 1, 0, 1) ;

-- Поле "Лицевой счет ГРБС"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтрация по характеру л/с',1901,1,190111022,1) ;

CALL DOCLOCK_IMPORT('Фильтр по характеру л/с(1)',0,1903,1,0,11,0,'',0,3,'Фильтр по характеру л/с в детализации. Допускается использовать только распорядительные и самостоятельные л\с.',0,'Лицевой счет должен быть распорядительным или самостоятельным',null,'([984110044] = 1)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по характеру л/с(1)', 1903, 1, 0, 1) ;

-- Поле "Лицевой счет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по характеру л/с(1)',1903,1,190311036,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования организации',32768,2201,1,0,3,0,'',0,1,'Запрет редактирования организации',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования организации', 2201, 1, 0, 1) ;

-- Поле "Организация"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',2201,1,220111059,1) ;

-- Поле "Наименование(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',2201,1,220111058,1) ;

-- Поле "КПП(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',2201,1,220111057,1) ;

-- Поле "ИНН(Организация)"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования организации',2201,1,220111056,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по КД',0,2201,1,0,11,0,'',0,3,'При доходной классификации справочник кодов целевых средств фильтруется по коду дохода. Допустимы для выбора КЦС с 0-вым кодом дохода, КЦС с таким же кодом дохода, как в документе, а также КЦС с 0-вым администратором и таким же (как в документе) видом дохода, подвидом, ЭКД. Если в документе  указан код дохода, применяемый для возврата трансфертов, то допустимы для выбора любые КЦС поступления.',0,'Код целевых средств не соответствует доходной классфикации',null,'([988410006] = 0) или (Документ.[220111046] = 0) или (Документ.[220111012] = [988410008])
или ((Разыменовать("КДКлюч.КВСР.Код",[988410006])=0)
   и(Разыменовать("КДКлюч.ВидДохода",[988410006])=Разыменовать("КДКлюч.ВидДохода",Документ.[220111046]))
   и((Разыменовать("КДКлюч.Программа",[988410006])=Разыменовать("КДКлюч.Программа",Документ.[220111046]))
     или(Разыменовать("КДКлюч.Программа",[988410006])=0))
   и(Разыменовать("КДКлюч.КЭСР",[988410006])=Разыменовать("КДКлюч.КЭСР",Документ.[220111046])))
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[220111046]) div 100000) between 218 and 219) 
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[220111046]) div 1000) = 11302)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по КД', 2201, 1, 0, 1) ;

-- Поле "Код целевых средствКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по КД',2201,1,220111064,1) ;

CALL DOCLOCK_IMPORT('Изменение чужих данных',2,5201,-1,0,8,2,'',1,1,'Разрешение на внесение изменений в документы, созданные другими пользователями. Изменять документы разрешается только указанному списку пользователей.',2,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Изменение чужих данных', 5201, -1, 0, 1) ;

CALL DOCLOCK_IMPORT('Проверка изменения периодичности',0,5201,0,0,9,0,'Количество([520111058])=0',0,3,'при изменении периодичности нужно изменить суммы выплат в детализации',0,'Нельзя изменить периодичность при наличии записей в детализации',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка изменения периодичности', 5201, 0, 0, 1) ;

-- Поле "Периодичность"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка изменения периодичности',5201,0,520110053,1) ;

CALL DOCLOCK_IMPORT('Фильтр справочника лицевых счетов по типу исп. лис',0,5201,0,0,11,0,'[520110052] = 0',0,3,'',0,'Для данного типа исп. листа выбор лицевых счетов с характером "БУ, АУ" или "Отдельный БУ, АУ" недопустим',null,'не(([984110041] = 1) или ([984110045] = 1) или ([984110046]))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр справочника лицевых счетов по типу исп. лис', 5201, 0, 0, 1) ;

-- Поле "Л/с владельца документа"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр справочника лицевых счетов по типу исп. лис',5201,0,520110033,1) ;

CALL DOCLOCK_IMPORT('Фильтр справочника лицевых счетов по типу исп. л. ',0,5201,0,0,11,0,'[520110052] = 1',0,3,'',0,'Для данного типа исп. листа выбор подведомственных, распорядительных, самостоятельных лицевых счетов и лицевых счетов по переданным полномочиям недопустим',null,'не(([984110042] = 1) или ([984110044]  = 1) или ([984110043] = 1))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр справочника лицевых счетов по типу исп. л. ', 5201, 0, 0, 1) ;

-- Поле "Л/с владельца документа"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр справочника лицевых счетов по типу исп. л. ',5201,0,520110033,1) ;

CALL DOCLOCK_IMPORT('Недействительный',32768,5201,0,0,3,0,'',0,3,'',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Недействительный', 5201, 0, 0, 1) ;

-- Поле "Недействителен"
CALL DOCLOCKFIELDS_INSERTFIELD('Недействительный',5201,0,520110032,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности',0,5201,1,0,11,0,'(Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[520111005]) или Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС",[520111005]))',0,1,'Для л\с ПБС и распорядительных л\с допустимыми являются типы средств с видами деятельности 1,2,3',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'[984910001] between 1 и 3',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности', 5201, 1, 0, 1) ;

-- Поле "Тип средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности',5201,1,520111017,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности для БУ, АУ',0,5201,1,0,11,0,'(Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[520111005]) или Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",[520111005]) или Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",[520111005]))',0,1,'Для л\с БУ, АУ допустимыми являются типы средств с видами деятельности 2,3,4,7,8;  для отдельных л\с БУ,АУ допустимы типы средств с видами деятельности 5,6,9;  для л\с ОМС допустимы типы средств в видами деятельности 7 или 8.',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'(Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",Документ.[520111005])
и (([984910001] between 2 и 4)или([984910001] between 7 и 8)))
или
(Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",Документ.[520111005])
и ([984910001] between 7 и 8))
или
(Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",Документ.[520111005])
и (([984910001] between 5 и 6)или([984910001] = 9)))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности для БУ, АУ', 5201, 1, 0, 1) ;

-- Поле "Тип средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности для БУ, АУ',5201,1,520111017,1) ;

CALL DOCLOCK_IMPORT('Ежемесячная',32768,5201,1,0,3,0,'[520110053]=1',0,3,'',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Ежемесячная', 5201, 1, 0, 1) ;

-- Поле "Сумма по исполнительному документу"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежемесячная',5201,1,520111023,1) ;

-- Поле "Номер месяца для поквартальных выплат(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежемесячная',5201,1,520111048,1) ;

-- Поле "День месяца для поквартальных выплат(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежемесячная',5201,1,520111047,1) ;

-- Поле "Квартал 4(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежемесячная',5201,1,520111045,1) ;

-- Поле "Квартал 3(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежемесячная',5201,1,520111044,1) ;

-- Поле "Квартал 2(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежемесячная',5201,1,520111043,1) ;

-- Поле "Квартал 1(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежемесячная',5201,1,520111042,1) ;

CALL DOCLOCK_IMPORT('Ежеквартальная',32768,5201,1,0,3,0,'[520110053]=2',0,3,'',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Ежеквартальная', 5201, 1, 0, 1) ;

-- Поле "Сумма по исполнительному документу"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111023,1) ;

-- Поле "День месяца для помесячных выплат(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111046,1) ;

-- Поле "Декабрь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111041,1) ;

-- Поле "Ноябрь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111040,1) ;

-- Поле "Октябрь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111039,1) ;

-- Поле "Сентябрь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111038,1) ;

-- Поле "Август(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111037,1) ;

-- Поле "Июль(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111036,1) ;

-- Поле "Июнь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111035,1) ;

-- Поле "Май(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111034,1) ;

-- Поле "Апрель(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111033,1) ;

-- Поле "Март(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111032,1) ;

-- Поле "Февраль(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111031,1) ;

-- Поле "Январь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Ежеквартальная',5201,1,520111030,1) ;

CALL DOCLOCK_IMPORT('Непериодическая',32768,5201,1,0,3,0,'[520110053] = 0',0,3,'',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Непериодическая', 5201, 1, 0, 1) ;

-- Поле "Номер месяца для поквартальных выплат(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111048,1) ;

-- Поле "День месяца для поквартальных выплат(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111047,1) ;

-- Поле "Квартал 4(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111045,1) ;

-- Поле "Квартал 3(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111044,1) ;

-- Поле "Квартал 2(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111043,1) ;

-- Поле "Квартал 1(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111042,1) ;

-- Поле "День месяца для помесячных выплат(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111046,1) ;

-- Поле "Декабрь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111041,1) ;

-- Поле "Ноябрь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111040,1) ;

-- Поле "Октябрь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111039,1) ;

-- Поле "Сентябрь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111038,1) ;

-- Поле "Август(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111037,1) ;

-- Поле "Июль(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111036,1) ;

-- Поле "Июнь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111035,1) ;

-- Поле "Май(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111034,1) ;

-- Поле "Апрель(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111033,1) ;

-- Поле "Март(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111032,1) ;

-- Поле "Февраль(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111031,1) ;

-- Поле "Январь(Периодичные выплаты)"
CALL DOCLOCKFIELDS_INSERTFIELD('Непериодическая',5201,1,520111030,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по получению,передаче',0,5501,1,0,11,0,'',0,1,'При доходной классификации, а также в случае источниковой классификации, если ЭКИ=0 (ввод остатков на начало года) справочник кодов целевых средств фильтруется по признаку "получение", при расходной - по признаку "передача"',0,'Нельзя выбирать код целевых средств с признаком "передача" при доходной классификации и код целевых средств с признаком "поступление" при расходной',null,'(((Документ.[550111066] = 2) или 
((Документ.[550111066] = 1) и (Разыменовать("ИсточникВнутр_ФинансированияКлюч.КЭСР",Документ.[550111088])=0)))  
и ([988410016] = 0))
или
((Документ.[550111066]=0) и ([988410016] = 1))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по получению,передаче', 5501, 1, 0, 1) ;

-- Поле "Код целевых средствКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по получению,передаче',5501,1,550111144,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по КД',0,5501,1,0,11,0,'[550111066] = 2',0,3,'При доходной классификации справочник кодов целевых средств фильтруется по коду дохода. Допустимы для выбора КЦС с 0-вым кодом дохода, КЦС с таким же кодом дохода, как в документе, а также КЦС с 0-вым администратором и таким же (как в документе) видом дохода, подвидом, ЭКД. Если в документе  указан код дохода, применяемый для возврата трансфертов, то допустимы для выбора любые КЦС поступления. ',0,'Код целевых средств не соответствует доходной классификации',null,'([988410006] = 0) или (Документ.[550111090] = 0) или (Документ.[550111156] = [988410008]) 
или ((Разыменовать("КДКлюч.КВСР.Код",[988410006])=0)
   и(Разыменовать("КДКлюч.ВидДохода",[988410006])=Разыменовать("КДКлюч.ВидДохода",Документ.[550111090]))
   и((Разыменовать("КДКлюч.Программа",[988410006])=Разыменовать("КДКлюч.Программа",Документ.[550111090]))
     или(Разыменовать("КДКлюч.Программа",[988410006])=0))
   и(Разыменовать("КДКлюч.КЭСР",[988410006])=Разыменовать("КДКлюч.КЭСР",Документ.[550111090])))
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[550111090]) div 100000) between 218 and 219) 
 или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[550111090]) div 1000) = 11302)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по КД', 5501, 1, 0, 1) ;

-- Поле "Код целевых средствКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по КД',5501,1,550111144,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности',0,5501,1,0,11,0,'(Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[550111052])    или Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС",[550111052]))',0,3,'Для л\с ПБС и распорядительных л\с допустимыми являются типы средств с видами деятельности 1,2,3',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'[984910001] between 1 и 3',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности', 5501, 1, 0, 1) ;

-- Поле "Тип средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности',5501,1,550111069,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по району контрагента',0,5501,1,0,11,0,'(Разыменовать("Р/с.Организация.ВидОрганизации",[550110048]) >= 20300) и (Разыменовать("Р/с.Организация.ВидОрганизации",[550110048]) <= 20399)',0,3,'Фильтрация справочника кодов целевых средств по району контрагента для видов организации 02.03.00 - 02.03.99',0,'Нельзя вводить код целевых средств с районом отличным от района контрагента для видов организации 02.03.00 - 02.03.99',null,'([988410030] = Документ.[550110165]) или 
([988410030] = ((Документ.[550110165] div 100) * 100)) или 
([988410030] = ((Документ.[550110165] div 10000) * 10000)) или 
([988410030] = 0)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по району контрагента', 5501, 1, 0, 1) ;

-- Поле "Код целевых средствКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по району контрагента',5501,1,550111144,1) ;

CALL DOCLOCK_IMPORT('Отметки о блокировании\разблокировании поступлений',327717,5501,1,0,4,2,'(Разыменовать("ЕстьЛицензия.ПДД_СВР", 5501)   или Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", 5501))  и ([550111051]>0) и ([550111052]<>0)',0,1,'Роль блокирования\разблокирования документов.  Разрешается изменение отметок о блокировании\разблокировании только у документов с типом класификации=доходная и только указанному списку пользователей.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Отметки о блокировании\разблокировании поступлений', 5501, 1, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',5501,1,550111087,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',5501,1,550111086,1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',5501,1,550111085,1) ;

-- Поле "Заблокировано(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',5501,1,550111084,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по получению,передаче',0,5502,1,0,11,0,'',0,1,'При доходной классификации, а также в случае источниковой классификации, если ЭКИ=0 (ввод остатков на начало года) справочник кодов целевых средств фильтруется по признаку "получение", при расходной - по признаку "передача"',0,'Нельзя выбирать код целевых средств с признаком "передача" при доходной классификации и код целевых средств с признаком "поступление" при расходной',null,'(((Документ.[550211066] = 2) или 
((Документ.[550211066] = 1) и (Разыменовать("ИсточникВнутр_ФинансированияКлюч.КЭСР",Документ.[550211088])=0)))  
и ([988410016] = 0))
или
((Документ.[550211066]=0) и ([988410016] = 1))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по получению,передаче', 5502, 1, 0, 1) ;

-- Поле "Код целевых средствКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по получению,передаче',5502,1,550211125,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по КД',0,5502,1,0,11,0,'[550211066] = 2',0,3,'При доходной классификации справочник кодов целевых средств фильтруется по коду дохода. Допустимы для выбора КЦС с 0-вым кодом дохода, КЦС с таким же кодом дохода, как в документе, а также КЦС с 0-вым администратором и таким же (как в документе) видом дохода, подвидом, ЭКД. Если в документе  указан код дохода, применяемый для возврата трансфертов, то допустимы для выбора любые КЦС поступления. ',0,'Код целевых средств не соответствует доходной классификации',null,'([988410006] = 0) или (Документ.[550211090] = 0) или (Документ.[550211135] = [988410008]) 
или ((Разыменовать("КДКлюч.КВСР.Код",[988410006])=0)
   и(Разыменовать("КДКлюч.ВидДохода",[988410006])=Разыменовать("КДКлюч.ВидДохода",Документ.[550211090]))
   и((Разыменовать("КДКлюч.Программа",[988410006])=Разыменовать("КДКлюч.Программа",Документ.[550211090]))
     или(Разыменовать("КДКлюч.Программа",[988410006])=0))
   и(Разыменовать("КДКлюч.КЭСР",[988410006])=Разыменовать("КДКлюч.КЭСР",Документ.[550211090])))
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[550211090]) div 100000) between 218 and 219) 
 или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[550211090]) div 1000) = 11302)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по КД', 5502, 1, 0, 1) ;

-- Поле "Код целевых средствКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по КД',5502,1,550211125,1) ;

CALL DOCLOCK_IMPORT('Фильтр по виду деятельности',0,5502,1,0,11,0,'(Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[550211052])    или Разыменовать("Лицевой_Счет.ЭтоРаспорядительныйЛС",[550211052]))',0,3,'Для л\с ПБС и распорядительных л\с допустимыми являются типы средств с видами деятельности 1,2,3',0,'Указанный тип средств не может использоваться для данного лицевого счета',null,'[984910001] between 1 и 3',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр по виду деятельности', 5502, 1, 0, 1) ;

-- Поле "Тип средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр по виду деятельности',5502,1,550211069,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по району контрагента',0,5502,1,0,11,0,'(Разыменовать("Р/с.Организация.ВидОрганизации",[550210048]) >= 20300) и (Разыменовать("Р/с.Организация.ВидОрганизации",[550210048]) <= 20399)',0,3,'Фильтрация справочника кодов целевых средств по району контрагента для видов организации 02.03.00 - 02.03.99',0,'Нельзя вводить код целевых средств с районом отличным от района контрагента для видов организации 02.03.00 - 02.03.99',null,'([988410030] = Документ.[550210149]) или 
([988410030] = ((Документ.[550210149] div 100) * 100)) или 
([988410030] = ((Документ.[550210149] div 10000) * 10000)) или 
([988410030] = 0)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по району контрагента', 5502, 1, 0, 1) ;

-- Поле "Код целевых средствКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по району контрагента',5502,1,550211125,1) ;

CALL DOCLOCK_IMPORT('Отметки о блокировании\разблокировании поступлений',327717,5502,1,0,4,2,'(Разыменовать("ЕстьЛицензия.ПДД_СВР", 5502)   или Разыменовать("ЕстьЛицензия.ДопУчетБУАУ", 5502))  и ([550211051]>0) и ([550211052]<>0)',0,1,'Роль блокирования\разблокирования документов.  Разрешается изменение отметок о блокировании\разблокировании только у документов с типом класификации=доходная и только указанному списку пользователей.',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Отметки о блокировании\разблокировании поступлений', 5502, 1, 0, 1) ;

-- Поле "Причина разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',5502,1,550211087,1) ;

-- Поле "Дата разблокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',5502,1,550211086,1) ;

-- Поле "Причина блокировки(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',5502,1,550211085,1) ;

-- Поле "Заблокировано(Состояние блокировки)"
CALL DOCLOCKFIELDS_INSERTFIELD('Отметки о блокировании\разблокировании поступлений',5502,1,550211084,1) ;

CALL DOCLOCK_IMPORT('Блокировка удаления заголовка',32768,5503,-1,0,7,0,'(not ([550310009] is null)) и ((not ([550310014] is null)) и (not ([550310014] = "")))',1,3,'',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Блокировка удаления заголовка', 5503, -1, 0, 1) ;

CALL DOCLOCK_IMPORT('Проверка возможности принятия',0,5503,0,0,9,0,'(Количество([550311002])<>0) и (Количество([550311002]) mod 2 = 0)',0,3,'Проверка возможности принятия ПЗК',0,'Невозможно установить дату заполнения. Введите классификацию для замены в детализации "Информация о классификации ПЗК"',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Проверка возможности принятия', 5503, 0, 0, 1) ;

-- Поле "Дата утверждения"
CALL DOCLOCKFIELDS_INSERTFIELD('Проверка возможности принятия',5503,0,550310005,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по получению,передаче',0,5503,1,0,11,0,'',0,1,'При доходной классификации, а также в случае источниковой классификации, если ЭКИ=0 (ввод остатков на начало года) справочник кодов целевых средств фильтруется по признаку "получение", при расходной - по признаку "передача"',0,'Нельзя выбирать код целевых средств с признаком "передача" при доходной классификации и код целевых средств с признаком "поступление" при расходной',null,'(((Документ.[550311008] = 2) или 
((Документ.[550311008] = 1) и (Разыменовать("ИсточникВнутр_ФинансированияКлюч.КЭСР",Документ.[550311023])=0)))  
и ([988410016] = 0))
или
((Документ.[550311008]=0) и ([988410016] = 1))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по получению,передаче', 5503, 1, 0, 1) ;

-- Поле "Код целевых средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по получению,передаче',5503,1,550311025,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по расходной БК',0,5503,1,0,11,0,'[550311008] = 0',0,1,'При расходной классификации справочник кодов целевых средств фильтруется по КВСР, ФКР, КВР, КЦСР, ЭКР. Классификатор не считается различающимся, если в документе для данного классификатора прописано нулевое значение, а в справочнике ненулевое или наоборот',0,'Код целевых средств не соответствует расходной классификации документа',null,'(([988410025] = 0) или (Документ.[550311011] = 0) или (Документ.[550311042] = [988410026]))
и
(([988410022] = 0) или (Документ.[550311012] = 0) или (Документ.[550311012] = [988410022]))
и
(([988410023] = 0) или (Документ.[550311014] = 0) или (Документ.[550311041] = [988410024]))
и
(([988410018] = 0) или (Документ.[550311013] = 0) или (Документ.[550311036] = [988410019]))
и
(([988410021] = 0) или (Документ.[550311015] = 0) или (Документ.[550311015] = [988410021]))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по расходной БК', 5503, 1, 0, 1) ;

-- Поле "Код целевых средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по расходной БК',5503,1,550311025,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по КД',0,5503,1,0,11,0,'[550311008] = 2',0,1,'При доходной классификации справочник кодов целевых средств фильтруется по коду дохода, исключая записи с бюджетными/автономными учреждениями на интерфейсах Приход от прочих и Расход по п/п. Допустимы для выбора КЦС с 0-вым кодом дохода, КЦС с таким же кодом дохода, как в документе, а также КЦС с 0-вым администратором и таким же (как в документе) видом дохода, подвидом, ЭКД. Если в документе  указан код дохода, применяемый для возврата трансфертов, то допустимы для выбора любые КЦС поступления.',0,'Код целевых средств не соответствует доходной классификации',null,'([988410006] = 0) или (Документ.[550311022] = 0) или (Документ.[550311022] = [988410006])
или ((Разыменовать("КДКлюч.КВСР.Код",[988410006])=0)
   и(Разыменовать("КДКлюч.ВидДохода",[988410006])=Разыменовать("КДКлюч.ВидДохода",Документ.[550311022]))
   и((Разыменовать("КДКлюч.Программа",[988410006])=Разыменовать("КДКлюч.Программа",Документ.[550311022]))
     или(Разыменовать("КДКлюч.Программа",[988410006])=0))
   и(Разыменовать("КДКлюч.КЭСР",[988410006])=Разыменовать("КДКлюч.КЭСР",Документ.[550311022])))
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[550311022]) div 100000) between 218 and 219) 
или ((Разыменовать("КДКлюч.ЗначимыйВидДохода", Документ.[550311022]) div 1000) = 11302)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по КД', 5503, 1, 0, 1) ;

-- Поле "Код целевых средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по КД',5503,1,550311025,1) ;

CALL DOCLOCK_IMPORT('Фильтр кода целевых средств по бюджету',0,5503,1,0,11,0,'',0,1,'',0,'Нельзя выбирать код целевых средств, не принадлежащий данному бюджету',null,'([988410032] = Документ.[550311057]) или ([988410032] = 0)',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр кода целевых средств по бюджету', 5503, 1, 0, 1) ;

-- Поле "Код целевых средств"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр кода целевых средств по бюджету',5503,1,550311025,1) ;

CALL DOCLOCK_IMPORT('Блокировка редактирования классификации',32768,5503,1,0,3,0,'[550311008] = 4',0,1,'Для незаполненного типа классификации требуется заблокировать редактирование схлопнутого дерева классификации (вызов справочников)',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Блокировка редактирования классификации', 5503, 1, 0, 1) ;

-- Поле "Классификация"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка редактирования классификации',5503,1,550311049,1) ;

CALL DOCLOCK_IMPORT('Разблокировка редактирования классификации',0,5503,1,0,4,0,'not([550311008] = 4)',0,1,'Для заполненного типа классификации требуется разблокировать редактирование схлопнутого дерева классификации',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Разблокировка редактирования классификации', 5503, 1, 0, 1) ;

-- Поле "Классификация"
CALL DOCLOCKFIELDS_INSERTFIELD('Разблокировка редактирования классификации',5503,1,550311049,1) ;

CALL DOCLOCK_IMPORT('На изменение вида организации(госучреждения)',0,9903,0,0,9,0,'(([990310057] >= 10800) и ([990310057] <= 11099) и   (Максимум([990312091]) = 0) и   (Сумма([990312089]) <= Сумма([990312090]))) или (([990310057] >= 10000) и ([990310057] <= 10499) и   (Максимум([990312088]) = 0) и (Максимум([990312092])= 0) и   (Максимум([990312090]) = 0) и (Максимум([990312093]) = 0)) или (([990310057] >= 10500) и ([990310057] <= 10799) и   (Максимум([990312091]) = 0) и (Максимум([990312088]) = 0) и   (Максимум([990312092])= 0) и (Максимум([990312090]) = 0) и  (Максимум([990312093]) = 0)) или (([990310057] >= 20000) и ([990310057] <= 999999)) или ([990310057] = 0)',0,3,'Проверка соответствия характеров л/с виду организации для организаций с видом 01.00.00 - 01.10.99(госучреждения, МУП, ГУП)',0,'Характеры лицевых счетов в детализации не совпадают с выбранным видом организации',0,'',1) ;

CALL DOCLOCKFIELDS_DELETE('На изменение вида организации(госучреждения)', 9903, 0, 0, 1) ;

-- Поле "Вид организации"
CALL DOCLOCKFIELDS_INSERTFIELD('На изменение вида организации(госучреждения)',9903,0,990310057,1) ;

CALL DOCLOCK_IMPORT('Блокировка бюджетных полномочий',32768,9903,0,0,3,0,'([990310057]<10000) или ([990310057]>19999) или (([990310057] >= 10800) и ([990310057] <= 11099))',0,3,'Запрет редактирования полей бюджетных полномочий для всех огранизаций, кроме финорганов, распорядителей и казенных учреждений',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Блокировка бюджетных полномочий', 9903, 0, 0, 1) ;

-- Поле "По СВР(Бюджетные полномочия)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка бюджетных полномочий',9903,0,990310090,1) ;

-- Поле "По доходам(Бюджетные полномочия)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка бюджетных полномочий',9903,0,990310089,1) ;

-- Поле "По источникам(Бюджетные полномочия)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка бюджетных полномочий',9903,0,990310088,1) ;

-- Поле "По расходам(Бюджетные полномочия)"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка бюджетных полномочий',9903,0,990310087,1) ;

CALL DOCLOCK_IMPORT('Фильтрация получателя полномочий',0,9903,2,0,11,0,'',0,3,'Фильтрация получателя полномочий. Вид организации должен быть БУ/АУ или МУП(ГУП) ',0,'Указанная организация не может являться получателем полномочий. Получателями полномочий могут быть только БУ/АУ',null,'[960110035] between 10800 and 11099',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтрация получателя полномочий', 9903, 2, 0, 1) ;

-- Поле "Получатель полномочий"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтрация получателя полномочий',9903,2,990312098,1) ;

CALL DOCLOCK_IMPORT('Фильтрация КВСР по организации-владельцу',0,9903,2,0,11,0,'',0,3,'Фильтрация КВСР для соответствия КВСР организации-владельцу или нулевому',0,'КВСР должен быть нулевым или совпадать с КВСР организации-владельца',null,'([980310002] = 0) или ([980310002] = Документ.[990310058])',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтрация КВСР по организации-владельцу', 9903, 2, 0, 1) ;

-- Поле "КВСРКлюч"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтрация КВСР по организации-владельцу',9903,2,990312042,1) ;

CALL DOCLOCK_IMPORT('Блокировка отрицательных типов пакетов',32768,9914,-1,0,5,0,'[991410004]<0',1,3,'Блокировка отрицательных типов пакетов от изменения и удаления',1,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Блокировка отрицательных типов пакетов', 9914, -1, 0, 1) ;

-- Поле "Категория по умолчанию"
CALL DOCLOCKFIELDS_INSERTFIELD('Блокировка отрицательных типов пакетов',9914,-1,991410008,1) ;

CALL DOCLOCK_IMPORT('Изменение чужих данных',2,9915,-1,0,8,2,'',1,1,'Разрешение на внесение изменений в документы, созданные другими пользователями. Изменять документы разрешается только указанному списку пользователей.',2,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Изменение чужих данных', 9915, -1, 0, 1) ;

CALL DOCLOCK_IMPORT('Фильтр для счетов 5-го раздела',0,9920,1,0,11,0,'',0,1,'Запрещает ввод счетов с ненулевым 22-м разрядом для счетов 5-го раздела',0,'Неверное значение классификатора. У счетов 5-го раздела 22-й разряд должен быть нулевым',null,'(не ([986510004] like ''5*'')) или (([986510004] like ''5*'') и ([986510004] like ''???0*''))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр для счетов 5-го раздела', 9920, 1, 0, 1) ;

-- Поле "Кредит"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр для счетов 5-го раздела',9920,1,992011010,1) ;

CALL DOCLOCK_IMPORT('Фильтр для счетов 5-го раздела дебет',0,9920,1,0,11,0,'',0,1,'Запрещает ввод счетов с ненулевым 22-м разрядом для счетов 5-го раздела',0,'Неверное значение классификатора. У счетов 5-го раздела 22-й разряд должен быть нулевым',null,'(не ([986510004] like ''5*'')) или (([986510004] like ''5*'') и ([986510004] like ''???0*''))',1) ;

CALL DOCLOCKFIELDS_DELETE('Фильтр для счетов 5-го раздела дебет', 9920, 1, 0, 1) ;

-- Поле "Дебет"
CALL DOCLOCKFIELDS_INSERTFIELD('Фильтр для счетов 5-го раздела дебет',9920,1,992011011,1) ;

CALL DOCLOCK_IMPORT('Запрет редактирования прав доступа',32768,9924,-1,0,3,0,'[992410004] <> 1',0,3,'Редактирование прав доступа разрешается только для подписей с принадлежностью "Бюджет"',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Запрет редактирования прав доступа', 9924, -1, 0, 1) ;

-- Поле "Доступ"
CALL DOCLOCKFIELDS_INSERTFIELD('Запрет редактирования прав доступа',9924,-1,992410002,1) ;

CALL DOCLOCK_IMPORT('Системные уведомления заголовок',262144,9926,0,0,5,0,'([992610001]<100) and (ПолеНеПустое([992610001]))',1,3,'',0,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Системные уведомления заголовок', 9926, 0, 0, 1) ;

-- Поле "Наименование"
CALL DOCLOCKFIELDS_INSERTFIELD('Системные уведомления заголовок',9926,0,992610002,1) ;

-- Поле "Используется в системе состояний"
CALL DOCLOCKFIELDS_INSERTFIELD('Системные уведомления заголовок',9926,0,992610005,1) ;

CALL DOCLOCK_IMPORT('Изменение чужих данных',2,9929,0,0,8,2,'',1,1,'Разрешение на внесение изменений в документы, созданные другими пользователями. Изменять документы разрешается только указанному списку пользователей.',2,'',null,'',1) ;

CALL DOCLOCKFIELDS_DELETE('Изменение чужих данных', 9929, 0, 0, 1) ;

DROP PROCEDURE DOCLOCK_IMPORT      
/

DROP PROCEDURE DocLockFields_InsertField
/

DROP PROCEDURE DOCLOCK_DELETE
/

DROP PROCEDURE DOCLOCKFIELDS_DELETE
/

CREATE OR REPLACE PROCEDURE LINKTYPE_DELETE(
  NAME_         VARCHAR2,
  TEMPLATECLS_  NUMBER,
  PARENTDOCCLS_ NUMBER,
  CHILDDOCCLS_  NUMBER) IS
BEGIN
  FOR tab_rec in (SELECT id FROM LINKTYPE LT
  WHERE (((NAME_ <> '') or (NAME_ is not null)) and (LT.NAME = NAME_)) or 
    (((NAME_ = '') or (NAME_ is null)) and (LT.TEMPLATECLS = TEMPLATECLS_ AND LT.PARENTDOCCLS = PARENTDOCCLS_ AND LT.CHILDDOCCLS = CHILDDOCCLS_)))    
  LOOP
    UPDATE STATE_JUMPCONTROL SET
      REFERENCEREF = NULL
    WHERE REFERENCEREF = tab_rec.id;
    DELETE FROM REPLACEMENTCLSDETAIL WHERE LINKID IN (SELECT ID FROM LINKRECORDS
      WHERE LINKTYPEREF = tab_rec.id);
    DELETE FROM LINKRECORDS
      WHERE LINKTYPEREF = tab_rec.id;
    DELETE FROM LINKTYPE LT
      WHERE LT.ID = tab_rec.id;
  END LOOP;     
END;
/

CREATE OR REPLACE PROCEDURE LINKTYPE_IMPORT(
   ID_                    NUMBER,
   NAME_                  VARCHAR2,
   TEMPLATECLS_           NUMBER,
   PARENTDOCCLS_          NUMBER,
   CHILDDOCCLS_           NUMBER,
   LINKCOMMENT_           VARCHAR2,
   BLOCKPARENT_           NUMBER,
   BLOCKCHILD_            NUMBER,
   CANDELBLOCKPARENT_     NUMBER,
   CANDELBLOCKCHILD_      NUMBER,
   PARENTPICTURETYPE_     NUMBER,
   PARENTPICTURENAME_     VARCHAR2,
   CHILDPICTURETYPE_      NUMBER,
   CHILDPICTURENAME_      VARCHAR2,
   PICTURECOLLECTIONNAME_ VARCHAR2,
   URMUSE_                NUMBER,
   DELMACROSNAME_         VARCHAR2,
   NEEDDELCHILD_          NUMBER,
   LINKKIND_              NUMBER
) IS
   CNT$ NUMBER(10);
BEGIN
   /* попытаемся объединить с переданной записью уже существующие в БД записи, но с другим значимым ключом*/
   /* объединяем записи, если код шаблона, родитель, дочерний совпадают, либо совпадает Имя типа связи*/
   IF (
   ((TEMPLATECLS_ is not null)and(TEMPLATECLS_<>0))or(Name_ is not null))   
   THEN
     FOR tab_rec in(SELECT id FROM LINKTYPE LT WHERE 
		 (id<>ID_)	
         and(((TEMPLATECLS_ is not null)and(TEMPLATECLS_<>0)and(LT.TEMPLATECLS = TEMPLATECLS_)
         and (LT.PARENTDOCCLS = PARENTDOCCLS_) and (LT.CHILDDOCCLS = CHILDDOCCLS_))
         or((Name_ is not null)and(lt.Name=Name_))))
     LOOP
        /* переключаем связи на новый тип связи опосредованно через промежуточный временно созданный тип связи*/    
        DELETE FROM LINKRECORDS WHERE LINKTYPEREF = -10;  
        DELETE FROM TB_LINKTYPE WHERE ID = -10;
        DELETE FROM DOCUMENTCLS WHERE ID = -10;
        DELETE FROM DOCUMENTTYPES WHERE ID = -10;
        INSERT INTO DOCUMENTTYPES(ID, PROGINDEX) VALUES(-10, -10);
        INSERT INTO DOCUMENTCLS(ID, DOCTYPE, TABLENAME, TABLENAMEURM, PRIMARYKEYNAME, PRIMARYKEYNAMEURM)
           VALUES(-10, -10, ' ', ' ', ' ', ' ');
        INSERT INTO LINKTYPE(ID, PARENTDOCCLS, CHILDDOCCLS, NAME) VALUES(-10, -10, -10, ' ');
        UPDATE STATE_JUMPCONTROL SET
           REFERENCEREF = -10
        WHERE
           REFERENCEREF = tab_rec.id;
        UPDATE LINKRECORDS SET
           LINKTYPEREF = -10
        WHERE
           LINKTYPEREF = tab_rec.id;
        DELETE FROM TB_LINKTYPE WHERE ID = tab_rec.Id;
     END LOOP;
   end if;
   /* создаем или обновляем новый тип связи*/ 
   SELECT count(*) into CNT$
      FROM LINKTYPE LT WHERE LT.ID = ID_;
   IF (CNT$ = 0)    
   THEN
      INSERT INTO LINKTYPE
       (ID,NAME,TEMPLATECLS,PARENTDOCCLS, CHILDDOCCLS, LINKCOMMENT, BLOCKPARENT,BLOCKCHILD,CANDELBLOCKPARENT,
        CANDELBLOCKCHILD, PARENTPICTURETYPE,PARENTPICTURENAME,CHILDPICTURETYPE,CHILDPICTURENAME,
        PICTURECOLLECTIONNAME,URMUSE,DELMACROSNAME,NEEDDELCHILD,LINKKIND)
      VALUES
       (ID_,NAME_,TEMPLATECLS_, PARENTDOCCLS_, CHILDDOCCLS_, LINKCOMMENT_, BLOCKPARENT_,BLOCKCHILD_,CANDELBLOCKPARENT_,
        CANDELBLOCKCHILD_, PARENTPICTURETYPE_,PARENTPICTURENAME_,CHILDPICTURETYPE_,CHILDPICTURENAME_,
        PICTURECOLLECTIONNAME_,URMUSE_,DELMACROSNAME_,NEEDDELCHILD_,LINKKIND_);
   ELSE
      UPDATE LINKTYPE SET
         NAME = NAME_,
         TEMPLATECLS = TEMPLATECLS_,
         PARENTDOCCLS = PARENTDOCCLS_,
         CHILDDOCCLS = CHILDDOCCLS_,
         LINKCOMMENT = LINKCOMMENT_,
         BLOCKPARENT = BLOCKPARENT_,
         BLOCKCHILD = BLOCKCHILD_,
         CANDELBLOCKPARENT = CANDELBLOCKPARENT_,
         CANDELBLOCKCHILD = CANDELBLOCKCHILD_,
         PARENTPICTURETYPE = PARENTPICTURETYPE_,
         PARENTPICTURENAME = PARENTPICTURENAME_,
         CHILDPICTURETYPE = CHILDPICTURETYPE_,
         CHILDPICTURENAME = CHILDPICTURENAME_,
         PICTURECOLLECTIONNAME = PICTURECOLLECTIONNAME_,
         URMUSE = URMUSE_,
         DELMACROSNAME = DELMACROSNAME_,
         NEEDDELCHILD = NEEDDELCHILD_,
         LINKKIND = LINKKIND_
      WHERE ID = ID_;
   END IF;      
   
   /* переключаем ранее найденные записи с типом, требующим объединения на новый тип связи*/
   UPDATE STATE_JUMPCONTROL SET
     REFERENCEREF = ID_
   WHERE
     REFERENCEREF = -10;
   UPDATE LINKRECORDS SET
      LINKTYPEREF = ID_
   WHERE
      LINKTYPEREF = -10;
   /* удаляем временные записи*/  
   DELETE FROM TB_LINKTYPE WHERE ID = -10;
   DELETE FROM DOCUMENTCLS WHERE ID = -10;
   DELETE FROM DOCUMENTTYPES WHERE ID = -10;
END;
/

-- Типы связей
CALL LINKTYPE_DELETE('ИсполнительныеЛистыПоПЗКПлюс',0, 520101, 520101) ;

CALL LINKTYPE_IMPORT(20201900,'БА->ЛБО',null,20100,20100,'Связь БР БА с БР ЛБО',1,0,0,1,1,'',1,'','16на16',1,'',1,0) ;

CALL LINKTYPE_IMPORT(20202100,'БР->ПОФ по ПБС совмещенно заголовок',null,20100,20600,'Связь заголовка БР с заголовком ПОФ по ПБС совмещенно ',1,0,0,1,1,'',1,'','16на16',1,'',1,0) ;

CALL LINKTYPE_IMPORT(20202200,'БР->ПОФ по ПБС совмещенно деталь',null,20101,20601,'Связь детали БР с деталью ПОФ по ПБС совмещенно ',1,0,0,1,1,'',1,'','16на16',1,'',1,0) ;

CALL LINKTYPE_IMPORT(20202400,'РосписьПоПЗК',null,20101,20101,'Связь росписи с росписью для ПЗК',1,0,0,0,1,'',1,'','16на16',1,'',0,0) ;

CALL LINKTYPE_IMPORT(20203000,'СметаПДРасходыПоПЗК',null,20401,20401,'Связь сметы по ПД со сметой по ПД для ПЗК',1,0,0,0,1,'',1,'','16на16',1,'',0,0) ;

CALL LINKTYPE_IMPORT(252500100,'ДоговораПоПЗК',null,250202,250202,'Связь договора с договором для ПЗК',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(252500200,'ДоговораПоПЗКПлюс',null,250202,250202,'Связь договора с договором для ПЗК плюс',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(520300100,'Исполнительный лист - платежное поручение(старая)',null,520100,30201,'Связь исполнительного листа и платежного поручения, когда нет БО',0,0,0,0,1,'',1,'','',0,'',0,0) ;

CALL LINKTYPE_IMPORT(524800100,'ИсполнительныеЛистыОбуславливающиеДокументы',null,520100,480100,'Связь исполнительных листов с обуславливающими документами',0,0,0,0,1,'',1,'','16на16',1,'',0,0) ;

CALL LINKTYPE_IMPORT(524900100,'ИсполнительныеЛистыПрикрепленныеФайлы2',null,520100,490200,'Связь исполнительных листов с прикрепленными файлами',0,0,0,0,2,'Привязать',1,'','16на16',1,'',0,1) ;

CALL LINKTYPE_IMPORT(254800100,'МупКонтрактыОбуславливающиеДокументы',null,250400,480100,'Связь муниципальных контрактов с обуславливающими документами',0,0,0,0,1,'',1,'','16на16',1,'',0,0) ;

CALL LINKTYPE_IMPORT(303000100,'ЗаявкиНаЗакупкуПоПЗК',null,300101,300101,'Связь заявки на закупку с заявкой на закупку для ПЗК',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(303000200,'ЗаявкиНаЗакупкуПоПЗКПлюс',null,300101,300101,'Связь заявки на закупку с заявкой на закупку для ПЗК Плюс',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(34902800,'ПеречислениеПрикрепленныеФайлы2',null,31100,490200,'Связь перечисления с прикрепленными файлами',0,0,0,0,2,'Привязать',1,'','16на16',1,'',0,1) ;

CALL LINKTYPE_IMPORT(522500100,'Исполнительный лист - БО (Договор)_старая',null,520101,250203,'Связь детализации исполнительного листа с БО (Договора)',0,0,0,0,1,'',1,'','',1,'',0,0) ;

CALL LINKTYPE_IMPORT(34903000,'ПодтверждениеВозвратаПрикрепленныеФайлы2',null,31500,490200,'Связь подтверждения с прикрепленными файлами',0,0,0,0,2,'Привязать',1,'','16на16',1,'',0,1) ;

CALL LINKTYPE_IMPORT(522500200,'Исполнительный лист - БО (Контракт)_старая',null,520101,250403,'Связь детализации исполнительного листа с БО (Контракты)',0,0,0,0,1,'',1,'','',1,'',0,0) ;

CALL LINKTYPE_IMPORT(20204000,'СведенияБУАУЗагСведенияБУАУЗаг',null,20400,20400,'Связь сведений БУ АУ со сведениями БУ АУ',1,0,0,0,1,'',1,'','16на16',1,'',0,0) ;

CALL LINKTYPE_IMPORT(24403100,'ВнутренниеРР->КУ (Заголовок)',null,21000,440300,'Связь заголовка внутреннего расходного расписания с заголовком казначейского уведомления',1,0,0,1,1,'',1,'','',0,'',1,0) ;

CALL LINKTYPE_IMPORT(444900500,'РасходныеРасписанияПрикрепленныеФайлы',null,440100,490200,'Связь расходного расписания с прикрепленными файлами',0,0,0,0,2,'Привязать',1,'','16на16',0,'',0,1) ;

CALL LINKTYPE_IMPORT(24403200,'ВнутренниеРР (БА, ЛБО)->КУ',null,21001,440301,'Связь БА, ЛБО внутреннего расходного расписания с деталью казначейского уведомления',1,0,0,1,1,'',1,'','',0,'',1,0) ;

CALL LINKTYPE_IMPORT(24403300,'ВнутренниеРР (ПОФ)->КУ',null,21002,440301,'Связь ПОФ внутреннего расходного расписания с деталью казначейского уведомления',1,0,0,1,1,'',1,'','',0,'',1,0) ;

CALL LINKTYPE_IMPORT(521600100,'Исполнительный лист - БО (Расшифровка к договору)',null,520101,160101,'Связь детализации исполнительного листа со старым БО ',0,0,0,0,1,'',1,'','',1,'',0,0) ;

CALL LINKTYPE_IMPORT(30303400,'РаспределениеОФ->РаспределениеОФ',null,32400,32400,'Связь распределения ОФ с распределением ОФ',1,0,0,1,1,'',1,'','',1,'',1,0) ;

CALL LINKTYPE_IMPORT(30303500,'РаспределениеОФДеталь->РаспределениеОФДеталь',null,32401,32401,'Связь распределения ОФ деталь с распределением ОФ деталь',1,0,0,1,1,'',1,'','',1,'',1,0) ;

CALL LINKTYPE_IMPORT(20204100,'РосписьГРБСДеталь->РосписьГРБСДеталь',null,20101,20101,'Связь детали росписи ГРБС с деталью росписи ГРБС',1,0,0,1,1,'',1,'','16на16',1,'',1,0) ;

CALL LINKTYPE_IMPORT(522500300,'Исполнительный лист - БО (Документ исполнения)',null,520101,250302,'Связь детализации исполнительного листа с БО (Документы исполнения)',0,0,0,0,1,'',1,'','',1,'',0,0) ;

CALL LINKTYPE_IMPORT(24800800,'КассовыйПланПодневнойОбуславливающиеДокументы',null,20900,480100,'Связь росписи ГРБС с обуславливающими документами',0,0,0,0,1,'',1,'','16на16',1,'',0,0) ;

CALL LINKTYPE_IMPORT(24901600,'КассовыйПланПодневнойПрикрепленныеФайлы2',null,20900,490200,'Связь Росписей ГРБС, кассовых планов ПБС по расходам с прикрепленными файлами',0,0,0,0,2,'Привязать',1,'','16на16',1,'',0,1) ;

CALL LINKTYPE_IMPORT(24901700,'КассовыйПланПодневнойЭлектронныйАрхив',null,20900,490300,'Связь Росписей ГРБС, кассовых планов ПБС по расходам с архивными документами',0,0,1,1,2,'Портфель_связь',1,'','16на16',0,'',0,3) ;

CALL LINKTYPE_IMPORT(525200100,'ИсполнительныеЛистыПоПЗКЗаголовок',null,520100,520100,'Связь исполнительного листа с уточненным исполнительным листом',1,0,0,0,1,'',1,'','',1,'',1,0) ;

CALL LINKTYPE_IMPORT(525200200,'ИсполнительныеЛистыПоПЗК',null,520101,520101,'Связь исп листа с исп листом по ПЗК',1,0,0,0,1,'',1,'','',1,'',1,0) ;

CALL LINKTYPE_IMPORT(484800100,'ОбуславливающиеДокументыОбуславливающиеДокументы',null,480100,480100,'Связь Обуславливающего документа с другим обуславливающим документом',0,0,0,0,1,'',1,'','16на16',1,'',0,0) ;

CALL LINKTYPE_IMPORT(520300200,'ИспЛистДеталь - ПлатежкаДеталь',null,520101,30201,'Связь детали исплиста и детали платежки',0,0,0,0,1,'',1,'','',0,'',0,0) ;

CALL LINKTYPE_IMPORT(520300300,'ИспЛистЗаголовок - ПлатежкаЗаголовок',null,520100,30200,'Связь заголовка исплиста и заголовка платежки',0,0,0,0,1,'',1,'','',0,'',0,0) ;

CALL LINKTYPE_IMPORT(24800900,'ПодневнойКассовыйПланОбслуживающиеДокументы',null,21100,480100,'Связь росписи ГРБС с обуславливающими документами',0,0,0,0,1,'',1,'','16на16',1,'',0,0) ;

CALL LINKTYPE_IMPORT(20204200,'ПодневнойКассовыйПланПЗК',null,21101,21101,'Связь детализацию подневного КП с детализацией подневной КП для ПЗК',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(24901800,'ПодневнойКассовыйПланПрикрепленныеФайлы',null,21100,490200,'Связь Росписей ГРБС, кассовых планов ПБС по расходам с прикрепленными файлами',0,0,0,0,2,'Привязать',1,'','16на16',1,'',0,1) ;

CALL LINKTYPE_IMPORT(20204300,'ПодневнойКассовыйПланПЗКПлюс',null,21101,21101,'Связь детализацию подневного КП с детализацией подневной КП для ПЗК плюс',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(24901900,'ПодневнойКассовыйПланЭлектронныйАрхив',null,21100,490300,'Связь Росписей ГРБС, кассовых планов ПБС по расходам с архивными документами',0,0,1,1,2,'Портфель_связь',1,'','16на16',0,'',0,3) ;

CALL LINKTYPE_IMPORT(303000300,'ПлановыеЗаявкиПоПЗК',null,300601,300601,'',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(303000500,'ИтогиКонкурсаПоПЗК',null,300300,300300,'',1,0,0,0,1,'',1,'','',0,'',0,0) ;

CALL LINKTYPE_IMPORT(303000400,'ПлановыеЗаявкиПоПЗКПлюс',null,300601,300601,'',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(994900200,'ОрганизацииПрикрепленныеФайлы',null,990300,490200,'Связь организаций с прикрепленными файлами',0,0,0,0,2,'Привязать',1,'','16на16',1,'',0,1) ;

CALL LINKTYPE_IMPORT(24801000,'ПодневныеСведенияБУАУОбслуживающиеДокументы',null,21200,480100,'Связь росписи ГРБС с обуславливающими документами',0,0,0,0,1,'',1,'','16на16',1,'',0,0) ;

CALL LINKTYPE_IMPORT(20204400,'ПодневныеСведенияБУАУПЗК',null,21201,21201,'Связь детализацию подневных сведений БУ, АУ с детализацией подневных сведений БУ, АУ для ПЗК',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(24902000,'ПодневныеСведенияБУАУПрикрепленныеФайлы',null,21200,490200,'Связь Росписей ГРБС, кассовых планов ПБС по расходам с прикрепленными файлами',0,0,0,0,2,'Привязать',1,'','16на16',1,'',0,1) ;

CALL LINKTYPE_IMPORT(20204500,'ПодневныеСведенияБУАУПЗКПлюс',null,21201,21201,'Связь детализацию подневных БУ, АУ с детализацией подневных БУ, АУ для ПЗК плюс',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(24902100,'ПодневныеСведенияБУАУЭлектронныйАрхив',null,21200,490300,'Связь Росписей ГРБС, кассовых планов ПБС по расходам с архивными документами',0,0,1,1,2,'Портфель_связь',1,'','16на16',0,'',0,3) ;

CALL LINKTYPE_IMPORT(30303600,'КазнПП->ПОФ',null,30201,32301,'',1,1,0,0,1,'',1,'','',0,'',1,0) ;

CALL LINKTYPE_IMPORT(30303700,'КазнПП_Заголовок->ПОФ_Заголовок',null,30200,32300,'',1,1,0,0,1,'',1,'','',0,'',1,0) ;

CALL LINKTYPE_IMPORT(30303800,'КазнПП->ВозвратПП',null,30200,30500,'Связь платежки с документом возврата в приходе от прочих',0,0,0,0,1,'',1,'','',0,'',0,0) ;

CALL LINKTYPE_IMPORT(520300400,'ИспЛистДеталь - ВозвратППДеталь',null,520101,30501,'',0,0,0,0,1,'',1,'','',0,'',0,0) ;

CALL LINKTYPE_IMPORT(520300500,'ИспЛистЗаголовок - ВозвратППЗаголовок',null,520100,30500,'',0,0,0,0,1,'',1,'','',0,'',0,0) ;

CALL LINKTYPE_IMPORT(252500700,'МупКонтрактыПоПЗК',null,250402,250402,'Связь муниципального контракта с муниципальным контрактом для ПЗК',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(252500800,'МупКонтрактыПоПЗКПлюс',null,250402,250402,'Связь муниципального контракта с муниципальным контрактом для ПЗК плюс',1,0,0,0,1,'',1,'','16на16',0,'',0,0) ;

CALL LINKTYPE_IMPORT(522500400,'Исполнительный лист - БО (Контракт)',null,520101,250402,'Связь детализации исполнительного листа с БО (Контракты)',0,0,0,0,1,'',1,'','',1,'',0,0) ;

CALL LINKTYPE_IMPORT(444900600,'РасходныеРасписания->ЭлектронныйАрхив',null,440100,490300,'Связь расходных расписаний с архивными документами',0,0,1,1,2,'Портфель_связь',1,'','16на16',0,'',0,3) ;

CALL LINKTYPE_IMPORT(522500500,'Исполнительный лист - БО (Договор)',null,520101,250202,'Связь детализации исполнительного листа с БО (Договора)',0,0,0,0,1,'',1,'','',1,'',0,0) ;

DROP PROCEDURE LINKTYPE_DELETE
/

DROP PROCEDURE LINKTYPE_IMPORT
/

CREATE OR REPLACE PROCEDURE STATICLINK_DELETE(ID_ NUMBER) IS
BEGIN
  DELETE FROM STATICLINKS SL
  WHERE SL.ID = ID_;
END;
/

CREATE OR REPLACE PROCEDURE STATICLINK_IMPORT(
  ID_             NUMBER,
  NAME_           VARCHAR2,
  PARENTFIELDREF_ NUMBER,
  CHILDFIELDREF_  NUMBER,
  LINKKIND_      NUMBER,
  ParentDelAction_ NUMBER
) IS
  FINDID$ NUMBER;
  FINDNEWID$ NUMBER;
  IDExists$ NUMBER;
BEGIN
  /* Связь идентифицируется либо по ID, либо по паре CHILDFIELDREF,PARENTFIELDREF. 
   Проверяем, возможно уже есть такая связь, но с другим ID. В этом случае меняем у нее ID на новое, 
   либо(если есть ссылки) создаем запись с новым id , а старую после перекидки ссылок удаляем*/
  BEGIN
    SELECT
      SL.ID
    INTO FINDID$
    FROM 
      STATICLINKS SL
    WHERE (SL.CHILDFIELDREF = CHILDFIELDREF_) AND (SL.PARENTFIELDREF = PARENTFIELDREF_) AND (SL.ID <> ID_);
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      FINDID$ := NULL;
  END;
  
  IF (FINDID$ IS NOT NULL) THEN
  /* Кроме самого ID меняем также и ссылки на него из других таблиц*/

    SELECT COUNT (ID)
      INTO IDExists$
      FROM STATE_JUMPCONTROL
    WHERE (STATICLINKREF = FINDID$);

    IF (IDExists$ > 0) THEN

      BEGIN
        SELECT
          SL.ID
        INTO FINDNEWID$
        FROM 
          STATICLINKS SL
        WHERE (SL.ID = ID_);
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          FINDNEWID$ := NULL;
      END;
 
      IF (FINDNEWID$ IS NULL) THEN
        INSERT INTO STATICLINKS
         (ID,NAME,PARENTFIELDREF,CHILDFIELDREF,LINKKIND,ParentDelAction)
        VALUES
          (ID_,NAME_,CHILDFIELDREF_,PARENTFIELDREF_,1,ParentDelAction_);
      END IF;        
      UPDATE STATE_JUMPCONTROL
        SET STATICLINKREF = ID_
      WHERE (STATICLINKREF = FINDID$);

      DELETE FROM STATICLINKS  
      WHERE ID=FINDID$;
    ELSE   
      BEGIN
        SELECT
          SL.ID
        INTO FINDNEWID$
        FROM
          STATICLINKS SL
        WHERE (SL.ID = ID_);
      EXCEPTION
        WHEN NO_DATA_FOUND THEN
          FINDNEWID$ := NULL;
      END;
      IF (FINDNEWID$ IS NULL) THEN
        UPDATE STATICLINKS
        SET ID=ID_
        WHERE ID=FINDID$;
      ELSE
        DELETE FROM STATICLINKS
        WHERE ID=FINDID$;
      END IF;
    END IF;
      
  END IF; /* Заменили id на новое*/
  
  /* Если добавляем связь с нулевым видом связи(простая связь), 
  то поищем, нет ли других связей с нулевым видом и с таким же CHILDFIELDREF.
  Если есть, то изменим у них вид связи на 1(множественная связь)*/
  IF (LINKKIND_=0) THEN
    UPDATE STATICLINKS
    SET LINKKIND=1  
    WHERE (CHILDFIELDREF = CHILDFIELDREF_) AND (ID <> ID_) AND (LINKKIND=0);
  END IF;    
  
  /* Проверяем есть ли уже связь с таким id. Если есть, то обновляем ее. Если нет, то добавляем */
  BEGIN
    SELECT SL.ID
      INTO FINDID$
      FROM
        STATICLINKS SL
      WHERE
        (SL.ID = ID_);
  EXCEPTION
      WHEN NO_DATA_FOUND THEN
        FINDID$ := NULL;
  END;
  IF (FINDID$ IS NOT NULL) THEN
    UPDATE STATICLINKS SET
      NAME           = NAME_,
      PARENTFIELDREF = PARENTFIELDREF_,
      CHILDFIELDREF  = CHILDFIELDREF_,
      LINKKIND       = LINKKIND_,
      ParentDelAction = ParentDelAction_
      WHERE ID = ID_;
  ELSE
    INSERT INTO STATICLINKS
     (ID,NAME,PARENTFIELDREF,CHILDFIELDREF,LINKKIND,ParentDelAction)
    VALUES
      (ID_,NAME_,PARENTFIELDREF_,CHILDFIELDREF_,LINKKIND_,ParentDelAction_);
  END IF;      

END;
/

-- Внутренние связи
CALL STATICLINK_DELETE(982500100) ;

CALL STATICLINK_DELETE(982502300) ;

CALL STATICLINK_DELETE(982501900) ;

CALL STATICLINK_DELETE(982501000) ;

CALL STATICLINK_DELETE(962500900) ;

CALL STATICLINK_DELETE(982502500) ;

CALL STATICLINK_DELETE(983001000) ;

CALL STATICLINK_DELETE(983000700) ;

CALL STATICLINK_DELETE(993000400) ;

CALL STATICLINK_DELETE(983002000) ;

CALL STATICLINK_DELETE(992501100) ;

CALL STATICLINK_DELETE(982503000) ;

CALL STATICLINK_DELETE(982503400) ;

CALL STATICLINK_DELETE(982504900) ;

CALL STATICLINK_DELETE(982504500) ;

CALL STATICLINK_DELETE(982503600) ;

CALL STATICLINK_DELETE(992501600) ;

CALL STATICLINK_DELETE(965200000) ;

CALL STATICLINK_DELETE(965200100) ;

CALL STATICLINK_DELETE(990229300) ;

CALL STATICLINK_DELETE(980357300) ;

CALL STATICLINK_IMPORT(980331000,'КазнПодтвПеречисл_СчетНал.SOURCEFACIALACC_CLS(ЛицСчетПлатЗаголовок)->ЛицСчета.ID',984110021,31210022,0,0) ;

CALL STATICLINK_IMPORT(980332100,'КазнПодтвПеречисл_СчетНал.1.DESTKVR(КВРКлюч)->КВР.ID',980410002,31211016,0,0) ;

CALL STATICLINK_IMPORT(980332200,'КазнПодтвПеречисл_СчетНал.1.DESTKVSR(КВСРКлюч)->КВСР.ID',980310002,31211018,0,0) ;

CALL STATICLINK_IMPORT(980331800,'КазнПодтвПеречисл_СчетНал.1.DESTKCSR(КЦСРКлюч)->КЦСР.ID',980510002,31211019,0,0) ;

CALL STATICLINK_IMPORT(444400500,'РасхРасписания.1.ID(КодДокумента)->РасхРасписания.ID(КодДокумента)',440110010,440110010,0,0) ;

CALL STATICLINK_IMPORT(980332400,'КазнПодтвПеречисл_СчетНал.1.DESTREGIONCLS(РайонТрансферта)->Районы.ID',981210005,31211101,0,0) ;

CALL STATICLINK_IMPORT(990312100,'КазнПодтвПеречисл_СчетНал.1.BUDGETREF(КодБюджета)->Бюджеты.ID',987810006,31211112,0,0) ;

CALL STATICLINK_IMPORT(30304100,'КазнУтверждениеОФ.1.ID(КодДокумента)->КазнУтверждениеОФ.ID(КодДокумента)',32310045,32310045,0,0) ;

CALL STATICLINK_IMPORT(222200200,'КП_Доходы.1.ID(КодДокумента)->КП_Доходы.ID(КодДокумента)',220110045,220110045,0,0) ;

CALL STATICLINK_IMPORT(20202200,'ЗаконОБюджете.1.ID(КодДокумента)->ЗаконОБюджете.ID(КодДокумента)',20510026,20510026,0,0) ;

CALL STATICLINK_IMPORT(999902600,'ПредметыЗаявки.OKPCLS->ОКП.ID',988810005,986110021,0,0) ;

CALL STATICLINK_IMPORT(969600300,'СчетаФО.ID->СчетаОрганизаций.ID',960210024,960410007,0,0) ;

CALL STATICLINK_IMPORT(30304000,'КазнВнебюджетВнутрПлат.1.ID(КодДокумента)->КазнВнебюджетВнутрПлат.ID(КодДокумента)',30810011,30810011,0,0) ;

CALL STATICLINK_IMPORT(985200300,'ИсполнительныеЛисты.FACIALACC_CLS(ЛицевойСчетДеталь)->ЛицСчета.ID',984110021,520111005,0,0) ;

CALL STATICLINK_IMPORT(985200500,'ИсполнительныеЛисты.1.MEANSTYPE(ТипСредств)->ТипСредств.ID',984910002,520111017,0,0) ;

CALL STATICLINK_IMPORT(990335900,'КазнВнебюджетВнутрПлат.1.DESTIFS(ИсточникВнутрФинансированияКлючПолуч)->ИФДБ.ID',985210008,30811094,0,0) ;

CALL STATICLINK_IMPORT(990335800,'КазнВнебюджетВнутрПлат.1.SOURCEIFS(ИсточникВнутрФинансированияКлюч,ИсточникВнутрФинансированияКлючПлат)->ИФДБ.ID',985210008,30811098,0,0) ;

CALL STATICLINK_IMPORT(995504000,'ПротоколПЗК.1.TRANSFERTCLS(КодЦелевыхСредствКлюч)->КЦС.ID',988410002,550311025,0,0) ;

CALL STATICLINK_IMPORT(990335700,'КазнПодтвПеречисл_СчетНал.DEPARTMENTCLS(Отдел)->Отделы.ID',985910005,31210120,0,0) ;

CALL STATICLINK_IMPORT(990229500,'ПОФ_Подневный.2.ASSIGNMENTKIND(ВидАссигнований)->ВидыАссигнований.ID',988510003,20912001,0,1) ;

CALL STATICLINK_IMPORT(980226400,'ПОФ_Подневный.2.FacialAcc_Cls->ЛицСчета.ID',984110021,20912007,0,1) ;

CALL STATICLINK_IMPORT(980226500,'ПОФ_Подневный.2.MeansType->ТипыСредств.ID',984910002,20912021,0,1) ;

CALL STATICLINK_IMPORT(990227000,'ПОФ_Подневный.2.TransfertCls->ВидыТрансфертов.ID',988410002,20912035,0,1) ;

CALL STATICLINK_IMPORT(990227100,'ПОФ_Подневный.2.SubsidyCls->КодыСубсидии.ID',988910006,20912036,0,1) ;

CALL STATICLINK_IMPORT(999902700,'Пользователи.DEPARTMENTCLS->Отделы.ID',985910005,989910003,0,0) ;

CALL STATICLINK_IMPORT(20202100,'ПОФ_Подневный.1.RECORDINDEX(КодДокумента)->ПОФ_Подневный.ID(КодДокумента)',20910013,20911134,0,2) ;

CALL STATICLINK_IMPORT(990227800,'КП_Подневный.ASSIGNMENTSOURCE(ВидИзменений)->ВидыИзменений.ID',988610003,21110001,0,0) ;

CALL STATICLINK_IMPORT(990227900,'КП_Подневный.BUDGETREF(КодБюджета)->Бюджеты.ID',987810006,21110002,0,0) ;

CALL STATICLINK_IMPORT(990229200,'КП_Подневный.2.ASSIGNMENTKIND(ВидАссигнований)->ВидыАссигнований.ID',988510003,21112004,0,1) ;

CALL STATICLINK_IMPORT(980226800,'КП_Подневный.2.FACIALACC_CLS->ЛицСчета.ID',984110021,21112006,0,1) ;

CALL STATICLINK_IMPORT(980227300,'КП_Подневный.FACIALACCCLS(ЛицевойСчетЗаголовок)->ЛицСчета.ID',984110021,21110010,0,0) ;

CALL STATICLINK_IMPORT(980227400,'КП_Подневный.NOTIFYTYPE(ИсточникФинансирования)->ИстФинансирования.ID',981310002,21110016,0,0) ;

CALL STATICLINK_IMPORT(990228000,'КП_Подневный.PLANDOCTYPE(ВидПлана)->КЦС.ID',988410002,21110020,0,0) ;

CALL STATICLINK_IMPORT(980226900,'КП_Подневный.2.MEANSTYPE->ТипСредств.ID',984910002,21112020,0,1) ;

CALL STATICLINK_IMPORT(990228100,'КП_Подневный.REJECTCLS(ПричинаОтклонКод)->ПричиныОткл.ID',985010005,21110023,0,0) ;

CALL STATICLINK_IMPORT(990227400,'КП_Подневный.2.TRANSFERTCLS->КЦС.ID',988410002,21112028,0,1) ;

CALL STATICLINK_IMPORT(990227500,'КП_Подневный.2.SUBSIDYCLS->КодыСубсидии.ID',988910006,21112029,0,1) ;

CALL STATICLINK_IMPORT(20202300,'КП_Подневный.1.RECORDINDEX(КодДокумента)->КП_Подневный.ID(КодДокумента)',21110011,21111033,0,2) ;

CALL STATICLINK_IMPORT(981800000,'ФорИмп.KCSR->КЦСР.ID',980510002,181610005,0,0) ;

CALL STATICLINK_IMPORT(980909800,'Доходы_Выписка.1.FINTYPE(ТипФинансированияКлюч)->КодДопИнформации.ID',982710006,90311087,0,0) ;

CALL STATICLINK_IMPORT(980910100,'Доходы_СуммыВПути.FINTYPE->КодДопИнформации.ID',982710006,90510040,0,0) ;

CALL STATICLINK_IMPORT(980910000,'Доходы_Невыясненные.1.FINTYPE->КодДопИнформации.ID',982710006,90611082,0,0) ;

CALL STATICLINK_IMPORT(980205800,'ЗаконОБюджете.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,20511101,0,0) ;

CALL STATICLINK_IMPORT(980100800,'СводнРаспНаФинансирование.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,10111188,0,0) ;

CALL STATICLINK_IMPORT(980102400,'СводнРаспНаФинансирование.2.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,10112219,0,0) ;

CALL STATICLINK_IMPORT(980104600,'СводнРаспНаФинансирование.4.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,10114221,0,0) ;

CALL STATICLINK_IMPORT(980100400,'СводнРаспНаФинансирование.1.DOCUMENTBASETYPE(ТипДокОснования)->ДокОснования.ID',982910007,10111189,0,0) ;

CALL STATICLINK_IMPORT(980102000,'СводнРаспНаФинансирование.2.DOCUMENTBASETYPE(ТипДокОснования)->ДокОснования.ID',982910007,10112220,0,0) ;

CALL STATICLINK_IMPORT(980104200,'СводнРаспНаФинансирование.4.DOCUMENTBASETYPE(ТипДокОснования)->ДокОснования.ID',982910007,10114222,0,0) ;

CALL STATICLINK_IMPORT(990200400,'БР_Расходы.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,20111183,0,0) ;

CALL STATICLINK_IMPORT(980200500,'БР_Расходы.1.FACT(Мероприятие)->Мероприятия.ID',982810005,20111184,0,0) ;

CALL STATICLINK_IMPORT(980200600,'БР_Расходы.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,20111185,0,0) ;

CALL STATICLINK_IMPORT(980200000,'БР_Расходы.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,20110082,0,0) ;

CALL STATICLINK_IMPORT(990201100,'СБР_Расходы.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,20211105,0,0) ;

CALL STATICLINK_IMPORT(980201800,'СБР_Расходы.1.FACT(Мероприятие)->Мероприятия.ID',982810005,20211106,0,0) ;

CALL STATICLINK_IMPORT(980201900,'СБР_Расходы.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,20211107,0,0) ;

CALL STATICLINK_IMPORT(980201400,'СБР_Расходы.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,20210090,0,0) ;

CALL STATICLINK_IMPORT(990201800,'КП_Расходы.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,20311095,0,0) ;

CALL STATICLINK_IMPORT(980203100,'КП_Расходы.1.FACT(Мероприятие)->Мероприятия.ID',982810005,20311096,0,0) ;

CALL STATICLINK_IMPORT(980203200,'КП_Расходы.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,20311097,0,0) ;

CALL STATICLINK_IMPORT(980202700,'КП_Расходы.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,20310081,0,0) ;

CALL STATICLINK_IMPORT(990202500,'СметаПоПД_Расходы.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,20411114,0,0) ;

CALL STATICLINK_IMPORT(980204400,'СметаПоПД_Расходы.1.FACT(Мероприятие)->Мероприятия.ID',982810005,20411115,0,0) ;

CALL STATICLINK_IMPORT(980204500,'СметаПоПД_Расходы.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,20411116,0,0) ;

CALL STATICLINK_IMPORT(980204000,'СметаПоПД_Расходы.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,20410086,0,0) ;

CALL STATICLINK_IMPORT(990203200,'ЗаконОБюджете.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,20511102,0,0) ;

CALL STATICLINK_IMPORT(980205700,'ЗаконОБюджете.1.FACT(Мероприятие)->Мероприятия.ID',982810005,20511103,0,0) ;

CALL STATICLINK_IMPORT(980205300,'ЗаконОБюджете.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,20510089,0,0) ;

CALL STATICLINK_IMPORT(990203900,'КП_ПБС_Расходы.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,20611183,0,0) ;

CALL STATICLINK_IMPORT(980207100,'КП_ПБС_Расходы.1.FACT(Мероприятие)->Мероприятия.ID',982810005,20611184,0,0) ;

CALL STATICLINK_IMPORT(980207200,'КП_ПБС_Расходы.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,20611185,0,0) ;

CALL STATICLINK_IMPORT(980206600,'КП_ПБС_Расходы.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,20610089,0,0) ;

CALL STATICLINK_IMPORT(990206800,'КП_Месяц.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,20711182,0,0) ;

CALL STATICLINK_IMPORT(980208600,'КП_Месяц.1.FACT(Мероприятие)->Мероприятия.ID',982810005,20711183,0,0) ;

CALL STATICLINK_IMPORT(980208700,'КП_Месяц.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,20711184,0,0) ;

CALL STATICLINK_IMPORT(980208200,'КП_Месяц.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,20710160,0,0) ;

CALL STATICLINK_IMPORT(980210000,'КП_ПБС_Месяц.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,20811183,0,0) ;

CALL STATICLINK_IMPORT(990207900,'КП_ПБС_Месяц.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,20811184,0,0) ;

CALL STATICLINK_IMPORT(980209900,'КП_ПБС_Месяц.1.FACT(Мероприятие)->Мероприятия.ID',982810005,20811185,0,0) ;

CALL STATICLINK_IMPORT(980209500,'КП_ПБС_Месяц.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,20810160,0,0) ;

CALL STATICLINK_IMPORT(980211200,'ПОФ_Подневный.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,20910027,0,0) ;

CALL STATICLINK_IMPORT(980227200,'КП_Подневный.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,21110027,0,0) ;

CALL STATICLINK_IMPORT(990210300,'ВнутренниеРР.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,21011044,0,0) ;

CALL STATICLINK_IMPORT(980211900,'ВнутренниеРР.1.FACT(Мероприятие)->Мероприятия.ID',982810005,21011045,0,0) ;

CALL STATICLINK_IMPORT(980212000,'ВнутренниеРР.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,21011046,0,0) ;

CALL STATICLINK_IMPORT(980211500,'ВнутренниеРР.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,21010027,0,0) ;

CALL STATICLINK_IMPORT(980212900,'ВнутренниеРР.2.FACT(Мероприятие)->Мероприятия.ID',982810005,21012058,0,0) ;

CALL STATICLINK_IMPORT(990211000,'ВнутренниеРР.2.DIRECTIONCLS(Направление)->Направления.ID',986910002,21012059,0,0) ;

CALL STATICLINK_IMPORT(980213000,'ВнутренниеРР.2.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,21012060,0,0) ;

CALL STATICLINK_IMPORT(980302000,'КазнПереброска.1.SOURCEFACT(МероприятиеПлат)->Мероприятия.ID',982810005,30111162,0,0) ;

CALL STATICLINK_IMPORT(980300700,'КазнПереброска.1.DESTFACT(МероприятиеПолуч)->Мероприятия.ID',982810005,30111163,0,0) ;

CALL STATICLINK_IMPORT(990300400,'КазнПереброска.1.SOURCEDIRECTIONCLS(НаправлениеПлат)->Направления.ID',986910002,30111164,0,0) ;

CALL STATICLINK_IMPORT(990300100,'КазнПереброска.1.DESTDIRECTIONCLS(НаправлениеПолуч)->Направления.ID',986910002,30111165,0,0) ;

CALL STATICLINK_IMPORT(980302200,'КазнПереброска.1.SOURCEFINTYPE(ТипФинансированияПлат)->ТипыФинансирования.ID',982710006,30111166,0,0) ;

CALL STATICLINK_IMPORT(980300900,'КазнПереброска.1.DESTFINTYPE(ТипФинансированияПолуч)->ТипыФинансирования.ID',982710006,30111167,0,0) ;

CALL STATICLINK_IMPORT(980301800,'КазнПереброска.1.SOURCEDOCBASE(ТипДокОснованияПлат)->ДокОснования.ID',982910007,30111168,0,0) ;

CALL STATICLINK_IMPORT(980300400,'КазнПереброска.1.DESTDOCBASE(ТипДокОснованияПолуч)->ДокОснования.ID',982910007,30111169,0,0) ;

CALL STATICLINK_IMPORT(980303900,'КазнПП.1.SOURCEFACT(Мероприятие)->Мероприятия.ID',982810005,30211151,0,0) ;

CALL STATICLINK_IMPORT(990300900,'КазнПП.1.SOURCEDIRECTIONCLS(Направление)->Направления.ID',986910002,30211152,0,0) ;

CALL STATICLINK_IMPORT(980304100,'КазнПП.1.SOURCEFINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,30211153,0,0) ;

CALL STATICLINK_IMPORT(980303600,'КазнПП.1.SOURCEDOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,30211154,0,0) ;

CALL STATICLINK_IMPORT(980305600,'КазнРазассигновка.1.DESTFACT(Мероприятие)->Мероприятия.ID',982810005,30311089,0,0) ;

CALL STATICLINK_IMPORT(990301400,'КазнРазассигновка.1.DESTDIRECTIONCLS(Направление)->Направления.ID',986910002,30311090,0,0) ;

CALL STATICLINK_IMPORT(980305800,'КазнРазассигновка.1.DESTFINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,30311092,0,0) ;

CALL STATICLINK_IMPORT(980305300,'КазнРазассигновка.1.DESTDOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,30311093,0,0) ;

CALL STATICLINK_IMPORT(980307500,'КазнЧек.1.SOURCEFACT(Мероприятие)->Мероприятия.ID',982810005,30411141,0,0) ;

CALL STATICLINK_IMPORT(990301900,'КазнЧек.1.SOURCEDIRECTIONCLS(Направление)->Направления.ID',986910002,30411142,0,0) ;

CALL STATICLINK_IMPORT(980307700,'КазнЧек.1.SOURCEFINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,30411143,0,0) ;

CALL STATICLINK_IMPORT(980307200,'КазнЧек.1.SOURCEDOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,30411144,0,0) ;

CALL STATICLINK_IMPORT(980309600,'КазнПриходПроч.1.DESTFACT(Мероприятие)->Мероприятия.ID',982810005,30511142,0,0) ;

CALL STATICLINK_IMPORT(990302400,'КазнПриходПроч.1.DESTDIRECTIONCLS(Направление)->Направления.ID',986910002,30511143,0,0) ;

CALL STATICLINK_IMPORT(980309800,'КазнПриходПроч.1.DESTFINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,30511144,0,0) ;

CALL STATICLINK_IMPORT(980309200,'КазнПриходПроч.1.DESTDOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,30511145,0,0) ;

CALL STATICLINK_IMPORT(980311300,'КазнОбъявления.1.DESTFACT(Мероприятие)->Мероприятия.ID',982810005,30611144,0,0) ;

CALL STATICLINK_IMPORT(990302800,'КазнОбъявления.1.DESTDIRECTIONCLS(Направление)->Направления.ID',986910002,30611145,0,0) ;

CALL STATICLINK_IMPORT(980311500,'КазнОбъявления.1.DESTFINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,30611146,0,0) ;

CALL STATICLINK_IMPORT(980311100,'КазнОбъявления.1.DESTDOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,30611147,0,0) ;

CALL STATICLINK_IMPORT(980334200,'КазнВнебюджетВнутрПлат.1.SOURCEFACT(МероприятиеПлат)->Мероприятия.ID',982810005,30811103,0,0) ;

CALL STATICLINK_IMPORT(980333300,'КазнВнебюджетВнутрПлат.1.DESTFACT(МероприятиеПолуч)->Мероприятия.ID',982810005,30811104,0,0) ;

CALL STATICLINK_IMPORT(990313200,'КазнВнебюджетВнутрПлат.1.SOURCEDIRECTIONCLS(НаправлениеПлат)->Направления.ID',986910002,30811105,0,0) ;

CALL STATICLINK_IMPORT(990313100,'КазнВнебюджетВнутрПлат.1.DESTDIRECTIONCLS(НаправлениеПолуч)->Направления.ID',986910002,30811106,0,0) ;

CALL STATICLINK_IMPORT(980334400,'КазнВнебюджетВнутрПлат.1.SOURCEFINTYPE(ТипФинансированияПлат)->ТипыФинансирования.ID',982710006,30811107,0,0) ;

CALL STATICLINK_IMPORT(980333500,'КазнВнебюджетВнутрПлат.1.DESTFINTYPE(ТипФинансированияПолуч)->ТипыФинансирования.ID',982710006,30811108,0,0) ;

CALL STATICLINK_IMPORT(980334000,'КазнВнебюджетВнутрПлат.1.SOURCEDOCBASE(ТипДокОснованияПлат)->ДокОснования.ID',982910007,30811109,0,0) ;

CALL STATICLINK_IMPORT(980333000,'КазнВнебюджетВнутрПлат.1.DESTDOCBASE(ТипДокОснованияПолуч)->ДокОснования.ID',982910007,30811110,0,0) ;

CALL STATICLINK_IMPORT(980314300,'КазнПеречисл_СчетНал.1.SOURCEFACT(Мероприятие)->Мероприятия.ID',982810005,31111100,0,0) ;

CALL STATICLINK_IMPORT(980313100,'КазнПеречисл_СчетНал.1.DESTFACT(МероприятиеПолуч)->Мероприятия.ID',982810005,31111101,0,0) ;

CALL STATICLINK_IMPORT(990303600,'КазнПеречисл_СчетНал.1.SOURCEDIRECTIONCLS(Направление)->Направления.ID',986910002,31111102,0,0) ;

CALL STATICLINK_IMPORT(990303400,'КазнПеречисл_СчетНал.1.DESTDIRECTIONCLS(НаправлениеПолуч)->Направления.ID',986910002,31111103,0,0) ;

CALL STATICLINK_IMPORT(980314500,'КазнПеречисл_СчетНал.1.SOURCEFINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,31111104,0,0) ;

CALL STATICLINK_IMPORT(980313300,'КазнПеречисл_СчетНал.1.DESTFINTYPE(ТипФинансированияПолуч)->ТипыФинансирования.ID',982710006,31111105,0,0) ;

CALL STATICLINK_IMPORT(980314000,'КазнПеречисл_СчетНал.1.SOURCEDOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,31111106,0,0) ;

CALL STATICLINK_IMPORT(980331500,'КазнПодтвПеречисл_СчетНал.1.DESTFACT(Мероприятие)->Мероприятия.ID',982810005,31211137,0,0) ;

CALL STATICLINK_IMPORT(990312300,'КазнПодтвПеречисл_СчетНал.1.DESTDIRECTIONCLS(Направление)->Направления.ID',986910002,31211139,0,0) ;

CALL STATICLINK_IMPORT(980331200,'КазнПодтвПеречисл_СчетНал.1.DESTDOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,31211140,0,0) ;

CALL STATICLINK_IMPORT(980331700,'КазнПодтвПеречисл_СчетНал.1.DESTFINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,31211141,0,0) ;

CALL STATICLINK_IMPORT(980316700,'КазнВозврат_СчетНал.1.SOURCEFACT(Мероприятие)->Мероприятия.ID',982810005,31411136,0,0) ;

CALL STATICLINK_IMPORT(990304300,'КазнВозврат_СчетНал.1.SOURCEDIRECTIONCLS(Направление)->Направления.ID',986910002,31411137,0,0) ;

CALL STATICLINK_IMPORT(990304100,'КазнВозврат_СчетНал.1.DESTDIRECTIONCLS(НаправлениеПолуч)->Направления.ID',986910002,31411138,0,0) ;

CALL STATICLINK_IMPORT(980316900,'КазнВозврат_СчетНал.1.SOURCEFINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,31411139,0,0) ;

CALL STATICLINK_IMPORT(980316400,'КазнВозврат_СчетНал.1.SOURCEDOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,31411140,0,0) ;

CALL STATICLINK_IMPORT(990304800,'КазнПодтвВозврата_СчетНал.1.DESTDIRECTIONCLS(Направление)->Направления.ID',986910002,31511094,0,0) ;

CALL STATICLINK_IMPORT(980318500,'КазнПодтвВозврата_СчетНал.1.DESTFACT(Мероприятие)->Мероприятия.ID',982810005,31511095,0,0) ;

CALL STATICLINK_IMPORT(980318700,'КазнПодтвВозврата_СчетНал.1.DESTFINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,31511096,0,0) ;

CALL STATICLINK_IMPORT(980318200,'КазнПодтвВозврата_СчетНал.1.DESTDOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,31511097,0,0) ;

CALL STATICLINK_IMPORT(990306300,'КазнУчетКассВыплат.1.SOURCEDIRECTIONCLS(Направление)->Направления.ID',986910002,32211086,0,0) ;

CALL STATICLINK_IMPORT(980325400,'КазнУчетКассВыплат.1.SOURCEFACT(Мероприятие)->Мероприятия.ID',982810005,32211087,0,0) ;

CALL STATICLINK_IMPORT(980325600,'КазнУчетКассВыплат.1.SOURCEFINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,32211088,0,0) ;

CALL STATICLINK_IMPORT(980325200,'КазнУчетКассВыплат.1.SOURCEDOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,32211089,0,0) ;

CALL STATICLINK_IMPORT(990306700,'КазнУтверждениеОФ.1.DESTDIRECTIONCLS(Направление)->Направления.ID',986910002,32311153,0,0) ;

CALL STATICLINK_IMPORT(980327000,'КазнУтверждениеОФ.1.DESTFACT(Мероприятие)->Мероприятия.ID',982810005,32311154,0,0) ;

CALL STATICLINK_IMPORT(980327200,'КазнУтверждениеОФ.1.DESTFINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,32311155,0,0) ;

CALL STATICLINK_IMPORT(980326700,'КазнУтверждениеОФ.1.DESTDOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,32311156,0,0) ;

CALL STATICLINK_IMPORT(980328600,'КазнРаспределениеОФ.1.DESTFACT(МероприятиеПолуч)->Мероприятия.ID',982810005,32411194,0,0) ;

CALL STATICLINK_IMPORT(990307100,'КазнРаспределениеОФ.1.DESTDIRECTIONCLS(НаправлениеПолуч)->Направления.ID',986910002,32411195,0,0) ;

CALL STATICLINK_IMPORT(980328800,'КазнРаспределениеОФ.1.DESTFINTYPE(ТипФинансированияПолуч)->ТипыФинансирования.ID',982710006,32411196,0,0) ;

CALL STATICLINK_IMPORT(980328300,'КазнРаспределениеОФ.1.DESTDOCBASE(ТипДокОснованияПолуч)->ДокОснования.ID',982910007,32411197,0,0) ;

CALL STATICLINK_IMPORT(990400600,'Кредиты.6.DIRECTIONCLS->Направления.ID',986910002,40116248,0,0) ;

CALL STATICLINK_IMPORT(990401000,'Кредиты.10.DIRECTIONCLS->Направления.ID',986910002,40110253,0,0) ;

CALL STATICLINK_IMPORT(980400300,'Кредиты.FACT(Мероприятие)->Мероприятия.ID',982810005,40110221,0,0) ;

CALL STATICLINK_IMPORT(980403300,'Кредиты.6.FACT(Мероприятие)->Мероприятия.ID',982810005,40116249,0,0) ;

CALL STATICLINK_IMPORT(980405400,'Кредиты.10.FACT(Мероприятие)->Мероприятия.ID',982810005,40110254,0,0) ;

CALL STATICLINK_IMPORT(980403500,'Кредиты.6.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,40116250,0,0) ;

CALL STATICLINK_IMPORT(980405600,'Кредиты.10.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,40110255,0,0) ;

CALL STATICLINK_IMPORT(980400100,'Кредиты.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,40110222,0,0) ;

CALL STATICLINK_IMPORT(990500100,'Ссуды.1.DIRECTIONCLS->Направления.ID',986910002,50111184,0,0) ;

CALL STATICLINK_IMPORT(990500300,'Ссуды.3.DIRECTIONCLS->Направления.ID',986910002,50113188,0,0) ;

CALL STATICLINK_IMPORT(980500200,'Ссуды.FACT(Мероприятие)->Мероприятия.ID',982810005,50110156,0,0) ;

CALL STATICLINK_IMPORT(980500800,'Ссуды.1.FACT(МероприятиеФин)->Мероприятия.ID',982810005,50111185,0,0) ;

CALL STATICLINK_IMPORT(980502200,'Ссуды.3.FACT(МероприятиеФин)->Мероприятия.ID',982810005,50113189,0,0) ;

CALL STATICLINK_IMPORT(980501000,'Ссуды.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,50111186,0,0) ;

CALL STATICLINK_IMPORT(980502400,'Ссуды.3.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,50113190,0,0) ;

CALL STATICLINK_IMPORT(980500000,'Ссуды.DOCBASE(ДокументОснование)->ДокОснования.ID',982910007,50110157,0,0) ;

CALL STATICLINK_IMPORT(990700000,'РаспНаФинансирование.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,70111070,0,0) ;

CALL STATICLINK_IMPORT(980700600,'РаспНаФинансирование.1.FACT(Мероприятие)->Мероприятия.ID',982810005,70111071,0,0) ;

CALL STATICLINK_IMPORT(980700800,'РаспНаФинансирование.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,70111072,0,0) ;

CALL STATICLINK_IMPORT(990700600,'СвободноеФин.DIRECTIONCLS(Направление)->Направления.ID',986910002,70310052,0,0) ;

CALL STATICLINK_IMPORT(980703100,'СвободноеФин.FACT(Мероприятие)->Мероприятия.ID',982810005,70310053,0,0) ;

CALL STATICLINK_IMPORT(980703300,'СвободноеФин.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,70310054,0,0) ;

CALL STATICLINK_IMPORT(990800200,'ПредельныеОФ_Уведомления.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,80111080,0,0) ;

CALL STATICLINK_IMPORT(980800600,'ПредельныеОФ_Уведомления.1.FACT(Мероприятие)->Мероприятия.ID',982810005,80111081,0,0) ;

CALL STATICLINK_IMPORT(980800800,'ПредельныеОФ_Уведомления.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,80111082,0,0) ;

CALL STATICLINK_IMPORT(980800300,'ПредельныеОФ_Уведомления.1.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,80111083,0,0) ;

CALL STATICLINK_IMPORT(990800600,'ПредельныеОФ_Линейно.DIRECTIONCLS(Направление)->Направления.ID',986910002,80210039,0,0) ;

CALL STATICLINK_IMPORT(980801800,'ПредельныеОФ_Линейно.FACT(Мероприятие)->Мероприятия.ID',982810005,80210040,0,0) ;

CALL STATICLINK_IMPORT(980802000,'ПредельныеОФ_Линейно.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,80210041,0,0) ;

CALL STATICLINK_IMPORT(990800900,'ПредельныеОФ_Заявки.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,80311052,0,0) ;

CALL STATICLINK_IMPORT(980803000,'ПредельныеОФ_Заявки.1.FACT(Мероприятие)->Мероприятия.ID',982810005,80311053,0,0) ;

CALL STATICLINK_IMPORT(980803200,'ПредельныеОФ_Заявки.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,80311054,0,0) ;

CALL STATICLINK_IMPORT(990900000,'Доходы_Возврат.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,90111067,0,0) ;

CALL STATICLINK_IMPORT(980900300,'Доходы_Возврат.1.FACT(Мероприятие)->Мероприятия.ID',982810005,90111068,0,0) ;

CALL STATICLINK_IMPORT(980901600,'Доходы_ВнутрОперации.FACT(НаМероприятие)->Мероприятия.ID',982810005,90210050,0,0) ;

CALL STATICLINK_IMPORT(980901500,'Доходы_ВнутрОперации.FACT(СМероприятия)->Мероприятия.ID',982810005,90210051,0,0) ;

CALL STATICLINK_IMPORT(990901100,'Доходы_Выписка.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,90311089,0,0) ;

CALL STATICLINK_IMPORT(980903400,'Доходы_Выписка.1.FACT(Мероприятие)->Мероприятия.ID',982810005,90311090,0,0) ;

CALL STATICLINK_IMPORT(980903100,'Доходы_Выписка.1.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,90311091,0,0) ;

CALL STATICLINK_IMPORT(980908500,'Доходы_СуммыВПути.FACT(Мероприятие)->Мероприятия.ID',982810005,90510042,0,0) ;

CALL STATICLINK_IMPORT(980904600,'Доходы_СуммыВПути.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,90510043,0,0) ;

CALL STATICLINK_IMPORT(990905600,'Доходы_Невыясненные.DIRECTIONCLS(Направление)->Направления.ID',986910002,90610078,0,0) ;

CALL STATICLINK_IMPORT(990905700,'Доходы_Невыясненные.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,90611084,0,0) ;

CALL STATICLINK_IMPORT(980906600,'Доходы_Невыясненные.1.FACT(Мероприятие)->Мероприятия.ID',982810005,90611085,0,0) ;

CALL STATICLINK_IMPORT(980905700,'Доходы_Невыясненные.FACT(Мероприятие)->Мероприятия.ID',982810005,90610079,0,0) ;

CALL STATICLINK_IMPORT(990905800,'Доходы_ОперДанные.DIRECTIONCLS(Направление)->Направления.ID',986910002,90710054,0,0) ;

CALL STATICLINK_IMPORT(980908400,'Доходы_ОперДанные.FACT(Мероприятие)->Мероприятия.ID',982810005,90710055,0,0) ;

CALL STATICLINK_IMPORT(991200700,'ЗакрытиеГода.DIRECTIONCLS_CORR(НаправлениеНовый)->Направления.ID',986910002,120110073,0,0) ;

CALL STATICLINK_IMPORT(991200600,'ЗакрытиеГода.DIRECTIONCLS(Направление)->Направления.ID',986910002,120110074,0,0) ;

CALL STATICLINK_IMPORT(981201400,'ЗакрытиеГода.FACT(Мероприятие)->Мероприятия.ID',982810005,120110075,0,0) ;

CALL STATICLINK_IMPORT(981201500,'ЗакрытиеГода.FACT_CORR(МероприятиеНовый)->Мероприятия.ID',982810005,120110076,0,0) ;

CALL STATICLINK_IMPORT(981201800,'ЗакрытиеГода.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,120110077,0,0) ;

CALL STATICLINK_IMPORT(981201900,'ЗакрытиеГода.FINTYPE_CORR(ТипФинансированияНовый)->ТипыФинансирования.ID',982710006,120110078,0,0) ;

CALL STATICLINK_IMPORT(991500000,'ОперДанные.DIRECTIONCLS(Направление)->Направления.ID',986910002,150110052,0,0) ;

CALL STATICLINK_IMPORT(981500300,'ОперДанные.FACT(Мероприятие)->Мероприятия.ID',982810005,150110053,0,0) ;

CALL STATICLINK_IMPORT(981500500,'ОперДанные.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,150110054,0,0) ;

CALL STATICLINK_IMPORT(981500100,'ОперДанные.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,150110055,0,0) ;

CALL STATICLINK_IMPORT(991600100,'БО.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,160111085,0,0) ;

CALL STATICLINK_IMPORT(981600300,'БО.1.FACT(Мероприятие)->Мероприятия.ID',982810005,160111086,0,0) ;

CALL STATICLINK_IMPORT(981600500,'БО.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,160111087,0,0) ;

CALL STATICLINK_IMPORT(991600400,'БО_Линейно.DIRECTIONCLS(Направление)->Направления.ID',986910002,160210045,0,0) ;

CALL STATICLINK_IMPORT(981601500,'БО_Линейно.FACT(Мероприятие)->Мероприятия.ID',982810005,160210046,0,0) ;

CALL STATICLINK_IMPORT(981601700,'БО_Линейно.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,160210047,0,0) ;

CALL STATICLINK_IMPORT(991700000,'Заявки.DIRECTIONCLS(Направление)->Направления.ID',986910002,170110093,0,0) ;

CALL STATICLINK_IMPORT(981700500,'Заявки.FACT(Мероприятие)->Мероприятия.ID',982810005,170110094,0,0) ;

CALL STATICLINK_IMPORT(981700700,'Заявки.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,170110095,0,0) ;

CALL STATICLINK_IMPORT(991700500,'Заявки_Стар.DIRECTIONCLS(Направление)->Направления.ID',986910002,170210051,0,0) ;

CALL STATICLINK_IMPORT(981702300,'Заявки_Стар.FACT(Мероприятие)->Мероприятия.ID',982810005,170210052,0,0) ;

CALL STATICLINK_IMPORT(981702500,'Заявки_Стар.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,170210053,0,0) ;

CALL STATICLINK_IMPORT(991900400,'СБР_Источники.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,190111102,0,0) ;

CALL STATICLINK_IMPORT(981900500,'СБР_Источники.1.FACT(Мероприятие)->Мероприятия.ID',982810005,190111103,0,0) ;

CALL STATICLINK_IMPORT(981900600,'СБР_Источники.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,190111104,0,0) ;

CALL STATICLINK_IMPORT(981900000,'СБР_Источники.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,190110087,0,0) ;

CALL STATICLINK_IMPORT(991901100,'БР_Источники.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,190211100,0,0) ;

CALL STATICLINK_IMPORT(981901400,'БР_Источники.1.FACT(Мероприятие)->Мероприятия.ID',982810005,190211101,0,0) ;

CALL STATICLINK_IMPORT(981901500,'БР_Источники.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,190211102,0,0) ;

CALL STATICLINK_IMPORT(981901000,'БР_Источники.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,190210086,0,0) ;

CALL STATICLINK_IMPORT(991901800,'КП_Источники.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,190311101,0,0) ;

CALL STATICLINK_IMPORT(981902300,'КП_Источники.1.FACT(Мероприятие)->Мероприятия.ID',982810005,190311102,0,0) ;

CALL STATICLINK_IMPORT(981902400,'КП_Источники.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,190311103,0,0) ;

CALL STATICLINK_IMPORT(981901900,'КП_Источники.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,190310087,0,0) ;

CALL STATICLINK_IMPORT(991904100,'ПОФ_ПБС_Источники.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,190611103,0,0) ;

CALL STATICLINK_IMPORT(981905200,'ПОФ_ПБС_Источники.1.FACT(Мероприятие)->Мероприятия.ID',982810005,190611104,0,0) ;

CALL STATICLINK_IMPORT(981905300,'ПОФ_ПБС_Источники.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,190611105,0,0) ;

CALL STATICLINK_IMPORT(981904700,'ПОФ_ПБС_Источники.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,190610088,0,0) ;

CALL STATICLINK_IMPORT(992202100,'КП_Доходы.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,220111076,0,0) ;

CALL STATICLINK_IMPORT(982200300,'КП_Доходы.1.FACT(Мероприятие)->Мероприятия.ID',982810005,220111077,0,0) ;

CALL STATICLINK_IMPORT(982200000,'КП_Доходы.DOCBASE(ТипДокОснования)->ДокОснования.ID',982910007,220110070,0,0) ;

CALL STATICLINK_IMPORT(982506400,'ГосКонтракты.FACT->Мероприятия.ID',982810005,250110076,0,0) ;

CALL STATICLINK_IMPORT(982506300,'Договора.2.FACT->Мероприятия.ID',982810005,250212052,0,0) ;

CALL STATICLINK_IMPORT(982506200,'Договора.FACT->Мероприятия.ID',982810005,250210058,0,0) ;

CALL STATICLINK_IMPORT(982506100,'Договора.2.FINTYPE->КодДопИнформации.ID',982710006,250212053,0,0) ;

CALL STATICLINK_IMPORT(992502000,'ДокИсполнения.2.DIRECTIONCLS->Направления.ID',986910002,250312046,0,0) ;

CALL STATICLINK_IMPORT(982505900,'ДокИсполнения.FACT->Мероприятия.ID',982810005,250310042,0,0) ;

CALL STATICLINK_IMPORT(982506000,'ДокИсполнения.2.FACT->Мероприятия.ID',982810005,250312047,0,0) ;

CALL STATICLINK_IMPORT(982505800,'ДокИсполнения.2.FINTYPE->КодДопИнформации.ID',982710006,250312048,0,0) ;

CALL STATICLINK_IMPORT(992501900,'МупКонтракты.2.DIRECTIONCLS->Направления.ID',986910002,250412050,0,0) ;

CALL STATICLINK_IMPORT(982505500,'МупКонтракты.2.FACT->Мероприятия.ID',982810005,250412051,0,1) ;

CALL STATICLINK_IMPORT(982505600,'МупКонтракты.FACT->Мероприятия.ID',982810005,250410098,0,0) ;

CALL STATICLINK_IMPORT(982505700,'МупКонтракты.2.FINTYPE->КодДопИнформации.ID',982710006,250412052,0,0) ;

CALL STATICLINK_IMPORT(982800300,'ОпСоСчетами.FACT(Мероприятие)->Мероприятия.ID',982810005,280210017,0,0) ;

CALL STATICLINK_IMPORT(993001100,'ЗаявкиНаЗакупку.1.DIRECTIONCLS->Направления.ID',986910002,300111095,0,0) ;

CALL STATICLINK_IMPORT(983002200,'ЗаявкиНаЗакупку.1.FACTCLS->Мероприятия.ID',982810005,300111096,0,0) ;

CALL STATICLINK_IMPORT(983002100,'ЗаявкиНаЗакупку.1.FINTYPE->КодДопИнформации.ID',982710006,300111097,0,0) ;

CALL STATICLINK_IMPORT(993001200,'ПланыЗакупок.1.DIRECTIONCLS->Направления.ID',986910002,300611053,0,0) ;

CALL STATICLINK_IMPORT(983002400,'ПланыЗакупок.1.FINTYPE->КодДопИнформации.ID',982710006,300611054,0,0) ;

CALL STATICLINK_IMPORT(994401700,'РасхРасписания.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,440111068,0,0) ;

CALL STATICLINK_IMPORT(984401400,'РасхРасписания.1.FACT(Мероприятие)->Мероприятия.ID',982810005,440111069,0,0) ;

CALL STATICLINK_IMPORT(994401600,'КазнУведомления.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,440311065,0,0) ;

CALL STATICLINK_IMPORT(984401000,'КазнУведомления.1.FACT(Мероприятие)->Мероприятия.ID',982810005,440311066,0,0) ;

CALL STATICLINK_IMPORT(995500100,'Уточнения_ПоступлениеНов.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,550111163,0,0) ;

CALL STATICLINK_IMPORT(985500500,'Уточнения_ПоступлениеНов.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,550111164,0,0) ;

CALL STATICLINK_IMPORT(985500300,'Уточнения_ПоступлениеНов.1.FACT(Мероприятие)->Мероприятия.ID',982810005,550111165,0,0) ;

CALL STATICLINK_IMPORT(995500600,'Уточнения_ВыбытиеНов.1.DIRECTIONCLS(Направление)->Направления.ID',986910002,550211142,0,0) ;

CALL STATICLINK_IMPORT(985501700,'Уточнения_ВыбытиеНов.1.FACT(Мероприятие)->Мероприятия.ID',982810005,550211143,0,0) ;

CALL STATICLINK_IMPORT(985501900,'Уточнения_ВыбытиеНов.1.FINTYPE(ТипФинансирования)->ТипыФинансирования.ID',982710006,550211144,0,0) ;

CALL STATICLINK_IMPORT(980700400,'РаспНаФинансирование.1.DOCUMENTBASETYPE(ТипДокОснования)->ДокОснования.ID',982910007,70111073,0,0) ;

CALL STATICLINK_IMPORT(990228200,'СметаПоПД_Подневно.ASSIGNMENTSOURCE(ВидИзменений)->ВидыИзменений.ID',988610003,21210001,0,0) ;

CALL STATICLINK_IMPORT(990228300,'СметаПоПД_Подневно.BUDGETREF(КодБюджета)->Бюджеты.ID',987810006,21210002,0,0) ;

CALL STATICLINK_IMPORT(990229800,'СметаПоПД_Подневно.2.ASSIGNMENTKIND(ВидАссигнований)->ВидыАссигнований.ID',988510003,21212004,0,1) ;

CALL STATICLINK_IMPORT(980227500,'СметаПоПД_Подневно.2.FACIALACC_CLS->ЛицСчета.ID',984110021,21212006,0,1) ;

CALL STATICLINK_IMPORT(980227600,'СметаПоПД_Подневно.FACIALACCCLS(ЛицевойСчетЗаголовок)->ЛицСчета.ID',984110021,21210010,0,0) ;

CALL STATICLINK_IMPORT(980227700,'СметаПоПД_Подневно.NOTIFYTYPE(ИсточникФинансирования)->ИстФинансирования.ID',981310002,21210016,0,0) ;

CALL STATICLINK_IMPORT(990228400,'СметаПоПД_Подневно.PLANDOCTYPE(ВидПлана)->КЦС.ID',988410002,21210020,0,0) ;

CALL STATICLINK_IMPORT(980228000,'СметаПоПД_Подневно.2.MEANSTYPE->ТипСредств.ID',984910002,21212020,0,1) ;

CALL STATICLINK_IMPORT(990228500,'СметаПоПД_Подневно.REJECTCLS(ПричинаОтклонКод)->ПричиныОткл.ID',985010005,21210023,0,0) ;

CALL STATICLINK_IMPORT(990228800,'СметаПоПД_Подневно.2.TRANSFERTCLS->КЦС.ID',988410002,21212028,0,1) ;

CALL STATICLINK_IMPORT(990228900,'СметаПоПД_Подневно.2.SUBSIDYCLS->КодыСубсидии.ID',988910006,21212029,0,1) ;

CALL STATICLINK_IMPORT(20202400,'СметаПоПД_Подневно.1.RECORDINDEX(КодДокумента)->СметаПоПД_Подневно.ID(КодДокумента)',21210011,21211033,0,2) ;

CALL STATICLINK_IMPORT(980228100,'СметаПоПД_Подневно.DOCBASECODE(ТипДокОснования)->ДокОснования.ID',982910007,21210027,0,0) ;

CALL STATICLINK_IMPORT(990229000,'ПланДокРасхОбщ.1.КодБюджАссигнованияКлюч->КодБА.ID',989010006,20011007,0,1) ;

CALL STATICLINK_IMPORT(990229100,'ПланДокРасхОбщ.1.ВидАссигнований->ВидыАссигнований.ID',988510003,20011034,0,1) ;

CALL STATICLINK_IMPORT(991912000,'ПланДокИстОбщ.1.КодБюджАссигнованияКлюч->КодБА.ID',989010006,190011034,0,1) ;

CALL STATICLINK_IMPORT(991912100,'ПланДокИстОбщ.1.ВидАссигнований->ВидыАссигнований.ID',988510003,190011035,0,1) ;

CALL STATICLINK_IMPORT(962501000,'ДокИсполнения.SUPPLIERACC_REF->СчетаОрганизаций.ID',960210003,250310043,0,0) ;

CALL STATICLINK_IMPORT(990229600,'КП_Подневный.2.BUDALLOCATIONCLS(КодБюджАссигнованияКлюч)->КодБА.ID',989010006,21112037,0,1) ;

CALL STATICLINK_IMPORT(990229400,'ПОФ_Подневный.2.BUDALLOCATIONCLS(КодБюджАссигнованияКлюч)->КодБА.ID',989010006,20912044,0,1) ;

CALL STATICLINK_IMPORT(990229700,'СметаПоПД_Подневно.2.BUDALLOCATIONCLS(КодБюджАссигнованияКлюч)->КодБА.ID',989010006,21212038,0,1) ;

CALL STATICLINK_IMPORT(980357400,'КазнОбщ.1.МероприятиеКлюч->Мероприятие.ID',982810005,30011044,0,1) ;

CALL STATICLINK_IMPORT(980228200,'ПланДокРасхОбщ.1.МероприятиеКлюч->Мероприятие.ID',982810005,20011036,0,1) ;

CALL STATICLINK_IMPORT(960304700,'КазнУтверждениеОФ.1.TRANSFERTORG_REF(ОргПолучСубсидии)->Организации.ID',960110033,32311163,0,1) ;

CALL STATICLINK_IMPORT(960304900,'КазнРаспределениеОФ.1.TRANSFERTORG_REF(ОргПолучСубсидии)->Организации.ID',960110033,32411204,0,1) ;

CALL STATICLINK_IMPORT(999902900,'РедакторБухОпераций.1.CREDITACCREF->ПланСчетов.ID',986510005,992011010,0,0) ;

CALL STATICLINK_IMPORT(999902800,'РедакторБухОпераций.1.DEBITACCREF->ПланСчетов.ID',986510005,992011011,0,0) ;

CALL STATICLINK_IMPORT(989904600,'РедакторДереваБК.KFSR->ФКР.ID',980210004,992910003,0,0) ;

CALL STATICLINK_IMPORT(999903000,'РедакторДереваБК.KESR->КОСГУ.ID',986810006,992910006,0,0) ;

CALL STATICLINK_IMPORT(989904900,'РедакторДереваБК.REGIONCLS->Районы.ID',981210005,992910010,0,0) ;

CALL STATICLINK_IMPORT(989905200,'РедакторДереваБК.MEANSTYPE->ТипСредств.ID',984910002,992910013,0,0) ;

CALL STATICLINK_IMPORT(989904500,'РедакторДереваБК.KVSR->КВСР.ID',980310002,992910021,0,0) ;

CALL STATICLINK_IMPORT(989904700,'РедакторДереваБК.KCSR->КЦСР.ID',980510002,992910022,0,0) ;

CALL STATICLINK_IMPORT(989904800,'РедакторДереваБК.KVR->КВР.ID',980410002,992910023,0,0) ;

CALL STATICLINK_IMPORT(999903200,'РедакторДереваБК.DIRECTIONCLS->Направления.ID',986910002,992910024,0,0) ;

CALL STATICLINK_IMPORT(989905000,'РедакторДереваБК.FACT->Мероприятия.ID',982810005,992910025,0,0) ;

CALL STATICLINK_IMPORT(989905100,'РедакторДереваБК.FINTYPE->КодДопИнформации.ID',982710006,992910026,0,0) ;

CALL STATICLINK_IMPORT(999903100,'РедакторДереваБК.TRANSFERTCLS->КЦС.ID',988410002,992910027,0,0) ;

CALL STATICLINK_IMPORT(999903300,'РедакторДереваБК.BUDALLOCATIONCLS->КодБА.ID',989010006,992910028,0,0) ;

CALL STATICLINK_IMPORT(999903400,'РедакторДереваБК.PAYPROMISECLS->КодРО.ID',989110006,992910029,0,0) ;

CALL STATICLINK_IMPORT(999903500,'РедакторДереваБК.SUBSIDYCLS->КодыСубсидии.ID',988910006,992910030,0,0) ;

CALL STATICLINK_IMPORT(983002300,'ПланыЗакупок.1.FACTCLS->Мероприятия.ID',982810005,300611058,0,0) ;

CALL STATICLINK_IMPORT(960304500,'КазнОбщ.1.ОргПолучСубсидии->Организации.ID',960110033,30011045,0,1) ;

DROP PROCEDURE STATICLINK_DELETE
/

DROP PROCEDURE STATICLINK_IMPORT
/

CREATE OR REPLACE PROCEDURE FILTERS_DELETE(ID_ NUMBER) IS
BEGIN
  DELETE FROM STATE_JUMPCONTROL
  WHERE STATE_JUMPCONTROL.FILTERCODE = ID_;
  UPDATE STATE_ACTIONJUMPS SAJ
  SET SAJ.FILTERCODE = NULL, SAJ.OPTIONS = NULL
  WHERE SAJ.FILTERCODE = ID_;
  DELETE FROM State_Filter SF
  WHERE SF.ID = ID_;
END;
/

CREATE OR REPLACE PROCEDURE FILTERS_IMPORT(
  ID_ NUMBER,
  Name_ VARCHAR2,
  Note_ VARCHAR2,
  FilterValue_ VARCHAR2,
  FilterFormat_ NUMBER,
  FilterActive_ NUMBER,
  IsBudget_ NUMBER
) IS
  IDExists$ NUMBER (10);
BEGIN
  SELECT COUNT(ID)
  INTO IDExists$
  FROM State_Filter
  WHERE (ID = ID_);
  IF (IDExists$ = 0) THEN
  INSERT INTO State_Filter
    (ID,NAME,Note,FilterValue,FilterFormat,FilterActive,IsBudget)
  VALUES
    (ID_,NAME_,Note_,FilterValue_,FilterFormat_,FilterActive_,IsBudget_);
  ELSE
    UPDATE State_Filter SET
      NAME = NAME_,
      Note = Note_,
      FilterValue = FilterValue_,
      FilterFormat = FilterFormat_,
      FilterActive = FilterActive_,
      IsBudget = IsBudget_
    WHERE ID = ID_;
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE FILTERS_IMPORTURM(
  ID_ NUMBER,
  Name_ VARCHAR2,
  Note_ VARCHAR2,
  FilterValueURM_ VARCHAR2,
  FilterFormat_ NUMBER,
  FilterActive_ NUMBER,
  IsBudget_ NUMBER
) IS
  IDExists$ NUMBER (10);
BEGIN
  SELECT COUNT(ID)
  INTO IDExists$
  FROM State_Filter
  WHERE (ID = ID_);
  IF (IDExists$ = 0) THEN
  INSERT INTO State_Filter
    (ID,NAME,Note,FilterValueURM,FilterFormat,FilterActive,IsBudget)
  VALUES
    (ID_,NAME_,Note_,FilterValueURM_,FilterFormat_,FilterActive_,IsBudget_);
  ELSE
    UPDATE State_Filter SET
      NAME = NAME_,
      Note = Note_,
      FilterValueURM = FilterValueURM_,
      FilterFormat = FilterFormat_,
      FilterActive = FilterActive_,
      IsBudget = IsBudget_
    WHERE ID = ID_;
  END IF;
END;
/

-- Фильтры
CALL FILTERS_IMPORT(100, 'СнятьФильтр', 'Снять фильтр', '1', 0, 1, 2) ;

CALL FILTERS_IMPORT(200, 'ИнвертироватьФильтр', 'Инвертировать фильтр', 'НЕ ТекущийФильтр', 0, 1, 2) ;

CALL FILTERS_IMPORT(300, 'ДоступныеПользователюДокументы', 'Выделение разрешенных текущему пользователю для данного действия документов', 'ControlResult<>-201', 0, 1, 2) ;

CALL FILTERS_IMPORT(400, 'Обработанные', 'Выделение уже обработанных документов, конечное состояние для которых уже определено. Определяется по факту измененности документа.', 'IsChangeState<>0', 0, 1, 2) ;

CALL FILTERS_IMPORT(500, 'ДопустимыеДляПерехода', 'Допустимые для перехода документы', '(ControlResult=0)или(ControlResult=-202)', 0, 1, 2) ;

CALL FILTERS_IMPORT(600, 'НеПрошедшиеАвтоПереход', 'Выделение документов, для которых переход автоматически определен быть не может из-за неоднозначности', '(ControlResult = -202)', 0, 1, 2) ;

CALL FILTERS_IMPORT(700, 'ОбработанныеВручную', 'Выделение обработанных в ручную документов, конечное состояние для которых уже определено.', '(IsChangeState=1)', 0, 1, 2) ;

CALL FILTERS_IMPORT(800, 'НеПрошедшиеКонтроль', 'Выделение документов, для которых контроль выполнялся, но не был пройден', '(ControlResult=-1001)или(ControlResult=-2001)', 0, 1, 2) ;

CALL FILTERS_IMPORT(2010100, 'Отклоненные', 'Получить отклоненные документы', 'ПолеНеПустое([20110016])', 0, 1, 2) ;

CALL FILTERS_IMPORT(3010600, 'Предпринимательские', 'Получить документы по предпринимательской деятельности', '(Разыменовать("Лицевой_Счет.Тип_Средств.ТипДеятельности",[30110003])=2)  
или((Разыменовать("Лицевой_Счет.Тип_Средств",[30110003])=0)и 
 Разыменовать("Р/с.ДляГУП_МУП",[30110028])и не Разыменовать("Р/с.Бюджетный",[30110028]))', 0, 1, 1) ;

CALL FILTERS_IMPORT(3020600, 'Предпринимательские', 'Получить документы по предпринимательской деятельности', '(Разыменовать("Лицевой_Счет.Тип_Средств.ТипДеятельности",[30210032])=2)  
или((Разыменовать("Лицевой_Счет.Тип_Средств",[30210032])=0)и 
 Разыменовать("Р/с.ДляГУП_МУП",[30210043])и не Разыменовать("Р/с.Бюджетный",[30210043]))', 0, 1, 1) ;

CALL FILTERS_IMPORT(3021600, 'ВключенныеВПринятыйРеестр', 'Получить документы включенные в принятый реестр', 'Разыменовать("Реестры_казначейства.Принятость",[30210054]) =1', 0, 1, 1) ;

CALL FILTERS_IMPORT(3030600, 'Предпринимательские', 'Получить документы по предпринимательской деятельности', '(Разыменовать("Р/с.ДляГУП_МУП",[30310041])и(не Разыменовать("Р/с.Бюджетный",[30310041])))или([30310052]=2)', 0, 1, 1) ;

CALL FILTERS_IMPORT(3040500, 'ПоЕдиномуСчету', 'Получить документы по единому счету', 'Разыменовать("Р/с.Единый",[30410033])', 0, 1, 2) ;

CALL FILTERS_IMPORT(3040600, 'Предпринимательские', 'Получить документы по предпринимательской деятельности', '(Разыменовать("Лицевой_Счет.Тип_Средств.ТипДеятельности",[30410017])=2)  
или((Разыменовать("Лицевой_Счет.Тип_Средств",[30410017])=0)и 
 Разыменовать("Р/с.ДляГУП_МУП",[30410033])и не Разыменовать("Р/с.Бюджетный",[30410033]))', 0, 1, 1) ;

CALL FILTERS_IMPORT(3041500, 'ВключенныеВПринятыйРеестр', 'Получить документы включенные в принятый реестр', 'Разыменовать("Реестры_казначейства.Принятость",[30410044])=1', 0, 1, 1) ;

CALL FILTERS_IMPORT(3050600, 'Предпринимательские', 'Получить документы по предпринимательской деятельности', '(Разыменовать("Лицевой_Счет.Тип_Средств.ТипДеятельности",[30510021])=2)  
или((Разыменовать("Лицевой_Счет.Тип_Средств",[30510021])=0)и 
 Разыменовать("Р/с.ДляГУП_МУП",[30510020])и не Разыменовать("Р/с.Бюджетный",[30510020]))', 0, 1, 1) ;

CALL FILTERS_IMPORT(3060600, 'Предпринимательские', 'Получить документы по предпринимательской деятельности', '(Разыменовать("Лицевой_Счет.Тип_Средств.ТипДеятельности",[30610002])=2)  
или((Разыменовать("Лицевой_Счет.Тип_Средств",[30610002])=0)и 
 Разыменовать("Р/с.ДляГУП_МУП",[30610108])и не Разыменовать("Р/с.Бюджетный",[30610108]))', 0, 1, 1) ;

CALL FILTERS_IMPORT(3061100, 'БюджетнаяДеятельность', 'Получить документы по бюджетной деятельности ', '((Разыменовать("Лицевой_Счет.Тип_Средств.ТипДеятельности",[30610002])=1)и
(Разыменовать("Лицевой_Счет.Тип_Средств",[30610002])<>0))
или((Разыменовать("Лицевой_Счет.Тип_Средств",[30610108])=0)и Разыменовать("Р/с.Бюджетный",[30610108])
    и не (Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[30610002])
          или Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",[30610002])
          или Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",[30610002])
         )
   )', 0, 1, 1) ;

CALL FILTERS_IMPORT(3110600, 'Предпринимательские', 'Получить документы по предпринимательской деятельности', '(Разыменовать("Р/с.ДляГУП_МУП",[31110004])и(не Разыменовать("Р/с.Бюджетный",[31110004])))или([31110062]=2)', 0, 1, 1) ;

CALL FILTERS_IMPORT(3120600, 'Предпринимательские', 'Получить документы по предпринимательской деятельности', '(Разыменовать("Р/с.ДляГУП_МУП",[31210021])и(не Разыменовать("Р/с.Бюджетный",[31210021])))или([31210108]=2)', 0, 1, 1) ;

CALL FILTERS_IMPORT(3140600, 'Предпринимательские', 'Получить документы по предпринимательской деятельности', '(Разыменовать("Р/с.ДляГУП_МУП",[31410021])и(не Разыменовать("Р/с.Бюджетный",[31410021])))или([31410108]=2)', 0, 1, 1) ;

CALL FILTERS_IMPORT(3140900, 'ВключенныеВПринятыйРеестр', 'Получить документы включенные в принятый реестр', 'Разыменовать("Реестры_казначейства.Принятость",[31410037]) =1', 0, 1, 1) ;

CALL FILTERS_IMPORT(3150100, 'Принятые', 'Получить принятые документы ', 'ПолеНеПустое([31510010])', 0, 1, 1) ;

CALL FILTERS_IMPORT(3230600, 'Предпринимательские', 'Получить документы по предпринимательской деятельности', '(Разыменовать("Р/с.ДляГУП_МУП",[32310052])и(не Разыменовать("Р/с.Бюджетный",[32310052])))или([32310009]=2)', 0, 1, 1) ;

CALL FILTERS_IMPORT(3240100, 'Отклоненные', 'Получить отклоненные документы', 'ПолеНеПустое([32410056])', 0, 1, 2) ;

CALL FILTERS_IMPORT(3240600, 'Предпринимательские', 'Получить документы по предпринимательской деятельности', '(Разыменовать("Лицевой_Счет.Тип_Средств.ТипДеятельности",[32410005])=2)  
или((Разыменовать("Лицевой_Счет.Тип_Средств",[32410005])=0)и 
 Разыменовать("Р/с.ДляГУП_МУП",[32410059])и не Разыменовать("Р/с.Бюджетный",[32410059]))', 0, 1, 1) ;

CALL FILTERS_IMPORT(25020200, 'ПоследнийВЦепочкеУточнений', 'Последний в цепочке уточнений', '[250210057]=1', 0, 1, 2) ;

CALL FILTERS_IMPORT(25020300, 'ДокументыБУ_АУ', 'Получить документы по бюджетным, автономным учреждениям', 'Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[250210014])', 0, 1, 2) ;

CALL FILTERS_IMPORT(25030200, 'ПоследнийВЦепочкеУточнений', 'Последний в цепочке уточнений', '[250310041]=1', 0, 1, 2) ;

CALL FILTERS_IMPORT(25030300, 'ДокументыБУ_АУ', 'Получить документы по бюджетным, автономным учреждениям', 'Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[250310027])', 0, 1, 2) ;

CALL FILTERS_IMPORT(25040200, 'ПоследнийВЦепочкеУточнений', 'Последний в цепочке уточнений', '[250410096]=1', 0, 1, 2) ;

CALL FILTERS_IMPORT(25040300, 'ДокументыБУ_АУ', 'Получить документы по бюджетным, автономным учреждениям', 'Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[250410046])', 0, 1, 2) ;

DROP PROCEDURE FILTERS_DELETE
/

DROP PROCEDURE FILTERS_IMPORT
/

DROP PROCEDURE FILTERS_IMPORTURM
/

CREATE OR REPLACE PROCEDURE STATUSICONS_IMPORT(
  ID_ NUMBER,
  NOTE_ VARCHAR2,
  DOCREF_ NUMBER,
  DETAILNUM_ NUMBER,
  ICONNAME_ VARCHAR2,
  ISSYSTEM_ NUMBER,
  ICONPOS_ NUMBER,
  RUNPOS_ NUMBER,
  RESERVEPOS_ NUMBER,
  ICONHINT_ VARCHAR2,
  ICONKIND_ NUMBER,
  LOCKMASK_ NUMBER,
  FORMULA_ VARCHAR2,
  ISBUDGET_ NUMBER
) IS
  IDExists$ NUMBER (10);
BEGIN
  SELECT COUNT(ID)
  INTO IDExists$
  FROM STATUSICONS
  WHERE (ID = ID_);
  IF (IDExists$ <> 0) THEN
    UPDATE STATUSICONS SET
      NOTE = NOTE_,
      DOCREF = DOCREF_,
      DETAILNUM = DETAILNUM_,
      ICONNAME = ICONNAME_,
      ISSYSTEM = ISSYSTEM_,
      ICONPOS = ICONPOS_,
      RUNPOS = RUNPOS_,
      RESERVEPOS = RESERVEPOS_,
      ICONHINT = ICONHINT_,
      ICONKIND = ICONKIND_,
      LOCKMASK = LOCKMASK_,
      ISBUDGET = ISBUDGET_,
      FORMULA = FORMULA_
    WHERE ID = ID_;
  ELSE
    INSERT INTO STATUSICONS
      (ISBUDGET, ID, NOTE, DOCREF, DETAILNUM, ICONNAME, ISSYSTEM, ICONPOS, RUNPOS, RESERVEPOS, ICONHINT, ICONKIND, LOCKMASK, FORMULA)
    VALUES
      (ISBUDGET_, ID_, NOTE_, DOCREF_, DETAILNUM_, ICONNAME_, ISSYSTEM_, ICONPOS_, RUNPOS_, RESERVEPOS_, ICONHINT_, ICONKIND_, LOCKMASK_, FORMULA_);
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE STATUSICONS_DELETE(
  ID_ NUMBER
) IS
BEGIN
  DELETE FROM STATUSICONS SI
  WHERE SI.ID = ID_;
END;
/

-- Статусные иконки
CALL STATUSICONS_IMPORT(16061508,'',200,0,'ЧернаяСкрепка',1,3,3,1,'Дата принятия документа закрыта для редактирования',1,64,'',1) ;

CALL STATUSICONS_IMPORT(16061509,'',200,0,'ДокументПринят',1,3,4,1,'Документ принят',1,1,'',1) ;

CALL STATUSICONS_IMPORT(10274277,'',200,1,'Внимание',1,6,1,0,'Операция закрыта',0,0,'(Разыменовать("Операция70н.ДатаЗакрытия.НоваяДата",[20011016]) > 0.5) и ((не ПолеНеПустое([20010001]) и (Разыменовать("Операция70н.ДатаЗакрытия.НоваяДата",[20011016]) < ТекущаяДата)) или (ПолеНеПустое([20010001]) и (Разыменовать("Операция70н.ДатаЗакрытия.НоваяДата",[20011016]) < [20010001])))',1) ;

CALL STATUSICONS_IMPORT(37541,'',211,2,'Монета',1,5,1,0,'Есть суммы по дням',0,0,'[21112001] > 0',1) ;

CALL STATUSICONS_IMPORT(37538,'',212,2,'Монета',1,5,1,0,'Есть суммы по дням',0,0,'[21212001] > 0',1) ;

CALL STATUSICONS_IMPORT(13728,'',300,0,'НевернаяЭЦП',1,1,4,1,'ЭЦП не признана верной',0,0,'[30010002]=Константа(1000,102,3)',1) ;

CALL STATUSICONS_IMPORT(8933799,'',300,0,'Земля',1,2,4,1,'Документ пришел от удаленного клиента',1,4,'',1) ;

CALL STATUSICONS_IMPORT(13729,'',300,0,'ПеречеркнутыйКружок',1,3,2,1,'Документ отклонен',0,0,'ПолеНеПустое([30010002])',1) ;

CALL STATUSICONS_IMPORT(13776,'',300,0,'ЧернаяСкрепка',1,3,3,1,'Дата принятия документа закрыта для редактирования',1,64,'',1) ;

CALL STATUSICONS_IMPORT(8931594,'',300,0,'ДокументПринят',1,3,4,1,'Документ принят',1,1,'',1) ;

CALL STATUSICONS_IMPORT(8933203,'',300,0,'ЗеленаяСкрепка',1,3,6,1,'Реестр принят',1,65536,'',1) ;

CALL STATUSICONS_IMPORT(26978,'',300,1,'Внимание',1,7,1,0,'Операция закрыта',0,0,'(Разыменовать("Операция70н.ДатаЗакрытия.НоваяДата",[30011024]) >= 1) и ((не ПолеНеПустое([30010001]) и (Разыменовать("Операция70н.ДатаЗакрытия.НоваяДата",[30011024]) < ТекущаяДата)) или (ПолеНеПустое([30010001]) и (Разыменовать("Операция70н.ДатаЗакрытия.НоваяДата",[30011024]) < [30010001])))',1) ;

CALL STATUSICONS_IMPORT(38132,'',304,0,'Конверт',1,2,5,1,'Документ отправлен',0,0,'[30410143] = 11',1) ;

CALL STATUSICONS_IMPORT(38128,'',306,0,'Конверт',1,2,5,1,'Документ отправлен',0,0,'[30610150] = 11',1) ;

CALL STATUSICONS_IMPORT(16061773,'',1900,0,'ЧернаяСкрепка',1,3,3,1,'Дата принятия документа закрыта для редактирования',1,64,'',1) ;

CALL STATUSICONS_IMPORT(16062805,'',2200,0,'ЧернаяСкрепка',1,3,3,1,'Дата принятия документа закрыта для редактирования',1,64,'',1) ;

CALL STATUSICONS_IMPORT(15338,'',4401,0,'Конверт',1,2,1,1,'Документ отправлен',0,0,'(([440110058] = 11) или ([440110058] = 1)) и не ПолеНеПустое([440110001])',1) ;

CALL STATUSICONS_IMPORT(15340,'',4401,0,'ЧернаяСкрепка',1,2,3,1,'Дата принятия документа закрыта для редактирования',1,64,'',1) ;

CALL STATUSICONS_IMPORT(35471,'',4903,0,'ПеречеркнутыйДокументЭЦП',1,1,0,1,'На подписании и отклонен',0,0,'ПолеНеПустое([490310010]) и ([490310013] = 2)',1) ;

CALL STATUSICONS_IMPORT(31262602,'',4903,0,'ПоданныйДокЭЦПСиняяГалка',1,1,0,1,'Опубликован и полностью подписан',0,0,'(не ПолеНеПустое([490310010])) и  ([490310013] = 0) и  ПолеНеПустое([490310014]) и  [490310015]',1) ;

CALL STATUSICONS_IMPORT(31262603,'',4903,0,'ПеречеркнутыйДокумент',1,1,0,1,'Ошибочный',0,0,'ПолеНеПустое([490310010]) и ([490310013] = 1)',1) ;

CALL STATUSICONS_IMPORT(31262640,'',4903,0,'ПоданныйДокументСиняяГалка',1,1,0,1,'Опубликован, в подписании не нуждается',0,0,'(не ПолеНеПустое([490310010])) и  ([490310013] = 0) и  (не ПолеНеПустое([490310014]))',1) ;

CALL STATUSICONS_IMPORT(31262641,'',4903,0,'ДокументЭЦПСиняяГалка',1,1,0,1,'Полностью подписан',0,0,'(не ПолеНеПустое([490310010])) и  ([490310013] = 2) и  ПолеНеПустое([490310014]) и  ([490310015])',1) ;

CALL STATUSICONS_IMPORT(31262642,'',4903,0,'Документ',1,1,0,1,'Сформирован',0,0,'(не ПолеНеПустое([490310010])) и ([490310013] = 1)',1) ;

CALL STATUSICONS_IMPORT(31262991,'',4903,0,'ДокументЭЦП',1,1,0,1,'Частично подписан',0,0,'(не ПолеНеПустое([490310010])) и ([490310013] = 2) и  ПолеНеПустое([490310014]) и  ([490310015] = 0)',1) ;

CALL STATUSICONS_IMPORT(31262992,'',4903,0,'ПоданныйПеречеркнутыйДок',1,1,0,1,'Опубликован и отклонен',0,0,'ПолеНеПустое([490310010]) и ([490310013] = 0)',1) ;

CALL STATUSICONS_IMPORT(35250,'',9923,0,'Деньги',1,1,1,0,'Схема бюджета',0,0,'[992310005] = 1',1) ;

CALL STATUSICONS_IMPORT(35251,'',9923,0,'Земля',1,1,1,0,'Схема УРМ',0,0,'[992310005] = 0',1) ;

CALL STATUSICONS_IMPORT(35253,'',9924,0,'Деньги',1,1,1,0,'Роль бюджета',0,0,'[992410004] = 1',1) ;

CALL STATUSICONS_IMPORT(35254,'',9924,0,'Земля',1,1,1,0,'Роль УРМ',0,0,'[992410004] = 0',1) ;

DROP PROCEDURE STATUSICONS_IMPORT
/

DROP PROCEDURE STATUSICONS_DELETE
/


CREATE OR REPLACE PROCEDURE ENUMS_IMPORT(NAME_ VARCHAR2,FACIALACCCLS_ NUMBER) IS
  IDEXISTS$ NUMBER;
BEGIN
  SELECT COUNT(ID) INTO IDEXISTS$ FROM ENUMS WHERE NAME = NAME_;
  IF (IDEXISTS$ > 1) THEN
      DELETE FROM ENUMS E1
      WHERE (E1.NAME = NAME_) AND (E1.ID > (SELECT MIN(E2.ID) FROM ENUMS E2 WHERE E2.NAME = NAME_));
  END IF;
  IF (IDEXISTS$ > 0) THEN
    UPDATE ENUMS SET
      FACIALACCCLS = FACIALACCCLS_,
      ISSYSTEM = 1
    WHERE NAME = NAME_;
  ELSE
    INSERT INTO ENUMS
      (NAME,FACIALACCCLS,ISSYSTEM)    
    VALUES
      (NAME_,FACIALACCCLS_,1);
  END IF;    
END;
/

CREATE OR REPLACE PROCEDURE ENUMVALUES_IMPORT(ENUMNAME_ VARCHAR2,NAME_ VARCHAR2,VAL_ NUMBER) IS
  IDENUM$ NUMBER;
  IDEXISTS$ NUMBER;
BEGIN
  BEGIN
    SELECT ID INTO IDENUM$ FROM ENUMS WHERE NAME = ENUMNAME_;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN
      IDENUM$ := NULL;
  END;  
  IF (IDENUM$ IS NOT NULL) THEN
    SELECT COUNT(ID) INTO IDEXISTS$ FROM ENUMVALUES WHERE ENUMREF = IDENUM$ AND VAL = VAL_;
    IF (IDEXISTS$ > 1) THEN
      DELETE FROM ENUMVALUES EV1
      WHERE (EV1.ENUMREF = IDENUM$) AND (EV1.VAL = VAL_) AND
        (EV1.ID > (SELECT MIN(EV2.ID) FROM ENUMVALUES EV2 WHERE EV2.ENUMREF = IDENUM$ AND EV2.VAL = VAL_));
    END IF;
    IF (IDEXISTS$ > 0) THEN
      UPDATE ENUMVALUES SET
        NAME = NAME_
      WHERE ENUMREF = IDENUM$ AND VAL = VAL_;
    ELSE
      INSERT INTO ENUMVALUES
        (VAL,NAME,ENUMREF)  
      VALUES
        (VAL_,NAME_,IDENUM$);
    END IF;    
  END IF;
END;
/

CREATE OR REPLACE PROCEDURE ENUMS_DELETE(NAME_ VARCHAR2) IS
BEGIN
  DELETE FROM ENUMS WHERE NAME = NAME_;
END;
/

CREATE OR REPLACE PROCEDURE ENUMVALUES_DELETE(ENUMNAME_ VARCHAR2,VAL_ NUMBER) IS
  IDENUM$ NUMBER;
BEGIN
  BEGIN
    SELECT ID INTO IDENUM$ FROM ENUMS WHERE NAME = ENUMNAME_;
  EXCEPTION
     WHEN NO_DATA_FOUND THEN
       IDENUM$ := NULL;  
  END;
  IF (IDENUM$ IS NOT NULL) THEN
    DELETE FROM ENUMVALUES WHERE (VAL = VAL_) AND (ENUMREF = IDENUM$);
  END IF;  
END;
/

-- Перечисления
CALL ENUMVALUES_DELETE('ПоказательСтатуса',0) ;

CALL ENUMVALUES_DELETE('ОснованиеПлатежа',23) ;

CALL ENUMVALUES_DELETE('ПоказательТипаПлатежа',4) ;

CALL ENUMVALUES_DELETE('ПоказательТипаПлатежа',5) ;

CALL ENUMVALUES_DELETE('ПоказательТипаПлатежа',6) ;

CALL ENUMVALUES_DELETE('ПоказательТипаПлатежа',7) ;

CALL ENUMVALUES_DELETE('ПоказательТипаПлатежа',8) ;

CALL ENUMVALUES_DELETE('ПоказательТипаПлатежа',9) ;

CALL ENUMVALUES_DELETE('ПоказательТипаПлатежа',10) ;

CALL ENUMVALUES_DELETE('ПоказательТипаПлатежа',11) ;

CALL ENUMVALUES_DELETE('ПоказательТипаПлатежа',12) ;

CALL ENUMVALUES_IMPORT('БлокДанных','Резервирование под закупки',230) ;

CALL ENUMVALUES_IMPORT('БлокДанных','Отдельные показатели планов-графиков',241) ;

CALL ENUMVALUES_IMPORT('ВидыДеятельности','6 - Cубсидии на кап.вложения',6) ;

CALL ENUMVALUES_IMPORT('ВидыОбслуживания','Сторонний финорган',4) ;

CALL ENUMVALUES_IMPORT('ВидыСубсидий','Cубсидии на кап.вложения',2) ;

CALL ENUMVALUES_IMPORT('УчастникиМежбюджетныхОтношений','Не указан',0) ;

CALL ENUMVALUES_IMPORT('УчастникиМежбюджетныхОтношений','Субъект РФ',4) ;

CALL ENUMVALUES_IMPORT('УчастникиМежбюджетныхОтношений','Территориальные внебюджетные фонды',5) ;

CALL ENUMVALUES_IMPORT('УчастникиМежбюджетныхОтношений','Муниципальные районы и городские округа',6) ;

CALL ENUMVALUES_IMPORT('УчастникиМежбюджетныхОтношений','Поселения',7) ;

CALL ENUMVALUES_IMPORT('УчастникиМежбюджетныхОтношений','Иное',8) ;

CALL ENUMS_IMPORT('ПоказательСтатуса',null) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','01=налогоплательщик (плательщик сборов)',1) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','02=налоговый агент',2) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','03=организация федеральной почтовой связи',3) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','04=налоговый орган',4) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','05=территориальные органы Федеральной службы судебных приставов',5) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','06=участник внешнеэкономической деятельности – юридическое лицо',6) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','07=таможенный орган',7) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','08=юрлицо (ИП) - плательщик страховых взносов и иных платежей в бюджетную систему',8) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','09=налогоплательщик (плательщик сборов) - индивидуальный предприниматель',9) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','10=налогоплательщик (плательщик сборов) – нотариус, занимающийся частной практикой',10) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','11=налогоплательщик (плательщик сборов) - адвокат, учредивший адвокатский кабинет',11) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','12=налогоплательщик (плательщик сборов) - глава крестьянского (фермерского) хозяйства',12) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','13=налогоплательщик (плательщик сборов) - иное физическое лицо - клиент банка',13) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','14=налогоплательщик, производящий выплаты физическим лицам',14) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','15=кредитная организация',15) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','16=участник внешнеэкономической деятельности – физическое лицо',16) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','17=участник внешнеэкономической деятельности – индивидуальный предприниматель',17) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','18=плательщик таможенных платежей, не являющийся декларантом',18) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','19=организации, переводящие средства, удержанные из дохода должника на основании исполнительного документа',19) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','20=кредитная организация, составившая распоряжение о переводе средств по платежу физлица',20) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','21=ответственный участник консолидированной группы налогоплательщиков',21) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','22=участник консолидированной группы налогоплательщиков',22) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','23=органы контроля за уплатой страховых взносов',23) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','24=физлицо - плательщик страховых взносов и иных платежей в бюджетную систему',24) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','25=банки-гаранты',25) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','26=учредители (участники) должника, собственники имущества должника или третьи лица',26) ;

CALL ENUMS_IMPORT('ОснованиеПлатежа',null) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ТП=платежи текущего года',0) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ЗД=добровольное погашение задолженности по истекшим налоговым периодам при отсутствии требования об уплате налогов (сборов) от налогового органа',1) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','БФ=текущие платежи физических лиц - клиентов банка (владельцев счета), уплачиваемые со своего банковского счета',2) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ТР=погашение задолженности по требованию налогового органа об уплате налогов (сборов)',3) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','РС=погашение рассроченной задолженности',4) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ОТ=погашение отсроченной задолженности',5) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','РТ=погашение реструктурируемой задолженности',6) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ПР=погашение задолженности, приостановленной к взысканию',7) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','АП=погашение задолженности по акту проверки',8) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','АР=погашение задолженности по исполнительному документу',9) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ДЕ=таможенная декларация',10) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ПО=таможенный приходный ордер',11) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','КТ=форма корректировки таможенной стоимости и таможенных платежей',12) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ИД=исполнительный документ',13) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ИП=инкассовое поручение',14) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ТУ=требование  об уплате таможенных платежей',15) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','БД=документы бухгалтерских служб таможенных органов',16) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ИН=погашение инвестиционного налогового кредита',17) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','КП=соглашение о взаимодействии при уплате крупными плательщиками суммарных платежей в централизованном порядке',18) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ПБ=погашение должником задолженности в ходе процедур, применяемых в деле о банкротстве',19) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ТЛ=погашение учредителем (участником) должника, собственником имущества должника - унитарного предприятия или третьим лицом задолженности в ходе процедур, применяемых в деле о банкротстве',20) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ЗТ=погашение текущей задолженности в ходе процедур, применяемых в деле о банкротстве',21) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','00=иные случаи',22) ;

CALL ENUMS_IMPORT('ПоказательТипаПлатежа',null) ;

CALL ENUMVALUES_IMPORT('ПоказательТипаПлатежа','ПЕ=уплата пени',0) ;

CALL ENUMVALUES_IMPORT('ПоказательТипаПлатежа','ПЦ=уплата процентов',1) ;

CALL ENUMVALUES_IMPORT('ПоказательТипаПлатежа','ШТ=уплата штрафа',2) ;

CALL ENUMVALUES_IMPORT('ПоказательТипаПлатежа','ЗД=уплата в счет погашения задолженности',3) ;

DROP PROCEDURE ENUMS_IMPORT
/

DROP PROCEDURE ENUMVALUES_IMPORT
/

DROP PROCEDURE ENUMS_DELETE
/

DROP PROCEDURE ENUMVALUES_DELETE
/

-- Запись информации о скрипте в журнал
INSERT INTO DFUCHANGELOG (VersionID, BEGINUPDATECODE, ENDUPDATECODE, LASTUPDATEDFU, ISBUDGET, INCLUDEDEL, INCLUDEBLOCKS, INCLUDEDOCS, SCRIPTCREATOR, SCRIPTCREATEDATE, NOTE) VALUES (781, 90000, 100000, TO_DATE('28.04.2015 8:46:53', 'DD.MM.YYYY HH24:MI:SS'), 1, 1, 'Поля, Права на изменение документов, Страницы документов, Связи, Внутренние связи, Фильтры, Статусные иконки, Выборки, Перечисления', '00.00, 01.01, 02.00, 02.01, 02.02, 02.03, 02.04, 02.05, 02.06, 02.07, 02.08, 02.09, 02.10, 02.11, 02.12, 03.00, 03.01, 03.02, 03.03, 03.04, 03.05, 03.06, 03.07, 03.08, 03.11, 03.12, 03.14, 03.15, 03.16, 03.22, 03.23, 03.24, 04.01, 05.01, 07.01, 07.02, 07.03, 08.01, 08.02, 08.03, 08.04, 09.00, 09.01, 09.02, 09.03, 09.05, 09.06, 09.07, 12.01, 15.01, 16.01, 16.02, 17.01, 17.02, 18.05, 18.07, 18.09, 18.10, 18.12, 18.13, 18.14, 18.15, 18.16, 19.00, 19.01, 19.02, 19.03, 19.06, 22.00, 22.01, 25.01, 25.02, 25.03, 25.04, 28.01, 28.02, 30.01, 30.03, 30.06, 36.10, 37.01, 39.01, 44.01, 44.03, 48.01, 49.01, 49.02, 49.03, 52.01, 55.01, 55.02, 55.03, 96.01, 96.02, 96.03, 96.04, 98.02, 98.03, 98.04, 98.05, 98.06, 98.08, 98.09, 98.10, 98.11, 98.12, 98.13, 98.14, 98.15, 98.16, 98.17, 98.18, 98.20, 98.21, 98.22, 98.23, 98.26, 98.27, 98.28, 98.29, 98.34, 98.35, 98.41, 98.42, 98.43, 98.44, 98.45, 98.46, 98.47, 98.48, 98.49, 98.50, 98.51, 98.52, 98.53, 98.54, 98.57, 98.58, 98.59, 98.60, 98.61, 98.62, 98.63, 98.64, 98.65, 98.67, 98.68, 98.69, 98.70, 98.71, 98.72, 98.78, 98.79, 98.80, 98.81, 98.82, 98.83, 98.84, 98.85, 98.86, 98.87, 98.88, 98.89, 98.90, 98.91, 98.92, 98.94, 98.95, 98.99, 99.03, 99.04, 99.05, 99.08, 99.12, 99.13, 99.14, 99.15, 99.16, 99.17, 99.18, 99.19, 99.20, 99.21, 99.22, 99.23, 99.24, 99.25, 99.26, 99.27, 99.28, 99.29', 'USHIBAEV8/shibaev', TO_DATE('28.04.2015 11:35:46', 'DD.MM.YYYY HH24:MI:SS'), '') ;

COMMIT WORK
/



-- #########################################################
-- #########################################################
-- DBVersion.sql
-- #########################################################
-- #########################################################

INSERT INTO DataBaseVersion(VERSION, Major, Minor, AComment)
  VALUES ('10.00.00', 1000, 00, 'Обновление 10.0')
/

COMMIT WORK
/

-- #########################################################
-- #########################################################
-- Index_Fix.sql
-- #########################################################
-- #########################################################

-- Перенос индексов в табличное пространство INDX
DECLARE
  CURSOR C$ IS
    select INDEX_NAME from DBA_INDEXES
    where OWNER = SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMA')
      and TABLESPACE_NAME <> 'INDX'
      and INDEX_TYPE LIKE '%NORMAL%';
  CNT$ NUMBER(10);    
BEGIN
  BEGIN
    select count(*) into CNT$ from V$TABLESPACE
    where name = 'INDX';
  EXCEPTION
    WHEN OTHERS THEN
      CNT$ := 1;
  END;
  IF CNT$ = 1 THEN
    FOR R$ IN C$ LOOP
      EXECUTE IMMEDIATE 'ALTER INDEX ' || R$.INDEX_NAME || ' REBUILD TABLESPACE INDX';
    END LOOP;
  END IF;
END;
/

-- #########################################################
-- #########################################################
-- compile_scr.sql
-- #########################################################
-- #########################################################

--Вместо данного скрипта можно вызвать стандартный метод, 
--только он почему-то не работает
--  DBMS_UTILITY.COMPILE_SCHEMA(user, TRUE);

DECLARE
  CURSOR C$ IS
    SELECT 'ALTER ' || object_type || ' ' || owner || '.' || object_name || ' COMPILE' AS str,
      object_type, object_name
    FROM SYS.ALL_OBJECTS
    WHERE owner = SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMA')
      AND object_type IN ('VIEW', 'PROCEDURE', 'TRIGGER')
      AND status = 'INVALID'
      AND object_name not like 'BIN$%'
    ORDER BY DECODE(object_type, 'VIEW', 1, 'PROCEDURE', 2, 'TRIGGER', 3), object_name;
  S VARCHAR2(100);
BEGIN
  FOR R$ IN C$ LOOP
    BEGIN
      S := R$.object_type || ' ' || R$.object_name;
      EXECUTE IMMEDIATE R$.str;
    EXCEPTION
      WHEN OTHERS THEN 
        --DBMS_OUTPUT.PUT_LINE(S);
        RAISE_APPLICATION_ERROR(-20000, 'Ошибка при компиляции объекта ' || S);
    END;
  END LOOP;
END;
/

-- #########################################################
-- #########################################################
-- dbms_stats_scr.sql
-- #########################################################
-- #########################################################

ALTER SESSION SET NLS_NUMERIC_CHARACTERS='.,'
/

BEGIN
  DBMS_STATS.GATHER_SCHEMA_STATS(
    SYS_CONTEXT ('USERENV', 'CURRENT_SCHEMA'),
    DBMS_STATS.AUTO_SAMPLE_SIZE,
    false,
    'FOR ALL COLUMNS SIZE AUTO',
    cascade=>TRUE
  );
END;
/

exit
