-- #########################################################
-- #########################################################
-- 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$ <> 800) or (Minor$ <> 00) then
    raise_application_error(-20000, 'Версия БД [' || TO_CHAR(Major$) || '.' || TO_CHAR(Minor$, 'FM00') || '] не соответствует требуемой [800.00]');
  end if;
end;
/

-- #########################################################
-- #########################################################
-- 8.00_GUANO_CLEAN.sql
-- #########################################################
-- #########################################################


ALTER TABLE ARCHIVEDOCPARAMS ADD (
  CHECK((BANMLTATTR<=2147483647)AND(BANMLTATTR>-2147483648))
)
/

ALTER TABLE ARCHIVEDOCTYPE ADD (
  CHECK((ENABLEDIMPORTKINDS<=2147483647)AND(ENABLEDIMPORTKINDS>-2147483648)),
  CHECK((STORETOLINK<=2147483647)AND(STORETOLINK>-2147483648))
)
/

ALTER TABLE CARDS ADD (
  CHECK((BANKCREATEDATE<=2147483647)AND(BANKCREATEDATE>-2147483648)),
  CHECK((BANKRETURNDATE<=2147483647)AND(BANKRETURNDATE>-2147483648)),
  CHECK((CLIENTORG<=2147483647)AND(CLIENTORG>-2147483648)),
  CHECK((CLIENTRECEIVEDATE<=2147483647)AND(CLIENTRECEIVEDATE>-2147483648)),
  CHECK((CLIENTRETURNDATE<=2147483647)AND(CLIENTRETURNDATE>-2147483648)),
  CHECK((DOCSTATEREF<=2147483647)AND(DOCSTATEREF>-2147483648)),
  CHECK((REQUEST_DATE<=2147483647)AND(REQUEST_DATE>-2147483648))
)
/

ALTER TABLE DATAPACKET ADD (
  CHECK((FILECRC<=2147483647)AND(FILECRC>-2147483648)),
  CHECK((FORMAT<=2147483647)AND(FORMAT>-2147483648)),
  CHECK((SPCONSTRAINTCRC<=2147483647)AND(SPCONSTRAINTCRC>-2147483648))
)
/

ALTER TABLE DATAPACKETTYPES ADD (
  CHECK((ARCHIVEDOCTYPE<=2147483647)AND(ARCHIVEDOCTYPE>-2147483648))
)
/

CREATE INDEX FK_CARDS_CLIENTORG ON CARDS(ClientOrg)
/

CREATE INDEX FK_DPTYPES_ARCHIVEDOCTYPE ON DATAPACKETTYPES(ARCHIVEDOCTYPE)
/

COMMIT
/


-- #########################################################
-- #########################################################
-- DBUsers
-- #########################################################
-- #########################################################


DROP TRIGGER TR_DBUSERS_BD
/
DROP TRIGGER TR_DBUSERS_BI
/
DROP TRIGGER TR_DBUSERS_BU
/
DROP TRIGGER TR_DBUSERS_BU_500
/
DROP TRIGGER TR_DBUSERS_AD
/
DROP TRIGGER TR_DBUSERS_AI
/
DROP TRIGGER TR_DBUSERS_AU
/

RENAME DBUsers TO TB_DBUsers
/
CREATE OR REPLACE TRIGGER TR_DBUSERS_BU_500
  BEFORE UPDATE
  ON TB_DBUsers
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_DBUSERS_BU_500)
-- - - - - - - - - - - - -

    :new.Updatedate := sysdate;

END;
/

CREATE OR REPLACE VIEW DBUsers (
  ID,
  USERNAME,
  FIRSTNAME,
  MIDDLENAME,
  LASTNAME,
  NOTE,
  PHONE,
  DESCRIPTION,
  DEPARTMENTCLS,
  REMOTECLIENTREF,
  REMOTEID,
  CREATEDATE,
  UPDATEDATE,
  CRYPTOPARAMS,
  CRYPTOID,
  ORG_REF)
AS
  SELECT
    ID,
    USERNAME,
    FIRSTNAME,
    MIDDLENAME,
    LASTNAME,
    NOTE,
    PHONE,
    DESCRIPTION,
    DEPARTMENTCLS,
    REMOTECLIENTREF,
    REMOTEID,
    CREATEDATE,
    UPDATEDATE,
    CRYPTOPARAMS,
    CRYPTOID,
    ORG_REF
  FROM TB_DBUsers
/

GRANT SELECT, INSERT, UPDATE, DELETE ON DBUsers TO BUDGET_USERS
/
CREATE OR REPLACE TRIGGER TR_DBUsers_II
  INSTEAD OF INSERT
  ON DBUsers
  FOR EACH ROW
DECLARE
  new$ID DBUsers.ID%TYPE := :NEW.ID;
  new$USERNAME DBUsers.USERNAME%TYPE := :NEW.USERNAME;
  new$FIRSTNAME DBUsers.FIRSTNAME%TYPE := :NEW.FIRSTNAME;
  new$MIDDLENAME DBUsers.MIDDLENAME%TYPE := :NEW.MIDDLENAME;
  new$LASTNAME DBUsers.LASTNAME%TYPE := :NEW.LASTNAME;
  new$NOTE DBUsers.NOTE%TYPE := :NEW.NOTE;
  new$PHONE DBUsers.PHONE%TYPE := :NEW.PHONE;
  new$DESCRIPTION DBUsers.DESCRIPTION%TYPE := :NEW.DESCRIPTION;
  new$DEPARTMENTCLS DBUsers.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$REMOTECLIENTREF DBUsers.REMOTECLIENTREF%TYPE := :NEW.REMOTECLIENTREF;
  new$REMOTEID DBUsers.REMOTEID%TYPE := :NEW.REMOTEID;
  new$CREATEDATE DBUsers.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DBUsers.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CRYPTOPARAMS DBUsers.CRYPTOPARAMS%TYPE := :NEW.CRYPTOPARAMS;
  new$CRYPTOID DBUsers.CRYPTOID%TYPE := :NEW.CRYPTOID;
  new$ORG_REF DBUsers.ORG_REF%TYPE := :NEW.ORG_REF;
--
  cGroupID$ NUMBER(10);
  acc$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DBUSERS_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  new$UserName := Upper(new$UserName);
  if (new$RemoteClientRef is null) then 
    new$RemoteID := -1;
     
  else 
    new$RemoteID := new$RemoteClientRef;
  END IF;
  if (new$Org_Ref is null) then
    GetIntConst(-1, 2,acc$);
    BEGIN
      select
      o.id
      into
      new$Org_Ref    from
      organizations o
      left join org_accounts oa on (oa.org_ref = o.id)
      where
      (oa.id = acc$)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (new$Org_Ref is null) then
      new$Org_Ref := 0;
     
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DBUSERS_BI_500)
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_DBUsers (
    ID,
    USERNAME,
    FIRSTNAME,
    MIDDLENAME,
    LASTNAME,
    NOTE,
    PHONE,
    DESCRIPTION,
    DEPARTMENTCLS,
    REMOTECLIENTREF,
    REMOTEID,
    CREATEDATE,
    UPDATEDATE,
    CRYPTOPARAMS,
    CRYPTOID,
    ORG_REF
  ) VALUES (
    new$ID,
    new$USERNAME,
    new$FIRSTNAME,
    new$MIDDLENAME,
    new$LASTNAME,
    new$NOTE,
    new$PHONE,
    new$DESCRIPTION,
    new$DEPARTMENTCLS,
    new$REMOTECLIENTREF,
    new$REMOTEID,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$CRYPTOPARAMS,
    new$CRYPTOID,
    new$ORG_REF);

-- - - - - - - - - - - - -
-- AI_0 (TR_DBUSERS_AI)
-- Last update 30.03.2006
-- - - - - - - - - - - - -

 insert into UsersInGroups (UserRef, GroupRef)
      values (new$id, 0);

 /* добавляем пользователя в ФинОрган */
 if (new$RemoteID = -1) then
     /* Выбираем ID ФинОргана */
     select max(ID) into cGroupID$ from DBGroups where (Name = 'ФинОрган');
     if (not (cGroupID$ is null)) then
     	insert into UsersInGroups (UserRef, GroupRef)
     	values (new$ID, cGroupID$);
     end if;
 /* иначе добавляем в УРМ */
 else
 	 /* Выбираем ID группы УРМ */
     select max(ID) into cGroupID$ from DBGroups where (Name = 'УРМ');
     if (not (cGroupID$ is null)) then
     	insert into UsersInGroups (UserRef, GroupRef)
     	values (new$ID, cGroupID$);
     end if;
 end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_DBUSERS_AI_500)
-- Last update 18.02.2004
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_DBUsers_IU
  INSTEAD OF UPDATE
  ON DBUsers
  FOR EACH ROW
DECLARE
  new$ID DBUsers.ID%TYPE := :NEW.ID;
  new$USERNAME DBUsers.USERNAME%TYPE := :NEW.USERNAME;
  new$FIRSTNAME DBUsers.FIRSTNAME%TYPE := :NEW.FIRSTNAME;
  new$MIDDLENAME DBUsers.MIDDLENAME%TYPE := :NEW.MIDDLENAME;
  new$LASTNAME DBUsers.LASTNAME%TYPE := :NEW.LASTNAME;
  new$NOTE DBUsers.NOTE%TYPE := :NEW.NOTE;
  new$PHONE DBUsers.PHONE%TYPE := :NEW.PHONE;
  new$DESCRIPTION DBUsers.DESCRIPTION%TYPE := :NEW.DESCRIPTION;
  new$DEPARTMENTCLS DBUsers.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$REMOTECLIENTREF DBUsers.REMOTECLIENTREF%TYPE := :NEW.REMOTECLIENTREF;
  new$REMOTEID DBUsers.REMOTEID%TYPE := :NEW.REMOTEID;
  new$CREATEDATE DBUsers.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DBUsers.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CRYPTOPARAMS DBUsers.CRYPTOPARAMS%TYPE := :NEW.CRYPTOPARAMS;
  new$CRYPTOID DBUsers.CRYPTOID%TYPE := :NEW.CRYPTOID;
  new$ORG_REF DBUsers.ORG_REF%TYPE := :NEW.ORG_REF;
--
  cGroupID1$ NUMBER(10);
  acc$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_DBUSERS_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  new$UserName := Upper(new$UserName);
  if (new$RemoteClientRef is null) then
    new$RemoteID := -1;
     
  else 
    new$RemoteID := new$RemoteClientRef;
  END IF;
  /* переводим пользователя в группу ФинОрган, если раньше он был в УРМ */
  if ((:old.RemoteID > 0) and (new$RemoteID = -1)) then
    select max(ID)       into cGroupID1$ from DBGroups where (Name = 'ФинОрган')
    ;
    if (not (cGroupID1$ is null)) then
      update UsersInGroups uig set uig.GroupRef = cGroupID1$

      where (uig.UserRef = :old.ID) and
      ((select Name from DBGroups dbg where dbg.ID = uig.GroupRef) = 'УРМ');
     
    END IF;
  END IF;
  /* переводим пользователя в группу УРМ, если раньше он был в ФинОргане */
  if ((:old.RemoteID = -1) and (new$RemoteID > 0)) then
    select max(ID)       into cGroupID1$ from DBGroups where (Name = 'УРМ')
    ;
    if (not (cGroupID1$ is null)) then
      update UsersInGroups uig set uig.GroupRef = cGroupID1$

      where (uig.UserRef = :old.ID) and
      ((select Name from DBGroups dbg where dbg.ID = uig.GroupRef) = 'ФинОрган');
     
    END IF;
  END IF;
  if (new$Org_Ref is null) then
    GetIntConst(-1, 2,acc$);
    BEGIN
      select
      o.id
      into
      new$Org_Ref    from
      organizations o
      left join org_accounts oa on (oa.org_ref = o.id)
      where
      (oa.id = acc$)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (new$Org_Ref is null) then
      new$Org_Ref := 0;
     
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_DBUSERS_BU_1)
-- Last update 30.03.2006
-- - - - - - - - - - - - -

-- Запрет изменения пользователя SYSDBA
 if ((:old.id = 0) and (new$UserName <> :old.UserName)) then
-- exception ex_CantUpdateThis;
   RaiseException('EX_CANTUPDATETHIS');
 end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_DBUsers SET
    ID = new$ID,
    USERNAME = new$USERNAME,
    FIRSTNAME = new$FIRSTNAME,
    MIDDLENAME = new$MIDDLENAME,
    LASTNAME = new$LASTNAME,
    NOTE = new$NOTE,
    PHONE = new$PHONE,
    DESCRIPTION = new$DESCRIPTION,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    REMOTECLIENTREF = new$REMOTECLIENTREF,
    REMOTEID = new$REMOTEID,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    CRYPTOPARAMS = new$CRYPTOPARAMS,
    CRYPTOID = new$CRYPTOID,
    ORG_REF = new$ORG_REF
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_500 (TR_DBUSERS_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_DBUsers_ID
  INSTEAD OF DELETE
  ON DBUsers
  FOR EACH ROW
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_500 (TR_DBUSERS_AD_500)
-- - - - - - - - - - - - -

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

END;
/

COMMIT WORK
/

-- #########################################################
-- #########################################################
-- DeleteDuplicateInterfacesEx.sql
-- #########################################################
-- #########################################################

/* Скрипт удаляет повторяющиеся интерфейсы, у которых одинокавые Giud+Param
*/
/* Реализуется удаление лишних объектов из базы: две записи в таблице Interfaces с одинаковым Guid'ом и параметром.
В случае присутствия одинаковых объектов, берется один из них, и в него объединяются все данные других объектов (совпадающих), после этого, все остальные объекты мочатся.  
Изменяются следующие таблицы:
1) WorkPlaces_Interface - поле Interfaces_Ref (ссылка на интерфейс) и Note (заголовок интерфейса). Если заголовок интерфейса не пустой, то оставляем его, если пустой, то заголовок берем из имени интерфейса (поле Note таблицы Interfaces). Также все ссылки (Interfaces_Ref) переводим на Id оставшегося объекта.
2) Itf_Ctrl и Itf_Docs - изменяется поле Itf_Ref (ссылка на интерфейс). Все ссылки переводятся на объект, который остается.   
3) Permissions - изменяются поля InterfaceRef (ссылка на интерфейс), Val (список пользователей). 
Все ссылки переводятся на объект, который остается. С правами происходит объединение, то есть у результирующего объекта должно быть право, имеющеюся хотя бы на одном из объектов. 
Также происходит объединение списка пользователей, назначенных на это право (если конечно результирующая длина списка пользователей не превышает 255, в таком случае остаются несколько записей (то есть изменяются только ссылки на объект). *//* Сначала удаляем одинаковые интерфейсы на одном РМ */
CREATE OR REPLACE procedure DeleteDupItfOnWorkplace
AS
BEGIN
  /* Для всех интерфейсов */
  FOR REC$1 IN (    select i.guid AS guid,  wi.workplaces_ref AS work_ref, i.param AS param1, wi.interfaces_ref
   AS itf_ref1     from workplaces_interface wi
  left join  interfaces i  on (i.id = wi.interfaces_ref)
  )
  LOOP
    /* Если нашли интерфейс с таким же guid, workplace_ref, param,
          но другим interface_ref, то мочим */
    FOR REC$2 IN (      select i.param AS param2, wi.interfaces_ref
     AS itf_ref2       from workplaces_interface wi
    left join  interfaces i  on (i.id = wi.interfaces_ref)
    where (wi.interfaces_ref <> REC$1.itf_ref1)
    and (i.guid = REC$1.guid)
    and (wi.workplaces_ref = REC$1.work_ref)
    )
    LOOP
      if ((REC$1.param1  = REC$2.param2) or (((REC$1.param1   is null) or (REC$1.param1 is null)) and ((REC$2.param2   is null) or (REC$2.param2 is null)))) then
        delete from workplaces_interface
        where (workplaces_ref = REC$1.work_ref)
        and (interfaces_ref = REC$2.itf_ref2);
          
      END IF;
    END LOOP;
  END LOOP;
END;
/
Commit work
/
CALL DeleteDupItfOnWorkplace()
/
commit work
/
drop procedure DeleteDupItfOnWorkplace
/
commit work
/
/* вычистка дублей guid+param из таблицы Interfaces */
CREATE OR REPLACE Procedure DeleteDuplicateInterfaces
AS
  WorkPlaces_InterfaceNote$ VARCHAR2(255);
BEGIN
  /* бежим по всем записям, группировка больше для оракла - там "стабильный" курсор */
  FOR REC$1 IN (select Guid AS InterfaceGuid, Min(Id) AS InterfaceId, Max(Note) AS InterfaceNote, Param
   AS InterfaceParam   from Interfaces
  group by Guid, Param
  )
  LOOP
    /* бежим по всем записям с таким же Guid'ом и параметром и выполняем объединение */
    FOR REC$2 IN (select Id
     AS DuplicateInterfaceId       from Interfaces
    where (Id>REC$1.InterfaceId) and (Guid=REC$1.InterfaceGuid) and
    ((Param=REC$1.InterfaceParam) or
    (((Param is null) or (Param  is null)) and ((REC$1.InterfaceParam  is null) or (REC$1.InterfaceParam   is null)))
    )
    )
    LOOP
      /* изменяем таблицу WorkPlaces_Interface */
      /* получаем заголовок интерфейса ?? помоему wp сам разбирается с заголовком по умолчанию */
      select Max(Note)
      into WorkPlaces_InterfaceNote$           from WorkPlaces_Interface
      where (Interfaces_Ref=REC$2.DuplicateInterfaceId)
      ;
      /* если заголовок интерфейса пустой, то проставляем заголовок, берем его из имени интерфейса */
      if ((WorkPlaces_InterfaceNote$  is null) or (WorkPlaces_InterfaceNote$ is null))
      then 
        update WorkPlaces_Interface
        set Note=REC$1.InterfaceNote

        where (Interfaces_Ref=REC$2.DuplicateInterfaceId);
                    
      END IF;
                  
      /* переводим ссылки */
      update WorkPlaces_Interface
      set Interfaces_Ref=REC$1.InterfaceId

      where (Interfaces_Ref=REC$2.DuplicateInterfaceId);

      /* изменяем таблицу Itf_Ctrl */

      /* переводим ссылки */
      update Itf_Ctrl
      set Itf_Ref=REC$1.InterfaceID

      where (Itf_Ref=REC$2.DuplicateInterfaceId);
                
      /* изменяем таблицу Itf_Docs */

      /* переводим ссылки */
      update Itf_Docs
      set Itf_Ref=REC$1.InterfaceID

      where (Itf_Ref=REC$2.DuplicateInterfaceId);

      /* изменяем таблицу Permissions */

      /* переводим ссылки */
      update Permissions
      set InterfaceRef=REC$1.InterfaceID

      where (InterfaceRef=REC$2.DuplicateInterfaceID);
                
      /* мочим дублирующую запись из таблицы Interfaces */
      delete from Interfaces
      where (Id=REC$2.DuplicateInterfaceId);
              
    END LOOP;
  END LOOP;
END;
/
Commit work
/
-- ALTER TRIGGER TR_INTERFACES_BD
CREATE OR REPLACE TRIGGER TR_INTERFACES_ID
  INSTEAD OF DELETE
  ON INTERFACES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_INTERFACES_BD)
-- Version 7.01.00.1
-- - - - - - - - - - - - -
  NULL;
--   if ((:old.GUID = '{5B722355-34AD-47F5-A963-13CBBD4CD43C}') or (:old.GUID = '{7F2E1C22-FD59-11D1-ACA7-008048E62D94}')) then
--     RaiseException('ex_CantDeleteThis');
--   END IF;

-- - - - - - - - - - - - -
-- BD_1 (TR_INTERFACES_BD_1)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /* Каскад при удалении интерфейса */
  delete from WorkPlaces_Interface  where Interfaces_ref = :old.id;

  /* удалить права выданные на интерфейс. 1000000 - тип объекта - интерфейс */
  delete from DBRights  where (ObjRef = :old.id) and (ObjectKindRef = 1000000);

-- - - - - - - - - - - - -
-- BD_2 (TR_INTERAFCES_BD_2)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from Permissions where InterfaceRef = :old.id;

-- - - - - - - - - - - - -
-- BD_10 (TR_INTERFACES_BD_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /*Удаление интерфейса - удаляем все связки его с печат документами*/
  delete from Itf_Docs where Itf_ref = :old.id;

-- - - - - - - - - - - - -
-- BD_11 (TR_INTERFACES_BD_11)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /*Удаление интерфейса - удаляем все связки его с печат документами*/
  delete from Itf_Ctrl where Itf_ref = :old.id;

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

END;
/
/* выполняем процедуру */
CALL DeleteDuplicateInterfaces()
/
-- ALTER TRIGGER TR_INTERFACES_BD
CREATE OR REPLACE TRIGGER TR_INTERFACES_ID
  INSTEAD OF DELETE
  ON INTERFACES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_INTERFACES_BD)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((:old.GUID = '{5B722355-34AD-47F5-A963-13CBBD4CD43C}') or (:old.GUID = '{7F2E1C22-FD59-11D1-ACA7-008048E62D94}')) then
    RaiseException('ex_CantDeleteThis');
  END IF;

-- - - - - - - - - - - - -
-- BD_1 (TR_INTERFACES_BD_1)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /* Каскад при удалении интерфейса */
  delete from WorkPlaces_Interface  where Interfaces_ref = :old.id;

  /* удалить права выданные на интерфейс. 1000000 - тип объекта - интерфейс */
  delete from DBRights  where (ObjRef = :old.id) and (ObjectKindRef = 1000000);

-- - - - - - - - - - - - -
-- BD_2 (TR_INTERAFCES_BD_2)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from Permissions where InterfaceRef = :old.id;

-- - - - - - - - - - - - -
-- BD_10 (TR_INTERFACES_BD_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /*Удаление интерфейса - удаляем все связки его с печат документами*/
  delete from Itf_Docs where Itf_ref = :old.id;

-- - - - - - - - - - - - -
-- BD_11 (TR_INTERFACES_BD_11)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /*Удаление интерфейса - удаляем все связки его с печат документами*/
  delete from Itf_Ctrl where Itf_ref = :old.id;

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

END;
/
Commit work
/
/* мочим процедуру */ 
Drop Procedure DeleteDuplicateInterfaces
/
Commit work
/
/* В Oracle не значимо, в IB - мешает */
update Interfaces set
  Param = Null
where
  Param  is null
/
Commit work
/

-- #########################################################
-- #########################################################
-- Add_Fields_To_Const_Tables.sql
-- #########################################################
-- #########################################################

/* INTCONST */
ALTER TABLE INTCONST ADD (
  ID NUMBER(10),
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_INTCONST_BI
CREATE OR REPLACE TRIGGER TR_INTCONST_BI
  BEFORE INSERT
  ON INTCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_INTCONST_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_INTCONST_BI_500)
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER tr_intconst_bi_500
CREATE OR REPLACE TRIGGER TR_INTCONST_BI
  BEFORE INSERT
  ON INTCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_INTCONST_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_INTCONST_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER tr_intconst_bu_500
CREATE OR REPLACE TRIGGER TR_INTCONST_BU_500
  BEFORE UPDATE
  ON INTCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_INTCONST_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:old.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;
  IF (:old.CreateDate IS NULL) THEN	
    :new.CreateDate := SYSDATE;
  END IF;
    
  :new.Updatedate := SYSDATE;
  :new.UpdaterUser := USER;

END;
/
commit work
/
UPDATE INTCONST
  SET ID = ID,
  CREATERUSER = USER
WHERE (ID IS NULL)
/
commit work
/
-- ALTER TRIGGER tr_intconst_bu_500
CREATE OR REPLACE TRIGGER TR_INTCONST_BU_500
  BEFORE UPDATE
  ON INTCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_INTCONST_BU_500)
-- Version 9.00.00.2
-- - - - - - - - - - - - -

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

END;
/
commit work
/
/* VARCHARCONST */
ALTER TABLE VARCHARCONST ADD (
  ID NUMBER(10),
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  CREATERUSER VARCHAR2(30),
  CREATEDATE DATE,
  UPDATERUSER VARCHAR2(30),
  UPDATEDATE DATE
)
/
-- CREATE TRIGGER TR_VARCHARCONST_BI
CREATE OR REPLACE TRIGGER TR_VARCHARCONST_BI
  BEFORE INSERT
  ON VARCHARCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_VARCHARCONST_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_VARCHARCONST_BI_500
CREATE OR REPLACE TRIGGER TR_VARCHARCONST_BI
  BEFORE INSERT
  ON VARCHARCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_VARCHARCONST_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_VARCHARCONST_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER tr_varcharconst_bu_500
CREATE OR REPLACE TRIGGER tr_varcharconst_bu_500
  BEFORE UPDATE
  ON VARCHARCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (tr_varcharconst_bu_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:old.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;
  IF (:old.CreateDate IS NULL) THEN	
    :new.CreateDate := SYSDATE;
  END IF;

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

END;
/
commit work
/
UPDATE VARCHARCONST
  SET ID = ID,
  CREATERUSER = USER
WHERE (ID IS NULL)
/
commit work
/
-- ALTER TRIGGER tr_varcharconst_bu_500
CREATE OR REPLACE TRIGGER tr_varcharconst_bu_500
  BEFORE UPDATE
  ON VARCHARCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (tr_varcharconst_bu_500)
-- Version 9.00.00.2
-- - - - - - - - - - - - -

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

END;
/
commit work
/
/* REALCONST */
ALTER TABLE REALCONST ADD (
  ID NUMBER(10),
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  CREATERUSER VARCHAR2(30),
  CREATEDATE DATE,
  UPDATERUSER VARCHAR2(30),
  UPDATEDATE DATE
)
/
-- CREATE TRIGGER TR_REALCONST_BI
CREATE OR REPLACE TRIGGER TR_REALCONST_BI
  BEFORE INSERT
  ON REALCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_REALCONST_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_REALCONST_BI_500
CREATE OR REPLACE TRIGGER TR_REALCONST_BI
  BEFORE INSERT
  ON REALCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_REALCONST_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_REALCONST_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_REALCONST_BU_500
CREATE OR REPLACE TRIGGER TR_REALCONST_BU_500
  BEFORE UPDATE
  ON REALCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_REALCONST_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:old.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;
  IF (:old.CreateDate IS NULL) THEN	
    :new.CreateDate := SYSDATE;
  END IF;

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

END;
/
commit work
/
UPDATE REALCONST
  SET ID = ID,
  CREATERUSER = USER
WHERE (ID IS NULL)
/
commit work
/
-- ALTER TRIGGER TR_REALCONST_BU_500
CREATE OR REPLACE TRIGGER TR_REALCONST_BU_500
  BEFORE UPDATE
  ON REALCONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_REALCONST_BU_500)
-- Version 9.00.00.2
-- - - - - - - - - - - - -

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

END;
/
commit work
/
/* DATECONST */
ALTER TABLE DATECONST ADD (
  ID NUMBER(10),
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  CREATERUSER VARCHAR2(30),
  CREATEDATE DATE,
  UPDATERUSER VARCHAR2(30),
  UPDATEDATE DATE
)
/
-- CREATE TRIGGER TR_DATECONST_BI
CREATE OR REPLACE TRIGGER TR_DATECONST_BI
  BEFORE INSERT
  ON DATECONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DATECONST_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_DATECONST_BI_500
CREATE OR REPLACE TRIGGER TR_DATECONST_BI
  BEFORE INSERT
  ON DATECONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DATECONST_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DATECONST_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_DATECONST_BU_500
CREATE OR REPLACE TRIGGER TR_DATECONST_BU_500
  BEFORE UPDATE
  ON DATECONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_DATECONST_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:old.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;
  IF (:old.CreateDate IS NULL) THEN	
    :new.CreateDate := SYSDATE;
  END IF;

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

END;
/
commit work
/
UPDATE DATECONST
  SET ID = ID,
  CREATERUSER = USER
WHERE (ID IS NULL)
/
commit work
/
-- ALTER TRIGGER TR_DATECONST_BU_500
CREATE OR REPLACE TRIGGER TR_DATECONST_BU_500
  BEFORE UPDATE
  ON DATECONST
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_DATECONST_BU_500)
-- Version 9.00.00.2
-- - - - - - - - - - - - -

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

END;
/
commit work
/
ALTER TABLE INTCONST MODIFY(ID NOT NULL)
/
ALTER TABLE INTCONST MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE INTCONST MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE VARCHARCONST MODIFY(ID NOT NULL)
/
ALTER TABLE VARCHARCONST MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE VARCHARCONST MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE VARCHARCONST MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE VARCHARCONST MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE REALCONST MODIFY(ID NOT NULL)
/
ALTER TABLE REALCONST MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE REALCONST MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE REALCONST MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE REALCONST MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE DATECONST MODIFY(ID NOT NULL)
/
ALTER TABLE DATECONST MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE DATECONST MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE DATECONST MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE DATECONST MODIFY(UPDATEDATE NOT NULL)
/

-- #########################################################
-- #########################################################
-- Alter_Unique_PayDocExchange.sql
-- #########################################################
-- #########################################################

/* Изменяет уникальный индекс по полю PayDocRef на составной CODEFORMAT,PAYDOCREF.
  Дает возможность экспортировать один документ в несколько различных форматов. В первую очередь доработка реализована для ГИС ГМП.*/
ALTER TABLE PAYDOCEXCHANGE DROP CONSTRAINT IND_PAYDOCEXCH_PAYDOCREF DROP INDEX
/
ALTER TABLE PAYDOCEXCHANGE ADD (
  CONSTRAINT IND_PAYDOCEXCH_PAYDOCREF UNIQUE (PAYDOCREF,CODEFORMAT)
)
/
COMMIT WORK
/

-- #########################################################
-- #########################################################
-- Alter_Table_DocLock_UK_DOCLOCK.sql
-- #########################################################
-- #########################################################

/* Скрипт изменяет ограничение целостности по уникальности ключа UK_DOCLOCK для таблицы DOCLOCK. */
ALTER TABLE DOCLOCK DROP CONSTRAINT UK_DOCLOCK DROP INDEX
/
ALTER TABLE DOCLOCK ADD (
  CONSTRAINT UK_DOCLOCK UNIQUE (NAME,DOCREF,DETAILNUM,ISBUDGET) 
)
/
commit work 
/

-- #########################################################
-- #########################################################
-- Drop_ClientAccRef_From_agreements.sql
-- #########################################################
-- #########################################################

ALTER TABLE TB_AGREEMENTS DROP CONSTRAINT FK_AGREEMENTS_CLIENTACCREF
/
DROP INDEX FK_AGREEMENTS_CLIENTACCREF
/
ALTER TABLE TB_AGREEMENTS DROP (CLIENTACCREF)
/

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,
  NOTE,
  FACT,
  REGION,
  CLOSEDATE,
  DELIVERYRULES,
  AGREEMENTSUMMA,
  AGREEMENTFINSUMMA,
  ADJUSTMENTREF,
  REESTRNUMBER,
  PAYMENTDATE,
  AGREEMENTCARDADVANCE,
  FINCARDADVANCE,
  STATEORDERREF,
  REJECTCLS,
  REJECTCAUSE,
  CRYPTOSTATUS,
  SENDERID,
  SENDERRECORDID,
  AGREEMENTBEGINDATE,
  PROTOCOLNUMBER,
  PROTOCOLDATE,
  REVIEWNOTE,
  DOCSTATEREF,
  RVERSION,
  EXPORTDATE,
  PURPORTDOC,
  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)
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,
    NOTE,
    FACT,
    REGION,
    CLOSEDATE,
    DELIVERYRULES,
    AGREEMENTSUMMA,
    AGREEMENTFINSUMMA,
    ADJUSTMENTREF,
    REESTRNUMBER,
    PAYMENTDATE,
    AGREEMENTCARDADVANCE,
    FINCARDADVANCE,
    STATEORDERREF,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    AGREEMENTBEGINDATE,
    PROTOCOLNUMBER,
    PROTOCOLDATE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXPORTDATE,
    PURPORTDOC,
    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
  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;

-- - - - - - - - - - - - -
-- 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_20 (TR_AGREEMENTS_AD_20)
-- Version 8.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;

-- - - - - - - - - - - - -
-- 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$NOTE AGREEMENTS.NOTE%TYPE := :NEW.NOTE;
  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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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;
--
  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,
    NOTE,
    FACT,
    REGION,
    CLOSEDATE,
    DELIVERYRULES,
    AGREEMENTSUMMA,
    AGREEMENTFINSUMMA,
    ADJUSTMENTREF,
    REESTRNUMBER,
    PAYMENTDATE,
    AGREEMENTCARDADVANCE,
    FINCARDADVANCE,
    STATEORDERREF,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    AGREEMENTBEGINDATE,
    PROTOCOLNUMBER,
    PROTOCOLDATE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXPORTDATE,
    PURPORTDOC,
    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
  ) 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$NOTE,
    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$PURPORTDOC,
    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);

-- - - - - - - - - - - - -
-- 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$NOTE AGREEMENTS.NOTE%TYPE := :NEW.NOTE;
  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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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;
--
  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,
    NOTE = new$NOTE,
    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,
    PURPORTDOC = new$PURPORTDOC,
    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
  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 TABLE TB_executiondocumentscaption DROP CONSTRAINT FK_EXECDOCCAPTION_RECIPIENTREF
/
DROP INDEX FK_EXECDOCCAPTION_RECIPIENTREF
/
ALTER TABLE TB_executiondocumentscaption DROP (RECIPIENTACC_REF)
/

CREATE OR REPLACE VIEW executiondocumentscaption (
  ID,
  DOCTYPE,
  DOCUMENTDATE,
  ACCEPTDATE,
  SUPPLIERACC_REF,
  SUMMA,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  BUDGETREF,
  STEPNUMBER,
  FACIALACC_CLS,
  RECIPIENT_REF,
  REGISTRATIONTYPE,
  REESTRNUMBER,
  AGREEMENTINNERNUMBER,
  REJECTCLS,
  REJECTCAUSE,
  CRYPTOSTATUS,
  SENDERID,
  SENDERRECORDID,
  NOTE,
  REVIEWNOTE,
  DOCSTATEREF,
  RVERSION,
  EXECDOCFINSUMMA,
  FACT,
  DOCNUMBER,
  SENDERIDKEY,
  SENDERRECORDIDKEY,
  REALID,
  INNERNUMBER,
  ADJUSTMENTREF,
  ADJUSTMENTNUMBER,
  ACCEPTED,
  LASTACCEPTED,
  LASTADJUSTMENT,
  AGREEMENTREF)
AS
  SELECT
    ID,
    DOCTYPE,
    DOCUMENTDATE,
    ACCEPTDATE,
    SUPPLIERACC_REF,
    SUMMA,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    STEPNUMBER,
    FACIALACC_CLS,
    RECIPIENT_REF,
    REGISTRATIONTYPE,
    REESTRNUMBER,
    AGREEMENTINNERNUMBER,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    NOTE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXECDOCFINSUMMA,
    FACT,
    DOCNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REALID,
    INNERNUMBER,
    ADJUSTMENTREF,
    ADJUSTMENTNUMBER,
    ACCEPTED,
    LASTACCEPTED,
    LASTADJUSTMENT,
    AGREEMENTREF
  FROM TB_executiondocumentscaption
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_ID
  INSTEAD OF DELETE
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  quant$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_DOCEXECCAPTION_BD)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  select count(ID)   into quant$ from executiondocumentscaption 
  where AdjustmentRef = :old.ID
  ;
  if (quant$  = 0) then
    delete from ExecutionDocumentsDetail where (RecordIndex = :old.ID);
    delete from paymentschedule where (ExecutionRef = :old.ID)and(ProgIndex=308);
      
  else
    RaiseException('ex_agr_cantdeladjustmented');
  END IF;

-- - - - - - - - - - - - -
-- BD_10 (TR_DocExecCaption_BD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

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

-- - - - - - - - - - - - -
-- AD_10 (TR_ExecDocCaption_AD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_200 (TR_EXECDOCCAPTION_AD_200)
-- Create 04.10.2004
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_500 (TR_EXECDOCCAPTION_AD_500)
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_II
  INSTEAD OF INSERT
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  new$ID EXECUTIONDOCUMENTSCAPTION.ID%TYPE := :NEW.ID;
  new$DOCTYPE EXECUTIONDOCUMENTSCAPTION.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$DOCUMENTDATE EXECUTIONDOCUMENTSCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE EXECUTIONDOCUMENTSCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SUPPLIERACC_REF EXECUTIONDOCUMENTSCAPTION.SUPPLIERACC_REF%TYPE := :NEW.SUPPLIERACC_REF;
  new$SUMMA EXECUTIONDOCUMENTSCAPTION.SUMMA%TYPE := :NEW.SUMMA;
  new$CREATERUSER EXECUTIONDOCUMENTSCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE EXECUTIONDOCUMENTSCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE EXECUTIONDOCUMENTSCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER EXECUTIONDOCUMENTSCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF EXECUTIONDOCUMENTSCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$STEPNUMBER EXECUTIONDOCUMENTSCAPTION.STEPNUMBER%TYPE := :NEW.STEPNUMBER;
  new$FACIALACC_CLS EXECUTIONDOCUMENTSCAPTION.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$RECIPIENT_REF EXECUTIONDOCUMENTSCAPTION.RECIPIENT_REF%TYPE := :NEW.RECIPIENT_REF;
  new$REGISTRATIONTYPE EXECUTIONDOCUMENTSCAPTION.REGISTRATIONTYPE%TYPE := :NEW.REGISTRATIONTYPE;
  new$REESTRNUMBER EXECUTIONDOCUMENTSCAPTION.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$AGREEMENTINNERNUMBER EXECUTIONDOCUMENTSCAPTION.AGREEMENTINNERNUMBER%TYPE := :NEW.AGREEMENTINNERNUMBER;
  new$REJECTCLS EXECUTIONDOCUMENTSCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE EXECUTIONDOCUMENTSCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS EXECUTIONDOCUMENTSCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID EXECUTIONDOCUMENTSCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID EXECUTIONDOCUMENTSCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$NOTE EXECUTIONDOCUMENTSCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$REVIEWNOTE EXECUTIONDOCUMENTSCAPTION.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF EXECUTIONDOCUMENTSCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION EXECUTIONDOCUMENTSCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$EXECDOCFINSUMMA EXECUTIONDOCUMENTSCAPTION.EXECDOCFINSUMMA%TYPE := :NEW.EXECDOCFINSUMMA;
  new$FACT EXECUTIONDOCUMENTSCAPTION.FACT%TYPE := :NEW.FACT;
  new$DOCNUMBER EXECUTIONDOCUMENTSCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SENDERIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REALID EXECUTIONDOCUMENTSCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER EXECUTIONDOCUMENTSCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTREF EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ADJUSTMENTNUMBER EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$ACCEPTED EXECUTIONDOCUMENTSCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED EXECUTIONDOCUMENTSCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$LASTADJUSTMENT EXECUTIONDOCUMENTSCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$AGREEMENTREF EXECUTIONDOCUMENTSCAPTION.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  AdjDocNum$ VARCHAR2(50);
  agr_accepted$ NUMBER(10);
  agr_acceptdate$ NUMBER(10);
  PreviousInner$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_EXECDOCCAPTION_BI)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$ExecDocFinSumma is null) then 
    new$ExecDocFinSumma := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$RegistrationType is null) then 
    new$RegistrationType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  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;
  /* если это первая версия, то генерим новый номер цепочки, иначе подтягиваем из уточняемой записи */
  if (new$AdjustmentRef is null) then
    new$InnerNumber := GEN_ID('g_ExecDocNumber',1);
      
  else
    BEGIN
      /* уточняемая запись должна быть принятой и последней в цепочке */
      select
      InnerNumber 
      into PreviousInner$     from ExecutionDocumentsCaption
      where ID = new$AdjustmentRef and LastAccepted = 1 and LastAdjustment = 1
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (PreviousInner$ is null) then
      RaiseException('EX_ExecDoc_NotFindInner');
    END IF;
    new$InnerNumber := PreviousInner$;
      
  END IF;
  /* заполняем внутренний номер договора по id */  
  new$agreementinnernumber := null;
  if (new$agreementref is not null) then
    BEGIN
      select
      innernumber
      into new$agreementinnernumber     from agreements
      where
      id = new$agreementref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_EXECDOCCAPTION_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_EXECDOCCAPTION_BI_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Проверка указания внутренних номеров.*/
  if (new$InnerNumber is null) then
    RaiseException('EX_AGR_InnerNumsIsNull');
  END IF;

  /* Получение внутреннего номера уточнения*/
  select max(AdjustmentNumber)
  into Tmp$     from ExecutionDocumentsCaption
  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$AdjustmentRef is not null) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID), max(DocNumber)
    into Tmp$, AdjID$, AdjDocNum$       from ExecutionDocumentsCaption
    where (InnerNumber = new$InnerNumber) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/
    if (Tmp$ <> 1) then
      RaiseException('EX_ExecDoc_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID)
    into Tmp$       from ExecutionDocumentsCaption
    where (InnerNumber = new$InnerNumber) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then
      RaiseException('EX_ExecDoc_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/      
    new$AdjustmentRef := AdjID$;
        
  else /* Если ДИ не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/      
    new$AdjustmentRef := null;
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (tr_execdoccaption_bi_40)
-- Version 7.00.01.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_60 (tr_execdoccaption_bi_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$agreementinnernumber is not null) then
    BEGIN
      /* выбираем информацию о принятии из первой версии договора, т.к. вся
          цепочка договоров будет отклонена, если отклонена первая версия, и в цепочке
          будет принятый договор, если принята первая версия */
      select accepted, acceptdate     into
      agr_accepted$, agr_acceptdate$ from agreements
      where
      innernumber = new$agreementinnernumber and adjustmentnumber = 0
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* если в неотклоненном документе указан отклоненный договор */
    if (new$acceptdate is null and agr_accepted$ = 0 and agr_acceptdate$ is not null) then
      RaiseException('EX_Agr_Rejected');
    END IF;
    /* если принятый документ ссылается на непринятый договор */
    if (new$accepted = 1 and new$acceptdate is not null and
    (agr_accepted$ = 0 or agr_acceptdate$ is null)) then
      RaiseException('EX_Agr_NotAccepted');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_EXECDOCCAPTION_BI_500)
-- Last update 08.12.2005
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_EXECUTIONDOCUMENTSCAPTION (
    ID,
    DOCTYPE,
    DOCUMENTDATE,
    ACCEPTDATE,
    SUPPLIERACC_REF,
    SUMMA,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    STEPNUMBER,
    FACIALACC_CLS,
    RECIPIENT_REF,
    REGISTRATIONTYPE,
    REESTRNUMBER,
    AGREEMENTINNERNUMBER,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    NOTE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXECDOCFINSUMMA,
    FACT,
    DOCNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REALID,
    INNERNUMBER,
    ADJUSTMENTREF,
    ADJUSTMENTNUMBER,
    ACCEPTED,
    LASTACCEPTED,
    LASTADJUSTMENT,
    AGREEMENTREF
  ) VALUES (
    new$ID,
    new$DOCTYPE,
    new$DOCUMENTDATE,
    new$ACCEPTDATE,
    new$SUPPLIERACC_REF,
    new$SUMMA,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$STEPNUMBER,
    new$FACIALACC_CLS,
    new$RECIPIENT_REF,
    new$REGISTRATIONTYPE,
    new$REESTRNUMBER,
    new$AGREEMENTINNERNUMBER,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$NOTE,
    new$REVIEWNOTE,
    new$DOCSTATEREF,
    new$RVERSION,
    new$EXECDOCFINSUMMA,
    new$FACT,
    new$DOCNUMBER,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$REALID,
    new$INNERNUMBER,
    new$ADJUSTMENTREF,
    new$ADJUSTMENTNUMBER,
    new$ACCEPTED,
    new$LASTACCEPTED,
    new$LASTADJUSTMENT,
    new$AGREEMENTREF);

-- - - - - - - - - - - - -
-- AI_0 (TR_ExecDocCaption_AI)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Коррекция вспомогательных флагов в уточняемой записи ДИ*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentRef is not null) and (new$LastAdjustment = 1)) then
    update ExecutionDocuMENTSCaption set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);        
    if (new$LastAccepted = 1) then
      update ExecutionDocuMENTSCaption set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_EXECDOCCAPTION_AI_500)
-- - - - - - - - - - - - -

-- 25.08.2004
  delete from DelRecIndexes where (TableID = 114) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_IU
  INSTEAD OF UPDATE
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  new$ID EXECUTIONDOCUMENTSCAPTION.ID%TYPE := :NEW.ID;
  new$DOCTYPE EXECUTIONDOCUMENTSCAPTION.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$DOCUMENTDATE EXECUTIONDOCUMENTSCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE EXECUTIONDOCUMENTSCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SUPPLIERACC_REF EXECUTIONDOCUMENTSCAPTION.SUPPLIERACC_REF%TYPE := :NEW.SUPPLIERACC_REF;
  new$SUMMA EXECUTIONDOCUMENTSCAPTION.SUMMA%TYPE := :NEW.SUMMA;
  new$CREATERUSER EXECUTIONDOCUMENTSCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE EXECUTIONDOCUMENTSCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE EXECUTIONDOCUMENTSCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER EXECUTIONDOCUMENTSCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF EXECUTIONDOCUMENTSCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$STEPNUMBER EXECUTIONDOCUMENTSCAPTION.STEPNUMBER%TYPE := :NEW.STEPNUMBER;
  new$FACIALACC_CLS EXECUTIONDOCUMENTSCAPTION.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$RECIPIENT_REF EXECUTIONDOCUMENTSCAPTION.RECIPIENT_REF%TYPE := :NEW.RECIPIENT_REF;
  new$REGISTRATIONTYPE EXECUTIONDOCUMENTSCAPTION.REGISTRATIONTYPE%TYPE := :NEW.REGISTRATIONTYPE;
  new$REESTRNUMBER EXECUTIONDOCUMENTSCAPTION.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$AGREEMENTINNERNUMBER EXECUTIONDOCUMENTSCAPTION.AGREEMENTINNERNUMBER%TYPE := :NEW.AGREEMENTINNERNUMBER;
  new$REJECTCLS EXECUTIONDOCUMENTSCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE EXECUTIONDOCUMENTSCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS EXECUTIONDOCUMENTSCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID EXECUTIONDOCUMENTSCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID EXECUTIONDOCUMENTSCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$NOTE EXECUTIONDOCUMENTSCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$REVIEWNOTE EXECUTIONDOCUMENTSCAPTION.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF EXECUTIONDOCUMENTSCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION EXECUTIONDOCUMENTSCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$EXECDOCFINSUMMA EXECUTIONDOCUMENTSCAPTION.EXECDOCFINSUMMA%TYPE := :NEW.EXECDOCFINSUMMA;
  new$FACT EXECUTIONDOCUMENTSCAPTION.FACT%TYPE := :NEW.FACT;
  new$DOCNUMBER EXECUTIONDOCUMENTSCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SENDERIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REALID EXECUTIONDOCUMENTSCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER EXECUTIONDOCUMENTSCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTREF EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ADJUSTMENTNUMBER EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$ACCEPTED EXECUTIONDOCUMENTSCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED EXECUTIONDOCUMENTSCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$LASTADJUSTMENT EXECUTIONDOCUMENTSCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$AGREEMENTREF EXECUTIONDOCUMENTSCAPTION.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
--
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  CntAgr$ NUMBER(10);
  CntStep$ NUMBER(10);
  agr_accepted$ NUMBER(10);
  agr_acceptdate$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_EXECDOCCAPTION_BU)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$ExecDocFinSumma is null) then 
    new$ExecDocFinSumma := 0;  
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$RegistrationType is null) then 
    new$RegistrationType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 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 CNT$1
      from ExecutionDocumentsDetail
      where 
      (                   RecordIndex = :old.Id
      ) AND (ROWNUM = 1)                ;
      if ((CNT$1<> 0)         ) then
        RaiseException('Ex_CantModufyBudget');
      END IF;
      SELECT COUNT(                   Id
      ) INTO CNT$2
      from PaymentSchedule
      where
      (                   ExecutionRef = :old.Id
      ) AND (ROWNUM = 1)                ;
      if ((CNT$2<> 0)         ) then
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* если номер цепочки не заполнен, то берем его из предыдущей версии записи */
  if (new$InnerNumber is null) then
    new$InnerNumber := :old.InnerNumber;
  END IF;
  /* cледим, чтобы никто не поменял внутреннюю нумерацию и ссылку на предыдущую */
  /* версию, иначе все накернится */
  if (new$InnerNumber <> :old.InnerNumber or
  new$AdjustmentRef <> :old.AdjustmentRef or
  new$AdjustmentNumber <> :old.AdjustmentNumber) then
    RaiseException('EX_Agr_ChangeInnerNums');
  END IF;
  /* заполняем внутренний номер договора по id */  
  new$agreementinnernumber := null;
  if (new$agreementref is not null) then
    BEGIN
      select
      innernumber
      into new$agreementinnernumber     from agreements
      where
      id = new$agreementref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_EXECDOCCAPTION_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_EXECDOCCAPTION_BU_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* отменять отклонение ДИ нельзя */
  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) then 
    /* менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (:old.LastAdjustment = 1) then
      new$LastAccepted := 1;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');
    END IF;
  END IF;
      
  /* если отменили принятие ДИ, тогда необходимо снять флаг LastAccepted*/
  if (:old.AcceptDate is not null and :old.Accepted = 1 and new$AcceptDate is null) then
    /* менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (:old.LastAdjustment = 1) then
      new$LastAccepted := 0;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');  
    END IF;
  END IF;
      
  /* если отклонили ДИ, тогда необходимо скинуть флаги LastAdjustment и LastAccepted */
  if (new$AcceptDate is not null and new$Accepted = 0 and (:old.AcceptDate is null or :old.Accepted = 1)) then
    if (:old.LastAdjustment = 1) then
      new$LastAdjustment := 0;
      new$LastAccepted := 0;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');
    END IF;
    SELECT COUNT(                 Id
    ) INTO CNT$1
    from ExecutionDocumentsCaption
    where
    (                 InnerNumber = new$InnerNumber and AdjustmentNumber > 0
    ) AND (ROWNUM = 1)              ;
    /* нельзя отклонять первую версию в цепочке при наличии уточнений */
    if (new$AdjustmentNumber = 0 and 
    (CNT$1<> 0)       ) then
      RaiseException('EX_ExecDoc_PrimaryAgrHasNotify');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_40 (tr_execdoccaption_bu_40)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  if ((:old.AcceptDate is not null) and (new$AcceptDate is null)) then
    select count(ID) into CntAgr$ from Agreements where (CloseDoc = :old.ID) ;
    select count(ID) into CntStep$ from AgreementSteps where (CloseDoc = :old.ID) ;
    if ((CntAgr$ > 0) or (CntStep$ > 0)) then
      RaiseException('ex_CannotUpdateCloseDoc');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_60 (tr_execdoccaption_bu_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$agreementinnernumber is not null) then
    BEGIN
      /* выбираем информацию о принятии из первой версии договора, т.к. вся
          цепочка договоров будет отклонена, если отклонена первая версия, и в цепочке
          будет принятый договор, если принята первая версия */
      select accepted, acceptdate     into
      agr_accepted$, agr_acceptdate$ from agreements
      where
      innernumber = new$agreementinnernumber and adjustmentnumber = 0
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* если в неотклоненном документе указан отклоненный договор */
    if (new$acceptdate is null and agr_accepted$ = 0 and agr_acceptdate$ is not null) then
      RaiseException('EX_Agr_Rejected');
    END IF;
    /* если принятый документ ссылается на непринятый договор */
    if (new$accepted = 1 and new$acceptdate is not null and
    (agr_accepted$ = 0 or agr_acceptdate$ is null)) then
      RaiseException('EX_Agr_NotAccepted');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_EXECDOCCAPTION_BU_200)
-- Create 04.10.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_EDCAPTION_BU_700)
-- Create 14.10.2004
-- - - - - - - - - - - - -

   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_EXECUTIONDOCUMENTSCAPTION SET
    ID = new$ID,
    DOCTYPE = new$DOCTYPE,
    DOCUMENTDATE = new$DOCUMENTDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    SUPPLIERACC_REF = new$SUPPLIERACC_REF,
    SUMMA = new$SUMMA,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    STEPNUMBER = new$STEPNUMBER,
    FACIALACC_CLS = new$FACIALACC_CLS,
    RECIPIENT_REF = new$RECIPIENT_REF,
    REGISTRATIONTYPE = new$REGISTRATIONTYPE,
    REESTRNUMBER = new$REESTRNUMBER,
    AGREEMENTINNERNUMBER = new$AGREEMENTINNERNUMBER,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    NOTE = new$NOTE,
    REVIEWNOTE = new$REVIEWNOTE,
    DOCSTATEREF = new$DOCSTATEREF,
    RVERSION = new$RVERSION,
    EXECDOCFINSUMMA = new$EXECDOCFINSUMMA,
    FACT = new$FACT,
    DOCNUMBER = new$DOCNUMBER,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    REALID = new$REALID,
    INNERNUMBER = new$INNERNUMBER,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    ACCEPTED = new$ACCEPTED,
    LASTACCEPTED = new$LASTACCEPTED,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    AGREEMENTREF = new$AGREEMENTREF
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_0 (TR_ExecDocCaption_AU)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AU_30 (TR_EXECDOCCAPTION_AU_30)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if ((new$DocStateRef is null) 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 ExecutionRef=new$ID;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_EXECDOCCAPTION_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

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

END;
/
commit work
/


-- #########################################################
-- #########################################################
-- Alter_tr_Promise_Caption_au_1.sql
-- #########################################################
-- #########################################################

/* Добавлена смена даты закрытия в уточняемых БО при смене даты принятия в уточнении.
  (Когалым: менялась дата принятия в уточнении,
  при этом дата закрытия в уточняемом оставалась прежней,
  из-за чего шло расхождение в отчетах) */
-- ALTER TRIGGER tr_Promise_Caption_au_1
CREATE OR REPLACE TRIGGER TR_PROMISE_CAPTION_IU
  INSTEAD OF UPDATE
  ON PROMISE_CAPTION
  FOR EACH ROW
DECLARE
  new$ID PROMISE_CAPTION.ID%TYPE := :NEW.ID;
  new$ACCEPTDATE PROMISE_CAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$ACCEPTED_REVERTED PROMISE_CAPTION.ACCEPTED_REVERTED%TYPE := :NEW.ACCEPTED_REVERTED;
  new$AGREEMENT_DATE PROMISE_CAPTION.AGREEMENT_DATE%TYPE := :NEW.AGREEMENT_DATE;
  new$AGREEMENT_END PROMISE_CAPTION.AGREEMENT_END%TYPE := :NEW.AGREEMENT_END;
  new$AGREEMENT_NOTE PROMISE_CAPTION.AGREEMENT_NOTE%TYPE := :NEW.AGREEMENT_NOTE;
  new$AGREEMENT_TYPE PROMISE_CAPTION.AGREEMENT_TYPE%TYPE := :NEW.AGREEMENT_TYPE;
  new$AGREEMENT_SUMMA PROMISE_CAPTION.AGREEMENT_SUMMA%TYPE := :NEW.AGREEMENT_SUMMA;
  new$SUPPLIER_REF PROMISE_CAPTION.SUPPLIER_REF%TYPE := :NEW.SUPPLIER_REF;
  new$DELIVERY_RULES PROMISE_CAPTION.DELIVERY_RULES%TYPE := :NEW.DELIVERY_RULES;
  new$TOTALSUMM PROMISE_CAPTION.TOTALSUMM%TYPE := :NEW.TOTALSUMM;
  new$BUDGETORG_REF PROMISE_CAPTION.BUDGETORG_REF%TYPE := :NEW.BUDGETORG_REF;
  new$FACIALACC_CLS PROMISE_CAPTION.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$BUDGETREF PROMISE_CAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$CREATERUSER PROMISE_CAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE PROMISE_CAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE PROMISE_CAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER PROMISE_CAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$ANUMBER PROMISE_CAPTION.ANUMBER%TYPE := :NEW.ANUMBER;
  new$REJECT_CLS PROMISE_CAPTION.REJECT_CLS%TYPE := :NEW.REJECT_CLS;
  new$REJECTCAUSE PROMISE_CAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS PROMISE_CAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID PROMISE_CAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID PROMISE_CAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$DOCUMENTSTATE PROMISE_CAPTION.DOCUMENTSTATE%TYPE := :NEW.DOCUMENTSTATE;
  new$USERSVISA PROMISE_CAPTION.USERSVISA%TYPE := :NEW.USERSVISA;
  new$RVERSION PROMISE_CAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$DOCSTATEREF PROMISE_CAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$STIMATEID PROMISE_CAPTION.STIMATEID%TYPE := :NEW.STIMATEID;
  new$BIDNUMBER PROMISE_CAPTION.BIDNUMBER%TYPE := :NEW.BIDNUMBER;
  new$FAXDOCCOUNT PROMISE_CAPTION.FAXDOCCOUNT%TYPE := :NEW.FAXDOCCOUNT;
  new$SUPPLIER_ACC_REF PROMISE_CAPTION.SUPPLIER_ACC_REF%TYPE := :NEW.SUPPLIER_ACC_REF;
  new$AGREEMENT_NUM PROMISE_CAPTION.AGREEMENT_NUM%TYPE := :NEW.AGREEMENT_NUM;
  new$INFONUMBER PROMISE_CAPTION.INFONUMBER%TYPE := :NEW.INFONUMBER;
  new$ADVANCESUMMA PROMISE_CAPTION.ADVANCESUMMA%TYPE := :NEW.ADVANCESUMMA;
--
  cnt$ NUMBER (10);
  IsReject$ NUMBER(10);
  DetCount1$ NUMBER(10);
  CloseDate1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_PROMISE_CAPTION_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$Accepted_Reverted is null) then 
    new$Accepted_Reverted := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$TotalSumm is null) then 
    new$TotalSumm := 0;
  END IF;
  if (new$Agreement_Type is null) then 
    new$Agreement_Type := 0;
  END IF;
  if (new$Agreement_Summa is null) then 
    new$Agreement_Summa := 0;
  END IF;
  if ((new$reject_cls is not null) and (:old.reject_cls is null) )then 
    new$Accepted_Reverted := 1;
  END IF;
  if ((new$reject_cls is null) and (:old.reject_cls is not null) )then 
    new$Accepted_Reverted := 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 DetCount1$ from Promise_detail where Title_Ref = :old.ID
      ;
      if (DetCount1$ > 0) then 
        RaiseException('Ex_CantModufyBudget');          
      END IF;
    END IF;
  END IF;
  /* документ не может быть одновременно принятым и отклоненным*/
  if ((new$AcceptDate is not null) and (new$Accepted_Reverted = 0) and (new$Reject_Cls is not null)) then
    RaiseException('EX_DOCNOTACCEPTREJECT');
  END IF;

-- - - - - - - - - - - - -
-- BU_101 (TR_PROMISECAPTION_BU_101)
-- Create 10.08.2004
-- Last update 19.03.2010
-- - - - - - - - - - - - -

  /*  Срабатывает, когда БО принимается */
  if ( ((:old.AcceptDate is null) and (new$AcceptDate is not null) and (new$Accepted_Reverted = 0)) or
       ((:old.Accepted_Reverted = 1) and (new$Accepted_Reverted = 0) and (new$AcceptDate is not null))
     ) then
     
    /*  Пробегаемся по БО текущего договора и проверяем, чтобы не было дублирования уточнений.*/
    for R$ IN (select Parent_Promise PP, ID
        from Promise_Detail
        where (Title_Ref = new$id) and (Parent_Promise is not null) and (budgetref = new$budgetref))
    LOOP
            /*  Выбираем количество уточнений */
      select count(pd.ID) into CNT$
      from Promise_Detail pd, promise_caption pc
      /*  Проверяем по ссылке на заголовок принятость уточнения. Добавлена проверка на неравенство ИД текущей записи.*/
      where ((pd.Parent_Promise = R$.PP) and (pc.id = pd.title_ref) and (pc.acceptdate is not null)
             and (pc.budgetref = pd.budgetref) and (pc.budgetref = new$budgetref) AND (pc.Accepted_Reverted = 0) AND
             (pd.id <> R$.ID)) AND (ROWNUM = 1);

      /*  Если есть принятое уточнение, тогда ругаемся */
      if (cnt$ > 0) then
        RaiseException('EX_PROMISE_ADJUSTDUPLICATE');
      end if;  
    end LOOP;
  end if;

-- - - - - - - - - - - - -
-- BU_200 (TR_PROMISE_CAPTION_BU_200)
-- Create 21.02.2005
-- Last update 24.05.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_PROMISE_CAPTION_BU_300)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.Reject_CLS is null)and(new$Reject_CLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.Reject_CLS is not null)and(new$Reject_CLS 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 Promise_Detail d where d.Title_Ref = new$id));
  end if;

-- - - - - - - - - - - - -
-- BU_700 (TR_PROMISE_CAPTION_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_CAPTION SET
    ID = new$ID,
    ACCEPTDATE = new$ACCEPTDATE,
    ACCEPTED_REVERTED = new$ACCEPTED_REVERTED,
    AGREEMENT_DATE = new$AGREEMENT_DATE,
    AGREEMENT_END = new$AGREEMENT_END,
    AGREEMENT_NOTE = new$AGREEMENT_NOTE,
    AGREEMENT_TYPE = new$AGREEMENT_TYPE,
    AGREEMENT_SUMMA = new$AGREEMENT_SUMMA,
    SUPPLIER_REF = new$SUPPLIER_REF,
    DELIVERY_RULES = new$DELIVERY_RULES,
    TOTALSUMM = new$TOTALSUMM,
    BUDGETORG_REF = new$BUDGETORG_REF,
    FACIALACC_CLS = new$FACIALACC_CLS,
    BUDGETREF = new$BUDGETREF,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    ANUMBER = new$ANUMBER,
    REJECT_CLS = new$REJECT_CLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    DOCUMENTSTATE = new$DOCUMENTSTATE,
    USERSVISA = new$USERSVISA,
    RVERSION = new$RVERSION,
    DOCSTATEREF = new$DOCSTATEREF,
    STIMATEID = new$STIMATEID,
    BIDNUMBER = new$BIDNUMBER,
    FAXDOCCOUNT = new$FAXDOCCOUNT,
    SUPPLIER_ACC_REF = new$SUPPLIER_ACC_REF,
    AGREEMENT_NUM = new$AGREEMENT_NUM,
    INFONUMBER = new$INFONUMBER,
    ADVANCESUMMA = new$ADVANCESUMMA
  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_1 (TR_PROMISE_CAPTION_AU_1)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  /* Обновлять ссылку нужно если приняли или принятое сделали не принятым
       и нечего не делать если отклонили или разотклонили */
  if (  ( ((:old.AcceptDate is null) or (:old.Accepted_Reverted = 1)) and /* приняли */
  (new$AcceptDate is not null) and (new$Accepted_Reverted = 0)
  ) or
  (
  ((new$AcceptDate is null) or (new$Accepted_Reverted = 1)) and /* разприняли */
  (:old.AcceptDate is not null) and (:old.Accepted_Reverted = 0)
  ) or
  ((new$AcceptDate is not null) and (:old.AcceptDate is not null) and /* поменяли */
  (new$AcceptDate <> :old.AcceptDate)
  )
  ) then
    /* Если договор принимают, или меняют дату принятия уже принятого,
           тогда эту дату надо проставить во всех уточняемых БО как дату закрытия*/    
    CloseDate1$ := new$AcceptDate;
    /* Если договор отклоняется, тогда проставляем NULL */
    if (new$Accepted_Reverted = 1) then
      CloseDate1$ := null;
    END IF;
    /* Пробегаемся по БО текущего договора и проставляем дату закрытия в уточняемых БО*/
    FOR REC$1 IN (select Parent_Promise AS PP, RegistrNumber
     AS ChildNum         from Promise_Detail
    where (Title_Ref = new$id) and (Parent_Promise is not null)
    )
    LOOP
      if (CloseDate1$ is null) then
        REC$1.ChildNum := null;
      END IF;
      update Promise_Detail set
      CloseDate = CloseDate1$,
      Child_Promise = REC$1.ChildNum

      where
      (RegistrNumber = REC$1.PP) and
      (budgetref = new$budgetref);
          
    END LOOP;
  END IF;

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

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

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

END;
/

commit work
/

-- #########################################################
-- #########################################################
-- ALTER_tr_writexecutioncaption_bd.sql
-- #########################################################
-- #########################################################

/* Скрипт изменяет триггер каскадного удаления для заголовка на интерфейсе Исполнительные листы:
 теперь удаляем данные еще и из таблицы уведомлений */
-- ALTER TRIGGER tr_writexecutioncaption_bd
CREATE OR REPLACE TRIGGER TR_WRITEXECUTIONCAPTION_BD
  BEFORE DELETE
  ON WRITEXECUTIONCAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_WRITEXECUTIONCAPTION_BD)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
commit work 
/

-- #########################################################
-- #########################################################
-- delete_Change_Orgsnization_right.sql
-- #########################################################
-- #########################################################

/* Удаление права "Изменение организации"*/
delete 
from permissions
where (permissions.name='Изменение организации')
/
COMMIT WORK 
/

-- #########################################################
-- #########################################################
-- Alter_Selections_and_FieldsInfo.sql
-- #########################################################
-- #########################################################

/* скрипт добавляет в таблицы Selections и FieldsInfo поля, необходимые для организации
   работы менеджера кэшей и динамических разыменовок *//* добавляем поля в таблицу выборок */
ALTER TABLE Selections ADD (
  AvailableInDeref NUMBER(10),/* признак доступна ли таблица в разыменовках (кэше) */
    CHECK((AvailableInDeref<=2147483647)AND(AvailableInDeref>-2147483648)),
  CacheType NUMBER(10),/* тип кэша(полный кэш, обычный кэш) */
    CHECK((CacheType<=2147483647)AND(CacheType>-2147483648)),
  FullOrModInsRefrTime NUMBER(10),/* интервал полного обновления кэша, либо обновления измененных\вставленных записей */
    CHECK((FullOrModInsRefrTime<=2147483647)AND(FullOrModInsRefrTime>-2147483648)),
  DeleteRefrTime NUMBER(10),/* интервал обновления удаленных записей */
    CHECK((DeleteRefrTime<=2147483647)AND(DeleteRefrTime>-2147483648)),
  FindTimeRefresh NUMBER(10),/* интервал обновления кэша в случае неудачного поиска */
    CHECK((FindTimeRefresh<=2147483647)AND(FindTimeRefresh>-2147483648)),
  Annotation VARCHAR2(1024),/* аннотация */
  DerefName VARCHAR2(30)/* имя в разыменовке */
)
/
/* заполняем not null поля значения по умолчанию */
update Selections set
  AvailableInDeref = 1,    /* таблица доступна в разыменовках */
  CacheType = 0,           /* обычный кэш */
  FullOrModInsRefrTime = 5 -- время обновления 5 сек
/
-- CREATE TRIGGER selections_bi0
CREATE OR REPLACE TRIGGER SELECTIONS_BI
  BEFORE INSERT
  ON SELECTIONS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (SELECTIONS_BI0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then 
    select g_shared.nextval into :new.id from dual;
  END IF;
  if (:new.Kind is null) then 
    :new.kind := 2;
  END IF;
  if (:new.ReadOnly is null) then 
    :new.ReadOnly := 0;
  END IF;
  if (:new.UseInDoc is null) then 
    :new.UseInDoc := 0;
  END IF;
  if ((:new.Alias is null) or (:new.Alias  is null)) then 
    :new.Alias := :new.TableName;
  END IF;
  if (:new.NeedGroupOnDb is null) then 
    :new.NeedGroupOnDb := 0;
  END IF;
  if (:new.NeedDistinct is null) then 
    :new.NeedDistinct := 0;
  END IF;
  if (:new.Master is null) then 
    :new.Master := 1;
  END IF;
  if (:new.AvailableInDeref is null) then 
    :new.AvailableInDeref := 1;
  END IF;
  if (:new.CacheType is null) then 
    :new.CacheType := 0;
  END IF;
  if (:new.FullOrModInsRefrTime is null) then 
    :new.FullOrModInsRefrTime := -1;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (SELECTIONS_BI500)
-- Create 12.10.2009
-- Last update 12.10.2009
-- - - - - - - - - - - - -

  :NEW.CREATEDATE := SYSDATE;
  :NEW.UPDATEDATE := :NEW.CREATEDATE;
  :NEW.CREATERUSER := user;
  :NEW.UPDATERUSER := user;

END;
/
-- CREATE TRIGGER selections_bu0
CREATE OR REPLACE TRIGGER SELECTIONS_BU
  BEFORE UPDATE
  ON SELECTIONS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (SELECTIONS_BU0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.Kind is null) then 
    :new.Kind := 2;
  END IF;
  if (:new.ReadOnly is null) then 
    :new.ReadOnly := 0;
  END IF;
  if (:new.UseInDoc is null) then 
    :new.UseInDoc := 0;
  END IF;
  if ((:new.Alias is null) or (:new.Alias  is null)) then 
    :new.Alias := :new.Name;
  END IF;
  if (:new.NeedGroupOnDb is null) then 
    :new.NeedGroupOnDb := 0;
  END IF;
  if (:new.NeedDistinct is null) then 
    :new.NeedDistinct := 0;
  END IF;
  if (:new.Master is null) then 
    :new.Master := 1;
  END IF;
  if (:new.AvailableInDeref is null) then 
    :new.AvailableInDeref := 1;
  END IF;
  if (:new.CacheType is null) then 
    :new.CacheType := 0;
  END IF;
  if (:new.FullOrModInsRefrTime is null) then 
    :new.FullOrModInsRefrTime := -1;
  END IF;

END;
/
commit work 
/
/* добавляем поля в таблицу FieldsInfo */
ALTER TABLE FieldsInfo ADD (
  IsTimeStampField NUMBER(10),/* признак поля, содержащего дату и время последнего изменения записи */
    CHECK((IsTimeStampField<=2147483647)AND(IsTimeStampField>-2147483648)),
  IsBudget NUMBER(10),/* принадлежность к проекту */
    CHECK((IsBudget<=2147483647)AND(IsBudget>-2147483648)),
  AvailableInDeref NUMBER(10),/* признак доступно ли поле в разыменовках(кэше) */
    CHECK((AvailableInDeref<=2147483647)AND(AvailableInDeref>-2147483648)),
  Annotation VARCHAR2(1024),/* аннотация */
  Alias VARCHAR2(30),/* алиас */
  DerefName VARCHAR2(30)/* имя в разыменовке */
)
/
ALTER TABLE FIELDSINFO DROP CONSTRAINT UK_FIELDSINFO_FIELDNAME DROP INDEX
/
ALTER TABLE FIELDSINFO ADD (
  constraint UK_FIELDSINFO_FIELDNAME unique (FIELDNAME,SELECTIONREF,ALIAS,IsBudget) 
)
/
-- CREATE TRIGGER fieldsinfo_bi0
CREATE OR REPLACE TRIGGER FIELDSINFO_BI
  BEFORE INSERT
  ON FIELDSINFO
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (FIELDSINFO_BI0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.id is null) then 
    select g_shared.nextval into :new.id from dual;
  END IF;
  if (:new.fieldkind is null) then 
    :new.fieldkind := 1;
  END IF;
  if (:new.datatype is null) then 
    :new.datatype := 1;
  END IF;
  if (:new.subdatatype is null) then 
    :new.subdatatype := 0;
  END IF;
  if (:new.cantedit is null) then 
    :new.cantedit := 0;
  END IF;
  if (:new.novisualize is null) then 
    :new.novisualize := 0;
  END IF;
  if (:new.required is null) then 
    :new.required := 0;
  END IF;
  if (:new.primarykey is null) then 
    :new.primarykey := 0;
  END IF;
  if (:new.isrversion is null) then 
    :new.isrversion := 0;
  END IF;
  if (:new.sortdirection is null) then 
    :new.sortdirection := 0;
  END IF;
  if (:new.sortorder is null) then 
    :new.sortorder := 0;
  END IF;
  if (:new.agrfunction is null) then 
    :new.agrfunction := 0;
  END IF;
  if (:new.flagfieldname is null) then 
    :new.flagfieldname := 0;
  END IF;
  if (:new.flagdisplaylabel is null) then 
    :new.flagdisplaylabel := 0;
  END IF;
  if (:new.flagnote is null) then 
    :new.flagnote := 0;
  END IF;
  if (:new.flagdefaultwidth is null) then 
    :new.flagdefaultwidth := 0;
  END IF;
  if (:new.flagcantedit is null) then 
    :new.flagcantedit := 0;
  END IF;
  if (:new.flagnovisualize is null) then 
    :new.flagnovisualize := 0;
  END IF;
  if (:new.flagrequired is null) then 
    :new.flagrequired := 0;
  END IF;
  if (:new.flaglimitparamnames is null) then 
    :new.flaglimitparamnames := 0;
  END IF;
  if (:new.flagagrfunction is null) then 
    :new.flagagrfunction := 0;
  END IF;
  if (:new.IsTimeStampField is null) then 
    :new.IsTimeStampField := 0;
  END IF;
  if (:new.AvailableInDeref is null) then 
    :new.AvailableInDeref := 1;
  END IF;
  if (:new.IsBudget is null) then
    BEGIN
      select Master     into :new.IsBudget from Selections
      where ID = :new.SelectionRef
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (FIELDSINFO_BI500)
-- Create 12.10.2009
-- Last update 12.10.2009
-- - - - - - - - - - - - -

  :NEW.CREATEDATE := SYSDATE;
  :NEW.UPDATEDATE := :NEW.CREATEDATE;
  :NEW.CREATERUSER := user;
  :NEW.UPDATERUSER := user;

END;
/
-- CREATE TRIGGER fieldsinfo_bu0
CREATE OR REPLACE TRIGGER FIELDSINFO_BU
  BEFORE UPDATE
  ON FIELDSINFO
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (FIELDSINFO_BU0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.fieldkind is null) then 
    :new.fieldkind := 1;
  END IF;
  if (:new.datatype is null) then 
    :new.datatype := 1;
  END IF;
  if (:new.subdatatype is null) then 
    :new.subdatatype := 0;
  END IF;
  if (:new.cantedit is null) then 
    :new.cantedit := 0;
  END IF;
  if (:new.novisualize is null) then 
    :new.novisualize := 0;
  END IF;
  if (:new.required is null) then 
    :new.required := 0;
  END IF;
  if (:new.primarykey is null) then 
    :new.primarykey := 0;
  END IF;
  if (:new.isrversion is null) then 
    :new.isrversion := 0;
  END IF;
  if (:new.sortdirection is null) then 
    :new.sortdirection := 0;
  END IF;
  if (:new.sortorder is null) then 
    :new.sortorder := 0;
  END IF;
  if (:new.agrfunction is null) then 
    :new.agrfunction := 0;
  END IF;
  if (:new.flagfieldname is null) then 
    :new.flagfieldname := 0;
  END IF;
  if (:new.flagdisplaylabel is null) then 
    :new.flagdisplaylabel := 0;
  END IF;
  if (:new.flagnote is null) then 
    :new.flagnote := 0;
  END IF;
  if (:new.flagdefaultwidth is null) then 
    :new.flagdefaultwidth := 0;
  END IF;
  if (:new.flagcantedit is null) then 
    :new.flagcantedit := 0;
  END IF;
  if (:new.flagnovisualize is null) then 
    :new.flagnovisualize := 0;
  END IF;
  if (:new.flagrequired is null) then 
    :new.flagrequired := 0;
  END IF;
  if (:new.flaglimitparamnames is null) then 
    :new.flaglimitparamnames := 0;
  END IF;
  if (:new.flagagrfunction is null) then 
    :new.flagagrfunction := 0;
  END IF;
  if (:new.IsTimeStampField is null) then 
    :new.IsTimeStampField := 0;
  END IF;
  if (:new.AvailableInDeref is null) then 
    :new.AvailableInDeref := 1;
  END IF;
  if (:new.IsBudget is null) then
    BEGIN
      select Master     into :new.IsBudget from Selections
      where ID = :new.SelectionRef
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

END;
/
commit work 
/
/* таблица событий  */
CREATE TABLE SelectionEvents (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  EventCode NUMBER(10) NOT NULL,/* код события */
    CHECK((EventCode<=2147483647)AND(EventCode>-2147483648)),
  SelectionRef NUMBER(10) NOT NULL,/* ссылка на выборку */
    CHECK((SelectionRef<=2147483647)AND(SelectionRef>-2147483648)),
  ScriptName VARCHAR2(255) NOT NULL,/* имя АБЛ макроса */
  CREATERUSER VARCHAR2(30) NOT NULL,
  CREATEDATE DATE NOT NULL,
  UPDATEDATE DATE NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL
)
/
ALTER TABLE SelectionEvents ADD (
  constraint SelectionEvents_PK_ID PRIMARY KEY (ID)
)
/
ALTER TABLE SelectionEvents ADD (
  constraint FK_SelEvents_SelectionRef foreign key (SelectionRef) references Selections (ID)
)
/
CREATE INDEX FK_SelEvents_SelectionRef ON SelectionEvents(SelectionRef)
/
commit work 
/
-- CREATE TRIGGER TR_SelectionEvents_BI
CREATE OR REPLACE TRIGGER TR_SelectionEvents_BI
  BEFORE INSERT
  ON SelectionEvents
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_SelectionEvents_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SelectionEvents_BI_500
CREATE OR REPLACE TRIGGER TR_SelectionEvents_BI
  BEFORE INSERT
  ON SelectionEvents
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_SelectionEvents_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- BI_500 (TR_SelectionEvents_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.CreateDate is null) then 
    :new.CreateDate := SYSDATE;
  END IF;
  if (:new.CreaterUser is null) then 
    :new.CreaterUser := user;
  END IF;
  :new.UpdateDate := SYSDATE;
  :new.UpdaterUser := User;

END;
/
-- CREATE TRIGGER TR_SelectionEvents_BU_500
CREATE OR REPLACE TRIGGER TR_SelectionEvents_BU_500
  BEFORE UPDATE
  ON SELECTIONEVENTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_SelectionEvents_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
GRANT SELECT, INSERT, UPDATE, DELETE ON SelectionEvents TO BUDGET_USERS
/
COMMIT WORK 
/
/* заполним признак IsTimeStampField, остальные поля заполнятся триггерами */

update FieldsInfo set
  IsTimeStampField = 1
where
  UPPER(FieldName) = 'UPDATEDATE'
/
update FieldsInfo set
  IsTimeStampField = 0
where
  IsTimeStampField is null
/
commit work 
/
ALTER TABLE Selections MODIFY(AvailableInDeref NOT NULL)
/
ALTER TABLE Selections MODIFY(CacheType NOT NULL)
/
ALTER TABLE Selections MODIFY(FullOrModInsRefrTime NOT NULL)
/
ALTER TABLE FieldsInfo MODIFY(IsTimeStampField NOT NULL)
/
ALTER TABLE FieldsInfo MODIFY(IsBudget NOT NULL)
/
ALTER TABLE FieldsInfo MODIFY(AvailableInDeref NOT NULL)
/

-- #########################################################
-- #########################################################
-- fix_documentCls_activateBU500.sql
-- #########################################################
-- #########################################################

/* Скрипт снова активирует триггер авторизации случайно отключенный в 8.0 */
ALTER TRIGGER TR_DOCUMENTCLS_BU_500 ENABLE
/
commit work 
/

-- #########################################################
-- #########################################################
-- create_trigger_TransfertCls_BU_100.sql
-- #########################################################
-- #########################################################

/* Скрипт запрещает изменение кода у КЦС с ID=0 */
INSERT INTO SqlExceptions(Name, Code, Text) VALUES ('EX_CANTMODIFY_ZEROTRANFERTSCLS', -20352, 'Нельзя изменять нулевой КЦС')
/
commit work 
/
-- CREATE TRIGGER TR_TRANSFERTCLS_BU_100
CREATE OR REPLACE TRIGGER TR_TRANSFERTCLS_BU
  BEFORE UPDATE
  ON TRANSFERTCLS
  FOR EACH ROW
DECLARE
  CurrentDate$ NUMBER;
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;

END;
/
commit work 
/

-- #########################################################
-- #########################################################
-- alter_OKOPF_add_DeleteDate.sql
-- #########################################################
-- #########################################################

/* Добавление полей StartDate, DeleteDate в таблицу OKOPF */
ALTER TABLE OKOPF ADD (
  STARTDATE DATE,
  DELETEDATE DATE
)
/
commit work 
/

-- #########################################################
-- #########################################################
-- alter_Organizations_addOKPO.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет полу ОКПО в таблицу организаций */
ALTER TABLE TB_organizations ADD (
  OKPO 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)
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
  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;
--
  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)
-- Last update 14.02.2006
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;
  addDateConst(-1, 17, new$CreateDate, '');

-- - - - - - - - - - - - -
-- 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
  ) 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);

-- - - - - - - - - - - - -
-- 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;
--
  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
  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 
/



-- #########################################################
-- #########################################################
-- AlterUnionNotifyCpt_LastExtrChange.sql
-- #########################################################
-- #########################################################

ALTER TABLE unionnotifycaption ADD (
  LastExtrChange DATE
)
/
commit work
/


-- #########################################################
-- #########################################################
-- Alter_ConstsConstraints_ora.sql
-- #########################################################
-- #########################################################


/* Таблицы констант. Скрипт переключает первичный ключ с составного ProgIndex,ConstIndex на простой id, а для ProgIndex,ConstIndex создает обычный уникальный индекс. Выполнять после Add_Fields_To_Const_Tables.sql */
alter table INTCONST drop PRIMARY KEY
/

alter table VARCHARCONST drop PRIMARY KEY
/

alter table REALCONST drop PRIMARY KEY
/

alter table DATECONST drop PRIMARY KEY
/

commit work
/

ALTER TABLE INTCONST ADD constraint UK_INTCONST_INDEXES unique (ProgIndex,ConstIndex)
/

ALTER TABLE INTCONST ADD constraint PK_INTCONST_ID Primary key (ID)
/

ALTER TABLE VARCHARCONST ADD constraint UK_VARCHARCONST_INDEXES unique (ProgIndex,ConstIndex)
/

ALTER TABLE VARCHARCONST ADD constraint PK_VARCHARCONST_ID Primary key (ID)
/

ALTER TABLE REALCONST ADD constraint UK_REALCONST_INDEXES unique (ProgIndex,ConstIndex)
/

ALTER TABLE REALCONST ADD constraint PK_REALCONST_ID Primary key (ID)
/

ALTER TABLE DATECONST ADD constraint UK_DATECONST_INDEXES unique (ProgIndex,ConstIndex)
/

ALTER TABLE DATECONST ADD constraint PK_DATECONST_ID Primary key (ID)
/

COMMIT WORK
/


-- #########################################################
-- #########################################################
-- create_table_CDECls.sql
-- #########################################################
-- #########################################################

CREATE TABLE CommDirectionExpenceCls (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  CODE VARCHAR2(10) NOT NULL,
  NAME VARCHAR2(1024) NOT NULL,
  OWNERLEVEL NUMBER(10),
    CHECK((OWNERLEVEL<=2147483647)AND(OWNERLEVEL>-2147483648)),
  CREATEDATE DATE NOT NULL,
  UPDATEDATE DATE NOT NULL,
  DELETEDATE DATE,
  STARTDATE DATE,
  CREATERUSER VARCHAR2(30) NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL
)
/
ALTER TABLE KCSR ADD (
  ConformityCode VARCHAR2(20),
  DirectionExpence VARCHAR2(10)
)
/
COMMIT WORK
/
ALTER TABLE CommDirectionExpenceCls ADD (
  constraint UQ_CDECLS_CODE Unique(CODE)
)
/
ALTER TABLE commdirectionexpencecls ADD (
  CONSTRAINT PK_CDECLS_ID Primary Key(ID)
)
/
-- CREATE TRIGGER TR_CDECLS_BI_500
CREATE OR REPLACE TRIGGER TR_CommDirectionExpenceCls_BI
  BEFORE INSERT
  ON CommDirectionExpenceCls
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (TR_CDECLS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_CDECLS_BU_500
CREATE OR REPLACE TRIGGER TR_CDECLS_BU_500
  BEFORE UPDATE
  ON COMMDIRECTIONEXPENCECLS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_CDECLS_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_CDECLS_BI_0
CREATE OR REPLACE TRIGGER TR_CommDirectionExpenceCls_BI
  BEFORE INSERT
  ON CommDirectionExpenceCls
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_CDECLS_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- BI_500 (TR_CDECLS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_CDECLS_BU_0
CREATE OR REPLACE TRIGGER TR_CommDirectionExpenceCls_BU
  BEFORE UPDATE
  ON CommDirectionExpenceCls
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_CDECLS_BU_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.DeleteDate is not null) then
    update KCSR set
    deletedate = :new.DeleteDate
    where (KCSR.DirectionExpence = :new.Code) and (KCSR.DeleteDate is null);
  END IF;

END;
/
-- CREATE TRIGGER TR_CDECLS_AD_500
CREATE OR REPLACE TRIGGER TR_CommDirectionExpenceCls_AD
  AFTER DELETE
  ON CommDirectionExpenceCls
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_CDECLS_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_CDECLS_AI_500
CREATE OR REPLACE TRIGGER TR_CommDirectionExpenceCls_AI
  AFTER INSERT
  ON CommDirectionExpenceCls
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_CDECLS_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 226) and (RecordId = :new.ID);

END;
/
ALTER TRIGGER TR_KCSR_BU_500 DISABLE
/
update KCSR SET
DirectionExpence = SUBSTR(code ,4 ,7)
/
ALTER TRIGGER TR_KCSR_BU_500 ENABLE
/
COMMIT WORK
/
-- ALTER TRIGGER tr_kcsr_bu_0
CREATE OR REPLACE TRIGGER TR_KCSR_BU
  BEFORE UPDATE
  ON KCSR
  FOR EACH ROW
DECLARE
  IsNumeric1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_KCSR_BU_0)
-- Version 9.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,IsNumeric1$);
    /* Пишем в ID код, если он числовой */
    if (IsNumeric1$ = 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;
  :new.DirectionExpence := SUBSTR(:new.code ,4 ,7);

END;
/
-- ALTER TRIGGER tr_kcsr_bi_0
CREATE OR REPLACE TRIGGER TR_KCSR_BI
  BEFORE INSERT
  ON KCSR
  FOR EACH ROW
DECLARE
  IsNumeric1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_KCSR_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if ((:new.Code is null) and (:new.id is null)) then
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if (:new.BudgetRef = 0) then
    /* Для всех бюджетов */
    /* Если код не указан, будем считать что он в ID, а иначе принудительно пишем в ID код */
    if (:new.Code is null) then
      :new.Code := :new.id;
          
    else
      IsNumericString(:new.Code,IsNumeric1$);
      /* Пишем в ID код, если он числовой */
      if (IsNumeric1$ = 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;  
    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;
  :new.DirectionExpence := SUBSTR(:new.code ,4 ,7);

-- - - - - - - - - - - - -
-- BI_500 (TR_KCSR_BI_500)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

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

END;
/
COMMIT WORK
/
grant SELECT, INSERT, UPDATE, DELETE on CommDirectionExpenceCls to BUDGET_USERS
/
COMMIT WORK
/
ALTER TABLE KCSR MODIFY(DirectionExpence NOT NULL)
/

-- #########################################################
-- #########################################################
-- drop_clsdiv_clsup_procs.sql
-- #########################################################
-- #########################################################

/* Удаление неиспользуемых процедур разбиения KVR, KCSR, TRANSFERTCLS */
drop procedure KVRUP 
/
drop procedure KCSRUP 
/
drop procedure TRANSFERTCLSUP 
/
commit work 
/
drop procedure KVRDIV 
/
drop procedure KCSRDIV 
/
drop procedure TRANSFERTCLSDIV 
/
commit work 
/

-- #########################################################
-- #########################################################
-- alter_tr_ffc_for_GISGMP.sql
-- #########################################################
-- #########################################################

/* при проверке, что документ отправлен электронно не должна учитываться отправка в ГИС ГМП с кодом формата 50*/
-- ALTER TRIGGER TR_FACIALFINCAPTION_BU_6
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;
--
  SourceFacialAcc_CLS$ NUMBER(10);
  DestFacialAcc_CLS$ NUMBER(10);
  IsReject$ NUMBER(10);
  UseFax1$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  DetCount1$ NUMBER(10);
  CNT$1 NUMBER(10);
  reestrAccepted1$ 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)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.Reject_CLS is null)and(new$Reject_CLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.Reject_CLS is not null)and(new$Reject_CLS 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 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
  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_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 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;
/
commit work 
/

-- #########################################################
-- #########################################################
-- Add_DFUChangeLog.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет таблицу DFUCHANGELOG, в которой хранится информация об импортированных скриптах DocFldUpdater'а */
CREATE TABLE DFUCHANGELOG (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  VersionID NUMBER(10) NOT NULL,
    CHECK((VersionID<=2147483647)AND(VersionID>-2147483648)),
  BEGINUPDATECODE NUMBER(10),
    CHECK((BEGINUPDATECODE<=2147483647)AND(BEGINUPDATECODE>-2147483648)),
  ENDUPDATECODE NUMBER(10),
    CHECK((ENDUPDATECODE<=2147483647)AND(ENDUPDATECODE>-2147483648)),
  LASTUPDATEDFU DATE,
  ISBUDGET NUMBER(10),
    CHECK((ISBUDGET<=2147483647)AND(ISBUDGET>-2147483648)),
  INCLUDEDEL NUMBER(10),
    CHECK((INCLUDEDEL<=2147483647)AND(INCLUDEDEL>-2147483648)),
  INCLUDEBLOCKS VARCHAR2(255),
  INCLUDEDOCS VARCHAR2(2000),
  SCRIPTCREATOR VARCHAR2(255),
  SCRIPTCREATEDATE DATE,
  NOTE VARCHAR2(255),
  CREATEDATE DATE NOT NULL,
  CREATERUSER VARCHAR2(30) NOT NULL
)
/
ALTER TABLE DFUCHANGELOG ADD (
  CONSTRAINT PK_DFUCHANGELOG PRIMARY KEY (ID)
)
/
-- CREATE TRIGGER TR_DFUCHANGELOG_BI
CREATE OR REPLACE TRIGGER TR_DFUCHANGELOG_BI
  BEFORE INSERT
  ON DFUCHANGELOG
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DFUCHANGELOG_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN 
    select g_shared.nextval into :new.ID from dual;
  END IF;

END;
/
-- CREATE TRIGGER TR_DFUCHANGELOG_BI_500
CREATE OR REPLACE TRIGGER TR_DFUCHANGELOG_BI
  BEFORE INSERT
  ON DFUCHANGELOG
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DFUCHANGELOG_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN 
    select g_shared.nextval into :new.ID from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DFUCHANGELOG_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

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

-- #########################################################
-- #########################################################
-- create_table_OKTMO.sql
-- #########################################################
-- #########################################################

CREATE TABLE OKTMO (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  CODE VARCHAR2(20) NOT NULL,
  CODE1 VARCHAR2(10) NOT NULL,
  CODE2 NUMBER(10) NOT NULL,
    CHECK((CODE2<=2147483647)AND(CODE2>-2147483648)),
  NAME VARCHAR2(1024) NOT NULL,
  NameOKTMO8 VARCHAR2(1024),
  NoteOKTMO8 VARCHAR2(255),
  RegionCLS NUMBER(10) NOT NULL,
    CHECK((RegionCLS<=2147483647)AND(RegionCLS>-2147483648)),
  StartDate DATE,
  DeleteDate DATE,
  CREATEDATE DATE NOT NULL,
  UPDATEDATE DATE NOT NULL,
  CREATERUSER VARCHAR2(30) NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL
)
/
COMMIT WORK 
/
ALTER TABLE OKTMO ADD (
  CONSTRAINT UQ_OKTMO_CODE UNIQUE(CODE) 
)
/
ALTER TABLE OKTMO ADD (
  CONSTRAINT PK_OKTMO_ID Primary Key(ID)
)
/
-- CREATE TRIGGER TR_OKTMO_BI_500
CREATE OR REPLACE TRIGGER TR_OKTMO_BI
  BEFORE INSERT
  ON OKTMO
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (TR_OKTMO_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_OKTMO_BU_500
CREATE OR REPLACE TRIGGER TR_OKTMO_BU_500
  BEFORE UPDATE
  ON OKTMO
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_OKTMO_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_OKTMO_BI_0
CREATE OR REPLACE TRIGGER TR_OKTMO_BI
  BEFORE INSERT
  ON OKTMO
  FOR EACH ROW
DECLARE
  c2$ VARCHAR2(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_OKTMO_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (:new.ID IS NULL) THEN
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.RegionCLS is null) then
    :new.RegionCLS := 0;
  END IF;
  if (:new.Code2 is null) then
    :new.Code2 := 0;
  END IF;
  if ((:new.NameOKTMO8 is null) and (:new.Code2 = 0)) then
    :new.NameOKTMO8 := :new.Name;
  END IF;
  if (:new.Code1 is null) then
    :new.Code1 := '00000000';
  END IF;
  if (LENGTH(:new.Code1) < 8) then
    while (LENGTH(:new.Code1) < 8) LOOP
      :new.code1 := '0' || :new.Code1;
    END LOOP;
  END IF;
  c2$ := :new.Code2;
  while (LENGTH(c2$) < 3) LOOP
    c2$ := '0' || c2$;
  END LOOP;
  :new.Code := :new.Code1 || c2$;

-- - - - - - - - - - - - -
-- BI_500 (TR_OKTMO_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_OKTMO_BU_0
CREATE OR REPLACE TRIGGER TR_OKTMO_BU
  BEFORE UPDATE
  ON OKTMO
  FOR EACH ROW
DECLARE
  c2$ VARCHAR2(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_OKTMO_BU_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.RegionCLS is null) then
    :new.RegionCLS := 0;
  END IF;
  if (:new.Code2 is null) then
    :new.Code2 := 0;
  END IF;
  if ((:new.NameOKTMO8 is null) and (:new.Code2 = 0)) then
    :new.NameOKTMO8 := :new.Name;
  END IF;
  if (:new.Code1 is null) then
    :new.Code1 := '00000000';
  END IF;
  if (LENGTH(:new.Code1) < 8) then
    while (LENGTH(:new.Code1) < 8) LOOP
      :new.code1 := '0' || :new.Code1;
    END LOOP;
  END IF;
  c2$ := :new.Code2;
  while (LENGTH(c2$) < 3) LOOP
    c2$ := '0' || c2$;
  END LOOP;
  :new.Code := :new.Code1 || c2$;

END;
/
-- CREATE TRIGGER TR_OKTMO_AD_500
CREATE OR REPLACE TRIGGER TR_OKTMO_AD
  AFTER DELETE
  ON OKTMO
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_OKTMO_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_OKTMO_AI_500
CREATE OR REPLACE TRIGGER TR_OKTMO_AI
  AFTER INSERT
  ON OKTMO
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_OKTMO_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 227) and (RecordId = :new.ID);

END;
/
COMMIT WORK
/
ALTER TABLE TB_ORGANIZATIONS ADD (
  OKTMO NUMBER(10),
    CHECK((OKTMO<=2147483647)AND(OKTMO>-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)
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
  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;
--
  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)
-- Last update 14.02.2006
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  new$CreaterUser := USER;
  new$UpdaterUser := USER;
  addDateConst(-1, 17, new$CreateDate, '');

-- - - - - - - - - - - - -
-- 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;
/

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;
--
  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
  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;
/
ALTER TABLE TB_INCOMES32 ADD (
  OKTMO NUMBER(10),
    CHECK((OKTMO<=2147483647)AND(OKTMO>-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)
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
  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_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)
-- Create 15.09.2005
-- - - - - - - - - - - - -

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

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;
--
  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)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- 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
  ) 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);

-- - - - - - - - - - - - -
-- 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;
--
  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
  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_CORRECTIONDETAIL ADD (
  OKTMO NUMBER(10),
    CHECK((OKTMO<=2147483647)AND(OKTMO>-2147483648))
)
/

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)
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
  FROM TB_CORRECTIONDETAIL
/

CREATE OR REPLACE TRIGGER TR_CORRECTIONDETAIL_ID
  INSTEAD OF DELETE
  ON CORRECTIONDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_CORRECTIONDETAIL
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AD_500 (TR_CORRECTIONDETAIL_AD_500)
-- Create 29.12.2009
-- - - - - - - - - - - - -

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

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;
--
  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)
-- Create 13.08.2007
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- 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
  ) 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);

-- - - - - - - - - - - - -
-- 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;
--
  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
  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;
/
COMMIT WORK
/
ALTER TABLE TB_ORGANIZATIONS ADD (
  CONSTRAINT ORG_FK_OKTMO FOREIGN KEY(OKTMO) REFERENCES OKTMO (ID) 
)
/
CREATE INDEX ORG_FK_OKTMO ON TB_ORGANIZATIONS(OKTMO)
/
ALTER TABLE TB_INCOMES32 ADD (
  CONSTRAINT FK_INCOMES32_OKTMO FOREIGN KEY(OKTMO) REFERENCES OKTMO (ID) 
)
/
CREATE INDEX FK_INCOMES32_OKTMO ON TB_INCOMES32(OKTMO)
/
ALTER TABLE TB_CORRECTIONDETAIL ADD (
  CONSTRAINT FK_CORDETAIL_OKTMO FOREIGN KEY(OKTMO) REFERENCES OKTMO (ID) 
)
/
CREATE INDEX FK_CORDETAIL_OKTMO ON TB_CORRECTIONDETAIL(OKTMO)
/
COMMIT WORK
/
grant SELECT, INSERT, UPDATE, DELETE on OKTMO  to BUDGET_USERS
/


-- #########################################################
-- #########################################################
-- Drop_UK_Cards_Index_ora.sql
-- #########################################################
-- #########################################################


/* <TRANS_COMMAND>
ALTER TABLE CARDS DROP CONSTRAINT UK_CARDS_CARDNUMBER
/
DROP INDEX UK_CARDS_CARDNUMBER
/
*/
-- <TRANS_IGNORE>
DECLARE
  v_exists INTEGER;
BEGIN
  SELECT count(*)
  INTO v_exists
  FROM user_indexes
  WHERE INDEX_NAME = 'UK_CARDS_CARDNUMBER';
  IF (v_exists <> 0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE CARDS DROP CONSTRAINT UK_CARDS_CARDNUMBER';
    EXECUTE IMMEDIATE 'COMMIT WORK';
  END IF;
  SELECT count(*)
  INTO v_exists
  FROM user_indexes
  WHERE INDEX_NAME = 'UK_CARDS_CARDNUMBER';
  IF (v_exists <> 0) THEN
    EXECUTE IMMEDIATE 'DROP INDEX UK_CARDS_CARDNUMBER';
  END IF;  
END;
/

/* <TRANS_COMMAND>
ALTER TABLE CARDS DROP CONSTRAINT UK_CARDS_CARDFULLNUMBER
/
DROP INDEX UK_CARDS_CARDFULLNUMBER
/
*/
-- <TRANS_IGNORE>
DECLARE
  v_exists INTEGER;
BEGIN
  SELECT count(*)
  INTO v_exists
  FROM user_indexes
  WHERE INDEX_NAME = 'UK_CARDS_CARDFULLNUMBER';
  IF (v_exists <> 0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE CARDS DROP CONSTRAINT UK_CARDS_CARDFULLNUMBER';
    EXECUTE IMMEDIATE 'COMMIT WORK';
  END IF;
  SELECT count(*)
  INTO v_exists
  FROM user_indexes
  WHERE INDEX_NAME = 'UK_CARDS_CARDFULLNUMBER';
  IF (v_exists <> 0) THEN
    EXECUTE IMMEDIATE 'DROP INDEX UK_CARDS_CARDFULLNUMBER';
  END IF;  
END;
/

commit work
/



-- #########################################################
-- #########################################################
-- Alter_Agreement_Note.sql
-- #########################################################
-- #########################################################

ALTER TRIGGER TR_AGREEMENTS_BU_500 DISABLE
/
/* РќСѓР¶РЅРѕ РїРѕС‡РёСЃС‚РёС‚СЊ РЅРµРєРѕСЂСЂРµРєС‚РЅС‹Рµ СЃСЃС‹Р»РєРё. */
update Agreements set
  executeraccref = null
where
  id in (
        select a.id
        from agreements a join
             Org_Accounts oa on a.executeraccref = oa.id
        where
          oa.org_ref <> a.executer_ref
    )
 
/
commit work 
/
ALTER TABLE TB_Agreements ADD (
  TempNote VARCHAR2(1024)
)
/

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,
  NOTE,
  FACT,
  REGION,
  CLOSEDATE,
  DELIVERYRULES,
  AGREEMENTSUMMA,
  AGREEMENTFINSUMMA,
  ADJUSTMENTREF,
  REESTRNUMBER,
  PAYMENTDATE,
  AGREEMENTCARDADVANCE,
  FINCARDADVANCE,
  STATEORDERREF,
  REJECTCLS,
  REJECTCAUSE,
  CRYPTOSTATUS,
  SENDERID,
  SENDERRECORDID,
  AGREEMENTBEGINDATE,
  PROTOCOLNUMBER,
  PROTOCOLDATE,
  REVIEWNOTE,
  DOCSTATEREF,
  RVERSION,
  EXPORTDATE,
  PURPORTDOC,
  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,
  TEMPNOTE)
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,
    NOTE,
    FACT,
    REGION,
    CLOSEDATE,
    DELIVERYRULES,
    AGREEMENTSUMMA,
    AGREEMENTFINSUMMA,
    ADJUSTMENTREF,
    REESTRNUMBER,
    PAYMENTDATE,
    AGREEMENTCARDADVANCE,
    FINCARDADVANCE,
    STATEORDERREF,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    AGREEMENTBEGINDATE,
    PROTOCOLNUMBER,
    PROTOCOLDATE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXPORTDATE,
    PURPORTDOC,
    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,
    TEMPNOTE
  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;

-- - - - - - - - - - - - -
-- 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_20 (TR_AGREEMENTS_AD_20)
-- Version 8.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;

-- - - - - - - - - - - - -
-- 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$NOTE AGREEMENTS.NOTE%TYPE := :NEW.NOTE;
  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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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$TEMPNOTE AGREEMENTS.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
--
  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,
    NOTE,
    FACT,
    REGION,
    CLOSEDATE,
    DELIVERYRULES,
    AGREEMENTSUMMA,
    AGREEMENTFINSUMMA,
    ADJUSTMENTREF,
    REESTRNUMBER,
    PAYMENTDATE,
    AGREEMENTCARDADVANCE,
    FINCARDADVANCE,
    STATEORDERREF,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    AGREEMENTBEGINDATE,
    PROTOCOLNUMBER,
    PROTOCOLDATE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXPORTDATE,
    PURPORTDOC,
    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,
    TEMPNOTE
  ) 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$NOTE,
    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$PURPORTDOC,
    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$TEMPNOTE);

-- - - - - - - - - - - - -
-- 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$NOTE AGREEMENTS.NOTE%TYPE := :NEW.NOTE;
  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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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$TEMPNOTE AGREEMENTS.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
--
  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,
    NOTE = new$NOTE,
    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,
    PURPORTDOC = new$PURPORTDOC,
    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,
    TEMPNOTE = new$TEMPNOTE
  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 
/
update Agreements set
  TempNote = Note
/
ALTER TABLE TB_Agreements DROP (Note)
/

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,
  PURPORTDOC,
  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,
  TEMPNOTE)
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,
    PURPORTDOC,
    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,
    TEMPNOTE
  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;

-- - - - - - - - - - - - -
-- 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_20 (TR_AGREEMENTS_AD_20)
-- Version 8.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;

-- - - - - - - - - - - - -
-- 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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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$TEMPNOTE AGREEMENTS.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
--
  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,
    PURPORTDOC,
    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,
    TEMPNOTE
  ) 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$PURPORTDOC,
    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$TEMPNOTE);

-- - - - - - - - - - - - -
-- 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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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$TEMPNOTE AGREEMENTS.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
--
  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,
    PURPORTDOC = new$PURPORTDOC,
    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,
    TEMPNOTE = new$TEMPNOTE
  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 TABLE TB_Agreements ADD (
  Note VARCHAR2(1024)
)
/

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,
  PURPORTDOC,
  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,
  TEMPNOTE,
  NOTE)
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,
    PURPORTDOC,
    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,
    TEMPNOTE,
    NOTE
  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;

-- - - - - - - - - - - - -
-- 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_20 (TR_AGREEMENTS_AD_20)
-- Version 8.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;

-- - - - - - - - - - - - -
-- 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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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$TEMPNOTE AGREEMENTS.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
  new$NOTE AGREEMENTS.NOTE%TYPE := :NEW.NOTE;
--
  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,
    PURPORTDOC,
    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,
    TEMPNOTE,
    NOTE
  ) 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$PURPORTDOC,
    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$TEMPNOTE,
    new$NOTE);

-- - - - - - - - - - - - -
-- 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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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$TEMPNOTE AGREEMENTS.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
  new$NOTE AGREEMENTS.NOTE%TYPE := :NEW.NOTE;
--
  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,
    PURPORTDOC = new$PURPORTDOC,
    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,
    TEMPNOTE = new$TEMPNOTE,
    NOTE = new$NOTE
  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;
/
update Agreements set
  Note = TempNote
/
commit work 
/
ALTER TABLE TB_Agreements DROP (TempNote)
/

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,
  PURPORTDOC,
  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)
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,
    PURPORTDOC,
    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
  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;

-- - - - - - - - - - - - -
-- 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_20 (TR_AGREEMENTS_AD_20)
-- Version 8.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;

-- - - - - - - - - - - - -
-- 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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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;
--
  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,
    PURPORTDOC,
    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
  ) 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$PURPORTDOC,
    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);

-- - - - - - - - - - - - -
-- 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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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;
--
  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,
    PURPORTDOC = new$PURPORTDOC,
    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
  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 TABLE TB_Agreements ADD (
  TempPurportDoc VARCHAR2(1024)
)
/

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,
  PURPORTDOC,
  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,
  TEMPPURPORTDOC)
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,
    PURPORTDOC,
    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,
    TEMPPURPORTDOC
  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;

-- - - - - - - - - - - - -
-- 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_20 (TR_AGREEMENTS_AD_20)
-- Version 8.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;

-- - - - - - - - - - - - -
-- 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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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$TEMPPURPORTDOC AGREEMENTS.TEMPPURPORTDOC%TYPE := :NEW.TEMPPURPORTDOC;
--
  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,
    PURPORTDOC,
    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,
    TEMPPURPORTDOC
  ) 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$PURPORTDOC,
    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$TEMPPURPORTDOC);

-- - - - - - - - - - - - -
-- 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$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
  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$TEMPPURPORTDOC AGREEMENTS.TEMPPURPORTDOC%TYPE := :NEW.TEMPPURPORTDOC;
--
  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,
    PURPORTDOC = new$PURPORTDOC,
    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,
    TEMPPURPORTDOC = new$TEMPPURPORTDOC
  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 
/
update Agreements set
  TempPurportDoc = PurportDoc
/
ALTER TABLE TB_Agreements DROP (PurportDoc)
/

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,
  TEMPPURPORTDOC)
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,
    TEMPPURPORTDOC
  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;

-- - - - - - - - - - - - -
-- 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_20 (TR_AGREEMENTS_AD_20)
-- Version 8.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;

-- - - - - - - - - - - - -
-- 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$TEMPPURPORTDOC AGREEMENTS.TEMPPURPORTDOC%TYPE := :NEW.TEMPPURPORTDOC;
--
  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,
    TEMPPURPORTDOC
  ) 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$TEMPPURPORTDOC);

-- - - - - - - - - - - - -
-- 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$TEMPPURPORTDOC AGREEMENTS.TEMPPURPORTDOC%TYPE := :NEW.TEMPPURPORTDOC;
--
  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,
    TEMPPURPORTDOC = new$TEMPPURPORTDOC
  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 TABLE TB_Agreements ADD (
  PurportDoc VARCHAR2(1024)
)
/

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,
  TEMPPURPORTDOC,
  PURPORTDOC)
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,
    TEMPPURPORTDOC,
    PURPORTDOC
  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;

-- - - - - - - - - - - - -
-- 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_20 (TR_AGREEMENTS_AD_20)
-- Version 8.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;

-- - - - - - - - - - - - -
-- 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$TEMPPURPORTDOC AGREEMENTS.TEMPPURPORTDOC%TYPE := :NEW.TEMPPURPORTDOC;
  new$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
--
  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,
    TEMPPURPORTDOC,
    PURPORTDOC
  ) 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$TEMPPURPORTDOC,
    new$PURPORTDOC);

-- - - - - - - - - - - - -
-- 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$TEMPPURPORTDOC AGREEMENTS.TEMPPURPORTDOC%TYPE := :NEW.TEMPPURPORTDOC;
  new$PURPORTDOC AGREEMENTS.PURPORTDOC%TYPE := :NEW.PURPORTDOC;
--
  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,
    TEMPPURPORTDOC = new$TEMPPURPORTDOC,
    PURPORTDOC = new$PURPORTDOC
  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;
/
update Agreements set
  PurportDoc = TempPurportDoc
/
commit work 
/
ALTER TABLE TB_Agreements DROP (TempPurportDoc)
/

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)
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
  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;

-- - - - - - - - - - - - -
-- 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_20 (TR_AGREEMENTS_AD_20)
-- Version 8.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;

-- - - - - - - - - - - - -
-- 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;
--
  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
  ) 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);

-- - - - - - - - - - - - -
-- 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;
--
  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
  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 TRIGGER TR_EXECDOCCAPTION_BU_500 DISABLE
/
ALTER TABLE TB_ExecutionDocumentsCaption ADD (
  TempNote VARCHAR2(1024)
)
/

CREATE OR REPLACE VIEW ExecutionDocumentsCaption (
  ID,
  DOCTYPE,
  DOCUMENTDATE,
  ACCEPTDATE,
  SUPPLIERACC_REF,
  SUMMA,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  BUDGETREF,
  STEPNUMBER,
  FACIALACC_CLS,
  RECIPIENT_REF,
  REGISTRATIONTYPE,
  REESTRNUMBER,
  AGREEMENTINNERNUMBER,
  REJECTCLS,
  REJECTCAUSE,
  CRYPTOSTATUS,
  SENDERID,
  SENDERRECORDID,
  NOTE,
  REVIEWNOTE,
  DOCSTATEREF,
  RVERSION,
  EXECDOCFINSUMMA,
  FACT,
  DOCNUMBER,
  SENDERIDKEY,
  SENDERRECORDIDKEY,
  REALID,
  INNERNUMBER,
  ADJUSTMENTREF,
  ADJUSTMENTNUMBER,
  ACCEPTED,
  LASTACCEPTED,
  LASTADJUSTMENT,
  AGREEMENTREF,
  TEMPNOTE)
AS
  SELECT
    ID,
    DOCTYPE,
    DOCUMENTDATE,
    ACCEPTDATE,
    SUPPLIERACC_REF,
    SUMMA,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    STEPNUMBER,
    FACIALACC_CLS,
    RECIPIENT_REF,
    REGISTRATIONTYPE,
    REESTRNUMBER,
    AGREEMENTINNERNUMBER,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    NOTE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXECDOCFINSUMMA,
    FACT,
    DOCNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REALID,
    INNERNUMBER,
    ADJUSTMENTREF,
    ADJUSTMENTNUMBER,
    ACCEPTED,
    LASTACCEPTED,
    LASTADJUSTMENT,
    AGREEMENTREF,
    TEMPNOTE
  FROM TB_ExecutionDocumentsCaption
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_ID
  INSTEAD OF DELETE
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  quant$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_DOCEXECCAPTION_BD)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  select count(ID)   into quant$ from executiondocumentscaption 
  where AdjustmentRef = :old.ID
  ;
  if (quant$  = 0) then
    delete from ExecutionDocumentsDetail where (RecordIndex = :old.ID);
    delete from paymentschedule where (ExecutionRef = :old.ID)and(ProgIndex=308);
      
  else
    RaiseException('ex_agr_cantdeladjustmented');
  END IF;

-- - - - - - - - - - - - -
-- BD_10 (TR_DocExecCaption_BD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

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

-- - - - - - - - - - - - -
-- AD_10 (TR_ExecDocCaption_AD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_200 (TR_EXECDOCCAPTION_AD_200)
-- Create 04.10.2004
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_500 (TR_EXECDOCCAPTION_AD_500)
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_II
  INSTEAD OF INSERT
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  new$ID EXECUTIONDOCUMENTSCAPTION.ID%TYPE := :NEW.ID;
  new$DOCTYPE EXECUTIONDOCUMENTSCAPTION.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$DOCUMENTDATE EXECUTIONDOCUMENTSCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE EXECUTIONDOCUMENTSCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SUPPLIERACC_REF EXECUTIONDOCUMENTSCAPTION.SUPPLIERACC_REF%TYPE := :NEW.SUPPLIERACC_REF;
  new$SUMMA EXECUTIONDOCUMENTSCAPTION.SUMMA%TYPE := :NEW.SUMMA;
  new$CREATERUSER EXECUTIONDOCUMENTSCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE EXECUTIONDOCUMENTSCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE EXECUTIONDOCUMENTSCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER EXECUTIONDOCUMENTSCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF EXECUTIONDOCUMENTSCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$STEPNUMBER EXECUTIONDOCUMENTSCAPTION.STEPNUMBER%TYPE := :NEW.STEPNUMBER;
  new$FACIALACC_CLS EXECUTIONDOCUMENTSCAPTION.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$RECIPIENT_REF EXECUTIONDOCUMENTSCAPTION.RECIPIENT_REF%TYPE := :NEW.RECIPIENT_REF;
  new$REGISTRATIONTYPE EXECUTIONDOCUMENTSCAPTION.REGISTRATIONTYPE%TYPE := :NEW.REGISTRATIONTYPE;
  new$REESTRNUMBER EXECUTIONDOCUMENTSCAPTION.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$AGREEMENTINNERNUMBER EXECUTIONDOCUMENTSCAPTION.AGREEMENTINNERNUMBER%TYPE := :NEW.AGREEMENTINNERNUMBER;
  new$REJECTCLS EXECUTIONDOCUMENTSCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE EXECUTIONDOCUMENTSCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS EXECUTIONDOCUMENTSCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID EXECUTIONDOCUMENTSCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID EXECUTIONDOCUMENTSCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$NOTE EXECUTIONDOCUMENTSCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$REVIEWNOTE EXECUTIONDOCUMENTSCAPTION.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF EXECUTIONDOCUMENTSCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION EXECUTIONDOCUMENTSCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$EXECDOCFINSUMMA EXECUTIONDOCUMENTSCAPTION.EXECDOCFINSUMMA%TYPE := :NEW.EXECDOCFINSUMMA;
  new$FACT EXECUTIONDOCUMENTSCAPTION.FACT%TYPE := :NEW.FACT;
  new$DOCNUMBER EXECUTIONDOCUMENTSCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SENDERIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REALID EXECUTIONDOCUMENTSCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER EXECUTIONDOCUMENTSCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTREF EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ADJUSTMENTNUMBER EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$ACCEPTED EXECUTIONDOCUMENTSCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED EXECUTIONDOCUMENTSCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$LASTADJUSTMENT EXECUTIONDOCUMENTSCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$AGREEMENTREF EXECUTIONDOCUMENTSCAPTION.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$TEMPNOTE EXECUTIONDOCUMENTSCAPTION.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  AdjDocNum$ VARCHAR2(50);
  agr_accepted$ NUMBER(10);
  agr_acceptdate$ NUMBER(10);
  PreviousInner$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_EXECDOCCAPTION_BI)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$ExecDocFinSumma is null) then 
    new$ExecDocFinSumma := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$RegistrationType is null) then 
    new$RegistrationType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  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;
  /* если это первая версия, то генерим новый номер цепочки, иначе подтягиваем из уточняемой записи */
  if (new$AdjustmentRef is null) then
    new$InnerNumber := GEN_ID('g_ExecDocNumber',1);
      
  else
    BEGIN
      /* уточняемая запись должна быть принятой и последней в цепочке */
      select
      InnerNumber 
      into PreviousInner$     from ExecutionDocumentsCaption
      where ID = new$AdjustmentRef and LastAccepted = 1 and LastAdjustment = 1
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (PreviousInner$ is null) then
      RaiseException('EX_ExecDoc_NotFindInner');
    END IF;
    new$InnerNumber := PreviousInner$;
      
  END IF;
  /* заполняем внутренний номер договора по id */  
  new$agreementinnernumber := null;
  if (new$agreementref is not null) then
    BEGIN
      select
      innernumber
      into new$agreementinnernumber     from agreements
      where
      id = new$agreementref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_EXECDOCCAPTION_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_EXECDOCCAPTION_BI_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Проверка указания внутренних номеров.*/
  if (new$InnerNumber is null) then
    RaiseException('EX_AGR_InnerNumsIsNull');
  END IF;

  /* Получение внутреннего номера уточнения*/
  select max(AdjustmentNumber)
  into Tmp$     from ExecutionDocumentsCaption
  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$AdjustmentRef is not null) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID), max(DocNumber)
    into Tmp$, AdjID$, AdjDocNum$       from ExecutionDocumentsCaption
    where (InnerNumber = new$InnerNumber) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/
    if (Tmp$ <> 1) then
      RaiseException('EX_ExecDoc_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID)
    into Tmp$       from ExecutionDocumentsCaption
    where (InnerNumber = new$InnerNumber) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then
      RaiseException('EX_ExecDoc_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/      
    new$AdjustmentRef := AdjID$;
        
  else /* Если ДИ не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/      
    new$AdjustmentRef := null;
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (tr_execdoccaption_bi_40)
-- Version 7.00.01.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_60 (tr_execdoccaption_bi_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$agreementinnernumber is not null) then
    BEGIN
      /* выбираем информацию о принятии из первой версии договора, т.к. вся
          цепочка договоров будет отклонена, если отклонена первая версия, и в цепочке
          будет принятый договор, если принята первая версия */
      select accepted, acceptdate     into
      agr_accepted$, agr_acceptdate$ from agreements
      where
      innernumber = new$agreementinnernumber and adjustmentnumber = 0
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* если в неотклоненном документе указан отклоненный договор */
    if (new$acceptdate is null and agr_accepted$ = 0 and agr_acceptdate$ is not null) then
      RaiseException('EX_Agr_Rejected');
    END IF;
    /* если принятый документ ссылается на непринятый договор */
    if (new$accepted = 1 and new$acceptdate is not null and
    (agr_accepted$ = 0 or agr_acceptdate$ is null)) then
      RaiseException('EX_Agr_NotAccepted');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_EXECDOCCAPTION_BI_500)
-- Last update 08.12.2005
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_EXECUTIONDOCUMENTSCAPTION (
    ID,
    DOCTYPE,
    DOCUMENTDATE,
    ACCEPTDATE,
    SUPPLIERACC_REF,
    SUMMA,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    STEPNUMBER,
    FACIALACC_CLS,
    RECIPIENT_REF,
    REGISTRATIONTYPE,
    REESTRNUMBER,
    AGREEMENTINNERNUMBER,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    NOTE,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXECDOCFINSUMMA,
    FACT,
    DOCNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REALID,
    INNERNUMBER,
    ADJUSTMENTREF,
    ADJUSTMENTNUMBER,
    ACCEPTED,
    LASTACCEPTED,
    LASTADJUSTMENT,
    AGREEMENTREF,
    TEMPNOTE
  ) VALUES (
    new$ID,
    new$DOCTYPE,
    new$DOCUMENTDATE,
    new$ACCEPTDATE,
    new$SUPPLIERACC_REF,
    new$SUMMA,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$STEPNUMBER,
    new$FACIALACC_CLS,
    new$RECIPIENT_REF,
    new$REGISTRATIONTYPE,
    new$REESTRNUMBER,
    new$AGREEMENTINNERNUMBER,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$NOTE,
    new$REVIEWNOTE,
    new$DOCSTATEREF,
    new$RVERSION,
    new$EXECDOCFINSUMMA,
    new$FACT,
    new$DOCNUMBER,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$REALID,
    new$INNERNUMBER,
    new$ADJUSTMENTREF,
    new$ADJUSTMENTNUMBER,
    new$ACCEPTED,
    new$LASTACCEPTED,
    new$LASTADJUSTMENT,
    new$AGREEMENTREF,
    new$TEMPNOTE);

-- - - - - - - - - - - - -
-- AI_0 (TR_ExecDocCaption_AI)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Коррекция вспомогательных флагов в уточняемой записи ДИ*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentRef is not null) and (new$LastAdjustment = 1)) then
    update ExecutionDocuMENTSCaption set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);        
    if (new$LastAccepted = 1) then
      update ExecutionDocuMENTSCaption set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_EXECDOCCAPTION_AI_500)
-- - - - - - - - - - - - -

-- 25.08.2004
  delete from DelRecIndexes where (TableID = 114) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_IU
  INSTEAD OF UPDATE
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  new$ID EXECUTIONDOCUMENTSCAPTION.ID%TYPE := :NEW.ID;
  new$DOCTYPE EXECUTIONDOCUMENTSCAPTION.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$DOCUMENTDATE EXECUTIONDOCUMENTSCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE EXECUTIONDOCUMENTSCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SUPPLIERACC_REF EXECUTIONDOCUMENTSCAPTION.SUPPLIERACC_REF%TYPE := :NEW.SUPPLIERACC_REF;
  new$SUMMA EXECUTIONDOCUMENTSCAPTION.SUMMA%TYPE := :NEW.SUMMA;
  new$CREATERUSER EXECUTIONDOCUMENTSCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE EXECUTIONDOCUMENTSCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE EXECUTIONDOCUMENTSCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER EXECUTIONDOCUMENTSCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF EXECUTIONDOCUMENTSCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$STEPNUMBER EXECUTIONDOCUMENTSCAPTION.STEPNUMBER%TYPE := :NEW.STEPNUMBER;
  new$FACIALACC_CLS EXECUTIONDOCUMENTSCAPTION.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$RECIPIENT_REF EXECUTIONDOCUMENTSCAPTION.RECIPIENT_REF%TYPE := :NEW.RECIPIENT_REF;
  new$REGISTRATIONTYPE EXECUTIONDOCUMENTSCAPTION.REGISTRATIONTYPE%TYPE := :NEW.REGISTRATIONTYPE;
  new$REESTRNUMBER EXECUTIONDOCUMENTSCAPTION.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$AGREEMENTINNERNUMBER EXECUTIONDOCUMENTSCAPTION.AGREEMENTINNERNUMBER%TYPE := :NEW.AGREEMENTINNERNUMBER;
  new$REJECTCLS EXECUTIONDOCUMENTSCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE EXECUTIONDOCUMENTSCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS EXECUTIONDOCUMENTSCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID EXECUTIONDOCUMENTSCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID EXECUTIONDOCUMENTSCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$NOTE EXECUTIONDOCUMENTSCAPTION.NOTE%TYPE := :NEW.NOTE;
  new$REVIEWNOTE EXECUTIONDOCUMENTSCAPTION.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF EXECUTIONDOCUMENTSCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION EXECUTIONDOCUMENTSCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$EXECDOCFINSUMMA EXECUTIONDOCUMENTSCAPTION.EXECDOCFINSUMMA%TYPE := :NEW.EXECDOCFINSUMMA;
  new$FACT EXECUTIONDOCUMENTSCAPTION.FACT%TYPE := :NEW.FACT;
  new$DOCNUMBER EXECUTIONDOCUMENTSCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SENDERIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REALID EXECUTIONDOCUMENTSCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER EXECUTIONDOCUMENTSCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTREF EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ADJUSTMENTNUMBER EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$ACCEPTED EXECUTIONDOCUMENTSCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED EXECUTIONDOCUMENTSCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$LASTADJUSTMENT EXECUTIONDOCUMENTSCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$AGREEMENTREF EXECUTIONDOCUMENTSCAPTION.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$TEMPNOTE EXECUTIONDOCUMENTSCAPTION.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
--
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  CntAgr$ NUMBER(10);
  CntStep$ NUMBER(10);
  agr_accepted$ NUMBER(10);
  agr_acceptdate$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_EXECDOCCAPTION_BU)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$ExecDocFinSumma is null) then 
    new$ExecDocFinSumma := 0;  
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$RegistrationType is null) then 
    new$RegistrationType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 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 CNT$1
      from ExecutionDocumentsDetail
      where 
      (                   RecordIndex = :old.Id
      ) AND (ROWNUM = 1)                ;
      if ((CNT$1<> 0)         ) then
        RaiseException('Ex_CantModufyBudget');
      END IF;
      SELECT COUNT(                   Id
      ) INTO CNT$2
      from PaymentSchedule
      where
      (                   ExecutionRef = :old.Id
      ) AND (ROWNUM = 1)                ;
      if ((CNT$2<> 0)         ) then
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* если номер цепочки не заполнен, то берем его из предыдущей версии записи */
  if (new$InnerNumber is null) then
    new$InnerNumber := :old.InnerNumber;
  END IF;
  /* cледим, чтобы никто не поменял внутреннюю нумерацию и ссылку на предыдущую */
  /* версию, иначе все накернится */
  if (new$InnerNumber <> :old.InnerNumber or
  new$AdjustmentRef <> :old.AdjustmentRef or
  new$AdjustmentNumber <> :old.AdjustmentNumber) then
    RaiseException('EX_Agr_ChangeInnerNums');
  END IF;
  /* заполняем внутренний номер договора по id */  
  new$agreementinnernumber := null;
  if (new$agreementref is not null) then
    BEGIN
      select
      innernumber
      into new$agreementinnernumber     from agreements
      where
      id = new$agreementref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_EXECDOCCAPTION_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_EXECDOCCAPTION_BU_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* отменять отклонение ДИ нельзя */
  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) then 
    /* менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (:old.LastAdjustment = 1) then
      new$LastAccepted := 1;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');
    END IF;
  END IF;
      
  /* если отменили принятие ДИ, тогда необходимо снять флаг LastAccepted*/
  if (:old.AcceptDate is not null and :old.Accepted = 1 and new$AcceptDate is null) then
    /* менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (:old.LastAdjustment = 1) then
      new$LastAccepted := 0;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');  
    END IF;
  END IF;
      
  /* если отклонили ДИ, тогда необходимо скинуть флаги LastAdjustment и LastAccepted */
  if (new$AcceptDate is not null and new$Accepted = 0 and (:old.AcceptDate is null or :old.Accepted = 1)) then
    if (:old.LastAdjustment = 1) then
      new$LastAdjustment := 0;
      new$LastAccepted := 0;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');
    END IF;
    SELECT COUNT(                 Id
    ) INTO CNT$1
    from ExecutionDocumentsCaption
    where
    (                 InnerNumber = new$InnerNumber and AdjustmentNumber > 0
    ) AND (ROWNUM = 1)              ;
    /* нельзя отклонять первую версию в цепочке при наличии уточнений */
    if (new$AdjustmentNumber = 0 and 
    (CNT$1<> 0)       ) then
      RaiseException('EX_ExecDoc_PrimaryAgrHasNotify');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_40 (tr_execdoccaption_bu_40)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  if ((:old.AcceptDate is not null) and (new$AcceptDate is null)) then
    select count(ID) into CntAgr$ from Agreements where (CloseDoc = :old.ID) ;
    select count(ID) into CntStep$ from AgreementSteps where (CloseDoc = :old.ID) ;
    if ((CntAgr$ > 0) or (CntStep$ > 0)) then
      RaiseException('ex_CannotUpdateCloseDoc');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_60 (tr_execdoccaption_bu_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$agreementinnernumber is not null) then
    BEGIN
      /* выбираем информацию о принятии из первой версии договора, т.к. вся
          цепочка договоров будет отклонена, если отклонена первая версия, и в цепочке
          будет принятый договор, если принята первая версия */
      select accepted, acceptdate     into
      agr_accepted$, agr_acceptdate$ from agreements
      where
      innernumber = new$agreementinnernumber and adjustmentnumber = 0
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* если в неотклоненном документе указан отклоненный договор */
    if (new$acceptdate is null and agr_accepted$ = 0 and agr_acceptdate$ is not null) then
      RaiseException('EX_Agr_Rejected');
    END IF;
    /* если принятый документ ссылается на непринятый договор */
    if (new$accepted = 1 and new$acceptdate is not null and
    (agr_accepted$ = 0 or agr_acceptdate$ is null)) then
      RaiseException('EX_Agr_NotAccepted');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_EXECDOCCAPTION_BU_200)
-- Create 04.10.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_EDCAPTION_BU_700)
-- Create 14.10.2004
-- - - - - - - - - - - - -

   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_EXECUTIONDOCUMENTSCAPTION SET
    ID = new$ID,
    DOCTYPE = new$DOCTYPE,
    DOCUMENTDATE = new$DOCUMENTDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    SUPPLIERACC_REF = new$SUPPLIERACC_REF,
    SUMMA = new$SUMMA,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    STEPNUMBER = new$STEPNUMBER,
    FACIALACC_CLS = new$FACIALACC_CLS,
    RECIPIENT_REF = new$RECIPIENT_REF,
    REGISTRATIONTYPE = new$REGISTRATIONTYPE,
    REESTRNUMBER = new$REESTRNUMBER,
    AGREEMENTINNERNUMBER = new$AGREEMENTINNERNUMBER,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    NOTE = new$NOTE,
    REVIEWNOTE = new$REVIEWNOTE,
    DOCSTATEREF = new$DOCSTATEREF,
    RVERSION = new$RVERSION,
    EXECDOCFINSUMMA = new$EXECDOCFINSUMMA,
    FACT = new$FACT,
    DOCNUMBER = new$DOCNUMBER,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    REALID = new$REALID,
    INNERNUMBER = new$INNERNUMBER,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    ACCEPTED = new$ACCEPTED,
    LASTACCEPTED = new$LASTACCEPTED,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    AGREEMENTREF = new$AGREEMENTREF,
    TEMPNOTE = new$TEMPNOTE
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_0 (TR_ExecDocCaption_AU)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AU_30 (TR_EXECDOCCAPTION_AU_30)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if ((new$DocStateRef is null) 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 ExecutionRef=new$ID;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_EXECDOCCAPTION_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

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

END;
/
commit work 
/
update ExecutionDocumentsCaption set
  TempNote = Note
/
ALTER TABLE TB_ExecutionDocumentsCaption DROP (Note)
/

CREATE OR REPLACE VIEW ExecutionDocumentsCaption (
  ID,
  DOCTYPE,
  DOCUMENTDATE,
  ACCEPTDATE,
  SUPPLIERACC_REF,
  SUMMA,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  BUDGETREF,
  STEPNUMBER,
  FACIALACC_CLS,
  RECIPIENT_REF,
  REGISTRATIONTYPE,
  REESTRNUMBER,
  AGREEMENTINNERNUMBER,
  REJECTCLS,
  REJECTCAUSE,
  CRYPTOSTATUS,
  SENDERID,
  SENDERRECORDID,
  REVIEWNOTE,
  DOCSTATEREF,
  RVERSION,
  EXECDOCFINSUMMA,
  FACT,
  DOCNUMBER,
  SENDERIDKEY,
  SENDERRECORDIDKEY,
  REALID,
  INNERNUMBER,
  ADJUSTMENTREF,
  ADJUSTMENTNUMBER,
  ACCEPTED,
  LASTACCEPTED,
  LASTADJUSTMENT,
  AGREEMENTREF,
  TEMPNOTE)
AS
  SELECT
    ID,
    DOCTYPE,
    DOCUMENTDATE,
    ACCEPTDATE,
    SUPPLIERACC_REF,
    SUMMA,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    STEPNUMBER,
    FACIALACC_CLS,
    RECIPIENT_REF,
    REGISTRATIONTYPE,
    REESTRNUMBER,
    AGREEMENTINNERNUMBER,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXECDOCFINSUMMA,
    FACT,
    DOCNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REALID,
    INNERNUMBER,
    ADJUSTMENTREF,
    ADJUSTMENTNUMBER,
    ACCEPTED,
    LASTACCEPTED,
    LASTADJUSTMENT,
    AGREEMENTREF,
    TEMPNOTE
  FROM TB_ExecutionDocumentsCaption
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_ID
  INSTEAD OF DELETE
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  quant$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_DOCEXECCAPTION_BD)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  select count(ID)   into quant$ from executiondocumentscaption 
  where AdjustmentRef = :old.ID
  ;
  if (quant$  = 0) then
    delete from ExecutionDocumentsDetail where (RecordIndex = :old.ID);
    delete from paymentschedule where (ExecutionRef = :old.ID)and(ProgIndex=308);
      
  else
    RaiseException('ex_agr_cantdeladjustmented');
  END IF;

-- - - - - - - - - - - - -
-- BD_10 (TR_DocExecCaption_BD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

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

-- - - - - - - - - - - - -
-- AD_10 (TR_ExecDocCaption_AD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_200 (TR_EXECDOCCAPTION_AD_200)
-- Create 04.10.2004
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_500 (TR_EXECDOCCAPTION_AD_500)
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_II
  INSTEAD OF INSERT
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  new$ID EXECUTIONDOCUMENTSCAPTION.ID%TYPE := :NEW.ID;
  new$DOCTYPE EXECUTIONDOCUMENTSCAPTION.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$DOCUMENTDATE EXECUTIONDOCUMENTSCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE EXECUTIONDOCUMENTSCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SUPPLIERACC_REF EXECUTIONDOCUMENTSCAPTION.SUPPLIERACC_REF%TYPE := :NEW.SUPPLIERACC_REF;
  new$SUMMA EXECUTIONDOCUMENTSCAPTION.SUMMA%TYPE := :NEW.SUMMA;
  new$CREATERUSER EXECUTIONDOCUMENTSCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE EXECUTIONDOCUMENTSCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE EXECUTIONDOCUMENTSCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER EXECUTIONDOCUMENTSCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF EXECUTIONDOCUMENTSCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$STEPNUMBER EXECUTIONDOCUMENTSCAPTION.STEPNUMBER%TYPE := :NEW.STEPNUMBER;
  new$FACIALACC_CLS EXECUTIONDOCUMENTSCAPTION.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$RECIPIENT_REF EXECUTIONDOCUMENTSCAPTION.RECIPIENT_REF%TYPE := :NEW.RECIPIENT_REF;
  new$REGISTRATIONTYPE EXECUTIONDOCUMENTSCAPTION.REGISTRATIONTYPE%TYPE := :NEW.REGISTRATIONTYPE;
  new$REESTRNUMBER EXECUTIONDOCUMENTSCAPTION.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$AGREEMENTINNERNUMBER EXECUTIONDOCUMENTSCAPTION.AGREEMENTINNERNUMBER%TYPE := :NEW.AGREEMENTINNERNUMBER;
  new$REJECTCLS EXECUTIONDOCUMENTSCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE EXECUTIONDOCUMENTSCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS EXECUTIONDOCUMENTSCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID EXECUTIONDOCUMENTSCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID EXECUTIONDOCUMENTSCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REVIEWNOTE EXECUTIONDOCUMENTSCAPTION.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF EXECUTIONDOCUMENTSCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION EXECUTIONDOCUMENTSCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$EXECDOCFINSUMMA EXECUTIONDOCUMENTSCAPTION.EXECDOCFINSUMMA%TYPE := :NEW.EXECDOCFINSUMMA;
  new$FACT EXECUTIONDOCUMENTSCAPTION.FACT%TYPE := :NEW.FACT;
  new$DOCNUMBER EXECUTIONDOCUMENTSCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SENDERIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REALID EXECUTIONDOCUMENTSCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER EXECUTIONDOCUMENTSCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTREF EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ADJUSTMENTNUMBER EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$ACCEPTED EXECUTIONDOCUMENTSCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED EXECUTIONDOCUMENTSCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$LASTADJUSTMENT EXECUTIONDOCUMENTSCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$AGREEMENTREF EXECUTIONDOCUMENTSCAPTION.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$TEMPNOTE EXECUTIONDOCUMENTSCAPTION.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  AdjDocNum$ VARCHAR2(50);
  agr_accepted$ NUMBER(10);
  agr_acceptdate$ NUMBER(10);
  PreviousInner$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_EXECDOCCAPTION_BI)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$ExecDocFinSumma is null) then 
    new$ExecDocFinSumma := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$RegistrationType is null) then 
    new$RegistrationType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  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;
  /* если это первая версия, то генерим новый номер цепочки, иначе подтягиваем из уточняемой записи */
  if (new$AdjustmentRef is null) then
    new$InnerNumber := GEN_ID('g_ExecDocNumber',1);
      
  else
    BEGIN
      /* уточняемая запись должна быть принятой и последней в цепочке */
      select
      InnerNumber 
      into PreviousInner$     from ExecutionDocumentsCaption
      where ID = new$AdjustmentRef and LastAccepted = 1 and LastAdjustment = 1
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (PreviousInner$ is null) then
      RaiseException('EX_ExecDoc_NotFindInner');
    END IF;
    new$InnerNumber := PreviousInner$;
      
  END IF;
  /* заполняем внутренний номер договора по id */  
  new$agreementinnernumber := null;
  if (new$agreementref is not null) then
    BEGIN
      select
      innernumber
      into new$agreementinnernumber     from agreements
      where
      id = new$agreementref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_EXECDOCCAPTION_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_EXECDOCCAPTION_BI_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Проверка указания внутренних номеров.*/
  if (new$InnerNumber is null) then
    RaiseException('EX_AGR_InnerNumsIsNull');
  END IF;

  /* Получение внутреннего номера уточнения*/
  select max(AdjustmentNumber)
  into Tmp$     from ExecutionDocumentsCaption
  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$AdjustmentRef is not null) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID), max(DocNumber)
    into Tmp$, AdjID$, AdjDocNum$       from ExecutionDocumentsCaption
    where (InnerNumber = new$InnerNumber) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/
    if (Tmp$ <> 1) then
      RaiseException('EX_ExecDoc_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID)
    into Tmp$       from ExecutionDocumentsCaption
    where (InnerNumber = new$InnerNumber) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then
      RaiseException('EX_ExecDoc_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/      
    new$AdjustmentRef := AdjID$;
        
  else /* Если ДИ не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/      
    new$AdjustmentRef := null;
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (tr_execdoccaption_bi_40)
-- Version 7.00.01.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_60 (tr_execdoccaption_bi_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$agreementinnernumber is not null) then
    BEGIN
      /* выбираем информацию о принятии из первой версии договора, т.к. вся
          цепочка договоров будет отклонена, если отклонена первая версия, и в цепочке
          будет принятый договор, если принята первая версия */
      select accepted, acceptdate     into
      agr_accepted$, agr_acceptdate$ from agreements
      where
      innernumber = new$agreementinnernumber and adjustmentnumber = 0
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* если в неотклоненном документе указан отклоненный договор */
    if (new$acceptdate is null and agr_accepted$ = 0 and agr_acceptdate$ is not null) then
      RaiseException('EX_Agr_Rejected');
    END IF;
    /* если принятый документ ссылается на непринятый договор */
    if (new$accepted = 1 and new$acceptdate is not null and
    (agr_accepted$ = 0 or agr_acceptdate$ is null)) then
      RaiseException('EX_Agr_NotAccepted');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_EXECDOCCAPTION_BI_500)
-- Last update 08.12.2005
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_EXECUTIONDOCUMENTSCAPTION (
    ID,
    DOCTYPE,
    DOCUMENTDATE,
    ACCEPTDATE,
    SUPPLIERACC_REF,
    SUMMA,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    STEPNUMBER,
    FACIALACC_CLS,
    RECIPIENT_REF,
    REGISTRATIONTYPE,
    REESTRNUMBER,
    AGREEMENTINNERNUMBER,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXECDOCFINSUMMA,
    FACT,
    DOCNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REALID,
    INNERNUMBER,
    ADJUSTMENTREF,
    ADJUSTMENTNUMBER,
    ACCEPTED,
    LASTACCEPTED,
    LASTADJUSTMENT,
    AGREEMENTREF,
    TEMPNOTE
  ) VALUES (
    new$ID,
    new$DOCTYPE,
    new$DOCUMENTDATE,
    new$ACCEPTDATE,
    new$SUPPLIERACC_REF,
    new$SUMMA,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$STEPNUMBER,
    new$FACIALACC_CLS,
    new$RECIPIENT_REF,
    new$REGISTRATIONTYPE,
    new$REESTRNUMBER,
    new$AGREEMENTINNERNUMBER,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$REVIEWNOTE,
    new$DOCSTATEREF,
    new$RVERSION,
    new$EXECDOCFINSUMMA,
    new$FACT,
    new$DOCNUMBER,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$REALID,
    new$INNERNUMBER,
    new$ADJUSTMENTREF,
    new$ADJUSTMENTNUMBER,
    new$ACCEPTED,
    new$LASTACCEPTED,
    new$LASTADJUSTMENT,
    new$AGREEMENTREF,
    new$TEMPNOTE);

-- - - - - - - - - - - - -
-- AI_0 (TR_ExecDocCaption_AI)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Коррекция вспомогательных флагов в уточняемой записи ДИ*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentRef is not null) and (new$LastAdjustment = 1)) then
    update ExecutionDocuMENTSCaption set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);        
    if (new$LastAccepted = 1) then
      update ExecutionDocuMENTSCaption set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_EXECDOCCAPTION_AI_500)
-- - - - - - - - - - - - -

-- 25.08.2004
  delete from DelRecIndexes where (TableID = 114) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_IU
  INSTEAD OF UPDATE
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  new$ID EXECUTIONDOCUMENTSCAPTION.ID%TYPE := :NEW.ID;
  new$DOCTYPE EXECUTIONDOCUMENTSCAPTION.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$DOCUMENTDATE EXECUTIONDOCUMENTSCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE EXECUTIONDOCUMENTSCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SUPPLIERACC_REF EXECUTIONDOCUMENTSCAPTION.SUPPLIERACC_REF%TYPE := :NEW.SUPPLIERACC_REF;
  new$SUMMA EXECUTIONDOCUMENTSCAPTION.SUMMA%TYPE := :NEW.SUMMA;
  new$CREATERUSER EXECUTIONDOCUMENTSCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE EXECUTIONDOCUMENTSCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE EXECUTIONDOCUMENTSCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER EXECUTIONDOCUMENTSCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF EXECUTIONDOCUMENTSCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$STEPNUMBER EXECUTIONDOCUMENTSCAPTION.STEPNUMBER%TYPE := :NEW.STEPNUMBER;
  new$FACIALACC_CLS EXECUTIONDOCUMENTSCAPTION.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$RECIPIENT_REF EXECUTIONDOCUMENTSCAPTION.RECIPIENT_REF%TYPE := :NEW.RECIPIENT_REF;
  new$REGISTRATIONTYPE EXECUTIONDOCUMENTSCAPTION.REGISTRATIONTYPE%TYPE := :NEW.REGISTRATIONTYPE;
  new$REESTRNUMBER EXECUTIONDOCUMENTSCAPTION.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$AGREEMENTINNERNUMBER EXECUTIONDOCUMENTSCAPTION.AGREEMENTINNERNUMBER%TYPE := :NEW.AGREEMENTINNERNUMBER;
  new$REJECTCLS EXECUTIONDOCUMENTSCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE EXECUTIONDOCUMENTSCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS EXECUTIONDOCUMENTSCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID EXECUTIONDOCUMENTSCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID EXECUTIONDOCUMENTSCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REVIEWNOTE EXECUTIONDOCUMENTSCAPTION.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF EXECUTIONDOCUMENTSCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION EXECUTIONDOCUMENTSCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$EXECDOCFINSUMMA EXECUTIONDOCUMENTSCAPTION.EXECDOCFINSUMMA%TYPE := :NEW.EXECDOCFINSUMMA;
  new$FACT EXECUTIONDOCUMENTSCAPTION.FACT%TYPE := :NEW.FACT;
  new$DOCNUMBER EXECUTIONDOCUMENTSCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SENDERIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REALID EXECUTIONDOCUMENTSCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER EXECUTIONDOCUMENTSCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTREF EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ADJUSTMENTNUMBER EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$ACCEPTED EXECUTIONDOCUMENTSCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED EXECUTIONDOCUMENTSCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$LASTADJUSTMENT EXECUTIONDOCUMENTSCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$AGREEMENTREF EXECUTIONDOCUMENTSCAPTION.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$TEMPNOTE EXECUTIONDOCUMENTSCAPTION.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
--
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  CntAgr$ NUMBER(10);
  CntStep$ NUMBER(10);
  agr_accepted$ NUMBER(10);
  agr_acceptdate$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_EXECDOCCAPTION_BU)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$ExecDocFinSumma is null) then 
    new$ExecDocFinSumma := 0;  
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$RegistrationType is null) then 
    new$RegistrationType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 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 CNT$1
      from ExecutionDocumentsDetail
      where 
      (                   RecordIndex = :old.Id
      ) AND (ROWNUM = 1)                ;
      if ((CNT$1<> 0)         ) then
        RaiseException('Ex_CantModufyBudget');
      END IF;
      SELECT COUNT(                   Id
      ) INTO CNT$2
      from PaymentSchedule
      where
      (                   ExecutionRef = :old.Id
      ) AND (ROWNUM = 1)                ;
      if ((CNT$2<> 0)         ) then
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* если номер цепочки не заполнен, то берем его из предыдущей версии записи */
  if (new$InnerNumber is null) then
    new$InnerNumber := :old.InnerNumber;
  END IF;
  /* cледим, чтобы никто не поменял внутреннюю нумерацию и ссылку на предыдущую */
  /* версию, иначе все накернится */
  if (new$InnerNumber <> :old.InnerNumber or
  new$AdjustmentRef <> :old.AdjustmentRef or
  new$AdjustmentNumber <> :old.AdjustmentNumber) then
    RaiseException('EX_Agr_ChangeInnerNums');
  END IF;
  /* заполняем внутренний номер договора по id */  
  new$agreementinnernumber := null;
  if (new$agreementref is not null) then
    BEGIN
      select
      innernumber
      into new$agreementinnernumber     from agreements
      where
      id = new$agreementref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_EXECDOCCAPTION_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_EXECDOCCAPTION_BU_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* отменять отклонение ДИ нельзя */
  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) then 
    /* менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (:old.LastAdjustment = 1) then
      new$LastAccepted := 1;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');
    END IF;
  END IF;
      
  /* если отменили принятие ДИ, тогда необходимо снять флаг LastAccepted*/
  if (:old.AcceptDate is not null and :old.Accepted = 1 and new$AcceptDate is null) then
    /* менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (:old.LastAdjustment = 1) then
      new$LastAccepted := 0;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');  
    END IF;
  END IF;
      
  /* если отклонили ДИ, тогда необходимо скинуть флаги LastAdjustment и LastAccepted */
  if (new$AcceptDate is not null and new$Accepted = 0 and (:old.AcceptDate is null or :old.Accepted = 1)) then
    if (:old.LastAdjustment = 1) then
      new$LastAdjustment := 0;
      new$LastAccepted := 0;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');
    END IF;
    SELECT COUNT(                 Id
    ) INTO CNT$1
    from ExecutionDocumentsCaption
    where
    (                 InnerNumber = new$InnerNumber and AdjustmentNumber > 0
    ) AND (ROWNUM = 1)              ;
    /* нельзя отклонять первую версию в цепочке при наличии уточнений */
    if (new$AdjustmentNumber = 0 and 
    (CNT$1<> 0)       ) then
      RaiseException('EX_ExecDoc_PrimaryAgrHasNotify');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_40 (tr_execdoccaption_bu_40)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  if ((:old.AcceptDate is not null) and (new$AcceptDate is null)) then
    select count(ID) into CntAgr$ from Agreements where (CloseDoc = :old.ID) ;
    select count(ID) into CntStep$ from AgreementSteps where (CloseDoc = :old.ID) ;
    if ((CntAgr$ > 0) or (CntStep$ > 0)) then
      RaiseException('ex_CannotUpdateCloseDoc');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_60 (tr_execdoccaption_bu_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$agreementinnernumber is not null) then
    BEGIN
      /* выбираем информацию о принятии из первой версии договора, т.к. вся
          цепочка договоров будет отклонена, если отклонена первая версия, и в цепочке
          будет принятый договор, если принята первая версия */
      select accepted, acceptdate     into
      agr_accepted$, agr_acceptdate$ from agreements
      where
      innernumber = new$agreementinnernumber and adjustmentnumber = 0
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* если в неотклоненном документе указан отклоненный договор */
    if (new$acceptdate is null and agr_accepted$ = 0 and agr_acceptdate$ is not null) then
      RaiseException('EX_Agr_Rejected');
    END IF;
    /* если принятый документ ссылается на непринятый договор */
    if (new$accepted = 1 and new$acceptdate is not null and
    (agr_accepted$ = 0 or agr_acceptdate$ is null)) then
      RaiseException('EX_Agr_NotAccepted');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_EXECDOCCAPTION_BU_200)
-- Create 04.10.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_EDCAPTION_BU_700)
-- Create 14.10.2004
-- - - - - - - - - - - - -

   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_EXECUTIONDOCUMENTSCAPTION SET
    ID = new$ID,
    DOCTYPE = new$DOCTYPE,
    DOCUMENTDATE = new$DOCUMENTDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    SUPPLIERACC_REF = new$SUPPLIERACC_REF,
    SUMMA = new$SUMMA,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    STEPNUMBER = new$STEPNUMBER,
    FACIALACC_CLS = new$FACIALACC_CLS,
    RECIPIENT_REF = new$RECIPIENT_REF,
    REGISTRATIONTYPE = new$REGISTRATIONTYPE,
    REESTRNUMBER = new$REESTRNUMBER,
    AGREEMENTINNERNUMBER = new$AGREEMENTINNERNUMBER,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    REVIEWNOTE = new$REVIEWNOTE,
    DOCSTATEREF = new$DOCSTATEREF,
    RVERSION = new$RVERSION,
    EXECDOCFINSUMMA = new$EXECDOCFINSUMMA,
    FACT = new$FACT,
    DOCNUMBER = new$DOCNUMBER,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    REALID = new$REALID,
    INNERNUMBER = new$INNERNUMBER,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    ACCEPTED = new$ACCEPTED,
    LASTACCEPTED = new$LASTACCEPTED,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    AGREEMENTREF = new$AGREEMENTREF,
    TEMPNOTE = new$TEMPNOTE
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_0 (TR_ExecDocCaption_AU)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AU_30 (TR_EXECDOCCAPTION_AU_30)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if ((new$DocStateRef is null) 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 ExecutionRef=new$ID;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_EXECDOCCAPTION_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

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

END;
/
commit work 
/
ALTER TABLE TB_ExecutionDocumentsCaption ADD (
  Note VARCHAR2(1024)
)
/

CREATE OR REPLACE VIEW ExecutionDocumentsCaption (
  ID,
  DOCTYPE,
  DOCUMENTDATE,
  ACCEPTDATE,
  SUPPLIERACC_REF,
  SUMMA,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  BUDGETREF,
  STEPNUMBER,
  FACIALACC_CLS,
  RECIPIENT_REF,
  REGISTRATIONTYPE,
  REESTRNUMBER,
  AGREEMENTINNERNUMBER,
  REJECTCLS,
  REJECTCAUSE,
  CRYPTOSTATUS,
  SENDERID,
  SENDERRECORDID,
  REVIEWNOTE,
  DOCSTATEREF,
  RVERSION,
  EXECDOCFINSUMMA,
  FACT,
  DOCNUMBER,
  SENDERIDKEY,
  SENDERRECORDIDKEY,
  REALID,
  INNERNUMBER,
  ADJUSTMENTREF,
  ADJUSTMENTNUMBER,
  ACCEPTED,
  LASTACCEPTED,
  LASTADJUSTMENT,
  AGREEMENTREF,
  TEMPNOTE,
  NOTE)
AS
  SELECT
    ID,
    DOCTYPE,
    DOCUMENTDATE,
    ACCEPTDATE,
    SUPPLIERACC_REF,
    SUMMA,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    STEPNUMBER,
    FACIALACC_CLS,
    RECIPIENT_REF,
    REGISTRATIONTYPE,
    REESTRNUMBER,
    AGREEMENTINNERNUMBER,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXECDOCFINSUMMA,
    FACT,
    DOCNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REALID,
    INNERNUMBER,
    ADJUSTMENTREF,
    ADJUSTMENTNUMBER,
    ACCEPTED,
    LASTACCEPTED,
    LASTADJUSTMENT,
    AGREEMENTREF,
    TEMPNOTE,
    NOTE
  FROM TB_ExecutionDocumentsCaption
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_ID
  INSTEAD OF DELETE
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  quant$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_DOCEXECCAPTION_BD)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  select count(ID)   into quant$ from executiondocumentscaption 
  where AdjustmentRef = :old.ID
  ;
  if (quant$  = 0) then
    delete from ExecutionDocumentsDetail where (RecordIndex = :old.ID);
    delete from paymentschedule where (ExecutionRef = :old.ID)and(ProgIndex=308);
      
  else
    RaiseException('ex_agr_cantdeladjustmented');
  END IF;

-- - - - - - - - - - - - -
-- BD_10 (TR_DocExecCaption_BD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

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

-- - - - - - - - - - - - -
-- AD_10 (TR_ExecDocCaption_AD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_200 (TR_EXECDOCCAPTION_AD_200)
-- Create 04.10.2004
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_500 (TR_EXECDOCCAPTION_AD_500)
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_II
  INSTEAD OF INSERT
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  new$ID EXECUTIONDOCUMENTSCAPTION.ID%TYPE := :NEW.ID;
  new$DOCTYPE EXECUTIONDOCUMENTSCAPTION.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$DOCUMENTDATE EXECUTIONDOCUMENTSCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE EXECUTIONDOCUMENTSCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SUPPLIERACC_REF EXECUTIONDOCUMENTSCAPTION.SUPPLIERACC_REF%TYPE := :NEW.SUPPLIERACC_REF;
  new$SUMMA EXECUTIONDOCUMENTSCAPTION.SUMMA%TYPE := :NEW.SUMMA;
  new$CREATERUSER EXECUTIONDOCUMENTSCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE EXECUTIONDOCUMENTSCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE EXECUTIONDOCUMENTSCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER EXECUTIONDOCUMENTSCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF EXECUTIONDOCUMENTSCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$STEPNUMBER EXECUTIONDOCUMENTSCAPTION.STEPNUMBER%TYPE := :NEW.STEPNUMBER;
  new$FACIALACC_CLS EXECUTIONDOCUMENTSCAPTION.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$RECIPIENT_REF EXECUTIONDOCUMENTSCAPTION.RECIPIENT_REF%TYPE := :NEW.RECIPIENT_REF;
  new$REGISTRATIONTYPE EXECUTIONDOCUMENTSCAPTION.REGISTRATIONTYPE%TYPE := :NEW.REGISTRATIONTYPE;
  new$REESTRNUMBER EXECUTIONDOCUMENTSCAPTION.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$AGREEMENTINNERNUMBER EXECUTIONDOCUMENTSCAPTION.AGREEMENTINNERNUMBER%TYPE := :NEW.AGREEMENTINNERNUMBER;
  new$REJECTCLS EXECUTIONDOCUMENTSCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE EXECUTIONDOCUMENTSCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS EXECUTIONDOCUMENTSCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID EXECUTIONDOCUMENTSCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID EXECUTIONDOCUMENTSCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REVIEWNOTE EXECUTIONDOCUMENTSCAPTION.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF EXECUTIONDOCUMENTSCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION EXECUTIONDOCUMENTSCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$EXECDOCFINSUMMA EXECUTIONDOCUMENTSCAPTION.EXECDOCFINSUMMA%TYPE := :NEW.EXECDOCFINSUMMA;
  new$FACT EXECUTIONDOCUMENTSCAPTION.FACT%TYPE := :NEW.FACT;
  new$DOCNUMBER EXECUTIONDOCUMENTSCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SENDERIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REALID EXECUTIONDOCUMENTSCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER EXECUTIONDOCUMENTSCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTREF EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ADJUSTMENTNUMBER EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$ACCEPTED EXECUTIONDOCUMENTSCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED EXECUTIONDOCUMENTSCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$LASTADJUSTMENT EXECUTIONDOCUMENTSCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$AGREEMENTREF EXECUTIONDOCUMENTSCAPTION.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$TEMPNOTE EXECUTIONDOCUMENTSCAPTION.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
  new$NOTE EXECUTIONDOCUMENTSCAPTION.NOTE%TYPE := :NEW.NOTE;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  AdjDocNum$ VARCHAR2(50);
  agr_accepted$ NUMBER(10);
  agr_acceptdate$ NUMBER(10);
  PreviousInner$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_EXECDOCCAPTION_BI)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$ExecDocFinSumma is null) then 
    new$ExecDocFinSumma := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$RegistrationType is null) then 
    new$RegistrationType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  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;
  /* если это первая версия, то генерим новый номер цепочки, иначе подтягиваем из уточняемой записи */
  if (new$AdjustmentRef is null) then
    new$InnerNumber := GEN_ID('g_ExecDocNumber',1);
      
  else
    BEGIN
      /* уточняемая запись должна быть принятой и последней в цепочке */
      select
      InnerNumber 
      into PreviousInner$     from ExecutionDocumentsCaption
      where ID = new$AdjustmentRef and LastAccepted = 1 and LastAdjustment = 1
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (PreviousInner$ is null) then
      RaiseException('EX_ExecDoc_NotFindInner');
    END IF;
    new$InnerNumber := PreviousInner$;
      
  END IF;
  /* заполняем внутренний номер договора по id */  
  new$agreementinnernumber := null;
  if (new$agreementref is not null) then
    BEGIN
      select
      innernumber
      into new$agreementinnernumber     from agreements
      where
      id = new$agreementref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_EXECDOCCAPTION_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_EXECDOCCAPTION_BI_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Проверка указания внутренних номеров.*/
  if (new$InnerNumber is null) then
    RaiseException('EX_AGR_InnerNumsIsNull');
  END IF;

  /* Получение внутреннего номера уточнения*/
  select max(AdjustmentNumber)
  into Tmp$     from ExecutionDocumentsCaption
  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$AdjustmentRef is not null) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID), max(DocNumber)
    into Tmp$, AdjID$, AdjDocNum$       from ExecutionDocumentsCaption
    where (InnerNumber = new$InnerNumber) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/
    if (Tmp$ <> 1) then
      RaiseException('EX_ExecDoc_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID)
    into Tmp$       from ExecutionDocumentsCaption
    where (InnerNumber = new$InnerNumber) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then
      RaiseException('EX_ExecDoc_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/      
    new$AdjustmentRef := AdjID$;
        
  else /* Если ДИ не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/      
    new$AdjustmentRef := null;
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (tr_execdoccaption_bi_40)
-- Version 7.00.01.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_60 (tr_execdoccaption_bi_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$agreementinnernumber is not null) then
    BEGIN
      /* выбираем информацию о принятии из первой версии договора, т.к. вся
          цепочка договоров будет отклонена, если отклонена первая версия, и в цепочке
          будет принятый договор, если принята первая версия */
      select accepted, acceptdate     into
      agr_accepted$, agr_acceptdate$ from agreements
      where
      innernumber = new$agreementinnernumber and adjustmentnumber = 0
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* если в неотклоненном документе указан отклоненный договор */
    if (new$acceptdate is null and agr_accepted$ = 0 and agr_acceptdate$ is not null) then
      RaiseException('EX_Agr_Rejected');
    END IF;
    /* если принятый документ ссылается на непринятый договор */
    if (new$accepted = 1 and new$acceptdate is not null and
    (agr_accepted$ = 0 or agr_acceptdate$ is null)) then
      RaiseException('EX_Agr_NotAccepted');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_EXECDOCCAPTION_BI_500)
-- Last update 08.12.2005
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_EXECUTIONDOCUMENTSCAPTION (
    ID,
    DOCTYPE,
    DOCUMENTDATE,
    ACCEPTDATE,
    SUPPLIERACC_REF,
    SUMMA,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    STEPNUMBER,
    FACIALACC_CLS,
    RECIPIENT_REF,
    REGISTRATIONTYPE,
    REESTRNUMBER,
    AGREEMENTINNERNUMBER,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXECDOCFINSUMMA,
    FACT,
    DOCNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REALID,
    INNERNUMBER,
    ADJUSTMENTREF,
    ADJUSTMENTNUMBER,
    ACCEPTED,
    LASTACCEPTED,
    LASTADJUSTMENT,
    AGREEMENTREF,
    TEMPNOTE,
    NOTE
  ) VALUES (
    new$ID,
    new$DOCTYPE,
    new$DOCUMENTDATE,
    new$ACCEPTDATE,
    new$SUPPLIERACC_REF,
    new$SUMMA,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$STEPNUMBER,
    new$FACIALACC_CLS,
    new$RECIPIENT_REF,
    new$REGISTRATIONTYPE,
    new$REESTRNUMBER,
    new$AGREEMENTINNERNUMBER,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$REVIEWNOTE,
    new$DOCSTATEREF,
    new$RVERSION,
    new$EXECDOCFINSUMMA,
    new$FACT,
    new$DOCNUMBER,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$REALID,
    new$INNERNUMBER,
    new$ADJUSTMENTREF,
    new$ADJUSTMENTNUMBER,
    new$ACCEPTED,
    new$LASTACCEPTED,
    new$LASTADJUSTMENT,
    new$AGREEMENTREF,
    new$TEMPNOTE,
    new$NOTE);

-- - - - - - - - - - - - -
-- AI_0 (TR_ExecDocCaption_AI)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Коррекция вспомогательных флагов в уточняемой записи ДИ*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentRef is not null) and (new$LastAdjustment = 1)) then
    update ExecutionDocuMENTSCaption set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);        
    if (new$LastAccepted = 1) then
      update ExecutionDocuMENTSCaption set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_EXECDOCCAPTION_AI_500)
-- - - - - - - - - - - - -

-- 25.08.2004
  delete from DelRecIndexes where (TableID = 114) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_IU
  INSTEAD OF UPDATE
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  new$ID EXECUTIONDOCUMENTSCAPTION.ID%TYPE := :NEW.ID;
  new$DOCTYPE EXECUTIONDOCUMENTSCAPTION.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$DOCUMENTDATE EXECUTIONDOCUMENTSCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE EXECUTIONDOCUMENTSCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SUPPLIERACC_REF EXECUTIONDOCUMENTSCAPTION.SUPPLIERACC_REF%TYPE := :NEW.SUPPLIERACC_REF;
  new$SUMMA EXECUTIONDOCUMENTSCAPTION.SUMMA%TYPE := :NEW.SUMMA;
  new$CREATERUSER EXECUTIONDOCUMENTSCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE EXECUTIONDOCUMENTSCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE EXECUTIONDOCUMENTSCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER EXECUTIONDOCUMENTSCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF EXECUTIONDOCUMENTSCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$STEPNUMBER EXECUTIONDOCUMENTSCAPTION.STEPNUMBER%TYPE := :NEW.STEPNUMBER;
  new$FACIALACC_CLS EXECUTIONDOCUMENTSCAPTION.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$RECIPIENT_REF EXECUTIONDOCUMENTSCAPTION.RECIPIENT_REF%TYPE := :NEW.RECIPIENT_REF;
  new$REGISTRATIONTYPE EXECUTIONDOCUMENTSCAPTION.REGISTRATIONTYPE%TYPE := :NEW.REGISTRATIONTYPE;
  new$REESTRNUMBER EXECUTIONDOCUMENTSCAPTION.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$AGREEMENTINNERNUMBER EXECUTIONDOCUMENTSCAPTION.AGREEMENTINNERNUMBER%TYPE := :NEW.AGREEMENTINNERNUMBER;
  new$REJECTCLS EXECUTIONDOCUMENTSCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE EXECUTIONDOCUMENTSCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS EXECUTIONDOCUMENTSCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID EXECUTIONDOCUMENTSCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID EXECUTIONDOCUMENTSCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REVIEWNOTE EXECUTIONDOCUMENTSCAPTION.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF EXECUTIONDOCUMENTSCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION EXECUTIONDOCUMENTSCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$EXECDOCFINSUMMA EXECUTIONDOCUMENTSCAPTION.EXECDOCFINSUMMA%TYPE := :NEW.EXECDOCFINSUMMA;
  new$FACT EXECUTIONDOCUMENTSCAPTION.FACT%TYPE := :NEW.FACT;
  new$DOCNUMBER EXECUTIONDOCUMENTSCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SENDERIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REALID EXECUTIONDOCUMENTSCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER EXECUTIONDOCUMENTSCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTREF EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ADJUSTMENTNUMBER EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$ACCEPTED EXECUTIONDOCUMENTSCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED EXECUTIONDOCUMENTSCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$LASTADJUSTMENT EXECUTIONDOCUMENTSCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$AGREEMENTREF EXECUTIONDOCUMENTSCAPTION.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$TEMPNOTE EXECUTIONDOCUMENTSCAPTION.TEMPNOTE%TYPE := :NEW.TEMPNOTE;
  new$NOTE EXECUTIONDOCUMENTSCAPTION.NOTE%TYPE := :NEW.NOTE;
--
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  CntAgr$ NUMBER(10);
  CntStep$ NUMBER(10);
  agr_accepted$ NUMBER(10);
  agr_acceptdate$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_EXECDOCCAPTION_BU)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$ExecDocFinSumma is null) then 
    new$ExecDocFinSumma := 0;  
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$RegistrationType is null) then 
    new$RegistrationType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 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 CNT$1
      from ExecutionDocumentsDetail
      where 
      (                   RecordIndex = :old.Id
      ) AND (ROWNUM = 1)                ;
      if ((CNT$1<> 0)         ) then
        RaiseException('Ex_CantModufyBudget');
      END IF;
      SELECT COUNT(                   Id
      ) INTO CNT$2
      from PaymentSchedule
      where
      (                   ExecutionRef = :old.Id
      ) AND (ROWNUM = 1)                ;
      if ((CNT$2<> 0)         ) then
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* если номер цепочки не заполнен, то берем его из предыдущей версии записи */
  if (new$InnerNumber is null) then
    new$InnerNumber := :old.InnerNumber;
  END IF;
  /* cледим, чтобы никто не поменял внутреннюю нумерацию и ссылку на предыдущую */
  /* версию, иначе все накернится */
  if (new$InnerNumber <> :old.InnerNumber or
  new$AdjustmentRef <> :old.AdjustmentRef or
  new$AdjustmentNumber <> :old.AdjustmentNumber) then
    RaiseException('EX_Agr_ChangeInnerNums');
  END IF;
  /* заполняем внутренний номер договора по id */  
  new$agreementinnernumber := null;
  if (new$agreementref is not null) then
    BEGIN
      select
      innernumber
      into new$agreementinnernumber     from agreements
      where
      id = new$agreementref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_EXECDOCCAPTION_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_EXECDOCCAPTION_BU_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* отменять отклонение ДИ нельзя */
  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) then 
    /* менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (:old.LastAdjustment = 1) then
      new$LastAccepted := 1;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');
    END IF;
  END IF;
      
  /* если отменили принятие ДИ, тогда необходимо снять флаг LastAccepted*/
  if (:old.AcceptDate is not null and :old.Accepted = 1 and new$AcceptDate is null) then
    /* менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (:old.LastAdjustment = 1) then
      new$LastAccepted := 0;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');  
    END IF;
  END IF;
      
  /* если отклонили ДИ, тогда необходимо скинуть флаги LastAdjustment и LastAccepted */
  if (new$AcceptDate is not null and new$Accepted = 0 and (:old.AcceptDate is null or :old.Accepted = 1)) then
    if (:old.LastAdjustment = 1) then
      new$LastAdjustment := 0;
      new$LastAccepted := 0;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');
    END IF;
    SELECT COUNT(                 Id
    ) INTO CNT$1
    from ExecutionDocumentsCaption
    where
    (                 InnerNumber = new$InnerNumber and AdjustmentNumber > 0
    ) AND (ROWNUM = 1)              ;
    /* нельзя отклонять первую версию в цепочке при наличии уточнений */
    if (new$AdjustmentNumber = 0 and 
    (CNT$1<> 0)       ) then
      RaiseException('EX_ExecDoc_PrimaryAgrHasNotify');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_40 (tr_execdoccaption_bu_40)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  if ((:old.AcceptDate is not null) and (new$AcceptDate is null)) then
    select count(ID) into CntAgr$ from Agreements where (CloseDoc = :old.ID) ;
    select count(ID) into CntStep$ from AgreementSteps where (CloseDoc = :old.ID) ;
    if ((CntAgr$ > 0) or (CntStep$ > 0)) then
      RaiseException('ex_CannotUpdateCloseDoc');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_60 (tr_execdoccaption_bu_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$agreementinnernumber is not null) then
    BEGIN
      /* выбираем информацию о принятии из первой версии договора, т.к. вся
          цепочка договоров будет отклонена, если отклонена первая версия, и в цепочке
          будет принятый договор, если принята первая версия */
      select accepted, acceptdate     into
      agr_accepted$, agr_acceptdate$ from agreements
      where
      innernumber = new$agreementinnernumber and adjustmentnumber = 0
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* если в неотклоненном документе указан отклоненный договор */
    if (new$acceptdate is null and agr_accepted$ = 0 and agr_acceptdate$ is not null) then
      RaiseException('EX_Agr_Rejected');
    END IF;
    /* если принятый документ ссылается на непринятый договор */
    if (new$accepted = 1 and new$acceptdate is not null and
    (agr_accepted$ = 0 or agr_acceptdate$ is null)) then
      RaiseException('EX_Agr_NotAccepted');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_EXECDOCCAPTION_BU_200)
-- Create 04.10.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_EDCAPTION_BU_700)
-- Create 14.10.2004
-- - - - - - - - - - - - -

   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_EXECUTIONDOCUMENTSCAPTION SET
    ID = new$ID,
    DOCTYPE = new$DOCTYPE,
    DOCUMENTDATE = new$DOCUMENTDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    SUPPLIERACC_REF = new$SUPPLIERACC_REF,
    SUMMA = new$SUMMA,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    STEPNUMBER = new$STEPNUMBER,
    FACIALACC_CLS = new$FACIALACC_CLS,
    RECIPIENT_REF = new$RECIPIENT_REF,
    REGISTRATIONTYPE = new$REGISTRATIONTYPE,
    REESTRNUMBER = new$REESTRNUMBER,
    AGREEMENTINNERNUMBER = new$AGREEMENTINNERNUMBER,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    REVIEWNOTE = new$REVIEWNOTE,
    DOCSTATEREF = new$DOCSTATEREF,
    RVERSION = new$RVERSION,
    EXECDOCFINSUMMA = new$EXECDOCFINSUMMA,
    FACT = new$FACT,
    DOCNUMBER = new$DOCNUMBER,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    REALID = new$REALID,
    INNERNUMBER = new$INNERNUMBER,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    ACCEPTED = new$ACCEPTED,
    LASTACCEPTED = new$LASTACCEPTED,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    AGREEMENTREF = new$AGREEMENTREF,
    TEMPNOTE = new$TEMPNOTE,
    NOTE = new$NOTE
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_0 (TR_ExecDocCaption_AU)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AU_30 (TR_EXECDOCCAPTION_AU_30)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if ((new$DocStateRef is null) 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 ExecutionRef=new$ID;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_EXECDOCCAPTION_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

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

END;
/
update ExecutionDocumentsCaption set
  Note = TempNote
/
commit work 
/
ALTER TABLE TB_ExecutionDocumentsCaption DROP (TempNote)
/

CREATE OR REPLACE VIEW ExecutionDocumentsCaption (
  ID,
  DOCTYPE,
  DOCUMENTDATE,
  ACCEPTDATE,
  SUPPLIERACC_REF,
  SUMMA,
  CREATERUSER,
  CREATEDATE,
  UPDATEDATE,
  UPDATERUSER,
  BUDGETREF,
  STEPNUMBER,
  FACIALACC_CLS,
  RECIPIENT_REF,
  REGISTRATIONTYPE,
  REESTRNUMBER,
  AGREEMENTINNERNUMBER,
  REJECTCLS,
  REJECTCAUSE,
  CRYPTOSTATUS,
  SENDERID,
  SENDERRECORDID,
  REVIEWNOTE,
  DOCSTATEREF,
  RVERSION,
  EXECDOCFINSUMMA,
  FACT,
  DOCNUMBER,
  SENDERIDKEY,
  SENDERRECORDIDKEY,
  REALID,
  INNERNUMBER,
  ADJUSTMENTREF,
  ADJUSTMENTNUMBER,
  ACCEPTED,
  LASTACCEPTED,
  LASTADJUSTMENT,
  AGREEMENTREF,
  NOTE)
AS
  SELECT
    ID,
    DOCTYPE,
    DOCUMENTDATE,
    ACCEPTDATE,
    SUPPLIERACC_REF,
    SUMMA,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    STEPNUMBER,
    FACIALACC_CLS,
    RECIPIENT_REF,
    REGISTRATIONTYPE,
    REESTRNUMBER,
    AGREEMENTINNERNUMBER,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXECDOCFINSUMMA,
    FACT,
    DOCNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REALID,
    INNERNUMBER,
    ADJUSTMENTREF,
    ADJUSTMENTNUMBER,
    ACCEPTED,
    LASTACCEPTED,
    LASTADJUSTMENT,
    AGREEMENTREF,
    NOTE
  FROM TB_ExecutionDocumentsCaption
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_ID
  INSTEAD OF DELETE
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  quant$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_DOCEXECCAPTION_BD)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  select count(ID)   into quant$ from executiondocumentscaption 
  where AdjustmentRef = :old.ID
  ;
  if (quant$  = 0) then
    delete from ExecutionDocumentsDetail where (RecordIndex = :old.ID);
    delete from paymentschedule where (ExecutionRef = :old.ID)and(ProgIndex=308);
      
  else
    RaiseException('ex_agr_cantdeladjustmented');
  END IF;

-- - - - - - - - - - - - -
-- BD_10 (TR_DocExecCaption_BD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

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

-- - - - - - - - - - - - -
-- AD_10 (TR_ExecDocCaption_AD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_200 (TR_EXECDOCCAPTION_AD_200)
-- Create 04.10.2004
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_500 (TR_EXECDOCCAPTION_AD_500)
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_II
  INSTEAD OF INSERT
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  new$ID EXECUTIONDOCUMENTSCAPTION.ID%TYPE := :NEW.ID;
  new$DOCTYPE EXECUTIONDOCUMENTSCAPTION.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$DOCUMENTDATE EXECUTIONDOCUMENTSCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE EXECUTIONDOCUMENTSCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SUPPLIERACC_REF EXECUTIONDOCUMENTSCAPTION.SUPPLIERACC_REF%TYPE := :NEW.SUPPLIERACC_REF;
  new$SUMMA EXECUTIONDOCUMENTSCAPTION.SUMMA%TYPE := :NEW.SUMMA;
  new$CREATERUSER EXECUTIONDOCUMENTSCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE EXECUTIONDOCUMENTSCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE EXECUTIONDOCUMENTSCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER EXECUTIONDOCUMENTSCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF EXECUTIONDOCUMENTSCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$STEPNUMBER EXECUTIONDOCUMENTSCAPTION.STEPNUMBER%TYPE := :NEW.STEPNUMBER;
  new$FACIALACC_CLS EXECUTIONDOCUMENTSCAPTION.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$RECIPIENT_REF EXECUTIONDOCUMENTSCAPTION.RECIPIENT_REF%TYPE := :NEW.RECIPIENT_REF;
  new$REGISTRATIONTYPE EXECUTIONDOCUMENTSCAPTION.REGISTRATIONTYPE%TYPE := :NEW.REGISTRATIONTYPE;
  new$REESTRNUMBER EXECUTIONDOCUMENTSCAPTION.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$AGREEMENTINNERNUMBER EXECUTIONDOCUMENTSCAPTION.AGREEMENTINNERNUMBER%TYPE := :NEW.AGREEMENTINNERNUMBER;
  new$REJECTCLS EXECUTIONDOCUMENTSCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE EXECUTIONDOCUMENTSCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS EXECUTIONDOCUMENTSCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID EXECUTIONDOCUMENTSCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID EXECUTIONDOCUMENTSCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REVIEWNOTE EXECUTIONDOCUMENTSCAPTION.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF EXECUTIONDOCUMENTSCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION EXECUTIONDOCUMENTSCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$EXECDOCFINSUMMA EXECUTIONDOCUMENTSCAPTION.EXECDOCFINSUMMA%TYPE := :NEW.EXECDOCFINSUMMA;
  new$FACT EXECUTIONDOCUMENTSCAPTION.FACT%TYPE := :NEW.FACT;
  new$DOCNUMBER EXECUTIONDOCUMENTSCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SENDERIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REALID EXECUTIONDOCUMENTSCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER EXECUTIONDOCUMENTSCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTREF EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ADJUSTMENTNUMBER EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$ACCEPTED EXECUTIONDOCUMENTSCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED EXECUTIONDOCUMENTSCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$LASTADJUSTMENT EXECUTIONDOCUMENTSCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$AGREEMENTREF EXECUTIONDOCUMENTSCAPTION.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$NOTE EXECUTIONDOCUMENTSCAPTION.NOTE%TYPE := :NEW.NOTE;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  AdjDocNum$ VARCHAR2(50);
  agr_accepted$ NUMBER(10);
  agr_acceptdate$ NUMBER(10);
  PreviousInner$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_EXECDOCCAPTION_BI)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$ExecDocFinSumma is null) then 
    new$ExecDocFinSumma := 0;
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$RegistrationType is null) then 
    new$RegistrationType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 0;
  END IF;
  if (new$Accepted is null) then 
    new$Accepted := 1;
  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;
  /* если это первая версия, то генерим новый номер цепочки, иначе подтягиваем из уточняемой записи */
  if (new$AdjustmentRef is null) then
    new$InnerNumber := GEN_ID('g_ExecDocNumber',1);
      
  else
    BEGIN
      /* уточняемая запись должна быть принятой и последней в цепочке */
      select
      InnerNumber 
      into PreviousInner$     from ExecutionDocumentsCaption
      where ID = new$AdjustmentRef and LastAccepted = 1 and LastAdjustment = 1
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (PreviousInner$ is null) then
      RaiseException('EX_ExecDoc_NotFindInner');
    END IF;
    new$InnerNumber := PreviousInner$;
      
  END IF;
  /* заполняем внутренний номер договора по id */  
  new$agreementinnernumber := null;
  if (new$agreementref is not null) then
    BEGIN
      select
      innernumber
      into new$agreementinnernumber     from agreements
      where
      id = new$agreementref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_5 (TR_EXECDOCCAPTION_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_EXECDOCCAPTION_BI_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Проверка указания внутренних номеров.*/
  if (new$InnerNumber is null) then
    RaiseException('EX_AGR_InnerNumsIsNull');
  END IF;

  /* Получение внутреннего номера уточнения*/
  select max(AdjustmentNumber)
  into Tmp$     from ExecutionDocumentsCaption
  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$AdjustmentRef is not null) then
    /* Получаем последний принятый в цепочке - он должен быть один*/
    select count(ID), max(ID), max(DocNumber)
    into Tmp$, AdjID$, AdjDocNum$       from ExecutionDocumentsCaption
    where (InnerNumber = new$InnerNumber) and (LastAccepted = 1)
    ;
    /* Если не один, тогда ругаемся*/
    if (Tmp$ <> 1) then
      RaiseException('EX_ExecDoc_AdjustNotAccept');
    END IF;
    /* Если есть уже в цепочке уточнения в состоянии редактирования, тогда ругаемся*/
    select count(ID)
    into Tmp$       from ExecutionDocumentsCaption
    where (InnerNumber = new$InnerNumber) and (AcceptDate is null)
    ;
    if (Tmp$ > 0) then
      RaiseException('EX_ExecDoc_AdjustDuplicate');
    END IF;
    /* Теперь, когда все в порядке, можно настроить все ссылочки*/      
    new$AdjustmentRef := AdjID$;
        
  else /* Если ДИ не является уточнением*/
    /* Проставляем на всякий случай пустые значения (ни на кого не ссылаемся)*/      
    new$AdjustmentRef := null;
  END IF;

-- - - - - - - - - - - - -
-- BI_40 (tr_execdoccaption_bi_40)
-- Version 7.00.01.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_60 (tr_execdoccaption_bi_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$agreementinnernumber is not null) then
    BEGIN
      /* выбираем информацию о принятии из первой версии договора, т.к. вся
          цепочка договоров будет отклонена, если отклонена первая версия, и в цепочке
          будет принятый договор, если принята первая версия */
      select accepted, acceptdate     into
      agr_accepted$, agr_acceptdate$ from agreements
      where
      innernumber = new$agreementinnernumber and adjustmentnumber = 0
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* если в неотклоненном документе указан отклоненный договор */
    if (new$acceptdate is null and agr_accepted$ = 0 and agr_acceptdate$ is not null) then
      RaiseException('EX_Agr_Rejected');
    END IF;
    /* если принятый документ ссылается на непринятый договор */
    if (new$accepted = 1 and new$acceptdate is not null and
    (agr_accepted$ = 0 or agr_acceptdate$ is null)) then
      RaiseException('EX_Agr_NotAccepted');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_EXECDOCCAPTION_BI_500)
-- Last update 08.12.2005
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_EXECUTIONDOCUMENTSCAPTION (
    ID,
    DOCTYPE,
    DOCUMENTDATE,
    ACCEPTDATE,
    SUPPLIERACC_REF,
    SUMMA,
    CREATERUSER,
    CREATEDATE,
    UPDATEDATE,
    UPDATERUSER,
    BUDGETREF,
    STEPNUMBER,
    FACIALACC_CLS,
    RECIPIENT_REF,
    REGISTRATIONTYPE,
    REESTRNUMBER,
    AGREEMENTINNERNUMBER,
    REJECTCLS,
    REJECTCAUSE,
    CRYPTOSTATUS,
    SENDERID,
    SENDERRECORDID,
    REVIEWNOTE,
    DOCSTATEREF,
    RVERSION,
    EXECDOCFINSUMMA,
    FACT,
    DOCNUMBER,
    SENDERIDKEY,
    SENDERRECORDIDKEY,
    REALID,
    INNERNUMBER,
    ADJUSTMENTREF,
    ADJUSTMENTNUMBER,
    ACCEPTED,
    LASTACCEPTED,
    LASTADJUSTMENT,
    AGREEMENTREF,
    NOTE
  ) VALUES (
    new$ID,
    new$DOCTYPE,
    new$DOCUMENTDATE,
    new$ACCEPTDATE,
    new$SUPPLIERACC_REF,
    new$SUMMA,
    new$CREATERUSER,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$UPDATERUSER,
    new$BUDGETREF,
    new$STEPNUMBER,
    new$FACIALACC_CLS,
    new$RECIPIENT_REF,
    new$REGISTRATIONTYPE,
    new$REESTRNUMBER,
    new$AGREEMENTINNERNUMBER,
    new$REJECTCLS,
    new$REJECTCAUSE,
    new$CRYPTOSTATUS,
    new$SENDERID,
    new$SENDERRECORDID,
    new$REVIEWNOTE,
    new$DOCSTATEREF,
    new$RVERSION,
    new$EXECDOCFINSUMMA,
    new$FACT,
    new$DOCNUMBER,
    new$SENDERIDKEY,
    new$SENDERRECORDIDKEY,
    new$REALID,
    new$INNERNUMBER,
    new$ADJUSTMENTREF,
    new$ADJUSTMENTNUMBER,
    new$ACCEPTED,
    new$LASTACCEPTED,
    new$LASTADJUSTMENT,
    new$AGREEMENTREF,
    new$NOTE);

-- - - - - - - - - - - - -
-- AI_0 (TR_ExecDocCaption_AI)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* Коррекция вспомогательных флагов в уточняемой записи ДИ*/
  /* Чтобы не возникало каскадных обновлений, вызываем только у последней записи в цепочке*/
  if ((new$AdjustmentRef is not null) and (new$LastAdjustment = 1)) then
    update ExecutionDocuMENTSCaption set
    LastAdjustment = 0,
    RVersion = -1
    where (ID = new$AdjustmentRef);        
    if (new$LastAccepted = 1) then
      update ExecutionDocuMENTSCaption set
      LastAccepted = 0,
      RVersion = -1
      where (ID = new$AdjustmentRef);
        
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_EXECDOCCAPTION_AI_500)
-- - - - - - - - - - - - -

-- 25.08.2004
  delete from DelRecIndexes where (TableID = 114) and (RecordID = new$ID);

END;
/

CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_IU
  INSTEAD OF UPDATE
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  new$ID EXECUTIONDOCUMENTSCAPTION.ID%TYPE := :NEW.ID;
  new$DOCTYPE EXECUTIONDOCUMENTSCAPTION.DOCTYPE%TYPE := :NEW.DOCTYPE;
  new$DOCUMENTDATE EXECUTIONDOCUMENTSCAPTION.DOCUMENTDATE%TYPE := :NEW.DOCUMENTDATE;
  new$ACCEPTDATE EXECUTIONDOCUMENTSCAPTION.ACCEPTDATE%TYPE := :NEW.ACCEPTDATE;
  new$SUPPLIERACC_REF EXECUTIONDOCUMENTSCAPTION.SUPPLIERACC_REF%TYPE := :NEW.SUPPLIERACC_REF;
  new$SUMMA EXECUTIONDOCUMENTSCAPTION.SUMMA%TYPE := :NEW.SUMMA;
  new$CREATERUSER EXECUTIONDOCUMENTSCAPTION.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$CREATEDATE EXECUTIONDOCUMENTSCAPTION.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE EXECUTIONDOCUMENTSCAPTION.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$UPDATERUSER EXECUTIONDOCUMENTSCAPTION.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$BUDGETREF EXECUTIONDOCUMENTSCAPTION.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$STEPNUMBER EXECUTIONDOCUMENTSCAPTION.STEPNUMBER%TYPE := :NEW.STEPNUMBER;
  new$FACIALACC_CLS EXECUTIONDOCUMENTSCAPTION.FACIALACC_CLS%TYPE := :NEW.FACIALACC_CLS;
  new$RECIPIENT_REF EXECUTIONDOCUMENTSCAPTION.RECIPIENT_REF%TYPE := :NEW.RECIPIENT_REF;
  new$REGISTRATIONTYPE EXECUTIONDOCUMENTSCAPTION.REGISTRATIONTYPE%TYPE := :NEW.REGISTRATIONTYPE;
  new$REESTRNUMBER EXECUTIONDOCUMENTSCAPTION.REESTRNUMBER%TYPE := :NEW.REESTRNUMBER;
  new$AGREEMENTINNERNUMBER EXECUTIONDOCUMENTSCAPTION.AGREEMENTINNERNUMBER%TYPE := :NEW.AGREEMENTINNERNUMBER;
  new$REJECTCLS EXECUTIONDOCUMENTSCAPTION.REJECTCLS%TYPE := :NEW.REJECTCLS;
  new$REJECTCAUSE EXECUTIONDOCUMENTSCAPTION.REJECTCAUSE%TYPE := :NEW.REJECTCAUSE;
  new$CRYPTOSTATUS EXECUTIONDOCUMENTSCAPTION.CRYPTOSTATUS%TYPE := :NEW.CRYPTOSTATUS;
  new$SENDERID EXECUTIONDOCUMENTSCAPTION.SENDERID%TYPE := :NEW.SENDERID;
  new$SENDERRECORDID EXECUTIONDOCUMENTSCAPTION.SENDERRECORDID%TYPE := :NEW.SENDERRECORDID;
  new$REVIEWNOTE EXECUTIONDOCUMENTSCAPTION.REVIEWNOTE%TYPE := :NEW.REVIEWNOTE;
  new$DOCSTATEREF EXECUTIONDOCUMENTSCAPTION.DOCSTATEREF%TYPE := :NEW.DOCSTATEREF;
  new$RVERSION EXECUTIONDOCUMENTSCAPTION.RVERSION%TYPE := :NEW.RVERSION;
  new$EXECDOCFINSUMMA EXECUTIONDOCUMENTSCAPTION.EXECDOCFINSUMMA%TYPE := :NEW.EXECDOCFINSUMMA;
  new$FACT EXECUTIONDOCUMENTSCAPTION.FACT%TYPE := :NEW.FACT;
  new$DOCNUMBER EXECUTIONDOCUMENTSCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  new$SENDERIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERIDKEY%TYPE := :NEW.SENDERIDKEY;
  new$SENDERRECORDIDKEY EXECUTIONDOCUMENTSCAPTION.SENDERRECORDIDKEY%TYPE := :NEW.SENDERRECORDIDKEY;
  new$REALID EXECUTIONDOCUMENTSCAPTION.REALID%TYPE := :NEW.REALID;
  new$INNERNUMBER EXECUTIONDOCUMENTSCAPTION.INNERNUMBER%TYPE := :NEW.INNERNUMBER;
  new$ADJUSTMENTREF EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTREF%TYPE := :NEW.ADJUSTMENTREF;
  new$ADJUSTMENTNUMBER EXECUTIONDOCUMENTSCAPTION.ADJUSTMENTNUMBER%TYPE := :NEW.ADJUSTMENTNUMBER;
  new$ACCEPTED EXECUTIONDOCUMENTSCAPTION.ACCEPTED%TYPE := :NEW.ACCEPTED;
  new$LASTACCEPTED EXECUTIONDOCUMENTSCAPTION.LASTACCEPTED%TYPE := :NEW.LASTACCEPTED;
  new$LASTADJUSTMENT EXECUTIONDOCUMENTSCAPTION.LASTADJUSTMENT%TYPE := :NEW.LASTADJUSTMENT;
  new$AGREEMENTREF EXECUTIONDOCUMENTSCAPTION.AGREEMENTREF%TYPE := :NEW.AGREEMENTREF;
  new$NOTE EXECUTIONDOCUMENTSCAPTION.NOTE%TYPE := :NEW.NOTE;
--
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  CntAgr$ NUMBER(10);
  CntStep$ NUMBER(10);
  agr_accepted$ NUMBER(10);
  agr_acceptdate$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_EXECDOCCAPTION_BU)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$DocType is null) then 
    new$DocType := 0;
  END IF;
  if (new$Summa is null) then 
    new$Summa := 0;
  END IF;
  if (new$ExecDocFinSumma is null) then 
    new$ExecDocFinSumma := 0;  
  END IF;
  if (new$FacialAcc_Cls is null) then 
    new$FacialAcc_Cls := 0;
  END IF;
  if (new$RegistrationType is null) then 
    new$RegistrationType := 0;
  END IF;
  if (new$Fact is null) then 
    new$Fact := 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 CNT$1
      from ExecutionDocumentsDetail
      where 
      (                   RecordIndex = :old.Id
      ) AND (ROWNUM = 1)                ;
      if ((CNT$1<> 0)         ) then
        RaiseException('Ex_CantModufyBudget');
      END IF;
      SELECT COUNT(                   Id
      ) INTO CNT$2
      from PaymentSchedule
      where
      (                   ExecutionRef = :old.Id
      ) AND (ROWNUM = 1)                ;
      if ((CNT$2<> 0)         ) then
        RaiseException('Ex_CantModufyBudget');    
      END IF;
    END IF;
  END IF;
  /* если номер цепочки не заполнен, то берем его из предыдущей версии записи */
  if (new$InnerNumber is null) then
    new$InnerNumber := :old.InnerNumber;
  END IF;
  /* cледим, чтобы никто не поменял внутреннюю нумерацию и ссылку на предыдущую */
  /* версию, иначе все накернится */
  if (new$InnerNumber <> :old.InnerNumber or
  new$AdjustmentRef <> :old.AdjustmentRef or
  new$AdjustmentNumber <> :old.AdjustmentNumber) then
    RaiseException('EX_Agr_ChangeInnerNums');
  END IF;
  /* заполняем внутренний номер договора по id */  
  new$agreementinnernumber := null;
  if (new$agreementref is not null) then
    BEGIN
      select
      innernumber
      into new$agreementinnernumber     from agreements
      where
      id = new$agreementref
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BU_5 (TR_EXECDOCCAPTION_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_EXECDOCCAPTION_BU_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* отменять отклонение ДИ нельзя */
  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) then 
    /* менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (:old.LastAdjustment = 1) then
      new$LastAccepted := 1;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');
    END IF;
  END IF;
      
  /* если отменили принятие ДИ, тогда необходимо снять флаг LastAccepted*/
  if (:old.AcceptDate is not null and :old.Accepted = 1 and new$AcceptDate is null) then
    /* менять LastAccepted таким образом можно только у последней записи в цепочке*/
    if (:old.LastAdjustment = 1) then
      new$LastAccepted := 0;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');  
    END IF;
  END IF;
      
  /* если отклонили ДИ, тогда необходимо скинуть флаги LastAdjustment и LastAccepted */
  if (new$AcceptDate is not null and new$Accepted = 0 and (:old.AcceptDate is null or :old.Accepted = 1)) then
    if (:old.LastAdjustment = 1) then
      new$LastAdjustment := 0;
      new$LastAccepted := 0;
          
    else
      RaiseException('EX_ExecDoc_ChangeStateAdjust');
    END IF;
    SELECT COUNT(                 Id
    ) INTO CNT$1
    from ExecutionDocumentsCaption
    where
    (                 InnerNumber = new$InnerNumber and AdjustmentNumber > 0
    ) AND (ROWNUM = 1)              ;
    /* нельзя отклонять первую версию в цепочке при наличии уточнений */
    if (new$AdjustmentNumber = 0 and 
    (CNT$1<> 0)       ) then
      RaiseException('EX_ExecDoc_PrimaryAgrHasNotify');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_40 (tr_execdoccaption_bu_40)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  if ((:old.AcceptDate is not null) and (new$AcceptDate is null)) then
    select count(ID) into CntAgr$ from Agreements where (CloseDoc = :old.ID) ;
    select count(ID) into CntStep$ from AgreementSteps where (CloseDoc = :old.ID) ;
    if ((CntAgr$ > 0) or (CntStep$ > 0)) then
      RaiseException('ex_CannotUpdateCloseDoc');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_60 (tr_execdoccaption_bu_60)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if (new$agreementinnernumber is not null) then
    BEGIN
      /* выбираем информацию о принятии из первой версии договора, т.к. вся
          цепочка договоров будет отклонена, если отклонена первая версия, и в цепочке
          будет принятый договор, если принята первая версия */
      select accepted, acceptdate     into
      agr_accepted$, agr_acceptdate$ from agreements
      where
      innernumber = new$agreementinnernumber and adjustmentnumber = 0
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    /* если в неотклоненном документе указан отклоненный договор */
    if (new$acceptdate is null and agr_accepted$ = 0 and agr_acceptdate$ is not null) then
      RaiseException('EX_Agr_Rejected');
    END IF;
    /* если принятый документ ссылается на непринятый договор */
    if (new$accepted = 1 and new$acceptdate is not null and
    (agr_accepted$ = 0 or agr_acceptdate$ is null)) then
      RaiseException('EX_Agr_NotAccepted');  
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_200 (TR_EXECDOCCAPTION_BU_200)
-- Create 04.10.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_EDCAPTION_BU_700)
-- Create 14.10.2004
-- - - - - - - - - - - - -

   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_EXECUTIONDOCUMENTSCAPTION SET
    ID = new$ID,
    DOCTYPE = new$DOCTYPE,
    DOCUMENTDATE = new$DOCUMENTDATE,
    ACCEPTDATE = new$ACCEPTDATE,
    SUPPLIERACC_REF = new$SUPPLIERACC_REF,
    SUMMA = new$SUMMA,
    CREATERUSER = new$CREATERUSER,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    UPDATERUSER = new$UPDATERUSER,
    BUDGETREF = new$BUDGETREF,
    STEPNUMBER = new$STEPNUMBER,
    FACIALACC_CLS = new$FACIALACC_CLS,
    RECIPIENT_REF = new$RECIPIENT_REF,
    REGISTRATIONTYPE = new$REGISTRATIONTYPE,
    REESTRNUMBER = new$REESTRNUMBER,
    AGREEMENTINNERNUMBER = new$AGREEMENTINNERNUMBER,
    REJECTCLS = new$REJECTCLS,
    REJECTCAUSE = new$REJECTCAUSE,
    CRYPTOSTATUS = new$CRYPTOSTATUS,
    SENDERID = new$SENDERID,
    SENDERRECORDID = new$SENDERRECORDID,
    REVIEWNOTE = new$REVIEWNOTE,
    DOCSTATEREF = new$DOCSTATEREF,
    RVERSION = new$RVERSION,
    EXECDOCFINSUMMA = new$EXECDOCFINSUMMA,
    FACT = new$FACT,
    DOCNUMBER = new$DOCNUMBER,
    SENDERIDKEY = new$SENDERIDKEY,
    SENDERRECORDIDKEY = new$SENDERRECORDIDKEY,
    REALID = new$REALID,
    INNERNUMBER = new$INNERNUMBER,
    ADJUSTMENTREF = new$ADJUSTMENTREF,
    ADJUSTMENTNUMBER = new$ADJUSTMENTNUMBER,
    ACCEPTED = new$ACCEPTED,
    LASTACCEPTED = new$LASTACCEPTED,
    LASTADJUSTMENT = new$LASTADJUSTMENT,
    AGREEMENTREF = new$AGREEMENTREF,
    NOTE = new$NOTE
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_0 (TR_ExecDocCaption_AU)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AU_30 (TR_EXECDOCCAPTION_AU_30)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if ((new$DocStateRef is null) 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 ExecutionRef=new$ID;
  END IF;

-- - - - - - - - - - - - -
-- AU_500 (TR_EXECDOCCAPTION_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

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

END;
/
commit work 
/
ALTER TRIGGER TR_EXECDOCCAPTION_BU_500 ENABLE
/
ALTER TRIGGER TR_AGREEMENTS_BU_500 ENABLE
/
commit work
/

-- #########################################################
-- #########################################################
-- alter_dbusers_addEmailNote2.sql
-- #########################################################
-- #########################################################

/* Добавление полей примечания и email в DBUSERS*/
ALTER TABLE TB_DBUSERS ADD (
  NOTE2 VARCHAR2(255)
)
/

CREATE OR REPLACE VIEW DBUSERS (
  ID,
  USERNAME,
  FIRSTNAME,
  MIDDLENAME,
  LASTNAME,
  NOTE,
  PHONE,
  DESCRIPTION,
  DEPARTMENTCLS,
  REMOTECLIENTREF,
  REMOTEID,
  CREATEDATE,
  UPDATEDATE,
  CRYPTOPARAMS,
  CRYPTOID,
  ORG_REF,
  NOTE2)
AS
  SELECT
    ID,
    USERNAME,
    FIRSTNAME,
    MIDDLENAME,
    LASTNAME,
    NOTE,
    PHONE,
    DESCRIPTION,
    DEPARTMENTCLS,
    REMOTECLIENTREF,
    REMOTEID,
    CREATEDATE,
    UPDATEDATE,
    CRYPTOPARAMS,
    CRYPTOID,
    ORG_REF,
    NOTE2
  FROM TB_DBUSERS
/

CREATE OR REPLACE TRIGGER TR_DBUsers_II
  INSTEAD OF INSERT
  ON DBUsers
  FOR EACH ROW
DECLARE
  new$ID DBUsers.ID%TYPE := :NEW.ID;
  new$USERNAME DBUsers.USERNAME%TYPE := :NEW.USERNAME;
  new$FIRSTNAME DBUsers.FIRSTNAME%TYPE := :NEW.FIRSTNAME;
  new$MIDDLENAME DBUsers.MIDDLENAME%TYPE := :NEW.MIDDLENAME;
  new$LASTNAME DBUsers.LASTNAME%TYPE := :NEW.LASTNAME;
  new$NOTE DBUsers.NOTE%TYPE := :NEW.NOTE;
  new$PHONE DBUsers.PHONE%TYPE := :NEW.PHONE;
  new$DESCRIPTION DBUsers.DESCRIPTION%TYPE := :NEW.DESCRIPTION;
  new$DEPARTMENTCLS DBUsers.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$REMOTECLIENTREF DBUsers.REMOTECLIENTREF%TYPE := :NEW.REMOTECLIENTREF;
  new$REMOTEID DBUsers.REMOTEID%TYPE := :NEW.REMOTEID;
  new$CREATEDATE DBUsers.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DBUsers.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CRYPTOPARAMS DBUsers.CRYPTOPARAMS%TYPE := :NEW.CRYPTOPARAMS;
  new$CRYPTOID DBUsers.CRYPTOID%TYPE := :NEW.CRYPTOID;
  new$ORG_REF DBUsers.ORG_REF%TYPE := :NEW.ORG_REF;
  new$NOTE2 DBUsers.NOTE2%TYPE := :NEW.NOTE2;
--
  cGroupID$ NUMBER(10);
  acc$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DBUSERS_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  new$UserName := Upper(new$UserName);
  if (new$RemoteClientRef is null) then 
    new$RemoteID := -1;
     
  else 
    new$RemoteID := new$RemoteClientRef;
  END IF;
  if (new$Org_Ref is null) then
    GetIntConst(-1, 2,acc$);
    BEGIN
      select
      o.id
      into
      new$Org_Ref    from
      organizations o
      left join org_accounts oa on (oa.org_ref = o.id)
      where
      (oa.id = acc$)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (new$Org_Ref is null) then
      new$Org_Ref := 0;
     
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DBUSERS_BI_500)
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_DBUsers (
    ID,
    USERNAME,
    FIRSTNAME,
    MIDDLENAME,
    LASTNAME,
    NOTE,
    PHONE,
    DESCRIPTION,
    DEPARTMENTCLS,
    REMOTECLIENTREF,
    REMOTEID,
    CREATEDATE,
    UPDATEDATE,
    CRYPTOPARAMS,
    CRYPTOID,
    ORG_REF,
    NOTE2
  ) VALUES (
    new$ID,
    new$USERNAME,
    new$FIRSTNAME,
    new$MIDDLENAME,
    new$LASTNAME,
    new$NOTE,
    new$PHONE,
    new$DESCRIPTION,
    new$DEPARTMENTCLS,
    new$REMOTECLIENTREF,
    new$REMOTEID,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$CRYPTOPARAMS,
    new$CRYPTOID,
    new$ORG_REF,
    new$NOTE2);

-- - - - - - - - - - - - -
-- AI_0 (TR_DBUSERS_AI)
-- Last update 30.03.2006
-- - - - - - - - - - - - -

 insert into UsersInGroups (UserRef, GroupRef)
      values (new$id, 0);

 /* добавляем пользователя в ФинОрган */
 if (new$RemoteID = -1) then
     /* Выбираем ID ФинОргана */
     select max(ID) into cGroupID$ from DBGroups where (Name = 'ФинОрган');
     if (not (cGroupID$ is null)) then
     	insert into UsersInGroups (UserRef, GroupRef)
     	values (new$ID, cGroupID$);
     end if;
 /* иначе добавляем в УРМ */
 else
 	 /* Выбираем ID группы УРМ */
     select max(ID) into cGroupID$ from DBGroups where (Name = 'УРМ');
     if (not (cGroupID$ is null)) then
     	insert into UsersInGroups (UserRef, GroupRef)
     	values (new$ID, cGroupID$);
     end if;
 end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_DBUSERS_AI_500)
-- Last update 18.02.2004
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_DBUsers_IU
  INSTEAD OF UPDATE
  ON DBUsers
  FOR EACH ROW
DECLARE
  new$ID DBUsers.ID%TYPE := :NEW.ID;
  new$USERNAME DBUsers.USERNAME%TYPE := :NEW.USERNAME;
  new$FIRSTNAME DBUsers.FIRSTNAME%TYPE := :NEW.FIRSTNAME;
  new$MIDDLENAME DBUsers.MIDDLENAME%TYPE := :NEW.MIDDLENAME;
  new$LASTNAME DBUsers.LASTNAME%TYPE := :NEW.LASTNAME;
  new$NOTE DBUsers.NOTE%TYPE := :NEW.NOTE;
  new$PHONE DBUsers.PHONE%TYPE := :NEW.PHONE;
  new$DESCRIPTION DBUsers.DESCRIPTION%TYPE := :NEW.DESCRIPTION;
  new$DEPARTMENTCLS DBUsers.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$REMOTECLIENTREF DBUsers.REMOTECLIENTREF%TYPE := :NEW.REMOTECLIENTREF;
  new$REMOTEID DBUsers.REMOTEID%TYPE := :NEW.REMOTEID;
  new$CREATEDATE DBUsers.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DBUsers.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CRYPTOPARAMS DBUsers.CRYPTOPARAMS%TYPE := :NEW.CRYPTOPARAMS;
  new$CRYPTOID DBUsers.CRYPTOID%TYPE := :NEW.CRYPTOID;
  new$ORG_REF DBUsers.ORG_REF%TYPE := :NEW.ORG_REF;
  new$NOTE2 DBUsers.NOTE2%TYPE := :NEW.NOTE2;
--
  cGroupID1$ NUMBER(10);
  acc$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_DBUSERS_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  new$UserName := Upper(new$UserName);
  if (new$RemoteClientRef is null) then
    new$RemoteID := -1;
     
  else 
    new$RemoteID := new$RemoteClientRef;
  END IF;
  /* переводим пользователя в группу ФинОрган, если раньше он был в УРМ */
  if ((:old.RemoteID > 0) and (new$RemoteID = -1)) then
    select max(ID)       into cGroupID1$ from DBGroups where (Name = 'ФинОрган')
    ;
    if (not (cGroupID1$ is null)) then
      update UsersInGroups uig set uig.GroupRef = cGroupID1$

      where (uig.UserRef = :old.ID) and
      ((select Name from DBGroups dbg where dbg.ID = uig.GroupRef) = 'УРМ');
     
    END IF;
  END IF;
  /* переводим пользователя в группу УРМ, если раньше он был в ФинОргане */
  if ((:old.RemoteID = -1) and (new$RemoteID > 0)) then
    select max(ID)       into cGroupID1$ from DBGroups where (Name = 'УРМ')
    ;
    if (not (cGroupID1$ is null)) then
      update UsersInGroups uig set uig.GroupRef = cGroupID1$

      where (uig.UserRef = :old.ID) and
      ((select Name from DBGroups dbg where dbg.ID = uig.GroupRef) = 'ФинОрган');
     
    END IF;
  END IF;
  if (new$Org_Ref is null) then
    GetIntConst(-1, 2,acc$);
    BEGIN
      select
      o.id
      into
      new$Org_Ref    from
      organizations o
      left join org_accounts oa on (oa.org_ref = o.id)
      where
      (oa.id = acc$)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (new$Org_Ref is null) then
      new$Org_Ref := 0;
     
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_DBUSERS_BU_1)
-- Last update 30.03.2006
-- - - - - - - - - - - - -

-- Запрет изменения пользователя SYSDBA
 if ((:old.id = 0) and (new$UserName <> :old.UserName)) then
-- exception ex_CantUpdateThis;
   RaiseException('EX_CANTUPDATETHIS');
 end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_DBUsers SET
    ID = new$ID,
    USERNAME = new$USERNAME,
    FIRSTNAME = new$FIRSTNAME,
    MIDDLENAME = new$MIDDLENAME,
    LASTNAME = new$LASTNAME,
    NOTE = new$NOTE,
    PHONE = new$PHONE,
    DESCRIPTION = new$DESCRIPTION,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    REMOTECLIENTREF = new$REMOTECLIENTREF,
    REMOTEID = new$REMOTEID,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    CRYPTOPARAMS = new$CRYPTOPARAMS,
    CRYPTOID = new$CRYPTOID,
    ORG_REF = new$ORG_REF,
    NOTE2 = new$NOTE2
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_500 (TR_DBUSERS_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_DBUsers_ID
  INSTEAD OF DELETE
  ON DBUsers
  FOR EACH ROW
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_500 (TR_DBUSERS_AD_500)
-- - - - - - - - - - - - -

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

END;
/
ALTER TABLE TB_DBUSERS ADD (
  EmailAddress VARCHAR2(255)
)
/

CREATE OR REPLACE VIEW DBUSERS (
  ID,
  USERNAME,
  FIRSTNAME,
  MIDDLENAME,
  LASTNAME,
  NOTE,
  PHONE,
  DESCRIPTION,
  DEPARTMENTCLS,
  REMOTECLIENTREF,
  REMOTEID,
  CREATEDATE,
  UPDATEDATE,
  CRYPTOPARAMS,
  CRYPTOID,
  ORG_REF,
  NOTE2,
  EMAILADDRESS)
AS
  SELECT
    ID,
    USERNAME,
    FIRSTNAME,
    MIDDLENAME,
    LASTNAME,
    NOTE,
    PHONE,
    DESCRIPTION,
    DEPARTMENTCLS,
    REMOTECLIENTREF,
    REMOTEID,
    CREATEDATE,
    UPDATEDATE,
    CRYPTOPARAMS,
    CRYPTOID,
    ORG_REF,
    NOTE2,
    EMAILADDRESS
  FROM TB_DBUSERS
/

CREATE OR REPLACE TRIGGER TR_DBUsers_II
  INSTEAD OF INSERT
  ON DBUsers
  FOR EACH ROW
DECLARE
  new$ID DBUsers.ID%TYPE := :NEW.ID;
  new$USERNAME DBUsers.USERNAME%TYPE := :NEW.USERNAME;
  new$FIRSTNAME DBUsers.FIRSTNAME%TYPE := :NEW.FIRSTNAME;
  new$MIDDLENAME DBUsers.MIDDLENAME%TYPE := :NEW.MIDDLENAME;
  new$LASTNAME DBUsers.LASTNAME%TYPE := :NEW.LASTNAME;
  new$NOTE DBUsers.NOTE%TYPE := :NEW.NOTE;
  new$PHONE DBUsers.PHONE%TYPE := :NEW.PHONE;
  new$DESCRIPTION DBUsers.DESCRIPTION%TYPE := :NEW.DESCRIPTION;
  new$DEPARTMENTCLS DBUsers.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$REMOTECLIENTREF DBUsers.REMOTECLIENTREF%TYPE := :NEW.REMOTECLIENTREF;
  new$REMOTEID DBUsers.REMOTEID%TYPE := :NEW.REMOTEID;
  new$CREATEDATE DBUsers.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DBUsers.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CRYPTOPARAMS DBUsers.CRYPTOPARAMS%TYPE := :NEW.CRYPTOPARAMS;
  new$CRYPTOID DBUsers.CRYPTOID%TYPE := :NEW.CRYPTOID;
  new$ORG_REF DBUsers.ORG_REF%TYPE := :NEW.ORG_REF;
  new$NOTE2 DBUsers.NOTE2%TYPE := :NEW.NOTE2;
  new$EMAILADDRESS DBUsers.EMAILADDRESS%TYPE := :NEW.EMAILADDRESS;
--
  cGroupID$ NUMBER(10);
  acc$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DBUSERS_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  new$UserName := Upper(new$UserName);
  if (new$RemoteClientRef is null) then 
    new$RemoteID := -1;
     
  else 
    new$RemoteID := new$RemoteClientRef;
  END IF;
  if (new$Org_Ref is null) then
    GetIntConst(-1, 2,acc$);
    BEGIN
      select
      o.id
      into
      new$Org_Ref    from
      organizations o
      left join org_accounts oa on (oa.org_ref = o.id)
      where
      (oa.id = acc$)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (new$Org_Ref is null) then
      new$Org_Ref := 0;
     
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DBUSERS_BI_500)
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_DBUsers (
    ID,
    USERNAME,
    FIRSTNAME,
    MIDDLENAME,
    LASTNAME,
    NOTE,
    PHONE,
    DESCRIPTION,
    DEPARTMENTCLS,
    REMOTECLIENTREF,
    REMOTEID,
    CREATEDATE,
    UPDATEDATE,
    CRYPTOPARAMS,
    CRYPTOID,
    ORG_REF,
    NOTE2,
    EMAILADDRESS
  ) VALUES (
    new$ID,
    new$USERNAME,
    new$FIRSTNAME,
    new$MIDDLENAME,
    new$LASTNAME,
    new$NOTE,
    new$PHONE,
    new$DESCRIPTION,
    new$DEPARTMENTCLS,
    new$REMOTECLIENTREF,
    new$REMOTEID,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$CRYPTOPARAMS,
    new$CRYPTOID,
    new$ORG_REF,
    new$NOTE2,
    new$EMAILADDRESS);

-- - - - - - - - - - - - -
-- AI_0 (TR_DBUSERS_AI)
-- Last update 30.03.2006
-- - - - - - - - - - - - -

 insert into UsersInGroups (UserRef, GroupRef)
      values (new$id, 0);

 /* добавляем пользователя в ФинОрган */
 if (new$RemoteID = -1) then
     /* Выбираем ID ФинОргана */
     select max(ID) into cGroupID$ from DBGroups where (Name = 'ФинОрган');
     if (not (cGroupID$ is null)) then
     	insert into UsersInGroups (UserRef, GroupRef)
     	values (new$ID, cGroupID$);
     end if;
 /* иначе добавляем в УРМ */
 else
 	 /* Выбираем ID группы УРМ */
     select max(ID) into cGroupID$ from DBGroups where (Name = 'УРМ');
     if (not (cGroupID$ is null)) then
     	insert into UsersInGroups (UserRef, GroupRef)
     	values (new$ID, cGroupID$);
     end if;
 end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_DBUSERS_AI_500)
-- Last update 18.02.2004
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_DBUsers_IU
  INSTEAD OF UPDATE
  ON DBUsers
  FOR EACH ROW
DECLARE
  new$ID DBUsers.ID%TYPE := :NEW.ID;
  new$USERNAME DBUsers.USERNAME%TYPE := :NEW.USERNAME;
  new$FIRSTNAME DBUsers.FIRSTNAME%TYPE := :NEW.FIRSTNAME;
  new$MIDDLENAME DBUsers.MIDDLENAME%TYPE := :NEW.MIDDLENAME;
  new$LASTNAME DBUsers.LASTNAME%TYPE := :NEW.LASTNAME;
  new$NOTE DBUsers.NOTE%TYPE := :NEW.NOTE;
  new$PHONE DBUsers.PHONE%TYPE := :NEW.PHONE;
  new$DESCRIPTION DBUsers.DESCRIPTION%TYPE := :NEW.DESCRIPTION;
  new$DEPARTMENTCLS DBUsers.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$REMOTECLIENTREF DBUsers.REMOTECLIENTREF%TYPE := :NEW.REMOTECLIENTREF;
  new$REMOTEID DBUsers.REMOTEID%TYPE := :NEW.REMOTEID;
  new$CREATEDATE DBUsers.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DBUsers.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CRYPTOPARAMS DBUsers.CRYPTOPARAMS%TYPE := :NEW.CRYPTOPARAMS;
  new$CRYPTOID DBUsers.CRYPTOID%TYPE := :NEW.CRYPTOID;
  new$ORG_REF DBUsers.ORG_REF%TYPE := :NEW.ORG_REF;
  new$NOTE2 DBUsers.NOTE2%TYPE := :NEW.NOTE2;
  new$EMAILADDRESS DBUsers.EMAILADDRESS%TYPE := :NEW.EMAILADDRESS;
--
  cGroupID1$ NUMBER(10);
  acc$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_DBUSERS_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  new$UserName := Upper(new$UserName);
  if (new$RemoteClientRef is null) then
    new$RemoteID := -1;
     
  else 
    new$RemoteID := new$RemoteClientRef;
  END IF;
  /* переводим пользователя в группу ФинОрган, если раньше он был в УРМ */
  if ((:old.RemoteID > 0) and (new$RemoteID = -1)) then
    select max(ID)       into cGroupID1$ from DBGroups where (Name = 'ФинОрган')
    ;
    if (not (cGroupID1$ is null)) then
      update UsersInGroups uig set uig.GroupRef = cGroupID1$

      where (uig.UserRef = :old.ID) and
      ((select Name from DBGroups dbg where dbg.ID = uig.GroupRef) = 'УРМ');
     
    END IF;
  END IF;
  /* переводим пользователя в группу УРМ, если раньше он был в ФинОргане */
  if ((:old.RemoteID = -1) and (new$RemoteID > 0)) then
    select max(ID)       into cGroupID1$ from DBGroups where (Name = 'УРМ')
    ;
    if (not (cGroupID1$ is null)) then
      update UsersInGroups uig set uig.GroupRef = cGroupID1$

      where (uig.UserRef = :old.ID) and
      ((select Name from DBGroups dbg where dbg.ID = uig.GroupRef) = 'ФинОрган');
     
    END IF;
  END IF;
  if (new$Org_Ref is null) then
    GetIntConst(-1, 2,acc$);
    BEGIN
      select
      o.id
      into
      new$Org_Ref    from
      organizations o
      left join org_accounts oa on (oa.org_ref = o.id)
      where
      (oa.id = acc$)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (new$Org_Ref is null) then
      new$Org_Ref := 0;
     
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_DBUSERS_BU_1)
-- Last update 30.03.2006
-- - - - - - - - - - - - -

-- Запрет изменения пользователя SYSDBA
 if ((:old.id = 0) and (new$UserName <> :old.UserName)) then
-- exception ex_CantUpdateThis;
   RaiseException('EX_CANTUPDATETHIS');
 end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_DBUsers SET
    ID = new$ID,
    USERNAME = new$USERNAME,
    FIRSTNAME = new$FIRSTNAME,
    MIDDLENAME = new$MIDDLENAME,
    LASTNAME = new$LASTNAME,
    NOTE = new$NOTE,
    PHONE = new$PHONE,
    DESCRIPTION = new$DESCRIPTION,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    REMOTECLIENTREF = new$REMOTECLIENTREF,
    REMOTEID = new$REMOTEID,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    CRYPTOPARAMS = new$CRYPTOPARAMS,
    CRYPTOID = new$CRYPTOID,
    ORG_REF = new$ORG_REF,
    NOTE2 = new$NOTE2,
    EMAILADDRESS = new$EMAILADDRESS
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_500 (TR_DBUSERS_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_DBUsers_ID
  INSTEAD OF DELETE
  ON DBUsers
  FOR EACH ROW
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_500 (TR_DBUSERS_AD_500)
-- - - - - - - - - - - - -

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

END;
/
commit work 
/


-- #########################################################
-- #########################################################
-- Alter_TenderCaption_DocNumber255.sql
-- #########################################################
-- #########################################################

/* Изменение размера поля TenderCaption.DocNumber с 20 до 255 знаков */
ALTER TRIGGER TR_TENDERCAPTION_BU_500 DISABLE
/
ALTER TABLE TB_TenderCaption ADD (
  tmpDocNumber VARCHAR2(255)
)
/

CREATE OR REPLACE VIEW TenderCaption (
  ID,
  BUDGETREF,
  DOCNUMBER,
  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,
  TMPDOCNUMBER)
AS
  SELECT
    ID,
    BUDGETREF,
    DOCNUMBER,
    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,
    TMPDOCNUMBER
  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)
-- - - - - - - - - - - - -

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

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$DOCNUMBER TENDERCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  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$TMPDOCNUMBER TENDERCAPTION.TMPDOCNUMBER%TYPE := :NEW.TMPDOCNUMBER;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  CurVal$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_TENDERCAPTION_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$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;

-- - - - - - - - - - - - -
-- 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,
    DOCNUMBER,
    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,
    TMPDOCNUMBER
  ) VALUES (
    new$ID,
    new$BUDGETREF,
    new$DOCNUMBER,
    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$TMPDOCNUMBER);

-- - - - - - - - - - - - -
-- 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$DOCNUMBER TENDERCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
  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$TMPDOCNUMBER TENDERCAPTION.TMPDOCNUMBER%TYPE := :NEW.TMPDOCNUMBER;
--
  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,
    DOCNUMBER = new$DOCNUMBER,
    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,
    TMPDOCNUMBER = new$TMPDOCNUMBER
  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;
/
update TenderCaption set tmpDocNumber = DocNumber
/
ALTER TABLE TB_TenderCaption DROP (DocNumber)
/

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,
  TMPDOCNUMBER)
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,
    TMPDOCNUMBER
  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)
-- - - - - - - - - - - - -

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

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$TMPDOCNUMBER TENDERCAPTION.TMPDOCNUMBER%TYPE := :NEW.TMPDOCNUMBER;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  CurVal$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_TENDERCAPTION_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$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;

-- - - - - - - - - - - - -
-- 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,
    TMPDOCNUMBER
  ) 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$TMPDOCNUMBER);

-- - - - - - - - - - - - -
-- 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$TMPDOCNUMBER TENDERCAPTION.TMPDOCNUMBER%TYPE := :NEW.TMPDOCNUMBER;
--
  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,
    TMPDOCNUMBER = new$TMPDOCNUMBER
  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 TABLE TB_TenderCaption ADD (
  DocNumber VARCHAR2(255)
)
/

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,
  TMPDOCNUMBER,
  DOCNUMBER)
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,
    TMPDOCNUMBER,
    DOCNUMBER
  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)
-- - - - - - - - - - - - -

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

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$TMPDOCNUMBER TENDERCAPTION.TMPDOCNUMBER%TYPE := :NEW.TMPDOCNUMBER;
  new$DOCNUMBER TENDERCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  CurVal$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_TENDERCAPTION_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$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;

-- - - - - - - - - - - - -
-- 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,
    TMPDOCNUMBER,
    DOCNUMBER
  ) 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$TMPDOCNUMBER,
    new$DOCNUMBER);

-- - - - - - - - - - - - -
-- 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$TMPDOCNUMBER TENDERCAPTION.TMPDOCNUMBER%TYPE := :NEW.TMPDOCNUMBER;
  new$DOCNUMBER TENDERCAPTION.DOCNUMBER%TYPE := :NEW.DOCNUMBER;
--
  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,
    TMPDOCNUMBER = new$TMPDOCNUMBER,
    DOCNUMBER = new$DOCNUMBER
  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;
/
update TenderCaption set DocNumber = tmpDocNumber
/
ALTER TABLE TB_TenderCaption DROP (tmpDocNumber)
/

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)
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
  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)
-- - - - - - - - - - - - -

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

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;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  CurVal$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_TENDERCAPTION_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$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;

-- - - - - - - - - - - - -
-- 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
  ) 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);

-- - - - - - - - - - - - -
-- 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;
--
  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
  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;
/
ALTER TRIGGER TR_TENDERCAPTION_BU_500 ENABLE
/
commit work
/

-- #########################################################
-- #########################################################
-- alter_GroupWorkplaces_add_FK_WP.sql
-- #########################################################
-- #########################################################

/* Добавление FK из GroupWorkplaces в Workplaces */
delete from GroupsWorkplaces gw
where
  not exists(
    select * from Workplaces w where gw.WorkplaceRef = w.id
  )
/
commit work 
/
ALTER TABLE GROUPSWORKPLACES ADD (
  CONSTRAINT FK_GW_WORKPLACES FOREIGN KEY (WORKPLACEREF) REFERENCES WORKPLACES(ID) 
)
/
CREATE INDEX FK_GW_WORKPLACES ON GROUPSWORKPLACES(WORKPLACEREF)
/
commit work 
/

-- #########################################################
-- #########################################################
-- Add_CreateUser_UpdateUser.sql
-- #########################################################
-- #########################################################

ALTER TABLE TB_INNERFINSOURCE ADD (
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/

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)
AS
  SELECT
    ID,
    CREATEDATE,
    UPDATEDATE,
    DIRECTION,
    KVSR,
    DESCRIPTIONCODE,
    MAINDESCRIPTIONCODE,
    ITEMCODE,
    PROGRAMCODE,
    KESR,
    FINSOURCEVALUE,
    UNIONFLAG,
    REMOTEFLAG,
    BUDGETREF,
    DELETEDATE,
    NAME,
    STARTDATE,
    SHORTNAME,
    CLSASPECT,
    CREATERUSER,
    UPDATERUSER
  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;
--
  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);
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;

  -- Для внутренних источников направление определяется по коду операции ГС
  --   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)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- 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
  ) 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);

-- - - - - - - - - - - - -
-- 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)
        values (0, new$DescriptionCode, new$KESR, new$Name, new$ShortName, new$CLSAspect, new$RemoteFlag, new$direction);
	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;
--
  CNT$ NUMBER(10);
  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);
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;
  /* Для внутренних источников направление определяется по коду операции ГС
       Погашение – это кода с косгу=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
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_100 (TR_INNERFINSOURCE_AU_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)
        values (0, new$DescriptionCode, new$KESR, new$Name, new$ShortName, new$CLSAspect, new$RemoteFlag);
        end if;         
  else
      -- Если КВСР = 0, то нужно обновить связанные записи с таким же кодом, но не нулевым КВСР
      update InnerFinSource ifs1 set
        name = new$name,
        ShortName = new$ShortName
      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);
          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;
/
commit work
/
-- ALTER TRIGGER tr_innerfinsource_au_100
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;
--
  CNT$ NUMBER(10);
  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);
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;
  /* Для внутренних источников направление определяется по коду операции ГС
       Погашение – это кода с косгу=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
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_100 (TR_INNERFINSOURCE_AU_100)
-- Last update 02.04.2010
-- - - - - - - - - - - - -
  NULL;
--   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)
--         values (0, new$DescriptionCode, new$KESR, new$Name, new$ShortName, new$CLSAspect, new$RemoteFlag);
--         end if;         
--   else
--       -- Если КВСР = 0, то нужно обновить связанные записи с таким же кодом, но не нулевым КВСР
--       update InnerFinSource ifs1 set
--         name = new$name,
--         ShortName = new$ShortName
--       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);
--           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;
/
UPDATE INNERFINSOURCE
  SET CREATERUSER = user,
      UPDATERUSER = user
/
commit work
/
-- ALTER TRIGGER tr_innerfinsource_au_100
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;
--
  CNT$ NUMBER(10);
  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);
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;
  /* Для внутренних источников направление определяется по коду операции ГС
       Погашение – это кода с косгу=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
  WHERE ID = :OLD.ID;

-- - - - - - - - - - - - -
-- AU_100 (TR_INNERFINSOURCE_AU_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)
        values (0, new$DescriptionCode, new$KESR, new$Name, new$ShortName, new$CLSAspect, new$RemoteFlag);
        end if;         
  else
      -- Если КВСР = 0, то нужно обновить связанные записи с таким же кодом, но не нулевым КВСР
      update InnerFinSource ifs1 set
        name = new$name,
        ShortName = new$ShortName
      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);
          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_INNERFINSOURCE_BI_500
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;
--
  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);
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;

  -- Для внутренних источников направление определяется по коду операции ГС
  --   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
  ) 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);

-- - - - - - - - - - - - -
-- 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)
        values (0, new$DescriptionCode, new$KESR, new$Name, new$ShortName, new$CLSAspect, new$RemoteFlag, new$direction);
	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;
/
-- ALTER TRIGGER TR_INNERFINSOURCE_BU_500
CREATE OR REPLACE TRIGGER TR_INNERFINSOURCE_BU_500
  BEFORE UPDATE
  ON TB_INNERFINSOURCE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_INNERFINSOURCE_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
ALTER TRIGGER TR_INNERFINSOURCE_BU_500 ENABLE
/
commit work
/

ALTER TABLE TB_INNERFINSOURCE MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE TB_INNERFINSOURCE MODIFY(UPDATERUSER NOT NULL)
/

-- #########################################################
-- #########################################################
-- Add_Fields_CrUs_UpUs.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет и инициализирует поля "Автор" и  "Изменил" в таблицу FACT*/
ALTER TABLE FACT ADD (
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
commit work
/
UPDATE FACT
  SET CREATERUSER = user,
      UPDATERUSER = user
/
commit work
/
-- ALTER TRIGGER TR_FACT_BI_500
CREATE OR REPLACE TRIGGER TR_FACT_BI
  BEFORE INSERT
  ON FACT
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_FACT_BI_0)
-- - - - - - - - - - - - -

  FactDiv(:new.id, :new.Code1, :new.Code2, :new.Code3);

-- - - - - - - - - - - - -
-- 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_500
CREATE OR REPLACE TRIGGER TR_FACT_BU_500
  BEFORE UPDATE
  ON FACT
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_FACT_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
ALTER TRIGGER TR_FACT_BU_500 ENABLE
/
commit work
/
ALTER TABLE FACT MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE FACT MODIFY(UPDATERUSER NOT NULL)
/

-- #########################################################
-- #########################################################
-- Alter_Exeption.sql
-- #########################################################
-- #########################################################

UPDATE SqlExceptions SET Text = 'Для кодов 7 и 12 допускается изменять только Наименование' WHERE UPPER(Name) = UPPER('EX_PDT_BANUPDATE')
/
commit work
/

-- #########################################################
-- #########################################################
-- uCons12.AddStringClassifiers.sql
-- #########################################################
-- #########################################################


/* <TRANS_COMMAND>
ALTER TABLE UTYPEDFORMSDETAIL ADD (
  KFSRCODE VARCHAR2(20),
  KCSRCODE VARCHAR2(20),
  KVSRCODE VARCHAR2(20),
  KVRCODE VARCHAR2(20),
  KESRCODE VARCHAR2(20),
  SUBKESRCODE VARCHAR2(20),
  OKATOCODE VARCHAR2(20)
)
/
*/
-- <TRANS_IGNORE>
DECLARE
  v_exists INTEGER;
BEGIN
  SELECT COUNT(*)
  INTO v_exists
  FROM USER_TAB_COLUMNS
  WHERE TABLE_NAME = 'UTYPEDFORMSDETAIL'
  AND COLUMN_NAME = 'KFSRCODE';
  IF (v_exists = 0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE UTYPEDFORMSDETAIL ADD (
     KFSRCODE VARCHAR2(20),
     KCSRCODE VARCHAR2(20),
     KVSRCODE VARCHAR2(20),
     KVRCODE VARCHAR2(20),
     KESRCODE VARCHAR2(20),
     SUBKESRCODE VARCHAR2(20),
     OKATOCODE VARCHAR2(20)
    )';

    /* Перенос значений из целочисленных полей классификации в строковые */
    EXECUTE IMMEDIATE 'update utypedformsdetail
      set kfsrcode = ''0'' || cast(Kfsr as VARCHAR2(20))
      where (Kfsr>=100) and (Kfsr <1000)';
 
    EXECUTE IMMEDIATE 'update utypedformsdetail
      set kfsrcode = cast(Kfsr as VARCHAR2(20))
      where (Kfsr>=1000) and (Kfsr <10000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
      set kfsrcode = ''00''||  cast(Kfsr as VARCHAR2(20))
      where (Kfsr>=10) and (Kfsr <100)';
      
    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kfsrcode = ''000'' || cast(Kfsr as VARCHAR2(20))
    where  (Kfsr>=0) and (Kfsr <10)';

    
    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kvsrcode =  cast(Kvsr as VARCHAR2(20))
    where (Kvsr>=100) and (Kvsr <1000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kvsrcode = ''0''|| cast(Kvsr as VARCHAR2(20))
    where (Kvsr>=10) and (Kvsr <100)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kvsrcode = ''00''|| cast(Kvsr as VARCHAR2(20))
    where (Kvsr>=0) and (Kvsr <10)';

    
    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kvrcode =  cast(Kvr as VARCHAR2(20))
    where (Kvr>=100) and (Kvr <1000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kvrcode = ''0''|| cast(Kvr as VARCHAR2(20))
    where (Kvr>=10) and (Kvr <100)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kvrcode = ''00''|| cast(Kvr as VARCHAR2(20))
    where (Kvr>=0) and (Kvr <10)';


    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kesrcode =  cast(Kesr as VARCHAR2(20))
    where (Kesr>=100) and (Kesr <1000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kesrcode = ''0''|| cast(Kesr as VARCHAR2(20))
    where (Kesr>=10) and (Kesr <100)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kesrcode = ''00''|| cast(Kesr as VARCHAR2(20))
    where (Kesr>=0) and (Kesr <10)';


    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kcsrcode =  cast(Kcsr as VARCHAR2(20))
    where (Kcsr>=1000000) and (Kcsr <10000000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kcsrcode = ''0''|| cast(Kcsr as VARCHAR2(20))
    where (Kcsr>=100000) and (Kcsr <1000000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kcsrcode = ''00''|| cast(Kcsr as VARCHAR2(20))
    where (Kcsr>=10000) and (Kcsr <100000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kcsrcode = ''000''|| cast(Kcsr as VARCHAR2(20))
    where (Kcsr>=1000) and (Kcsr <10000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kcsrcode = ''0000''|| cast(Kcsr as VARCHAR2(20))
    where (Kcsr>=100) and (Kcsr <1000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kcsrcode = ''00000''|| cast(Kcsr as VARCHAR2(20))
    where (Kcsr>=10) and (Kcsr <100)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set kcsrcode = ''000000''|| cast(Kcsr as VARCHAR2(20))
    where (Kcsr>=0) and (Kcsr <10)';


    EXECUTE IMMEDIATE 'update utypedformsdetail
    set subkesrcode =  cast(subkesr as VARCHAR2(20))
    where (subkesr>=1000000) and (subkesr <10000000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set subkesrcode = ''0''|| cast(subkesr as VARCHAR2(20))
    where (subkesr>=100000) and (subkesr <1000000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set subkesrcode = ''00''|| cast(subkesr as VARCHAR2(20))
    where (subkesr>=10000) and (subkesr <100000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set subkesrcode = ''000''|| cast(subkesr as VARCHAR2(20))
    where (subkesr>=1000) and (subkesr <10000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set subkesrcode = ''0000''|| cast(subkesr as VARCHAR2(20))
    where (subkesr>=100) and (subkesr <1000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set subkesrcode = ''00000''|| cast(subkesr as VARCHAR2(20))
    where (subkesr>=10) and (subkesr <100)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set subkesrcode = ''000000''|| cast(subkesr as VARCHAR2(20))
    where (subkesr>=0) and (subkesr <10)';


    
    EXECUTE IMMEDIATE 'update utypedformsdetail
    set okatocode =  cast(okato as VARCHAR2(20))
    where (okato>=10000000) and (okato <100000000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set okatocode = ''0''|| cast(okato as VARCHAR2(20))
    where (okato>=1000000) and (okato <10000000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set okatocode = ''00''|| cast(okato as VARCHAR2(20))
    where (okato>=100000) and (okato <1000000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set okatocode = ''000''|| cast(okato as VARCHAR2(20))
    where (okato>=10000) and (okato <100000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set okatocode = ''0000''|| cast(okato as VARCHAR2(20))
    where (okato>=1000) and (okato <10000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set okatocode = ''00000''|| cast(okato as VARCHAR2(20))
    where (okato>=100) and (okato <1000)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set okatocode = ''000000''|| cast(okato as VARCHAR2(20))
    where (okato>=10) and (okato <100)';

    EXECUTE IMMEDIATE 'update utypedformsdetail
    set okatocode = ''0000000''|| cast(okato as VARCHAR2(20))
    where (okato>=0) and (okato <10)';
    
  END IF;
END;
/

COMMIT WORK
/



-- #########################################################
-- #########################################################
-- Add_GeneralDocsItf.sql
-- #########################################################
-- #########################################################

/* Добавляем интерфейс Обуславливающие документы */
CREATE OR REPLACE procedure AddIntf(GUID$ VARCHAR2,Cls$ NUMBER,Name$ VARCHAR2)
AS
  IDIntf$ NUMBER(10);
BEGIN
  BEGIN
    select ID   into IDIntf$ from Interfaces
    where GUID = GUID$  and Cls = Cls$

    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  if (IDIntf$  is Null) then
    insert into Interfaces
    (Note,GUID,CLS)
    values
    (Name$,GUID$,Cls$);
      
  else
    update Interfaces set
    Note = Name$

    where ID = IDIntf$;      
  END IF;
END;
/
CALL AddIntf('{80D6F8CE-EC7E-4431-8EF1-6C7EAAB35937}',4801,'Обуславливающие документы') 
/
drop procedure AddIntf 
/
commit work 
/

-- #########################################################
-- #########################################################
-- Drop_ClsBinding_FaxDocs.sql
-- #########################################################
-- #########################################################

/* Удаляем старые таблицы: ClsBinding*//* FaxDocs пришлось оставить для совместимости с УРМ по прошлим годам */
DROP TABLE CLSBINDING
/
commit work
/

-- #########################################################
-- #########################################################
-- DROP_TR_CURRENCYCLS_BD.sql
-- #########################################################
-- #########################################################

/* Удаляем триггер TR_CURRENCYCLS_BD*/
-- drop trigger TR_CURRENCYCLS_BD
DROP TRIGGER TR_CURRENCYCLS_BD
/
commit work
/

-- #########################################################
-- #########################################################
-- Delete_Const52_1.sql
-- #########################################################
-- #########################################################

delete from intconst
where ProgIndex = 52 and ConstIndex = 1
/
commit work 
/


-- #########################################################
-- #########################################################
-- Alter_Triggers_WritExecutionCaption.sql
-- #########################################################
-- #########################################################

/* Скрипт изменяет триггеры TR_WritExecutionCaption_AD_500, TR_WritExecutionCaption_AI_500, TR_WritExecutionCaption_AU_500
   Меняем номер для DelRecIndexes.TableID с 1410 на 5201 (как задано в TablesCorrespondence.xml)
*/
-- ALTER TRIGGER TR_WritExecutionCaption_AD_500
CREATE OR REPLACE TRIGGER TR_WRITEXECUTIONCAPTION_AD
  AFTER DELETE
  ON WRITEXECUTIONCAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_200 (TR_WRITEXECUTIONCAPTION_AD_200)
-- Create 02.04.2010
-- Last update 02.04.2010
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_500 (TR_WRITEXECUTIONCAPTION_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_WritExecutionCaption_AI_500
CREATE OR REPLACE TRIGGER TR_WRITEXECUTIONCAPTION_AI
  AFTER INSERT
  ON WRITEXECUTIONCAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_WRITEXECUTIONCAPTION_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 5201) and (RecordID = :new.ID);

END;
/
-- ALTER TRIGGER TR_WritExecutionCaption_AU_500
CREATE OR REPLACE TRIGGER TR_WRITEXECUTIONCAPTION_AU
  AFTER UPDATE
  ON WRITEXECUTIONCAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (TR_WRITEXECUTIONCAPTION_AU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
commit work 
/




-- #########################################################
-- #########################################################
-- Alter_WritExecutionDetail_AddFields.sql
-- #########################################################
-- #########################################################

/* Добавление в исполнительные листы классификаторов "Код бюджетного ассигнования",
   "Код расходного обязательства", "Код целевых средств", "Код субсидии"*/
ALTER TABLE WritExecutionDetail ADD (
  BUDALLOCATIONCLS NUMBER(10),
    CHECK((BUDALLOCATIONCLS<=2147483647)AND(BUDALLOCATIONCLS>-2147483648)),
  PAYPROMISECLS NUMBER(10),
    CHECK((PAYPROMISECLS<=2147483647)AND(PAYPROMISECLS>-2147483648)),
  TRANSFERTCLS NUMBER(10),
    CHECK((TRANSFERTCLS<=2147483647)AND(TRANSFERTCLS>-2147483648)),
  SUBSIDYCLS NUMBER(10),
    CHECK((SUBSIDYCLS<=2147483647)AND(SUBSIDYCLS>-2147483648)),
  constraint FK_WritExecDet_BUDALLOCCLS foreign key (BUDALLOCATIONCLS) references BUDALLOCATIONCLS (ID),
  constraint FK_WritExecDet_PAYPROMISECLS foreign key (PAYPROMISECLS) references PAYPROMISECLS (ID),
  constraint FK_WritExecDet_TRANSFERTCLS foreign key (TRANSFERTCLS) references TRANSFERTCLS (ID),
  constraint FK_WritExecDet_SUBSIDYCLS foreign key (SUBSIDYCLS) references SUBSIDYCLS (ID)
)
/
CREATE INDEX FK_WritExecDet_BUDALLOCCLS ON WritExecutionDetail(BUDALLOCATIONCLS)
/
CREATE INDEX FK_WritExecDet_PAYPROMISECLS ON WritExecutionDetail(PAYPROMISECLS)
/
CREATE INDEX FK_WritExecDet_TRANSFERTCLS ON WritExecutionDetail(TRANSFERTCLS)
/
CREATE INDEX FK_WritExecDet_SUBSIDYCLS ON WritExecutionDetail(SUBSIDYCLS)
/

commit work 
/



-- #########################################################
-- #########################################################
-- CreateTrigerForWRITEXECUTIONDETAIL.sql
-- #########################################################
-- #########################################################

-- CREATE TRIGGER TR_WRITEXECUTIONDETAIL_BI_210
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);
  ScheduleRef$ NUMBER(10);
  PromiseMode1$ NUMBER(10);
  ProgIndex$ NUMBER(10);
  ExecID$ NUMBER(10);
  ExecInnerNumber$ NUMBER(10);
  AgrInnerNumber$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_WRITEXECUTIONDETAIL_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.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 ((not :new.PROMISE is null) and (not :new.BUDGETPROMISE is null)) then
    BEGIN
      select ps.id     into ScheduleRef$ from PaymentSchedule ps
      where (ps.InnerPromiseNum = :new.BUDGETPROMISE) and
      (ps.ANumber = :new.PROMISE)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (ScheduleRef$ <> 0) then
    :new.PScheduleRef := ScheduleRef$;
      
  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;
/
-- CREATE TRIGGER TR_WRITEXECUTIONDETAIL_BU_210
CREATE OR REPLACE TRIGGER TR_WRITEXECUTIONDETAIL_BU
  BEFORE UPDATE
  ON WRITEXECUTIONDETAIL
  FOR EACH ROW
DECLARE
  ScheduleRef$ NUMBER(10);
  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);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_WRITEXECUTIONDETAIL_BU)
-- Version 8.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 ((not :new.PROMISE is null) and (not :new.BUDGETPROMISE is null)) then
    BEGIN
      select ps.id     into ScheduleRef$ from PaymentSchedule ps
      where (ps.InnerPromiseNum = :new.BUDGETPROMISE) and
      (ps.ANumber = :new.PROMISE)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;
  if (ScheduleRef$ <> 0) then
    :new.PScheduleRef := ScheduleRef$;
      
  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 
/


-- #########################################################
-- #########################################################
-- Alter_TenderPlan_Reason.sql
-- #########################################################
-- #########################################################

ALTER TRIGGER TR_TENDERCAPTION_BU_500 DISABLE
/
commit work
/
update TenderCaption set
  ProtocolReason = MultiPurpose
    where ProgIndex = 241
/
ALTER TRIGGER TR_TENDERCAPTION_BU_500 ENABLE
/
commit work
/




-- #########################################################
-- #########################################################
-- Alter_Triggers_DFAccountsBuhTable.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет в триггера таблицы DFACCOUNTSBUHTABLE инициализацию поля isForAU */
-- ALTER TRIGGER TR_DFACCOUNTSBUHTABLE_BI_0
CREATE OR REPLACE TRIGGER TR_DFACCOUNTSBUHTABLE_II
  INSTEAD OF INSERT
  ON DFACCOUNTSBUHTABLE
  FOR EACH ROW
DECLARE
  new$BUDGETREF DFACCOUNTSBUHTABLE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$ID DFACCOUNTSBUHTABLE.ID%TYPE := :NEW.ID;
  new$BUHACC DFACCOUNTSBUHTABLE.BUHACC%TYPE := :NEW.BUHACC;
  new$ACCMODE DFACCOUNTSBUHTABLE.ACCMODE%TYPE := :NEW.ACCMODE;
  new$FIXED DFACCOUNTSBUHTABLE.FIXED%TYPE := :NEW.FIXED;
  new$CREATEDATE DFACCOUNTSBUHTABLE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DFACCOUNTSBUHTABLE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CURRENCYCLS DFACCOUNTSBUHTABLE.CURRENCYCLS%TYPE := :NEW.CURRENCYCLS;
  new$TREASURYACCREF DFACCOUNTSBUHTABLE.TREASURYACCREF%TYPE := :NEW.TREASURYACCREF;
  new$FINORGACCREF DFACCOUNTSBUHTABLE.FINORGACCREF%TYPE := :NEW.FINORGACCREF;
  new$IFS DFACCOUNTSBUHTABLE.IFS%TYPE := :NEW.IFS;
  new$SINGLEID DFACCOUNTSBUHTABLE.SINGLEID%TYPE := :NEW.SINGLEID;
  new$ISCOMMON DFACCOUNTSBUHTABLE.ISCOMMON%TYPE := :NEW.ISCOMMON;
  new$ISFORBUDGET DFACCOUNTSBUHTABLE.ISFORBUDGET%TYPE := :NEW.ISFORBUDGET;
  new$ISFORBUSINESS DFACCOUNTSBUHTABLE.ISFORBUSINESS%TYPE := :NEW.ISFORBUSINESS;
  new$ISFORTEMPORARY DFACCOUNTSBUHTABLE.ISFORTEMPORARY%TYPE := :NEW.ISFORTEMPORARY;
  new$ISFORCASH DFACCOUNTSBUHTABLE.ISFORCASH%TYPE := :NEW.ISFORCASH;
  new$CREATERUSER DFACCOUNTSBUHTABLE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER DFACCOUNTSBUHTABLE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$REGIONCLS DFACCOUNTSBUHTABLE.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$ISFORBU_AU DFACCOUNTSBUHTABLE.ISFORBU_AU%TYPE := :NEW.ISFORBU_AU;
  new$ISDEPOSIT DFACCOUNTSBUHTABLE.ISDEPOSIT%TYPE := :NEW.ISDEPOSIT;
  new$FACIALACC_ADB DFACCOUNTSBUHTABLE.FACIALACC_ADB%TYPE := :NEW.FACIALACC_ADB;
  new$ISFORTEMPORARYBU_AU DFACCOUNTSBUHTABLE.ISFORTEMPORARYBU_AU%TYPE := :NEW.ISFORTEMPORARYBU_AU;
  new$ISFORAU DFACCOUNTSBUHTABLE.ISFORAU%TYPE := :NEW.ISFORAU;
--
  OldValue$ NUMBER(10);
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  countForBU_AU$ NUMBER(10);
  countForBudget$ NUMBER(10);
  countForBusiness$ NUMBER(10);
  countForTemporary$ NUMBER(10);
  countForTemporaryBU_AU$ NUMBER(10);
  countForAU$ NUMBER(10);
  CurNum1$ NUMBER(10);
  CommonBudget1$ NUMBER(10);
  RegionCLS1$ NUMBER(10);
  checkUseAU1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DFACCOUNTSBUHTABLE_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (new$SingleID is null) then 
    select g_shared.nextval into new$SingleID from dual;
  END IF;
  if (new$CurrencyCls is null) then
    GetIntConst(19, 4,CurNum1$);
    if (CurNum1$ is null) then 
      new$CurrencyCls:= 2;
         
    else 
      new$CurrencyCls:= CurNum1$;
     
    END IF;
  END IF;
  if ((new$BudgetRef is null) or (new$BudgetRef = 0)) then
    GetIntConst(-1, 3,new$BudgetRef);
  END IF;
  if (new$isForBudget is null) then 
    new$isForBudget:= 0;
  END IF;
  if (new$isForBusiness is null) then 
    new$isForBusiness:= 0;
  END IF;
  if (new$isForTemporary is null) then 
    new$isForTemporary:= 0;
  END IF;
  if (new$isForBU_AU is null) then 
    new$isForBU_AU:= 0;
  END IF;
  if (new$isCommon is null) then 
    new$isCommon := 0;
  END IF;
  if (new$isDeposit is null) then 
    new$isDeposit := 0;
  END IF;
  if (new$isForCash is null) then 
    new$isForCash := 0;
  END IF;
  if (new$isForTemporaryBU_AU is null) then 
    new$isForTemporaryBU_AU := 0;
  END IF;
  if (new$isForAU is null) then 
    new$isForAU := 0;
  END IF;
  getintconst(30, 44,checkUseAU1$);
  if (checkUseAU1$ <> 1) then 
    new$isForAU := new$isForBU_AU;
  END IF;
   
  if ((new$isForBudget = 0)and(new$isForBusiness = 0)and(new$isForTemporary = 0)
  and(new$isForBU_AU = 0)and(new$isDeposit = 0)and(new$isForTemporaryBU_AU = 0)and(new$isForAU = 0)) then
    new$isForBudget := 1;
  END IF;
  if ((new$isCommon = 1)and(new$IsForBudget=1)) then
    GetIntConst(-1,3,CommonBudget1$);
    if (new$BudgetRef = CommonBudget1$) then
      SELECT COUNT(constValue ) INTO CNT$1
      from intconst where ((progindex = -1) and (constindex = 2)) AND (ROWNUM = 1);
      if ((CNT$1<> 0)) then
        Update intconst
        set Constvalue = new$ID
        where (progindex = -1) and (constindex = 2);
                
      else
        INSERT INTO INTCONST (PROGINDEX, CONSTINDEX, CONSTVALUE)
        VALUES (-1, 2, new$ID);
                
      END IF;  
    END IF;
  END IF;
  if ((new$isCommon = 1)and(new$IsForBusiness=1)) then
    GetIntConst(-1,3,CommonBudget1$);
    if (new$BudgetRef = CommonBudget1$) then
      SELECT COUNT(constValue ) INTO CNT$2
      from intconst where ((progindex = 30) and (constindex = 17)) AND (ROWNUM = 1);
      if ((CNT$2<> 0)) then
        Update intconst
        set Constvalue = new$ID
        where (progindex = 30) and (constindex = 17);
                
      else
        INSERT INTO INTCONST (PROGINDEX, CONSTINDEX, CONSTVALUE)
        VALUES (30, 17, new$ID);
                
      END IF;  
    END IF;
  END IF;
  if (new$RegionCLS is null) then
    BEGIN
      select o.RegionCls     into RegionCLS1$ from Organizations o where o.ID =
      (select oa.Org_Ref from Org_Accounts oa where oa.ID = new$ID)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not (RegionCLS1$  is null)) then
      new$RegionCLS := RegionCLS1$;
          
    else
      new$RegionCLS := 0;
      
    END IF;
  END IF;
  if (new$FacialAcc_ADB is null) then 
    new$FacialAcc_ADB := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_300 (TR_DFACCOUNTSBUHTABLE_BI_300)
-- Create 13.05.2005
-- Last update 19.05.2005
-- - - - - - - - - - - - -

   IF (new$IFS IS NULL) THEN
      --Источник не заполнен, но может этот счет был в другом бюджете и там он есть
      SELECT MAX (IFS)
        INTO OldValue$
        FROM DFACCOUNTSBUHTABLE df
       WHERE df.ID = new$ID;

      IF ((OldValue$ IS NOT NULL) AND (OldValue$ <> 0)) THEN
         new$IFS := OldValue$;
      END IF;
   END IF;

   IF (new$CURRENCYCLS IS NULL) THEN
      SELECT MAX (CURRENCYCLS)
        INTO OldValue$
        FROM DFACCOUNTSBUHTABLE df
       WHERE df.ID = new$ID;

      IF ((OldValue$ IS NOT NULL) AND (OldValue$ <> 0)) THEN
         new$CURRENCYCLS := OldValue$;
      END IF;
   END IF;

   IF (new$TREASURYACCREF IS NULL) THEN
      SELECT MAX (TREASURYACCREF)
        INTO OldValue$
        FROM DFACCOUNTSBUHTABLE df
       WHERE df.ID = new$ID;

      IF ((OldValue$ IS NOT NULL) AND (OldValue$ <> 0)) THEN
         new$TREASURYACCREF := OldValue$;
      END IF;
   END IF;

   IF (new$FINORGACCREF IS NULL) THEN
      SELECT MAX (FINORGACCREF)
        INTO OldValue$
        FROM DFACCOUNTSBUHTABLE df
       WHERE df.ID = new$ID;

      IF ((OldValue$ IS NOT NULL) AND (OldValue$ <> 0)) THEN
         new$FINORGACCREF := OldValue$;
      END IF;
   END IF;

   UPDATE DFACCOUNTSBUHTABLE
      SET IFS = new$IFS,
          CURRENCYCLS = new$CURRENCYCLS,
          TREASURYACCREF = new$TREASURYACCREF,
          FINORGACCREF = new$FINORGACCREF
    WHERE (ID = new$id)
      AND (BUDGETREF <> new$BUDGETREF)
      AND (   (IFS <> new$IFS)
           OR (CURRENCYCLS <> new$CURRENCYCLS)
           OR (TREASURYACCREF <> new$TREASURYACCREF)
           OR (FINORGACCREF <> new$FINORGACCREF)
          );

-- - - - - - - - - - - - -
-- BI_500 (TR_DFACCOUNTSBUHTABLE_BI_500)
-- Last update 19.05.2005
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_DFACCOUNTSBUHTABLE (
    BUDGETREF,
    ID,
    BUHACC,
    ACCMODE,
    FIXED,
    CREATEDATE,
    UPDATEDATE,
    CURRENCYCLS,
    TREASURYACCREF,
    FINORGACCREF,
    IFS,
    SINGLEID,
    ISCOMMON,
    ISFORBUDGET,
    ISFORBUSINESS,
    ISFORTEMPORARY,
    ISFORCASH,
    CREATERUSER,
    UPDATERUSER,
    REGIONCLS,
    ISFORBU_AU,
    ISDEPOSIT,
    FACIALACC_ADB,
    ISFORTEMPORARYBU_AU,
    ISFORAU
  ) VALUES (
    new$BUDGETREF,
    new$ID,
    new$BUHACC,
    new$ACCMODE,
    new$FIXED,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$CURRENCYCLS,
    new$TREASURYACCREF,
    new$FINORGACCREF,
    new$IFS,
    new$SINGLEID,
    new$ISCOMMON,
    new$ISFORBUDGET,
    new$ISFORBUSINESS,
    new$ISFORTEMPORARY,
    new$ISFORCASH,
    new$CREATERUSER,
    new$UPDATERUSER,
    new$REGIONCLS,
    new$ISFORBU_AU,
    new$ISDEPOSIT,
    new$FACIALACC_ADB,
    new$ISFORTEMPORARYBU_AU,
    new$ISFORAU);

-- - - - - - - - - - - - -
-- AI_100 (TR_DFACCOUNTSBUHTABLE_AI_100)
-- Version 8.00.00.2
-- - - - - - - - - - - - -

  if (new$IsCommon=1) then
    select sum(dfbt.isForBudget),sum(dfbt.isForBusiness),sum(dfbt.isForTemporary),sum(dfbt.isForBU_AU),
    sum(dfbt.isForTemporaryBU_AU),sum(dfbt.isForAU)
    into countForBudget$, countForBusiness$, countForTemporary$, countForBU_AU$, countForTemporaryBU_AU$, countForAU$         from dfaccountsbuhtable dfbt
    LEFT JOIN Org_Accounts oa ON (dfbt.id =  oa.id)
    where (dfbt.BudgetRef = new$BudgetRef) and (dfbt.isCommon = 1) and ((oa.Closed = 0)or(oa.Closed is null))
    ;
    if ((countForBudget$  > 1)or(countForBusiness$  > 1)or(countForTemporary$  > 1)or(countForBU_AU$  > 1)
    or(countForTemporaryBU_AU$  > 1)or(countForAU$  > 1)) then
      RaiseException('EX_CHECK_common_DFACCBT');   
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AI_500 (TR_DFACCOUNTSBUHTABLE_AI_500)
-- Last update 29.11.2006
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 73) and (RecordId = new$SingleID);

END;
/
-- ALTER TRIGGER TR_DFACCOUNTSBUHTABLE_BU_0
CREATE OR REPLACE TRIGGER TR_DFACCOUNTSBUHTABLE_IU
  INSTEAD OF UPDATE
  ON DFACCOUNTSBUHTABLE
  FOR EACH ROW
DECLARE
  new$BUDGETREF DFACCOUNTSBUHTABLE.BUDGETREF%TYPE := :NEW.BUDGETREF;
  new$ID DFACCOUNTSBUHTABLE.ID%TYPE := :NEW.ID;
  new$BUHACC DFACCOUNTSBUHTABLE.BUHACC%TYPE := :NEW.BUHACC;
  new$ACCMODE DFACCOUNTSBUHTABLE.ACCMODE%TYPE := :NEW.ACCMODE;
  new$FIXED DFACCOUNTSBUHTABLE.FIXED%TYPE := :NEW.FIXED;
  new$CREATEDATE DFACCOUNTSBUHTABLE.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DFACCOUNTSBUHTABLE.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CURRENCYCLS DFACCOUNTSBUHTABLE.CURRENCYCLS%TYPE := :NEW.CURRENCYCLS;
  new$TREASURYACCREF DFACCOUNTSBUHTABLE.TREASURYACCREF%TYPE := :NEW.TREASURYACCREF;
  new$FINORGACCREF DFACCOUNTSBUHTABLE.FINORGACCREF%TYPE := :NEW.FINORGACCREF;
  new$IFS DFACCOUNTSBUHTABLE.IFS%TYPE := :NEW.IFS;
  new$SINGLEID DFACCOUNTSBUHTABLE.SINGLEID%TYPE := :NEW.SINGLEID;
  new$ISCOMMON DFACCOUNTSBUHTABLE.ISCOMMON%TYPE := :NEW.ISCOMMON;
  new$ISFORBUDGET DFACCOUNTSBUHTABLE.ISFORBUDGET%TYPE := :NEW.ISFORBUDGET;
  new$ISFORBUSINESS DFACCOUNTSBUHTABLE.ISFORBUSINESS%TYPE := :NEW.ISFORBUSINESS;
  new$ISFORTEMPORARY DFACCOUNTSBUHTABLE.ISFORTEMPORARY%TYPE := :NEW.ISFORTEMPORARY;
  new$ISFORCASH DFACCOUNTSBUHTABLE.ISFORCASH%TYPE := :NEW.ISFORCASH;
  new$CREATERUSER DFACCOUNTSBUHTABLE.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER DFACCOUNTSBUHTABLE.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
  new$REGIONCLS DFACCOUNTSBUHTABLE.REGIONCLS%TYPE := :NEW.REGIONCLS;
  new$ISFORBU_AU DFACCOUNTSBUHTABLE.ISFORBU_AU%TYPE := :NEW.ISFORBU_AU;
  new$ISDEPOSIT DFACCOUNTSBUHTABLE.ISDEPOSIT%TYPE := :NEW.ISDEPOSIT;
  new$FACIALACC_ADB DFACCOUNTSBUHTABLE.FACIALACC_ADB%TYPE := :NEW.FACIALACC_ADB;
  new$ISFORTEMPORARYBU_AU DFACCOUNTSBUHTABLE.ISFORTEMPORARYBU_AU%TYPE := :NEW.ISFORTEMPORARYBU_AU;
  new$ISFORAU DFACCOUNTSBUHTABLE.ISFORAU%TYPE := :NEW.ISFORAU;
--
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
  countForBU_AU$ NUMBER(10);
  countForBudget$ NUMBER(10);
  countForBusiness$ NUMBER(10);
  countForTemporary$ NUMBER(10);
  countForTemporaryBU_AU$ NUMBER(10);
  countForAU$ NUMBER(10);
  CurNum1$ NUMBER(10);
  CommonBudget1$ NUMBER(10);
  RegionCLS1$ NUMBER(10);
  checkUseAU1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_DFACCOUNTSBUHTABLE_BU_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (new$CurrencyCls is null) then
    GetIntConst(19, 4,CurNum1$);
    if (CurNum1$ is null) then 
      new$CurrencyCls:= 2;
         
    else 
      new$CurrencyCls:= CurNum1$;
     
    END IF;
  END IF;
   
  if (new$isForBudget is null) then 
    new$isForBudget:= 0;
  END IF;
  if (new$isForBusiness is null) then 
    new$isForBusiness:= 0;
  END IF;
  if (new$isForTemporary is null) then 
    new$isForTemporary:= 0;
  END IF;
  if (new$isForBU_AU is null) then 
    new$isForBU_AU:= 0;
  END IF;
  if (new$isCommon is null) then 
    new$isCommon := 0;
  END IF;
  if (new$isDeposit is null) then 
    new$isDeposit := 0;
  END IF;
  if (new$isForCash is null) then 
    new$isForCash := 0;
  END IF;
  if (new$isForTemporaryBU_AU is null) then 
    new$isForTemporaryBU_AU := 0;
  END IF;
  if (new$isForAU is null) then 
    new$isForAU := 0;
  END IF;
  getintconst(30, 44,checkUseAU1$);
  if (checkUseAU1$ <> 1) then 
    new$isForAU := new$isForBU_AU;
  END IF;
   
  if ((new$isForBudget = 0)and(new$isForBusiness = 0)and(new$isForTemporary = 0)
  and(new$isForBU_AU = 0)and(new$isDeposit = 0)and(new$isForTemporaryBU_AU = 0)and(new$isForAU = 0))then
    new$isForBudget := 1;
  END IF;
  if (((:old.isCommon <> 1) and (new$isCommon = 1)and(new$IsForBudget=1))
  or ((new$isCommon = 1)and(:old.IsForBudget<>1)and(new$IsForBudget=1))) then
    GetIntConst(-1,3,CommonBudget1$);
    if (new$BudgetRef = CommonBudget1$) then
      SELECT COUNT(constValue ) INTO CNT$1
      from intconst where ((progindex = -1) and (constindex = 2)) AND (ROWNUM = 1);
      if ((CNT$1<> 0)) then
        Update intconst
        set Constvalue = new$ID
        where (progindex = -1) and (constindex = 2);
                
      else
        INSERT INTO INTCONST (PROGINDEX, CONSTINDEX, CONSTVALUE)
        VALUES (-1, 2, new$ID);
                
      END IF; 
    END IF;
  END IF;
  if (((:old.isCommon <> 1) and (new$isCommon = 1)and(new$isForBusiness=1))
  or ((new$isCommon = 1)and(:old.isForBusiness<>1)and(new$isForBusiness=1))) then
    GetIntConst(-1,3,CommonBudget1$);
    if (new$BudgetRef = CommonBudget1$) then
      SELECT COUNT(constValue ) INTO CNT$2
      from intconst where ((progindex = 30) and (constindex = 17)) AND (ROWNUM = 1);
      if ((CNT$2<> 0)) then
        Update intconst
        set Constvalue = new$ID
        where (progindex = 30) and (constindex = 17);
                
      else
        INSERT INTO INTCONST (PROGINDEX, CONSTINDEX, CONSTVALUE)
        VALUES (30, 17, new$ID);
                
      END IF; 
    END IF;
  END IF;
  if (new$RegionCLS is null) then
    BEGIN
      select o.RegionCls     into RegionCLS1$ from Organizations o where o.ID =
      (select oa.Org_Ref from Org_Accounts oa where oa.ID = new$ID)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (not (RegionCLS1$  is null)) then
      new$RegionCLS := RegionCLS1$;
          
    else
      new$RegionCLS := 0;
      
    END IF;
  END IF;
  if (new$FacialAcc_ADB is null) then 
    new$FacialAcc_ADB := 0;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_DFACCOUNTSBUHTABLE SET
    BUDGETREF = new$BUDGETREF,
    ID = new$ID,
    BUHACC = new$BUHACC,
    ACCMODE = new$ACCMODE,
    FIXED = new$FIXED,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    CURRENCYCLS = new$CURRENCYCLS,
    TREASURYACCREF = new$TREASURYACCREF,
    FINORGACCREF = new$FINORGACCREF,
    IFS = new$IFS,
    SINGLEID = new$SINGLEID,
    ISCOMMON = new$ISCOMMON,
    ISFORBUDGET = new$ISFORBUDGET,
    ISFORBUSINESS = new$ISFORBUSINESS,
    ISFORTEMPORARY = new$ISFORTEMPORARY,
    ISFORCASH = new$ISFORCASH,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER,
    REGIONCLS = new$REGIONCLS,
    ISFORBU_AU = new$ISFORBU_AU,
    ISDEPOSIT = new$ISDEPOSIT,
    FACIALACC_ADB = new$FACIALACC_ADB,
    ISFORTEMPORARYBU_AU = new$ISFORTEMPORARYBU_AU,
    ISFORAU = new$ISFORAU
  WHERE id = :old.Id and budgetref = :old.budgetref;

-- - - - - - - - - - - - -
-- AU_100 (TR_DFACCOUNTSBUHTABLE_AU_100)
-- Version 8.00.00.2
-- - - - - - - - - - - - -

  if (new$IsCommon=1) then
    select sum(dfbt.isForBudget),sum(dfbt.isForBusiness),sum(dfbt.isForTemporary),sum(dfbt.isForBU_AU),
    sum(dfbt.isForTemporaryBU_AU),sum(dfbt.isForAU)
    into countForBudget$, countForBusiness$, countForTemporary$, countForBU_AU$, countForTemporaryBU_AU$, countForAU$         from dfaccountsbuhtable dfbt
    LEFT JOIN Org_Accounts oa ON (dfbt.id =  oa.id)
    where (dfbt.BudgetRef = new$BudgetRef) and (dfbt.isCommon = 1) and ((oa.Closed = 0)or(oa.Closed is null))
    ;
    if ((countForBudget$  > 1)or(countForBusiness$  > 1)or(countForTemporary$  > 1)or(countForBU_AU$  > 1)
    or(countForTemporaryBU_AU$  > 1)or(countForAU$  > 1)) then
      RaiseException('EX_CHECK_common_DFACCBT');   
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- AU_300 (TR_DFACCOUNTSBUHTABLE_AU_300)
-- Create 13.05.2005
-- Last update 19.05.2005
-- - - - - - - - - - - - -

  update TB_DFACCOUNTSBUHTABLE set
    IFS = new$IFS,
    CURRENCYCLS = new$CURRENCYCLS,
    TREASURYACCREF = new$TREASURYACCREF,
    FINORGACCREF = new$FINORGACCREF
  where
    (id = new$id)and(BUDGETREF <> new$BUDGETREF)and
    ((IFS <> new$IFS)or(CURRENCYCLS <> new$CURRENCYCLS)or
    (TREASURYACCREF <> new$TREASURYACCREF)or(FINORGACCREF <> new$FINORGACCREF));

-- - - - - - - - - - - - -
-- AU_500 (TR_DFACCOUNTSBUHTABLE_AU_500)
-- Create 29.11.2006
-- - - - - - - - - - - - -

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

END;
/
commit work 
/

-- #########################################################
-- #########################################################
-- CascadeDelRemoteClientByDBUsers.sql
-- #########################################################
-- #########################################################

/* 
  Каскадно мочим RemoteClient при удалении DBUsers 
*/
-- CREATE TRIGGER TR_DBUSERS_AD_10
CREATE OR REPLACE TRIGGER TR_DBUsers_ID
  INSTEAD OF DELETE
  ON DBUsers
  FOR EACH ROW
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 9.00.00.1
-- - - - - - - - - - - - -

  /* не должно остаться RemoteClients без DBUsers */  
  if (:old.RemoteClientRef is not null) then
    delete from RemoteClient where ID = :old.RemoteClientRef;
  END IF;

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

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

END;
/

commit work
/





-- #########################################################
-- #########################################################
-- alter_triggers_addprogind.sql
-- #########################################################
-- #########################################################

/* Добавление заполнения ProgIndex и поля Summa в DelRecIndexes*/
-- ALTER TRIGGER TR_BUDNOTIFY_AD_500
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;
/
-- ALTER TRIGGER TR_PAYMENTSCHEDULE_AD_500
CREATE OR REPLACE TRIGGER TR_PAYMENTSCHEDULE_ID
  INSTEAD OF DELETE
  ON PAYMENTSCHEDULE
  FOR EACH ROW
DECLARE
  cnt$ NUMBER(10);
  SummInMonths$ NUMBER(15,2);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_PAYMENTSCHEDULE_BD)
-- Version 7.00.02.1
-- - - - - - - - - - - - -

  /* Версия триггера 5.0*/
  select count(ID) into cnt$ from PaymentSchedule where (AdjustmentRef = :old.ID) ;
  if (cnt$ > 0) then
    RaiseException('EX_Agr_CantDelAdjustmented');
  END IF;
  if (:old.AdjustmentNumber = 0) then
    select count(ID) 
    into cnt$         from FacialFinDetail
    where (SourceBudgetPromise = :old.InnerPromiseNum) or (DestBudgetPromise = :old.InnerPromiseNum) 
    ;
            
    if (cnt$ > 0) then
      RaiseException('ex_CantDeleteAgreement');    
    END IF;
  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;
/
-- ALTER TRIGGER TR_COMPOUNDCLSDET_AD_500
CREATE OR REPLACE TRIGGER TR_COMPOUNDCLSDET_AD
  AFTER DELETE
  ON COMPOUNDCLSDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_COMPOUNDCLSDET_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_TENDERPRODUCT_AD_500
CREATE OR REPLACE TRIGGER TR_TENDERPRODUCT_AD
  AFTER DELETE
  ON TENDERPRODUCT
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_TENDERPRODUCT_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_TENDERCAPTION_AD_500
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;
/
-- ALTER TRIGGER TR_QUOTESTITLE_AD_500
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;
/
-- ALTER TRIGGER TR_INCOMES32_AD_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_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_INCOMESNOTIF_AD_500
CREATE OR REPLACE TRIGGER TR_INCOMESNOTIF_AD
  AFTER DELETE
  ON INCOMESNOTIF
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_INCOMESNOTIF_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_INCOMESDATA_AD_500
CREATE OR REPLACE TRIGGER TR_INCOMESDATA_AD
  AFTER DELETE
  ON INCOMESDATA
  FOR EACH ROW
DECLARE
  SummInMonths$ NUMBER(15,2);
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_INCOMESDATA_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 (164, :old.ID, SYSDATE, :old.ProgIndex, SummInMonths$);

END;
/
-- ALTER TRIGGER TR_LAYERFIELDS_AD_500
CREATE OR REPLACE TRIGGER TR_LAYERFIELDS_AD
  AFTER DELETE
  ON LAYERFIELDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_LAYERFIELDS_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_LAYERCONTROLRULES_AD_500
CREATE OR REPLACE TRIGGER TR_LAYERCONTROLRULES_AD
  AFTER DELETE
  ON LAYERCONTROLRULES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_LAYERCONTROLRULES_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_UNIONNOTIFYCAPTION_AD_500
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYCAPTION_AD
  AFTER DELETE
  ON UNIONNOTIFYCAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_200 (TR_UNIONNOTIFYCAPTION_AD_200)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_500 (TR_UNIONNOTIFYCAPTION_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_DATAPACKET_AD_500
CREATE OR REPLACE TRIGGER TR_DATAPACKET_AD
  AFTER DELETE
  ON DATAPACKET
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_DATAPACKET_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_DOCUMENTCLS_AD_500
CREATE OR REPLACE TRIGGER TR_DOCUMENTCLS_AD
  AFTER DELETE
  ON DOCUMENTCLS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_DOCUMENTCLS_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_UTFC_AD_500
CREATE OR REPLACE TRIGGER TR_UTFC_ID
  INSTEAD OF DELETE
  ON UTYPEDFORMSCAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_UTFC_BD)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

  /* удаляем данные детализации */
  delete from uTypedFormsDetail where RecordIndex = :old.id;
    
  /* удаляем версии данного отчета из реестра импорта */
  delete from uTypedImportRegistry where RecordIndex = :old.id;

-- - - - - - - - - - - - -
-- BD_10 (TR_UTFC_BD10)
-- Create 30.11.2004
-- Last update 25.05.2005
-- - - - - - - - - - - - -

  /* Каскадное удаление записей из дерева отчетов */
  DELETE FROM utfctree WHERE (utfcparent = :old.id) OR (utfckid = :old.id);

-- - - - - - - - - - - - -
-- BD_20 (TR_UTFC_BD20)
-- Create 15.12.2005
-- - - - - - - - - - - - -

  /* При удалении отчета уменьшаем число ссылок на версию*/
  if (not :old.VERSIONID is null) then
    update UTYPEDFORMSVERSION utfv
    set REPORTNUMBER = (select count(utfc.ID) - 1
                        from utypedformscaption utfc
                        where (utfc.VERSIONID = :old.VERSIONID))
    where utfv.ID = :old.VERSIONID;
  end if;  

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

-- - - - - - - - - - - - -
-- AD_200 (TR_UTFC_AD_200)
-- Create 14.09.2005
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_500 (TR_UTFC_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  INSERT INTO delrecindexes(tableid, recordid, deletedate, ProgIndex)
  VALUES (1301, :old.ID, SYSDATE, :old.ProgIndex);

END;
/
-- CREATE TRIGGER TR_UNIONNOTIFYDETAIL_AD_500
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_AD
  AFTER DELETE
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_UNIONNOTIFYDETAIL_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordId, DeleteDate, ProgIndex, SUMMA) values (182, :old.Id, SYSDATE, :old.ProgIndex, :old.SUMMAYEAR1);

END;
/
-- CREATE TRIGGER TR_UNIONNOTIFYDETAIL_AI_500
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_AI
  AFTER INSERT
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_UNIONNOTIFYDETAIL_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 182) and (RecordId = :new.ID);

END;
/
-- CREATE TRIGGER TR_UNIONNOTIFYDETAIL_AU_500
CREATE OR REPLACE TRIGGER TR_UNIONNOTIFYDETAIL_AU
  AFTER UPDATE
  ON UNIONNOTIFYDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (TR_UNIONNOTIFYDETAIL_AU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.Id <> :old.Id) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (182, :old.Id, SYSDATE);
    delete from DelRecIndexes where (TableID = 182) and (RecordId = :new.ID);
      
  END IF;

END;
/
-- CREATE TRIGGER TR_ED_OUTPAYDOC_AD_500
CREATE OR REPLACE TRIGGER TR_ED_OUTPAYDOC_AD
  AFTER DELETE
  ON ED_OUTPAYDOC
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_ED_OUTPAYDOC_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_ED_OUTPAYDOC_AI_500
CREATE OR REPLACE TRIGGER TR_ED_OUTPAYDOC_AI
  AFTER INSERT
  ON ED_OUTPAYDOC
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_ED_OUTPAYDOC_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 1406) and (RecordId = :new.ID);

END;
/
-- CREATE TRIGGER TR_ED_OUTPAYDOC_AU_500
CREATE OR REPLACE TRIGGER TR_ED_OUTPAYDOC_AU
  AFTER UPDATE
  ON ED_OUTPAYDOC
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (TR_ED_OUTPAYDOC_AU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.Id <> :old.Id) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (1406, :old.Id, SYSDATE);
    delete from DelRecIndexes where (TableID = 1406) and (RecordId = :new.ID);
      
  END IF;

END;
/
-- CREATE TRIGGER TR_BANKEXCH_MERDOC_AD_500
CREATE OR REPLACE TRIGGER TR_BANKEXCH_MERDOC_AD
  AFTER DELETE
  ON BANKEXCH_MERDOC
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_BANKEXCH_MERDOC_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (1407, :old.Id, SYSDATE);

END;
/
-- CREATE TRIGGER TR_BANKEXCH_MERDOC_AI_500
CREATE OR REPLACE TRIGGER TR_BANKEXCH_MERDOC_AI
  AFTER INSERT
  ON BANKEXCH_MERDOC
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_BANKEXCH_MERDOC_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 1407) and (RecordId = :new.ID);

END;
/
-- CREATE TRIGGER TR_BANKEXCH_MERDOC_AU_500
CREATE OR REPLACE TRIGGER TR_BANKEXCH_MERDOC_AU
  AFTER UPDATE
  ON BANKEXCH_MERDOC
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AU_500 (TR_BANKEXCH_MERDOC_AU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.Id <> :old.Id) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (1407, :old.Id, SYSDATE);
    delete from DelRecIndexes where (TableID = 1407) and (RecordId = :new.ID);
      
  END IF;

END;
/
-- ALTER TRIGGER TR_EXECDOCCAPTION_AD_500
CREATE OR REPLACE TRIGGER TR_EXECUTIONDOCUMENTSCAPTIO_ID
  INSTEAD OF DELETE
  ON EXECUTIONDOCUMENTSCAPTION
  FOR EACH ROW
DECLARE
  quant$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_DOCEXECCAPTION_BD)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  select count(ID)   into quant$ from executiondocumentscaption 
  where AdjustmentRef = :old.ID
  ;
  if (quant$  = 0) then
    delete from ExecutionDocumentsDetail where (RecordIndex = :old.ID);
    delete from paymentschedule where (ExecutionRef = :old.ID)and(ProgIndex=308);
      
  else
    RaiseException('ex_agr_cantdeladjustmented');
  END IF;

-- - - - - - - - - - - - -
-- BD_10 (TR_DocExecCaption_BD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

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

-- - - - - - - - - - - - -
-- AD_10 (TR_ExecDocCaption_AD_10)
-- Version 7.00.01.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_200 (TR_EXECDOCCAPTION_AD_200)
-- Create 04.10.2004
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_500 (TR_EXECDOCCAPTION_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_EXECDOCDETAIL_AD_500
CREATE OR REPLACE TRIGGER TR_EXECDOCDETAIL_AD
  AFTER DELETE
  ON EXECUTIONDOCUMENTSDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_EXECDOCDETAIL_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_RESERVEFUNDS_AD_500
CREATE OR REPLACE TRIGGER TR_RESERVEFUNDS_AD
  AFTER DELETE
  ON RESERVEFUNDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_RESERVEFUNDS_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_CORRECTIONCAPTION_AD_500
CREATE OR REPLACE TRIGGER TR_CORRECTIONCAPTION_AD
  AFTER DELETE
  ON CORRECTIONCAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_200 (TR_CORRECTIONCAPTION_AD_200)
-- Create 29.12.2009
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- AD_500 (TR_CORRECTIONCAPTION_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER TR_CORRECTIONDETAIL_AD_500
CREATE OR REPLACE TRIGGER TR_CORRECTIONDETAIL_ID
  INSTEAD OF DELETE
  ON CORRECTIONDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- 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_BUDGETDATA_AD_500
CREATE OR REPLACE TRIGGER TR_BUDGETDATA_AD
  AFTER DELETE
  ON BUDGETDATA
  FOR EACH ROW
DECLARE
  SummInMonths$ NUMBER(15,2);
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_BUDGETDATA_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 (26, :old.ID, SYSDATE, :old.ProgIndex, SummInMonths$);

END;
/
-- ALTER TRIGGER TR_WRITEXECUTIONDETAIL_AD_500
CREATE OR REPLACE TRIGGER TR_WRITEXECUTIONDETAIL_AD
  AFTER DELETE
  ON WRITEXECUTIONDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_WRITEXECUTIONDETAIL_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  insert into DelRecIndexes(TableID,RecordId,DeleteDate, ProgIndex, Summa)
  values(5202,:old.ID,SYSDATE,:old.ProgIndex, :old.Month01+:old.Month02+:old.Month03+:old.Month04+:old.Month05+
  :old.Month06+:old.Month07+:old.Month08+:old.Month09+:old.Month10+:old.Month11+:old.Month12);

END;
/
commit work 
/


-- #########################################################
-- #########################################################
-- ADD_AutoTest.sql
-- #########################################################
-- #########################################################

/* Добавляем интерфейс "Форма для выполнения автоматического тестирования Бюджет",
и размещаем его на технологическом РМ */
CREATE OR REPLACE procedure AddIntf(GUID$ VARCHAR2,Cls$ NUMBER,Name$ VARCHAR2)
AS
  IDIntf$ NUMBER(10);
BEGIN
  BEGIN
    select ID   into IDIntf$ from Interfaces
    where GUID = GUID$  and Cls = Cls$

    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  if (IDIntf$  is Null) then
    insert into Interfaces
    (Note,GUID,CLS)
    values
    (Name$,GUID$,Cls$);
      
  else
    update Interfaces set
    Note = Name$

    where ID = IDIntf$;      
  END IF;
END;
/
CREATE OR REPLACE procedure PW
AS
  IDnt$ NUMBER(10);
  CNT$1 NUMBER(10);
  CNT$2 NUMBER(10);
BEGIN
  BEGIN
    select ID   into IDnt$ from interfaces where GUID = '{031D78FC-AFEA-4961-9615-B88E04E4CD93}'
    ;
  EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
  END;
  if (IDnt$  is not Null) then
    SELECT COUNT(NOTE ) INTO CNT$1
    from Workplaces where (ID = 703) AND (ROWNUM = 1);
    if ((CNT$1<> 0)) then
      SELECT COUNT(ID ) INTO CNT$2
      from WORKPLACES_INTERFACE
      where ((workplaces_ref=703) and (INTERFACES_REF=IDnt$)) AND (ROWNUM = 1);
      if (not (CNT$2<> 0))
      Then
        insert into workplaces_interface (workplaces_ref,INTERFACES_REF)
        values(703,IDnt$);
      END IF;
    END IF;
  END IF;
END;
/
CALL AddIntf('{031D78FC-AFEA-4961-9615-B88E04E4CD93}', 0, 'Форма для выполнения автоматического тестирования Бюджет') 
/
CALL PW() 
/
drop procedure AddIntf 
/
drop procedure PW 
/
commit work 
/

-- #########################################################
-- #########################################################
-- alter_tables_add_autarization.sql
-- #########################################################
-- #########################################################

/* 
Добавляет поля авторизации в таблицы:
ACCCUROPERATION
WORKPLACES
USER_WORKPLACES
USERGENERATORFIELDS
USERGENERATOR
SUBKCSR
STATE_ACTIONJUMPS
BANKS
REGUSERS
PERMISSIONS
ORG_ACCDEFAULTS
BUDGETTYPE
KSHK
INTERFACES
GROUPSWORKPLACES
GROUPINF_CLS
CURRENCYCLS
MEANSCLS
WORKPLACES_NEWREPORTS
WORKPLACES_INTERFACE
REG_JOURNAL
*/
/* ACCCUROPERATION*/
ALTER TABLE ACCCUROPERATION ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_ACCCUROPERATION_BI_500
CREATE OR REPLACE TRIGGER TR_ACCCUROPERATION_BI
  BEFORE INSERT
  ON ACCCUROPERATION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (TR_ACCCUROPERATION_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_ACCCUROPERATION_BU_500
CREATE OR REPLACE TRIGGER TR_ACCCUROPERATION_BU_500
  BEFORE UPDATE
  ON ACCCUROPERATION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_ACCCUROPERATION_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE ACCCUROPERATION SET
  createdate = SYSDATE,
  createruser = user
/
/* WORKPLACES*/
ALTER TABLE WORKPLACES ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_WORKPLACES_BI_500
CREATE OR REPLACE TRIGGER TR_WORKPLACES_BI
  BEFORE INSERT
  ON WORKPLACES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_WORKPLACES_BI)
-- Last update 18.02.2004
-- - - - - - - - - - - - -

	if (:new.ID is null) then
		select g_Shared.NextVal into :new.ID from dual;
	end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_WORKPLACES_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_WORKPLACES_BU_500
CREATE OR REPLACE TRIGGER TR_WORKPLACES_BU_500
  BEFORE UPDATE
  ON WORKPLACES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_WORKPLACES_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE WORKPLACES SET
  createdate = SYSDATE,
  createruser = user
/
/* USER_WORKPLACES*/
ALTER TABLE TB_USER_WORKPLACES ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/

CREATE OR REPLACE VIEW USER_WORKPLACES (
  ID,
  USERS_REF,
  WORKPLACES_REF,
  DEFAULTWORKPLACE,
  UPDATEDATE,
  CREATEDATE,
  CREATERUSER,
  UPDATERUSER)
AS
  SELECT
    ID,
    USERS_REF,
    WORKPLACES_REF,
    DEFAULTWORKPLACE,
    UPDATEDATE,
    CREATEDATE,
    CREATERUSER,
    UPDATERUSER
  FROM TB_USER_WORKPLACES
/

CREATE OR REPLACE TRIGGER TR_USER_WORKPLACES_ID
  INSTEAD OF DELETE
  ON USER_WORKPLACES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_USER_WORKPLACES_BD)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

  -- Запрет удаления доступа администратора к его первичному месту
  if (:old.id = 0) then
    RaiseException('EX_CANTDELETETHIS');
  end if;

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

END;
/

CREATE OR REPLACE TRIGGER TR_USER_WORKPLACES_II
  INSTEAD OF INSERT
  ON USER_WORKPLACES
  FOR EACH ROW
DECLARE
  new$ID USER_WORKPLACES.ID%TYPE := :NEW.ID;
  new$USERS_REF USER_WORKPLACES.USERS_REF%TYPE := :NEW.USERS_REF;
  new$WORKPLACES_REF USER_WORKPLACES.WORKPLACES_REF%TYPE := :NEW.WORKPLACES_REF;
  new$DEFAULTWORKPLACE USER_WORKPLACES.DEFAULTWORKPLACE%TYPE := :NEW.DEFAULTWORKPLACE;
  new$UPDATEDATE USER_WORKPLACES.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATEDATE USER_WORKPLACES.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$CREATERUSER USER_WORKPLACES.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER USER_WORKPLACES.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_USER_WORKPLACES_BI)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

  if (new$id is null) then select g_Shared.NextVal into new$ID from dual; end if;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_USER_WORKPLACES (
    ID,
    USERS_REF,
    WORKPLACES_REF,
    DEFAULTWORKPLACE,
    UPDATEDATE,
    CREATEDATE,
    CREATERUSER,
    UPDATERUSER
  ) VALUES (
    new$ID,
    new$USERS_REF,
    new$WORKPLACES_REF,
    new$DEFAULTWORKPLACE,
    new$UPDATEDATE,
    new$CREATEDATE,
    new$CREATERUSER,
    new$UPDATERUSER);

END;
/

CREATE OR REPLACE TRIGGER TR_USER_WORKPLACES_IU
  INSTEAD OF UPDATE
  ON USER_WORKPLACES
  FOR EACH ROW
DECLARE
  new$ID USER_WORKPLACES.ID%TYPE := :NEW.ID;
  new$USERS_REF USER_WORKPLACES.USERS_REF%TYPE := :NEW.USERS_REF;
  new$WORKPLACES_REF USER_WORKPLACES.WORKPLACES_REF%TYPE := :NEW.WORKPLACES_REF;
  new$DEFAULTWORKPLACE USER_WORKPLACES.DEFAULTWORKPLACE%TYPE := :NEW.DEFAULTWORKPLACE;
  new$UPDATEDATE USER_WORKPLACES.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATEDATE USER_WORKPLACES.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$CREATERUSER USER_WORKPLACES.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER USER_WORKPLACES.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_USER_WORKPLACES_BU)
-- Last update 13.03.2008
-- - - - - - - - - - - - -

  -- Запрет изменения доступа администратора к его первичному месту
  if ((:old.id = 0) and ((new$Users_ref <> :old.Users_ref) or
    (new$WorkPlaces_ref <> :old.WorkPlaces_ref)))
  then
    RaiseException('EX_CANTUPDATETHIS');
  end if;

-- - - - - - - - - - - - -
-- BU_1 (TR_USER_WORKPLACES_BU_1)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

  if ((new$DefaultWorkplace <> :old.DefaultWorkplace) and (new$DefaultWorkplace <> 0)) then
        update tb_user_workplaces
                set
                        DefaultWorkplace = 0
                where
                        (Users_ref = new$Users_ref) and
                        (id <> new$id);
  end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_USER_WORKPLACES SET
    ID = new$ID,
    USERS_REF = new$USERS_REF,
    WORKPLACES_REF = new$WORKPLACES_REF,
    DEFAULTWORKPLACE = new$DEFAULTWORKPLACE,
    UPDATEDATE = new$UPDATEDATE,
    CREATEDATE = new$CREATEDATE,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER
  WHERE ID = :OLD.ID;

END;
/
-- CREATE TRIGGER TR_USER_WORKPLACES_BI_500
CREATE OR REPLACE TRIGGER TR_USER_WORKPLACES_II
  INSTEAD OF INSERT
  ON USER_WORKPLACES
  FOR EACH ROW
DECLARE
  new$ID USER_WORKPLACES.ID%TYPE := :NEW.ID;
  new$USERS_REF USER_WORKPLACES.USERS_REF%TYPE := :NEW.USERS_REF;
  new$WORKPLACES_REF USER_WORKPLACES.WORKPLACES_REF%TYPE := :NEW.WORKPLACES_REF;
  new$DEFAULTWORKPLACE USER_WORKPLACES.DEFAULTWORKPLACE%TYPE := :NEW.DEFAULTWORKPLACE;
  new$UPDATEDATE USER_WORKPLACES.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATEDATE USER_WORKPLACES.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$CREATERUSER USER_WORKPLACES.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER USER_WORKPLACES.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_USER_WORKPLACES_BI)
-- Last update 25.05.2005
-- - - - - - - - - - - - -

  if (new$id is null) then select g_Shared.NextVal into new$ID from dual; end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_USER_WORKPLACES_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$createdate := SYSDATE;
  new$updatedate := new$createdate;
  new$createruser := user;
  new$updateruser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_USER_WORKPLACES (
    ID,
    USERS_REF,
    WORKPLACES_REF,
    DEFAULTWORKPLACE,
    UPDATEDATE,
    CREATEDATE,
    CREATERUSER,
    UPDATERUSER
  ) VALUES (
    new$ID,
    new$USERS_REF,
    new$WORKPLACES_REF,
    new$DEFAULTWORKPLACE,
    new$UPDATEDATE,
    new$CREATEDATE,
    new$CREATERUSER,
    new$UPDATERUSER);

END;
/
-- CREATE TRIGGER TR_USER_WORKPLACES_BU_500
CREATE OR REPLACE TRIGGER TR_USER_WORKPLACES_BU_500
  BEFORE UPDATE
  ON TB_USER_WORKPLACES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_USER_WORKPLACES_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE USER_WORKPLACES SET
  createdate = SYSDATE,
  createruser = user
/
/* USERGENERATORFIELDS*/
ALTER TABLE USERGENERATORFIELDS ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_USERGENERATORFIELDS_BI_500
CREATE OR REPLACE TRIGGER TR_USERGENERATORFIELDS_BI
  BEFORE INSERT
  ON USERGENERATORFIELDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_USERGENERATORFIELDS_BI_0)
-- Create 21.08.2006
-- Last update 30.11.2006
-- - - - - - - - - - - - -

  if (:new.ID is null) then select g_Shared.nextval into :new.Id from DUAL; end if;
  if (:new.SetOf is null) then :new.SetOf := 0; end if;
  if (:new.Step is null) then :new.Step := 1; end if;
  if (:new.GenPosition is null) then :new.GenPosition := 0; end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_USERGENERATORFIELDS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_USERGENERATORFIELDS_BU_500
CREATE OR REPLACE TRIGGER TR_USERGENERATORFIELDS_BU_500
  BEFORE UPDATE
  ON USERGENERATORFIELDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_USERGENERATORFIELDS_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE USERGENERATORFIELDS SET
  createdate = SYSDATE,
  createruser = user
/
/* USERGENERATOR*/
ALTER TABLE USERGENERATOR ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_USERGENERATOR_BI_500
CREATE OR REPLACE TRIGGER TR_USERGENERATOR_BI
  BEFORE INSERT
  ON USERGENERATOR
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_USERGENERATOR_BI)
-- Create 20.03.2006
-- - - - - - - - - - - - -

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

  IF ((:new.GenValueMin is null) or (:new.GenValueMax is null)) then
    FOR R$ IN (SELECT GenValueMin, GenValueMax
         FROM UserGeneratorOpt
         WHERE :new.name LIKE LikeStr
         ORDER BY Priority)
    LOOP
      if (:new.GenValueMin is null) then :new.GenValueMin := R$.GenValueMin; end if;
      if (:new.GenValueMax is null) then :new.GenValueMax := R$.GenValueMax; end if;
      EXIT;
    END LOOP;
    if (:new.GenValueMin is null) then :new.GenValueMin := 1; end if;
    if (:new.GenValueMax is null) then :new.GenValueMax := 2147483647; end if;
  END IF;

  if (:new.GenValue is null) then :new.GenValue := :new.GenValueMin - 1; end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_USERGENERATOR_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_USERGENERATOR_BU_500
CREATE OR REPLACE TRIGGER TR_USERGENERATOR_BU_500
  BEFORE UPDATE
  ON USERGENERATOR
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_USERGENERATOR_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE USERGENERATOR SET
  createdate = SYSDATE,
  createruser = user
/
/* SUBKCSR*/
ALTER TABLE SUBKCSR ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_SUBKCSR_BI_500
CREATE OR REPLACE TRIGGER TR_SUBKCSR_BI
  BEFORE INSERT
  ON SUBKCSR
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (TR_SUBKCSR_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_SUBKCSR_BU_500
CREATE OR REPLACE TRIGGER TR_SUBKCSR_BU_500
  BEFORE UPDATE
  ON SUBKCSR
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_SUBKCSR_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE SUBKCSR SET
  createdate = SYSDATE,
  createruser = user
/
/* STATE_ACTIONJUMPS*/
ALTER TABLE STATE_ACTIONJUMPS ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_STATE_ACTIONJUMPS_BI_500
CREATE OR REPLACE TRIGGER TR_STATE_ACTIONJUMPS_BI
  BEFORE INSERT
  ON STATE_ACTIONJUMPS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_STATE_ACTIONJUMPS_BI_0)
-- - - - - - - - - - - - -

-- 25.08.2004
-- Триггер генерации идентификатора для перехода
  if (:new.ID is null) then
    select g_Shared.NextVal into :new.ID from dual;
  end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_STATE_ACTIONJUMPS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_STATE_ACTIONJUMPS_BU_500
CREATE OR REPLACE TRIGGER TR_STATE_ACTIONJUMPS_BU_500
  BEFORE UPDATE
  ON STATE_ACTIONJUMPS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_STATE_ACTIONJUMPS_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE STATE_ACTIONJUMPS SET
  createdate = SYSDATE,
  createruser = user
/
/* BANKS*/
ALTER TABLE TB_BANKS ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/

CREATE OR REPLACE VIEW BANKS (
  ID,
  MFO,
  COR,
  CLOSED,
  UER,
  UERREAL,
  PZN,
  DATECLOSE,
  UPDATEDATE,
  CREATEDATE,
  CREATERUSER,
  UPDATERUSER)
AS
  SELECT
    ID,
    MFO,
    COR,
    CLOSED,
    UER,
    UERREAL,
    PZN,
    DATECLOSE,
    UPDATEDATE,
    CREATEDATE,
    CREATERUSER,
    UPDATERUSER
  FROM TB_BANKS
/

CREATE OR REPLACE TRIGGER TR_BANKS_ID
  INSTEAD OF DELETE
  ON BANKS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_BANKS_BD)
-- Last update 09.06.2008
-- - - - - - - - - - - - -

  delete from Org_Accounts where bank_ref = :old.id;

-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_BANKS
  WHERE     ID = :OLD.ID;

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

-- - - - - - - - - - - - -
-- AD_500 (TR_BANKS_AD_500)
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_BANKS_II
  INSTEAD OF INSERT
  ON BANKS
  FOR EACH ROW
DECLARE
  new$ID BANKS.ID%TYPE := :NEW.ID;
  new$MFO BANKS.MFO%TYPE := :NEW.MFO;
  new$COR BANKS.COR%TYPE := :NEW.COR;
  new$CLOSED BANKS.CLOSED%TYPE := :NEW.CLOSED;
  new$UER BANKS.UER%TYPE := :NEW.UER;
  new$UERREAL BANKS.UERREAL%TYPE := :NEW.UERREAL;
  new$PZN BANKS.PZN%TYPE := :NEW.PZN;
  new$DATECLOSE BANKS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$UPDATEDATE BANKS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATEDATE BANKS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$CREATERUSER BANKS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER BANKS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_banks_bi)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* проверяем уникальность*/
  CHECK_UNIQUE_BANK(new$MFO, new$COR);
    
  if (new$dateclose is null) then
    new$closed := null;
      
  else
    new$closed := 1;
  END IF;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_BANKS (
    ID,
    MFO,
    COR,
    CLOSED,
    UER,
    UERREAL,
    PZN,
    DATECLOSE,
    UPDATEDATE,
    CREATEDATE,
    CREATERUSER,
    UPDATERUSER
  ) VALUES (
    new$ID,
    new$MFO,
    new$COR,
    new$CLOSED,
    new$UER,
    new$UERREAL,
    new$PZN,
    new$DATECLOSE,
    new$UPDATEDATE,
    new$CREATEDATE,
    new$CREATERUSER,
    new$UPDATERUSER);

-- - - - - - - - - - - - -
-- AI_500 (TR_BANKS_AI_500)
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_BANKS_IU
  INSTEAD OF UPDATE
  ON BANKS
  FOR EACH ROW
DECLARE
  new$ID BANKS.ID%TYPE := :NEW.ID;
  new$MFO BANKS.MFO%TYPE := :NEW.MFO;
  new$COR BANKS.COR%TYPE := :NEW.COR;
  new$CLOSED BANKS.CLOSED%TYPE := :NEW.CLOSED;
  new$UER BANKS.UER%TYPE := :NEW.UER;
  new$UERREAL BANKS.UERREAL%TYPE := :NEW.UERREAL;
  new$PZN BANKS.PZN%TYPE := :NEW.PZN;
  new$DATECLOSE BANKS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$UPDATEDATE BANKS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATEDATE BANKS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$CREATERUSER BANKS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER BANKS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_banks_bu)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* проверяем уникальность, когда реально поменялся БИК или корсчёт */
  if ((:old.mfo is null and new$mfo is not null)
  or (:old.mfo is not null and new$mfo is null)
  or (:old.cor is null and new$cor is not null)
  or (:old.cor is not null and new$cor is null)
  or (new$mfo <> :old.mfo)
  or (new$cor <> :old.cor))
  then
    CHECK_UNIQUE_BANK(new$MFO, new$COR);
  END IF;
    
  /* При закрытии банка */
  if (new$DateClose is not null) then
    new$Closed := 1;
    /* закрываем счета обслуживаемые этим банком*/
    if (:old.DateClose is null) then
      update Org_Accounts set CloseCode = CloseCode + 1000 where Bank_Ref = new$ID;
      
    END IF;
  END IF;
  /* При открытии банка */
  if (new$DateClose is null) then
    new$Closed := null;
    /* открываем счета обслуживаемые этим банком */
    if (:old.DateClose is not null) then
      update Org_Accounts set CloseCode = CloseCode - 1000 where Bank_Ref = new$ID;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_BANKS SET
    ID = new$ID,
    MFO = new$MFO,
    COR = new$COR,
    CLOSED = new$CLOSED,
    UER = new$UER,
    UERREAL = new$UERREAL,
    PZN = new$PZN,
    DATECLOSE = new$DATECLOSE,
    UPDATEDATE = new$UPDATEDATE,
    CREATEDATE = new$CREATEDATE,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER
  WHERE ID = :old.ID;

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

-- - - - - - - - - - - - -
-- AU_0 (TR_BANKS_AU)
-- Create 27.07.2007
-- - - - - - - - - - - - -

  /* При закрытии банка */
  if ((new$DateClose is not null) and (:old.DateClose is null)) then
   /* Закрываем соответствующую организацию */
   update Organizations 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 Organizations set
      DateClose = null
    where (ID = new$ID) and (DateClose is not null);
  end if;

-- - - - - - - - - - - - -
-- AU_500 (TR_BANKS_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_BANKS_BI_500
CREATE OR REPLACE TRIGGER TR_BANKS_II
  INSTEAD OF INSERT
  ON BANKS
  FOR EACH ROW
DECLARE
  new$ID BANKS.ID%TYPE := :NEW.ID;
  new$MFO BANKS.MFO%TYPE := :NEW.MFO;
  new$COR BANKS.COR%TYPE := :NEW.COR;
  new$CLOSED BANKS.CLOSED%TYPE := :NEW.CLOSED;
  new$UER BANKS.UER%TYPE := :NEW.UER;
  new$UERREAL BANKS.UERREAL%TYPE := :NEW.UERREAL;
  new$PZN BANKS.PZN%TYPE := :NEW.PZN;
  new$DATECLOSE BANKS.DATECLOSE%TYPE := :NEW.DATECLOSE;
  new$UPDATEDATE BANKS.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATEDATE BANKS.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$CREATERUSER BANKS.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER BANKS.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_banks_bi)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  /* проверяем уникальность*/
  CHECK_UNIQUE_BANK(new$MFO, new$COR);
    
  if (new$dateclose is null) then
    new$closed := null;
      
  else
    new$closed := 1;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_BANKS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$createdate := SYSDATE;
  new$updatedate := new$createdate;
  new$createruser := user;
  new$updateruser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_BANKS (
    ID,
    MFO,
    COR,
    CLOSED,
    UER,
    UERREAL,
    PZN,
    DATECLOSE,
    UPDATEDATE,
    CREATEDATE,
    CREATERUSER,
    UPDATERUSER
  ) VALUES (
    new$ID,
    new$MFO,
    new$COR,
    new$CLOSED,
    new$UER,
    new$UERREAL,
    new$PZN,
    new$DATECLOSE,
    new$UPDATEDATE,
    new$CREATEDATE,
    new$CREATERUSER,
    new$UPDATERUSER);

-- - - - - - - - - - - - -
-- AI_500 (TR_BANKS_AI_500)
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_BANKS_BU_500
CREATE OR REPLACE TRIGGER TR_BANKS_BU_500
  BEFORE UPDATE
  ON TB_BANKS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_BANKS_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE BANKS SET
  createdate = SYSDATE,
  createruser = user
/
/* REGUSERS*/
ALTER TABLE REGUSERS ADD (
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_REGUSERS_BI_500
CREATE OR REPLACE TRIGGER TR_REGUSERS_BI
  BEFORE INSERT
  ON REGUSERS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_REGUSERS_BI)
-- - - - - - - - - - - - -

  if (:new.ID is null) then
    select g_Shared.NextVal into :new.ID from dual;
  end if;
  :new.DateBegin := SYSDATE;
  :new.DBUserName := USER;

-- - - - - - - - - - - - -
-- BI_500 (TR_REGUSERS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.createruser := user;

END;
/
COMMIT WORK
/
UPDATE REGUSERS SET
  createdate = SYSDATE,
  createruser = user
/
/* PERMISSIONS*/
ALTER TABLE PERMISSIONS ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_PERMISSIONS_BI_500
CREATE OR REPLACE TRIGGER TR_PERMISSIONS_BI
  BEFORE INSERT
  ON PERMISSIONS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (T_PERMISSIONS_BI)
-- Last update 18.02.2004
-- - - - - - - - - - - - -

	if (:new.ID is null) then
		select g_Shared.NextVal into :new.ID from dual;
	end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_PERMISSIONS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_PERMISSIONS_BU_500
CREATE OR REPLACE TRIGGER TR_PERMISSIONS_BU_500
  BEFORE UPDATE
  ON PERMISSIONS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_PERMISSIONS_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE PERMISSIONS SET
  createdate = SYSDATE,
  createruser = user
/
/* ORG_ACCDEFAULTS*/
ALTER TABLE ORG_ACCDEFAULTS ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_ORG_ACCDEFAULTS_BI_500
CREATE OR REPLACE TRIGGER TR_ORG_ACCDEFAULTS_BI
  BEFORE INSERT
  ON ORG_ACCDEFAULTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (TR_ORG_ACCDEFAULTS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_ORG_ACCDEFAULTS_BU_500
CREATE OR REPLACE TRIGGER TR_ORG_ACCDEFAULTS_BU_500
  BEFORE UPDATE
  ON ORG_ACCDEFAULTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_ORG_ACCDEFAULTS_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE ORG_ACCDEFAULTS SET
  createdate = SYSDATE,
  createruser = user
/
/* BUDGETTYPE*/
ALTER TABLE BUDGETTYPE ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_BUDGETTYPE_BI_500
CREATE OR REPLACE TRIGGER TR_BUDGETTYPE_BI
  BEFORE INSERT
  ON BUDGETTYPE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_BudgetType_BI)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  if (:new.TransfertLevelKind is null) then
    :new.TransfertLevelKind := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_BUDGETTYPE_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_BUDGETTYPE_BU_500
CREATE OR REPLACE TRIGGER TR_BUDGETTYPE_BU_500
  BEFORE UPDATE
  ON BUDGETTYPE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_BUDGETTYPE_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE BUDGETTYPE SET
  createdate = SYSDATE,
  createruser = user
/
/* KSHK*/
ALTER TABLE KSHK ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_KSHK_BI_500
CREATE OR REPLACE TRIGGER TR_KSHK_BI
  BEFORE INSERT
  ON KSHK
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (TR_KSHK_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_KSHK_BU_500
CREATE OR REPLACE TRIGGER TR_KSHK_BU_500
  BEFORE UPDATE
  ON KSHK
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_KSHK_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE KSHK SET
  createdate = SYSDATE,
  createruser = user
/
/* INTERFACES*/
ALTER TABLE TB_INTERFACES ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/

CREATE OR REPLACE VIEW INTERFACES (
  ID,
  GUID,
  NOTE,
  PARAM,
  CLS,
  INTERFACETYPE,
  PARAMCOLLECTION,
  UPDATEDATE,
  CREATEDATE,
  CREATERUSER,
  UPDATERUSER)
AS
  SELECT
    ID,
    GUID,
    NOTE,
    PARAM,
    CLS,
    INTERFACETYPE,
    PARAMCOLLECTION,
    UPDATEDATE,
    CREATEDATE,
    CREATERUSER,
    UPDATERUSER
  FROM TB_INTERFACES
/

CREATE OR REPLACE TRIGGER TR_INTERFACES_ID
  INSTEAD OF DELETE
  ON INTERFACES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_INTERFACES_BD)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if ((:old.GUID = '{5B722355-34AD-47F5-A963-13CBBD4CD43C}') or (:old.GUID = '{7F2E1C22-FD59-11D1-ACA7-008048E62D94}')) then
    RaiseException('ex_CantDeleteThis');
  END IF;

-- - - - - - - - - - - - -
-- BD_1 (TR_INTERFACES_BD_1)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /* Каскад при удалении интерфейса */
  delete from WorkPlaces_Interface  where Interfaces_ref = :old.id;

  /* удалить права выданные на интерфейс. 1000000 - тип объекта - интерфейс */
  delete from DBRights  where (ObjRef = :old.id) and (ObjectKindRef = 1000000);

-- - - - - - - - - - - - -
-- BD_2 (TR_INTERAFCES_BD_2)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  delete from Permissions where InterfaceRef = :old.id;

-- - - - - - - - - - - - -
-- BD_10 (TR_INTERFACES_BD_10)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /*Удаление интерфейса - удаляем все связки его с печат документами*/
  delete from Itf_Docs where Itf_ref = :old.id;

-- - - - - - - - - - - - -
-- BD_11 (TR_INTERFACES_BD_11)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  /*Удаление интерфейса - удаляем все связки его с печат документами*/
  delete from Itf_Ctrl where Itf_ref = :old.id;

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

END;
/

CREATE OR REPLACE TRIGGER TR_INTERFACES_II
  INSTEAD OF INSERT
  ON INTERFACES
  FOR EACH ROW
DECLARE
  new$ID INTERFACES.ID%TYPE := :NEW.ID;
  new$GUID INTERFACES.GUID%TYPE := :NEW.GUID;
  new$NOTE INTERFACES.NOTE%TYPE := :NEW.NOTE;
  new$PARAM INTERFACES.PARAM%TYPE := :NEW.PARAM;
  new$CLS INTERFACES.CLS%TYPE := :NEW.CLS;
  new$INTERFACETYPE INTERFACES.INTERFACETYPE%TYPE := :NEW.INTERFACETYPE;
  new$PARAMCOLLECTION INTERFACES.PARAMCOLLECTION%TYPE := :NEW.PARAMCOLLECTION;
  new$UPDATEDATE INTERFACES.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATEDATE INTERFACES.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$CREATERUSER INTERFACES.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER INTERFACES.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
--
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_INTERFACES_BI)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID is null) then
    select g_Shared.NextVal into new$ID from dual;
  end if;

-- - - - - - - - - - - - -
-- BI_1 (TR_INTERFACES_BI_1)
-- Create 29.04.2005
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  select count(*) into CNT$
    from Interfaces
    where (ID<>new$ID)and(Guid=new$Guid)
      and ((Param=new$Param)or((new$Param is Null) and (Param is Null)));
  if CNT$ <> 0 then           
    RaiseException('ex_DublicateInterface');
  end if;  

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_INTERFACES (
    ID,
    GUID,
    NOTE,
    PARAM,
    CLS,
    INTERFACETYPE,
    PARAMCOLLECTION,
    UPDATEDATE,
    CREATEDATE,
    CREATERUSER,
    UPDATERUSER
  ) VALUES (
    new$ID,
    new$GUID,
    new$NOTE,
    new$PARAM,
    new$CLS,
    new$INTERFACETYPE,
    new$PARAMCOLLECTION,
    new$UPDATEDATE,
    new$CREATEDATE,
    new$CREATERUSER,
    new$UPDATERUSER);

END;
/

CREATE OR REPLACE TRIGGER TR_INTERFACES_IU
  INSTEAD OF UPDATE
  ON INTERFACES
  FOR EACH ROW
DECLARE
  new$ID INTERFACES.ID%TYPE := :NEW.ID;
  new$GUID INTERFACES.GUID%TYPE := :NEW.GUID;
  new$NOTE INTERFACES.NOTE%TYPE := :NEW.NOTE;
  new$PARAM INTERFACES.PARAM%TYPE := :NEW.PARAM;
  new$CLS INTERFACES.CLS%TYPE := :NEW.CLS;
  new$INTERFACETYPE INTERFACES.INTERFACETYPE%TYPE := :NEW.INTERFACETYPE;
  new$PARAMCOLLECTION INTERFACES.PARAMCOLLECTION%TYPE := :NEW.PARAMCOLLECTION;
  new$UPDATEDATE INTERFACES.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATEDATE INTERFACES.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$CREATERUSER INTERFACES.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER INTERFACES.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
--
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_INTERFACES_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (((:old.GUID = '{5B722355-34AD-47F5-A963-13CBBD4CD43C}') or (:old.GUID = '{7F2E1C22-FD59-11D1-ACA7-008048E62D94}')) and (new$GUID <> :old.GUID)) then
    RaiseException('ex_CantUpdateThis');
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_INTERFACES_BU_1)
-- Create 29.04.2005
-- Last update 24.05.2005
-- - - - - - - - - - - - -

   SELECT COUNT (*)
     INTO CNT$
     FROM TB_Interfaces
    WHERE (ID <> new$ID)
      AND (Guid = new$Guid)
      AND ((Param = new$Param) OR ((new$Param IS NULL) AND (Param IS NULL)));

   IF CNT$ <> 0 THEN
      RaiseException ('ex_DublicateInterface');
   END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_INTERFACES SET
    ID = new$ID,
    GUID = new$GUID,
    NOTE = new$NOTE,
    PARAM = new$PARAM,
    CLS = new$CLS,
    INTERFACETYPE = new$INTERFACETYPE,
    PARAMCOLLECTION = new$PARAMCOLLECTION,
    UPDATEDATE = new$UPDATEDATE,
    CREATEDATE = new$CREATEDATE,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER
  WHERE ID = :OLD.ID;

END;
/
-- CREATE TRIGGER TR_INTERFACES_BI_500
CREATE OR REPLACE TRIGGER TR_INTERFACES_II
  INSTEAD OF INSERT
  ON INTERFACES
  FOR EACH ROW
DECLARE
  new$ID INTERFACES.ID%TYPE := :NEW.ID;
  new$GUID INTERFACES.GUID%TYPE := :NEW.GUID;
  new$NOTE INTERFACES.NOTE%TYPE := :NEW.NOTE;
  new$PARAM INTERFACES.PARAM%TYPE := :NEW.PARAM;
  new$CLS INTERFACES.CLS%TYPE := :NEW.CLS;
  new$INTERFACETYPE INTERFACES.INTERFACETYPE%TYPE := :NEW.INTERFACETYPE;
  new$PARAMCOLLECTION INTERFACES.PARAMCOLLECTION%TYPE := :NEW.PARAMCOLLECTION;
  new$UPDATEDATE INTERFACES.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATEDATE INTERFACES.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$CREATERUSER INTERFACES.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER INTERFACES.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
--
  CNT$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_INTERFACES_BI)
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  if (new$ID is null) then
    select g_Shared.NextVal into new$ID from dual;
  end if;

-- - - - - - - - - - - - -
-- BI_1 (TR_INTERFACES_BI_1)
-- Create 29.04.2005
-- Last update 24.05.2005
-- - - - - - - - - - - - -

  select count(*) into CNT$
    from Interfaces
    where (ID<>new$ID)and(Guid=new$Guid)
      and ((Param=new$Param)or((new$Param is Null) and (Param is Null)));
  if CNT$ <> 0 then           
    RaiseException('ex_DublicateInterface');
  end if;  

-- - - - - - - - - - - - -
-- BI_500 (TR_INTERFACES_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  new$createdate := SYSDATE;
  new$updatedate := new$createdate;
  new$createruser := user;
  new$updateruser := user;

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_INTERFACES (
    ID,
    GUID,
    NOTE,
    PARAM,
    CLS,
    INTERFACETYPE,
    PARAMCOLLECTION,
    UPDATEDATE,
    CREATEDATE,
    CREATERUSER,
    UPDATERUSER
  ) VALUES (
    new$ID,
    new$GUID,
    new$NOTE,
    new$PARAM,
    new$CLS,
    new$INTERFACETYPE,
    new$PARAMCOLLECTION,
    new$UPDATEDATE,
    new$CREATEDATE,
    new$CREATERUSER,
    new$UPDATERUSER);

END;
/
-- CREATE TRIGGER TR_INTERFACES_BU_500
CREATE OR REPLACE TRIGGER TR_INTERFACES_BU_500
  BEFORE UPDATE
  ON TB_INTERFACES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_INTERFACES_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE INTERFACES SET
  createdate = SYSDATE,
  createruser = user
/
/* GROUPSWORKPLACES*/
ALTER TABLE GROUPSWORKPLACES ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_GROUPSWORKPLACES_BI_500
CREATE OR REPLACE TRIGGER TR_GROUPSWORKPLACES_BI
  BEFORE INSERT
  ON GROUPSWORKPLACES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_GROUPSWORKPLACES_BI_0)
-- Last update 18.02.2004
-- - - - - - - - - - - - -

-- заполнение значений по умолчанию
  if (:new.ID is null) then select g_Shared.NextVal into :new.ID from dual;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_GROUPSWORKPLACES_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_GROUPSWORKPLACES_BU_500
CREATE OR REPLACE TRIGGER TR_GROUPSWORKPLACES_BU_500
  BEFORE UPDATE
  ON GROUPSWORKPLACES
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_GROUPSWORKPLACES_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE GROUPSWORKPLACES SET
  createdate = SYSDATE,
  createruser = user
/
/* GROUPINF_CLS*/
ALTER TABLE GROUPINF_CLS ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_GROUPINF_CLS_BI_500
CREATE OR REPLACE TRIGGER TR_GROUPINF_CLS_BI
  BEFORE INSERT
  ON GROUPINF_CLS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_GROUPINF_CLS_BI_0)
-- - - - - - - - - - - - -

  GroupInf_CLSDiv(:new.id, :new.Code1, :new.Code2);

-- - - - - - - - - - - - -
-- BI_500 (TR_GROUPINF_CLS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_GROUPINF_CLS_BU_500
CREATE OR REPLACE TRIGGER TR_GROUPINF_CLS_BU_500
  BEFORE UPDATE
  ON GROUPINF_CLS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_GROUPINF_CLS_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE GROUPINF_CLS SET
  createdate = SYSDATE,
  createruser = user
/
/* CURRENCYCLS*/
ALTER TABLE CURRENCYCLS ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_CURRENCYCLS_BI_500
CREATE OR REPLACE TRIGGER TR_CURRENCYCLS_BI
  BEFORE INSERT
  ON CURRENCYCLS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (TR_CURRENCYCLS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_CURRENCYCLS_BU_500
CREATE OR REPLACE TRIGGER TR_CURRENCYCLS_BU_500
  BEFORE UPDATE
  ON CURRENCYCLS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_CURRENCYCLS_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE CURRENCYCLS SET
  createdate = SYSDATE,
  createruser = user
/
/* MEANSCLS*/
ALTER TABLE MEANSCLS ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_MEANSCLS_BI_500
CREATE OR REPLACE TRIGGER TR_MEANSCLS_BI
  BEFORE INSERT
  ON MEANSCLS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (TR_MEANSCLS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_MEANSCLS_BU_500
CREATE OR REPLACE TRIGGER TR_MEANSCLS_BU_500
  BEFORE UPDATE
  ON MEANSCLS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_MEANSCLS_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE MEANSCLS SET
  createdate = SYSDATE,
  createruser = user
/
/* WORKPLACES_NEWREPORTS*/
ALTER TABLE WORKPLACES_NEWREPORTS ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_WORKPLACES_NEWREPORTS_BI_500
CREATE OR REPLACE TRIGGER TR_WORKPLACES_NEWREPORTS_BI
  BEFORE INSERT
  ON WORKPLACES_NEWREPORTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_500 (TR_WORKPLACES_NEWREPORTS_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_WP_NEWREPORTS_BU_500
CREATE OR REPLACE TRIGGER TR_WP_NEWREPORTS_BU_500
  BEFORE UPDATE
  ON WORKPLACES_NEWREPORTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_WP_NEWREPORTS_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE WORKPLACES_NEWREPORTS SET
  createdate = SYSDATE,
  createruser = user
/
/* WORKPLACES_INTERFACE*/
ALTER TABLE WORKPLACES_INTERFACE ADD (
  UPDATEDATE DATE,
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30),
  UPDATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_WORKPLACES_INTERFACE_BI_500
CREATE OR REPLACE TRIGGER TR_WORKPLACES_INTERFACE_BI
  BEFORE INSERT
  ON WORKPLACES_INTERFACE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_WORKPLACES_INTERFACE_BI)
-- Last update 18.02.2004
-- - - - - - - - - - - - -

	if (:new.ID is null) then
		select g_Shared.NextVal into :new.ID from dual;
	end if;

-- - - - - - - - - - - - -
-- BI_500 (TR_WORKPLACES_INTERFACE_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.updatedate := :new.createdate;
  :new.createruser := user;
  :new.updateruser := user;

END;
/
-- CREATE TRIGGER TR_WORKPLACES_INTERFACE_BU_500
CREATE OR REPLACE TRIGGER TR_WORKPLACES_INTERFACE_BU_500
  BEFORE UPDATE
  ON WORKPLACES_INTERFACE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_WORKPLACES_INTERFACE_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.updatedate := SYSDATE;
  :new.updateruser := user;

END;
/
COMMIT WORK
/
UPDATE WORKPLACES_INTERFACE SET
  createdate = SYSDATE,
  createruser = user
/
/* REG_JOURNAL*/
ALTER TABLE REG_JOURNAL ADD (
  CREATEDATE DATE,
  CREATERUSER VARCHAR2(30)
)
/
-- CREATE TRIGGER TR_REG_JOURNAL_BI_500
CREATE OR REPLACE TRIGGER TR_REG_JOURNAL_BI
  BEFORE INSERT
  ON REG_JOURNAL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_REG_JOURNAL_BI)
-- Create 06.10.2009
-- - - - - - - - - - - - -

  if (:new.id is null) then
    select g_shared.NextVal into :new.id from DUAL;
  end if;

  if (:new.DateBegin is null) then
    :new.DateBegin := SYSDATE;
  end if;  

-- - - - - - - - - - - - -
-- BI_500 (TR_REG_JOURNAL_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  :new.createdate := SYSDATE;
  :new.createruser := user;

END;
/
COMMIT WORK
/
UPDATE REG_JOURNAL SET
  createdate = SYSDATE,
  createruser = user
/
COMMIT WORK
/
ALTER TABLE ACCCUROPERATION MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE ACCCUROPERATION MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE ACCCUROPERATION MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE ACCCUROPERATION MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE WORKPLACES MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE WORKPLACES MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE WORKPLACES MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE WORKPLACES MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE TB_USER_WORKPLACES MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE TB_USER_WORKPLACES MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE TB_USER_WORKPLACES MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE TB_USER_WORKPLACES MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE USERGENERATORFIELDS MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE USERGENERATORFIELDS MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE USERGENERATORFIELDS MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE USERGENERATORFIELDS MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE USERGENERATOR MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE USERGENERATOR MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE USERGENERATOR MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE USERGENERATOR MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE SUBKCSR MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE SUBKCSR MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE SUBKCSR MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE SUBKCSR MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE STATE_ACTIONJUMPS MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE STATE_ACTIONJUMPS MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE STATE_ACTIONJUMPS MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE STATE_ACTIONJUMPS MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE TB_BANKS MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE TB_BANKS MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE TB_BANKS MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE TB_BANKS MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE REGUSERS MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE REGUSERS MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE PERMISSIONS MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE PERMISSIONS MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE PERMISSIONS MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE PERMISSIONS MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE ORG_ACCDEFAULTS MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE ORG_ACCDEFAULTS MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE ORG_ACCDEFAULTS MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE ORG_ACCDEFAULTS MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE BUDGETTYPE MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE BUDGETTYPE MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE BUDGETTYPE MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE BUDGETTYPE MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE KSHK MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE KSHK MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE KSHK MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE KSHK MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE TB_INTERFACES MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE TB_INTERFACES MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE TB_INTERFACES MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE TB_INTERFACES MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE GROUPSWORKPLACES MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE GROUPSWORKPLACES MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE GROUPSWORKPLACES MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE GROUPSWORKPLACES MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE GROUPINF_CLS MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE GROUPINF_CLS MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE GROUPINF_CLS MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE GROUPINF_CLS MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE CURRENCYCLS MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE CURRENCYCLS MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE CURRENCYCLS MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE CURRENCYCLS MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE MEANSCLS MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE MEANSCLS MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE MEANSCLS MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE MEANSCLS MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE WORKPLACES_NEWREPORTS MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE WORKPLACES_NEWREPORTS MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE WORKPLACES_NEWREPORTS MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE WORKPLACES_NEWREPORTS MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE WORKPLACES_INTERFACE MODIFY(UPDATEDATE NOT NULL)
/
ALTER TABLE WORKPLACES_INTERFACE MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE WORKPLACES_INTERFACE MODIFY(CREATERUSER NOT NULL)
/
ALTER TABLE WORKPLACES_INTERFACE MODIFY(UPDATERUSER NOT NULL)
/
ALTER TABLE REG_JOURNAL MODIFY(CREATEDATE NOT NULL)
/
ALTER TABLE REG_JOURNAL MODIFY(CREATERUSER NOT NULL)
/

-- #########################################################
-- #########################################################
-- alter_rights801.sql
-- #########################################################
-- #########################################################

/* Укорочение связей в таблицах прав с денормализацией. Запись напрямую ссылается на
  на справочник типов прав RightKind, не только транзитивно через DBRights.rightref.
  Таблица DBRights постепенно просто станет справочником сочетаний "тип права - тип объекта"
  и возможно покинет БД.*/
commit work
/
ALTER TABLE USERSRIGHTS ADD (
  RIGHTKINDREF NUMBER(10)/* Тип права */,
    CHECK((RIGHTKINDREF<=2147483647)AND(RIGHTKINDREF>-2147483648))
)
/
commit work
/
/* Подтягиваем тип права из ссылки на сочетание */
update USERSRIGHTS r set
  RIGHTKINDREF = (select RIGHTKINDREF from DBRIGHTS dr where dr.id = r.rightref)
/
commit work
/
ALTER TABLE USERSRIGHTS ADD (
  CONSTRAINT FK_UR_RIGHTKIND FOREIGN KEY (RIGHTKINDREF) REFERENCES RIGHTKIND (ID)
)
/
CREATE INDEX FK_UR_RIGHTKIND ON USERSRIGHTS(RIGHTKINDREF)
/
commit work
/
-- ALTER TRIGGER tr_UsersRights_BI_0
CREATE OR REPLACE TRIGGER TR_USERSRIGHTS_BI
  BEFORE INSERT
  ON USERSRIGHTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_USERSRIGHTS_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then 
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.IsReject is null) then 
    :new.IsReject := 0;
  END IF;
  /* Сносим тип права пока (на всякий случай) */
  if ((:new.RightKindRef is Null) and not (:new.RightRef is Null)) then
    BEGIN
      select RightKindRef 	into :new.RightKindRef from DBRIGHTS dr where (dr.Id = :new.RightRef)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_USERSRIGHTS_BI_500)
-- - - - - - - - - - - - -

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

END;
/
commit work
/
ALTER TABLE GROUPSRIGHTS ADD (
  RIGHTKINDREF NUMBER(10)/* Тип права */,
    CHECK((RIGHTKINDREF<=2147483647)AND(RIGHTKINDREF>-2147483648))
)
/
commit work
/
/* Подтягиваем тип права из ссылки на сочетание */
update GROUPSRIGHTS r set
  RIGHTKINDREF = (select RIGHTKINDREF from DBRIGHTS dr where dr.id = r.rightref)
/
commit work
/
ALTER TABLE GROUPSRIGHTS ADD (
  CONSTRAINT FK_GR_RIGHTKIND FOREIGN KEY (RIGHTKINDREF) REFERENCES RIGHTKIND (ID)
)
/
CREATE INDEX FK_GR_RIGHTKIND ON GROUPSRIGHTS(RIGHTKINDREF)
/
commit work
/
-- ALTER TRIGGER tr_GroupsRights_BI_0
CREATE OR REPLACE TRIGGER TR_GROUPSRIGHTS_BI
  BEFORE INSERT
  ON GROUPSRIGHTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_GROUPSRIGHTS_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then 
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.IsReject is null) then 
    :new.IsReject := 0;
  END IF;
  /* Сносим тип права пока (на всякий случай) */
  if ((:new.RightKindRef is Null) and not (:new.RightRef is Null)) then
    BEGIN
      select RightKindRef 	into :new.RightKindRef from DBRIGHTS dr where (dr.Id = :new.RightRef)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_GROUPSRIGHTS_BI_500)
-- - - - - - - - - - - - -

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

END;
/
commit work
/

ALTER TABLE USERSRIGHTS MODIFY(RIGHTKINDREF NOT NULL)
/
ALTER TABLE GROUPSRIGHTS MODIFY(RIGHTKINDREF NOT NULL)
/

-- #########################################################
-- #########################################################
-- Update_PayDocExchange.sql
-- #########################################################
-- #########################################################

/* Скрипт проставляет нулевой код формата там, где он не заполнен.*/
update paydocexchange
set
  codeformat = 0
where
  codeformat is null
/
COMMIT WORK
/

-- #########################################################
-- #########################################################
-- alter_DbUsers_Add_UserInfo.sql
-- #########################################################
-- #########################################################

ALTER TABLE TB_DbUsers ADD (
  PrincipalName VARCHAR2(255),
  UserGUID VARCHAR2(50)
)
/

CREATE OR REPLACE VIEW DbUsers (
  ID,
  USERNAME,
  FIRSTNAME,
  MIDDLENAME,
  LASTNAME,
  NOTE,
  PHONE,
  DESCRIPTION,
  DEPARTMENTCLS,
  REMOTECLIENTREF,
  REMOTEID,
  CREATEDATE,
  UPDATEDATE,
  CRYPTOPARAMS,
  CRYPTOID,
  ORG_REF,
  NOTE2,
  EMAILADDRESS,
  PRINCIPALNAME,
  USERGUID)
AS
  SELECT
    ID,
    USERNAME,
    FIRSTNAME,
    MIDDLENAME,
    LASTNAME,
    NOTE,
    PHONE,
    DESCRIPTION,
    DEPARTMENTCLS,
    REMOTECLIENTREF,
    REMOTEID,
    CREATEDATE,
    UPDATEDATE,
    CRYPTOPARAMS,
    CRYPTOID,
    ORG_REF,
    NOTE2,
    EMAILADDRESS,
    PRINCIPALNAME,
    USERGUID
  FROM TB_DbUsers
/

CREATE OR REPLACE TRIGGER TR_DBUsers_II
  INSTEAD OF INSERT
  ON DBUsers
  FOR EACH ROW
DECLARE
  new$ID DBUsers.ID%TYPE := :NEW.ID;
  new$USERNAME DBUsers.USERNAME%TYPE := :NEW.USERNAME;
  new$FIRSTNAME DBUsers.FIRSTNAME%TYPE := :NEW.FIRSTNAME;
  new$MIDDLENAME DBUsers.MIDDLENAME%TYPE := :NEW.MIDDLENAME;
  new$LASTNAME DBUsers.LASTNAME%TYPE := :NEW.LASTNAME;
  new$NOTE DBUsers.NOTE%TYPE := :NEW.NOTE;
  new$PHONE DBUsers.PHONE%TYPE := :NEW.PHONE;
  new$DESCRIPTION DBUsers.DESCRIPTION%TYPE := :NEW.DESCRIPTION;
  new$DEPARTMENTCLS DBUsers.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$REMOTECLIENTREF DBUsers.REMOTECLIENTREF%TYPE := :NEW.REMOTECLIENTREF;
  new$REMOTEID DBUsers.REMOTEID%TYPE := :NEW.REMOTEID;
  new$CREATEDATE DBUsers.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DBUsers.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CRYPTOPARAMS DBUsers.CRYPTOPARAMS%TYPE := :NEW.CRYPTOPARAMS;
  new$CRYPTOID DBUsers.CRYPTOID%TYPE := :NEW.CRYPTOID;
  new$ORG_REF DBUsers.ORG_REF%TYPE := :NEW.ORG_REF;
  new$NOTE2 DBUsers.NOTE2%TYPE := :NEW.NOTE2;
  new$EMAILADDRESS DBUsers.EMAILADDRESS%TYPE := :NEW.EMAILADDRESS;
  new$PRINCIPALNAME DBUsers.PRINCIPALNAME%TYPE := :NEW.PRINCIPALNAME;
  new$USERGUID DBUsers.USERGUID%TYPE := :NEW.USERGUID;
--
  cGroupID$ NUMBER(10);
  acc$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DBUSERS_BI)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  new$UserName := Upper(new$UserName);
  if (new$RemoteClientRef is null) then 
    new$RemoteID := -1;
     
  else 
    new$RemoteID := new$RemoteClientRef;
  END IF;
  if (new$Org_Ref is null) then
    GetIntConst(-1, 2,acc$);
    BEGIN
      select
      o.id
      into
      new$Org_Ref    from
      organizations o
      left join org_accounts oa on (oa.org_ref = o.id)
      where
      (oa.id = acc$)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (new$Org_Ref is null) then
      new$Org_Ref := 0;
     
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DBUSERS_BI_500)
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_DBUsers (
    ID,
    USERNAME,
    FIRSTNAME,
    MIDDLENAME,
    LASTNAME,
    NOTE,
    PHONE,
    DESCRIPTION,
    DEPARTMENTCLS,
    REMOTECLIENTREF,
    REMOTEID,
    CREATEDATE,
    UPDATEDATE,
    CRYPTOPARAMS,
    CRYPTOID,
    ORG_REF,
    NOTE2,
    EMAILADDRESS,
    PRINCIPALNAME,
    USERGUID
  ) VALUES (
    new$ID,
    new$USERNAME,
    new$FIRSTNAME,
    new$MIDDLENAME,
    new$LASTNAME,
    new$NOTE,
    new$PHONE,
    new$DESCRIPTION,
    new$DEPARTMENTCLS,
    new$REMOTECLIENTREF,
    new$REMOTEID,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$CRYPTOPARAMS,
    new$CRYPTOID,
    new$ORG_REF,
    new$NOTE2,
    new$EMAILADDRESS,
    new$PRINCIPALNAME,
    new$USERGUID);

-- - - - - - - - - - - - -
-- AI_0 (TR_DBUSERS_AI)
-- Last update 30.03.2006
-- - - - - - - - - - - - -

 insert into UsersInGroups (UserRef, GroupRef)
      values (new$id, 0);

 /* добавляем пользователя в ФинОрган */
 if (new$RemoteID = -1) then
     /* Выбираем ID ФинОргана */
     select max(ID) into cGroupID$ from DBGroups where (Name = 'ФинОрган');
     if (not (cGroupID$ is null)) then
     	insert into UsersInGroups (UserRef, GroupRef)
     	values (new$ID, cGroupID$);
     end if;
 /* иначе добавляем в УРМ */
 else
 	 /* Выбираем ID группы УРМ */
     select max(ID) into cGroupID$ from DBGroups where (Name = 'УРМ');
     if (not (cGroupID$ is null)) then
     	insert into UsersInGroups (UserRef, GroupRef)
     	values (new$ID, cGroupID$);
     end if;
 end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_DBUSERS_AI_500)
-- Last update 18.02.2004
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_DBUsers_IU
  INSTEAD OF UPDATE
  ON DBUsers
  FOR EACH ROW
DECLARE
  new$ID DBUsers.ID%TYPE := :NEW.ID;
  new$USERNAME DBUsers.USERNAME%TYPE := :NEW.USERNAME;
  new$FIRSTNAME DBUsers.FIRSTNAME%TYPE := :NEW.FIRSTNAME;
  new$MIDDLENAME DBUsers.MIDDLENAME%TYPE := :NEW.MIDDLENAME;
  new$LASTNAME DBUsers.LASTNAME%TYPE := :NEW.LASTNAME;
  new$NOTE DBUsers.NOTE%TYPE := :NEW.NOTE;
  new$PHONE DBUsers.PHONE%TYPE := :NEW.PHONE;
  new$DESCRIPTION DBUsers.DESCRIPTION%TYPE := :NEW.DESCRIPTION;
  new$DEPARTMENTCLS DBUsers.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$REMOTECLIENTREF DBUsers.REMOTECLIENTREF%TYPE := :NEW.REMOTECLIENTREF;
  new$REMOTEID DBUsers.REMOTEID%TYPE := :NEW.REMOTEID;
  new$CREATEDATE DBUsers.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DBUsers.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CRYPTOPARAMS DBUsers.CRYPTOPARAMS%TYPE := :NEW.CRYPTOPARAMS;
  new$CRYPTOID DBUsers.CRYPTOID%TYPE := :NEW.CRYPTOID;
  new$ORG_REF DBUsers.ORG_REF%TYPE := :NEW.ORG_REF;
  new$NOTE2 DBUsers.NOTE2%TYPE := :NEW.NOTE2;
  new$EMAILADDRESS DBUsers.EMAILADDRESS%TYPE := :NEW.EMAILADDRESS;
  new$PRINCIPALNAME DBUsers.PRINCIPALNAME%TYPE := :NEW.PRINCIPALNAME;
  new$USERGUID DBUsers.USERGUID%TYPE := :NEW.USERGUID;
--
  cGroupID1$ NUMBER(10);
  acc$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_DBUSERS_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  new$UserName := Upper(new$UserName);
  if (new$RemoteClientRef is null) then
    new$RemoteID := -1;
     
  else 
    new$RemoteID := new$RemoteClientRef;
  END IF;
  /* переводим пользователя в группу ФинОрган, если раньше он был в УРМ */
  if ((:old.RemoteID > 0) and (new$RemoteID = -1)) then
    select max(ID)       into cGroupID1$ from DBGroups where (Name = 'ФинОрган')
    ;
    if (not (cGroupID1$ is null)) then
      update UsersInGroups uig set uig.GroupRef = cGroupID1$

      where (uig.UserRef = :old.ID) and
      ((select Name from DBGroups dbg where dbg.ID = uig.GroupRef) = 'УРМ');
     
    END IF;
  END IF;
  /* переводим пользователя в группу УРМ, если раньше он был в ФинОргане */
  if ((:old.RemoteID = -1) and (new$RemoteID > 0)) then
    select max(ID)       into cGroupID1$ from DBGroups where (Name = 'УРМ')
    ;
    if (not (cGroupID1$ is null)) then
      update UsersInGroups uig set uig.GroupRef = cGroupID1$

      where (uig.UserRef = :old.ID) and
      ((select Name from DBGroups dbg where dbg.ID = uig.GroupRef) = 'ФинОрган');
     
    END IF;
  END IF;
  if (new$Org_Ref is null) then
    GetIntConst(-1, 2,acc$);
    BEGIN
      select
      o.id
      into
      new$Org_Ref    from
      organizations o
      left join org_accounts oa on (oa.org_ref = o.id)
      where
      (oa.id = acc$)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (new$Org_Ref is null) then
      new$Org_Ref := 0;
     
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_DBUSERS_BU_1)
-- Last update 30.03.2006
-- - - - - - - - - - - - -

-- Запрет изменения пользователя SYSDBA
 if ((:old.id = 0) and (new$UserName <> :old.UserName)) then
-- exception ex_CantUpdateThis;
   RaiseException('EX_CANTUPDATETHIS');
 end if;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_DBUsers SET
    ID = new$ID,
    USERNAME = new$USERNAME,
    FIRSTNAME = new$FIRSTNAME,
    MIDDLENAME = new$MIDDLENAME,
    LASTNAME = new$LASTNAME,
    NOTE = new$NOTE,
    PHONE = new$PHONE,
    DESCRIPTION = new$DESCRIPTION,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    REMOTECLIENTREF = new$REMOTECLIENTREF,
    REMOTEID = new$REMOTEID,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    CRYPTOPARAMS = new$CRYPTOPARAMS,
    CRYPTOID = new$CRYPTOID,
    ORG_REF = new$ORG_REF,
    NOTE2 = new$NOTE2,
    EMAILADDRESS = new$EMAILADDRESS,
    PRINCIPALNAME = new$PRINCIPALNAME,
    USERGUID = new$USERGUID
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_500 (TR_DBUSERS_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

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

END;
/

CREATE OR REPLACE TRIGGER TR_DBUsers_ID
  INSTEAD OF DELETE
  ON DBUsers
  FOR EACH ROW
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 9.00.00.1
-- - - - - - - - - - - - -

  /* не должно остаться RemoteClients без DBUsers */  
  if (:old.RemoteClientRef is not null) then
    delete from RemoteClient where ID = :old.RemoteClientRef;
  END IF;

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

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

END;
/
COMMIT WORK 
/
INSERT INTO SqlExceptions(Name, Code, Text) VALUES ('EX_DBUSERS_DUBLICATENAME', -20353, 'Пользователь с таким уникальным именем уже существует')
/
commit work
/
-- ALTER TRIGGER tr_dbusers_bi
CREATE OR REPLACE TRIGGER TR_DBUsers_II
  INSTEAD OF INSERT
  ON DBUsers
  FOR EACH ROW
DECLARE
  new$ID DBUsers.ID%TYPE := :NEW.ID;
  new$USERNAME DBUsers.USERNAME%TYPE := :NEW.USERNAME;
  new$FIRSTNAME DBUsers.FIRSTNAME%TYPE := :NEW.FIRSTNAME;
  new$MIDDLENAME DBUsers.MIDDLENAME%TYPE := :NEW.MIDDLENAME;
  new$LASTNAME DBUsers.LASTNAME%TYPE := :NEW.LASTNAME;
  new$NOTE DBUsers.NOTE%TYPE := :NEW.NOTE;
  new$PHONE DBUsers.PHONE%TYPE := :NEW.PHONE;
  new$DESCRIPTION DBUsers.DESCRIPTION%TYPE := :NEW.DESCRIPTION;
  new$DEPARTMENTCLS DBUsers.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$REMOTECLIENTREF DBUsers.REMOTECLIENTREF%TYPE := :NEW.REMOTECLIENTREF;
  new$REMOTEID DBUsers.REMOTEID%TYPE := :NEW.REMOTEID;
  new$CREATEDATE DBUsers.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DBUsers.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CRYPTOPARAMS DBUsers.CRYPTOPARAMS%TYPE := :NEW.CRYPTOPARAMS;
  new$CRYPTOID DBUsers.CRYPTOID%TYPE := :NEW.CRYPTOID;
  new$ORG_REF DBUsers.ORG_REF%TYPE := :NEW.ORG_REF;
  new$NOTE2 DBUsers.NOTE2%TYPE := :NEW.NOTE2;
  new$EMAILADDRESS DBUsers.EMAILADDRESS%TYPE := :NEW.EMAILADDRESS;
  new$PRINCIPALNAME DBUsers.PRINCIPALNAME%TYPE := :NEW.PRINCIPALNAME;
  new$USERGUID DBUsers.USERGUID%TYPE := :NEW.USERGUID;
--
  cGroupID$ NUMBER(10);
  acc1$ NUMBER(10);
  CNT$1 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DBUSERS_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (new$id is null) then 
    select g_shared.nextval into new$id from dual;
  END IF;
  new$UserName := Upper(new$UserName);
  if (new$RemoteClientRef is null) then 
    new$RemoteID := -1;
     
  else 
    new$RemoteID := new$RemoteClientRef;
  END IF;
  if (new$Org_Ref is null) then
    GetIntConst(-1, 2,acc1$);
    BEGIN
      select
      o.id
      into
      new$Org_Ref    from
      organizations o
      left join org_accounts oa on (oa.org_ref = o.id)
      where
      (oa.id = acc1$)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (new$Org_Ref is null) then
      new$Org_Ref := 0;
     
    END IF;
  END IF;
  if (new$RemoteClientRef is not null) then
    new$PrincipalName := null;
  END IF;
  if (new$PrincipalName is not null) then
    SELECT COUNT(id ) INTO CNT$1
    from dbUsers where (PrincipalName = new$PrincipalName) AND (ROWNUM = 1);
    if ((CNT$1<> 0)) then
      RaiseException('EX_DBUSERS_DUBLICATENAME');
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DBUSERS_BI_500)
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_DBUsers (
    ID,
    USERNAME,
    FIRSTNAME,
    MIDDLENAME,
    LASTNAME,
    NOTE,
    PHONE,
    DESCRIPTION,
    DEPARTMENTCLS,
    REMOTECLIENTREF,
    REMOTEID,
    CREATEDATE,
    UPDATEDATE,
    CRYPTOPARAMS,
    CRYPTOID,
    ORG_REF,
    NOTE2,
    EMAILADDRESS,
    PRINCIPALNAME,
    USERGUID
  ) VALUES (
    new$ID,
    new$USERNAME,
    new$FIRSTNAME,
    new$MIDDLENAME,
    new$LASTNAME,
    new$NOTE,
    new$PHONE,
    new$DESCRIPTION,
    new$DEPARTMENTCLS,
    new$REMOTECLIENTREF,
    new$REMOTEID,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$CRYPTOPARAMS,
    new$CRYPTOID,
    new$ORG_REF,
    new$NOTE2,
    new$EMAILADDRESS,
    new$PRINCIPALNAME,
    new$USERGUID);

-- - - - - - - - - - - - -
-- AI_0 (TR_DBUSERS_AI)
-- Last update 30.03.2006
-- - - - - - - - - - - - -

 insert into UsersInGroups (UserRef, GroupRef)
      values (new$id, 0);

 /* добавляем пользователя в ФинОрган */
 if (new$RemoteID = -1) then
     /* Выбираем ID ФинОргана */
     select max(ID) into cGroupID$ from DBGroups where (Name = 'ФинОрган');
     if (not (cGroupID$ is null)) then
     	insert into UsersInGroups (UserRef, GroupRef)
     	values (new$ID, cGroupID$);
     end if;
 /* иначе добавляем в УРМ */
 else
 	 /* Выбираем ID группы УРМ */
     select max(ID) into cGroupID$ from DBGroups where (Name = 'УРМ');
     if (not (cGroupID$ is null)) then
     	insert into UsersInGroups (UserRef, GroupRef)
     	values (new$ID, cGroupID$);
     end if;
 end if;

-- - - - - - - - - - - - -
-- AI_500 (TR_DBUSERS_AI_500)
-- Last update 18.02.2004
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER tr_dbusers_bu_1
CREATE OR REPLACE TRIGGER TR_DBUsers_IU
  INSTEAD OF UPDATE
  ON DBUsers
  FOR EACH ROW
DECLARE
  new$ID DBUsers.ID%TYPE := :NEW.ID;
  new$USERNAME DBUsers.USERNAME%TYPE := :NEW.USERNAME;
  new$FIRSTNAME DBUsers.FIRSTNAME%TYPE := :NEW.FIRSTNAME;
  new$MIDDLENAME DBUsers.MIDDLENAME%TYPE := :NEW.MIDDLENAME;
  new$LASTNAME DBUsers.LASTNAME%TYPE := :NEW.LASTNAME;
  new$NOTE DBUsers.NOTE%TYPE := :NEW.NOTE;
  new$PHONE DBUsers.PHONE%TYPE := :NEW.PHONE;
  new$DESCRIPTION DBUsers.DESCRIPTION%TYPE := :NEW.DESCRIPTION;
  new$DEPARTMENTCLS DBUsers.DEPARTMENTCLS%TYPE := :NEW.DEPARTMENTCLS;
  new$REMOTECLIENTREF DBUsers.REMOTECLIENTREF%TYPE := :NEW.REMOTECLIENTREF;
  new$REMOTEID DBUsers.REMOTEID%TYPE := :NEW.REMOTEID;
  new$CREATEDATE DBUsers.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE DBUsers.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CRYPTOPARAMS DBUsers.CRYPTOPARAMS%TYPE := :NEW.CRYPTOPARAMS;
  new$CRYPTOID DBUsers.CRYPTOID%TYPE := :NEW.CRYPTOID;
  new$ORG_REF DBUsers.ORG_REF%TYPE := :NEW.ORG_REF;
  new$NOTE2 DBUsers.NOTE2%TYPE := :NEW.NOTE2;
  new$EMAILADDRESS DBUsers.EMAILADDRESS%TYPE := :NEW.EMAILADDRESS;
  new$PRINCIPALNAME DBUsers.PRINCIPALNAME%TYPE := :NEW.PRINCIPALNAME;
  new$USERGUID DBUsers.USERGUID%TYPE := :NEW.USERGUID;
--
  cGroupID1$ NUMBER(10);
  acc$ NUMBER(10);
  CNT$1 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_DBUSERS_BU)
-- Version 7.01.00.1
-- - - - - - - - - - - - -

  new$UserName := Upper(new$UserName);
  if (new$RemoteClientRef is null) then
    new$RemoteID := -1;
     
  else 
    new$RemoteID := new$RemoteClientRef;
  END IF;
  /* переводим пользователя в группу ФинОрган, если раньше он был в УРМ */
  if ((:old.RemoteID > 0) and (new$RemoteID = -1)) then
    select max(ID)       into cGroupID1$ from DBGroups where (Name = 'ФинОрган')
    ;
    if (not (cGroupID1$ is null)) then
      update UsersInGroups uig set uig.GroupRef = cGroupID1$

      where (uig.UserRef = :old.ID) and
      ((select Name from DBGroups dbg where dbg.ID = uig.GroupRef) = 'УРМ');
     
    END IF;
  END IF;
  /* переводим пользователя в группу УРМ, если раньше он был в ФинОргане */
  if ((:old.RemoteID = -1) and (new$RemoteID > 0)) then
    select max(ID)       into cGroupID1$ from DBGroups where (Name = 'УРМ')
    ;
    if (not (cGroupID1$ is null)) then
      update UsersInGroups uig set uig.GroupRef = cGroupID1$

      where (uig.UserRef = :old.ID) and
      ((select Name from DBGroups dbg where dbg.ID = uig.GroupRef) = 'ФинОрган');
     
    END IF;
  END IF;
  if (new$Org_Ref is null) then
    GetIntConst(-1, 2,acc$);
    BEGIN
      select
      o.id
      into
      new$Org_Ref    from
      organizations o
      left join org_accounts oa on (oa.org_ref = o.id)
      where
      (oa.id = acc$)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if (new$Org_Ref is null) then
      new$Org_Ref := 0;
     
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- BU_1 (TR_DBUSERS_BU_1)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if ((:old.id = 0) and (new$UserName <> :old.UserName)) then 
    RaiseException('ex_CantUpdateThis');
  END IF;
  if (new$RemoteClientRef is not null) then
    new$PrincipalName := null;
  END IF;
  if (new$PrincipalName is not null) then
    SELECT COUNT(id ) INTO CNT$1
    from dbUsers where ((PrincipalName = new$PrincipalName) and id <> new$ID) AND (ROWNUM = 1);
    if ((CNT$1<> 0)) then
      RaiseException('EX_DBUSERS_DUBLICATENAME');
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_DBUsers SET
    ID = new$ID,
    USERNAME = new$USERNAME,
    FIRSTNAME = new$FIRSTNAME,
    MIDDLENAME = new$MIDDLENAME,
    LASTNAME = new$LASTNAME,
    NOTE = new$NOTE,
    PHONE = new$PHONE,
    DESCRIPTION = new$DESCRIPTION,
    DEPARTMENTCLS = new$DEPARTMENTCLS,
    REMOTECLIENTREF = new$REMOTECLIENTREF,
    REMOTEID = new$REMOTEID,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    CRYPTOPARAMS = new$CRYPTOPARAMS,
    CRYPTOID = new$CRYPTOID,
    ORG_REF = new$ORG_REF,
    NOTE2 = new$NOTE2,
    EMAILADDRESS = new$EMAILADDRESS,
    PRINCIPALNAME = new$PRINCIPALNAME,
    USERGUID = new$USERGUID
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AU_500 (TR_DBUSERS_AU_500)
-- Create 28.04.2005
-- - - - - - - - - - - - -

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

END;
/
commit work
/
ALTER TABLE dbgroups ADD (
  SYSTEMGROUPID NUMBER(10),
    CHECK((SYSTEMGROUPID<=2147483647)AND(SYSTEMGROUPID>-2147483648))
)
/
commit work 
/
CREATE OR REPLACE procedure CheckGroup(Name$ VARCHAR2,Note$ VARCHAR2,SYSTEMGROUPID$ NUMBER)
AS
  CNT$1 NUMBER(10);
BEGIN
  SELECT COUNT(ID ) INTO CNT$1
  from DBGROUPS where (name = Name$) AND (ROWNUM = 1);
  if (not (CNT$1<> 0)) then
    insert into DBGROUPS
    (Name,Note,SYSTEMGROUPID)
    values
    (Name$,Note$,SYSTEMGROUPID$);
      
  else
    update DBGROUPS set
    SYSTEMGROUPID = SYSTEMGROUPID$

    where Name = Name$;
        
  END IF;
END;
/
commit work 
/
-- ALTER TRIGGER TR_DBGROUPS_BU_0
CREATE OR REPLACE TRIGGER TR_DBGROUPS_BU
  BEFORE UPDATE
  ON DBGROUPS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_DBGROUPS_BU_0)
-- Version 8.00.00.1
-- - - - - - - - - - - - -
  NULL;
--   /* Системные группы нельзя менять*/
--   if (:old.ID < 10) then
--     RaiseException('ex_SystemGroup');
--   END IF;

END;
/
CALL CheckGroup('ALL', 'Все пользователи и группы', 0) 
/
CALL CheckGroup('Администраторы', 'Администраторы системы', 1) 
/
CALL CheckGroup('ФинОрган', 'Пользователи АС "Бюджет"', 2) 
/
CALL CheckGroup('УРМ', null, 3) 
/
CALL CheckGroup('WEB-пользователи', 'Пользователи работающие через WEB', 4) 
/
-- ALTER TRIGGER TR_DBGROUPS_BU_0
CREATE OR REPLACE TRIGGER TR_DBGROUPS_BU
  BEFORE UPDATE
  ON DBGROUPS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_DBGROUPS_BU_0)
-- Version 8.00.00.1
-- - - - - - - - - - - - -

  /* Системные группы нельзя менять*/
  if (:old.ID < 10) then
    RaiseException('ex_SystemGroup');
  END IF;

END;
/
commit work 
/
drop procedure CheckGroup 
/
commit work 
/

-- #########################################################
-- #########################################################
-- alter_TransfertCls_MultiBudget.sql
-- #########################################################
-- #########################################################

/* Поддержка многобюджетности в КЦС - проверка уникальности перенесена в триггер */
ALTER TABLE TRANSFERTCLS DROP CONSTRAINT UQ_TRANSFERTCLS_CLSCODE DROP INDEX
/
INSERT INTO SqlExceptions(Name, Code, Text) VALUES ('EX_DUPLICATE_TRANSFERT', -20354, 'Дублирование Кода целевых средств')
/
-- CREATE TRIGGER TR_TRANSFERTCLS_BI_200
CREATE OR REPLACE TRIGGER TR_TRANSFERTCLS_BI
  BEFORE INSERT
  ON TRANSFERTCLS
  FOR EACH ROW
DECLARE
  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;

END;
/
-- CREATE TRIGGER TR_TRANSFERTCLS_BU_200
CREATE OR REPLACE TRIGGER TR_TRANSFERTCLS_BU
  BEFORE UPDATE
  ON TRANSFERTCLS
  FOR EACH ROW
DECLARE
  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;

END;
/
commit work 
/

-- #########################################################
-- #########################################################
-- TransfertCls
-- #########################################################
-- #########################################################


DROP TRIGGER TR_TRANSFERTCLS_BI
/
DROP TRIGGER TR_TRANSFERTCLS_BU
/
DROP TRIGGER TR_TRANSFERTCLS_BU_500
/
DROP TRIGGER TR_TRANSFERTCLS_AD
/
DROP TRIGGER TR_TRANSFERTCLS_AI
/
DROP TRIGGER TR_TRANSFERTCLS_AU
/

RENAME TransfertCls TO TB_TransfertCls
/
CREATE OR REPLACE TRIGGER TR_TRANSFERTCLS_BU_500
  BEFORE UPDATE
  ON TB_TransfertCls
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_TRANSFERTCLS_BU_500)
-- Create 24.09.2007
-- - - - - - - - - - - - -

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

END;
/

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)
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
  FROM TB_TransfertCls
/

GRANT SELECT, INSERT, UPDATE, DELETE ON TransfertCls TO BUDGET_USERS
/
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;
--
  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
  ) 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);

-- - - - - - - - - - - - -
-- 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;
--
  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
  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;
/

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;
/

COMMIT WORK
/

-- #########################################################
-- #########################################################
-- ALTER_TR_FacialFinDet_BIBU.sql
-- #########################################################
-- #########################################################

/* Скрипт синхронизирует старое и новые поля БО
   для и/ф Внутренние платежи, Учет кассовых выплат, Утверждение ОФ, Распределение ОФ */
UPDATE FacialFinDetail
 set Promise = SourcePromise
where (ProgIndex = 73) AND (Promise is NULL) AND (SourcePromise is not NULL)
/
UPDATE FacialFinDetail
 set SourcePromise = Promise
where (ProgIndex = 73) AND (Promise is not NULL) AND (SourcePromise is NULL)
/
UPDATE FacialFinDetail
 set Promise = DestPromise
where (ProgIndex = 75) AND (Promise is NULL) AND (DestPromise is not NULL)
/
UPDATE FacialFinDetail
 set DestPromise = Promise
where (ProgIndex = 75) AND (Promise is not NULL) AND (DestPromise is NULL)
/
UPDATE FacialFinDetail
 set Promise = DestPromise
where (ProgIndex IN (67, 76)) AND (Promise is NULL) AND (DestPromise is not NULL) AND
      (SourcePromise = DestPromise)
/
UPDATE FacialFinDetail
 set DestPromise = Promise, SourcePromise = Promise
where (ProgIndex IN (67, 76)) AND (Promise is not NULL) AND (DestPromise is NULL) AND
      (SourcePromise is NULL)
/
-- ALTER TRIGGER TR_FACIALFINDETAIL_BI_110
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;
--
  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)
-- Last update 14.02.2006
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- 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
  ) 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);

-- - - - - - - - - - - - -
-- 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;
/
-- ALTER TRIGGER TR_FACIALFINDETAIL_BU_110
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;
--
  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
  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_LayerData_SumFieldNull.sql
-- #########################################################
-- #########################################################


alter table LayerData modify(
  SumField00 default null,
  SumField01 default null,
  SumField02 default null,
  SumField03 default null,
  SumField04 default null,
  SumField05 default null,
  SumField06 default null,
  SumField07 default null,
  SumField08 default null,
  SumField09 default null,
  SumField10 default null,
  SumField11 default null,
  SumField12 default null,
  SumField13 default null,
  SumField14 default null,
  SumField15 default null,
  SumField16 default null,
  SumField17 default null,
  SumField18 default null,
  SumField19 default null,
  SumField20 default null,
  SumField21 default null,
  SumField22 default null,
  SumField23 default null,
  SumField24 default null,
  SumField25 default null,
  SumField26 default null,
  SumField27 default null,
  SumField28 default null,
  SumField29 default null,
  SumField30 default null,
  SumField31 default null,
  SumField32 default null,
  SumField33 default null,
  SumField34 default null
);

COMMIT WORK
/



-- #########################################################
-- #########################################################
-- Alter_LayerData_AddSenderID_forCheck.sql
-- #########################################################
-- #########################################################


/* Скрипт добавляет поле SenderID_forCheck в таблицу LayerData.
  По нему должна осуществляться проверка возможности отправки документа с УРМ.*/
/* <TRANS_COMMAND>

ALTER TABLE LAYERDATA
    ADD SENDERID_FORCHECK NUMBER(10,0)
/
ALTER TABLE LAYERDATA
    ADD CHECK ((SENDERID_FORCHECK<=2147483647) and (SENDERID_FORCHECK>=-2147483648))
/
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 = 'SENDERID_FORCHECK';
  IF (v_exists = 0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA ADD SENDERID_FORCHECK NUMBER(10,0)';
    EXECUTE IMMEDIATE 'COMMIT WORK'; 
  END IF;
  EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA
    ADD CHECK ((SENDERID_FORCHECK<=2147483647) and (SENDERID_FORCHECK>=-2147483648))';
  EXECUTE IMMEDIATE 'COMMIT WORK'; 
END;
/



-- #########################################################
-- #########################################################
-- Add_LayersAppliedType.sql
-- #########################################################
-- #########################################################


/* <TRANS_COMMAND>
--Реализация прикладных типов в планированиии

--Таблица прикладных типов
CREATE TABLE LAYERFIELDTYPES (
    ID               NUMBER(10,0) NOT NULL,
    ALIAS            VARCHAR2(255) NOT NULL,
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL
)
/

--Ограничения
ALTER TABLE LAYERFIELDTYPES ADD CONSTRAINT PK_LAYERFIELDTYPES PRIMARY KEY (ID)
/

GRANT SELECT, INSERT, UPDATE, DELETE ON LAYERFIELDTYPES TO budget_users
/

CREATE TABLE LAYERFIELDTYPESDETAIL (
    ID               NUMBER(10,0) NOT NULL,
    ALIAS            VARCHAR(255),
    RECORDINDEX      NUMBER(10,0) NOT NULL,    
    MASK             VARCHAR2(20),
    NOTE             VARCHAR2(2000),
    REGEXP           VARCHAR2(4000),
    FIELDSIZE        NUMBER(10,0),
    MASTERFIELDTYPE  NUMBER(10,0) NOT NULL,
    CONTEXT          VARCHAR2(255),		
    CREATEDATE       DATE NOT NULL,
    CREATERUSER      VARCHAR2(30) NOT NULL,
    UPDATEDATE       DATE NOT NULL,
    UPDATERUSER      VARCHAR2(30) NOT NULL
)
/

GRANT SELECT, INSERT, UPDATE, DELETE ON LAYERFIELDTYPESDETAIL TO budget_users
/

--Ограничения
ALTER TABLE LAYERFIELDTYPESDETAIL ADD CONSTRAINT PK_LAYERFIELDTYPESDETAIL PRIMARY KEY (ID)
/
                
CREATE INDEX IDX_LRFLDTYPESDET_RECORDINDEX
  ON LAYERFIELDTYPESDETAIL(RECORDINDEX)
/

CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_BI
  BEFORE INSERT
  ON LAYERFIELDTYPES
  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;
-- - - - - - - - - - - - -
-- BI_(500)
-- Create 01.07.2013
-- - - - - - - - - - - - -
  :NEW.CreateDate := SYSDATE;
  :NEW.UpdateDate := :NEW.CreateDate;
  :NEW.CreaterUser := USER;
  :NEW.UpdaterUser := USER;
END;
/

-- Trigger: LAYERFIELDTYPES_BU0 
CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_BU
BEFORE UPDATE
ON LAYERFIELDTYPES
FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_(500)
-- Create 01.07.2013
-- - - - - - - - - - - - -
    :new.UpdateDate := SYSDATE;
    :new.UpdaterUser := User;
END;
/ 

CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_BD
  BEFORE DELETE
  ON LAYERFIELDTYPES
  FOR EACH ROW
begin

-- - - - - - - - - - - - -
-- BD_0
-- Create 01.07.2013
-- - - - - - - - - - - - -
    DELETE FROM LAYERFIELDTYPESDETAIL WHERE (RecordIndex = :old.ID);
END;
/

CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_AD
  AFTER DELETE
  ON LAYERFIELDTYPES
  FOR EACH ROW
begin

-- - - - - - - - - - - - -
-- AD_500
-- Create 01.07.2013
-- - - - - - - - - - - - -

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

end;
/

CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_AI
  AFTER INSERT
  ON LAYERFIELDTYPES
  FOR EACH ROW
begin

-- - - - - - - - - - - - -
-- AI_500
-- Create 01.07.2013
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 176) and (RecordID = :new.ID);
end;
/

CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_AU
  AFTER UPDATE
  ON LAYERFIELDTYPES
  FOR EACH ROW
begin

-- - - - - - - - - - - - -
-- AU_500
-- Create 01.07.2013
-- - - - - - - - - - - - -

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

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;
/

CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPESDETAIL_AD
  AFTER DELETE
  ON LAYERFIELDTYPESDETAIL
  FOR EACH ROW
begin

-- - - - - - - - - - - - -
-- AD_500
-- Create 01.07.2013
-- - - - - - - - - - - - -

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

CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPESDETAIL_AI
  AFTER INSERT
  ON LAYERFIELDTYPESDETAIL
  FOR EACH ROW
begin

-- - - - - - - - - - - - -
-- AI_500
-- Create 01.07.2013
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 177) and (RecordID = :new.ID);
  
end;
/

CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPESDETAIL_AU
  AFTER UPDATE
  ON LAYERFIELDTYPESDETAIL
  FOR EACH ROW
begin

-- - - - - - - - - - - - -
-- AU_500
-- Create 01.07.2013
-- - - - - - - - - - - - -

  if (:new.ID<>:old.ID) then
    insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (177, :old.ID, SYSDATE);
    delete from DelRecIndexes where (TableID=177) and (RecordId=:new.ID);
  end if;
  
end;
/
  
--Добавить поле ссылку на таблицу прикладных типов
ALTER TABLE LayerFields ADD FIELDTYPEREF NUMBER(10,0)
/

ALTER TABLE LAYERFIELDS ADD 
       CHECK ((FIELDTYPEREF<=2147483647) and (FIELDTYPEREF>=-2147483648))
/
ALTER TABLE LAYERFIELDTYPES ADD 
       CHECK ((ID<=2147483647) and (ID>=-2147483648))
/
ALTER TABLE LAYERFIELDTYPESDETAIL ADD 
       CHECK ((FIELDSIZE<=2147483647) and (FIELDSIZE>=-2147483648))
/
ALTER TABLE LAYERFIELDTYPESDETAIL ADD 
       CHECK ((ID<=2147483647) and (ID>=-2147483648))
/
ALTER TABLE LAYERFIELDTYPESDETAIL ADD 
       CHECK ((MASTERFIELDTYPE<=2147483647) and (MASTERFIELDTYPE>=-2147483648))
/
ALTER TABLE LAYERFIELDTYPESDETAIL ADD 
       CHECK ((RECORDINDEX<=2147483647) and (RECORDINDEX>=-2147483648))
/


CREATE INDEX IDX_LAYERFIELDS_FIELDTYPEREF ON LAYERFIELDS (FIELDTYPEREF)
/

ALTER TABLE LayerFieldTypesDetail ADD ERRORMESSAGE VARCHAR(255)
/

COMMIT WORK
/
*/
-- <TRANS_IGNORE>
DECLARE
  v_exists INTEGER;
BEGIN
  SELECT COUNT(*)
  INTO v_exists
  FROM USER_TABLES
  WHERE TABLE_NAME = 'LAYERFIELDTYPES';
  IF (v_exists = 0) THEN
    EXECUTE IMMEDIATE '--Таблица прикладных типов
    CREATE TABLE LAYERFIELDTYPES (
        ID               NUMBER(10,0) NOT NULL,
        ALIAS            VARCHAR2(255) NOT NULL,
        CREATEDATE       DATE NOT NULL,
        CREATERUSER      VARCHAR2(30) NOT NULL,
        UPDATEDATE       DATE NOT NULL,
        UPDATERUSER      VARCHAR2(30) NOT NULL
    )';
    EXECUTE IMMEDIATE '--Ограничения
    ALTER TABLE LAYERFIELDTYPES ADD CONSTRAINT PK_LAYERFIELDTYPES PRIMARY KEY (ID)';
    EXECUTE IMMEDIATE 'GRANT SELECT, INSERT, UPDATE, DELETE ON LAYERFIELDTYPES TO budget_users';
    EXECUTE IMMEDIATE 'CREATE TABLE LAYERFIELDTYPESDETAIL (
        ID               NUMBER(10,0) NOT NULL,
        ALIAS            VARCHAR(255),
        RECORDINDEX      NUMBER(10,0) NOT NULL,    
        MASK             VARCHAR2(20),
        NOTE             VARCHAR2(2000),
        REGEXP           VARCHAR2(4000),
        FIELDSIZE        NUMBER(10,0),
        MASTERFIELDTYPE  NUMBER(10,0) NOT NULL,
        CONTEXT          VARCHAR2(255),   
        CREATEDATE       DATE NOT NULL,
        CREATERUSER      VARCHAR2(30) NOT NULL,
        UPDATEDATE       DATE NOT NULL,
        UPDATERUSER      VARCHAR2(30) NOT NULL
    )';
    EXECUTE IMMEDIATE 'GRANT SELECT, INSERT, UPDATE, DELETE ON LAYERFIELDTYPESDETAIL TO budget_users';
    EXECUTE IMMEDIATE '--Ограничения
    ALTER TABLE LAYERFIELDTYPESDETAIL ADD CONSTRAINT PK_LAYERFIELDTYPESDETAIL PRIMARY KEY (ID)';                    
    EXECUTE IMMEDIATE 'CREATE INDEX IDX_LRFLDTYPESDET_RECORDINDEX
      ON LAYERFIELDTYPESDETAIL(RECORDINDEX)';
    EXECUTE IMMEDIATE 'CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_BI
      BEFORE INSERT
      ON LAYERFIELDTYPES
      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;
    -- - - - - - - - - - - - -
    -- BI_(500)
    -- Create 01.07.2013
    -- - - - - - - - - - - - -
      :NEW.CreateDate := SYSDATE;
      :NEW.UpdateDate := :NEW.CreateDate;
      :NEW.CreaterUser := USER;
      :NEW.UpdaterUser := USER;
    END;';
    EXECUTE IMMEDIATE '-- Trigger: LAYERFIELDTYPES_BU0 
    CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_BU
    BEFORE UPDATE
    ON LAYERFIELDTYPES
    FOR EACH ROW
    BEGIN
    -- - - - - - - - - - - - -
    -- BU_(500)
    -- Create 01.07.2013
    -- - - - - - - - - - - - -
        :new.UpdateDate := SYSDATE;
        :new.UpdaterUser := User;
    END;';
    EXECUTE IMMEDIATE 'CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_BD
      BEFORE DELETE
      ON LAYERFIELDTYPES
      FOR EACH ROW
    begin

    -- - - - - - - - - - - - -
    -- BD_0
    -- Create 01.07.2013
    -- - - - - - - - - - - - -
        DELETE FROM LAYERFIELDTYPESDETAIL WHERE (RecordIndex = :old.ID);
    END;';
    EXECUTE IMMEDIATE 'CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_AD
      AFTER DELETE
      ON LAYERFIELDTYPES
      FOR EACH ROW
    begin

    -- - - - - - - - - - - - -
    -- AD_500
    -- Create 01.07.2013
    -- - - - - - - - - - - - -

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

    end;';
    EXECUTE IMMEDIATE 'CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_AI
      AFTER INSERT
      ON LAYERFIELDTYPES
      FOR EACH ROW
    begin

    -- - - - - - - - - - - - -
    -- AI_500
    -- Create 01.07.2013
    -- - - - - - - - - - - - -

      delete from DelRecIndexes where (TableID = 176) and (RecordID = :new.ID);
    end;';
    EXECUTE IMMEDIATE 'CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPES_AU
      AFTER UPDATE
      ON LAYERFIELDTYPES
      FOR EACH ROW
    begin

    -- - - - - - - - - - - - -
    -- AU_500
    -- Create 01.07.2013
    -- - - - - - - - - - - - -

      if (:new.ID<>:old.ID) then
        insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (176, :old.ID, SYSDATE);
        delete from DelRecIndexes where (TableID=176) and (RecordId=:new.ID);
      end if;
      
    end;';
    EXECUTE IMMEDIATE '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;';
    EXECUTE IMMEDIATE '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;';
    EXECUTE IMMEDIATE 'CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPESDETAIL_AD
      AFTER DELETE
      ON LAYERFIELDTYPESDETAIL
      FOR EACH ROW
    begin

    -- - - - - - - - - - - - -
    -- AD_500
    -- Create 01.07.2013
    -- - - - - - - - - - - - -

        insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (177, :old.ID, SYSDATE);
        
    end;';
    EXECUTE IMMEDIATE 'CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPESDETAIL_AI
      AFTER INSERT
      ON LAYERFIELDTYPESDETAIL
      FOR EACH ROW
    begin

    -- - - - - - - - - - - - -
    -- AI_500
    -- Create 01.07.2013
    -- - - - - - - - - - - - -

      delete from DelRecIndexes where (TableID = 177) and (RecordID = :new.ID);
      
    end;';
    EXECUTE IMMEDIATE 'CREATE OR REPLACE TRIGGER TR_LAYERFIELDTYPESDETAIL_AU
      AFTER UPDATE
      ON LAYERFIELDTYPESDETAIL
      FOR EACH ROW
    begin

    -- - - - - - - - - - - - -
    -- AU_500
    -- Create 01.07.2013
    -- - - - - - - - - - - - -

      if (:new.ID<>:old.ID) then
        insert into DelRecIndexes(TableID, RecordId, DeleteDate) values (177, :old.ID, SYSDATE);
        delete from DelRecIndexes where (TableID=177) and (RecordId=:new.ID);
      end if;
      
    end;';      
    EXECUTE IMMEDIATE '--Добавить поле ссылку на таблицу прикладных типов
    ALTER TABLE LayerFields ADD FIELDTYPEREF NUMBER(10,0)';
    EXECUTE IMMEDIATE 'CREATE INDEX IDX_LAYERFIELDS_FIELDTYPEREF ON LAYERFIELDS (FIELDTYPEREF)';
    
    EXECUTE IMMEDIATE 'COMMIT WORK';
  END IF;

  EXECUTE IMMEDIATE 'ALTER TABLE LAYERFIELDS ADD 
       CHECK ((FIELDTYPEREF<=2147483647) and (FIELDTYPEREF>=-2147483648))';
  EXECUTE IMMEDIATE 'ALTER TABLE LAYERFIELDTYPES ADD 
       CHECK ((ID<=2147483647) and (ID>=-2147483648))';
  EXECUTE IMMEDIATE 'ALTER TABLE LAYERFIELDTYPESDETAIL ADD 
       CHECK ((FIELDSIZE<=2147483647) and (FIELDSIZE>=-2147483648))';
  EXECUTE IMMEDIATE 'ALTER TABLE LAYERFIELDTYPESDETAIL ADD 
       CHECK ((ID<=2147483647) and (ID>=-2147483648))';
  EXECUTE IMMEDIATE 'ALTER TABLE LAYERFIELDTYPESDETAIL ADD 
       CHECK ((MASTERFIELDTYPE<=2147483647) and (MASTERFIELDTYPE>=-2147483648))';
  EXECUTE IMMEDIATE 'ALTER TABLE LAYERFIELDTYPESDETAIL ADD 
       CHECK ((RECORDINDEX<=2147483647) and (RECORDINDEX>=-2147483648))';
  EXECUTE IMMEDIATE 'COMMIT WORK';

  SELECT COUNT(*)
  INTO v_exists
  FROM USER_TAB_COLUMNS
  WHERE TABLE_NAME = 'LAYERFIELDTYPESDETAIL' AND COLUMN_NAME = 'ERRORMESSAGE';
  IF (v_exists = 0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE LayerFieldTypesDetail ADD ERRORMESSAGE VARCHAR(255)';
    EXECUTE IMMEDIATE 'COMMIT WORK'; 
  END IF;
END;
/



-- #########################################################
-- #########################################################
-- LayerClassifierFieldToVarchar.sql
-- #########################################################
-- #########################################################


/* Скрипт сделает поле KCSR строковым. */

/* <TRANS_COMMAND>
ALTER TABLE LAYERDATA ADD (tempKCSR varchar2(20))
/

update LAYERDATA set tempKCSR = KCSR
/

DROP INDEX IDX_LAYERDATA_KCSR
/

ALTER TABLE LAYERDATA DROP (KCSR)
/

ALTER TABLE LAYERDATA ADD (KCSR varchar2(20))
/

update LAYERDATA set KCSR = tempKCSR
/

ALTER TABLE LAYERDATA DROP (tempKCSR)
/

CREATE INDEX IDX_LAYERDATA_KCSR ON LAYERDATA(KCSR)
/

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 = 'KCSR'
  AND DATA_TYPE = 'NUMBER';
  IF (v_exists > 0) THEN
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA ADD (tempKCSR varchar2(20))';
    EXECUTE IMMEDIATE 'update LAYERDATA set tempKCSR = KCSR';
    EXECUTE IMMEDIATE 'DROP INDEX IDX_LAYERDATA_KCSR';
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA DROP (KCSR)';
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA ADD (KCSR varchar2(20))';
    EXECUTE IMMEDIATE 'update LAYERDATA set KCSR = tempKCSR';
    EXECUTE IMMEDIATE 'ALTER TABLE LAYERDATA DROP (tempKCSR)';
    EXECUTE IMMEDIATE 'CREATE INDEX IDX_LAYERDATA_KCSR ON LAYERDATA(KCSR)';
    EXECUTE IMMEDIATE 'COMMIT WORK';
  END IF;
END;
/



-- #########################################################
-- #########################################################
-- add_FFC_DocChangeDate.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет индекс для казначейских документов, 
ускоряющий отслеживание изменений документа и не влияющий на синхронизацию УРМ*/
ALTER TABLE TB_facialfincaption ADD (
  DocChangeDate DATE
)
/

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)
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
  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;
--
  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)
-- Last update 20.05.2005
-- - - - - - - - - - - - -

  new$CreateDate := SYSDATE;
  new$UpdateDate := new$CreateDate;
  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
  ) 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);

-- - - - - - - - - - - - -
-- 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;
--
  SourceFacialAcc_CLS$ NUMBER(10);
  DestFacialAcc_CLS$ NUMBER(10);
  IsReject$ NUMBER(10);
  UseFax1$ NUMBER(10);
  DocNumber1$ NUMBER(10);
  DetCount1$ NUMBER(10);
  CNT$1 NUMBER(10);
  reestrAccepted1$ 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)
-- Create 24.06.2010
-- Last update 24.06.2010
-- - - - - - - - - - - - -

  IsReject$ := -1;
  if ((:old.Reject_CLS is null)and(new$Reject_CLS is not null)) then
    IsReject$ := 1;
  elsif ((:old.Reject_CLS is not null)and(new$Reject_CLS 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 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
  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;
/
CREATE INDEX FFC_DocChangeDate ON TB_FACIALFINCAPTION (DocChangeDate)
/
-- CREATE TRIGGER TR_FACIALFINCAPTION_BI_500
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;
--
  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
  ) 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);

-- - - - - - - - - - - - -
-- 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 TRIGGER TR_FACIALFINCAPTION_BU_500
CREATE OR REPLACE TRIGGER TR_FACIALFINCAPTION_BU_500
  BEFORE UPDATE
  ON TB_FACIALFINCAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_FACIALFINCAPTION_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_FACIALFINDETAIL_BI_500
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;
--
  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
  ) 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);

-- - - - - - - - - - - - -
-- 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 TRIGGER TR_FACIALFINDETAIL_BU_500
CREATE OR REPLACE TRIGGER TR_FACIALFINDETAIL_BU_500
  BEFORE UPDATE
  ON TB_FACIALFINDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_FACIALFINDETAIL_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

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

END;
/
ALTER TRIGGER TR_FACIALFINCAPTION_BU_500 DISABLE
/
Update FacialFinCaption ffc set
	DocChangeDate = (select max(UpdateDate) from facialFinDetail ffd where (ffd.recordindex=ffc.id)) 
/
Update FacialFinCaption ffc set
	DocChangeDate = UpdateDate
where (DocChangeDate<UpdateDate) or (DocChangeDate is null)
/
ALTER TRIGGER TR_FACIALFINCAPTION_BU_500 ENABLE
/
commit
/


-- #########################################################
-- #########################################################
-- FFC_tr_BU300_Fix.sql
-- #########################################################
-- #########################################################

/* Правка проблемы с производительностью при обновлении linkRecords. В случае сложного условия индексы начинают использоваться плохо.
Для упрощения условия update разбит на два update'а с более простыми условиями */
-- CREATE TRIGGER T_FACIALFINCAPTION_BU_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;
--
  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
  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
/

-- #########################################################
-- #########################################################
-- Alter_SignTables.sql
-- #########################################################
-- #########################################################

--Скрипт модифицирует таблицы Signs, SignLog, SignSchemeCaption для поддержки нескольких эцп
---------------Signs----------------------------
ALTER TABLE Signs ADD (
  IsBudget NUMBER(10),
    CHECK((IsBudget<=2147483647)AND(IsBudget>-2147483648)),
  Note VARCHAR2(255)
)
/
-- ALTER TRIGGER TR_SIGNS_BI_0
CREATE OR REPLACE TRIGGER TR_SIGNS_BI
  BEFORE INSERT
  ON SIGNS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_SIGNS_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.IsBudget is null) then
    :new.IsBudget := 1;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_SIGNS_BI_500)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

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

END;
/
ALTER TRIGGER TR_SIGNS_BU_500 DISABLE
/
update Signs
set IsBudget = 1
/
ALTER TRIGGER TR_SIGNS_BU_500 ENABLE
/
---------------SignSchemeCaption----------------------------
ALTER TABLE SignSchemeCaption ADD (
  IsBudget NUMBER(10),
    CHECK((IsBudget<=2147483647)AND(IsBudget>-2147483648))
)
/
-- ALTER TRIGGER TR_SIGNSCHEMECAPT_BI_0
CREATE OR REPLACE TRIGGER TR_SIGNSCHEMECAPTION_BI
  BEFORE INSERT
  ON SIGNSCHEMECAPTION
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_SIGNSCHEMECAPT_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.IsBudget is null) then
    :new.IsBudget := 1;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_SIGNSCHEMECAPT_BI_500)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

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

END;
/
ALTER TRIGGER TR_SIGNSCHEMECAPT_BU_500 DISABLE
/
update SignSchemeCaption
set IsBudget = 1
/
ALTER TRIGGER TR_SIGNSCHEMECAPT_BU_500 ENABLE
/
---------------SignLog----------------------------
ALTER TABLE SignLog ADD (
  FacialAccCls NUMBER(10),
    CHECK((FacialAccCls<=2147483647)AND(FacialAccCls>-2147483648)),
  SenderId NUMBER(10),
    CHECK((SenderId<=2147483647)AND(SenderId>-2147483648)),
  SenderRecordId NUMBER(10),
    CHECK((SenderRecordId<=2147483647)AND(SenderRecordId>-2147483648)),
  SignId NUMBER(10),
    CHECK((SignId<=2147483647)AND(SignId>-2147483648)),
  SignDate NUMBER,
  DocType NUMBER(10),
    CHECK((DocType<=2147483647)AND(DocType>-2147483648)),
  StateHistoryRef NUMBER(10),
    CHECK((StateHistoryRef<=2147483647)AND(StateHistoryRef>-2147483648)),
  constraint FK_FacialAccCls_SignLog foreign key (FacialAccCls) references TB_FacialAcc_Cls (ID),
  constraint FK_DocType_SignLog foreign key (DocType) references DocumentTypes (ID),
  constraint FK_HistoryRef_SignLog foreign key (StateHistoryRef) references StateJumpHistory (ID)
)
/
CREATE INDEX FK_FacialAccCls_SignLog ON SignLog(FacialAccCls)
/
CREATE INDEX FK_DocType_SignLog ON SignLog(DocType)
/
CREATE INDEX FK_HistoryRef_SignLog ON SignLog(StateHistoryRef)
/
create index idx_SignLog_Sender on SignLog(SenderID, SenderRecordID)
/
commit work
/
-- CREATE TRIGGER TR_Signs_AD_500
CREATE OR REPLACE TRIGGER TR_Signs_AD
  AFTER DELETE
  ON Signs
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_Signs_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_Signs_AI_500
CREATE OR REPLACE TRIGGER TR_Signs_AI
  AFTER INSERT
  ON Signs
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_Signs_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 228) and (RecordId = :new.ID);

END;
/
-- CREATE TRIGGER TR_SignSchemeCaption_AD_500
CREATE OR REPLACE TRIGGER TR_SignSchemeCaption_AD
  AFTER DELETE
  ON SignSchemeCaption
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_SignSchemeCaption_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignSchemeCaption_AI_500
CREATE OR REPLACE TRIGGER TR_SignSchemeCaption_AI
  AFTER INSERT
  ON SignSchemeCaption
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_SignSchemeCaption_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 229) and (RecordId = :new.ID);

END;
/
-- CREATE TRIGGER TR_SignSchemeDetail_AD_500
CREATE OR REPLACE TRIGGER TR_SIGNSCHEMEDETAIL_ID
  INSTEAD OF DELETE
  ON SIGNSCHEMEDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- DELETE
-- - - - - - - - - - - - -
  DELETE FROM TB_SIGNSCHEMEDETAIL
  WHERE Id = :old.Id;

-- - - - - - - - - - - - -
-- AD_500 (TR_SignSchemeDetail_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignSchemeDetail_AI_500
CREATE OR REPLACE TRIGGER TR_SIGNSCHEMEDETAIL_II
  INSTEAD OF INSERT
  ON SIGNSCHEMEDETAIL
  FOR EACH ROW
DECLARE
  new$ID SIGNSCHEMEDETAIL.ID%TYPE := :NEW.ID;
  new$RECORDINDEX SIGNSCHEMEDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SIGNREF SIGNSCHEMEDETAIL.SIGNREF%TYPE := :NEW.SIGNREF;
  new$SIGNORDER SIGNSCHEMEDETAIL.SIGNORDER%TYPE := :NEW.SIGNORDER;
  new$SIGNMASK SIGNSCHEMEDETAIL.SIGNMASK%TYPE := :NEW.SIGNMASK;
  new$FICTIVESIGN SIGNSCHEMEDETAIL.FICTIVESIGN%TYPE := :NEW.FICTIVESIGN;
  new$ACTIONREF SIGNSCHEMEDETAIL.ACTIONREF%TYPE := :NEW.ACTIONREF;
  new$CREATEDATE SIGNSCHEMEDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE SIGNSCHEMEDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATERUSER SIGNSCHEMEDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER SIGNSCHEMEDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
--
  MaxOrder$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_SIGNSCHEMEDET_BI_0)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- BI_100 (TR_SIGNSCHEMEDET_BI_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  select
  max(d.signmask)
  into
  MaxOrder$   from
  SignSchemeDetail d
  where
  (d.RecordIndex = new$RecordIndex)and(d.signorder = new$signorder)
  ;
  if (MaxOrder$  >= 1073741824) then /* 1073741824=2 в степени 30. Степень больше 30 будет вызывать переполнение integer*/
    RaiseException('EX_MASKOUTOFRANGE');
  END IF;
  if ((MaxOrder$  = 0)or(MaxOrder$  is null)) then
    new$signmask := 1;
      
  else
    new$SignMask := MaxOrder$  * 2;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_SIGNSCHEMEDET_BI_500)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_SIGNSCHEMEDETAIL (
    ID,
    RECORDINDEX,
    SIGNREF,
    SIGNORDER,
    SIGNMASK,
    FICTIVESIGN,
    ACTIONREF,
    CREATEDATE,
    UPDATEDATE,
    CREATERUSER,
    UPDATERUSER
  ) VALUES (
    new$ID,
    new$RECORDINDEX,
    new$SIGNREF,
    new$SIGNORDER,
    new$SIGNMASK,
    new$FICTIVESIGN,
    new$ACTIONREF,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$CREATERUSER,
    new$UPDATERUSER);

-- - - - - - - - - - - - -
-- AI_500 (TR_SignSchemeDetail_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignLog_AD_500
CREATE OR REPLACE TRIGGER TR_SignLog_AD
  AFTER DELETE
  ON SignLog
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_SignLog_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignLog_AI_500
CREATE OR REPLACE TRIGGER TR_SignLog_AI
  AFTER INSERT
  ON SignLog
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_SignLog_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 231) and (RecordId = :new.ID);

END;
/

ALTER TABLE Signs MODIFY(IsBudget NOT NULL)
/
ALTER TABLE SignSchemeCaption MODIFY(IsBudget NOT NULL)
/

-- #########################################################
-- #########################################################
-- Create_MultiEDSTables.sql
-- #########################################################
-- #########################################################

-- Скрипт добавляет таблицы для использования нескольких ЭЦП


/* Сертификаты */
Create table SignCertificate (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  SerialNumber VARCHAR2(255) NOT NULL,/* Номер сертификата */
  IsEnabled NUMBER(10) NOT NULL,/* можно ли подписывать этим сертификатом */
    CHECK((IsEnabled<=2147483647)AND(IsEnabled>-2147483648)),
  StartDate DATE,/* дата вступления в действие */
  EndDate DATE,/* дата окончания действия */
  Owner VARCHAR2(255),/* владелец сертификата */
  OwnerOrganization VARCHAR2(255),/* Организация */
  Note VARCHAR2(255),
  UserRef NUMBER(10) NOT NULL,/* ссылка на пользователя DbUsers */
    CHECK((UserRef<=2147483647)AND(UserRef>-2147483648)),
  CreateDate DATE NOT NULL,
  UpdateDate DATE NOT NULL,
  CREATERUSER VARCHAR2(30) NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL,
  constraint PK_SignCertificate PRIMARY KEY (ID),
  constraint FK_SignCertClientRef foreign key (UserRef) references TB_DbUsers (ID)
)
/
CREATE INDEX FK_SignCertClientRef ON SignCertificate(UserRef)
/
-- CREATE TRIGGER tr_SignCert_BI_0
CREATE OR REPLACE TRIGGER TR_SignCertificate_BI
  BEFORE INSERT
  ON SignCertificate
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_SignCert_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then 
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.IsEnabled is null) then 
    :new.IsEnabled := 1;
  END IF;

END;
/
-- CREATE TRIGGER tr_SignCert_BU_0
CREATE OR REPLACE TRIGGER TR_SignCertificate_BU
  BEFORE UPDATE
  ON SignCertificate
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (tr_SignCert_BU_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.IsEnabled is null) then 
    :new.IsEnabled := 1;
  END IF;

END;
/
-- CREATE TRIGGER tr_SignCert_bi_500
CREATE OR REPLACE TRIGGER TR_SignCertificate_BI
  BEFORE INSERT
  ON SignCertificate
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_SignCert_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then 
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.IsEnabled is null) then 
    :new.IsEnabled := 1;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (tr_SignCert_bi_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER tr_SignCert_bu_500
CREATE OR REPLACE TRIGGER tr_SignCert_bu_500
  BEFORE UPDATE
  ON SIGNCERTIFICATE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (tr_SignCert_bu_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignCert_AD_500
CREATE OR REPLACE TRIGGER TR_SignCertificate_AD
  AFTER DELETE
  ON SignCertificate
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_SignCert_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignCert_AI_500
CREATE OR REPLACE TRIGGER TR_SignCertificate_AI
  AFTER INSERT
  ON SignCertificate
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_SignCert_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 232) and (RecordId = :new.ID);

END;
/

/* Группа подписания документов */
Create table SignDocumentsGroup (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  Name VARCHAR2(255) NOT NULL,/* Имя группы (уникальное) */
  Note VARCHAR2(255),/* Примечание */
  ClientRef NUMBER(10) NOT NULL,
    CHECK((ClientRef<=2147483647)AND(ClientRef>-2147483648)),
  SchemaRef NUMBER(10),
    CHECK((SchemaRef<=2147483647)AND(SchemaRef>-2147483648)),
  CreateDate DATE NOT NULL,
  UpdateDate DATE NOT NULL,
  CREATERUSER VARCHAR2(30) NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL,
  constraint PK_SignDocumentsGroup PRIMARY KEY (ID),
  constraint FK_SignDocsGroupClientRef foreign key (ClientRef) references RemoteClient (ID),
  constraint FK_SignDocsGroupSchemaRef foreign key (SchemaRef) references SIGNSCHEMECAPTION (ID)
)
/
CREATE INDEX FK_SignDocsGroupClientRef ON SignDocumentsGroup(ClientRef)
/
CREATE INDEX FK_SignDocsGroupSchemaRef ON SignDocumentsGroup(SchemaRef)
/
-- CREATE TRIGGER tr_SignDocsGroup_BI_0
CREATE OR REPLACE TRIGGER TR_SignDocumentsGroup_BI
  BEFORE INSERT
  ON SignDocumentsGroup
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_SignDocsGroup_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER tr_SignDocsGroup_bi_500
CREATE OR REPLACE TRIGGER TR_SignDocumentsGroup_BI
  BEFORE INSERT
  ON SignDocumentsGroup
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_SignDocsGroup_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- BI_500 (tr_SignDocsGroup_bi_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER tr_SignDocsGroup_bu_500
CREATE OR REPLACE TRIGGER tr_SignDocsGroup_bu_500
  BEFORE UPDATE
  ON SIGNDOCUMENTSGROUP
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (tr_SignDocsGroup_bu_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignDocsGroup_AD_500
CREATE OR REPLACE TRIGGER TR_SignDocumentsGroup_AD
  AFTER DELETE
  ON SignDocumentsGroup
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_SignDocsGroup_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignDocsGroup_AI_500
CREATE OR REPLACE TRIGGER TR_SignDocumentsGroup_AI
  AFTER INSERT
  ON SignDocumentsGroup
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_SignDocsGroup_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 233) and (RecordId = :new.ID);

END;
/

/* Группа документов подписания - детализация */
Create table SignDocumentsGroupDetail (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  DocType NUMBER(10),
    CHECK((DocType<=2147483647)AND(DocType>-2147483648)),
  DocState NUMBER(10),
    CHECK((DocState<=2147483647)AND(DocState>-2147483648)),
  FacialAccCls NUMBER(10),
    CHECK((FacialAccCls<=2147483647)AND(FacialAccCls>-2147483648)),
  FacialAccClsUp NUMBER(10),
    CHECK((FacialAccClsUp<=2147483647)AND(FacialAccClsUp>-2147483648)),
  RecordIndex NUMBER(10) NOT NULL,
    CHECK((RecordIndex<=2147483647)AND(RecordIndex>-2147483648)),
  CreateDate DATE NOT NULL,
  UpdateDate DATE NOT NULL,
  CREATERUSER VARCHAR2(30) NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL,
  constraint PK_SignDocsGroupDet PRIMARY KEY (ID),
  constraint FK_SignDocsGroupRecordIndex foreign key (RecordIndex) references SignDocumentsGroup (ID),
  constraint FK_SignDocsGroupDocType foreign key (DocType) references DocumentTypes (ID),
  constraint FK_SignDocsGroupDocState foreign key (DocState) references State_DocStates (ID),
  constraint FK_SignDocsGroupFacialAccCls foreign key (FacialAccCls) references TB_FacialAcc_Cls (ID)
)
/
CREATE INDEX FK_SignDocsGroupRecordIndex ON SignDocumentsGroupDetail(RecordIndex)
/
CREATE INDEX FK_SignDocsGroupDocType ON SignDocumentsGroupDetail(DocType)
/
CREATE INDEX FK_SignDocsGroupDocState ON SignDocumentsGroupDetail(DocState)
/
CREATE INDEX FK_SignDocsGroupFacialAccCls ON SignDocumentsGroupDetail(FacialAccCls)
/
-- CREATE TRIGGER tr_SignDocsGroupDet_BI_0
CREATE OR REPLACE TRIGGER TR_SignDocumentsGroupDetail_BI
  BEFORE INSERT
  ON SignDocumentsGroupDetail
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_SignDocsGroupDet_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER tr_SignDocsGroupDet_bi_50
CREATE OR REPLACE TRIGGER TR_SignDocumentsGroupDetail_BI
  BEFORE INSERT
  ON SignDocumentsGroupDetail
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_SignDocsGroupDet_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- BI_50 (tr_SignDocsGroupDet_bi_50)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.FacialAccCls is not null) then
    FacialAcc_CLSUp(:new.FacialAccCls,:new.FacialAccClsUP);
  END IF;

END;
/
-- CREATE TRIGGER tr_SignDocsGroupDet_bu_50
CREATE OR REPLACE TRIGGER TR_SignDocumentsGroupDetail_BU
  BEFORE UPDATE
  ON SignDocumentsGroupDetail
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_50 (tr_SignDocsGroupDet_bu_50)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.FacialAccCls is null) then
    :new.FacialAccClsUP := null;
      
  else
    if (:old.FacialAccCls is null) then
      FacialAcc_CLSUp(:new.FacialAccCls,:new.FacialAccClsUP);
          
    else 
      if (:new.FacialAccCls <> :old.FacialAccCls) then
        FacialAcc_CLSUp(:new.FacialAccCls,:new.FacialAccClsUP);
      END IF;
    END IF;
  END IF;

END;
/
-- CREATE TRIGGER tr_SignDocsGroupDet_bi_500
CREATE OR REPLACE TRIGGER TR_SignDocumentsGroupDetail_BI
  BEFORE INSERT
  ON SignDocumentsGroupDetail
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_SignDocsGroupDet_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- BI_50 (tr_SignDocsGroupDet_bi_50)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.FacialAccCls is not null) then
    FacialAcc_CLSUp(:new.FacialAccCls,:new.FacialAccClsUP);
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (tr_SignDocsGroupDet_bi_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER tr_SignDocsGroupDet_bu_500
CREATE OR REPLACE TRIGGER tr_SignDocsGroupDet_bu_500
  BEFORE UPDATE
  ON SIGNDOCUMENTSGROUPDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (tr_SignDocsGroupDet_bu_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- 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 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignDocsGroupDet_AD_500
CREATE OR REPLACE TRIGGER TR_SignDocumentsGroupDetail_AD
  AFTER DELETE
  ON SignDocumentsGroupDetail
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_SignDocsGroupDet_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignDocsGroupDet_AI_500
CREATE OR REPLACE TRIGGER TR_SignDocumentsGroupDetail_AI
  AFTER INSERT
  ON SignDocumentsGroupDetail
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_SignDocsGroupDet_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 234) and (RecordId = :new.ID);

END;
/

/* Профиль подписания. По сути деталь к группе подписания документов */
Create table SignProfile (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  SignRef NUMBER(10) NOT NULL,
    CHECK((SignRef<=2147483647)AND(SignRef>-2147483648)),
  SignDocumentsGroupRef NUMBER(10) NOT NULL,
    CHECK((SignDocumentsGroupRef<=2147483647)AND(SignDocumentsGroupRef>-2147483648)),
  CreateDate DATE NOT NULL,
  UpdateDate DATE NOT NULL,
  CREATERUSER VARCHAR2(30) NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL,
  constraint PK_SignProfile PRIMARY KEY (ID),
  constraint FK_SignProfileSignRef foreign key (SignRef) references SIGNS (ID),
  constraint FK_SignDocumentsGroupRef foreign key (SignDocumentsGroupRef) references SignDocumentsGroup (ID),
  constraint Uniq_GroupAndSign unique (SignRef, SignDocumentsGroupRef)
)
/
CREATE INDEX FK_SignProfileSignRef ON SignProfile(SignRef)
/
CREATE INDEX FK_SignDocumentsGroupRef ON SignProfile(SignDocumentsGroupRef)
/
-- CREATE TRIGGER tr_SignProfile_BI_0
CREATE OR REPLACE TRIGGER TR_SignProfile_BI
  BEFORE INSERT
  ON SignProfile
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_SignProfile_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER tr_SignProfile_bi_500
CREATE OR REPLACE TRIGGER TR_SignProfile_BI
  BEFORE INSERT
  ON SignProfile
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_SignProfile_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- BI_500 (tr_SignProfile_bi_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER tr_SignProfile_bu_500
CREATE OR REPLACE TRIGGER tr_SignProfile_bu_500
  BEFORE UPDATE
  ON SIGNPROFILE
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (tr_SignProfile_bu_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignProfile_AD_500
CREATE OR REPLACE TRIGGER TR_SignProfile_AD
  AFTER DELETE
  ON SignProfile
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_SignProfile_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignProfile_AI_500
CREATE OR REPLACE TRIGGER TR_SignProfile_AI
  AFTER INSERT
  ON SignProfile
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_SignProfile_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 235) and (RecordId = :new.ID);

END;
/

/* Деталь профиля подписания */
Create table SignProfileDetail (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  RecordIndex NUMBER(10) NOT NULL,
    CHECK((RecordIndex<=2147483647)AND(RecordIndex>-2147483648)),
  CertificateRef NUMBER(10) NOT NULL,
    CHECK((CertificateRef<=2147483647)AND(CertificateRef>-2147483648)),
  CreateDate DATE NOT NULL,
  UpdateDate DATE NOT NULL,
  CREATERUSER VARCHAR2(30) NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL,
  constraint PK_SignProfileDet PRIMARY KEY (ID),
  constraint FK_SignProfileRecordIndex foreign key (RecordIndex) references SignProfile (ID),
  constraint FK_SignProfileCertificateRef foreign key (CertificateRef) references SignCertificate (ID),
  constraint Uniq_ProfileAndCert unique (RecordIndex, CertificateRef)
)
/
CREATE INDEX FK_SignProfileRecordIndex ON SignProfileDetail(RecordIndex)
/
CREATE INDEX FK_SignProfileCertificateRef ON SignProfileDetail(CertificateRef)
/
-- CREATE TRIGGER tr_SignProfileDet_BI_0
CREATE OR REPLACE TRIGGER TR_SignProfileDetail_BI
  BEFORE INSERT
  ON SignProfileDetail
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_SignProfileDet_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER tr_SignProfileDet_bi_500
CREATE OR REPLACE TRIGGER TR_SignProfileDetail_BI
  BEFORE INSERT
  ON SignProfileDetail
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (tr_SignProfileDet_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- BI_500 (tr_SignProfileDet_bi_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER tr_SignProfileDet_bu_500
CREATE OR REPLACE TRIGGER tr_SignProfileDet_bu_500
  BEFORE UPDATE
  ON SIGNPROFILEDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (tr_SignProfileDet_bu_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignProfile_BD_0
CREATE OR REPLACE TRIGGER TR_SignProfile_BD
  BEFORE DELETE
  ON SignProfile
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (TR_SignProfile_BD_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignProfileDet_AD_500
CREATE OR REPLACE TRIGGER TR_SignProfileDetail_AD
  AFTER DELETE
  ON SignProfileDetail
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_SignProfileDet_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SignProfileDet_AI_500
CREATE OR REPLACE TRIGGER TR_SignProfileDetail_AI
  AFTER INSERT
  ON SignProfileDetail
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_SignProfileDet_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 236) and (RecordId = :new.ID);

END;
/

commit work 
/

/* раздача прав на таблицы*/

grant SELECT, INSERT, UPDATE, DELETE on SignCertificate to BUDGET_USERS
/
grant SELECT, INSERT, UPDATE, DELETE on SignDocumentsGroup to BUDGET_USERS
/
grant SELECT, INSERT, UPDATE, DELETE on SignDocumentsGroupDetail to BUDGET_USERS
/
grant SELECT, INSERT, UPDATE, DELETE on SignProfile to BUDGET_USERS
/
grant SELECT, INSERT, UPDATE, DELETE on SignProfileDetail to BUDGET_USERS
/

commit work 
/




-- #########################################################
-- #########################################################
-- alter_cls_DeleteDateTrigger.sql
-- #########################################################
-- #########################################################

-- ALTER TRIGGER TR_INNERFINSOURCE_AU_100
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;
--
  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);
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;
  /* Для внутренних источников направление определяется по коду операции ГС
       Погашение – это кода с косгу=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
  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)
      values (0, new$DescriptionCode, new$KESR, new$Name, new$ShortName, new$CLSAspect, new$RemoteFlag);
      
    END IF;
  else
    /* Если КВСР = 0, то нужно обновить связанные записи с таким же кодом, но не нулевым КВСР */
    update InnerFinSource ifs1 set
    name = new$name,
    ShortName = new$ShortName
    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_AU_100
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);
  DescrCode1 NUMBER(10);
  DescrCode2 NUMBER(10);
  KVSRCode$ NUMBER(10);
  sKVSR VARCHAR(3);
  sDescrCode1 VARCHAR(5);
  sDescrCode2 VARCHAR(5);
  sProgCode VARCHAR(4);
  sKESR VARCHAR(3);
  CNT$1 NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_KD_BU_0)
-- Last update 27.10.2009
-- - - - - - - - - - - - -

  -- Установка значений по умолчанию
  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;
  new$MainDescriptionCode := TRUNC (tmp$ / 100);
  new$ItemCode := tmp$ - new$MainDescriptionCode * 100;

  -- Выбираем код КВСР по ключу
  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$ / 100000);
  DescrCode2 := tmp$ - DescrCode1 * 100000;

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

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

  -- Вычисление Программы с лидирующими нулями
  IF (new$programcode = 0) THEN
    sProgCode := '0000';
  ELSIF (new$programcode < 10) THEN
    sProgCode := '000' || new$programcode;
  ELSIF (new$programcode < 100) THEN
    sProgCode := '00' || new$programcode;
  ELSIF (new$programcode < 1000) THEN
    sProgCode := '0' || new$programcode;
  ELSE
    sProgCode := new$programcode;
  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$kdvalue := sKVSR || sDescrCode1 || sDescrCode2 || sProgCode || sKESR;

  if ((new$ID = 0) and (new$kdvalue <> '00000000000000000000')) 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
/


-- #########################################################
-- #########################################################
-- Correct_Reject_Links.sql
-- #########################################################
-- #########################################################

/* */
-- ALTER TRIGGER TR_LINKRECORDS_BU
CREATE OR REPLACE TRIGGER TR_LINKRECORDS_BU
  BEFORE UPDATE
  ON LINKRECORDS
  FOR EACH ROW
DECLARE
  BlockParent$ NUMBER(10);
  BlockChild$ NUMBER(10);
  CanDelParent$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_LINKRECORDS_BU)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.IsRejected is null) then 
    :new.IsRejected := 0;
  END IF;
  if (:new.IsRejected <> :old.IsRejected) then
    BEGIN
      select
      BlockParent, 1 - CanDelBlockParent, BlockChild
      into BlockParent$, CanDelParent$, BlockChild$     from
      LinkType
      where
      ID = :new.LinkTypeRef
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    if ((:new.IsRejected = 1)and(:old.IsRejected = 0)) then
      update RecordParams set
      ChildBlockCount = ChildBlockCount - BlockParent$,
      RejectCount = RejectCount + 1,
      DISABLEDELCOUNT = DISABLEDELCOUNT - CanDelParent$

      where
      id = :new.ParentID;
      update RecordParams set
      RejectCount = RejectCount + 1,
      ParentBlockCount = ParentBlockCount - BlockChild$

      where
      id = :new.ChildID;
          
    END IF;
    if ((:new.IsRejected = 0)and(:old.IsRejected = 1)) then
      update RecordParams set
      ChildBlockCount = ChildBlockCount + BlockParent$,
      RejectCount = RejectCount - 1,
      DISABLEDELCOUNT = DISABLEDELCOUNT + CanDelParent$

      where
      id = :new.ParentID;
      update RecordParams set
      RejectCount = RejectCount - 1,
      ParentBlockCount = ParentBlockCount + BlockChild$

      where
      id = :new.ChildID;
      
    END IF;
  END IF;

END;
/
commit work 
/

-- #########################################################
-- #########################################################
-- alter_TR_AGREEMENTS_AD_20.sql
-- #########################################################
-- #########################################################

/* Коррекция триггера, очищающего связь контратка с итогом при удалении, с After на Before */
-- drop trigger TR_AGREEMENTS_AD_20
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;

-- - - - - - - - - - - - -
-- 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 TRIGGER TR_AGREEMENTS_BD_20
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;
/
commit work
/

-- #########################################################
-- #########################################################
-- replace_Procedure_CloseOrgClsDiv.sql
-- #########################################################
-- #########################################################


CREATE OR REPLACE PROCEDURE CLOSEORGCLS_DIV(    CODE$$ NUMBER,    CODE1$ out NUMBER,
        CODE2$ out NUMBER,    CODE3$ out NUMBER,    CODE4$ out NUMBER,    CODE5$ out NUMBER)
AS
  CODE$ NUMBER(10) := CODE$$;
BEGIN
  CODE5$ := TRUNC(CODE$ / 10000);
  CODE$ := CODE$ - CODE5$*10000;
  CODE4$ := TRUNC(CODE$ / 1000);
  CODE$ := CODE$ - CODE4$*1000;
  CODE3$ := TRUNC(CODE$ / 100);
  CODE$ := CODE$ - CODE3$*100;
  CODE2$ := TRUNC(CODE$ / 10);
  CODE1$ := CODE$ - CODE2$*10;
END;
/


-- #########################################################
-- #########################################################
-- AddOKVEDandOKPD.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет таблицы для справочников ОКВЕД, ОКПД
   и ссылки из каталога продукции на них.
*/
CREATE TABLE OKPD (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  CODE NUMBER(10),
    CHECK((CODE<=2147483647)AND(CODE>-2147483648)),
  NAME VARCHAR2(1024),
  HASCHILDS NUMBER(10),
    CHECK((HASCHILDS<=2147483647)AND(HASCHILDS>-2147483648)),
  DELETEDATE DATE,
  STARTDATE DATE,
  CREATEDATE DATE NOT NULL,
  UPDATEDATE DATE NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL,
  CREATERUSER VARCHAR2(30) NOT NULL
)
/
ALTER TABLE OKPD ADD (
  CONSTRAINT PK_OKPD_ID PRIMARY KEY (ID)
)
/
CREATE INDEX IDX_OKPD_SOURCECODE ON OKPD (CODE)
/
-- CREATE TRIGGER TR_OKPD_BI
CREATE OR REPLACE TRIGGER TR_OKPD_BI
  BEFORE INSERT
  ON OKPD
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_OKPD_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.HasChilds is null) then 
    :new.HasChilds := 0;
  END IF;

END;
/
-- CREATE TRIGGER TR_OKPD_BI_500
CREATE OR REPLACE TRIGGER TR_OKPD_BI
  BEFORE INSERT
  ON OKPD
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_OKPD_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.HasChilds is null) then 
    :new.HasChilds := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_OKPD_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_OKPD_BU_0
CREATE OR REPLACE TRIGGER TR_OKPD_BU
  BEFORE UPDATE
  ON OKPD
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_OKPD_BU_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.HasChilds is null) then 
    :new.HasChilds := 0;    
  END IF;

END;
/
-- CREATE TRIGGER TR_OKPD_BU_500
CREATE OR REPLACE TRIGGER TR_OKPD_BU_500
  BEFORE UPDATE
  ON OKPD
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_OKPD_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
GRANT SELECT, INSERT, UPDATE, DELETE ON OKPD TO BUDGET_USERS
/
insert into okpd (ID, Name, Code, HasChilds)values
  (0, 'Не указанная продукция', '0', 1)
/
CREATE TABLE OKVED (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  CODE NUMBER(10),
    CHECK((CODE<=2147483647)AND(CODE>-2147483648)),
  NAME VARCHAR2(1024),
  HASCHILDS NUMBER(10),
    CHECK((HASCHILDS<=2147483647)AND(HASCHILDS>-2147483648)),
  DELETEDATE DATE,
  STARTDATE DATE,
  CREATEDATE DATE NOT NULL,
  UPDATEDATE DATE NOT NULL,
  UPDATERUSER VARCHAR2(30) NOT NULL,
  CREATERUSER VARCHAR2(30) NOT NULL
)
/
ALTER TABLE OKVED ADD (
  CONSTRAINT PK_OKVED_ID PRIMARY KEY (ID)
)
/
CREATE INDEX IDX_OKVED_SOURCECODE ON OKVED (CODE)
/
-- CREATE TRIGGER TR_OKVED_BI
CREATE OR REPLACE TRIGGER TR_OKVED_BI
  BEFORE INSERT
  ON OKVED
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_OKVED_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.HasChilds is null) then 
    :new.HasChilds := 0;
  END IF;

END;
/
-- CREATE TRIGGER TR_OKVED_BI_500
CREATE OR REPLACE TRIGGER TR_OKVED_BI
  BEFORE INSERT
  ON OKVED
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_OKVED_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.HasChilds is null) then 
    :new.HasChilds := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_OKVED_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_OKVED_BU_0
CREATE OR REPLACE TRIGGER TR_OKVED_BU
  BEFORE UPDATE
  ON OKVED
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_OKVED_BU_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.HasChilds is null) then 
    :new.HasChilds := 0;    
  END IF;

END;
/
-- CREATE TRIGGER TR_OKVED_BU_500
CREATE OR REPLACE TRIGGER TR_OKVED_BU_500
  BEFORE UPDATE
  ON OKVED
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_OKVED_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
GRANT SELECT, INSERT, UPDATE, DELETE ON OKVED TO BUDGET_USERS
/
insert into okved (ID, Name, Code, HasChilds)values
  (0, 'Не указанный вид экономической деятельности', '0', 1)
/
ALTER TABLE tenderobjects ADD (
  OKPD NUMBER(10),
    CHECK((OKPD<=2147483647)AND(OKPD>-2147483648)),
  OKVED NUMBER(10),
    CHECK((OKVED<=2147483647)AND(OKVED>-2147483648)),
  CONSTRAINT FK_TENDEROBJECTS_OKPD FOREIGN KEY (OKPD) REFERENCES OKPD (ID),
  CONSTRAINT FK_TENDEROBJECTS_OKVED FOREIGN KEY (OKVED) REFERENCES OKVED (ID)
)
/
CREATE INDEX FK_TENDEROBJECTS_OKPD ON tenderobjects(OKPD)
/
CREATE INDEX FK_TENDEROBJECTS_OKVED ON tenderobjects(OKVED)
/
-- 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 9.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;

-- - - - - - - - - - - - -
-- 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 9.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;

-- - - - - - - - - - - - -
-- 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
  OKPD = 0,
  OKVED = 0
/
ALTER TRIGGER TR_TENDEROBJECTS_BU_500 ENABLE
/
commit work
/


ALTER TABLE tenderobjects MODIFY(OKPD NOT NULL)
/
ALTER TABLE tenderobjects MODIFY(OKVED NOT NULL)
/

-- #########################################################
-- #########################################################
-- alter_dualrights801.sql
-- #########################################################
-- #########################################################

/* Укорочение связей в DualRights с денормализацией. Запись напрямую ссылается на
  на справочник типов прав RightKind, не только транзитивно через DBRights.rightref.
  То же и ObjectKind.
  Абстрагируем ObjRef2, убирая явную ссылку на FACIALACC_CLS.
 */
/* Удаляем ссылку на FACIALACC_CLS */
ALTER TABLE DualRights DROP CONSTRAINT FK_DR_FACIALACC_CLS
/
DROP INDEX FK_DR_FACIALACC_CLS
/
commit work
/
ALTER TABLE DualRights ADD (
  RIGHTKINDREF NUMBER(10),/* Тип права */
    CHECK((RIGHTKINDREF<=2147483647)AND(RIGHTKINDREF>-2147483648)),
  OBJECTKINDREF NUMBER(10)/* Тип объекта - в данном случае - тип связки */,
    CHECK((OBJECTKINDREF<=2147483647)AND(OBJECTKINDREF>-2147483648))
)
/
commit work
/
/* Подтягиваем тип права и объекта из ссылки на сочетание */
CREATE OR REPLACE procedure FixDualRights
AS
  obj_kind$ NUMBER(10);
  right_kind$ NUMBER(10);
BEGIN
  FOR REC$1 IN (select r.Id AS cur_id, r.RightRef  AS cur_right from DualRights r   )
  LOOP
    BEGIN
      select dr.RIGHTKINDREF, dr.OBJECTKINDREF 	into right_kind$, obj_kind$ from DBRIGHTS dr where (dr.id = REC$1.cur_right)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
    update DualRights set RIGHTKINDREF=right_kind$, OBJECTKINDREF=obj_kind$  where (id = REC$1.cur_id);
      
  END LOOP;
END;
/
commit work
/
CALL FixDualRights()
/
commit work
/
drop procedure FixDualRights
/
commit work
/
ALTER TABLE DualRights ADD (
  CONSTRAINT FK_DR_RIGHTKIND FOREIGN KEY (RIGHTKINDREF) REFERENCES RIGHTKIND (ID)
)
/
CREATE INDEX FK_DR_RIGHTKIND ON DualRights(RIGHTKINDREF)
/
commit work
/
ALTER TABLE DualRights ADD (
  CONSTRAINT FK_DR_OBJECTKIND FOREIGN KEY (OBJECTKINDREF) REFERENCES OBJECTKIND (ID)
)
/
CREATE INDEX FK_DR_OBJECTKIND ON DualRights(OBJECTKINDREF)
/
commit work
/
-- ALTER TRIGGER tr_DualRights_BI_0
CREATE OR REPLACE TRIGGER TR_DUALRIGHTS_BI
  BEFORE INSERT
  ON DUALRIGHTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DUALRIGHTS_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then 
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.IsReject is null) then 
    :new.IsReject := 0;
  END IF;
  if (:new.IsGroup is null) then 
    :new.IsGroup := 0;
  END IF;
  /* Сносим тип права и объекта пока (на всякий случай для совместимости) */
  if ((:new.RightKindRef is Null) and not (:new.RightRef is Null)) then
    BEGIN
      select RightKindRef, ObjectKindRef     into :new.RightKindRef, :new.ObjectKindRef from DBRIGHTS dr where (dr.Id = :new.RightRef)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_50 (tr_DualRights_bi_50)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if ((:new.ObjRef1 is not null) and (:new.ObjRef1Up is null)) then
    :new.ObjRef1Up := :new.ObjRef1;
  END IF;
  /* Тип объекта не проверяем, пока в ObjRef2 у нас только Л/С */
  if ((:new.ObjRef2 is not null) and (:new.ObjRef2Up is null)) then
    FacialAcc_CLSUp(:new.ObjRef2,:new.ObjRef2Up);
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DUALRIGHTS_BI_500)
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER tr_DualRights_bu_50
CREATE OR REPLACE TRIGGER TR_DUALRIGHTS_BU
  BEFORE UPDATE
  ON DUALRIGHTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_50 (tr_DualRights_bu_50)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if ((:new.ObjRef1 is not null) and (:new.ObjRef1Up is null)) then
    :new.ObjRef1Up := :new.ObjRef1;
  END IF;
  /* Л/С форматируем для совместимости */
  if ((:new.ObjectKindRef in (8000000, 27000000)) and (:new.ObjRef2 is not null) and (:new.ObjRef2Up is null)) then
    FacialAcc_CLSUp(:new.ObjRef2,:new.ObjRef2Up);
  END IF;

END;
/
-- ALTER TRIGGER tr_DualRights_bi_50
CREATE OR REPLACE TRIGGER TR_DUALRIGHTS_BI
  BEFORE INSERT
  ON DUALRIGHTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_DUALRIGHTS_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then 
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.IsReject is null) then 
    :new.IsReject := 0;
  END IF;
  if (:new.IsGroup is null) then 
    :new.IsGroup := 0;
  END IF;
  /* Сносим тип права и объекта пока (на всякий случай для совместимости) */
  if ((:new.RightKindRef is Null) and not (:new.RightRef is Null)) then
    BEGIN
      select RightKindRef, ObjectKindRef     into :new.RightKindRef, :new.ObjectKindRef from DBRIGHTS dr where (dr.Id = :new.RightRef)
      ;
    EXCEPTION
      WHEN NO_DATA_FOUND THEN NULL;
    END;
  END IF;

-- - - - - - - - - - - - -
-- BI_50 (tr_DualRights_bi_50)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if ((:new.ObjRef1 is not null) and (:new.ObjRef1Up is null)) then
    :new.ObjRef1Up := :new.ObjRef1;
  END IF;
  /* Л/С форматируем для совместимости */
  if ((:new.ObjectKindRef in (8000000, 27000000)) and (:new.ObjRef2 is not null) and (:new.ObjRef2Up is null)) then
    FacialAcc_CLSUp(:new.ObjRef2,:new.ObjRef2Up);
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_DUALRIGHTS_BI_500)
-- - - - - - - - - - - - -

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

END;
/
commit work
/

ALTER TABLE DualRights MODIFY(RIGHTKINDREF NOT NULL)
/
ALTER TABLE DualRights MODIFY(OBJECTKINDREF NOT NULL)
/

-- #########################################################
-- #########################################################
-- Alter_SignSchemeDetail_Triggers.sql
-- #########################################################
-- #########################################################

/* Скрипт изменяет/создает триггеры для SignSchemeDetail заполняющие значения по умолчанию */
-- CREATE TRIGGER TR_SIGNSCHEMEDET_BI_0
CREATE OR REPLACE TRIGGER TR_SIGNSCHEMEDETAIL_II
  INSTEAD OF INSERT
  ON SIGNSCHEMEDETAIL
  FOR EACH ROW
DECLARE
  new$ID SIGNSCHEMEDETAIL.ID%TYPE := :NEW.ID;
  new$RECORDINDEX SIGNSCHEMEDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SIGNREF SIGNSCHEMEDETAIL.SIGNREF%TYPE := :NEW.SIGNREF;
  new$SIGNORDER SIGNSCHEMEDETAIL.SIGNORDER%TYPE := :NEW.SIGNORDER;
  new$SIGNMASK SIGNSCHEMEDETAIL.SIGNMASK%TYPE := :NEW.SIGNMASK;
  new$FICTIVESIGN SIGNSCHEMEDETAIL.FICTIVESIGN%TYPE := :NEW.FICTIVESIGN;
  new$ACTIONREF SIGNSCHEMEDETAIL.ACTIONREF%TYPE := :NEW.ACTIONREF;
  new$CREATEDATE SIGNSCHEMEDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE SIGNSCHEMEDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATERUSER SIGNSCHEMEDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER SIGNSCHEMEDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
--
  MaxOrder$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_SIGNSCHEMEDET_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (new$ID is null) then
    select g_shared.nextval into new$ID from dual;
  END IF;
  if (new$SignOrder is null) then
    new$SignOrder := 0;
  END IF;
  if (new$FictiveSign is null) then
    new$FictiveSign := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_100 (TR_SIGNSCHEMEDET_BI_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  select
  max(d.signmask)
  into
  MaxOrder$   from
  SignSchemeDetail d
  where
  (d.RecordIndex = new$RecordIndex)and(d.signorder = new$signorder)
  ;
  if (MaxOrder$  >= 1073741824) then /* 1073741824=2 в степени 30. Степень больше 30 будет вызывать переполнение integer*/
    RaiseException('EX_MASKOUTOFRANGE');
  END IF;
  if ((MaxOrder$  = 0)or(MaxOrder$  is null)) then
    new$signmask := 1;
      
  else
    new$SignMask := MaxOrder$  * 2;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_SIGNSCHEMEDET_BI_500)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- INSERT
-- - - - - - - - - - - - -
  INSERT INTO TB_SIGNSCHEMEDETAIL (
    ID,
    RECORDINDEX,
    SIGNREF,
    SIGNORDER,
    SIGNMASK,
    FICTIVESIGN,
    ACTIONREF,
    CREATEDATE,
    UPDATEDATE,
    CREATERUSER,
    UPDATERUSER
  ) VALUES (
    new$ID,
    new$RECORDINDEX,
    new$SIGNREF,
    new$SIGNORDER,
    new$SIGNMASK,
    new$FICTIVESIGN,
    new$ACTIONREF,
    new$CREATEDATE,
    new$UPDATEDATE,
    new$CREATERUSER,
    new$UPDATERUSER);

-- - - - - - - - - - - - -
-- AI_500 (TR_SignSchemeDetail_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_SIGNSCHEMEDET_BU_0
CREATE OR REPLACE TRIGGER TR_SIGNSCHEMEDETAIL_IU
  INSTEAD OF UPDATE
  ON SIGNSCHEMEDETAIL
  FOR EACH ROW
DECLARE
  new$ID SIGNSCHEMEDETAIL.ID%TYPE := :NEW.ID;
  new$RECORDINDEX SIGNSCHEMEDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SIGNREF SIGNSCHEMEDETAIL.SIGNREF%TYPE := :NEW.SIGNREF;
  new$SIGNORDER SIGNSCHEMEDETAIL.SIGNORDER%TYPE := :NEW.SIGNORDER;
  new$SIGNMASK SIGNSCHEMEDETAIL.SIGNMASK%TYPE := :NEW.SIGNMASK;
  new$FICTIVESIGN SIGNSCHEMEDETAIL.FICTIVESIGN%TYPE := :NEW.FICTIVESIGN;
  new$ACTIONREF SIGNSCHEMEDETAIL.ACTIONREF%TYPE := :NEW.ACTIONREF;
  new$CREATEDATE SIGNSCHEMEDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE SIGNSCHEMEDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATERUSER SIGNSCHEMEDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER SIGNSCHEMEDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
--
  MaxOrder$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_SIGNSCHEMEDET_BU_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (new$SignOrder is null) then
    new$SignOrder := 0;
  END IF;
  if (new$FictiveSign is null) then
    new$FictiveSign := 0;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_SIGNSCHEMEDET_BU_100)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

  if ((new$signorder <> :old.signorder)or(new$RecordIndex <> :old.RecordIndex)) then
    select
    max(d.SignMask)
    into
    MaxOrder$     from
    SignSchemeDetail d
    where
    (d.RecordIndex = new$RecordIndex)and(d.signorder = new$signorder)
    ;
    if (MaxOrder$  >= 1073741824) then /* 1073741824=2 в степени 30. Степень больше 30 будет вызывать переполнение integer*/
      RaiseException('EX_MASKOUTOFRANGE');
    END IF;
    new$SignMask := MaxOrder$  * 2;
      
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_SIGNSCHEMEDETAIL SET
    ID = new$ID,
    RECORDINDEX = new$RECORDINDEX,
    SIGNREF = new$SIGNREF,
    SIGNORDER = new$SIGNORDER,
    SIGNMASK = new$SIGNMASK,
    FICTIVESIGN = new$FICTIVESIGN,
    ACTIONREF = new$ACTIONREF,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER
  WHERE Id = :old.Id;

END;
/
-- CREATE TRIGGER TR_SIGNSCHEMEDET_BU_100
CREATE OR REPLACE TRIGGER TR_SIGNSCHEMEDETAIL_IU
  INSTEAD OF UPDATE
  ON SIGNSCHEMEDETAIL
  FOR EACH ROW
DECLARE
  new$ID SIGNSCHEMEDETAIL.ID%TYPE := :NEW.ID;
  new$RECORDINDEX SIGNSCHEMEDETAIL.RECORDINDEX%TYPE := :NEW.RECORDINDEX;
  new$SIGNREF SIGNSCHEMEDETAIL.SIGNREF%TYPE := :NEW.SIGNREF;
  new$SIGNORDER SIGNSCHEMEDETAIL.SIGNORDER%TYPE := :NEW.SIGNORDER;
  new$SIGNMASK SIGNSCHEMEDETAIL.SIGNMASK%TYPE := :NEW.SIGNMASK;
  new$FICTIVESIGN SIGNSCHEMEDETAIL.FICTIVESIGN%TYPE := :NEW.FICTIVESIGN;
  new$ACTIONREF SIGNSCHEMEDETAIL.ACTIONREF%TYPE := :NEW.ACTIONREF;
  new$CREATEDATE SIGNSCHEMEDETAIL.CREATEDATE%TYPE := :NEW.CREATEDATE;
  new$UPDATEDATE SIGNSCHEMEDETAIL.UPDATEDATE%TYPE := :NEW.UPDATEDATE;
  new$CREATERUSER SIGNSCHEMEDETAIL.CREATERUSER%TYPE := :NEW.CREATERUSER;
  new$UPDATERUSER SIGNSCHEMEDETAIL.UPDATERUSER%TYPE := :NEW.UPDATERUSER;
--
  MaxOrder1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_SIGNSCHEMEDET_BU_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (new$SignOrder is null) then
    new$SignOrder := 0;
  END IF;
  if (new$FictiveSign is null) then
    new$FictiveSign := 0;
  END IF;

-- - - - - - - - - - - - -
-- BU_100 (TR_SIGNSCHEMEDET_BU_100)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if ((new$signorder <> :old.signorder)or(new$RecordIndex <> :old.RecordIndex)) then
    select
    max(d.SignMask)
    into
    MaxOrder1$     from
    SignSchemeDetail d
    where
    (d.RecordIndex = new$RecordIndex)and(d.signorder = new$signorder)
    ;
    if (MaxOrder1$  >= 1073741824) then /* 1073741824=2 в степени 30. Степень больше 30 будет вызывать переполнение integer*/ 
      RaiseException('EX_MASKOUTOFRANGE');
    END IF;
    if ((MaxOrder1$  = 0) or (MaxOrder1$  is null)) then
      new$SignMask := 1;      
          
    else
      new$SignMask := MaxOrder1$  * 2;
      
    END IF;
  END IF;

-- - - - - - - - - - - - -
-- UPDATE
-- - - - - - - - - - - - -
  UPDATE TB_SIGNSCHEMEDETAIL SET
    ID = new$ID,
    RECORDINDEX = new$RECORDINDEX,
    SIGNREF = new$SIGNREF,
    SIGNORDER = new$SIGNORDER,
    SIGNMASK = new$SIGNMASK,
    FICTIVESIGN = new$FICTIVESIGN,
    ACTIONREF = new$ACTIONREF,
    CREATEDATE = new$CREATEDATE,
    UPDATEDATE = new$UPDATEDATE,
    CREATERUSER = new$CREATERUSER,
    UPDATERUSER = new$UPDATERUSER
  WHERE Id = :old.Id;

END;
/
commit work
/

-- #########################################################
-- #########################################################
-- Alter_SignSchemeDetail_Fields.sql
-- #########################################################
-- #########################################################


/* >Alter_SignSchemeDetail_Triggers.sql */
/* Скрипт изменяет в таблице SignSchemeDetail типы поле SignRef, SignOrder, SignMask, FictiveSign на NOT NULL */

alter trigger TR_SIGNSCHEMEDET_BU_500 DISABLE
/

update SignSchemeDetail
set
  SignOrder = 0
where
  (SignOrder is null)
/

update SignSchemeDetail
set
  FictiveSign = 0
where
  (FictiveSign is null)
/

alter trigger TR_SIGNSCHEMEDET_BU_500 ENABLE
/

alter table TB_SignSchemeDetail modify (SignRef not null)
/

alter table TB_SignSchemeDetail modify (SignOrder not null)
/

alter table TB_SignSchemeDetail modify (SignMask not null)
/

alter table TB_SignSchemeDetail modify (FictiveSign not null)
/

commit work
/



-- #########################################################
-- #########################################################
-- alter_bankexch_subst_add_ClsType.sql
-- #########################################################
-- #########################################################

/* Добавления полей исходного и заменяющего значения типа классификации в таблицу подстановок ЭО */
ALTER TABLE bankexch_substitution ADD (
  SourceClsType NUMBER(10),
    CHECK((SourceClsType<=2147483647)AND(SourceClsType>-2147483648)),
  DestClsType NUMBER(10),
    CHECK((DestClsType<=2147483647)AND(DestClsType>-2147483648))
)
/
commit work 
/

-- #########################################################
-- #########################################################
-- Create_ClsCorrespondents.sql
-- #########################################################
-- #########################################################

/* Соответствие классификации*/
create table ClsCorrespondents (
  ID NUMBER(10) NOT NULL,
    CHECK((ID<=2147483647)AND(ID>-2147483648)),
  KVR NUMBER(10) NOT NULL,
    CHECK((KVR<=2147483647)AND(KVR>-2147483648)),
  KESR NUMBER(10) NOT NULL,
    CHECK((KESR<=2147483647)AND(KESR>-2147483648)),
  CreaterUser VARCHAR2(30) NOT NULL,
  CreateDate DATE NOT NULL,
  Updatedate DATE NOT NULL,
  UpdaterUser VARCHAR2(30) NOT NULL,
  constraint ClsCorrespondents_PK_ID PRIMARY KEY (ID),
  constraint FK_KVR_ClsCorrespondents foreign key(KVR) references KVR(ID),
  constraint FK_KESR_ClsCorrespondents foreign key(KESR) references KESR(ID)
)
/
CREATE INDEX FK_KVR_ClsCorrespondents ON ClsCorrespondents(KVR)
/
CREATE INDEX FK_KESR_ClsCorrespondents ON ClsCorrespondents(KESR)
/
-- CREATE TRIGGER TR_ClsCorrespondents_BI_0
CREATE OR REPLACE TRIGGER TR_ClsCorrespondents_BI
  BEFORE INSERT
  ON ClsCorrespondents
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_ClsCorrespondents_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.KVR is null) then
    :new.KVR := 0;
  END IF;
  if (:new.KESR is null) then
    :new.KESR := 0;
  END IF;

END;
/
-- CREATE TRIGGER TR_ClsCorrespondents_BU_0
CREATE OR REPLACE TRIGGER TR_ClsCorrespondents_BU
  BEFORE UPDATE
  ON ClsCorrespondents
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_ClsCorrespondents_BU_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.KVR is null) then
    :new.KVR := 0;
  END IF;
  if (:new.KESR is null) then
    :new.KESR := 0;
  END IF;

END;
/
-- CREATE TRIGGER TR_ClsCorrespondents_BU_500
CREATE OR REPLACE TRIGGER TR_ClsCorrespondents_BU_500
  BEFORE UPDATE
  ON CLSCORRESPONDENTS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BU_500 (TR_ClsCorrespondents_BU_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_ClsCorrespondents_BI_500
CREATE OR REPLACE TRIGGER TR_ClsCorrespondents_BI
  BEFORE INSERT
  ON ClsCorrespondents
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_ClsCorrespondents_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if (:new.ID is null) then
    select g_shared.nextval into :new.ID from dual;
  END IF;
  if (:new.KVR is null) then
    :new.KVR := 0;
  END IF;
  if (:new.KESR is null) then
    :new.KESR := 0;
  END IF;

-- - - - - - - - - - - - -
-- BI_500 (TR_ClsCorrespondents_BI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_ClsCorrespondents_AD_500
CREATE OR REPLACE TRIGGER TR_ClsCorrespondents_AD
  AFTER DELETE
  ON ClsCorrespondents
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AD_500 (TR_ClsCorrespondents_AD_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

END;
/
-- CREATE TRIGGER TR_ClsCorrespondents_AI_500
CREATE OR REPLACE TRIGGER TR_ClsCorrespondents_AI
  AFTER INSERT
  ON ClsCorrespondents
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- AI_500 (TR_ClsCorrespondents_AI_500)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  delete from DelRecIndexes where (TableID = 1420) and (RecordId = :new.ID);

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


-- #########################################################
-- #########################################################
-- ADD_UINCode_107H.sql
-- #########################################################
-- #########################################################

/* Изменения согласно 107H *//* Скрипт добавляет поле UINCode в таблицы
   bankexch_merdoc и ed_outpaydoc */
ALTER TABLE bankexch_merdoc ADD (
  UINCode VARCHAR2(20)
)
/
COMMIT WORK
/
ALTER TABLE ed_outpaydoc ADD (
  UINCode VARCHAR2(20)
)
/
COMMIT WORK
/


-- #########################################################
-- #########################################################
-- Add_UINCode_incomes32_FFC.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет поле для хранения уникального идентификатора начислений в таблицы FacialFinCaption и Incomes32 */
ALTER TABLE TB_FacialFinCaption ADD (
  UINCode VARCHAR2(20)
)
/

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)
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
  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;
--
  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
  ) 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);

-- - - - - - - - - - - - -
-- 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;
--
  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
  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_incomes32 ADD (
  UINCode VARCHAR2(20)
)
/

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)
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
  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_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;
--
  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)
-- Last update 23.05.2005
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- 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 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;
--
  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
  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;
/
commit work 
/

-- #########################################################
-- #########################################################
-- Alter_Trigger_DataPacket_BD0.sql
-- #########################################################
-- #########################################################

/* скрипт модифицирует тригер "перед удалением" таблицы DataPacket для
   поддержки нового значения PacketState "На подписании"(2) */
-- CREATE TRIGGER Tr_Datapacket_Bd_0
CREATE OR REPLACE TRIGGER TR_DATAPACKET_BD
  BEFORE DELETE
  ON DATAPACKET
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BD_0 (tr_DataPacket_bd_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if ((:old.ProgIndex <> 526) and (:old.PacketState in (0, 2))) then
    RaiseException('EX_CANNOTDELETEPUBLICED');
  END IF;
  delete from ArchiveOpLog
  where (DataPacketRef = :old.ID);

END;
/
commit work 
/


-- #########################################################
-- #########################################################
-- Alter_TR_CORRECTIONCAPTION_BU_300.sql
-- #########################################################
-- #########################################################

/* Исправление триггера, отклоняющего связи для
   отклоненных уведомлений */
-- ALTER TRIGGER TR_CORRECTIONCAPTION_BU_300
CREATE OR REPLACE TRIGGER TR_CORRECTIONCAPTION_BU
  BEFORE UPDATE
  ON CORRECTIONCAPTION
  FOR EACH ROW
DECLARE
  NewFAOrgType$ NUMBER(10);
  IsReject1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_CORRECTIONCAPTION_BU)
-- Version 7.01.00.3
-- - - - - - - - - - - - -

  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 ((:old.AcceptDate is null)
  or (:new.AcceptDate <> :old.AcceptDate))) then
    FOR REC$1 IN (select ID AS DetailID, FAOrgType AS OldFAOrgType, FacialAcc_Cls  AS DetailFacCls from CorrectionDetail
    where RecordIndex = :new.ID
    )
    LOOP
      BEGIN
        select org.Org_Type into NewFAOrgType$ from Organizations org
        inner join FacialAcc_Cls fac on (fac.Org_Ref = org.ID)
        where fac.ID = REC$1.DetailFacCls  ;
      EXCEPTION
        WHEN NO_DATA_FOUND THEN NULL;
      END;
      if (NewFAOrgType$ <> REC$1.OldFaOrgType) then
        update CorrectionDetail set
        FAOrgType = NewFAOrgType$,
        RVersion = -1
        where ID = REC$1.DetailID;
           
      END IF;
    END LOOP;
  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;

-- - - - - - - - - - - - -
-- BU_200 (CORRECTIONCAPTION_BU200)
-- Create 05.05.2009
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- BU_300 (TR_CORRECTIONCAPTION_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 in (select d.id from CorrectionDetail d where d.RecordIndex = :new.id);
  END IF;

-- - - - - - - - - - - - -
-- BU_700 (TR_CORRECTIONCAPTION_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;     

END;
/
commit work 
/



-- #########################################################
-- #########################################################
-- Alter_TenderCaption_SupportAndNKO.sql
-- #########################################################
-- #########################################################

ALTER TRIGGER TR_TENDERCAPTION_BU_500 DISABLE
/
commit work
/
ALTER TABLE TB_tendercaption ADD (
  SecurityTSize NUMBER,/* Обеспечение заявки на участие */
  SecurityASize NUMBER,/* Обеспечение исполнения контракта */
  AvansSize NUMBER,/* Размер аванса */
  PreferenceCripple NUMBER,/* Преимущества для организаций инвалидов */
  PreferenceRusProduct NUMBER,/* Преимущества для товаров российского происхождения */
  PreferencePrison NUMBER,/* Преимущества для учреждений УИС */
  PurchaseSocialNKO NUMBER(5) default 0,
    CHECK (PurchaseSocialNKO in (0,1))
)
/

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)
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
  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;
--
  Tmp$ NUMBER(10);
  AdjID$ NUMBER(10);
  CurVal$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_TENDERCAPTION_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$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;

-- - - - - - - - - - - - -
-- 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;
/

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;
--
  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
  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;
/
/* Закупка у социально ориентированных НКО */
ALTER TRIGGER TR_TENDERCAPTION_BU_500 ENABLE
/
commit work
/
ALTER TABLE TB_tendercaption MODIFY(PurchaseSocialNKO NOT NULL)
/

-- #########################################################
-- #########################################################
-- ImportClsCorrespondents.sql
-- #########################################################
-- #########################################################

/* Скрипт импортирует таблицу соответствия КВР и КОСГУ */
CREATE OR REPLACE procedure AddClsCorresp(kvrCode$ VARCHAR2,kvrName$ VARCHAR2,                               kesrKey$ NUMBER,
    kesrName$ VARCHAR2)
AS
  kvrKey$ NUMBER(10);
  ClsCorExists$ NUMBER(10);
  KesrExists$ NUMBER(10);
BEGIN
  select min(id) into kvrKey$ from kvr where (code = kvrCode$) and (BudgetRef = 0) ;
  if (kvrKey$ is null) then
    select min(id) into kvrKey$ from kvr where code = kvrCode$  ;
    if (kvrKey$ is null) then
      insert into KVR (code,name,budgetref,startdate)
      values (kvrCode$,kvrName$,0,TO_DATE('01.01.2014', 'DD.MM.YYYY'));
      select min(id) into kvrKey$ from kvr where (code = kvrCode$) and (BudgetRef = 0) ;
    else
      Update kvr set budgetref=0 where id = kvrKey$;
      
    END IF;
  END IF;

  select count(id)
  into ClsCorExists$             from clscorrespondents
  where (kvr = kvrKey$) and (kesr  = kesrKey$) ;
  if (ClsCorExists$ = 0) then
    select count(id) into KesrExists$ from KESR where id = kesrKey$  ;
    if (KesrExists$ = 0) then
      insert into KESR (id, name,startdate)
      values (kesrKey$,kesrName$,TO_DATE('01.01.2014', 'DD.MM.YYYY'));
    END IF;
    insert into clscorrespondents(kvr, kesr) values (kvrKey$, kesrKey$);
      
  END IF;
END;
/
commit work 
/
CALL AddClsCorresp('111','Фонд оплаты труда казенных учреждений и взносы по обязательному социальному страхованию',211,'Заработная плата')
/
CALL AddClsCorresp('111','Фонд оплаты труда казенных учреждений и взносы по обязательному социальному страхованию',213,'Начисления на выплаты по оплате труда')
/
CALL AddClsCorresp('112','Иные выплаты персоналу казенных учреждений, за исключением фонда оплаты труда',212,'Прочие выплаты')
/
CALL AddClsCorresp('112','Иные выплаты персоналу казенных учреждений, за исключением фонда оплаты труда',213,'Начисления на выплаты по оплате труда')
/
CALL AddClsCorresp('112','Иные выплаты персоналу казенных учреждений, за исключением фонда оплаты труда',222,'Транспортные услуги')
/
CALL AddClsCorresp('112','Иные выплаты персоналу казенных учреждений, за исключением фонда оплаты труда',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('112','Иные выплаты персоналу казенных учреждений, за исключением фонда оплаты труда',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('112','Иные выплаты персоналу казенных учреждений, за исключением фонда оплаты труда',290,'Прочие расходы')
/
CALL AddClsCorresp('113','Иные выплаты, за исключением фонда оплаты труда казенных учреждений, лицам, привлекаемым согласно законодательству для выполнения отдельных полномочий ',222,'Транспортные услуги')
/
CALL AddClsCorresp('113','Иные выплаты, за исключением фонда оплаты труда казенных учреждений, лицам, привлекаемым согласно законодательству для выполнения отдельных полномочий ',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('113','Иные выплаты, за исключением фонда оплаты труда казенных учреждений, лицам, привлекаемым согласно законодательству для выполнения отдельных полномочий ',290,'Прочие расходы')
/
CALL AddClsCorresp('121','Фонд оплаты труда государственных (муниципальных) органов и взносы по обязательному социальному страхованию',211,'Заработная плата')
/
CALL AddClsCorresp('121','Фонд оплаты труда государственных (муниципальных) органов и взносы по обязательному социальному страхованию',213,'Начисления на выплаты по оплате труда')
/
CALL AddClsCorresp('122','Иные выплаты персоналу государственных (муниципальных) органов, за исключением фонда оплаты труда ',211,'Заработная плата')
/
CALL AddClsCorresp('122','Иные выплаты персоналу государственных (муниципальных) органов, за исключением фонда оплаты труда ',212,'Прочие выплаты')
/
CALL AddClsCorresp('122','Иные выплаты персоналу государственных (муниципальных) органов, за исключением фонда оплаты труда ',213,'Начисления на выплаты по оплате труда')
/
CALL AddClsCorresp('122','Иные выплаты персоналу государственных (муниципальных) органов, за исключением фонда оплаты труда ',222,'Транспортные услуги')
/
CALL AddClsCorresp('122','Иные выплаты персоналу государственных (муниципальных) органов, за исключением фонда оплаты труда ',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('122','Иные выплаты персоналу государственных (муниципальных) органов, за исключением фонда оплаты труда ',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('122','Иные выплаты персоналу государственных (муниципальных) органов, за исключением фонда оплаты труда ',290,'Прочие расходы')
/
CALL AddClsCorresp('123','Иные выплаты, за исключением фонда оплаты труда государственных (муниципальных) органов, лицам, привлекаемым согласно законодательству для выполнения отдельных полномочий',222,'Транспортные услуги')
/
CALL AddClsCorresp('123','Иные выплаты, за исключением фонда оплаты труда государственных (муниципальных) органов, лицам, привлекаемым согласно законодательству для выполнения отдельных полномочий',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('123','Иные выплаты, за исключением фонда оплаты труда государственных (муниципальных) органов, лицам, привлекаемым согласно законодательству для выполнения отдельных полномочий',290,'Прочие расходы')
/
CALL AddClsCorresp('131','Денежное довольствие военнослужащих и сотрудников, имеющих специальные звания',211,'Заработная плата')
/
CALL AddClsCorresp('131','Денежное довольствие военнослужащих и сотрудников, имеющих специальные звания',213,'Начисления на выплаты по оплате труда')
/
CALL AddClsCorresp('133','Расходы на выплаты военнослужащим и сотрудникам, имеющим специальные звания, зависящие от размера денежного довольствия',212,'Прочие выплаты')
/
CALL AddClsCorresp('133','Расходы на выплаты военнослужащим и сотрудникам, имеющим специальные звания, зависящие от размера денежного довольствия',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('134','Иные выплаты персоналу и сотрудникам, имеющим специальные звания',212,'Прочие выплаты')
/
CALL AddClsCorresp('134','Иные выплаты персоналу и сотрудникам, имеющим специальные звания',222,'Транспортные услуги')
/
CALL AddClsCorresp('134','Иные выплаты персоналу и сотрудникам, имеющим специальные звания',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('134','Иные выплаты персоналу и сотрудникам, имеющим специальные звания',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('134','Иные выплаты персоналу и сотрудникам, имеющим специальные звания',290,'Прочие расходы')
/
CALL AddClsCorresp('141','Фонд оплаты труда и страховые взносы',211,' Заработная плата')
/
CALL AddClsCorresp('141','Фонд оплаты труда и страховые взносы',213,'Начисления на выплаты по оплате труда')
/
CALL AddClsCorresp('142','Иные выплаты персоналу, за исключением фонда оплаты труда',212,'Прочие выплаты')
/
CALL AddClsCorresp('142','Иные выплаты персоналу, за исключением фонда оплаты труда',213,'Начисления на выплаты по оплате труда')
/
CALL AddClsCorresp('142','Иные выплаты персоналу, за исключением фонда оплаты труда',222,'Транспортные услуги')
/
CALL AddClsCorresp('142','Иные выплаты персоналу, за исключением фонда оплаты труда',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('142','Иные выплаты персоналу, за исключением фонда оплаты труда',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('211','Закупка вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа в целях обеспечения государственной программы вооружения',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('211','Закупка вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа в целях обеспечения государственной программы вооружения',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('211','Закупка вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа в целях обеспечения государственной программы вооружения',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('212','Закупка вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа вне рамок государственной программы вооружения',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('212','Закупка вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа вне рамок государственной программы вооружения',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('212','Закупка вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа вне рамок государственной программы вооружения',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('214','Ремонт вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа в целях обеспечения государственной программы вооружения',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('214','Ремонт вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа в целях обеспечения государственной программы вооружения',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('214','Ремонт вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа в целях обеспечения государственной программы вооружения',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('214','Ремонт вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа в целях обеспечения государственной программы вооружения',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('215','Ремонт вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа вне рамок государственной программы вооружения',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('215','Ремонт вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа вне рамок государственной программы вооружения',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('215','Ремонт вооружений, военной и специальной техники, продукции производственно-технического назначения и имущества в рамках государственного оборонного заказа вне рамок государственной программы вооружения',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('216','Фундаментальные исследования в интересах национальной обороны, национальной безопасности и правоохранительной деятельности в рамках государственного оборонного заказа в целях обеспечения государственной программы вооружения',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('216','Фундаментальные исследования в интересах национальной обороны, национальной безопасности и правоохранительной деятельности в рамках государственного оборонного заказа в целях обеспечения государственной программы вооружения',320,'Увеличение стоимости нематериальных активов')
/
CALL AddClsCorresp('217','Исследования в области разработки вооружений, военной и специальной техники, продукции производственно-технического назначения в рамках государственного оборонного заказа в целях обеспечения государственной программы вооружения',226,'Прочие работы, услуги ')
/
CALL AddClsCorresp('217','Исследования в области разработки вооружений, военной и специальной техники, продукции производственно-технического назначения в рамках государственного оборонного заказа в целях обеспечения государственной программы вооружения',320,'Увеличение стоимости нематериальных активов')
/
CALL AddClsCorresp('218','Исследования в области разработки вооружений, военной и специальной техники, продукции производственно-технического назначения в рамках государственного оборонного заказа вне рамок государственной программы вооружения',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('218','Исследования в области разработки вооружений, военной и специальной техники, продукции производственно-технического назначения в рамках государственного оборонного заказа вне рамок государственной программы вооружения',320,'Увеличение стоимости нематериальных активов')
/
CALL AddClsCorresp('219','Закупка работ и услуг в целях обеспечения мероприятий в рамках государственного оборонного заказа',221,'Услуги связи')
/
CALL AddClsCorresp('219','Закупка работ и услуг в целях обеспечения мероприятий в рамках государственного оборонного заказа',222,'Транспортные услуги')
/
CALL AddClsCorresp('219','Закупка работ и услуг в целях обеспечения мероприятий в рамках государственного оборонного заказа',223,'Коммунальные услуги')
/
CALL AddClsCorresp('219','Закупка работ и услуг в целях обеспечения мероприятий в рамках государственного оборонного заказа',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('219','Закупка работ и услуг в целях обеспечения мероприятий в рамках государственного оборонного заказа',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('219','Закупка работ и услуг в целях обеспечения мероприятий в рамках государственного оборонного заказа',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('219','Закупка работ и услуг в целях обеспечения мероприятий в рамках государственного оборонного заказа',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('219','Закупка работ и услуг в целях обеспечения мероприятий в рамках государственного оборонного заказа',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('221','Обеспечение специальным топливом и горюче-смазочными материалами в рамках государственного оборонного заказа',222,'Транспортные услуги')
/
CALL AddClsCorresp('221','Обеспечение специальным топливом и горюче-смазочными материалами в рамках государственного оборонного заказа',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('221','Обеспечение специальным топливом и горюче-смазочными материалами в рамках государственного оборонного заказа',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('221','Обеспечение специальным топливом и горюче-смазочными материалами в рамках государственного оборонного заказа',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('221','Обеспечение специальным топливом и горюче-смазочными материалами в рамках государственного оборонного заказа',290,'Прочие расходы')
/
CALL AddClsCorresp('221','Обеспечение специальным топливом и горюче-смазочными материалами в рамках государственного оборонного заказа',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('221','Обеспечение специальным топливом и горюче-смазочными материалами в рамках государственного оборонного заказа',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('222','Обеспечение специальным топливом и горюче-смазочными материалами вне рамок государственного оборонного заказа',222,'Транспортные услуги')
/
CALL AddClsCorresp('222','Обеспечение специальным топливом и горюче-смазочными материалами вне рамок государственного оборонного заказа',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('222','Обеспечение специальным топливом и горюче-смазочными материалами вне рамок государственного оборонного заказа',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('222','Обеспечение специальным топливом и горюче-смазочными материалами вне рамок государственного оборонного заказа',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('222','Обеспечение специальным топливом и горюче-смазочными материалами вне рамок государственного оборонного заказа',290,'Прочие расходы')
/
CALL AddClsCorresp('222','Обеспечение специальным топливом и горюче-смазочными материалами вне рамок государственного оборонного заказа',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('222','Обеспечение специальным топливом и горюче-смазочными материалами вне рамок государственного оборонного заказа',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('223','Продовольственное обеспечение в рамках государственного оборонного заказа',222,'Транспортные услуги')
/
CALL AddClsCorresp('223','Продовольственное обеспечение в рамках государственного оборонного заказа',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('223','Продовольственное обеспечение в рамках государственного оборонного заказа',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('223','Продовольственное обеспечение в рамках государственного оборонного заказа',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('223','Продовольственное обеспечение в рамках государственного оборонного заказа',290,'Прочие расходы')
/
CALL AddClsCorresp('223','Продовольственное обеспечение в рамках государственного оборонного заказа',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('223','Продовольственное обеспечение в рамках государственного оборонного заказа',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('224','Продовольственное обеспечение вне рамок государственного оборонного заказа',222,'Транспортные услуги')
/
CALL AddClsCorresp('224','Продовольственное обеспечение вне рамок государственного оборонного заказа',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('224','Продовольственное обеспечение вне рамок государственного оборонного заказа',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('224','Продовольственное обеспечение вне рамок государственного оборонного заказа',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('224','Продовольственное обеспечение вне рамок государственного оборонного заказа',290,'Прочие расходы')
/
CALL AddClsCorresp('224','Продовольственное обеспечение вне рамок государственного оборонного заказа',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('224','Продовольственное обеспечение вне рамок государственного оборонного заказа',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('225','Вещевое обеспечение в рамках государственного оборонного заказа',222,'Транспортные услуги')
/
CALL AddClsCorresp('225','Вещевое обеспечение в рамках государственного оборонного заказа',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('225','Вещевое обеспечение в рамках государственного оборонного заказа',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('225','Вещевое обеспечение в рамках государственного оборонного заказа',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('225','Вещевое обеспечение в рамках государственного оборонного заказа',290,'Прочие расходы')
/
CALL AddClsCorresp('225','Вещевое обеспечение в рамках государственного оборонного заказа',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('225','Вещевое обеспечение в рамках государственного оборонного заказа',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('226','Вещевое обеспечение вне рамок государственного оборонного заказа',222,'Транспортные услуги')
/
CALL AddClsCorresp('226','Вещевое обеспечение вне рамок государственного оборонного заказа',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('226','Вещевое обеспечение вне рамок государственного оборонного заказа',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('226','Вещевое обеспечение вне рамок государственного оборонного заказа',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('226','Вещевое обеспечение вне рамок государственного оборонного заказа',290,'Прочие расходы')
/
CALL AddClsCorresp('226','Вещевое обеспечение вне рамок государственного оборонного заказа',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('226','Вещевое обеспечение вне рамок государственного оборонного заказа',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('231','Закупка товаров, работ, услуг в целях формирования государственного материального резерва в рамках государственного оборонного заказа',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('232','Закупка товаров, работ, услуг в целях формирования государственного материального резерва вне рамок государственного оборонного заказа',222,'Транспортные услуги')
/
CALL AddClsCorresp('232','Закупка товаров, работ, услуг в целях формирования государственного материального резерва вне рамок государственного оборонного заказа',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('241','Научно-исследовательские и опытно-конструкторские работы',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('241','Научно-исследовательские и опытно-конструкторские работы',320,'Увеличение стоимости нематериальных активов')
/
CALL AddClsCorresp('242','Закупка товаров, работ, услуг в сфере информационно-коммуникационных технологий',221,'Услуги связи')
/
CALL AddClsCorresp('242','Закупка товаров, работ, услуг в сфере информационно-коммуникационных технологий',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('242','Закупка товаров, работ, услуг в сфере информационно-коммуникационных технологий',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('242','Закупка товаров, работ, услуг в сфере информационно-коммуникационных технологий',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('242','Закупка товаров, работ, услуг в сфере информационно-коммуникационных технологий',290,'Прочие расходы')
/
CALL AddClsCorresp('242','Закупка товаров, работ, услуг в сфере информационно-коммуникационных технологий',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('242','Закупка товаров, работ, услуг в сфере информационно-коммуникационных технологий',320,'Увеличение стоимости нематериальных активов')
/
CALL AddClsCorresp('242','Закупка товаров, работ, услуг в сфере информационно-коммуникационных технологий',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('243','Закупка товаров, работ, услуг в целях капитального ремонта государственного (муниципального)  имущества',222,'Транспортные услуги')
/
CALL AddClsCorresp('243','Закупка товаров, работ, услуг в целях капитального ремонта государственного (муниципального)  имущества',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('243','Закупка товаров, работ, услуг в целях капитального ремонта государственного (муниципального)  имущества',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('243','Закупка товаров, работ, услуг в целях капитального ремонта государственного (муниципального)  имущества',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('243','Закупка товаров, работ, услуг в целях капитального ремонта государственного (муниципального)  имущества',290,'Прочие расходы')
/
CALL AddClsCorresp('243','Закупка товаров, работ, услуг в целях капитального ремонта государственного (муниципального)  имущества',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('243','Закупка товаров, работ, услуг в целях капитального ремонта государственного (муниципального)  имущества',340,'Увеличение стоимости материальных запасов ')
/
CALL AddClsCorresp('244','Прочая закупка товаров, работ и услуг для обеспечения государственных (муниципальных) нужд',221,'Услуги связи')
/
CALL AddClsCorresp('244','Прочая закупка товаров, работ и услуг для обеспечения государственных (муниципальных) нужд',222,'Транспортные услуги')
/
CALL AddClsCorresp('244','Прочая закупка товаров, работ и услуг для обеспечения государственных (муниципальных) нужд',223,'Коммунальные услуги')
/
CALL AddClsCorresp('244','Прочая закупка товаров, работ и услуг для обеспечения государственных (муниципальных) нужд',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('244','Прочая закупка товаров, работ и услуг для обеспечения государственных (муниципальных) нужд',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('244','Прочая закупка товаров, работ и услуг для обеспечения государственных (муниципальных) нужд',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('244','Прочая закупка товаров, работ и услуг для обеспечения государственных (муниципальных) нужд',290,'Прочие расходы')
/
CALL AddClsCorresp('244','Прочая закупка товаров, работ и услуг для обеспечения государственных (муниципальных) нужд',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('244','Прочая закупка товаров, работ и услуг для обеспечения государственных (муниципальных) нужд',320,'Увеличение стоимости нематериальных активов')
/
CALL AddClsCorresp('244','Прочая закупка товаров, работ и услуг для обеспечения государственных (муниципальных) нужд',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('244','Прочая закупка товаров, работ и услуг для обеспечения государственных (муниципальных) нужд',530,'Увеличение стоимости акций и иных форм участия в капитале')
/
CALL AddClsCorresp('311','Пенсии, выплачиваемые по пенсионному страхованию населения',261,'Пенсии, пособия и выплаты по пенсионному, социальному и медицинскому страхованию населения')
/
CALL AddClsCorresp('311','Пенсии, выплачиваемые по пенсионному страхованию населения',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('311','Пенсии, выплачиваемые по пенсионному страхованию населения',263,'Пенсии, пособия, выплачиваемые организациями сектора государственного управления')
/
CALL AddClsCorresp('312','Иные пенсии, социальные доплаты к пенсиям',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('312','Иные пенсии, социальные доплаты к пенсиям',263,'Пенсии, пособия, выплачиваемые организациями сектора государственного управления')
/
CALL AddClsCorresp('312','Иные пенсии, социальные доплаты к пенсиям',290,'Прочие расходы')
/
CALL AddClsCorresp('313','Пособия, компенсации, меры социальной поддержки по публичным нормативным обязательствам',261,'Пенсии, пособия и выплаты по пенсионному, социальному и медицинскому страхованию населения')
/
CALL AddClsCorresp('313','Пособия, компенсации, меры социальной поддержки по публичным нормативным обязательствам',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('313','Пособия, компенсации, меры социальной поддержки по публичным нормативным обязательствам',263,'Пенсии, пособия, выплачиваемые организациями сектора государственного управления')
/
CALL AddClsCorresp('313','Пособия, компенсации, меры социальной поддержки по публичным нормативным обязательствам',290,'Прочие расходы')
/
CALL AddClsCorresp('321','Пособия, компенсации и иные социальные выплаты гражданам, кроме публичных нормативных обязательств',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('321','Пособия, компенсации и иные социальные выплаты гражданам, кроме публичных нормативных обязательств',263,'Пенсии, пособия, выплачиваемые организациями сектора государственного управления')
/
CALL AddClsCorresp('321','Пособия, компенсации и иные социальные выплаты гражданам, кроме публичных нормативных обязательств',290,'Прочие расходы')
/
CALL AddClsCorresp('322','Субсидии гражданам на приобретение жилья',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('323','Приобретение товаров, работ, услуг в пользу граждан в целях их социального обеспечения',220,'Оплата работ, услуг')
/
CALL AddClsCorresp('323','Приобретение товаров, работ, услуг в пользу граждан в целях их социального обеспечения',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('323','Приобретение товаров, работ, услуг в пользу граждан в целях их социального обеспечения',263,'Пенсии, пособия, выплачиваемые организациями сектора государственного управления')
/
CALL AddClsCorresp('323','Приобретение товаров, работ, услуг в пользу граждан в целях их социального обеспечения',300,'Поступление нефинансовых активов')
/
CALL AddClsCorresp('330','Публичные нормативные выплаты гражданам несоциального характера',290,'Прочие расходы')
/
CALL AddClsCorresp('340','Стипендии',290,'Прочие расходы')
/
CALL AddClsCorresp('350','Премии и гранты',290,'Прочие расходы')
/
CALL AddClsCorresp('360','Иные выплаты населению',221,'Услуги связи')
/
CALL AddClsCorresp('360','Иные выплаты населению',222,'Транспортные услуги')
/
CALL AddClsCorresp('360','Иные выплаты населению',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('360','Иные выплаты населению',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('360','Иные выплаты населению',290,'Прочие расходы')
/
CALL AddClsCorresp('411','Бюджетные инвестиции на приобретение объектов недвижимого имущества в федеральную собственность в рамках государственного оборонного заказа',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('411','Бюджетные инвестиции на приобретение объектов недвижимого имущества в федеральную собственность в рамках государственного оборонного заказа',330,'Увеличение стоимости непроизведенных активов            ')
/
CALL AddClsCorresp('412','Бюджетные инвестиции на приобретение объектов недвижимого имущества в государственную (муниципальную) собственность',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('412','Бюджетные инвестиции на приобретение объектов недвижимого имущества в государственную (муниципальную) собственность',330,'Увеличение стоимости непроизведенных активов            ')
/
CALL AddClsCorresp('413','Бюджетные инвестиции в объекты капитального строительства в рамках государственного оборонного заказа',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('413','Бюджетные инвестиции в объекты капитального строительства в рамках государственного оборонного заказа',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('413','Бюджетные инвестиции в объекты капитального строительства в рамках государственного оборонного заказа',290,'Прочие расходы')
/
CALL AddClsCorresp('413','Бюджетные инвестиции в объекты капитального строительства в рамках государственного оборонного заказа',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('413','Бюджетные инвестиции в объекты капитального строительства в рамках государственного оборонного заказа',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('414','Бюджетные инвестиции в объекты капитального строительства государственной (муниципальной) собственности',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('414','Бюджетные инвестиции в объекты капитального строительства государственной (муниципальной) собственности',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('414','Бюджетные инвестиции в объекты капитального строительства государственной (муниципальной) собственности',290,'Прочие расходы')
/
CALL AddClsCorresp('414','Бюджетные инвестиции в объекты капитального строительства государственной (муниципальной) собственности',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('414','Бюджетные инвестиции в объекты капитального строительства государственной (муниципальной) собственности',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('415','Бюджетные инвестиции в соответствии с концессионными соглашениями',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('415','Бюджетные инвестиции в соответствии с концессионными соглашениями',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('415','Бюджетные инвестиции в соответствии с концессионными соглашениями',290,'Прочие расходы')
/
CALL AddClsCorresp('415','Бюджетные инвестиции в соответствии с концессионными соглашениями',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('415','Бюджетные инвестиции в соответствии с концессионными соглашениями',340,'Увеличение стоимости материальных запасов')
/
CALL AddClsCorresp('451','Бюджетные инвестиции иным юридическим лицам в объекты капитального строительства',530,'Увеличение стоимости акций и иных форм участия в капитале')
/
CALL AddClsCorresp('452','Бюджетные инвестиции иным юридическим лицам, за исключением бюджетных инвестиций в объекты капитального строительства',530,'Увеличение стоимости акций и иных форм участия в капитале')
/
CALL AddClsCorresp('461','Субсидии на приобретение объектов недвижимого имущества в государственную (муниципальную) собственность бюджетным учреждениям',530,'Увеличение стоимости акций и иных форм участия в капитале')
/
CALL AddClsCorresp('462','Субсидии на приобретение объектов недвижимого имущества в государственную (муниципальную) собственность автономным учреждениям ',530,'Увеличение стоимости акций и иных форм участия в капитале')
/
CALL AddClsCorresp('463','Субсидии на приобретение объектов недвижимого имущества в государственную (муниципальную) собственность государственным (муниципальным) унитарным предприятиям',530,'Увеличение стоимости акций и иных форм участия в капитале')
/
CALL AddClsCorresp('464','Субсидии на осуществление капитальных вложений в объекты капитального строительства государственной (муниципальной) собственности бюджетным учреждениям',530,'Увеличение стоимости акций и иных форм участия в капитале')
/
CALL AddClsCorresp('465','Субсидии на осуществление капитальных вложений в объекты капитального строительства государственной (муниципальной) собственности автономным учреждениям',530,'Увеличение стоимости акций и иных форм участия в капитале')
/
CALL AddClsCorresp('466','Субсидии на осуществление капитальных вложений в объекты капитального строительства государственной (муниципальной) собственности государственным (муниципальным) унитарным предприятиям',530,'Увеличение стоимости акций и иных форм участия в капитале')
/
CALL AddClsCorresp('511','Дотации на выравнивание бюджетной обеспеченности',251,'Перечисления другим бюджетам бюджетной системы Российской Федерации')
/
CALL AddClsCorresp('512','Иные дотации',251,'Перечисления другим бюджетам бюджетной системы Российской Федерации')
/
CALL AddClsCorresp('521','Субсидии, за исключением субсидий на софинансирование капитальных вложений в объекты государственной (муниципальной) собственности',251,'Перечисления другим бюджетам бюджетной системы Российской Федерации')
/
CALL AddClsCorresp('522','Субсидии на софинансирование капитальных вложений в объекты государственной (муниципальной) собственности',251,'Перечисления другим бюджетам бюджетной системы Российской Федерации')
/
CALL AddClsCorresp('530','Субвенции',251,'Перечисления другим бюджетам бюджетной системы Российской Федерации')
/
CALL AddClsCorresp('540','Иные межбюджетные трансферты',251,'Перечисления другим бюджетам бюджетной системы Российской Федерации')
/
CALL AddClsCorresp('550','Межбюджетные трансферты бюджету Фонда социального страхования Российской Федерации',251,'Перечисления другим бюджетам бюджетной системы Российской Федерации')
/
CALL AddClsCorresp('560','Межбюджетные трансферты бюджету Федерального фонда обязательного медицинского страхования',251,'Перечисления другим бюджетам бюджетной системы Российской Федерации')
/
CALL AddClsCorresp('570','Межбюджетные трансферты бюджету Пенсионного фонда Российской Федерации',251,'Перечисления другим бюджетам бюджетной системы Российской Федерации')
/
CALL AddClsCorresp('580','Межбюджетные трансферты бюджетам территориальных фондов обязательного медицинского страхования',251,'Перечисления другим бюджетам бюджетной системы Российской Федерации')
/
CALL AddClsCorresp('611','Субсидии бюджетным учреждениям на финансовое обеспечение государственного (муниципального) задания на оказание государственных (муниципальных) услуг (выполнение работ)',241,'Безвозмездные перечисления государственным и муниципальным организациям')
/
CALL AddClsCorresp('612','Субсидии бюджетным учреждениям на иные цели',241,'Безвозмездные перечисления государственным и муниципальным организациям')
/
CALL AddClsCorresp('613','Гранты в форме субсидии бюджетным учреждениям',241,'Безвозмездные перечисления государственным и муниципальным организациям')
/
CALL AddClsCorresp('621','Субсидии автономным учреждениям на финансовое обеспечение государственного (муниципального) задания на оказание государственных (муниципальных) услуг (выполнение работ)',241,'Безвозмездные перечисления государственным и муниципальным организациям')
/
CALL AddClsCorresp('622','Субсидии автономным учреждениям на иные цели',241,'Безвозмездные перечисления государственным и муниципальным организациям')
/
CALL AddClsCorresp('623','Гранты в форме субсидии автономным учреждениям',241,'Безвозмездные перечисления государственным и муниципальным организациям')
/
CALL AddClsCorresp('630','Субсидии некоммерческим организациям (за исключением государственных (муниципальных) учреждений)',242,'Безвозмездные перечисления организациям, за исключением государственных и муниципальных организаций')
/
CALL AddClsCorresp('710','Обслуживание государственного долга Российской Федерации',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('710','Обслуживание государственного долга Российской Федерации',231,'Обслуживание внутреннего долга')
/
CALL AddClsCorresp('710','Обслуживание государственного долга Российской Федерации',232,'Обслуживание внешнего долга')
/
CALL AddClsCorresp('720','Обслуживание государственного долга субъекта Российской Федерации',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('720','Обслуживание государственного долга субъекта Российской Федерации',231,'Обслуживание внутреннего долга')
/
CALL AddClsCorresp('720','Обслуживание государственного долга субъекта Российской Федерации',232,'Обслуживание внешнего долга')
/
CALL AddClsCorresp('730','Обслуживание муниципального долга',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('730','Обслуживание муниципального долга',231,'Обслуживание внутреннего долга')
/
CALL AddClsCorresp('810','Субсидии юридическим лицам (кроме некоммерческих организаций), индивидуальным предпринимателям, физическим лицам',241,'Безвозмездные перечисления государственным и муниципальным организациям')
/
CALL AddClsCorresp('810','Субсидии юридическим лицам (кроме некоммерческих организаций), индивидуальным предпринимателям, физическим лицам',242,'Безвозмездные перечисления организациям, за исключением государственных и муниципальных организаций')
/
CALL AddClsCorresp('810','Субсидии юридическим лицам (кроме некоммерческих организаций), индивидуальным предпринимателям, физическим лицам',530,'Увеличение стоимости акций и иных форм участия в капитале')
/
CALL AddClsCorresp('821','Субсидии государственным корпорациям (компаниям) в виде имущественного взноса',242,'Безвозмездные перечисления организациям, за исключением государственных и муниципальных организаций')
/
CALL AddClsCorresp('822','Субсидии государственным корпорациям (компаниям) на выполнение возложенных на них государственных полномочий',242,'Безвозмездные перечисления организациям, за исключением государственных и муниципальных организаций')
/
CALL AddClsCorresp('823','Иные субсидии государственным корпорациям (компаниям)',242,'Безвозмездные перечисления организациям, за исключением государственных и муниципальных организаций')
/
CALL AddClsCorresp('831','Исполнение судебных актов Российской Федерации и мировых соглашений по возмещению вреда, причиненного в результате незаконных действий (бездействия) органов государственной власти (государственных органов), органов местного самоуправления либо должностных лиц этих органов, а также в результате деятельности казенных учреждений',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('831','Исполнение судебных актов Российской Федерации и мировых соглашений по возмещению вреда, причиненного в результате незаконных действий (бездействия) органов государственной власти (государственных органов), органов местного самоуправления либо должностных лиц этих органов, а также в результате деятельности казенных учреждений',290,'Прочие расходы')
/
CALL AddClsCorresp('832','Исполнение судебных актов судебных органов иностранных государств, международных судов и арбитражей, определяемых международными договорами Российской Федерации, в результате незаконных действий (бездействия) органов государственной власти (государственных органов) либо должностных лиц этих органов, мировых соглашений, заключенных в рамках судебных процессов в судебных органах иностранных государств, в международных судах и арбитражах',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('832','Исполнение судебных актов судебных органов иностранных государств, международных судов и арбитражей, определяемых международными договорами Российской Федерации, в результате незаконных действий (бездействия) органов государственной власти (государственных органов) либо должностных лиц этих органов, мировых соглашений, заключенных в рамках судебных процессов в судебных органах иностранных государств, в международных судах и арбитражах',262,'Пособия по социальной помощи населению')
/
CALL AddClsCorresp('832','Исполнение судебных актов судебных органов иностранных государств, международных судов и арбитражей, определяемых международными договорами Российской Федерации, в результате незаконных действий (бездействия) органов государственной власти (государственных органов) либо должностных лиц этих органов, мировых соглашений, заключенных в рамках судебных процессов в судебных органах иностранных государств, в международных судах и арбитражах',290,'Прочие расходы')
/
CALL AddClsCorresp('841','Исполнение государственных гарантий Российской Федерации',290,'Прочие расходы')
/
CALL AddClsCorresp('842','Исполнение государственных гарантий субъекта Российской Федерации',290,'Прочие расходы')
/
CALL AddClsCorresp('843','Исполнение муниципальных гарантий',290,'Прочие расходы')
/
CALL AddClsCorresp('851','Уплата налога на имущество организаций и земельного налога',290,'Прочие расходы')
/
CALL AddClsCorresp('852','Уплата прочих налогов, сборов и иных платежей',290,'Прочие расходы')
/
CALL AddClsCorresp('861','Безвозмездные перечисления субъектам международного права',252,'Перечисления наднациональным организациям и правительствам иностранных государств')
/
CALL AddClsCorresp('861','Безвозмездные перечисления субъектам международного права',253,'Перечисления международным организациям')
/
CALL AddClsCorresp('862','Взносы в международные организации',253,'Перечисления международным организациям')
/
CALL AddClsCorresp('863','Платежи в целях обеспечения реализации соглашений с правительствами иностранных государств и международными организациями',220,'Оплата работ, услуг')
/
CALL AddClsCorresp('863','Платежи в целях обеспечения реализации соглашений с правительствами иностранных государств и международными организациями',252,'Перечисления наднациональным организациям и правительствам иностранных государств')
/
CALL AddClsCorresp('863','Платежи в целях обеспечения реализации соглашений с правительствами иностранных государств и международными организациями',253,'Перечисления международным организациям')
/
CALL AddClsCorresp('863','Платежи в целях обеспечения реализации соглашений с правительствами иностранных государств и международными организациями',290,'Прочие расходы')
/
CALL AddClsCorresp('870','Резервные средства',290,'Прочие расходы')
/
CALL AddClsCorresp('880','Специальные расходы',212,'Прочие выплаты')
/
CALL AddClsCorresp('880','Специальные расходы',221,'Услуги связи')
/
CALL AddClsCorresp('880','Специальные расходы',222,'Транспортные услуги')
/
CALL AddClsCorresp('880','Специальные расходы',224,'Арендная плата за пользование имуществом')
/
CALL AddClsCorresp('880','Специальные расходы',225,'Работы, услуги по содержанию имущества')
/
CALL AddClsCorresp('880','Специальные расходы',226,'Прочие работы, услуги')
/
CALL AddClsCorresp('880','Специальные расходы',290,'Прочие расходы')
/
CALL AddClsCorresp('880','Специальные расходы',310,'Увеличение стоимости основных средств')
/
CALL AddClsCorresp('880','Специальные расходы',340,'Увеличение стоимости материальных запасов')
/
drop procedure AddClsCorresp 
/
commit work 
/



-- #########################################################
-- #########################################################
-- Alter_Ed_OutPayDoc_IDX.sql
-- #########################################################
-- #########################################################


/* индекс для таблицы ED_OUTPAYDOC по полям PacketNumber, DocSource */
create index IDX_ED_OUTPAYDOC_PACK_DOCSRC on ED_OUTPAYDOC(PacketNumber,DocSource)
/

commit work
/



-- #########################################################
-- #########################################################
-- ADD_OKTMO.sql
-- #########################################################
-- #########################################################

/* Скрипт переименовывает поле ОКАТО таблицы ed_correctiondetail в ОКТМО*/
ALTER TABLE ed_correctiondetail ADD (
  OKTMO VARCHAR2(11)
)
/
COMMIT WORK
/
update ed_correctiondetail
set OKTMO = OKATO
/
COMMIT WORK
/
ALTER TABLE ed_correctiondetail DROP (OKATO)
/
COMMIT WORK
/


-- #########################################################
-- #########################################################
-- Add_UINCode_CorrectionDetail.sql
-- #########################################################
-- #########################################################

/* Скрипт добавляет поле для хранения уникального идентификатора начислений в таблицу CorrectionDetail */
ALTER TABLE TB_CorrectionDetail ADD (
  UINCode VARCHAR2(20)
)
/

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)
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
  FROM TB_CorrectionDetail
/

CREATE OR REPLACE TRIGGER TR_CORRECTIONDETAIL_ID
  INSTEAD OF DELETE
  ON CORRECTIONDETAIL
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- 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;
--
  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)
-- Create 13.08.2007
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- 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 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;
--
  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
  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;
/
commit work 
/

-- #########################################################
-- #########################################################
-- alter_AddClsFormat.sql
-- #########################################################
-- #########################################################

/* Добавление форматирования кодов КЦСР и КВР на триггеры */
-- ALTER TRIGGER tr_kcsr_bi_0
CREATE OR REPLACE TRIGGER TR_KCSR_BI
  BEFORE INSERT
  ON KCSR
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_KCSR_BI_0)
-- Version 9.00.00.2
-- - - - - - - - - - - - -

  if ((:new.Code is null) and (:new.id is null)) then
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if (:new.BudgetRef = 0) then
    /* Для всех бюджетов */
    /* Если код не указан, будем считать что он в ID, а иначе принудительно пишем в ID код */
    if (:new.Code is null) then
      :new.Code := :new.id;
          
    else
      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;  
    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;
  FormatClsStr(:new.Code, 7,:new.Code);
  :new.DirectionExpence := SUBSTR(:new.code ,4 ,7);

-- - - - - - - - - - - - -
-- BI_500 (TR_KCSR_BI_500)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER tr_kcsr_bu_0
CREATE OR REPLACE TRIGGER TR_KCSR_BU
  BEFORE UPDATE
  ON KCSR
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_KCSR_BU_0)
-- Version 9.00.00.2
-- - - - - - - - - - - - -

  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;
  FormatClsStr(:new.Code, 7,:new.Code);
  if (:new.DirectionExpence is null) then
    :new.DirectionExpence := SUBSTR(:new.code ,4 ,7);
  END IF;

END;
/
-- ALTER TRIGGER tr_kvr_bi_0
CREATE OR REPLACE TRIGGER TR_KVR_BI
  BEFORE INSERT
  ON KVR
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_KVR_BI_0)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  if ((:new.Code is null) and (:new.id is null)) then
    RaiseException('ex_WrongClsEmpty');
  END IF;
  if (:new.BudgetRef is null) then 
    :new.BudgetRef := 0;
  END IF;
  if (:new.BudgetRef = 0) then
    /* Для всех бюджетов */
    /* Если код не указан, будем считать что он в ID */
    if (:new.Code is null) then
      :new.Code := :new.id;
          
    else
      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;  
    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;
  FormatClsStr(:new.Code, 3,:new.Code);

-- - - - - - - - - - - - -
-- BI_500 (TR_KVR_BI_500)
-- Version 7.02.00.1
-- - - - - - - - - - - - -

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

END;
/
-- ALTER TRIGGER tr_kvr_bu_0
CREATE OR REPLACE TRIGGER TR_KVR_BU
  BEFORE UPDATE
  ON KVR
  FOR EACH ROW
DECLARE
  IsNumeric$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_KVR_BU_0)
-- Version 9.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;
  FormatClsStr(:new.Code, 3,:new.Code);

END;
/
commit work 
/

-- #########################################################
-- #########################################################
-- Alter_Cards_Triggers.sql
-- #########################################################
-- #########################################################

-- CREATE TRIGGER TR_CARDS_BU
CREATE OR REPLACE TRIGGER TR_CARDS_BU
  BEFORE UPDATE
  ON CARDS
  FOR EACH ROW
DECLARE
  REC_COUNT1$ NUMBER(10);
BEGIN
-- - - - - - - - - - - - -
-- BU_0 (TR_CARDS_BU)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

  IF (UPPER(:new.CARDNUMBER) <> UPPER(:old.CARDNUMBER)) THEN
    select 
    count(ffc.id) 
    INTO REC_COUNT1$       from 
    FacialFinCaption ffc 
    where (ffc.CardRef = :new.ID)
    ;
    IF (REC_COUNT1$  <> 0) THEN
      RaiseException('EX_CANNOT_UPD_USEDCARD');    
    END IF;
  END IF;

END;
/
-- CREATE TRIGGER TR_CARDS_BI
CREATE OR REPLACE TRIGGER TR_CARDS_BI
  BEFORE INSERT
  ON CARDS
  FOR EACH ROW
BEGIN
-- - - - - - - - - - - - -
-- BI_0 (TR_CARDS_BI)
-- Version 9.00.00.1
-- - - - - - - - - - - - -

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

-- - - - - - - - - - - - -
-- BI_500 (TR_CARDS_BI_500)
-- Last update 21.09.2005
-- - - - - - - - - - - - -

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

END;
/
commit work 
/

-- #########################################################
-- #########################################################
-- UpdDocFields_8.01.00_Ora.sql
-- #########################################################
-- #########################################################


-- Интервал обновлений: 90000 - 90000. Последнее изменение БД было 26.12.2013 16:57:07.
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(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 ImportDocType(210, 252, 'Внутренние РР', 0, 'BudNotify[RVERSION=RVERSION-1]', 0,-1,'Управление_ДляСценариев',10100,'ВнутренниеРР') ;

CALL UpdateInterfaces(210, 'Внутренние РР', '{2EF0F811-E21F-4ADB-BC7E-A3A9B16059A4}', '') ;

CALL ImportDocType(300, 0, 'Все казначейские документы', 0, '', 0,0,'',30000,'') ;

CALL ImportDocType(302, 63, 'Выбытия по п\п', 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(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(900, 0, 'Доходы', 0, '', 0,0,'',30000,'') ;

CALL ImportDocType(903, 45, 'Выписка по доходам', 0, ' ', 0,-1,'',10100,'Доходы_Выписка') ;

CALL ImportDocType(906, 41, 'Невыясненные поступления (устарел)', 0, ' ', 0,-1,'',10200,'Доходы_Невыясненные') ;

CALL ImportDocType(1701, 222, 'Заявки', 0, 'REQUESTS[RVERSION=RVERSION-1]', 0,-1,'',10100,'Заявки') ;

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(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(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(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(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(9828, 0, 'Мероприятия', 0, 'FACT', 0,0,'',20200,'Мероприятия') ;

CALL ImportDocType(9829, 0, 'Документ-основание', 0, 'DocBase', 0,0,'',20200,'ДокОснования') ;

CALL ImportDocType(9892, 0, 'Категории архивных документов (справочник)', 0, 'ARCHIVEDOCTYPE', 0,0,'',20100,'КатегорииАрхДокументовСправочник') ;

CALL ImportDocType(9894, 0, 'Направления расходов вышестоящих бюджетов ', 0, 'COMMDIRECTIONEEXPENCECLS', 0,0,'',20100,'ОбщиеНаправленияРасходов') ;

CALL ImportDocType(9895, 0, 'ОКТМО', 0, 'OKTMO', 0,0,'',20100,'ОКТМО') ;

CALL ImportDocType(9899, 0, 'Пользователи системы', 0, 'DBUsers', 0,0,'',20100,'Пользователи') ;

CALL ImportDocType(9916, 0, 'Константы системы', 0, '', 0,0,'',10300,'КонстантыСистемы') ;

CALL ImportDocType(9924, 0, 'Редактор справочника ролей', 0, '', 0,0,'',10200,'Подписи') ;

CALL UpdateInterfaces(9924, 'Редактор справочника ролей', '{4C71385E-A42A-43D1-AEBB-807B3C86E76B}', '') ;

CALL ImportDocType(9927, 0, 'Права удаленных клиентов', 0, 'RemoteClient', 0,0,'',10200,'ПраваУдаленныхКлиентов') ;

CALL UpdateInterfaces(9927, 'Права удаленных клиентов', '{60EFBA81-B436-11D6-8CA4-000021DDD8CD}', '') ;

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
) 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_      
    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)
    VALUES
      (ID_, KIND_, NAME_, NOTE_, READONLY_, USEINDOC_, TABLENAME_, ALIAS_, TABLECODE_, NEEDGROUPONDB_, NEEDDISTINCT_, MASTER_, DISCRIMVALUE_,
      AVAILABLEINDEREF_, CACHETYPE_, FULLORMODINSREFRTIME_, DELETEREFRTIME_, FINDTIMEREFRESH_, ANNOTATION_, DEREFNAME_);
  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
) 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_
    WHERE ID = ID_;
  ELSE
    INSERT INTO SELECTIONSDETAIL
      (ID, SELECTIONREF, TABLEREF, ALIAS, JOINORDER, JOINTYPE, RELATIONTYPE, JOINCONDITION, DONTUSETABLELIMITS, LIMITNAMESLIST)
    VALUES
      (ID_, SELECTIONREF_, TABLEREF_, ALIAS_, JOINORDER_, JOINTYPE_, RELATIONTYPE_, JOINCONDITION_, DONTUSETABLELIMITS_, LIMITNAMESLIST_);
  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
  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(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(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(34647) ;

CALL FIELDSINFO_DELETE(34679) ;

CALL FIELDSINFO_DELETE(34736) ;

CALL FIELDSINFO_DELETE(34757) ;

CALL FIELDSINFO_DELETE(34776) ;

CALL FIELDSINFO_DELETE(34797) ;

CALL FIELDSINFO_DELETE(34818) ;

CALL FIELDSINFO_DELETE(34838) ;

CALL FIELDSINFO_DELETE(34928) ;

CALL FIELDSINFO_DELETE(34932) ;

CALL FIELDSINFO_DELETE(34936) ;

CALL FIELDSINFO_DELETE(34940) ;

CALL FIELDSINFO_DELETE(35115) ;

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, '', '') ;

CALL SELECTIONS_IMPORT(16688, 1, 'REGIONCLS', 'Районы', 0, 0, 'REGIONCLS', 'regionCLS', 18, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16700, 1, 'SINGLE', 'Таблица с одной записью', 1, 0, 'SINGLE', 'Single', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16702, 1, 'DATABASEVERSION', 'Версии БД', 0, 0, 'DATABASEVERSION', 'DBVersion', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16708, 1, 'DBUSERS', 'Пользователи', 0, 0, 'DBUSERS', 'DbUsers', 100, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16722, 1, 'INTERFACES', 'Интерфейсы', 0, 0, 'INTERFACES', 'Interfaces', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16729, 1, 'PERMISSIONS', 'Старые права', 0, 0, 'PERMISSIONS', 'PERMISSIONS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16734, 1, 'WORKPLACES', 'Рабочие места', 0, 0, 'WORKPLACES', 'Workplaces', 0, 0, 0, 1, '', 1, 1, 3600, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16738, 1, 'WORKPLACES_INTERFACE', 'Интерфейсы на рабочих местах', 0, 0, 'WORKPLACES_INTERFACE', 'WORKPLACES_INTERFACE', 0, 0, 0, 1, '', 1, 1, 3600, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16744, 1, 'USER_WORKPLACES', 'Рабочие места пользователей', 0, 0, 'USER_WORKPLACES', 'USER_WORKPLACES', 0, 0, 0, 1, '', 1, 1, 3600, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16749, 1, 'WORKPLACES_NEWREPORTS', 'Отчеты на рабочих местах', 0, 0, 'WORKPLACES_NEWREPORTS', 'WorkPlaces_NewReports', 0, 0, 0, 1, '', 1, 1, 3600, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16755, 1, 'INTCONST', 'Целые константы', 0, 0, 'INTCONST', 'IntConst', 0, 0, 0, 2, '', 1, 1, -1, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(16762, 1, 'VARCHARCONST', 'Строковые константы', 0, 0, 'VARCHARCONST', 'VarCharConst', 0, 0, 0, 2, '', 1, 1, -1, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(16767, 1, 'REALCONST', 'Вещественные константы', 0, 0, 'REALCONST', 'RealConst', 0, 0, 0, 1, '', 1, 1, -1, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(16777, 1, 'REGUSERS', 'Журнал работы пользователей', 0, 0, 'REGUSERS', 'REGUSERS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23400, 1, 'WRITEXECUTIONCAPTION', 'Заголовки документов исполнения', 0, 0, 'WRITEXECUTIONCAPTION', 'WRITEXECUTIONCAPTION', 1410, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23401, 1, 'WRITEXECUTIONDETAIL', 'Детализации документов исполнения', 0, 0, 'WRITEXECUTIONDETAIL', 'WRITEXECUTIONDETAIL', 5102, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16803, 1, 'BUDGETS_S', 'Бюджеты', 0, 0, 'BUDGETS_S', 'Budgets_s', 178, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16814, 1, 'DOCTYPES', 'Тип документа', 0, 0, 'DOCTYPES', 'DocTypes', 1, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16824, 1, 'KD', 'Код дохода', 0, 0, 'KD', 'KD', 80, 0, 0, 2, '', 1, 1, 600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16844, 1, 'KFSR', 'ФКР', 0, 0, 'KFSR', 'kfsr', 2, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16851, 1, 'KVSR', 'КВСР', 0, 0, 'KVSR', 'KVSR', 3, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16857, 1, 'KCSR', 'КЦСР', 0, 0, 'KCSR', 'KCSR', 4, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16864, 1, 'KVR', 'КВР', 0, 0, 'KVR', 'KVR', 5, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16871, 1, 'KESR', 'КОСГУ', 0, 0, 'KESR', 'KESR', 6, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16883, 1, 'KSHK', 'Сети и штаты', 0, 0, 'KSHK', 'KSHK', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16886, 1, 'SUBKCSR', 'Суб КЦСР', 0, 0, 'SUBKCSR', 'SUBKCSR', 0, 0, 0, 1, '', 1, 1, 1800, -1, 5, '', '') ;

CALL SELECTIONS_IMPORT(16901, 1, 'REFCLS', 'Справочно', 0, 0, 'REFCLS', 'REFCLS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16904, 1, 'MEANSCLS', 'Основные средства', 0, 0, 'MEANSCLS', 'MeansCLS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16907, 1, 'VALUECLS', 'Материальные ценности', 0, 0, 'VALUECLS', 'VALUECLS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16910, 1, 'BUDGETACCOUNTS', 'Бюджетный счет', 0, 0, 'BUDGETACCOUNTS', 'BudAccounts', 158, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16915, 1, 'KESRSUBCODE', 'Суб КОСГУ', 0, 0, 'KESRSUBCODE', 'KESRSubCode', 7, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16920, 1, 'ACCOUNTPLAN', 'Устарело. Старый план счетов', 0, 0, 'ACCOUNTPLAN', 'ACCOUNTPLAN', 71, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16928, 1, 'SUBKD', 'Суб КД', 0, 0, 'SUBKD', 'SubKD', 159, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16937, 1, 'CURRENCYCLS', 'Код валюты', 0, 0, 'CURRENCYCLS', 'CurrencyCLS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16945, 1, 'REPORTTYPE', 'Устарело. Тип отчета', 0, 0, 'REPORTTYPE', 'ReportType', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16948, 1, 'GOSNI', 'ГОСНИ', 0, 0, 'GOSNI', 'GOSNI', 157, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16955, 1, 'FINTYPE', 'Тип финансирования', 0, 0, 'FINTYPE', 'FinType', 8, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16964, 1, 'FACT', 'Мероприятие', 0, 0, 'FACT', 'FACT', 9, 0, 0, 2, '', 1, 1, 600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16973, 1, 'DOCBASE', 'Документ-основание', 0, 0, 'DOCBASE', 'DocBase', 29, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(16983, 1, 'NOTIFYTYPES', 'Источники финансирования', 0, 0, 'NOTIFYTYPES', 'NOTIFYTYPES', 10, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16988, 1, 'ORG_CLS', 'Тип организации', 0, 0, 'ORG_CLS', 'ORG_CLS', 31, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(16996, 1, 'ACC_CLS', 'Код расчетного счета', 0, 0, 'ACC_CLS', 'Acc_CLS', 1403, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17005, 1, 'GROUPINF_CLS', 'Группа информации', 0, 0, 'GROUPINF_CLS', 'GroupInf_CLS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17010, 1, 'BUDGETTYPE', 'Вид бюджета', 0, 0, 'BUDGETTYPE', 'BUDGETTYPE', 0, 0, 0, 1, '', 1, 1, 3600, -1, 5, '', '') ;

CALL SELECTIONS_IMPORT(17016, 1, 'PAYTYPECLS', 'Виды платежей', 0, 0, 'PAYTYPECLS', 'PayTypeCls', 12, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17021, 1, 'ORG_ACCDEFAULTS', 'Умолчания расчетных счетов', 0, 0, 'ORG_ACCDEFAULTS', 'Org_AccDefaults', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17026, 1, 'REJECTCLS', 'Причина отклонения', 0, 0, 'REJECTCLS', 'RejectCLS', 17, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17034, 1, 'ERROR', 'Коды ошибок', 0, 0, 'ERROR', 'Error', 143, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17043, 1, 'INNERFINSOURCE', 'ИВВФ', 0, 0, 'INNERFINSOURCE', 'InnerFinSource', 145, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(17062, 1, 'PAYSYMBOLCLS', 'Кассовые символы', 0, 0, 'PAYSYMBOLCLS', 'PAYSYMBOLCLS', 14, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(17069, 1, 'BUHPAYMENTCLS', 'Старая бух проводка', 0, 0, 'BUHPAYMENTCLS', 'BuhPaymentCls', 16, 0, 0, 2, '', 2, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17076, 1, 'ACCOUNTSCORR', 'Корреспонденция бухгалтерских счетов ', 0, 0, 'ACCOUNTSCORR', 'AccountsCorr', 72, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17084, 1, 'PAYDESTINATIONCLS', 'Назначения платежа', 0, 0, 'PAYDESTINATIONCLS', 'PayDestinationCLS', 0, 0, 0, 2, '', 1, 1, 3600, -1, 5, '', '') ;

CALL SELECTIONS_IMPORT(17094, 1, 'TYPEOPERATIONCLS', 'Вид операции', 0, 0, 'TYPEOPERATIONCLS', 'TYPEOPERATIONCLS', 15, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17099, 1, 'BANKS', 'Банки', 0, 0, 'BANKS', 'Banks', 20, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(17108, 1, 'ORG_ACCOUNTS', 'Расчетные счета', 0, 0, 'ORG_ACCOUNTS', 'Org_Accounts', 21, 0, 0, 2, '', 1, 1, 100, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(17129, 1, 'FACIALACC_CLS', 'Лицевой счет', 0, 0, 'FACIALACC_CLS', 'FacialAcc_Cls', 19, 0, 0, 2, '', 1, 1, 600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(17164, 1, 'PAYDOC32', 'Старые платежные поручения', 0, 0, 'PAYDOC32', 'PayDoc32', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17204, 1, 'PAYDOCTEMPLATES', 'Устарело. Шаблоны п/п ', 0, 0, 'PAYDOCTEMPLATES', 'PAYDOCTEMPLATES', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17218, 1, 'EXCHANGENUMBER', 'Обменные номера ', 0, 0, 'EXCHANGENUMBER', 'EXCHANGENUMBER', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17225, 1, 'PAYDOCEXCHANGE', 'Обмен с банком платежками ', 0, 0, 'PAYDOCEXCHANGE', 'PayDocExchange', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17243, 1, 'MUTNOTIFCAPT', 'Устарело. Уведомления по взаимным расчетам', 0, 0, 'MUTNOTIFCAPT', 'MUTNOTIFCAPT', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

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, '', '') ;

CALL SELECTIONS_IMPORT(17265, 1, 'DFACCOUNTSBUHTABLE', 'Счета ФО', 0, 0, 'DFACCOUNTSBUHTABLE', 'DFAccBuhTable', 73, 0, 0, 2, '', 1, 1, 600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(17286, 1, 'DFACCOUNTOPERATION', 'Операции между расчетными счетами ФО', 0, 0, 'DFACCOUNTOPERATION', 'DFAccountOperation', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17301, 1, 'ACCSOPERTITLE', 'Формирование п\п связанных со счетамти ФО. Заголовок ', 0, 0, 'ACCSOPERTITLE', 'AccsOperTitle', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17311, 1, 'MEANSTYPE', 'Тип средств бюджета', 0, 0, 'MEANSTYPE', 'MEANSTYPE', 13, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(17321, 1, 'BUH_JOURNAL', 'Устарело. Журнал бухгалтерии ', 0, 0, 'BUH_JOURNAL', 'Buh_Journal', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17402, 1, 'MEM_WARRANT', 'Устарело. Мемориальные ордера', 0, 0, 'MEM_WARRANT', 'Mem_warrant', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17408, 1, 'BUDGETDATA', 'Плановые документы детализация ', 0, 0, 'BUDGETDATA', 'BudgetData', 26, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17463, 1, 'BUDNOTIFY', 'Плановые документы заголовки', 0, 0, 'BUDNOTIFY', 'BudNotify', 28, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17511, 1, 'INCOMESDATA', 'Устарело. Доходы план', 0, 0, 'INCOMESDATA', 'IncomesData', 164, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17583, 1, 'PROMISE_CAPTION', 'Заголовки бюджетных обязательств ', 0, 0, 'PROMISE_CAPTION', 'Promise_Caption', 77, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17616, 1, 'INCOMESNOTIF', 'Устарело. Уведомления об изменении плана доходов ', 0, 0, 'INCOMESNOTIF', 'IncomesNotif', 163, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17643, 1, 'QUOTESTITLE', 'Заголовки выписок по доходам', 0, 0, 'QUOTESTITLE', 'QuotesTitle', 160, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17668, 1, 'INCOMES32', 'Доходы (факт) ', 0, 0, 'INCOMES32', 'Incomes32', 161, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17744, 1, 'SUMINPASSAGE', 'Суммы в пути ', 0, 0, 'SUMINPASSAGE', 'SumInPassage', 162, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17772, 1, 'SCHEMEBUHCACH', 'Устарело. Кэш бухгалтерии (схема) ', 0, 0, 'SCHEMEBUHCACH', 'SCHEMEBUHCACH', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17784, 1, 'INCTEMPLATETITLE', 'Устарело. Шаблоны доходов (заголовки) ', 0, 0, 'INCTEMPLATETITLE', 'incTemplateTitle', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17796, 1, 'INCTEMPLATEDETAIL', 'Устарело. Шаблоны доходов (детализация) ', 0, 0, 'INCTEMPLATEDETAIL', 'incTemplateDetail', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17810, 1, 'EXEMPTIONTITLE', 'Основная таблица данных', 0, 0, 'EXEMPTIONTITLE', 'EXEMPTIONTITLE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17821, 1, 'FINDOCDETAIL', 'Финансирование детализация', 0, 0, 'FINDOCDETAIL', 'FinDocDetail', 24, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17876, 1, 'FINDOCCAPTION', 'Финансирование заголовок', 0, 0, 'FINDOCCAPTION', 'FinDocCaption', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17896, 1, 'MUTNOTIFDETAIL', 'Устарело. Уведомления по взаимным расчетам (детализация)', 0, 0, 'MUTNOTIFDETAIL', 'MUTNOTIFDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17942, 1, 'VZ_OFFSET', 'Устарело. Взаимозачёты', 0, 0, 'VZ_OFFSET', 'Vz_Offset', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17956, 1, 'INCOMES_ARREARS', 'Устарело. Таблица задолженностей', 0, 0, 'INCOMES_ARREARS', 'Incomes_arrears', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(17959, 1, 'LOANCREDIT', 'Устарело. Ссуды/кредиты заголовок', 0, 0, 'LOANCREDIT', 'LoanCredit', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18005, 1, 'ADMISSION', 'Устарело. Средства полученные', 0, 0, 'ADMISSION', 'Admission', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18037, 1, 'OTHBUDNOTIFCAPTION', 'Устарело. Уведомления по взаимным расчетам заголовок', 0, 0, 'OTHBUDNOTIFCAPTION', 'OthBudNotifCaption', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18055, 1, 'ORMONTHTITLE', 'Устарело. Месячные отчеты организаций заголовок', 0, 0, 'ORMONTHTITLE', 'OrMonthTitle', 67, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18074, 1, 'OTHBUDNOTIFDETAIL', 'Устарело. уведомлений по взаимным расчетам Детализация ', 0, 0, 'OTHBUDNOTIFDETAIL', 'OthBudNotifDetail', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18097, 1, 'ORMONTHDETAIL', 'Устарело. Месячные отчеты организаций детализация ', 0, 0, 'ORMONTHDETAIL', 'OrMonthDetail', 68, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18122, 1, 'LOANCREDITPERCENTS', 'Устарело. Ссуды/кредиты - начисленные проценты ', 0, 0, 'LOANCREDITPERCENTS', 'LoanCreditPercents', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18153, 1, 'ORQUARTERTITLE', 'Устарело. Квартальные/годовые отчеты заголовок', 0, 0, 'ORQUARTERTITLE', 'orQuarterTitle', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18170, 1, 'ORMONTHREFERENCE', 'Устарело. Месячные отчеты организаций справочные данные', 0, 0, 'ORMONTHREFERENCE', 'orMonthReference', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18189, 1, 'ORMONTHTEMPLATESTITLE', 'Устарело. Шаблоны на месячные отчеты организаций (заголовок)', 0, 0, 'ORMONTHTEMPLATESTITLE', 'ORMONTHTEMPLATESTITLE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18197, 1, 'ORMONTHTEMPLATESDETAIL', 'Устарело. Шаблоны на месячные отчеты организаций (детализация) ', 0, 0, 'ORMONTHTEMPLATESDETAIL', 'ORMONTHTEMPLATESDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18212, 1, 'ORMONTHTEMPLATESREFERENCE', 'Устарело. Ссылки на шаблоны на месячные отчеты ', 0, 0, 'ORMONTHTEMPLATESREFERENCE', 'ORMONTHTEMPLATESREFERENCE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18226, 1, 'ORQUARTERDETAIL', 'Устарело. Квартальные отчетыорганизаций детализация', 0, 0, 'ORQUARTERDETAIL', 'orQuarterDetail', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18235, 1, 'ORQUARTERTEMPLATESTITLE', 'Устарело. Шаблоны на квартальные отчеты ', 0, 0, 'ORQUARTERTEMPLATESTITLE', 'ORQUARTERTEMPLATESTITLE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18246, 1, 'ORQUARTERTEMPLATESDETAIL', 'Устарело. Шаблоны на квартальные отчеты (детализация) ', 0, 0, 'ORQUARTERTEMPLATESDETAIL', 'ORQUARTERTEMPLATESDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18250, 1, 'ORMEANSTITLE', 'Устарело. Отчеты организаций о движении основных средств - заголовки ', 0, 0, 'ORMEANSTITLE', 'orMeansTitle', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18262, 1, 'ORMEANSDETAIL', 'Устарело. Отчеты организаций по основным средствам детализация', 0, 0, 'ORMEANSDETAIL', 'ORMEANSDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18271, 1, 'ORMEANSTEMPLATESTITLE', 'Устарело. Шаблоны отчетов организация (заголовок)', 0, 0, 'ORMEANSTEMPLATESTITLE', 'ORMEANSTEMPLATESTITLE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18277, 1, 'ORMEANSTEMPLATESDETAIL', 'Устарело. Шаблоны отчетов организация (детализация) ', 0, 0, 'ORMEANSTEMPLATESDETAIL', 'ORMEANSTEMPLATESDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18281, 1, 'ORSTAFFTITLE', 'Устарело. Отчет по СШК заголовки ', 0, 0, 'ORSTAFFTITLE', 'orStaffTitle', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18299, 1, 'ORSTAFFDETAIL', 'Устарело. Квартальный отчет по СШК детализация', 0, 0, 'ORSTAFFDETAIL', 'ORSTAFFDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18308, 1, 'ORSTAFFTEMPLATESTITLE', 'Устарело. Шаблоны на квартальные отчеты по СШК ', 0, 0, 'ORSTAFFTEMPLATESTITLE', 'ORSTAFFTEMPLATESTITLE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18319, 1, 'ORVALUETITLE', 'Устарело. Отчет о движении материальных ценностей - заголовки ', 0, 0, 'ORVALUETITLE', 'orValueTitle', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18331, 1, 'ORSTAFFTEMPLATESDETAIL', 'Устарело. Шаблоны на квартальные отчеты по СШК (детализация) ', 0, 0, 'ORSTAFFTEMPLATESDETAIL', 'ORSTAFFTEMPLATESDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18335, 1, 'ORVALUEDETAIL', 'Устарело. Детализация отчета по материальным ценностям ', 0, 0, 'ORVALUEDETAIL', 'ORVALUEDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18344, 1, 'ORVALUETEMPLATESTITLE', 'Устарело. Шаблоны на отчеты ', 0, 0, 'ORVALUETEMPLATESTITLE', 'ORVALUETEMPLATESTITLE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18350, 1, 'ORVALUETEMPLATESDETAIL', 'Устарело. Шаблоны на отчеты (детализация) ', 0, 0, 'ORVALUETEMPLATESDETAIL', 'ORVALUETEMPLATESDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18354, 1, 'CURRENCYEXCHANGE', 'Курсы валют', 0, 0, 'CURRENCYEXCHANGE', 'CurrencyExchange', 0, 0, 0, 1, '', 1, 1, 600, -1, 5, '', '') ;

CALL SELECTIONS_IMPORT(18365, 1, 'ACCCUROPERATION', 'Операции с валютными счетами', 0, 0, 'ACCCUROPERATION', 'AccCurOperation', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18371, 1, 'CURRENCYINCOMES', 'Надстройка к доходам', 0, 0, 'CURRENCYINCOMES', 'CurrencyIncomes', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18377, 1, 'ORGOPERAT', 'Оперативные данные', 0, 0, 'ORGOPERAT', 'ORGOPERAT', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18414, 1, 'BILLS', 'Устарело. Приходы по векселям. Заголовки', 0, 0, 'BILLS', 'Bills', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18427, 1, 'BILLS_DET', 'Устарело. Данных по векселям. Детализация', 0, 0, 'BILLS_DET', 'Bills_Det', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18446, 1, 'BILL_ACCORDDOC', 'Устарело. Соглашения на финансирование векселями. Заголовки. ', 0, 0, 'BILL_ACCORDDOC', 'Bill_AccordDoc', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18459, 1, 'VZFINCAPTION', 'Устарело. Взаимозачёты заголовок', 0, 0, 'VZFINCAPTION', 'VZFINCAPTION', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18469, 1, 'ORGSHARECAPTION', 'Устарело. Состояние расчетных счетов распорядителей кредитов ', 0, 0, 'ORGSHARECAPTION', 'OrgShareCaption', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18477, 1, 'ORGSHAREDETAIL', 'Устарело. Состояние расчетных счетов распорядителей кредитов (детализация) ', 0, 0, 'ORGSHAREDETAIL', 'OrgShareDetail', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(27814, 1, 'BUDALLOCATIONCLS', 'Коды бюджетных ассигнований', 0, 0, 'BUDALLOCATIONCLS', 'BUDALLOCATIONCLS', 221, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(27815, 1, 'PAYPROMISECLS', 'Коды расходных обязательств', 0, 0, 'PAYPROMISECLS', 'PAYPROMISECLS', 222, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(27816, 1, 'UCONSCHAINSCAPTION', '', 0, 0, 'UCONSCHAINSCAPTION', 'UCONSCHAINSCAPTION', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18577, 1, 'MONTHREPORTCAPTION', 'Устарело. Таблица-заголовок месячных отчетов', 0, 0, 'MONTHREPORTCAPTION', 'MONTHREPORTCAPTION', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18591, 1, 'MONTHREPORTDETAIL', 'Устарело. Таблица детализации месячных отчетов', 0, 0, 'MONTHREPORTDETAIL', 'MONTHREPORTDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18607, 1, 'DELOIN', 'Регистрация входящих документов ', 0, 0, 'DELOIN', 'DeloIn', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18627, 1, 'LIMITFINDETAIL', 'Устарело. Детализация лимитов(заявок и уточнений)', 0, 0, 'LIMITFINDETAIL', 'LimitFinDetail', 25, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18673, 1, 'DELOOUT', 'Регистрация исходящих документов ', 0, 0, 'DELOOUT', 'DeloOut', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18686, 1, 'DELOEXEC', 'Исполнение документов ', 0, 0, 'DELOEXEC', 'DeloExec', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18697, 1, 'DELOEXECUTOR', 'Исполнитель', 0, 0, 'DELOEXECUTOR', 'DELOEXECUTOR', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18702, 1, 'DELOOTDEL', 'Отдел', 0, 0, 'DELOOTDEL', 'DELOOTDEL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18707, 1, 'DELOGRIF', 'Гриф', 0, 0, 'DELOGRIF', 'DELOGRIF', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18710, 1, 'DELORESOLUTION', 'Резолюция', 0, 0, 'DELORESOLUTION', 'DELORESOLUTION', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18713, 1, 'DELOCORRESPONDENT', 'Корреспондент', 0, 0, 'DELOCORRESPONDENT', 'DELOCORRESPONDENT', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18716, 1, 'REQUESTFINCAPTION', 'Заявки на финансирование заголовок', 0, 0, 'REQUESTFINCAPTION', 'RequestFinCaption', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18732, 1, 'LIMITNOTIFYCAPTION', 'Устарело. Заголовки уточнений лимитов на финансирование', 0, 0, 'LIMITNOTIFYCAPTION', 'LimitNotifyCaption', 75, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18765, 1, 'LIMITFINCAPTION', 'Устарело. Даты принятия лимитов на финансирование', 0, 0, 'LIMITFINCAPTION', 'LimitFinCaption', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18793, 1, 'FINCLAIM', 'Устарело. Налоги бюджета заголовок', 0, 0, 'FINCLAIM', 'FinClaim', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18803, 1, 'FINCLAIMDET', 'Устарело. Налоги бюджета детализация', 0, 0, 'FINCLAIMDET', 'FinClaimDet', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18816, 1, 'FINTENDER', 'Заявки на финансирование заголовок', 0, 0, 'FINTENDER', 'FinTender', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18826, 1, 'FINTENDERDET', 'Заявки на финансирование детализация', 0, 0, 'FINTENDERDET', 'FinTenderDet', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18860, 1, 'FINTENDERORG', 'Цепочка организаций, через которые проходит зачет', 0, 0, 'FINTENDERORG', 'FinTenderOrg', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18864, 1, 'FACIALFINDETAIL', 'Казначейство детализация', 0, 0, 'FACIALFINDETAIL', 'FacialFinDet', 22, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(18937, 1, 'CARDS', 'Корпоративные карты заголовок', 0, 0, 'CARDS', 'Cards', 30, 0, 0, 2, '', 1, 1, 100, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(18947, 1, 'FACIALFINCAPTION', 'Казначейство заголовок', 0, 0, 'FACIALFINCAPTION', 'FacialFinCpt', 23, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19016, 1, 'PROMISE_DETAIL', 'Расшифровка договоров', 0, 0, 'PROMISE_DETAIL', 'Promise_Det', 76, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19088, 1, 'FACIALFINREESTR', 'Реестры казначейства', 0, 0, 'FACIALFINREESTR', 'FacialFinReestr', 191, 0, 0, 2, '', 1, 1, 3, 30, null, '', '') ;

CALL SELECTIONS_IMPORT(19110, 1, 'PERCENTJOURNAL', 'Журнал процентных ставок ', 0, 0, 'PERCENTJOURNAL', 'PercentJournal', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19123, 1, 'REQUESTS', 'Заявки', 0, 0, 'REQUESTS', 'Requests', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19182, 1, 'DEBT', 'Устарело. Источники заимствований', 0, 0, 'DEBT', 'Debt', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19221, 1, 'LOANCREDITPLAN', 'Устарело. Плапн погашения кредита', 0, 0, 'LOANCREDITPLAN', 'LOANCREDITPLAN', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19234, 1, 'REQUESTSPAYMENTS', 'Оплаты заявок', 0, 0, 'REQUESTSPAYMENTS', 'RequestsPayments', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19242, 1, 'DELRECINDEXES', 'Журнал удаления данных', 0, 0, 'DELRECINDEXES', 'DELRECINDEXES', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(27817, 1, 'UCONSCHAINSDETAIL', '', 0, 0, 'UCONSCHAINSDETAIL', 'UCONSCHAINSDETAIL', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

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, '', '') ;

CALL SELECTIONS_IMPORT(19387, 1, 'BANKEXCH_REOUT', 'Обмен с банком Таблица буфферизации данных из V пакета', 0, 0, 'BANKEXCH_REOUT', 'BANKEXCH_REOUT', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

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, '', '') ;

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, '', '') ;

CALL SELECTIONS_IMPORT(19497, 1, 'BANKEXCH_MERKWI', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_MERKWI', 'BANKEXCH_MERKWI', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19516, 1, 'BANKEXCH_POST', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_POST', 'BANKEXCH_POST', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19535, 1, 'BANKEXCH_QUERY', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_QUERY', 'BANKEXCH_QUERY', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19556, 1, 'BANKEXCH_CONFIRM', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_CONFIRM', 'BANKEXCH_CONFIRM', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19582, 1, 'BANKEXCH_QUEUE', 'Таблица буфферизации данных ', 0, 0, 'BANKEXCH_QUEUE', 'BANKEXCH_QUEUE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19609, 1, 'UFK_VP', 'Информация о зачислении, списании и передвижке средств в ОФК ', 0, 0, 'UFK_VP', 'UFK_VP', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19639, 1, 'UFK_RM', 'Оборотно-сальдовая ведомость по лицевым счетам', 0, 0, 'UFK_RM', 'UFK_RM', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19661, 1, 'UFK_SVOD', 'Информация по доходам бюджета ', 0, 0, 'UFK_SVOD', 'UFK_SVOD', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19684, 1, 'BNKINPUTDOC_JOURNAL', 'Журнал принятых из банка пакетов', 0, 0, 'BNKINPUTDOC_JOURNAL', 'BnkInputDoc_Journal', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19688, 1, 'BNKOUTPUTDOC_JOURNAL', 'Журнал принятых из банка пакетов', 0, 0, 'BNKOUTPUTDOC_JOURNAL', 'BnkOutputDoc_Journal', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19695, 1, 'BNK_DSIGNDOCUMENTS', 'Подписанные документы, принятые из банка', 0, 0, 'BNK_DSIGNDOCUMENTS', 'Bnk_DSignDocuments', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19705, 1, 'REESTRTYPE', 'Тип реестра', 0, 0, 'REESTRTYPE', 'REESTRTYPE', 190, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(19714, 1, 'OKDP', 'ОКДП', 0, 0, 'OKDP', 'OKDP', 82, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(19729, 1, 'REMOTEDOCUMENT', 'Настройки схем обработки документов ', 0, 0, 'REMOTEDOCUMENT', 'RemoteDocument', 50, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19736, 1, 'EXECUTIONDOCUMENTSCAPTION', 'Документы исполнения - заголовок', 0, 0, 'EXECUTIONDOCUMENTSCAPTION', 'ExecutionDocumentsCaption', 114, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19786, 1, 'DEPARTMENTCLS', 'Отдел', 0, 0, 'DEPARTMENTCLS', 'DepartmentCLS', 1412, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(19795, 1, 'AGREEMENTS', 'Договор-заголовок ', 0, 0, 'AGREEMENTS', 'Agreements', 110, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(27818, 1, 'UCONSGROUPSCAPTION', '', 0, 0, 'UCONSGROUPSCAPTION', 'UCONSGROUPSCAPTION', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19876, 1, 'UFK_LOGCAPTION', 'Таблица импорта. Заголовок', 0, 0, 'UFK_LOGCAPTION', 'UFK_LogCaption', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19891, 1, 'UFK_LOGDETAIL', 'Таблица импорта. Детализация', 0, 0, 'UFK_LOGDETAIL', 'UFK_LogDetail', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19909, 1, 'INCCURRENCY', 'Устарело. Изменения курсовой разницы', 0, 0, 'INCCURRENCY', 'IncCurrency', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19980, 1, 'KDSHIFR', 'Поступление доходов в областной бюджет', 0, 0, 'KDSHIFR', 'KDSHIFR', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19988, 1, 'OLDINCOMES', 'Устарело. Таблица для хранения информации по дохдам за прошлый год', 0, 0, 'OLDINCOMES', 'OLDINCOMES', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(19994, 1, 'KDSHIFRDETAIL', 'Связь шифра с кодами дохода', 0, 0, 'KDSHIFRDETAIL', 'KDSHIFRDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(27819, 1, 'UCONSGROUPSDETAIL', '', 0, 0, 'UCONSGROUPSDETAIL', 'UCONSGROUPSDETAIL', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20054, 1, 'REMOTECLIENT', 'Cписок удаленных клиентов ', 0, 0, 'REMOTECLIENT', 'RemoteClient', 58, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20071, 1, 'CBPERCENTJOURNAL', 'Журнал процентов Центробанка ', 0, 0, 'CBPERCENTJOURNAL', 'CBPERCENTJOURNAL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20107, 1, 'AGREEMENTSTEPS', 'Этапы договора', 0, 0, 'AGREEMENTSTEPS', 'AgreementSteps', 111, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20127, 1, 'ESTIMATE', 'Смета', 0, 0, 'ESTIMATE', 'ESTIMATE', 112, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20153, 1, 'EXECUTIONDOCUMENTSDETAIL', 'Документы исполнения - деталь', 0, 0, 'EXECUTIONDOCUMENTSDETAIL', 'ExecutionDocumentsDetail', 115, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20173, 1, 'LOANTYPE', 'Устарело. Вид ссуды', 0, 0, 'LOANTYPE', 'LOANTYPE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20182, 1, 'DEBTTYPE', 'Устарело. Вид заимствования', 0, 0, 'DEBTTYPE', 'DEBTTYPE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20191, 1, 'REMOTEINPUTRIGHT', '', 0, 0, 'REMOTEINPUTRIGHT', 'RemoteInputRight', 60, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20201, 1, 'REMOTEREADRIGHT', 'Добавление нового типа задачи', 0, 0, 'REMOTEREADRIGHT', 'RemoteReadRight', 59, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20211, 1, 'REMOTECLIENTACCOUNT', 'Счета удаленных клиентов', 0, 0, 'REMOTECLIENTACCOUNT', 'RemoteClientAccount', 62, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20221, 1, 'PAYMENTSCHEDULE', 'График выплат по договору ', 0, 0, 'PAYMENTSCHEDULE', 'PaymentSchedule', 113, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20344, 1, 'OBJECTCAPTION', 'Объекты заголовок', 0, 0, 'OBJECTCAPTION', 'objectcaption', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20350, 1, 'OBJECTDETAIL', 'Объекты детализация', 0, 0, 'OBJECTDETAIL', 'objectdetail', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20387, 1, 'UFK_SVERKA', 'Ввод остатков по расчетным счетам ', 0, 0, 'UFK_SVERKA', 'UFK_SVERKA', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20400, 1, 'BUDSTRUCT', 'Таблица для справочника Структура расходной части бюджета', 0, 0, 'BUDSTRUCT', 'BUDSTRUCT', 141, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20418, 1, 'OKATO', 'ОКАТО', 0, 0, 'OKATO', 'OKATO', 116, 0, 0, 2, '', 2, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(20428, 1, 'TREASUARYDOCSTATE', 'Устарело. Добавление нового линейного классификатора - состояние казначейского документа', 0, 0, 'TREASUARYDOCSTATE', 'TREASUARYDOCSTATE', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20433, 1, 'COLLATERALTYPE', 'Тип обеспечения', 0, 0, 'COLLATERALTYPE', 'COLLATERALTYPE', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20441, 1, 'CLIENTDFACCOUNTLIST', 'Таблица соответствия счетов ФО форматам электронного обмена', 0, 0, 'CLIENTDFACCOUNTLIST', 'ClientDFAccountList', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20449, 1, 'PAPEROPERATION', 'Устарело. Ценные бумаги (содержится информация о покупке и продаже векселей)', 0, 0, 'PAPEROPERATION', 'PaperOperation', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20480, 1, 'COLLATERAL', 'Обеспечение (залог, поручиетельство и т.п.) кредитного договора', 0, 0, 'COLLATERAL', 'COLLATERAL', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20497, 1, 'MANAGERBID', 'Устарело. Распорядительные заявки ', 0, 0, 'MANAGERBID', 'ManagerBid', 78, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20510, 1, 'REPORTSPERMISSIONS', 'Устарело. Настройки параметров для отчетов', 0, 0, 'REPORTSPERMISSIONS', 'REPORTSPERMISSIONS', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20539, 1, 'ITF_DOCS', 'Печатные документы', 0, 0, 'ITF_DOCS', 'Itf_Docs', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(27820, 1, 'UCONSSUBJECTFORMS', '', 0, 0, 'UCONSSUBJECTFORMS', 'UCONSSUBJECTFORMS', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20554, 1, 'COMPOUNDCLS', 'Группа статей экономической классификации ', 0, 0, 'COMPOUNDCLS', 'CompoundCls', 131, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20561, 1, 'COMPOUNDCLSDETAIL', 'Экономические статьи входящие в группу', 0, 0, 'COMPOUNDCLSDETAIL', 'COMPOUNDCLSDETAIL', 132, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20578, 1, 'RESERVEFUNDS', 'Устарело. Резервы средств ', 0, 0, 'RESERVEFUNDS', 'RESERVEFUNDS', 133, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20591, 1, 'STATE_TYPES', 'Типы состояний (справочник)', 0, 0, 'STATE_TYPES', 'St_T', 87, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20598, 1, 'DOCUMENTTYPES', 'Типы документов', 0, 0, 'DOCUMENTTYPES', 'DocumentTypes', 88, 0, 0, 2, '', 1, 1, -1, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(20618, 1, 'BANKEXCH_CLSREPLACEMENT', '', 0, 0, 'BANKEXCH_CLSREPLACEMENT', 'BankExch_ClsReplacement', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20638, 1, 'REMOTECLIENTTYPE', 'Типы удаленных клиентов', 0, 0, 'REMOTECLIENTTYPE', 'RemoteClientType', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20646, 1, 'REMOTETASKREGIME', 'Права удалённого пользователя ', 0, 0, 'REMOTETASKREGIME', 'RemoteTaskRegime', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20649, 1, 'REMOTETASKTYPE', 'Типы задач ', 0, 0, 'REMOTETASKTYPE', 'RemoteTaskType', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20652, 1, 'REMOTETASKMANAGER', 'Менеджер задач ', 0, 0, 'REMOTETASKMANAGER', 'RemoteTaskManager', 108, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20666, 1, 'REMOTETASKMANAGERDETAIL', 'Менеджер задач детализация', 0, 0, 'REMOTETASKMANAGERDETAIL', 'RemoteTaskManagerDetail', 109, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20677, 1, 'ITF_CTRL', 'Раскладка элементов окружения по интерфейсам ввода', 0, 0, 'ITF_CTRL', 'Itf_Ctrl', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20686, 1, 'PLANDOCTYPE', 'Вид плана', 0, 0, 'PLANDOCTYPE', 'PlanDocType', 106, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20691, 1, 'REPORTTESTERCONTROL', '', 0, 0, 'REPORTTESTERCONTROL', 'REPORTTESTERCONTROL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20694, 1, 'TENDEROBJECTS', 'Предмет заявки', 0, 0, 'TENDEROBJECTS', 'TenderObj', 83, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20727, 1, 'MEASUREMENTCLS', 'Единицы измерения', 0, 0, 'MEASUREMENTCLS', 'MeasurementCls', 81, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20735, 1, 'DBGROUPS', 'Группы пользователей', 0, 0, 'DBGROUPS', 'DBGroups', 101, 0, 0, 2, '', 1, 1, 3600, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20741, 1, 'GROUPSWORKPLACES', 'Права групп на РМ', 0, 0, 'GROUPSWORKPLACES', 'GROUPSWORKPLACES', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20746, 1, 'OBJECTKIND', 'Тип объекта системы ', 0, 0, 'OBJECTKIND', 'ObjectKind', 99, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20751, 1, 'RIGHTKIND', 'Тип права на объекты системы', 0, 0, 'RIGHTKIND', 'RightKind', 98, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20756, 1, 'DBRIGHTS', 'Соотнесение прав объектам системы', 0, 0, 'DBRIGHTS', 'DBRights', 102, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20763, 1, 'GROUPSRIGHTS', 'Права групп на объекты', 0, 0, 'GROUPSRIGHTS', 'GroupsRights', 105, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20772, 1, 'USERSRIGHTS', 'Права пользователей на объекты ', 0, 0, 'USERSRIGHTS', 'UsersRights', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20781, 1, 'USERSINGROUPS', 'Вхождение пользователей в группы ', 0, 0, 'USERSINGROUPS', 'UsersInGroups', 103, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20787, 1, 'DATECONST', 'Константы типа дата', 0, 0, 'DATECONST', 'DateConst', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20792, 1, 'GUARANTEE', 'Устарело. Гарантии', 0, 0, 'GUARANTEE', 'Guarantee', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20821, 1, 'DOCUMENTFIELDS', 'Поля документов ', 0, 0, 'DOCUMENTFIELDS', 'DocumentFields', 92, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20836, 1, 'STATE_DOCSTATES', 'Состояния документов', 0, 0, 'STATE_DOCSTATES', 'St_DS', 89, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20851, 1, 'STATE_JUMPS', 'Переходы ', 0, 0, 'STATE_JUMPS', 'St_J', 90, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20868, 1, 'STATE_OPENFIELDS', 'Поля, открытые для редактирования, для каждого перехода', 0, 0, 'STATE_OPENFIELDS', 'St_OF', 93, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20877, 1, 'DUALRIGHTS', 'Права на связки объектов', 0, 0, 'DUALRIGHTS', 'DualRights', 107, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20887, 1, 'EXCHNUMBERLIMITS', 'Ограничения каждого типа номера (снизу и сверху) для каждого типа обмена', 0, 0, 'EXCHNUMBERLIMITS', 'EXCHNUMBERLIMITS', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20892, 1, 'EXCHNUMBER', 'Обменные номера для каждой даты обмена и типа обмена', 0, 0, 'EXCHNUMBER', 'ExchNumber', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20902, 1, 'REMOTEMAILMESSAGES', 'Содержание почтового сообщения ', 0, 0, 'REMOTEMAILMESSAGES', 'RemoteMailMessages', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20908, 1, 'REMOTEMAILCLIENTMESSAGES', 'Почтовые сообщения для удалённых клиентов ', 0, 0, 'REMOTEMAILCLIENTMESSAGES', 'RemoteMailClientMessages', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20914, 1, 'REMOTEMAILATTACHEDFILES', 'Файлы, приложенные к почтовым сообщениям ', 0, 0, 'REMOTEMAILATTACHEDFILES', 'RemoteMailAttachedFiles', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20918, 1, 'BUDSTRLINK', 'Сруктура расходной части бюджета', 0, 0, 'BUDSTRLINK', 'BudStrLink', 142, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20957, 1, 'UTYPEDFORMS', 'Реестр форм ввода, подлежащих консолидации', 0, 0, 'UTYPEDFORMS', 'uTypedForms', 1300, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(20983, 1, 'UTYPEDFORMSCAPTION', 'Шапка таблицы с содержимым форм ввода', 0, 0, 'UTYPEDFORMSCAPTION', 'uTypedFormsCaption', 1301, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21028, 1, 'TENDERPRODUCT', 'Детализация заявок, конс. заявок, и итогов конкурса', 0, 0, 'TENDERPRODUCT', 'TenderProduct', 138, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21131, 1, 'UTYPEDFORMSDETAIL', 'Детализация содержимого форм ввода', 0, 0, 'UTYPEDFORMSDETAIL', 'utypedformsdetail', 1302, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21247, 1, 'UTYPEDFORMSPLACES', 'Раскладка форм ввода по интерфейсам', 0, 0, 'UTYPEDFORMSPLACES', 'utypedformsplaces', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21275, 1, 'TENDERCAPTION', 'Таблица заголовков заявок', 0, 0, 'TENDERCAPTION', 'TenderCpt', 139, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21356, 1, 'TENDERSOURCEORG', 'Заявки - список организаций', 0, 0, 'TENDERSOURCEORG', 'TENDERSOURCEORG', 79, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21369, 1, 'TENDERRESULTCAPTION', 'Заголовки итогов конкурса', 0, 0, 'TENDERRESULTCAPTION', 'TenderResultCpt', 134, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21424, 1, 'BANKEXCH_SUBSTITUTION', 'Таблица подстановок ЭПД', 0, 0, 'BANKEXCH_SUBSTITUTION', 'BANKEXCH_SUBSTITUTION', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21480, 1, 'BUDSTRUCTRIGHTS', 'Права на обобщающие значения по классификаторам', 0, 0, 'BUDSTRUCTRIGHTS', 'BudStructRights', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21520, 1, 'DESCRDOCUMENTFIELDS', 'Описания документов. Для серверных обработчиков УРМ ', 0, 0, 'DESCRDOCUMENTFIELDS', 'DESCRDOCUMENTFIELDS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21541, 1, 'DESCRDOCUMENTTYPES', 'Описания документов, позволяющие автоматически формировать запросы для серверных обработчиков УРМ', 0, 0, 'DESCRDOCUMENTTYPES', 'DESCRDOCUMENTTYPES', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21555, 1, 'DIRECTIONCLS', 'Направление', 0, 0, 'DIRECTIONCLS', 'DirectionCLS', 144, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(21560, 1, 'PROGRAMCODE', 'Программы', 0, 0, 'PROGRAMCODE', 'ProgramCode', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21565, 1, 'STATE_ACTIONJUMPS', 'Разрешенные переходы', 0, 0, 'STATE_ACTIONJUMPS', 'St_AJ', 96, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21569, 1, 'STATE_ACTIONS', 'Действия', 0, 0, 'STATE_ACTIONS', 'St_A', 95, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21585, 1, 'STATEJUMPHISTORY', 'История переходов сотояний документов', 0, 0, 'STATEJUMPHISTORY', 'St_JH', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(27821, 1, 'UCONSSUBJECTTYPES', '', 0, 0, 'UCONSSUBJECTTYPES', 'UCONSSUBJECTTYPES', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21599, 1, 'UTFCTREE', 'Связи для отчетов и заданий типа m:n', 0, 0, 'UTFCTREE', 'utfctree', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21608, 1, 'UTYPEDFORMSREGCAPTION', 'Шапка для реестра форм ввода', 0, 0, 'UTYPEDFORMSREGCAPTION', 'utypedformsregcaption', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21619, 1, 'UTYPEDFORMSREGDETAIL', 'Детализация содержимого форм ввода', 0, 0, 'UTYPEDFORMSREGDETAIL', 'utypedformsregdetail', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21627, 1, 'BUHACCPLAN', 'План счетов', 0, 0, 'BUHACCPLAN', 'BuhAccPlan', 146, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(21634, 1, 'BUHOPERATIONCLS', 'Бухгалтерские операции (проводки)', 0, 0, 'BUHOPERATIONCLS', 'BuhOpCls', 147, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(21640, 1, 'BALANCECLS', 'Тип счетов', 0, 0, 'BALANCECLS', 'BalanceCls', 148, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21646, 1, 'ACCOUNTSCONFORMITY', 'Соответствие счетов', 0, 0, 'ACCOUNTSCONFORMITY', 'AccountsConformity', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21651, 1, 'BUHACCCORR', 'Корреспонденция счетов', 0, 0, 'BUHACCCORR', 'BuhAccCorr', 149, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21664, 1, 'INTERFACESBUHOP', 'Ограничения бухопераций по коду интерфейса', 0, 0, 'INTERFACESBUHOP', 'InterfacesBuhOp', 150, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21672, 1, 'TRANSFER15NTO70N', 'Устарело. Переходы от проводок 15н к бух. операциям 70н', 0, 0, 'TRANSFER15NTO70N', 'TRANSFER15NTO70N', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21681, 1, 'UNIONNOTIFYCAPTION', 'Таблица для блока сводных уведомлений 1Н. Заголовок', 0, 0, 'UNIONNOTIFYCAPTION', 'UNIONNOTIFYCAPTION', 181, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21709, 1, 'UNIONNOTIFYDETAIL', 'Таблица для блока сводных уведомлений 1Н. Детализация', 0, 0, 'UNIONNOTIFYDETAIL', 'UNIONNOTIFYDETAIL', 182, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21876, 1, 'STATE_JUMPCONTROL', 'Таблица для хранения списка контролей на переходы между состояниями документов', 0, 0, 'STATE_JUMPCONTROL', 'St_JC', 97, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21896, 1, 'CONTACTPERSONS', 'Справочник контакных лиц организаций (л/с)', 0, 0, 'CONTACTPERSONS', 'CONTACTPERSONS', 151, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21916, 1, 'TENDERCONTACTS', 'Таблица контакных лиц для заявок на закупку', 0, 0, 'TENDERCONTACTS', 'TenderContacts', 152, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21929, 1, 'YARDSTICKS', 'Справочник критериев оценки/квалификационных требований', 0, 0, 'YARDSTICKS', 'YARDSTICKS', 153, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21942, 1, 'TENDERYARDSTICKS', 'Критерии/требования к заявке заказчика', 0, 0, 'TENDERYARDSTICKS', 'TENDERYARDSTICKS', 154, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21964, 1, 'TENDERSUPPLEMENTS', 'Документы предоставляемые государственным заказчиком', 0, 0, 'TENDERSUPPLEMENTS', 'TENDERSUPPLEMENTS', 155, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(21978, 1, 'ENUMS', 'Описание перечислимых типов данных ', 0, 0, 'ENUMS', 'Enums', 165, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(21990, 1, 'ENUMVALUES', 'Описания значений перечислимых типов данных ', 0, 0, 'ENUMVALUES', 'ENUMVALUES', 166, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(22002, 1, 'STATE_CASCADEACTIONS', 'Устарело. Таблица для каскадных переходов', 0, 0, 'STATE_CASCADEACTIONS', 'St_CA', 156, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22014, 1, 'LAYERTYPES', 'Виды слоев', 0, 0, 'LAYERTYPES', 'LAYERTYPES', 167, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22024, 1, 'LAYERS', 'Виды слоев', 0, 0, 'LAYERS', 'Layers', 168, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22042, 1, 'LAYERFIELDS', 'Описание полей слоя', 0, 0, 'LAYERFIELDS', 'LAYERFIELDS', 169, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22075, 1, 'LAYERCONTROLRULES', 'Описание полей слоя', 0, 0, 'LAYERCONTROLRULES', 'LAYERCONTROLRULES', 170, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22089, 1, 'LAYERRELATIONS', 'Таблица для задания отношений между слоями ', 0, 0, 'LAYERRELATIONS', 'LAYERRELATIONS', 171, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22105, 1, 'LAYERFIELDSRELATIONS', 'Таблица для задания отношений между слоями ', 0, 0, 'LAYERFIELDSRELATIONS', 'LAYERFIELDSRELATIONS', 172, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22120, 1, 'LAYERTASKS', 'Таблица для хранения задач', 0, 0, 'LAYERTASKS', 'LAYERTASKS', 173, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22143, 1, 'LAYERDATA', 'Таблица для хранения данных слоев ', 0, 0, 'LAYERDATA', 'LAYERDATA', 174, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22257, 1, 'LAYERNEEDCONTROL', 'Таблица заданий для согласования слоев', 0, 0, 'LAYERNEEDCONTROL', 'LayerNeedControl', 175, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22270, 1, 'ED_DETAIL', '', 0, 0, 'ED_DETAIL', 'ED_Detail', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22280, 1, 'UTYPEDFORMSVERSION', 'Таблица для хранения списка версии на формы ввода', 0, 0, 'UTYPEDFORMSVERSION', 'uTypedFormsVersion', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22293, 1, 'LOANCREDITCONTRACTS', 'Устарело. Таблица для хранения списка версии на формы ввода', 0, 0, 'LOANCREDITCONTRACTS', 'LOANCREDITCONTRACTS', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22306, 1, 'ED_SALDO', 'Остатки на счетах ФО ', 0, 0, 'ED_SALDO', 'ED_SALDO', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22334, 1, 'ED_OUTPAYDOC', 'Расходные пп', 0, 0, 'ED_OUTPAYDOC', 'ED_OutPayDoc', 1406, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22385, 1, 'TARGETCLS', 'Код цели', 0, 0, 'TARGETCLS', 'TargetCls', 11, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(22391, 1, 'ORGATTRIBUTES', 'Таблица атрибутов для организаций плательщика/получателя, нужных для отправления документа в ФК ', 0, 0, 'ORGATTRIBUTES', 'OrgAttributes', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22405, 1, 'DATAPACKETTYPES', 'Типы пакетов обратной ЭЦП', 0, 0, 'DATAPACKETTYPES', 'DataPacketTypes', 186, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(22417, 1, 'REMOTEEDSRIGHT', 'Таблица прав удаленных клиентов на пакетами документов, заверенными ЭЦП', 0, 0, 'REMOTEEDSRIGHT', 'REMOTEEDSRIGHT', 185, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22428, 1, 'LINKTYPE', 'Типы связей ', 0, 0, 'LINKTYPE', 'LinkType', 1401, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(22454, 1, 'UTYPEDCLSCAPTION', 'мастер таблицы для произвольных справочников в технологии консолидации ', 0, 0, 'UTYPEDCLSCAPTION', 'utypedclscaption', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22468, 1, 'DATAPACKET', 'Пакеты обратной ЭЦП', 0, 0, 'DATAPACKET', 'DataPacket', 189, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22489, 1, 'DATASECTIONTYPES', 'Таблица описания секций типов пакетов обратной ЭЦП', 0, 0, 'DATASECTIONTYPES', 'DATASECTIONTYPES', 187, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22499, 1, 'DATAPACKETCONTENT', 'Таблица описания содержания пакетов обратной ЭЦП', 0, 0, 'DATAPACKETCONTENT', 'DataPacketContent', 188, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22513, 1, 'RECORDPARAMS', 'Таблица атрибутов записей ', 0, 0, 'RECORDPARAMS', 'RecordParams', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22523, 1, 'USERGENERATOROPT', '', 0, 0, 'USERGENERATOROPT', 'USERGENERATOROPT', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22529, 1, 'LINKRECORDS', 'Динамические связи', 0, 0, 'LINKRECORDS', 'LinkRecords', 1402, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22538, 1, 'USERGENERATOR', 'Пользовательские генераторы', 0, 0, 'USERGENERATOR', 'UserGenerator', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22547, 1, 'USERGENERATORFIELDS', 'Привязка генераторов к полям документов', 0, 0, 'USERGENERATORFIELDS', 'UserGeneratorFields', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22558, 1, 'DOCLOCK', 'Блокировки для документов ', 0, 0, 'DOCLOCK', 'DOCLOCK', 223, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22576, 1, 'DOCLOCKFIELDS', 'Поля для блокировок', 0, 0, 'DOCLOCKFIELDS', 'DOCLOCKFIELDS', 225, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22580, 1, 'UTYPEDCLSDETAIL', '', 0, 0, 'UTYPEDCLSDETAIL', 'UTYPEDCLSDETAIL', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22616, 1, 'CARDSDETAIL_FACC', 'Список л\с, разрешенных для использования с пласт. картой', 0, 0, 'CARDSDETAIL_FACC', 'CardsDetail_FAcc', 183, 0, 0, 2, '', 1, 1, 600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(22624, 1, 'CARDSDETAIL_KESR', 'Перечень ЭКР, разрешенных для использования с пластиковой картой', 0, 0, 'CARDSDETAIL_KESR', 'CARDSDETAIL_KESR', 184, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22632, 1, 'FUNDSSOURCE', 'Устарело. Источник образования средств', 0, 0, 'FUNDSSOURCE', 'FUNDSSOURCE', 32, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22639, 1, 'ALLOWANCECAPTION', 'Устарело. Разрешения. Заголовок', 0, 0, 'ALLOWANCECAPTION', 'AllowanceCaption', 5000, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22675, 1, 'ALLOWANCEDETAIL', 'Устарело. Разрешения. Деталь', 0, 0, 'ALLOWANCEDETAIL', 'AllowanceDetail', 5001, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22697, 1, 'TENDERLOT', '', 0, 0, 'TENDERLOT', 'TenderLot', 195, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22727, 1, 'SUPDOCTYPECLS', '', 0, 0, 'SUPDOCTYPECLS', 'SupDTCls', 198, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22737, 1, 'OKP', '', 0, 0, 'OKP', 'OKP', 192, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22773, 1, 'TRANSFERTCLS', 'Код целевых средств', 0, 0, 'TRANSFERTCLS', 'KCS', 203, 0, 0, 2, '', 1, 1, 600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(22787, 1, 'STATICLINKS', 'Описание статических связей между документами', 0, 0, 'STATICLINKS', 'StLinks', 1405, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22797, 1, 'OKFS', '', 0, 0, 'OKFS', 'OKFS', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22802, 1, 'STATE_FILTER', 'Фильтры, применяемые в сценариях системы состояний', 0, 0, 'STATE_FILTER', 'St_F', 1404, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22813, 1, 'OKOPF', '', 0, 0, 'OKOPF', 'OKOPF', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22818, 1, 'ORG_TYPE', 'Виды организаций', 0, 0, 'ORG_TYPE', 'ORG_TYPE', 210, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(22823, 1, 'DOCUMENTCLS', 'Страницы документов с 6-разрядной кодировкой', 0, 0, 'DOCUMENTCLS', 'DocumentCls', 220, 0, 0, 2, '', 1, 1, 3600, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(22838, 1, 'LAYERBLOBS', '', 0, 0, 'LAYERBLOBS', 'LAYERBLOBS', 197, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22843, 1, 'CORRECTIONCAPTION', 'Уведомления об уточнении заголовок', 0, 0, 'CORRECTIONCAPTION', 'CorrectionCpt', 5503, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22908, 1, 'CORRECTIONDETAIL', 'Уведомления об уточнении детализация', 0, 0, 'CORRECTIONDETAIL', 'CorrectionDet', 5504, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22954, 1, 'PLANKIND', '', 0, 0, 'PLANKIND', 'PLANKIND', 200, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22961, 1, 'TENDERSUPDOCUMENT', '', 0, 0, 'TENDERSUPDOCUMENT', 'TENDERSUPDOCUMENT', 196, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22976, 1, 'ASSIGNMENTKIND', 'Вид ассигнований', 0, 0, 'ASSIGNMENTKIND', 'ASSIGNMENTKIND', 201, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22983, 1, 'ASSIGNMENTSOURCE', 'Вид изменений', 0, 0, 'ASSIGNMENTSOURCE', 'ASSIGNMENTSOURCE', 202, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(22990, 1, 'TENDERPROPOSAL', '', 0, 0, 'TENDERPROPOSAL', 'TENDERPROPOSAL', 205, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23004, 1, 'TENDERPROPOSALDETAIL', '', 0, 0, 'TENDERPROPOSALDETAIL', 'TENDERPROPOSALDet', 206, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23023, 1, 'TENDERPURCHASELOT', '', 0, 0, 'TENDERPURCHASELOT', 'TENDERPURCHASELOT', 207, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23037, 1, 'TENDERPURCHASE', '', 0, 0, 'TENDERPURCHASE', 'TENDERPURCHASE', 204, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23055, 0, 'ПРОТОТИПЫ', 'Прототипы полей', 1, 0, '', 'Прототипы', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23058, 1, 'UNLOCKDATES', 'Таблица для хранения дат закрытых от изменения дней', 0, 0, 'UNLOCKDATES', 'UNLOCKDATES', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23059, 1, 'VARIANTCLS', 'Справочник вариантов (бюджетные данные)', 0, 0, 'VARIANTCLS', 'VARIANTCLS', 1408, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23060, 1, 'ACCCUROPERATIONVIEW', 'Устарело. Вьюшка. ', 1, 0, 'ACCCUROPERATIONVIEW', 'ACCCUROPERATIONVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23061, 1, 'BANKSNAMES', 'Вьюшка. ', 1, 0, 'BANKSNAMES', 'BANKSNAMES', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23063, 1, 'BILLFINVIEW', 'Устарело. Вьюшка. ', 1, 0, 'BILLFINVIEW', 'BILLFINVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23065, 1, 'DFACCOUNTS', 'Устарело. Вьюшка на счета ФО', 1, 0, 'DFACCOUNTS', 'DFACCOUNTS', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23066, 1, 'DOCUMENTTEMPLATE', 'Шаблоны ввода данных для интерфейсов ввода', 0, 0, 'DOCUMENTTEMPLATE', 'DOCUMENTTEMPLATE', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23067, 1, 'DZACC', 'Устарело. Вьюшка. ', 1, 0, 'DZACC', 'DZACC', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23069, 1, 'FIELDSINFO', 'Информация о полях выборок', 0, 0, 'FIELDSINFO', 'FIELDSINFO', 0, 0, 0, 2, '', 1, 1, -1, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(23070, 1, 'FINCLAIMTMP', 'Устарело. Вьюшка. ', 1, 0, 'FINCLAIMTMP', 'FINCLAIMTMP', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23071, 1, 'FINCLAIMVIEW', 'Устарело. Вьюшка. ', 1, 0, 'FINCLAIMVIEW', 'FINCLAIMVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23072, 1, 'FINDETAILVIEW', 'Устарело. Вьюшка. ', 1, 0, 'FINDETAILVIEW', 'FINDETAILVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23074, 1, 'FREEFINVIEW', 'Устарело. Вьюшка. ', 1, 0, 'FREEFINVIEW', 'FREEFINVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23075, 1, 'INCOMESLEFT', 'Устарело. Вьюшка. ', 1, 0, 'INCOMESLEFT', 'INCOMESLEFT', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23077, 1, 'INCOMESRIGHT', 'Устарело. Вьюшка. ', 1, 0, 'INCOMESRIGHT', 'INCOMESRIGHT', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23078, 1, 'INCOMES_REDIRECT', 'Вьюшка. ', 1, 0, 'INCOMES_REDIRECT', 'INCOMES_REDIRECT', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23079, 1, 'INCTEMPLATETITLEVIEW', 'УСТАРЕЛО. Вьюшка. ', 1, 0, 'INCTEMPLATETITLEVIEW', 'INCTEMPLATETITLEVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23080, 1, 'INTERFACESVIEW', 'Вьюшка. ', 1, 0, 'INTERFACESVIEW', 'INTERFACESVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23081, 1, 'ORGNAMEINNACC', 'Вьюшка. ', 1, 0, 'ORGNAMEINNACC', 'ORGNAMEINNACC', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23082, 1, 'PROTOCOLDOCTYPE', '', 0, 0, 'PROTOCOLDOCTYPE', 'PROTOCOLDOCTYPE', 208, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23083, 1, 'PROTOCOLREASON', '', 0, 0, 'PROTOCOLREASON', 'PROTOCOLREASON', 209, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23084, 1, 'REG_JOURNAL', 'Журнал регистрации', 1, 0, 'REG_JOURNAL', 'REG_JOURNAL', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23088, 1, 'SCENARIO', 'Сценарии', 0, 0, 'SCENARIO', 'SCENARIO', 1409, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23089, 1, 'SELECTIONS', 'Выборки данных', 0, 0, 'SELECTIONS', 'SELECTIONS', 0, 0, 0, 2, '', 1, 1, -1, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(23090, 1, 'SELECTIONSDETAIL', 'Вложенные выборки данных', 0, 0, 'SELECTIONSDETAIL', 'SELECTIONSDETAIL', 0, 0, 0, 2, '', 1, 1, -1, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(23091, 1, 'STATUSICONS', 'Статусные иконки для интерфейсов ввода', 0, 0, 'STATUSICONS', 'ICONS', 224, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23092, 1, 'SUMINPASSAGEVIEW', 'Устарело. Вьюшка. ', 1, 0, 'SUMINPASSAGEVIEW', 'SumInPassageView', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23093, 1, 'UCONSCLIENTS', '', 0, 0, 'UCONSCLIENTS', 'UCONSCLIENTS', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23094, 1, 'UNKNOWNREDIRECTMASTER', 'Вьюшка. ', 1, 0, 'UNKNOWNREDIRECTMASTER', 'UNKNOWNREDIRECTMASTER', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23095, 1, 'VZFINDETAIL', 'УСТАРЕЛО. Вьюшка. ', 1, 0, 'VZFINDETAIL', 'VZFINDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

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, '', '') ;

CALL SELECTIONS_IMPORT(23097, 1, 'WORKPLACESINTERFACES', 'Вьюшка. Распределение интерфейсов по рабочим местам', 1, 0, 'WORKPLACESINTERFACES', 'WP_INTERFACES', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23098, 1, 'WORKPLACESUSER', 'Вьюшка. Назначение рабочих мест пользователям', 1, 0, 'WORKPLACESUSER', 'WORKPLACESUSER', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23099, 1, 'WORKPLACESVIEW', 'Вьюшка. ', 1, 0, 'WORKPLACESVIEW', 'WORKPLACESVIEW', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(23100, 1, 'DOCUMENTTEMPLATEFIELDS', 'Таблица для хранения шаблонных значений полей для шаблонов ввода', 0, 0, 'DOCUMENTTEMPLATEFIELDS', 'DOCUMENTTEMPLATEFIELDS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(26536, 1, 'SUBSIDYCLS', 'Коды субсидий', 0, 0, 'SUBSIDYCLS', 'SUBSIDYCLS', 211, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(26537, 1, 'ED_CORRECTIONCAPTION', '', 0, 0, 'ED_CORRECTIONCAPTION', 'ED_CORRECTIONCAPTION', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(26538, 1, 'ED_CORRECTIONDETAIL', '', 0, 0, 'ED_CORRECTIONDETAIL', 'ED_CORRECTIONDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(26793, 1, 'REPLACEMENTCLSCAPTION', '', 0, 0, 'REPLACEMENTCLSCAPTION', 'REPLACEMENTCLSCAPTION', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(26794, 1, 'REPLACEMENTCLSDETAIL', '', 0, 0, 'REPLACEMENTCLSDETAIL', 'REPLACEMENTCLSDETAIL', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(26795, 1, 'REPLACEMENTCLSDETAILINFO', '', 0, 0, 'REPLACEMENTCLSDETAILINFO', 'REPLACEMENTCLSDETAILINFO', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(26796, 1, 'UTYPEDIMPORTREGISTRY', '', 0, 0, 'UTYPEDIMPORTREGISTRY', 'UTYPEDIMPORTREGISTRY', 0, 0, 0, 1, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(30653, 1, 'ARCHIVEDOCPARAMS', 'Параметры для категории архивных докуметов', 0, 0, 'ARCHIVEDOCPARAMS', 'ARCHIVEDOCPARAMS', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(30654, 1, 'ARCHIVEDOCTYPE', 'Категории архивных документов', 0, 0, 'ARCHIVEDOCTYPE', 'ArchiveDocType', 1413, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(30655, 1, 'ARCHIVEOPLOG', 'Журнал операций с архивными документами', 0, 0, 'ARCHIVEOPLOG', 'ARCHIVEOPLOG', 0, 0, 0, 1, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(30656, 1, 'SIGNLOG', 'ЭА. Таблица основного журнала подписания', 0, 0, 'SIGNLOG', 'SIGNLOG', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(30657, 1, 'SIGNPARAMS', 'ЭА. Таблица вспомогательного журнала подписания', 0, 0, 'SIGNPARAMS', 'SIGNPARAMS', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(30658, 1, 'SIGNS', 'ЭА. Справочник подписей (ролей)', 0, 0, 'SIGNS', 'SIGNS', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(30659, 1, 'SIGNSCHEMECAPTION', 'ЭА. Справочник схем подписания (заголовок)', 0, 0, 'SIGNSCHEMECAPTION', 'SIGNSCHEMECAPTION', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(30660, 1, 'SIGNSCHEMEDETAIL', 'ЭА. Справочник схем подписания (детализация)', 0, 0, 'SIGNSCHEMEDETAIL', 'SIGNSCHEMEDETAIL', 0, 0, 0, 2, '', 1, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(31615, 1, 'WRITEXECUTIONNOTIFY', '', 0, 0, 'WRITEXECUTIONNOTIFY', 'WRITEXECUTIONNOTIFY', 1416, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(31616, 1, 'WRITNOTIFYCLS', '', 0, 0, 'WRITNOTIFYCLS', 'WRITNOTIFYCLS', 1417, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(31617, 1, 'GENERALDOCSDETAIL', '', 0, 0, 'GENERALDOCSDETAIL', 'GENERALDOCSDETAIL', 1415, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(31618, 1, 'GENERALDOCUMENTS', '', 0, 0, 'GENERALDOCUMENTS', 'GENERALDOCUMENTS', 1414, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(31619, 1, 'UTYPEDDOCUMENTS', '', 0, 0, 'UTYPEDDOCUMENTS', 'UTYPEDDOCUMENTS', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(31620, 1, 'UTYPEDPERIODCAPTION', '', 0, 0, 'UTYPEDPERIODCAPTION', 'UTYPEDPERIODCAPTION', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(31621, 1, 'UTYPEDPERIODDETAIL', '', 0, 0, 'UTYPEDPERIODDETAIL', 'UTYPEDPERIODDETAIL', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(31622, 1, 'UTYPEDSOURCESCAPTION', '', 0, 0, 'UTYPEDSOURCESCAPTION', 'UTYPEDSOURCESCAPTION', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(31623, 1, 'UTYPEDSOURCESDETAIL', '', 0, 0, 'UTYPEDSOURCESDETAIL', 'UTYPEDSOURCESDETAIL', 0, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(31624, 1, 'WRITNOTIFYCLSDETAIL', '', 0, 0, 'WRITNOTIFYCLSDETAIL', 'WRITNOTIFYCLSDETAIL', 1418, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(31625, 1, 'WRITNOTIFYCLSPART', '', 0, 0, 'WRITNOTIFYCLSPART', 'WRITNOTIFYCLSPART', 1419, 0, 0, 2, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(32177, 1, 'CLIENTSESSIONS', '', 0, 0, 'CLIENTSESSIONS', 'CLIENTSESSIONS', 0, 0, 0, 0, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(32178, 1, 'SERVERSESSIONS', 'Устарело. ', 0, 0, 'SERVERSESSIONS', 'SERVERSESSIONS', 0, 0, 0, 0, '', 0, 0, 3, null, null, '', '') ;

CALL SELECTIONS_IMPORT(32786, 1, 'COMMDIRECTIONEXPENCECLS', 'Направления расходов вышестоящих бюджетов ', 0, 0, 'COMMDIRECTIONEXPENCECLS', 'COMMDIRECTIONEXPENCECLS', 226, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(32820, 1, 'OKTMO', 'Классификатор муниципальный образований / населенных пунктов', 0, 0, 'OKTMO', 'OKTMO', 227, 0, 0, 2, '', 1, 1, 1800, null, 5, '', '') ;

CALL SELECTIONS_IMPORT(32867, 2, 'CLS_302', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(32895, 1, 'DFUCHANGELOG', '', 0, 0, 'DFUCHANGELOG', 'DFUCHANGELOG', 0, 0, 0, 1, '', 1, 0, -1, null, null, '', '') ;

CALL SELECTIONS_IMPORT(32896, 1, 'SELECTIONEVENTS', '', 0, 0, 'SELECTIONEVENTS', 'SELECTIONEVENTS', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '') ;

CALL SELECTIONS_IMPORT(34400, 2, 'CLS_304', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(35312, 1, 'OKPD', '', 0, 0, 'OKPD', 'OKPD', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '') ;

CALL SELECTIONS_IMPORT(34424, 2, 'CLS_305', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34448, 2, 'CLS_303', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34471, 2, 'CLS_306', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34494, 2, 'CLS_312', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34517, 2, 'CLS_311', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34539, 2, 'CLS_314', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34562, 2, 'CLS_315', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34588, 2, 'CLS_322', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34610, 2, 'CLS_323', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34631, 2, 'CLS_201', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34650, 2, 'CLS_202', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34683, 1, 'SIGNDOCRECORDS', '', 0, 0, 'SIGNDOCRECORDS', 'SIGNDOCRECORDS', 0, 0, 0, 1, '', 0, 0, 3, 3, null, '', '') ;

CALL SELECTIONS_IMPORT(34700, 2, 'ДАННЫЕЭЦП', '', 1, 0, '', '', 0, 0, 0, 1, '', 1, 0, 3, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34718, 2, 'CLS_203', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34738, 2, 'CLS_204', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34759, 2, 'CLS_205', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34779, 2, 'CLS_206', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34799, 2, 'CLS_207', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34820, 2, 'CLS_208', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(34841, 2, 'CLS_4903', '', 1, 0, '', '', 0, 0, 1, 1, '', 0, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(35019, 2, 'CLS_903', '', 1, 0, '', '', 0, 0, 1, 1, '', 1, 1, 20, -1, null, '', '') ;

CALL SELECTIONS_IMPORT(35044, 1, 'LAYERFIELDTYPESDETAIL', '', 0, 0, 'LAYERFIELDTYPESDETAIL', 'LAYERFIELDTYPESDETAIL', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '') ;

CALL SELECTIONS_IMPORT(35045, 1, 'SIGNCERTIFICATE', '', 0, 0, 'SIGNCERTIFICATE', 'SIGNCERTIFICATE', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '') ;

CALL SELECTIONS_IMPORT(35046, 1, 'SIGNDOCUMENTSGROUP', '', 0, 0, 'SIGNDOCUMENTSGROUP', 'SIGNDOCUMENTSGROUP', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '') ;

CALL SELECTIONS_IMPORT(35047, 1, 'SIGNDOCUMENTSGROUPDETAIL', '', 0, 0, 'SIGNDOCUMENTSGROUPDETAIL', 'SIGNDOCUMENTSGROUPDETAIL', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '') ;

CALL SELECTIONS_IMPORT(35048, 1, 'LAYERFIELDTYPES', '', 0, 0, 'LAYERFIELDTYPES', 'LAYERFIELDTYPES', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '') ;

CALL SELECTIONS_IMPORT(35049, 1, 'SIGNPROFILE', '', 0, 0, 'SIGNPROFILE', 'SIGNPROFILE', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '') ;

CALL SELECTIONS_IMPORT(35050, 1, 'SIGNPROFILEDETAIL', '', 0, 0, 'SIGNPROFILEDETAIL', 'SIGNPROFILEDETAIL', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '') ;

CALL SELECTIONS_IMPORT(35313, 1, 'OKVED', '', 0, 0, 'OKVED', 'OKVED', 0, 0, 0, 2, '', 1, 0, -1, null, null, '', '') ;

CALL SELECTIONS_IMPORT(35357, 1, 'CLSCORRESPONDENTS', '', 0, 0, 'CLSCORRESPONDENTS', 'CLSCORRESPONDENTS', 1420, 0, 0, 2, '', 1, 1, 3600, -1, null, '', '') ;

CALL SELECTIONSDETAIL_IMPORT(32868, 32867, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=63', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(32869, 32867, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34401, 34400, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=64', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34402, 34400, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34426, 34424, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=61', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34427, 34424, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34450, 34448, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=65', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34451, 34448, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34473, 34471, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=62', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34474, 34471, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34496, 34494, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=69', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34497, 34494, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34519, 34517, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=68', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34520, 34517, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34541, 34539, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=70', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34542, 34539, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34564, 34562, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=71', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34565, 34562, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34590, 34588, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=73', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34591, 34588, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34612, 34610, 18947, 'FFC', 0, 0, 1, 'FFC.Progindex=75', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34613, 34610, 18864, 'FFD', 1, 2, 1, 'FFD.RECORDINDEX=FFC.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34632, 34631, 17463, 'BN', 0, 0, 1, 'BN.Progindex=32', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34633, 34631, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34652, 34650, 17463, 'BN', 0, 0, 1, 'BN.Progindex=260', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34653, 34650, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34701, 34700, 34683, 'sdr', 0, 0, 1, '', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34720, 34718, 17463, 'BN', 0, 0, 1, 'BN.Progindex=261', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34721, 34718, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34740, 34738, 17463, 'BN', 0, 0, 1, 'BN.Progindex=262', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34741, 34738, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34761, 34759, 17463, 'BN', 0, 0, 1, 'BN.Progindex=263', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34762, 34759, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34781, 34779, 17463, 'BN', 0, 0, 1, 'BN.Progindex=268', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34782, 34779, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34801, 34799, 17463, 'BN', 0, 0, 1, 'BN.Progindex=272', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34802, 34799, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34822, 34820, 17463, 'BN', 0, 0, 1, 'BN.Progindex=273', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34823, 34820, 17408, 'BDAT', 1, 2, 1, 'BDAT.RECORDINDEX=BN.ID', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(34842, 34841, 22468, 'DP', 0, 0, 1, 'DP.PROGINDEX=527', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(35023, 35019, 17643, 'QT', 0, 0, 1, '(QT.Progindex=45) or (QT.Progindex=140)', 0, '') ;

CALL SELECTIONSDETAIL_IMPORT(35024, 35019, 17668, 'INC', 1, 2, 1, 'INC.RECORDINDEX=QT.ID', 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(32345, 0, 1, null, 16642, null, 'DOCSUSPENDED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32346, 0, 1, null, 16642, null, 'ISINBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32347, 0, 1, null, 16642, null, 'ISVISED', 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, 0, 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', '', '', 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(35080, 0, 1, null, 16642, null, 'SOFTREJECTCAUSE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35081, 0, 1, null, 16642, null, 'SOFTREJECTCLS', 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, 0, 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(32237, 0, 1, null, 16708, null, 'FACIALACCCLS', 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, 0, 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, '', '', '') ;

-- 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, '', '', '') ;

-- 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, '', '', '') ;

-- 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.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, '', '', '', 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, '9999', '', '', 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, '', '', '', 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, '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(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, '', '', '', 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(16957, 0, 1, null, 16955, 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(16958, 0, 1, null, 16955, 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(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, '', '', '') ;

-- 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(16966, 0, 1, null, 16964, 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(16967, 0, 1, null, 16964, 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(16968, 0, 1, null, 16964, 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(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, '', '', '') ;

-- DOCBASE
CALL FIELDSINFO_IMPORT(16974, 0, 1, null, 16973, null, 'ID', 3, 0, 0, 'Код', '', 11, '99.99.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(16975, 0, 1, null, 16973, 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(16976, 0, 1, null, 16973, 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(16977, 0, 1, null, 16973, 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(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, '', '', '') ;

-- 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(32199, 0, 1, null, 17099, null, 'FUID', 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, 0, 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, 0, 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(32339, 0, 1, null, 17108, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32340, 0, 1, null, 17108, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32341, 0, 1, null, 17108, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32342, 0, 1, null, 17108, null, 'ISVISED', 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, 0, 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(35078, 0, 1, null, 17108, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35079, 0, 1, null, 17108, null, 'SOFTREJECTCLS', 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, 0, 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(32262, 0, 1, null, 17129, null, 'READRIGHTOPTION', 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, 0, 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, '', '', '') ;

-- 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(32238, 0, 1, null, 17265, null, 'FUID', 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, 0, 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(32200, 0, 1, null, 17408, null, 'FUID', 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, 0, 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(32201, 0, 1, null, 17463, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32202, 0, 1, null, 17463, null, 'DOCSUSPENDED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32203, 0, 1, null, 17463, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32204, 0, 1, null, 17463, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32205, 0, 1, null, 17463, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32206, 0, 1, null, 17463, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32207, 0, 1, null, 17463, null, 'SOFTREJECTCLS', 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, 0, 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(32362, 0, 1, null, 17583, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32363, 0, 1, null, 17583, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32364, 0, 1, null, 17583, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32365, 0, 1, null, 17583, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32366, 0, 1, null, 17583, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32367, 0, 1, null, 17583, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32368, 0, 1, null, 17583, null, 'SOFTREJECTCLS', 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, 0, 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(32370, 0, 1, null, 17643, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32371, 0, 1, null, 17643, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32372, 0, 1, null, 17643, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32373, 0, 1, null, 17643, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32374, 0, 1, null, 17643, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32375, 0, 1, null, 17643, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32376, 0, 1, null, 17643, null, 'SOFTREJECTCLS', 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, 0, 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, '', '', '') ;

-- 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(32285, 0, 1, null, 17668, null, 'FUID', 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, 0, 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, '', '', '') ;

-- 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32382, 0, 1, null, 17744, null, 'FUID', 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, 0, 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(32275, 0, 1, null, 17821, null, 'ACCEPTDATEPAYDOC', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32276, 0, 1, null, 17821, null, 'FUID', 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, 0, 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, '', '', '') ;

-- ORMONTHTITLE
CALL FIELDSINFO_IMPORT(18056, 0, 1, null, 18055, 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(18057, 0, 1, null, 18055, null, 'INPUTDATE', 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, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18058, 0, 1, null, 18055, null, 'ACC_REF', 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, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18060, 0, 1, null, 18055, 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, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18061, 0, 1, null, 18055, 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(18062, 0, 1, null, 18055, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '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(18063, 0, 1, null, 18055, null, 'BUHPAYMENTCLS', 3, 0, 0, 'Бух. операция', '', 11, '999', '', '', 0, 0, null, 1, 17069, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18064, 0, 1, null, 18055, 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(18065, 0, 1, null, 18055, 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(18066, 0, 1, null, 18055, 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(18067, 0, 1, null, 18055, 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(18068, 0, 1, null, 18055, null, 'REJECTCAUSE', 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(18069, 0, 1, null, 18055, 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18070, 0, 1, null, 18055, 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18071, 0, 1, null, 18055, null, 'REJECT_CLS', 3, 0, 0, 'Код причины отклонения', '', 11, '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, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18072, 0, 1, null, 18055, null, 'AYEAR', 3, 0, 0, 'Год', '', 11, '9999', '', '', 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(18073, 0, 1, null, 18055, null, 'AMONTH', 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(32351, 0, 1, null, 18055, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32352, 0, 1, null, 18055, 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32353, 0, 1, null, 18055, null, 'DOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32354, 0, 1, null, 18055, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32355, 0, 1, null, 18055, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32356, 0, 1, null, 18055, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32357, 0, 1, null, 18055, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32358, 0, 1, null, 18055, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32359, 0, 1, null, 18055, null, 'SOFTREJECTCLS', 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, 0, 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, '', '', '') ;

-- ORMONTHDETAIL
CALL FIELDSINFO_IMPORT(18098, 0, 1, null, 18097, 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(18099, 0, 1, null, 18097, null, 'TITLE_REF', 3, 0, 0, 'Заголовок отчета', '', 11, '', '', '', 0, 0, null, 1, 18055, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18100, 0, 1, null, 18097, 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(18101, 0, 1, null, 18097, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '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(18102, 0, 1, null, 18097, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 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(18103, 0, 1, null, 18097, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 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(18104, 0, 1, null, 18097, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '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(18105, 0, 1, null, 18097, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '999', '', '', 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(18106, 0, 1, null, 18097, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 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, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18107, 0, 1, null, 18097, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '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(18108, 0, 1, null, 18097, 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(18109, 0, 1, null, 18097, 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, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18110, 0, 1, null, 18097, 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(18111, 0, 1, null, 18097, 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, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18112, 0, 1, null, 18097, 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(18113, 0, 1, null, 18097, 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(18114, 0, 1, null, 18097, null, 'REST', 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(18115, 0, 1, null, 18097, null, 'TOTAL', 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(18116, 0, 1, null, 18097, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '99.99.99', '', '', 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(18117, 0, 1, null, 18097, null, 'FINSOURCE', 3, 0, 0, 'Источник финансирования', '', 11, '999', '', '', 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(18118, 0, 1, null, 18097, null, 'SUMMAFACT', 6, 0, 0, 'Сумма по факту', '', 13, '', ',0.00', '0.00', 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(18119, 0, 1, null, 18097, 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(18120, 0, 1, null, 18097, 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(18121, 0, 1, null, 18097, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '999', '', '', 0, 0, null, 1, 21555, 0, 0, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32350, 0, 1, null, 18097, null, 'FUID', 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, 0, 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, '', '', '') ;

-- ORQUARTERTITLE
CALL FIELDSINFO_IMPORT(18154, 0, 1, null, 18153, 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(18155, 0, 1, null, 18153, null, 'INPUTDATE', 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(18156, 0, 1, null, 18153, null, 'ACC_REF', 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(18157, 0, 1, null, 18153, 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(18158, 0, 1, null, 18153, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '999', '', '', 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(18159, 0, 1, null, 18153, null, 'QUARTER', 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(18160, 0, 1, null, 18153, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '9.99', '', '', 0, 0, null, 1, 16955, 0, 0, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18161, 0, 1, null, 18153, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 0, 0, null, 1, 16844, 0, 0, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18162, 0, 1, null, 18153, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 0, 0, null, 1, 16851, 0, 0, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18163, 0, 1, null, 18153, 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(18164, 0, 1, null, 18153, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18165, 0, 1, null, 18153, 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(18166, 0, 1, null, 18153, 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(18167, 0, 1, null, 18153, 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(18168, 0, 1, null, 18153, 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(18169, 0, 1, null, 18153, null, 'AYEAR', 3, 0, 0, 'Год', '', 11, '9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORMONTHREFERENCE
CALL FIELDSINFO_IMPORT(18171, 0, 1, null, 18170, 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(18172, 0, 1, null, 18170, null, 'TITLE_REF', 3, 0, 0, 'Заголовок', '', 11, '', '', '', 0, 0, null, 1, 18055, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18173, 0, 1, null, 18170, null, 'REFCLS', 3, 0, 0, 'Справочно', '', 11, '9999', '', '', 0, 0, null, 1, 16901, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18174, 0, 1, null, 18170, 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(18175, 0, 1, null, 18170, 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(18176, 0, 1, null, 18170, 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(18177, 0, 1, null, 18170, 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(18178, 0, 1, null, 18170, 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(18179, 0, 1, null, 18170, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '999', '', '', 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(18180, 0, 1, null, 18170, null, 'SUMMA', 6, 0, 0, 'Сумма', '', 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(18181, 0, 1, null, 18170, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18182, 0, 1, null, 18170, 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(18183, 0, 1, null, 18170, 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(18184, 0, 1, null, 18170, 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(18185, 0, 1, null, 18170, 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(18186, 0, 1, null, 18170, 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(18187, 0, 1, null, 18170, null, 'FACT', 3, 0, 0, 'Мероприятие', '', 11, '99.99.99', '', '', 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(18188, 0, 1, null, 18170, null, 'FINSOURCE', 3, 0, 0, 'Источник финансирования', '', 11, '999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORMONTHTEMPLATESTITLE
CALL FIELDSINFO_IMPORT(18190, 0, 1, null, 18189, 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(18191, 0, 1, null, 18189, 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(18192, 0, 1, null, 18189, null, 'USERNAME', 1, 0, 30, '', '', 30, '', '', '', 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(18193, 0, 1, null, 18189, null, 'ACC_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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18194, 0, 1, null, 18189, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '9.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(18195, 0, 1, null, 18189, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.99.99', '', '', 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(18196, 0, 1, null, 18189, null, 'NUMDETAIL', 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, '', '', '') ;

-- ORMONTHTEMPLATESDETAIL
CALL FIELDSINFO_IMPORT(18198, 0, 1, null, 18197, 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(18199, 0, 1, null, 18197, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 18189, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18200, 0, 1, null, 18197, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 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(18201, 0, 1, null, 18197, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 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(18202, 0, 1, null, 18197, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.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(18203, 0, 1, null, 18197, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '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(18204, 0, 1, null, 18197, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.9.9', '', '', 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(18205, 0, 1, null, 18197, null, 'SUBKESR', 3, 0, 0, 'Суб ЭКР', '', 11, '9.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(18206, 0, 1, null, 18197, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 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(18207, 0, 1, null, 18197, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 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(18208, 0, 1, null, 18197, null, 'BUHPAYMENTCLS', 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(18209, 0, 1, null, 18197, 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(18210, 0, 1, null, 18197, null, 'FINSOURCE', 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(18211, 0, 1, null, 18197, null, 'DIRECTIONCLS', 3, 0, 0, 'Направление', '', 11, '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, '', '', '') ;

-- ORMONTHTEMPLATESREFERENCE
CALL FIELDSINFO_IMPORT(18213, 0, 1, null, 18212, 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(18214, 0, 1, null, 18212, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 18189, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18215, 0, 1, null, 18212, null, 'REFCLS', 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(18216, 0, 1, null, 18212, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 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(18217, 0, 1, null, 18212, null, 'KVSR', 3, 0, 0, 'КВСР', '', 11, '999', '', '', 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(18218, 0, 1, null, 18212, 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18219, 0, 1, null, 18212, null, 'KVR', 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18220, 0, 1, null, 18212, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.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(18221, 0, 1, null, 18212, null, 'SUBKESR', 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(18222, 0, 1, null, 18212, null, 'FACIALACC_CLS', 3, 0, 0, 'Лицевой счет', '', 11, '999.99.999.9', '', '', 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(18223, 0, 1, null, 18212, null, 'MEANSTYPE', 3, 0, 0, 'Тип средств', '', 11, '99.99.99', '', '', 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(18224, 0, 1, null, 18212, 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(18225, 0, 1, null, 18212, null, 'FINSOURCE', 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, '', '', '') ;

-- ORQUARTERDETAIL
CALL FIELDSINFO_IMPORT(18227, 0, 1, null, 18226, 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(18228, 0, 1, null, 18226, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 18153, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18229, 0, 1, null, 18226, 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18230, 0, 1, null, 18226, null, 'SUMMA', 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(18231, 0, 1, null, 18226, 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(18232, 0, 1, null, 18226, 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(18233, 0, 1, null, 18226, 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(18234, 0, 1, null, 18226, 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, '', '', '') ;

-- ORQUARTERTEMPLATESTITLE
CALL FIELDSINFO_IMPORT(18236, 0, 1, null, 18235, 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(18237, 0, 1, null, 18235, 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(18238, 0, 1, null, 18235, null, 'USERNAME', 1, 0, 30, '', '', 30, '', '', '', 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(18239, 0, 1, null, 18235, null, 'ACC_REF', 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(18240, 0, 1, null, 18235, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.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(18241, 0, 1, null, 18235, null, 'FINTYPE', 3, 0, 0, 'Тип финансирования', '', 11, '9.99', '', '', 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(18242, 0, 1, null, 18235, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 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(18243, 0, 1, null, 18235, null, 'KVSR', 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18244, 0, 1, null, 18235, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 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(18245, 0, 1, null, 18235, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORQUARTERTEMPLATESDETAIL
CALL FIELDSINFO_IMPORT(18247, 0, 1, null, 18246, 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(18248, 0, 1, null, 18246, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 18235, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18249, 0, 1, null, 18246, null, 'KESR', 3, 0, 0, 'ЭКР', '', 11, '9.9.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, '', '', '') ;

-- ORMEANSTITLE
CALL FIELDSINFO_IMPORT(18251, 0, 1, null, 18250, 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(18252, 0, 1, null, 18250, null, 'INPUTDATE', 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(18253, 0, 1, null, 18250, null, 'ACC_REF', 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(18254, 0, 1, null, 18250, 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(18255, 0, 1, null, 18250, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '999', '', '', 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(18256, 0, 1, null, 18250, null, 'QUARTER', 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(18257, 0, 1, null, 18250, 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(18258, 0, 1, null, 18250, 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(18259, 0, 1, null, 18250, 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(18260, 0, 1, null, 18250, 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(18261, 0, 1, null, 18250, 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, '', '', '') ;

-- ORMEANSDETAIL
CALL FIELDSINFO_IMPORT(18263, 0, 1, null, 18262, 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(18264, 0, 1, null, 18262, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 18250, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18265, 0, 1, null, 18262, null, 'MEANSCLS', 3, 0, 0, 'КОС', '', 11, '999', '', '', 0, 0, null, 1, 16904, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18266, 0, 1, null, 18262, null, 'SUMMA', 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(18267, 0, 1, null, 18262, 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(18268, 0, 1, null, 18262, 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(18269, 0, 1, null, 18262, 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(18270, 0, 1, null, 18262, 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, '', '', '') ;

-- ORMEANSTEMPLATESTITLE
CALL FIELDSINFO_IMPORT(18272, 0, 1, null, 18271, 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(18273, 0, 1, null, 18271, 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(18274, 0, 1, null, 18271, null, 'USERNAME', 1, 0, 30, '', '', 30, '', '', '', 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(18275, 0, 1, null, 18271, null, 'ACC_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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18276, 0, 1, null, 18271, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.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, '', '', '') ;

-- ORMEANSTEMPLATESDETAIL
CALL FIELDSINFO_IMPORT(18278, 0, 1, null, 18277, 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(18279, 0, 1, null, 18277, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 18271, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18280, 0, 1, null, 18277, null, 'MEANSCLS', 3, 0, 0, '', '', 11, '999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORSTAFFTITLE
CALL FIELDSINFO_IMPORT(18282, 0, 1, null, 18281, 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(18283, 0, 1, null, 18281, null, 'INPUTDATE', 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(18284, 0, 1, null, 18281, null, 'ACC_REF', 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(18285, 0, 1, null, 18281, 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(18286, 0, 1, null, 18281, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '999', '', '', 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(18287, 0, 1, null, 18281, null, 'QUARTER', 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(18288, 0, 1, null, 18281, 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(18289, 0, 1, null, 18281, 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(18290, 0, 1, null, 18281, 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18291, 0, 1, null, 18281, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 0, 0, null, 1, 16864, 0, 0, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18292, 0, 1, null, 18281, null, 'SUBKCSR', 3, 0, 0, 'Суб.КЦСР', '', 11, '999', '', '', 0, 0, null, 1, 16886, 0, 0, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18293, 0, 1, null, 18281, 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(18294, 0, 1, null, 18281, 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(18295, 0, 1, null, 18281, 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(18296, 0, 1, null, 18281, 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(18297, 0, 1, null, 18281, 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18298, 0, 1, null, 18281, null, 'AYEAR', 3, 0, 0, 'Год', '', 11, '9999', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORSTAFFDETAIL
CALL FIELDSINFO_IMPORT(18300, 0, 1, null, 18299, 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(18301, 0, 1, null, 18299, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 18281, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18302, 0, 1, null, 18299, null, 'KSHK', 3, 0, 0, 'КСШК', '', 11, '999.99.99', '', '', 0, 0, null, 1, 16883, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18303, 0, 1, null, 18299, null, 'SUMMA', 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(18304, 0, 1, null, 18299, 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(18305, 0, 1, null, 18299, 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(18306, 0, 1, null, 18299, 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(18307, 0, 1, null, 18299, 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, '', '', '') ;

-- ORSTAFFTEMPLATESTITLE
CALL FIELDSINFO_IMPORT(18309, 0, 1, null, 18308, 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(18310, 0, 1, null, 18308, 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(18311, 0, 1, null, 18308, null, 'USERNAME', 1, 0, 30, '', '', 30, '', '', '', 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(18312, 0, 1, null, 18308, null, 'ACC_REF', 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(18313, 0, 1, null, 18308, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.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(18314, 0, 1, null, 18308, null, 'KFSR', 3, 0, 0, 'ФКР', '', 11, '99.99', '', '', 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(18315, 0, 1, null, 18308, 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18316, 0, 1, null, 18308, null, 'KCSR', 3, 0, 0, 'КЦСР', '', 11, '999.99.99', '', '', 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(18317, 0, 1, null, 18308, null, 'KVR', 3, 0, 0, 'КВР', '', 11, '999', '', '', 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(18318, 0, 1, null, 18308, null, 'SUBKCSR', 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, '', '', '') ;

-- ORVALUETITLE
CALL FIELDSINFO_IMPORT(18320, 0, 1, null, 18319, 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(18321, 0, 1, null, 18319, null, 'INPUTDATE', 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(18322, 0, 1, null, 18319, null, 'ACC_REF', 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(18323, 0, 1, null, 18319, 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(18324, 0, 1, null, 18319, null, 'BUDGETREF', 3, 0, 0, 'Код бюджета', '', 11, '999', '', '', 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(18325, 0, 1, null, 18319, null, 'QUARTER', 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(18326, 0, 1, null, 18319, 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(18327, 0, 1, null, 18319, 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(18328, 0, 1, null, 18319, 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(18329, 0, 1, null, 18319, 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(18330, 0, 1, null, 18319, 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, '', '', '') ;

-- ORSTAFFTEMPLATESDETAIL
CALL FIELDSINFO_IMPORT(18332, 0, 1, null, 18331, 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(18333, 0, 1, null, 18331, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 18308, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18334, 0, 1, null, 18331, null, 'KSHK', 3, 0, 0, '', '', 11, '999.99.99', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

-- ORVALUEDETAIL
CALL FIELDSINFO_IMPORT(18336, 0, 1, null, 18335, 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(18337, 0, 1, null, 18335, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 18319, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18338, 0, 1, null, 18335, null, 'VALUECLS', 3, 0, 0, 'КМЦ', '', 11, '999', '', '', 0, 0, null, 1, 16907, 0, 0, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18339, 0, 1, null, 18335, null, 'SUMMA', 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(18340, 0, 1, null, 18335, 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(18341, 0, 1, null, 18335, 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(18342, 0, 1, null, 18335, 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(18343, 0, 1, null, 18335, 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, '', '', '') ;

-- ORVALUETEMPLATESTITLE
CALL FIELDSINFO_IMPORT(18345, 0, 1, null, 18344, 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(18346, 0, 1, null, 18344, 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(18347, 0, 1, null, 18344, null, 'USERNAME', 1, 0, 30, '', '', 30, '', '', '', 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(18348, 0, 1, null, 18344, null, 'ACC_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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18349, 0, 1, null, 18344, null, 'REGIONCLS', 3, 0, 0, 'Район', '', 11, '99.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, '', '', '') ;

-- ORVALUETEMPLATESDETAIL
CALL FIELDSINFO_IMPORT(18351, 0, 1, null, 18350, 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(18352, 0, 1, null, 18350, null, 'TITLE_REF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, 18344, 1, 0, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18353, 0, 1, null, 18350, null, 'VALUECLS', 3, 0, 0, '', '', 11, '999', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 3, 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, '', '', '') ;

-- DELOIN
CALL FIELDSINFO_IMPORT(18608, 0, 1, null, 18607, 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(18609, 0, 1, null, 18607, null, 'TYPEDOC', 3, 0, 0, 'Тип документа', '', 10, '99.99.999', '', '', 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(18610, 0, 1, null, 18607, null, 'NUMBERIN', 1, 0, 16, 'Вх. №', '', 16, '', '', '', 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(18611, 0, 1, null, 18607, null, 'DATEIN', 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(18612, 0, 1, null, 18607, null, 'CORRESPONDENT', 3, 0, 0, 'Корреспондент', '', 4, '999', '', '', 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(18613, 0, 1, null, 18607, null, 'DATEOUT', 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(18614, 0, 1, null, 18607, null, 'NUMBEROUT', 1, 0, 16, 'Исх. №', '', 16, '', '', '', 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(18615, 0, 1, null, 18607, null, 'CONTENTS', 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(18616, 0, 1, null, 18607, null, 'RESOLUTION', 3, 0, 0, 'Резолюция', '', 4, '999', '', '', 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(18617, 0, 1, null, 18607, null, 'DATEEXEC', 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(18618, 0, 1, null, 18607, null, 'GRIF', 3, 0, 0, 'Гриф', '', 4, '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(18619, 0, 1, null, 18607, null, 'DATEANSWER', 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18620, 0, 1, null, 18607, null, 'TOM', 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(18621, 0, 1, null, 18607, 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(18622, 0, 1, null, 18607, null, 'CREATEDATE', 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, 0, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18623, 0, 1, null, 18607, 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(18624, 0, 1, null, 18607, 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(18625, 0, 1, null, 18607, null, 'NEEDCARD', 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(18626, 0, 1, null, 18607, null, 'DELO', 1, 0, 13, 'Дело', '', 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, '', '', '') ;

-- 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(32318, 0, 1, null, 18627, null, 'FUID', 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, 0, 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, '', '', '') ;

-- DELOOUT
CALL FIELDSINFO_IMPORT(18674, 0, 1, null, 18673, 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(18675, 0, 1, null, 18673, null, 'TYPEDOC', 3, 0, 0, 'Тип документа', '', 11, '99.99.999', '', '', 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(18676, 0, 1, null, 18673, null, 'CORRESPONDENT', 3, 0, 0, 'Кореспондент', '', 11, '999', '', '', 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(18677, 0, 1, null, 18673, null, 'DATEOUT', 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(18678, 0, 1, null, 18673, null, 'NUMBEROUT', 1, 0, 16, 'Исх. №', '', 16, '', '', '', 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(18679, 0, 1, null, 18673, null, 'CONTENTS', 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(18680, 0, 1, null, 18673, null, 'GRIF', 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18681, 0, 1, null, 18673, null, 'EXECUTOR', 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, 1, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(18682, 0, 1, null, 18673, 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(18683, 0, 1, null, 18673, 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(18684, 0, 1, null, 18673, 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(18685, 0, 1, null, 18673, 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, '', '', '') ;

-- DELOEXEC
CALL FIELDSINFO_IMPORT(18687, 0, 1, null, 18686, 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(18688, 0, 1, null, 18686, null, 'DOCID', 3, 0, 0, 'ID документа', '', 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(18689, 0, 1, null, 18686, null, 'OTDEL', 3, 0, 0, 'Отдел', '', 6, '99.99', '', '', 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(18690, 0, 1, null, 18686, null, 'EXECUTOR', 3, 0, 0, 'Исполнитель', '', 4, '999', '', '', 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(18691, 0, 1, null, 18686, null, 'DATETO', 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(18692, 0, 1, null, 18686, null, 'DATEBACK', 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(18693, 0, 1, null, 18686, 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(18694, 0, 1, null, 18686, 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(18695, 0, 1, null, 18686, 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(18696, 0, 1, null, 18686, 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, '', '', '') ;

-- DELOEXECUTOR
CALL FIELDSINFO_IMPORT(18698, 0, 1, null, 18697, 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(18699, 0, 1, null, 18697, null, 'NAME', 1, 0, 32, 'Наименование', '', 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(18700, 0, 1, null, 18697, null, 'FULLNAME', 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(18701, 0, 1, null, 18697, null, 'PHONE', 1, 0, 32, '', '', 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, '', '', '') ;

-- DELOOTDEL
CALL FIELDSINFO_IMPORT(18703, 0, 1, null, 18702, 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(18704, 0, 1, null, 18702, null, 'GR1', 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(18705, 0, 1, null, 18702, null, 'GR2', 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(18706, 0, 1, null, 18702, 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, 1, 1, '', '', '') ;

-- DELOGRIF
CALL FIELDSINFO_IMPORT(18708, 0, 1, null, 18707, 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(18709, 0, 1, null, 18707, 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, '', '', '') ;

-- DELORESOLUTION
CALL FIELDSINFO_IMPORT(18711, 0, 1, null, 18710, 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(18712, 0, 1, null, 18710, 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, '', '', '') ;

-- DELOCORRESPONDENT
CALL FIELDSINFO_IMPORT(18714, 0, 1, null, 18713, 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(18715, 0, 1, null, 18713, 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, '', '', '') ;

-- 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32319, 0, 1, null, 18732, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32320, 0, 1, null, 18732, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32321, 0, 1, null, 18732, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32322, 0, 1, null, 18732, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32323, 0, 1, null, 18732, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32324, 0, 1, null, 18732, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32325, 0, 1, null, 18732, null, 'SOFTREJECTCLS', 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, 0, 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(32272, 0, 1, null, 18864, null, 'FUID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, '', '', '') ;

-- 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(32263, 0, 1, null, 18947, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32264, 0, 1, null, 18947, null, 'DOCSUSPENDED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32265, 0, 1, null, 18947, null, 'FAXDOCSINFO', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32266, 0, 1, null, 18947, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32267, 0, 1, null, 18947, null, 'ISINBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32268, 0, 1, null, 18947, null, 'ISVISED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32269, 0, 1, null, 18947, null, 'REESTRNUMBER', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32270, 0, 1, null, 18947, null, 'SOFTREJECTCAUSE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32271, 0, 1, null, 18947, null, 'SOFTREJECTCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, '', '', '') ;

-- 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(32369, 0, 1, null, 19016, null, 'FUID', 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, 0, 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(32273, 0, 1, null, 19088, null, 'FUID', 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, 0, 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(32250, 0, 1, null, 19736, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32251, 0, 1, null, 19736, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32252, 0, 1, null, 19736, null, 'FAILNOTE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32253, 0, 1, null, 19736, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32254, 0, 1, null, 19736, null, 'FUINNERNUMBER', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32255, 0, 1, null, 19736, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32256, 0, 1, null, 19736, null, 'ISINBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 52, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32257, 0, 1, null, 19736, null, 'ISVISED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32258, 0, 1, null, 19736, null, 'SOFTREJECTCAUSE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32259, 0, 1, null, 19736, null, 'SOFTREJECTCLS', 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, 0, 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(32179, 0, 1, null, 19795, null, 'BEGINDOCSTATEREF', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32180, 0, 1, null, 19795, null, 'DOCSUSPENDED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32181, 0, 1, null, 19795, null, 'FAILNOTE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32182, 0, 1, null, 19795, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32183, 0, 1, null, 19795, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32184, 0, 1, null, 19795, null, 'ISINBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

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(32185, 0, 1, null, 19795, null, 'ISVISED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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(32186, 0, 1, null, 19795, null, 'SOFTREJECTCAUSE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32187, 0, 1, null, 19795, null, 'SOFTREJECTCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(35082, 0, 1, null, 20054, null, 'ADDITIONALINFO', 15, 0, 0, '', '', 17, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32188, 0, 1, null, 20107, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32189, 0, 1, null, 20107, null, 'ISDELETED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32248, 0, 1, null, 20127, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32249, 0, 1, null, 20127, null, 'ISDELETED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32260, 0, 1, null, 20153, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32261, 0, 1, null, 20153, null, 'ISDELETED', 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, 0, 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(32360, 0, 1, null, 20221, null, 'FUID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 94, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32361, 0, 1, null, 20221, null, 'ISDELETED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32331, 0, 1, null, 20497, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32332, 0, 1, null, 20497, 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32333, 0, 1, null, 20497, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32334, 0, 1, null, 20497, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32335, 0, 1, null, 20497, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32336, 0, 1, null, 20497, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32337, 0, 1, null, 20497, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32338, 0, 1, null, 20497, null, 'SOFTREJECTCLS', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32378, 0, 1, null, 20652, null, 'FUID', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32379, 0, 1, null, 20666, null, 'FUID', 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, 0, 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(32398, 0, 1, null, 20694, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32399, 0, 1, null, 20694, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32400, 0, 1, null, 20694, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32401, 0, 1, null, 20694, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32402, 0, 1, null, 20694, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32403, 0, 1, null, 20694, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32404, 0, 1, null, 20694, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32405, 0, 1, null, 20694, null, 'SOFTREJECTCLS', 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, 0, 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, '', '', '') ;

-- 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, '', '', '') ;

-- 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(32451, 0, 1, null, 20983, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32452, 0, 1, null, 20983, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32453, 0, 1, null, 20983, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32454, 0, 1, null, 20983, null, 'ISINBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32455, 0, 1, null, 20983, null, 'ISVISED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32456, 0, 1, null, 20983, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32457, 0, 1, null, 20983, null, 'SOFTREJECTCLS', 3, 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, 0, 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(32406, 0, 1, null, 21028, null, 'FUID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32407, 0, 1, null, 21028, null, 'ISDELETED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 108, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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(32458, 0, 1, null, 21131, null, 'FUID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 117, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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(32385, 0, 1, null, 21275, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32386, 0, 1, null, 21275, null, 'DOCSUSPENDED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32387, 0, 1, null, 21275, null, 'FAILNOTE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32388, 0, 1, null, 21275, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32389, 0, 1, null, 21275, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32390, 0, 1, null, 21275, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32391, 0, 1, null, 21275, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32392, 0, 1, null, 21275, null, 'SOFTREJECTCAUSE', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 59, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32393, 0, 1, null, 21275, null, 'SOFTREJECTCLS', 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, 0, 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(35369, 0, 1, null, 21275, null, 'PREFERENCEORG', 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, 0, 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(35371, 0, 1, null, 21275, null, 'PREFERENCEUIS', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35372, 0, 1, null, 21275, null, 'SUPPORTAGREEMENT', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35373, 0, 1, null, 21275, null, 'SUPPORTTENDER', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35374, 0, 1, null, 21275, null, 'TENDERAVANS', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(35375, 0, 1, null, 21275, null, 'TENDERSOCIALNKO', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 67, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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(32434, 0, 1, null, 21356, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32435, 0, 1, null, 21356, null, 'ISDELETED', 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, 0, 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(32426, 0, 1, null, 21369, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32427, 0, 1, null, 21369, null, 'DOCSUSPENDED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32428, 0, 1, null, 21369, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32429, 0, 1, null, 21369, null, 'ISDELETED', 3, 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32430, 0, 1, null, 21369, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32431, 0, 1, null, 21369, null, 'ISVISED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32432, 0, 1, null, 21369, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32433, 0, 1, null, 21369, null, 'SOFTREJECTCLS', 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, 0, 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, '', '', '') ;

-- 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, '', '', '') ;

-- 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(32442, 0, 1, null, 21681, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32443, 0, 1, null, 21681, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32444, 0, 1, null, 21681, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32445, 0, 1, null, 21681, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32446, 0, 1, null, 21681, null, 'ISVISED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32448, 0, 1, null, 21681, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32449, 0, 1, null, 21681, null, 'SOFTREJECTCLS', 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, 0, 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(32450, 0, 1, null, 21709, null, 'FUID', 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, 0, 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, '', '', '') ;

-- 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32214, 0, 1, null, 21896, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32215, 0, 1, null, 21896, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32216, 0, 1, null, 21896, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32217, 0, 1, null, 21896, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32218, 0, 1, null, 21896, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32219, 0, 1, null, 21896, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32220, 0, 1, null, 21896, null, 'SOFTREJECTCLS', 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, 0, 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(32394, 0, 1, null, 21916, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32395, 0, 1, null, 21916, null, 'ISDELETED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32475, 0, 1, null, 21929, null, 'FUID', 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, 0, 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(32440, 0, 1, null, 21942, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32441, 0, 1, null, 21942, null, 'ISDELETED', 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, 0, 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(32438, 0, 1, null, 21964, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32439, 0, 1, null, 21964, null, 'ISDELETED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32239, 0, 1, null, 21978, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32240, 0, 1, null, 21978, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32241, 0, 1, null, 21978, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32242, 0, 1, null, 21978, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32243, 0, 1, null, 21978, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32244, 0, 1, null, 21978, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32245, 0, 1, null, 21978, null, 'SOFTREJECTCLS', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32246, 0, 1, null, 21990, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32247, 0, 1, null, 21990, null, 'ISDELETED', 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, 0, 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(32305, 0, 1, null, 22024, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32306, 0, 1, null, 22024, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32307, 0, 1, null, 22024, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32308, 0, 1, null, 22024, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32309, 0, 1, null, 22024, null, 'ISVISED', 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, 0, 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(32294, 0, 1, null, 22042, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32295, 0, 1, null, 22042, null, 'ISDELETED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32288, 0, 1, null, 22075, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32289, 0, 1, null, 22075, null, 'ISDELETED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32300, 0, 1, null, 22089, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32301, 0, 1, null, 22089, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32302, 0, 1, null, 22089, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32303, 0, 1, null, 22089, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32304, 0, 1, null, 22089, null, 'ISVISED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32296, 0, 1, null, 22105, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32297, 0, 1, null, 22105, null, 'ISDELETED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32310, 0, 1, null, 22120, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32311, 0, 1, null, 22120, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32312, 0, 1, null, 22120, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32313, 0, 1, null, 22120, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32314, 0, 1, null, 22120, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32315, 0, 1, null, 22120, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32316, 0, 1, null, 22120, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32317, 0, 1, null, 22120, null, 'SOFTREJECTCLS', 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, 0, 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(32290, 0, 1, null, 22143, null, 'FUID', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32291, 0, 1, null, 22143, null, 'ISDELETED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32292, 0, 1, null, 22143, null, 'ISVISED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32293, 0, 1, null, 22143, null, 'SERVERERROR', 1, 0, 255, '', '', 40, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 145, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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(35055, 0, 1, null, 22143, null, 'DOCSUSPENDED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32298, 0, 1, null, 22257, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32299, 0, 1, null, 22257, null, 'ISDELETED', 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, 0, 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, '', '', '') ;

-- 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(32229, 0, 1, null, 22468, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32230, 0, 1, null, 22468, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32231, 0, 1, null, 22468, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32232, 0, 1, null, 22468, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32233, 0, 1, null, 22468, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32234, 0, 1, null, 22468, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32235, 0, 1, null, 22468, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32236, 0, 1, null, 22468, null, 'SOFTREJECTCLS', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32377, 0, 1, null, 22513, null, 'DELETEDCOUNT', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32326, 0, 1, null, 22529, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32327, 0, 1, null, 22529, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32328, 0, 1, null, 22529, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32329, 0, 1, null, 22529, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32330, 0, 1, null, 22529, null, 'ISVISED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32190, 0, 1, null, 22639, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32191, 0, 1, null, 22639, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32192, 0, 1, null, 22639, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32193, 0, 1, null, 22639, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32194, 0, 1, null, 22639, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32195, 0, 1, null, 22639, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32196, 0, 1, null, 22639, null, 'SOFTREJECTCLS', 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, 0, 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(32197, 0, 1, null, 22675, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32198, 0, 1, null, 22675, null, 'FUPARENTID', 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, 0, 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(32396, 0, 1, null, 22697, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32397, 0, 1, null, 22697, null, 'ISDELETED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32383, 0, 1, null, 22727, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32384, 0, 1, null, 22727, null, 'ISDELETED', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(32286, 0, 1, null, 22838, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32287, 0, 1, null, 22838, null, 'ISDELETED', 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, 0, 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(32221, 0, 1, null, 22843, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32222, 0, 1, null, 22843, null, 'DOCSUSPENDED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 76, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32223, 0, 1, null, 22843, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32224, 0, 1, null, 22843, null, 'ISINBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 78, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32225, 0, 1, null, 22843, null, 'ISVISED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32226, 0, 1, null, 22843, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32227, 0, 1, null, 22843, null, 'SOFTREJECTCLS', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, '', '', '') ;

-- 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(32228, 0, 1, null, 22908, null, 'FUID', 3, 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, 0, 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(32436, 0, 1, null, 22961, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32437, 0, 1, null, 22961, null, 'ISDELETED', 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, 0, 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(32408, 0, 1, null, 22990, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32409, 0, 1, null, 22990, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32410, 0, 1, null, 22990, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32411, 0, 1, null, 22990, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32412, 0, 1, null, 22990, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32413, 0, 1, null, 22990, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32414, 0, 1, null, 22990, null, 'SOFTREJECTCLS', 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, 0, 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(32415, 0, 1, null, 23004, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32416, 0, 1, null, 23004, null, 'ISDELETED', 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, 0, 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(32424, 0, 1, null, 23023, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32425, 0, 1, null, 23023, null, 'ISDELETED', 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, 0, 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(32417, 0, 1, null, 23037, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32418, 0, 1, null, 23037, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32419, 0, 1, null, 23037, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32420, 0, 1, null, 23037, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32421, 0, 1, null, 23037, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32422, 0, 1, null, 23037, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32423, 0, 1, null, 23037, null, 'SOFTREJECTCLS', 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, 0, 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(32461, 0, 1, null, 23400, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32462, 0, 1, null, 23400, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32463, 0, 1, null, 23400, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32464, 0, 1, null, 23400, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32465, 0, 1, null, 23400, null, 'ISINBUDGET', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32466, 0, 1, null, 23400, null, 'ISVISED', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 0, 0, '', 61, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32467, 0, 1, null, 23400, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32468, 0, 1, null, 23400, null, 'SOFTREJECTCLS', 3, 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, 0, 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(32469, 0, 1, null, 23401, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32470, 0, 1, null, 23401, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32471, 0, 1, null, 23401, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32472, 0, 1, null, 23401, null, 'LASTEXTRCHANGE', 11, 0, 0, 'Дата экстренного изменения', '', 20, '', '', '', 0, 0, null, 0, null, 0, 0, 0, '', 54, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, '', '', '') ;

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(35117, 0, 1, null, 30656, null, 'FUID', 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, 0, 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, '', '', '') ;

CALL FIELDSINFO_IMPORT(35376, 0, 1, null, 30657, null, 'ISLOCAL', 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, 0, 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(32473, 0, 1, null, 31615, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32474, 0, 1, null, 31615, null, 'ISDELETED', 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, 0, 1, '', '', '') ;

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(32277, 0, 1, null, 31617, null, 'FUID', 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, 0, 1, '', '', '') ;

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(32278, 0, 1, null, 31618, null, 'BEGINDOCSTATEREF', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32279, 0, 1, null, 31618, null, 'DOCSUSPENDED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32280, 0, 1, null, 31618, null, 'FUID', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32281, 0, 1, null, 31618, null, 'ISINBUDGET', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32282, 0, 1, null, 31618, null, 'ISVISED', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32283, 0, 1, null, 31618, null, 'SOFTREJECTCAUSE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32284, 0, 1, null, 31618, null, 'SOFTREJECTCLS', 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, 0, 1, '', '', '') ;

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, '', '', '') ;

-- CLIENTSESSIONS
CALL FIELDSINFO_IMPORT(32208, 0, 1, null, 32177, 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32209, 0, 1, null, 32177, 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32210, 0, 1, null, 32177, null, 'LASTACTIVITYDATE', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32211, 0, 1, null, 32177, null, 'SESSIONDATA', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32212, 0, 1, null, 32177, null, 'SESSIONIDENTIFIER', 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32213, 0, 1, null, 32177, null, 'UPDATEDATE', 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, 1, 0, 1, '', '', '') ;

-- SERVERSESSIONS
CALL FIELDSINFO_IMPORT(32380, 0, 1, null, 32178, 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, 0, 1, '', '', '') ;

CALL FIELDSINFO_IMPORT(32381, 0, 1, null, 32178, null, 'SESSIONID', 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, 0, 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, '', '', '') ;

-- CLS_302
CALL FIELDSINFO_IMPORT(32743, 0, 2, 18979, 32867, 32868, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 1, 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, 1, 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, 1, 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, 1, 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, 1, 16857, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 21634, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16824, 0, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '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, 1, 0, '', 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

-- CLS_304
CALL FIELDSINFO_IMPORT(34404, 0, 2, 18979, 34400, 34401, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 1, 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, 1, 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, 1, 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, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16824, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', 'DOCCHANGEDATE', '') ;

-- CLS_305
CALL FIELDSINFO_IMPORT(34428, 0, 2, 18983, 34424, 34426, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16824, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 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, 1, 17129, 0, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', '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, 1, 0, '', 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'REJECT_CLS', '') ;

-- CLS_303
CALL FIELDSINFO_IMPORT(34452, 0, 2, 18979, 34448, 34450, 'CREATERUSER', 1, 0, 30, 'АвторДокумента', 'Автор', 30, '', '', '', 1, 0, null, 1, null, 0, 1, 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, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 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, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', 'DOCCHANGEDATE', '') ;

-- CLS_306
CALL FIELDSINFO_IMPORT(34475, 0, 2, 18983, 34471, 34473, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 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, 1, 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, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16824, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', 'DOCCHANGEDATE', '') ;

-- CLS_312
CALL FIELDSINFO_IMPORT(34498, 0, 2, 18983, 34494, 34496, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 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, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16824, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', 'DOCCHANGEDATE', '') ;

-- CLS_311
CALL FIELDSINFO_IMPORT(34521, 0, 2, 18983, 34517, 34519, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16824, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', 'DOCCHANGEDATE', '') ;

-- CLS_314
CALL FIELDSINFO_IMPORT(34543, 0, 2, 18983, 34539, 34541, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 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, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16824, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', 'DOCCHANGEDATE', '') ;

-- CLS_315
CALL FIELDSINFO_IMPORT(34566, 0, 2, 18983, 34562, 34564, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 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, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16824, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 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, 1, 16964, 0, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', 'DOCCHANGEDATE', '') ;

-- CLS_322
CALL FIELDSINFO_IMPORT(34592, 0, 2, 18983, 34588, 34590, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 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, 1, 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, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34942, 0, 2, 18972, 34588, 34590, 'REJECT_CLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', 'DOCCHANGEDATE', '') ;

-- CLS_323
CALL FIELDSINFO_IMPORT(34614, 0, 2, 18983, 34610, 34612, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 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, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, '', 'DOCCHANGEDATE', '') ;

-- CLS_201
CALL FIELDSINFO_IMPORT(35715, 0, 2, 17474, 34631, 34632, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34644, 0, 2, 17429, 34631, 34633, '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, 3, '', 'DETAILUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34645, 0, 2, 17472, 34631, 34632, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34648, 0, 2, 17479, 34631, 34632, 'UPDATEDATE', 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, 1, 2, 3, '', 'CAPTIONUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34649, 0, 2, 17418, 34631, 34633, 'FACT', 3, 0, 0, 'Мероприятие', 'Классификатор мероприятия', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

-- CLS_202
CALL FIELDSINFO_IMPORT(35716, 0, 2, 17474, 34650, 34652, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34676, 0, 2, 17429, 34650, 34653, '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, 3, '', 'DETAILUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34677, 0, 2, 17472, 34650, 34652, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34680, 0, 2, 17479, 34650, 34652, '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, 3, '', 'CAPTIONUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34876, 0, 2, 17485, 34650, 34652, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

-- ДАННЫЕЭЦП
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, 1, 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, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34733, 0, 2, 17429, 34718, 34721, '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, 3, '', 'DETAILUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34734, 0, 2, 17472, 34718, 34720, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34737, 0, 2, 17479, 34718, 34720, '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, 3, '', 'CAPTIONUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34877, 0, 2, 17485, 34718, 34720, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

-- CLS_204
CALL FIELDSINFO_IMPORT(35718, 0, 2, 17474, 34738, 34740, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16824, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34754, 0, 2, 17429, 34738, 34741, '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, 3, '', 'DETAILUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34755, 0, 2, 17472, 34738, 34740, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34758, 0, 2, 17479, 34738, 34740, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', 'dd/mm/yyyy hh:mm:ss', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, '', 'CAPTIONUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34878, 0, 2, 17485, 34738, 34740, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

-- CLS_205
CALL FIELDSINFO_IMPORT(34763, 0, 2, 17450, 34759, 34762, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '000', '000', 0, 0, null, 1, 21555, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 17043, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16824, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBKESR', '') ;

CALL FIELDSINFO_IMPORT(34773, 0, 2, 17429, 34759, 34762, '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, 3, '', 'DETAILUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34774, 0, 2, 17472, 34759, 34761, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34777, 0, 2, 17479, 34759, 34761, 'UPDATEDATE', 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, 1, 2, 3, '', 'CAPTIONUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(35719, 0, 2, 17474, 34759, 34761, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 0, '', 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

-- CLS_206
CALL FIELDSINFO_IMPORT(34783, 0, 2, 17451, 34779, 34782, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34794, 0, 2, 17429, 34779, 34782, '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, 3, '', 'DETAILUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34795, 0, 2, 17472, 34779, 34781, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34798, 0, 2, 17479, 34779, 34781, '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, 3, '', 'CAPTIONUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(35720, 0, 2, 17474, 34779, 34781, 'VARIANT', 3, 0, 0, 'Вариант росписи', 'Вариант росписи', 4, '', '', '', 0, 0, null, 1, null, 0, 1, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'VARIANT', '') ;

CALL FIELDSINFO_IMPORT(34880, 0, 2, 17485, 34779, 34781, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 0, '', 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

-- CLS_207
CALL FIELDSINFO_IMPORT(34803, 0, 2, 17451, 34799, 34802, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16824, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34815, 0, 2, 17429, 34799, 34802, '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, 3, '', 'DETAILUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34816, 0, 2, 17472, 34799, 34801, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 0, '', 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34819, 0, 2, 17479, 34799, 34801, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 20, '99/99/9999', 'dd/mm/yyyy hh:mm:ss', '', 1, 0, null, 1, null, 0, 0, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, '', 'CAPTIONUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34881, 0, 2, 17485, 34799, 34801, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 1, 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, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'TRANSFERTCLS', '') ;

-- CLS_208
CALL FIELDSINFO_IMPORT(34824, 0, 2, 17451, 34820, 34823, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 1, 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, 1, 21555, 0, 1, 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, 1, 17129, 0, 1, 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, 1, 16964, 0, 1, 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, 1, 16857, 0, 1, 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, 1, 16871, 0, 1, 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, 1, 16844, 0, 1, 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, 1, 16864, 0, 1, 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, 1, 16851, 0, 1, 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, 1, 16915, 0, 1, 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, 1, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'SUBSIDYCLS', '') ;

CALL FIELDSINFO_IMPORT(34835, 0, 2, 17429, 34820, 34823, '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, 3, '', 'DETAILUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34836, 0, 2, 17472, 34820, 34822, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 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, 1, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, '', 'CREATERUSER', '') ;

CALL FIELDSINFO_IMPORT(34839, 0, 2, 17479, 34820, 34822, '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, 3, '', 'CAPTIONUPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(34882, 0, 2, 17485, 34820, 34822, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 1, 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, 1, 17311, 0, 1, 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, 1, 16688, 0, 1, 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, 1, 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, 1, 0, '', 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, '', 'VARIANT', '') ;

-- CLS_4903
CALL FIELDSINFO_IMPORT(34843, 0, 2, 30710, 34841, 34842, 'ARCHIVEDOCTYPE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 0, 30654, 0, 1, 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, 1, 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, 1, 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, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(34847, 0, 2, 24707, 34841, 34842, 'PACKETSTATE', 3, 0, 0, '', '', 11, '', '', '', 0, 0, null, 1, null, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, '', 'UPDATEDATE', '') ;

-- CLS_903
CALL FIELDSINFO_IMPORT(35025, 0, 2, 17649, 35019, 35023, 'BUDGETREF', 3, 0, 0, 'КодБюджета', 'Ссылка на бюджет, к которому относится документ', 11, '999', '', '', 0, 0, null, 1, 16803, 0, 1, 0, '', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'BUDGETREF', '') ;

CALL FIELDSINFO_IMPORT(35026, 0, 2, 17647, 35019, 35023, 'INCACCOUNT', 3, 0, 0, 'р\с финоргана', 'Рассчетный счет финансового органа', 11, '', '', '', 0, 0, null, 1, 17108, 0, 1, 0, '', 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'INCACCOUNT', '') ;

CALL FIELDSINFO_IMPORT(35027, 0, 2, 17663, 35019, 35023, 'REJECTCLS', 3, 0, 0, 'Причина отклонения', 'Классификатор причины отклонения', 9, '99.99.99', '', '', 0, 0, null, 0, 17026, 0, 1, 0, '', 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'REJECTCLS', '') ;

CALL FIELDSINFO_IMPORT(35028, 0, 2, 17720, 35019, 35024, 'BUHOPERATIONCLS', 3, 0, 0, 'Бух операция', 'Классификатор бухгалтерских операций по 70Н', 11, '999.99', '', '', 0, 0, null, 1, 21634, 0, 1, 0, '', 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'BUHOPERATIONCLS', '') ;

CALL FIELDSINFO_IMPORT(35029, 0, 2, 17733, 35019, 35024, 'DIRECTIONCLS', 3, 0, 0, 'Направление', 'Классификатор направления расходования средств', 4, '999', '', '', 0, 0, null, 1, 21555, 0, 1, 0, '', 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'DIRECTIONCLS', '') ;

CALL FIELDSINFO_IMPORT(35030, 0, 2, 17697, 35019, 35024, 'FACIALACC_CLS', 3, 0, 0, 'С лицевого счета', 'Лицевой счет', 13, '999.99.999.9', '', '', 0, 0, null, 1, 17129, 0, 1, 0, '', 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'FACIALACC_CLS', '') ;

CALL FIELDSINFO_IMPORT(35031, 0, 2, 17710, 35019, 35024, 'FACT', 3, 0, 0, 'С мероприятия', 'Мероприятие', 9, '99.99.99', '', '', 0, 0, null, 1, 16964, 0, 1, 0, '', 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'FACT', '') ;

CALL FIELDSINFO_IMPORT(35032, 0, 2, 17721, 35019, 35024, 'IFS', 3, 0, 0, 'Источник внутреннего финансирования(ключ)', 'Ключ источника внутреннего финансирования', 11, '', '', '', 0, 0, null, 1, 17043, 0, 1, 0, '', 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'IFS', '') ;

CALL FIELDSINFO_IMPORT(35033, 0, 2, 17680, 35019, 35024, 'KD', 3, 0, 0, 'КД', 'Ссылка на код дохода', 11, '9.99.99.99.99', '', '', 0, 0, null, 1, 16824, 0, 1, 0, '', 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'KD', '') ;

CALL FIELDSINFO_IMPORT(35034, 0, 2, 17699, 35019, 35024, 'MEANSTYPE', 3, 0, 0, 'Тип средств', 'Классификатор типа средств', 9, '99.99.99', '', '', 0, 0, null, 1, 17311, 0, 1, 0, '', 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'MEANSTYPE', '') ;

CALL FIELDSINFO_IMPORT(35035, 0, 2, 17682, 35019, 35024, 'REGIONCLS', 3, 0, 0, 'Район', 'Классификатор районов', 9, '99.99.99', '', '', 0, 0, null, 1, 16688, 0, 1, 0, '', 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'REGIONCLS', '') ;

CALL FIELDSINFO_IMPORT(35036, 0, 2, 17681, 35019, 35024, 'SUBKD', 3, 0, 0, 'СубКД', 'Классификатор суб кода дохода', 9, '99.99.99', '', '', 0, 0, null, 1, 16928, 0, 1, 0, '', 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'SUBKD', '') ;

CALL FIELDSINFO_IMPORT(35037, 0, 2, 26627, 35019, 35024, 'SUBSIDYCLS', 3, 0, 0, '', '', 12, '', '', '', 0, 0, null, 0, 26536, 0, 1, 0, '', 13, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', '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, 1, 0, '', 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, '', 'TRANSFERTCLS', '') ;

CALL FIELDSINFO_IMPORT(35039, 0, 2, 17690, 35019, 35024, 'UPDATEDATE', 11, 0, 0, 'Дата время изменения', 'Дата изменения', 11, '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, 3, '', 'UPDATEDATE', '') ;

CALL FIELDSINFO_IMPORT(35040, 0, 2, 17652, 35019, 35023, '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, 2, 3, '', 'UPDATEDATE_35040', '') ;

CALL FIELDSINFO_IMPORT(35041, 0, 2, 17650, 35019, 35023, 'CREATERUSER', 1, 0, 30, 'Автор(Авторизация)', '', 30, '', '', '', 1, 0, null, 1, null, 0, 1, 0, '', 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, '', 'CREATERUSER', '') ;

-- События выборок
CALL SELECTIONEVENTS_IMPORT(34715, 34700, 1, 'КриптоБДИнициализацияДанныхКэш') ;

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(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(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(991700, 9917, 'Константы', ' ', ' ', ' ', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(991200, 9912, 'Заголовок', 'DFACCOUNTSBUHTABLE', ' ', '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(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(250202, 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(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(250402, 2504, 'Смета муниципального контракта', 'ESTIMATE', 'ESTIMATE', 'ID', 'ID', 'RECORDINDEX', 'RECORDINDEX', 0, null, null, null) ;

CALL ImportDocCLS(250403, 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, 555) ;

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(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', 'EXECUTIONEREF', '', 0, null, null, 308) ;

CALL ImportDocCLS(181400, 1814, 'Заголовок', 'BANKEXCH_LS_KB', ' ', 'ID', ' ', '', '', 0, null, null, null) ;

CALL ImportDocCLS(181500, 1815, 'Заголовок', 'BANKEXCH_KO_SALDO', ' ', '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(250203, 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
) 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(20901002) ;

CALL DeleteFields(20901003) ;

CALL DeleteFields(20900004) ;

CALL DeleteFields(20901013) ;

CALL DeleteFields(20901024) ;

CALL DeleteFields(20901026) ;

CALL DeleteFields(20901029) ;

CALL DeleteFields(20901030) ;

CALL DeleteFields(90101063) ;

CALL DeleteFields(90101064) ;

CALL DeleteFields(90101054) ;

CALL DeleteFields(90101040) ;

CALL DeleteFields(90101007) ;

CALL DeleteFields(220110066) ;

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(991610100) ;

CALL DeleteFields(991610122) ;

CALL DeleteFields(991610211) ;

CALL DeleteFields(991610198) ;

-- Сводные распоряжения на финансирование, Бюджет(1)
CALL ImportField(10111015, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор', ' ', 1, 101, 1, 0, '', 0, 25472) ;

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(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(10113103, 'Администратор(Источники внутреннего и внешнего финансирования)', 'IFSKVSRCode', 'Администратор', ' ', 1, 101, 3, 0, '', 0, 25472) ;

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(10115138, 'Администратор(Код дохода)', 'KDKVSRCode', 'Администратор', ' ', 1, 101, 5, 0, '', 0, 25472) ;

-- Роспись по ПБС (расходы), Бюджет(1)
CALL ImportField(20110015, 'Главный распорядитель (ссылка)', 'OrgRef', 'Главный распорядитель(ссылка)', 'DestOrgRef', 1, 201, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20111019, 'Получатель (ссылка)', 'Org_Ref', 'Ссылка на орг. получ.', 'Org_Ref_Det', 1, 201, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

CALL ImportField(20111051, 'Получатель', 'OrgNameAndAcc', 'Получатель', ' ', 1, 201, 1, 0, 'НаименованиеОрганизации', 0, null) ;

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) ;

-- СБР (расходы), Бюджет(1)
CALL ImportField(20210039, 'Главный распорядитель (ссылка)', 'OrgRef', 'Главный распорядитель(ссылка)', 'DestOrgRef', 1, 202, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20211038, 'Главный распорядитель (ссылка)', 'Org_Ref', 'Организация', 'Org_Ref_Det', 1, 202, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

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) ;

-- Кассовый план (расходы), Бюджет(1)
CALL ImportField(20310039, 'Главный распорядитель (ссылка)', 'OrgRef', 'Главный распорядитель', 'DestOrgRef', 1, 203, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20311009, 'Операция', 'BuhOperationCLS', 'Операция', 'BuhOperationCLS', 1, 203, 1, 1, 'БухОперация', 0, 17451) ;

CALL ImportField(20311038, 'Организация', 'Org_Ref', 'Организация', 'Org_Ref_Det', 1, 203, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

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) ;

-- Сведения БУ, АУ, Бюджет(1)
CALL ImportField(20410002, 'Главный распорядитель', 'OrgName', 'Получатель', ' ', 1, 204, 0, 0, '', 0, 16646) ;

CALL ImportField(20410039, 'Организация (ссылка)', 'OrgRef', 'Главный распорядитель', 'DestOrgRef', 1, 204, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

CALL ImportField(20411005, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 204, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(20411038, 'Организация (ссылка)', 'Org_Ref', 'Организация (ссылка)', 'Org_Ref_Det', 1, 204, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

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) ;

-- Бюджет, Бюджет(1)
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(20511096, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', 'BudAllocationClsCode', 1, 205, 1, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(20511097, 'Код расходного обязательства', 'PayPromiseClsCode', '', 'PayPromiseClsCode', 1, 205, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

-- ПОФ по ПБС (расходы), Бюджет(1)
CALL ImportField(20611039, 'Организация', 'Org_Ref', 'Организация', 'Org_Ref_Det', 1, 206, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

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) ;

-- Помесячный кассовый план, Бюджет(1)
CALL ImportField(20711005, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 207, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(20711039, 'Организация', 'Org_Ref', 'Организация', 'Org_Ref_Det', 1, 207, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

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) ;

-- Помесячные ПОФ по ПБС, Бюджет(1)
CALL ImportField(20811005, 'Организация', 'OrgNameAndAcc', 'Организация', ' ', 1, 208, 1, 0, 'НаименованиеОрганизации', 0, null) ;

CALL ImportField(20811039, 'Организация', 'Org_Ref', 'Организация', 'Org_Ref_Det', 1, 208, 1, 1, 'ОрганизацияДеталь', 0, 17454) ;

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) ;

-- Подневный ПОФ, Бюджет(1)
CALL ImportField(20910020, 'Главный распорядитель', 'OrgName', 'Главный распорядитель', ' ', 1, 209, 0, 0, '', 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, 'Направление(Классификация)', 'DirectionCLS', 'Направление(Классификация)', 'DestDirectionCLS', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911007, 'Лицевой счет', 'FACIALACC_CLS', 'Лицевой счет', 'DestFacialAccCls', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911008, 'л/с ФК', 'FACIALCODE', 'л/с ФК', ' ', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911009, 'Мероприятие', 'FACT', 'Мероприятие', 'DestFactCls', 1, 209, 1, 1, '', 0, null) ;

CALL ImportField(20911010, 'Тип финансирования', 'FINTYPE', 'Тип финансирования', 'DestFinTypeCls', 1, 209, 1, 1, '', 0, null) ;

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, null) ;

CALL ImportField(20911018, 'ФКР(Классификация)', 'KFSR', 'ФКР(Классификация)', 'DestKfsr', 1, 209, 1, 1, '', 0, null) ;

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, null) ;

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, null) ;

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(20912001, 'Вид ассигнований', 'ASSIGNMENTKIND', 'Вид ассигнований', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912006, 'Направление(Классификация)', 'DirectionCLS', 'Направление(Классификация)', ' ', 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, 'Мероприятие', 'FACT', 'Мероприятие', ' ', 1, 209, 2, 0, '', 0, null) ;

CALL ImportField(20912010, 'Тип финансирования', 'FINTYPE', 'Тип финансирования', ' ', 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) ;

-- Внутренние РР, Бюджет(1)
CALL ImportField(21010022, 'Главный распорядитель', 'ORGREF', 'Главный распорядитель', 'DestOrgRef', 1, 210, 0, 1, 'ОрганизацияЗаголовок', 0, 17484) ;

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(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(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(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) ;

-- Все казначейские документы, Бюджет(1)
CALL ImportField(30010022, 'Код документа', '{РусПоле("КодДокумента")}', 'Код документа', ' ', 1, 300, 0, 1, 'КодДокумента', 0, null) ;

-- Внутренняя переброска, Бюджет(1)
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(30111150, 'Код субсидии получ-ля', 'DestSubsidyClsCode', 'Код субсидии получателя', 'DestSubsidyClsCode', 1, 301, 1, 0, 'КодСубсидииПолуч', 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) ;

-- Выбытия по п\п, Бюджет(1)
CALL ImportField(30210005, 'Очередность платежа', 'PAYPRIORITY', 'Очередность платежа', 'PayPriority', 1, 302, 0, 0, 'Очередность', 0, 18966) ;

CALL ImportField(30210031, 'Номер карточки', 'CardNumber', 'Номер пластиковой карты', 'CARDNUMBER', 1, 302, 0, 1, 'НомерКарточки', 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(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) ;

-- Внутренние зачисления(разассигновка), Бюджет(1)
CALL ImportField(30311019, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор', ' ', 1, 303, 1, 0, '', 0, 25472) ;

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) ;

-- Выбытия по чекам, Бюджет(1)
CALL ImportField(30410129, 'Номер карточки', 'CardNumber', 'Номер пластиковой карты', 'CARDNUMBER', 1, 304, 0, 1, 'НомерКарточки', 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(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) ;

-- Поступления по п\п, Бюджет(1)
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(30511049, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор(расходный источник)', ' ', 1, 305, 1, 0, '', 0, 25472) ;

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) ;

-- Поступление по объявлениям, Бюджет(1)
CALL ImportField(30610144, 'Номер пластиковой карты(ключ)', 'CardRef', 'Код пластиковой карты', 'CardRef', 1, 306, 0, 1, 'КлючПластиковойКарты', 0, 31656) ;

CALL ImportField(30610145, 'Номер пластиковой карты', 'CardRefName', '', ' ', 1, 306, 0, 0, '', 0, 18939) ;

CALL ImportField(30611025, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор ИВФ', ' ', 1, 306, 1, 0, '', 0, 25472) ;

CALL ImportField(30611028, 'Администратор(Классификация)', 'DestKD_KVSRCode', 'Администратор КД', ' ', 1, 306, 1, 0, '', 0, 25472) ;

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) ;

-- Внутренние платежи, Бюджет(1)
CALL ImportField(30811018, 'Тип фин-я получателя(Классификация получателя)', 'DestFinType', 'Тип фин-я получ-ля', 'DestFINTYPECLS', 1, 308, 1, 0, 'ТипФинансированияПолуч', 0, 18902) ;

CALL ImportField(30811019, 'Код дохода ключ получ.', 'DestKD', 'Код дохода получателя (ключ)', 'DESTKD', 1, 308, 1, 1, 'КДКлючПолуч', 0, 18926) ;

CALL ImportField(30811022, 'Администратор получателя(Классификация получателя)', 'DestKD_KVSRCode', 'Администратор получ-ля(Классификация получ-ля)', ' ', 1, 308, 1, 0, '', 0, 25472) ;

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(30811102, 'Код дохода плат.', 'SourceKD_Value', 'Код дохода плательщика', 'SOURCEKDVALUE', 1, 308, 1, 1, 'КодДохода,КодДоходаПлат', 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(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) ;

-- Подтверждение перечисления на счета наличности, Бюджет(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(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, 'Мероприятие(Классификация)', 'DestFACT', 'Мероприятие получателя', 'DestFACTCLS', 1, 312, 1, 0, 'Мероприятие', 0, 18899) ;

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, 'Тип финансирования', 'DestFINTYPE', 'Тип финансирования получателя', 'DestFINTYPECLS', 1, 312, 1, 0, 'ТипФинансирования', 0, 18902) ;

CALL ImportField(31211026, 'Тип документа', 'DestDOCTYPE', 'Тип документа получателя', 'DestDOCTYPECLS', 1, 312, 1, 0, 'ТипДокумента', 0, 18903) ;

CALL ImportField(31211027, 'Направление(Классификация)', 'DestDirectionCLS', 'Направление получателя', 'DestDirectionCLS', 1, 312, 1, 0, 'Направление', 0, 18914) ;

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, 'Документ-основание', 'DestDocBase', 'Документ-основание получателя', 'DESTDOCBASE', 1, 312, 1, 0, 'ТипДокОснования', 0, 18916) ;

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) ;

-- Возврат со счетов наличности, Бюджет(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(31411075, 'Вид источника(Классификация)', 'SourceIFS_DescriptionCode', 'Вид источника(ИвнФ)', 'SourceIFS_DescriptionCode', 1, 314, 1, 0, 'ИсточникВнутрФинансирования', 0, 17050) ;

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) ;

-- Подтверждение возврата со счетов для наличности, Бюджет(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(31511023, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор ИВФ', ' ', 1, 315, 1, 0, '', 0, 25472) ;

CALL ImportField(31511026, 'Администратор(Классификация)', 'DestKD_KVSRCode', 'Администратор КД', ' ', 1, 315, 1, 0, '', 0, 25472) ;

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) ;

-- Учет кассовых выплат, Бюджет(1)
CALL ImportField(32210077, 'УИН(Информация о платеже)', 'UINCode', 'Уникальный идентификатор начисления', 'UINCode', 1, 322, 0, 0, 'УИН', 0, 35367) ;

CALL ImportField(32211030, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор', ' ', 1, 322, 1, 0, '', 0, 25472) ;

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) ;

-- Утверждение ОФ, Бюджет(1)
CALL ImportField(32311021, 'Администратор(Классификация)', 'DestIFS_KVSRCode', 'Администратор', ' ', 1, 323, 1, 0, '', 0, 25472) ;

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) ;

-- Распределение ОФ, Бюджет(1)
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(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) ;

-- Кредиты от кредитных организаций, Бюджет(1)
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(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(40118169, 'Администратор(Источники внутреннего и внешнего финансирования)', 'IFSKVSRCode', '', ' ', 1, 401, 8, 0, '', 0, 25472) ;

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) ;

-- Ссуды юридическим лицам, Бюджет(1)
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(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(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(70111014, 'Администратор(Классификация)', 'IFS_KVSRCode', 'Администратор', ' ', 1, 701, 1, 0, '', 0, 25472) ;

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) ;

-- Свободное финансирование, Бюджет(1)
CALL ImportField(70310011, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор', ' ', 1, 703, 0, 0, '', 0, 25472) ;

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) ;

-- Объемы финансирования, Бюджет(1)
CALL ImportField(80111020, 'ИНН(Организация)', 'INN', 'ИНН', ' ', 1, 801, 1, 0, '', 0, 16645) ;

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) ;

-- Объемы финансирования (линейно), Бюджет(1)
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) ;

-- Заявки на выделение объемов финансирования, Бюджет(1)
CALL ImportField(80311017, 'Администратор(Классификация)', 'SourceIFS_KVSRCode', 'Администратор', ' ', 1, 803, 1, 0, '', 0, 25472) ;

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) ;

-- Доходы, Бюджет(1)
CALL ImportField(90010001, 'Счет ФО', '{РусПоле("РСФО")}', 'Счет ФО', ' ', 1, 900, 0, 0, 'РСФО', 0, null) ;

CALL ImportField(90011008, 'Лицевой счет', '{РусПоле("ЛицевойСчет")}', 'Лицевой счет', ' ', 1, 900, 1, 0, 'ЛицевойСчет', 0, null) ;

-- Распоряжение на возврат доходов, Бюджет(1)
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) ;

-- Внутренние операции (доходы), Бюджет(1)
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) ;

-- Выписка по доходам, Бюджет(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(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) ;

-- Суммы в пути, Бюджет(1)
CALL ImportField(90510005, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор', ' ', 1, 905, 0, 0, '', 0, 25472) ;

CALL ImportField(90510034, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 905, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(90510039, 'Администратор(Классификация)', 'IFS_KVSRCode', '', ' ', 1, 905, 0, 0, '', 0, 25472) ;

-- Невыясненные поступления (устарел), Бюджет(1)
CALL ImportField(90610005, 'Администратор(Код дохода)', 'KDKVSRCode', 'Администратор', ' ', 1, 906, 0, 0, '', 0, 25472) ;

CALL ImportField(90610075, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 906, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(90611027, 'Администратор(Код дохода)', 'KDKVSRCode', 'Администратор', ' ', 1, 906, 1, 0, '', 0, 25472) ;

CALL ImportField(90611076, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 906, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(90611081, 'Код субсидии', 'SubsidyClsCode', '', ' ', 1, 906, 1, 0, 'КодСубсидии', 0, 26641) ;

-- Оперативные данные (доходы), Бюджет(1)
CALL ImportField(90710004, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор', ' ', 1, 907, 0, 0, '', 0, 25472) ;

CALL ImportField(90710044, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', ' ', 1, 907, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

CALL ImportField(90710050, 'Администратор(Классификация)', 'IFS_KVSRCode', '', ' ', 1, 907, 0, 0, '', 0, 25472) ;

CALL ImportField(90710052, 'Код субсидии', 'SubsidyClsCode', '', ' ', 1, 907, 0, 0, 'КодСубсидии', 0, 26641) ;

-- Закрытие года, Бюджет(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(120110065, 'Администратор(Корреспондирующая классификация)', 'IFS_KVSR_corrCode', 'Администратор(Корреспондирующая классификация)', ' ', 1, 1201, 0, 0, '', 0, 25472) ;

CALL ImportField(120110066, 'Тип средств (корренспондирующий)', 'MeansType_corr', 'Тип средств', ' ', 1, 1201, 0, 0, 'ТипСредствНовый', 0, 17372) ;

-- Оперативные данные, Бюджет(1)
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) ;

-- Бюджетные обязательства, Бюджет(1)
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) ;

-- БО.Обязательства - линейно, Бюджет(1)
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) ;

-- Заявки, Бюджет(1)
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) ;

-- Буферный интерфейс поступлений, Бюджет(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(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) ;

-- СБР (источники), Бюджет(1)
CALL ImportField(190111016, 'Администратор(Источники финансирования дефицита)', 'IFS_KVSRCode', 'Администратор', ' ', 1, 1901, 1, 0, '', 0, 25472) ;

CALL ImportField(190111021, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 1901, 1, 0, 'Регион,РайонТрансферта', 0, 17417) ;

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) ;

-- Роспись по АИФ (источники), Бюджет(1)
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(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(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) ;

-- Кассовый план (источники), Бюджет(1)
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(190311049, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 1903, 1, 0, 'Регион,РайонТрансферта', 0, 17417) ;

CALL ImportField(190311076, 'Администратор(Источники финансирования дефицита)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 1903, 1, 0, '', 0, 25472) ;

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) ;

-- ПОФ по АИФ (источники), Бюджет(1)
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(190611050, 'Район трансферта', 'REGIONCLS', 'Район', 'RegionCls', 1, 1906, 1, 0, 'Регион,РайонТрансферта', 0, 17417) ;

CALL ImportField(190611077, 'Администратор(Источники финансирования дефицита)', 'IFS_KVSRCode', 'Администратор(Классификация)', ' ', 1, 1906, 1, 0, '', 0, 25472) ;

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) ;

-- Кассовый план (доходы), Бюджет(1)
CALL ImportField(220111013, 'Администратор(Классификация)', 'KDKVSRCode', 'Администратор', 'KDKVSRCode', 1, 2201, 1, 0, '', 0, 25472) ;

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) ;

-- Государственные контракты, Бюджет(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, 'Мероприятие', 'Fact', '', 'Fact', 2, 2501, 0, 0, '', 0, 19822) ;

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(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, 'Мероприятие', 'Fact', '', 'Fact', 2, 2502, 0, 0, '', 0, 19822) ;

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(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(250212003, 'Сумма с учетом НДС', 'Summa', '', 'Summa', 2, 2502, 2, 0, '', 0, 20242) ;

CALL ImportField(250213003, 'Сумма', 'Summa', '', 'Summa', 2, 2502, 3, 0, '', 0, 20140) ;

-- Документы исполнения , Бюджет(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, 'Мероприятие', 'Fact', '', 'Fact', 2, 2503, 0, 0, '', 0, 19769) ;

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(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, 'Направление', 'DirectionCls', '', 'DirectionCls', 2, 2503, 2, 0, '', 0, 20277) ;

CALL ImportField(250312005, 'Лицевой счет', 'FacialAcc_Cls', '', 'FacialAcc_Cls', 2, 2503, 2, 0, '', 0, 20249) ;

CALL ImportField(250312007, 'Мероприятие', 'Fact', '', 'Fact', 2, 2503, 2, 0, '', 0, 20248) ;

CALL ImportField(250312008, 'Источник финансирования', 'FinSource', '', 'FinSource', 2, 2503, 2, 0, '', 0, 20246) ;

CALL ImportField(250312009, 'Тип финансирования', 'FinType', '', 'FinType', 2, 2503, 2, 0, '', 0, 20247) ;

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) ;

-- Муниципальные контракты, УРМ+Бюджет(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, 'Мероприятие', 'Fact', '', 'Fact', 2, 2504, 0, 0, '', 0, 19822) ;

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(250410055, 'EXECUTERACCREF_BANKBIK', 'EXECUTERACCREF_BANKBIK', '', 'EXECUTERACCREF_BANKBIK', 2, 2504, 0, 1, '', 0, null) ;

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(250412003, 'Сумма с учетом НДС', 'Summa', '', 'Summa', 2, 2504, 2, 0, '', 0, 20242) ;

CALL ImportField(250412008, 'Лицевой счет получателя', 'FacialAcc_Cls', 'Лицевой счет получателя', 'FacialAcc_Cls', 2, 2504, 2, 0, '', 0, 20249) ;

CALL ImportField(250413008, 'Сумма', 'Summa', '', 'Summa', 2, 2504, 3, 0, '', 0, 20140) ;

-- Операции со счетами через распоряжение на финансирование, Бюджет(1)
CALL ImportField(280111023, 'Код целевых средств', 'TransfertCLSCode', '', ' ', 1, 2801, 1, 0, 'КодЦелевыхСредств', 0, 25326) ;

-- Операции со счетами, Бюджет(1)
CALL ImportField(280210016, 'Код целевых средств', 'TransfertClsCode', 'Код целевых средств', 'TransfertClsValue', 1, 2802, 0, 0, 'КодЦелевыхСредств', 0, 25326) ;

-- Заявка на закупку продукции, УРМ+Бюджет(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(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, 'Тип финансирования', 'FinType', 'Тип финансирования', 'FinType', 2, 3001, 1, 0, '', 0, 21114) ;

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, 'Мероприятие', 'FactCls', 'Мероприятие', 'FactCls', 2, 3001, 1, 0, '', 0, 21040) ;

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, 'Направление', 'DirectionCls', '', 'DirectionCls', 2, 3001, 1, 0, '', 0, 21104) ;

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(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, 'Направление', 'DirectionCls', '', ' ', 1, 3006, 1, 0, '', 0, 21104) ;

CALL ImportField(300611047, 'Л/с в ФК(Организация - Заказчик)', 'FacialCode', '', ' ', 1, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611048, 'Наименование(Организация - Заказчик)', 'FacialOrgName', '', ' ', 1, 3006, 1, 0, '', 0, null) ;

CALL ImportField(300611049, 'Тип финансирования', 'FinType', '', ' ', 1, 3006, 1, 0, '', 0, 21114) ;

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) ;

-- План-график, УРМ+Бюджет(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(300611002, 'Наименование продукции', 'ProductName', '', 'ProductName', 2, 3006, 1, 0, '', 0, 20697) ;

CALL ImportField(300611003, 'Цена с налогами', 'PriceVAT', '', 'PriceVAT', 2, 3006, 1, 0, '', 0, 21123) ;

CALL ImportField(300611005, 'ОКДП', 'OKDP', '', 'OKDP', 2, 3006, 1, 0, '', 0, 24924) ;

CALL ImportField(300611006, 'Примечание', 'Note', '', 'Note', 2, 3006, 1, 0, '', 0, 21054) ;

CALL ImportField(300611008, 'КЭСР', 'KESR', '', 'KESR', 2, 3006, 1, 0, '', 0, 21038) ;

CALL ImportField(300611010, 'Мероприятие', 'FactCLS', '', 'FactCLS', 2, 3006, 1, 0, '', 0, 21040) ;

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(300612002, 'ФИО', 'Name', '', 'Name', 2, 3006, 2, 0, '', 0, 21900) ;

CALL ImportField(300612003, 'Статус контактного лица', 'Status', 'Статус контактного лица', 'Status', 2, 3006, 2, 0, '', 0, 25042) ;

-- Каталогизация продукции, Бюджет(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) ;

-- Расходные расписания, Бюджет(1)
CALL ImportField(440110012, 'Дата формирования', 'InputDate', 'Дата ввода', 'InputDate', 1, 4401, 0, 0, 'ДатаВвода', 0, 21686) ;

-- Обуславливающие документы, Бюджет(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(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) ;

-- Уведомление об уточнении поступлений, Бюджет(1)
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) ;

-- Уведомление об уточнении выбытий, Бюджет(1)
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) ;

-- Протокол пакетной замены классификации, Бюджет(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(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, 0, 'ПротоколКодСубсидииКлюч', 0, null) ;

CALL ImportField(550311005, 'Код бюджетного ассигнования', 'BudAllocationCls', 'Код бюджетного ассигнования', 'BudAllocationCls', 1, 5503, 1, 0, 'ПротоколКодБюджАссигнКлюч', 0, null) ;

CALL ImportField(550311006, 'Код расходного обязательства', 'PayPromiseCls', 'Код расходного обязательства', 'PayPromiseCls', 1, 5503, 1, 0, 'ПротоколКодРасхОбязКлюч', 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, 0, 'ПротоколКВСР', 0, null) ;

CALL ImportField(550311012, 'ФКР(Классификация)', 'KFSR', 'ФКР', 'KFSR', 1, 5503, 1, 0, 'ПротоколКФСР', 0, 31729) ;

CALL ImportField(550311013, 'КЦСР', 'KCSR', 'КЦСР', 'KCSR', 1, 5503, 1, 0, 'ПротоколКЦСР', 0, null) ;

CALL ImportField(550311014, 'КВР', 'KVR', 'КВР', 'KVR', 1, 5503, 1, 0, 'ПротоколКВР', 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, 'Мероприятие', 'Fact', 'Мероприятие', 'Fact', 1, 5503, 1, 0, 'ПротоколМероприятие', 0, 31722) ;

CALL ImportField(550311018, 'Направление', 'DirectionCls', 'Направление', 'DirectionCls', 1, 5503, 1, 0, 'ПротоколНаправление', 0, 31719) ;

CALL ImportField(550311019, 'Тип средств', 'MeansType', 'Тип средств', 'MeansType', 1, 5503, 1, 0, 'ТипСредств', 0, 31732) ;

CALL ImportField(550311020, 'Тип финансирования', 'FinType', 'Тип финансирования', 'FinType', 1, 5503, 1, 0, 'ПротоколТипФинансирования', 0, 31724) ;

CALL ImportField(550311021, 'Лицевой счет', 'FacialAcc_Cls', 'Лицевой счет', 'FacialAcc_Cls', 1, 5503, 1, 0, 'ПротоколЛицевойСчет', 0, 31721) ;

CALL ImportField(550311022, 'Код дохода', 'KD', 'Код дохода', 'KD', 1, 5503, 1, 0, 'ПротоколКдКлюч', 0, null) ;

CALL ImportField(550311023, 'Источник внутреннего финансирования', 'IFS', 'Источниковая классификация', 'IFS', 1, 5503, 1, 0, 'ПротоколИсточникВнутрФинансированияКлюч', 0, null) ;

CALL ImportField(550311024, 'Источник', 'FinSource', 'Источник финансирования', 'FinSource', 1, 5503, 1, 0, 'ПротоколИсточникФинансирования', 0, 31723) ;

CALL ImportField(550311025, 'Код целевых средств', 'TransfertCls', 'Код целевых средств', 'TransfertCls', 1, 5503, 1, 0, 'ПротоколКодЦелевыхСредствКлюч', 0, null) ;

CALL ImportField(550311026, 'Тип документа основания', 'DocBase', 'Тип документа основания', 'DocBase', 1, 5503, 1, 0, 'ПротоколТипДокументаОснования', 0, 31720) ;

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', '', ' ', 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', '', ' ', 1, 5503, 1, 0, 'КодРасходногоОбязательства', 0, 27849) ;

CALL ImportField(550311044, 'Код субсидии', 'SubsidyClsCode', '', ' ', 1, 5503, 1, 0, 'КодСубсидии', 0, 26641) ;

CALL ImportField(550311046, 'Код целевых средств', '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(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, 0, 'ПротоколПримечаниеДеталь', 0, 29939) ;

CALL ImportField(550312005, 'Вид ассигнований', 'AssignMentKind', '', ' ', 1, 5503, 2, 0, '', 0, 31716) ;

CALL ImportField(550312006, 'Код бюджетного ассигнования', 'BudAllocationClsCode', '', ' ', 1, 5503, 2, 0, 'КодБюджАссигнования', 0, 27825) ;

CALL ImportField(550312007, 'Тип классификации', 'ClsType', '', ' ', 1, 5503, 2, 0, '', 0, 17453) ;

CALL ImportField(550312008, 'Направление', 'DirectionCls', '', ' ', 1, 5503, 2, 0, '', 0, 17450) ;

CALL ImportField(550312009, 'Тип документа основания', 'DocBase', '', ' ', 1, 5503, 2, 0, '', 0, 17473) ;

CALL ImportField(550312010, 'Лицевой счет', 'FacialAcc_Cls', '', ' ', 1, 5503, 2, 0, '', 0, 17419) ;

CALL ImportField(550312011, 'Мероприятие', 'Fact', '', ' ', 1, 5503, 2, 0, '', 0, 17418) ;

CALL ImportField(550312012, 'Источник', 'FinSource', '', ' ', 1, 5503, 2, 0, '', 0, 17471) ;

CALL ImportField(550312013, 'Тип финансирования', 'FinType', '', ' ', 1, 5503, 2, 0, '', 0, 17425) ;

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(550312028, 'Уникальный номер договора', 'ReestrNumber', '', ' ', 1, 5503, 2, 0, '', 0, 31736) ;

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, 0, '', 0, null) ;

CALL ImportField(550312042, 'КВР', 'Kvr', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312043, 'КЦСР', 'Kcsr', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312044, 'Код целевых средств', 'TransfertCls', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312045, 'Сумма', 'summaCalc', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312046, 'Код субсидии', 'SubsidyCls', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312047, 'Код бюджетного ассигнования', 'BudAllocationCls', '', ' ', 1, 5503, 2, 0, '', 0, null) ;

CALL ImportField(550312048, 'Код расходного обязательсва', 'PayPromiseCls', '', ' ', 1, 5503, 2, 0, '', 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) ;

-- Организации, Бюджет(1)
CALL ImportField(960110052, 'ОКТМОКлюч', 'OKTMO', '', ' ', 1, 9601, 0, 0, '', 0, 32858) ;

CALL ImportField(960110053, 'ОКТМО', 'OKTMOCODE', '', ' ', 1, 9601, 0, 0, '', 0, null) ;

CALL ImportField(960110054, 'ОКПО', 'OKPO', '', ' ', 1, 9601, 0, 0, '', 0, 32938) ;

-- Организации, УРМ+Бюджет(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) ;

-- Счета организаций, УРМ+Бюджет(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) ;

-- КЦСР, Бюджет(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) ;

-- Суб КЦСР, Бюджет(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) ;

-- Документ-основание, Бюджет(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) ;

-- Виды платежей, Бюджет(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(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) ;

-- Код операции сектора государственного управления, Бюджет(1)
CALL ImportField(986810017, '', '_FAVORITE', '', ' ', 1, 9868, 0, 0, '', 0, null) ;

-- Направление, Бюджет(1)
CALL ImportField(986910007, '', '_FAVORITE', '', ' ', 1, 9869, 0, 0, '', 0, null) ;

-- Программа, Бюджет(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(990310093, 'ОКТМО', 'OKTMOCode', '', ' ', 1, 9903, 0, 0, '', 0, 32822) ;

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) ;

-- Справочник контактных лиц, Бюджет(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(991610005, 'Настройки бухгалтерии\Использовать расширенный план счетов', 'НастройкиБухгалтерии_ИспользоватьРасширенныйПланСчетов', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 6, 3, 'Настройки бухгалтерии\Использовать расширенный план счетов', '', 0, 0) ;

CALL ImportField(991610024, 'Настройки финоргана\Наименование бюджета', 'НастройкиФиноргана_НаименованиеБюджета', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 21, 8, 'Настройки финоргана\Наименование бюджета', 'Задайте наименование бюджета в константах системы', 0, 0) ;

CALL ImportField(991610055, 'Первичные документы\Казначейство\Контролируемая классификация\Расход по п\п (казенные учреждения)', 'ПервичныеДокументы_Казначейство_КонтролируемаяКлассификация_РасходПоППБюджетнаяДеятельность', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL ImportField(991610056, 'Первичные документы\Казначейство\Контролируемая классификация\Расход по п\п (БУ/АУ)', 'ПервичныеДокументы_Казначейство_КонтролируемаяКлассификация_РасходПоПППредпринимательскаяДеятельность', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL ImportField(991610058, 'Первичные документы\Объемы финансирования(Limits.ocx устарело)\Контролируемая классификация\Уведомления по ОФ', 'ПервичныеДокументы_ОбъемыФинансированияLimitsOcx_КонтролируемаяКлассификация_УведомленияПоОФ', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL ImportField(991610065, 'Первичные документы\Планирование расходов, доходов, источников\Детализация показателей СБР по ГРБС\Детализация в части КОСГУ', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ДетализацияЭКПриРаспределенииПоПодведомственным_БюджетнаяРосписьГРБС', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL ImportField(991610091, 'Первичные документы\Платежные поручения\Максимальная разрешенная очередность платежа', 'ПервичныеДокументы_ПлатежныеПоручения_ОчередностьПлатежа', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(11, 2, 3, 'Первичные документы\Платежные поручения\Максимальная разрешенная очередность платежа', '', 0, 5) ;

CALL ImportField(991610098, 'Последняя дата, закрытая для редактирования:', 'ПоследняяДатаРедактирования:', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL ImportField(991610166, 'Первичные документы\Бюджетные обязательства\Использовать номер БО в заголовке', 'ПервичныеДокументы_БюджетныеОбязательства_ИспользоватьНомерБОвЗаголовке', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(30, 37, 3, 'Первичные документы\Бюджетные обязательства\Использовать номер БО в заголовке', '', 0, 0) ;

CALL ImportField(991610170, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка периодичности ведения субсидий БУ,АУ', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_НастрокаВеденияСметПД', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 43, 3, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка периодичности ведения субсидий БУ,АУ', '', 0, 0) ;

CALL ImportField(991610174, 'Первичные документы\Казначейство\Сквозной учет поступлений между казначейством и блоком доходов', 'ПервичныеДокументы_Казначейство_СквознойУчетПоступленийМеждуКазначействомИБлокомДоходов', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(30, 31, 3, 'Первичные документы\Казначейство\Сквозной учет поступлений между казначейством и блоком доходов', '', 0, 0) ;

CALL ImportField(991610182, 'Справочники\Бюджетная классификация\Разрешить использование букв в классификаторах', 'Справочники_БюджетнаяКлассификация_РазрешитьИспользованиеБуквВКлассификаторах', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(60, 6, 8, 'Справочники\Бюджетная классификация\Разрешить использование букв в классификаторах', '', 0, 0) ;

CALL ImportField(991610195, 'Настройки финоргана\Наименование бюджета\Единый счет бюджета', 'НастройкиФиноргана_НаименованиеБюджета_ЕдиныйСчетБюджета', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610196, 'Справочники\Справочник банков, организаций и счетов\Оптимизация', 'Справочники_СправочникБанковОрганизацийИСчетов_Оптимизация', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610197, 'Справочники\Бюджетная классификация\Структура бюджетных классификаторов', 'Справочники_БюджетнаяКлассификация_СтруктураБюджетныхКлассификаторов', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610199, 'Первичные документы\Планирование расходов, доходов, источников\Поддержка совместимости\Разрешать поквартальную/помесячную разбивку БА при совмещенном ведении СБР и КП, БР и ПОФ', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ПоддержкаСовместимостиСВедениемПлановыхПоказателейВ2007Г_РазрешатьРазбивкуБАПриСовмещенномВеденииСБРиКП', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610200, 'Системные настройки\Использовать блок "Учет разрешений"', 'СистемныеНастройки_ИспользоватьБлокУчетРазрешений', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610201, 'Справочники\Бюджетная классификация\Список классификаторов для задания прав', 'Справочники_БюджетнаяКлассификация_СписокКлассификаторовДляЗаданияПрав', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610202, 'Настройки бухгалтерии\ЭКИ для поступления средств', 'НастройкиБухгалтерии_ЭКИДляПоступленияСредств', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610203, 'Настройки бухгалтерии\ЭКИ для выбытия средств', 'НастройкиБухгалтерии_ЭКИДляВыбытияСредств', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610204, 'Настройки бухгалтерии\Операция по умолчанию', 'НастройкиБухгалтерии_ОперацияПоУмолчанию', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610205, 'Настройки бухгалтерии\Синтетические счета для фильтрации', 'НастройкиБухгалтерии_СинтетическиеСчетаДляФильтрации', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610206, 'Настройки бухгалтерии\Код синтетического счета ФО', 'НастройкиБухгалтерии_КодСинтетическогоСчетаФО', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610207, 'Настройки бухгалтерии\Код синтетического счета казначейства', 'НастройкиБухгалтерии_КодСинтетическогоСчетаКазначейства', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL ImportField(991610208, 'Константы УРМ, требующие инициализации\Длина отката начальной даты (ч)', 'КонстантыУРМТребующиеИнициализации_ДлинаОткатаДачальнойДаты', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(1000, 53, 3, 'Константы УРМ, требующие инициализации\Длина отката начальной даты (ч)', '', 0, 1) ;

CALL ImportField(991610209, 'Константы УРМ, требующие инициализации\Скрывать персональные данные физ. лиц', 'КонстантыУРМТребующиеИнициализации_СкрыватьПерсональныеДанныеФизЛиц', '', ' ', 1, 9916, 0, 1, '', 0, null) ;

CALL InsertConst(1000, 109, 3, 'Константы УРМ, требующие инициализации\Скрывать персональные данные физ. лиц', '', 0, 0) ;

CALL ImportField(991610210, 'Первичные документы\Казначейство\Разрешенные для нумерации расчетных счетов коды валют', 'ПервичныеДокументы_Казначейство_РазрешенныеДляРСКодыВалют', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(30, 46, 8, 'Первичные документы\Казначейство\Разрешенные для нумерации расчетных счетов коды валют', '810', 0, 0) ;

CALL ImportField(991610211, 'Первичные документы\Планирование расходов, доходов, источников\Настройка использования интерфейсов\Настройка подневного ПОФ\Обязательность указания лицевого счета в заголовке', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_НастройкаИспользованияИнтерфейсов_НастройкаПодневногоПОФ_ОбязательностьУказанияЛицевогоСчетаВЗаголовке', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL ImportField(991610212, 'Первичные документы\Планирование расходов, доходов, источников\Детализация показателей СБР по ГРБС\Детализация в части КВР', 'ПервичныеДокументы_ПланированиеРасходовДоходовИсточников_ДетализацияПоказателейСБРПоГРБС_ДетализацияВЧастиКВР', '', ' ', 1, 9916, 0, 0, '', 0, null) ;

CALL InsertConst(32, 45, 3, 'Первичные документы\Планирование расходов, доходов, источников\Детализация показателей СБР по ГРБС\Детализация в части КВР', '', 0, 0) ;

-- Константы казначейства, Бюджет(1)
CALL ImportField(991710015, 'Наименование казначейства', 'НаименованиеКазначейства', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL InsertConst(-1, 22, 8, 'Наименование казначейства', 'Задайте наименование казначейства в константах казначейства', 0, 0) ;

CALL ImportField(991710020, 'Последняя дата, закрытая для редактирования:', 'ПоследняяДатаРедактирования:', '', ' ', 1, 9917, 0, 0, '', 0, null) ;

CALL ImportField(991710035, 'Основной счет казначейства по учету средств от предпр. деят.', 'ОсновнойСчетКазначействаПоУчетуСредствОтПредпрДеят', '', ' ', 1, 9917, 0, 1, '', 0, null) ;

-- Редактор справочника бюджетов, Бюджет(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) ;

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
/




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('Отметки о блокировании\разблокировании поступлений',303, 1, 1) ;

CALL DOCLOCK_DELETE('По дате разблокировки',303, 1, 1) ;

CALL DOCLOCK_DELETE('Блокировка даты и причины разблокировки',303, 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_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,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('Фильтр лимитируемости ассигнований',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"))
или ((Константа(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,20201047,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,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('Проверка заполненности лицевого счета',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,'',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,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,'(Разыменовать("Р/с.ДляБУ_АУ",[30010021]) = 0) и  не ((Разыменовать("Р/с.ДляАУ",[30010021]) <> 0) и Константа(30,44,3) = 1) и  (Разыменовать("Р/с.ДляСВРБУ_АУ",[30010021]) = 0)',0,1,'Если в качестве счета финоргана выбран расчетный счет не для бюджетных(автономных) учреждений, то допустимы самостоятельные, подведомственные, распорядителльные л/c и л/c по переданным полномочиям',0,'Для данного расчетного счета выбор лицевых счетов с характером "БУ, АУ" или "Отдельный БУ, АУ" недопустим',null,'не(([984110041] = 1) или ([984110045] = 1) или ([984110046])) и
не( ([984110044] = 0) и ([984110042] = 0) и ([984110041] = 0) и 
    ([984110045] = 0) и ([984110046] = 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,1,0,11,0,'([30011019] = 2) и  (((КодИнтерфейса <> 305) и (КодИнтерфейса <> 302)) или   не(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации",[30010008]) between 010800 and 010999))',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('Фильтр кода целевых средств получ. по КД',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('Проверка очередности платежа',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,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('Ввод документов',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('По дате разблокировки',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,'(Константа(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('Фильтр кода целевых средств получ (получ,передача)',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] = 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('Запрет редактирования кода субсидии',32768,308,1,0,3,0,'не((Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код", [30810064]) between 10800 и 10999)    или(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации.Код",[30810064]) between 10000 и 10499))',0,1,'Блокировка поля "Код субсидии" для лицевых счетов с видом организации-владельца вне диапазона 01.08.00-01.09.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('Фильтр по характеру л/с',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('Фильтр по виду деятельности',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('Фильтр по характеру л/с',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,'Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[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,900,1,0,11,0,'([90011001] = 2) и ((КодИнтерфейса <> 903) или   не(Разыменовать("Лицевой_Счет.ОрганизацияВладелец.ВидОрганизации",[90011008]) between 010800 and 010999))',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('По дате разблокировки',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('Блокировка суммы к исполнению',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('Запрет редактирования организации',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('Проверка изменения периодичности',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('Ежемесячная',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,'[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('Отметки о блокировании\разблокировании поступлений',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,'(Разыменовать("Лицевой_Счет.ЭтоЛСПБС",[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('Отметки о блокировании\разблокировании поступлений',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('Фильтр кода целевых средств по получению,передаче',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('Блокировка отрицательных типов пакетов',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('Запрет редактирования прав доступа',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) ;

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_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(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(444900500,'РасходныеРасписанияПрикрепленныеФайлы',null,440100,490200,'Связь расходного расписания с прикрепленными файлами',0,0,0,0,2,'Привязать',1,'','16на16',0,'',0,1) ;

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(965200000) ;

CALL STATICLINK_DELETE(965200100) ;

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(980332400,'КазнПодтвПеречисл_СчетНал.1.DESTREGIONCLS(РайонТрансферта)->Районы.ID',981210005,31211101,0,0) ;

CALL STATICLINK_IMPORT(990312100,'КазнПодтвПеречисл_СчетНал.1.BUDGETREF(КодБюджета)->Бюджеты.ID',987810006,31211112,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(985200300,'ИсполнительныеЛисты.FACIALACC_CLS(ЛицевойСчетДеталь)->ЛицСчета.ID',984110021,520111005,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(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) ;

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(3021600, 'ВключенныеВПринятыйРеестр', 'Получить документы включенные в принятый реестр', 'Разыменовать("Реестры_казначейства.Принятость",[30210054]) =1', 0, 1, 1) ;

CALL FILTERS_IMPORT(3040500, 'ПоЕдиномуСчету', 'Получить документы по единому счету', 'Разыменовать("Р/с.Единый",[30410033])', 0, 1, 2) ;

CALL FILTERS_IMPORT(3041500, 'ВключенныеВПринятыйРеестр', 'Получить документы включенные в принятый реестр', 'Разыменовать("Реестры_казначейства.Принятость",[30410044])=1', 0, 1, 1) ;

CALL FILTERS_IMPORT(3061100, 'БюджетнаяДеятельность', 'Получить документы по бюджетной деятельности ', '((Разыменовать("Лицевой_Счет.Тип_Средств.ТипДеятельности",[30610002])=1)и
(Разыменовать("Лицевой_Счет.Тип_Средств",[30610002])<>0))
или((Разыменовать("Лицевой_Счет.Тип_Средств",[30610108])=0)и Разыменовать("Р/с.Бюджетный",[30610108])
    и не (Разыменовать("Лицевой_Счет.ЭтоЛСБУ_АУ",[30610002])
          или Разыменовать("Лицевой_Счет.ЭтоОтдельныйЛСБУ_АУ",[30610002])
          или Разыменовать("Лицевой_Счет.ЭтоЛСДляОМС",[30610002])
         )
   )', 0, 1, 1) ;

CALL FILTERS_IMPORT(3140900, 'ВключенныеВПринятыйРеестр', 'Получить документы включенные в принятый реестр', 'Разыменовать("Реестры_казначейства.Принятость",[31410037]) =1', 0, 1, 1) ;

CALL FILTERS_IMPORT(3150100, 'Принятые', 'Получить принятые документы ', 'ПолеНеПустое([31510010])', 0, 1, 1) ;

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(13776,'',300,0,'ЧернаяСкрепка',1,2,3,1,'Дата принятия документа закрыта для редактирования',1,64,'',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(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(31262603,'',4903,0,'ПеречеркнутыйДокумент',1,1,0,1,'Ошибочный',0,0,'ПолеНеПустое([490310010]) и ([490310013] = 1)',1) ;

CALL STATUSICONS_IMPORT(31262642,'',4903,0,'Документ',1,1,0,1,'Сформирован',0,0,'(не ПолеНеПустое([490310010])) и ([490310013] = 1)',1) ;

CALL STATUSICONS_IMPORT(31262602,'',4903,0,'ПоданныйДокЭЦПСиняяГалка',1,1,0,1,'Опубликован и полностью подписан',0,0,'(не ПолеНеПустое([490310010])) и  ([490310013] = 0) и  ПолеНеПустое([490310014]) и  [490310015]',1) ;

CALL STATUSICONS_IMPORT(31262640,'',4903,0,'ПоданныйДокументСиняяГалка',1,1,0,1,'Опубликован, в подписании не нуждается',0,0,'(не ПолеНеПустое([490310010])) и  ([490310013] = 0) и  (не ПолеНеПустое([490310014]))',1) ;

CALL STATUSICONS_IMPORT(31262992,'',4903,0,'ПоданныйПеречеркнутыйДок',1,1,0,1,'Опубликован и отклонен',0,0,'ПолеНеПустое([490310010]) и ([490310013] = 0)',1) ;

CALL STATUSICONS_IMPORT(31262641,'',4903,0,'ДокументЭЦПСиняяГалка',1,1,0,1,'Полностью подписан',0,0,'(не ПолеНеПустое([490310010])) и  ([490310013] = 2) и  ПолеНеПустое([490310014]) и  ([490310015])',1) ;

CALL STATUSICONS_IMPORT(31262991,'',4903,0,'ДокументЭЦП',1,1,0,1,'Частично подписан',0,0,'(не ПолеНеПустое([490310010])) и ([490310013] = 2) и  ПолеНеПустое([490310014]) и  ([490310015] = 0)',1) ;

CALL STATUSICONS_IMPORT(35471,'',4903,0,'ПеречеркнутыйДокументЭЦП',1,1,0,1,'На подписании и отклонен',0,0,'ПолеНеПустое([490310010]) и ([490310013] = 2)',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_;
  END IF;  
END;
/

-- Перечисления
CALL ENUMS_IMPORT('ПоказательСтатуса',null) ;

CALL ENUMVALUES_IMPORT('ПоказательСтатуса','00=возврат средств из невыясненных поступлений',0) ;

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('ОснованиеПлатежа','ТЛ=погашение учредителем (участником) должника, собственником имущества должника - унитарного предприятия или третьим лицом задолженности в ходе процедур, применяемых в деле о банкротстве',22) ;

CALL ENUMVALUES_IMPORT('ОснованиеПлатежа','ЗТ=погашение текущей задолженности в ходе процедур, применяемых в деле о банкротстве',23) ;

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) ;

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 (294, 90000, 90000, TO_DATE('26.12.2013 16:57:7', '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, 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, 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.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.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', 'FINOGENOV/sergy', TO_DATE('26.12.2013 17:3:49', 'DD.MM.YYYY HH24:MI:SS'), 'Для обновления 09.00') ;

-- Удаление документа 55.55, 49.04, 52.00
delete from Interfaces where cls in (5555,4904,5200)
/

DELETE FROM State_OpenFields
  WHERE (docfieldref in (select id from DocumentFields where DocTypeRef in (5555,4904,5200)))
/

delete from dualrights where objref1 in (5555,4904,5200)
/

-- Удаляем блокировки 
DELETE FROM DOCLOCK
  WHERE DocRef in (5555,4904,5200)
/

DELETE FROM STATE_JUMPCONTROL
  WHERE STATICLINKREF IN(SELECT ID FROM staticlinks
                           WHERE (PARENTFIELDREF
                           in (select id from DocumentFields where DocTypeRef in (5555,4904,5200)))
                           OR(CHILDFIELDREF
                           in (select id from DocumentFields where DocTypeRef in (5555,4904,5200))))
/

-- Удаляем внутренние связи полей для этих документов 
DELETE FROM staticlinks
  WHERE (PARENTFIELDREF
  in (select id from DocumentFields where DocTypeRef in (5555,4904,5200)))
  OR(CHILDFIELDREF
  in (select id from DocumentFields where DocTypeRef in (5555,4904,5200)))
/

-- Удаляем связи страниц для этих документов 
delete from LinkType where 
(ParentDocCls between 555500 and 555599) or (ChildDocCls between 555500 and 555599) or
(ParentDocCls between 490400 and 490499) or (ChildDocCls between 490400 and 490499) or
(ParentDocCls between 520000 and 520099) or (ChildDocCls between 520000 and 520099)
/

-- Удаляем поля
DELETE FROM DocumentFields
  WHERE DocTypeRef in (5555,4904,5200)
/

-- Удаляем страницы
Delete from DocumentCls
  WHERE DocType in (5555,4904,5200)
/

-- Удаляем документы
Delete from DocumentTypes where id in (5555,4904,5200)
/

-- Удаление документа 55.55, 49.04, 52.00 окончено
COMMIT WORK
/



-- #########################################################
-- #########################################################
-- DBVersion.sql
-- #########################################################
-- #########################################################

INSERT INTO DataBaseVersion(VERSION, Major, Minor, AComment)
  VALUES ('9.00.00', 900, 00, 'Обновление 9.00')
/

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;
/
