# Date: 06/09/06 # Version: 105 $DOC(D_STOCK_OUT) name=Снятие ЦБ class=1 product=ALD_DEPO name_formula=.DEPO_OPER_ITEM_NAME remark_formula=$TEXT(17551733) .TO_STR_RND(@stock_qty) + ' ' + .ITEM_NAME(@stock_id) + ' ' + .ITEM_NAME(@s_subacc_id) + '->' + .ITEM_NAME(@t_subacc_id) + ' ' + isnull(@move_contragent_name, '') + ' ' + isnull(@contragent_comment, '') $ENDTEXT(17551733) $STATE(BEG) name=Начальный class=1 $ENDSTATE $STATE(CAN) name=Отменено class=0 $ENDSTATE $STATE(DEL) name=Удалено class=2 $ENDSTATE $STATE(ED) name=В обработке class=0 $ENDSTATE $STATE(ED_END) name=В операции class=0 $ENDSTATE $STATE(OP_END) name=Исполнено class=0 $ENDSTATE $STATE(OP_END_SD) name=Проведено по СД class=0 $ENDSTATE $STATE(REF) name=Отказано class=0 $ENDSTATE $STATE(STR) name=Сторнирован class=0 $ENDSTATE $STATE(TST) name=На подтверждении class=0 $ENDSTATE $STATE(WAIT_BLK) name=Ожидет подтв в связи с блок. class=0 $ENDSTATE $STATE(WAIT_PAY) name=Ждет оплату class=0 $ENDSTATE $STATE(WAIT_REPL) name=На проверке class=0 $ENDSTATE $STATE(WAIT_STNO) name=В сторнировании class=0 $ENDSTATE $PROP(OUT_DATE) name=Внешняя дата корреспондента field_name=out_date table_name=td_depo_docs field_type=datetime field_length=8 field_scale=null field_prec=null page=1 order=1 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(IN_DATE) name=Дата документа field_name=in_date table_name=td_depo_docs field_type=datetime field_length=8 field_scale=null field_prec=null page=1 order=2 init_class=1 init_formula=.OPERDAY unique_index=1 numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(WHO_GET) name=Кто принял field_name=who_get table_name=td_depo_docs field_type=varchar field_length=100 field_scale=null field_prec=null page=1 order=3 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(WHO_PUT) name=Кто отправил field_name=who_put table_name=td_depo_docs field_type=varchar field_length=100 field_scale=null field_prec=null page=1 order=4 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(OUT_NO) name=Внешний номер field_name=out_no table_name=td_depo_docs field_type=varchar field_length=50 field_scale=null field_prec=null page=1 order=5 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(IN_NO) name=Номер документа field_name=in_no table_name=td_depo_docs field_type=varchar field_length=50 field_scale=null field_prec=null page=1 order=6 init_class=0 init_formula=null unique_index=1 numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(CORRESPONDENT_ID) name=Корреспондент field_name=correspondent_id table_name=td_depo_docs field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=7 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(PAYER_ID) name=Плательщик field_name=payer_id table_name=td_depo_docs field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=8 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(PAY_SUM) name=Сумма field_name=pay_sum table_name=td_depo_docs field_type=money field_length=8 field_scale=null field_prec=null page=1 order=9 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(INITIATOR_ID) name=Инициатор field_name=initiator_id table_name=td_depo_docs field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=10 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(DOCUMENT_FORM_ID) name=Форма документа field_name=document_form_id table_name=td_depo_docs field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=11 init_class=1 init_formula=1 unique_index=null numerator=null import_type=null import_table=null import_field= import_where=null ref_table=null ref_key= ref_display= ref_alias=null ref_where=null $ENDPROP $PROP(DEPO_DOC_TYPE) name=Входящий исходящий или внутр field_name=depo_doc_type table_name=td_depo_docs field_type=int field_length=4 field_scale=null field_prec=null page=1 order=12 init_class=1 init_formula=1 unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(FOLDER_ID) name=Депозитарная папка field_name=folder_id table_name=td_depo_docs field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=13 init_class=2 init_formula=.DEPO_FOLDER_DEFAULT unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(SUM_CUR_ID) name=Валюта суммы field_name=sum_cur_id table_name=td_depo_docs field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=14 init_class=1 init_formula=.CUR("RUR") unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(DOC_COMMENT) name=Коментарии field_name=doc_comment table_name=td_depo_docs field_type=varchar field_length=255 field_scale=null field_prec=null page=1 order=15 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(FOUNDATION_REMARK) name=Комментарий по документам - основаниям field_name=foundation_remark table_name=td_depo_docs field_type=varchar field_length=255 field_scale=null field_prec=null page=2 order=16 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(STOCK_ID) name=ценная бумага field_name=stock_id table_name=td_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=17 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(STOCK_QTY) name=Количество field_name=stock_qty table_name=td_stock_moves field_type=money field_length=8 field_scale=null field_prec=null page=2 order=18 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(KEEP_SUBACC_ID) name=Активный раздел field_name=keep_subacc_id table_name=td_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=19 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(T_SUBACC_ID) name=Раздел счета получатель field_name=t_subacc_id table_name=td_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=20 init_class=0 init_formula=@keep_subacc_id unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(S_SUBACC_ID) name=Раздел счета поставщик field_name=s_subacc_id table_name=td_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=21 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(MOVE_COMMENT) name=Комментарий field_name=move_comment table_name=td_stock_moves field_type=varchar field_length=255 field_scale=null field_prec=null page=2 order=22 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(CONTRAGENT_COMMENT) name=Контрагент с ном держателем field_name=contragent_comment table_name=td_stock_moves field_type=varchar field_length=255 field_scale=null field_prec=null page=2 order=23 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field= import_where=null ref_table=null ref_key= ref_display= ref_alias=null ref_where=null $ENDPROP $PROP(OPER_FORM_ID) name=Форма операции field_name=oper_form_id table_name=td_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=24 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(REESTR_OPER_DATE) name=Дата операции в реестре field_name=reestr_oper_date table_name=td_stock_moves field_type=datetime field_length=8 field_scale=null field_prec=null page=2 order=25 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(DEPOCORR_OPER_DATE) name=Дата исполнения депозитарие field_name=depocorr_oper_date table_name=td_stock_moves field_type=datetime field_length=8 field_scale=null field_prec=null page=2 order=26 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(MOVE_CONTRAGENT_NAME) name=Контрагент по передаче field_name=move_contragent_name table_name=td_stock_moves field_type=varchar field_length=255 field_scale=null field_prec=null page=2 order=27 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field= import_where=null ref_table=null ref_key= ref_display= ref_alias=null ref_where=null $ENDPROP $PROP(CONTR_OWNER_TYPE_ID) name=Тип держания field_name=contr_owner_type_id table_name=td_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=28 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(CONTR_ACCOUNT) name=Счет контрагента field_name=contr_account table_name=td_stock_moves field_type=varchar field_length=100 field_scale=null field_prec=null page=2 order=29 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field= import_where=null ref_table=null ref_key= ref_display= ref_alias=null ref_where=null $ENDPROP $PROP(CONTR_JURADRESS) name=Юридический адрес field_name=contr_juradress table_name=td_stock_moves field_type=varchar field_length=255 field_scale=null field_prec=null page=2 order=30 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(CONTR_REGISTER_NO) name=N госрегистрации field_name=contr_register_no table_name=td_stock_moves field_type=varchar field_length=60 field_scale=null field_prec=null page=2 order=31 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(CONTR_REGISTER_DATE) name=Дата регистрации field_name=contr_register_date table_name=td_stock_moves field_type=datetime field_length=8 field_scale=null field_prec=null page=2 order=32 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(CONTR_REGISTRATOR) name=Регистратор field_name=contr_registrator table_name=td_stock_moves field_type=varchar field_length=255 field_scale=null field_prec=null page=2 order=33 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field= import_where=null ref_table=null ref_key= ref_display= ref_alias=null ref_where=null $ENDPROP $PROP(KEEP_TRAJECT_END_ID) name=Конечный узел цепочки хранения field_name=keep_traject_end_id table_name=td_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=34 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(REESTR_OPER_ID) name=Ссылка на перечень выписки по конечному узлу field_name=reestr_oper_id table_name=td_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=35 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(DEPOCORR_OPER_ID) name=Ссылка на перечень выписки по ближ корресп field_name=depocorr_oper_id table_name=td_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=36 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(STOCK_PRICE) name=Сумма сделки field_name=stock_price table_name=td_stock_moves field_type=money field_length=8 field_scale=null field_prec=null page=2 order=37 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(STOCK_PRICE_CUR_ID) name=Валюта сделки field_name=stock_price_cur_id table_name=td_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=38 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $RELATION(REL13) class=1 type=ASSETS2ITEMS form=D_ASSETS2ITEMS_LIST prop=null idname=docitem_id_s order=30 $ENDRELATION $RELATION(REL1) class=0 type=partners form=null prop=PAYER_ID idname=null order=null $ENDRELATION $RELATION(REL2) class=0 type=td_stock_emis form=null prop=STOCK_ID idname=null order=null $ENDRELATION $RELATION(REL3) class=0 type=depo_subacc form=null prop=S_SUBACC_ID idname=null order=null $ENDRELATION $RELATION(REL4) class=0 type=depo_subacc form=null prop=KEEP_SUBACC_ID idname=null order=null $ENDRELATION $RELATION(REL5) class=4 type=d_depo_folders form=null prop=FOLDER_ID idname=null order=null $ENDRELATION $RELATION(REL6) class=0 type=partners form=null prop=INITIATOR_ID idname=null order=null $ENDRELATION $RELATION(REL7) class=0 type=partners form=null prop=CORRESPONDENT_ID idname=null order=null $ENDRELATION $RELATION(REL8) class=1 type=t_operations form=item_opers_list prop=null idname=item_id_s order=999 $ENDRELATION $RELATION(REL9) class=1 type=actions_history form=uo_actions_history_list prop=null idname=null order=998 $ENDRELATION $RELATION(REL10) class=1 type=reports form=uo_reports_page_list prop=null idname=foundation_id_s order=997 $ENDRELATION $RELATION(REL11) class=1 type=FOUNDATION_DOCS_GROUP form=UO_FOUNDATION_DOCS_LIST prop=null idname=depo_doc_id_s order=20 $ENDRELATION $RELATION(REL12) class=1 type=activdocs form=ACTION2 prop=null idname=null order=1000 $ENDRELATION $FORM(D_ASSETS2ITEMS_EDIT) name=Список для привязки партий class=5 filter=null target_state= uo=uo_assets2items dw=d_assets2items_edit procedure=ap_50760000000029194 patterns=GENERIC_VIEW_ITEM user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551736) create procedure dbo.%PROC% @sid varchar(30) = null as declare @id numeric, @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric begin select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER /* assets2items */ /* delete t_items from t_pays2items where t_pays2items.id = t_items.id and t_pays2items.docitem_id = @id and .ITEMS_EXISTS_BY_TYPE(t_pays2items.id,'assets2items') delete t_pays2items where t_pays2items.docitem_id = @id and .ITEMS_EXISTS_BY_TYPE(t_pays2items.id,'assets2items') */ .GET_PROPS .ID_VAR(@doc_id) .ID_VAR(@stock_op_id) declare @fund_type_code varchar(255) declare @subc3_type_id numeric declare @subc3_item_id numeric declare @fund_plan_id numeric declare @operday datetime declare @stock_account_id numeric select @doc_id=fd.id from td_foundation_docs fd, .ACTUAL_TABLES , t_types where fd.depo_doc_id=@id and fd.function_id=1 .ACTUAL_WHERE(fd.id) and t_types.id=t_items.type_id and upper(t_types.type_code)=upper('foundation_docs_sd') if @doc_id is null .EXIT_MESSAGE('Не задан документ-основание проведения по СД') .TYPE_GET('foundation_docs_sd',@doc_id,1) .GET_SD_OPER_DATE(@operday,@id) select @fund_type_code = lower(.ITEM_TYPE_CODE(@owner_id1)) -- если бумага не задана или для фонда метод учета - по поручению if @stock_id1 is null or (select registr_mode_id from td_pay_fond where id=@owner_id1) = 1 select @stock_op_id = @stock_id else begin .CHECK_STOCK_EMM_AND_TYPE(@stock_id,@stock_id1,'Эммитент и тип ЦБ в документе-основании проведения по СД должны соответствовать ЦБ в поручении') select @stock_op_id = @stock_id1 end if @fund_type_code = 'pif_fund' begin select @fund_plan_id = .ARG_PLAN('PIF_ACCOUNT') end else if @fund_type_code = 'npf_fund' begin select @fund_plan_id = .ARG_PLAN('NPF_ACCOUNT') end select @stock_account_id = .ACCID_FROM_EFFNO(@fund_plan_id,'58.1') if @fund_type_code = 'pif_fund' begin select @subc3_type_id = .SUBCTYPE_FROM_CODE('stock_emis') select @subc3_item_id = @stock_op_id end else begin select @subc3_type_id = .SUBCTYPE_FROM_CODE('asset_manager') select @subc3_item_id = isnull(@initiator_id1, @owner_id1) end .TOTALS_QUERY_SUB(@owner_id1,@fund_plan_id,@operday,@operday,@stock_account_id,'stock_emis',@stock_op_id,'doc_item',N,(.FROM_SUBC3),(.WHERE_SUBC3(@subc3_type_id,@subc3_item_id)),L,N,Y,N,Y) /* Delete not existed */ delete t_items from t_pays2items where t_pays2items.id = t_items.id and t_pays2items.docitem_id = @id and t_pays2items.paydoc_id not in (select o.subc2_id from #tmp_oss o ) and .ITEMS_EXISTS_BY_TYPE(t_pays2items.id,'assets2items') delete t_pays2items where t_pays2items.docitem_id = @id and t_pays2items.paydoc_id not in (select o.subc2_id from #tmp_oss o ) and .ITEMS_EXISTS_BY_TYPE(t_pays2items.id,'assets2items') /*-------*/ select @sid as sid, convert(decimal(18,4), @stock_qty) as stock_qty, t_types.type_name, d.in_no, d.in_date, convert(varchar(30), o.subc2_id) as part_id_s, convert(decimal(18,4), o.saldo_de) as part_sum, convert(decimal(18,4), o.q_saldo_de) as part_qty, convert(decimal(18,4), (o.saldo_de / o.q_saldo_de)) as part_price, convert(decimal(18,4),(select min(p.covered_sum) from t_pays2items p where p.docitem_id = @id and p.paydoc_id = o.subc2_id and .ITEMS_EXISTS_BY_TYPE(p.id,'assets2items')) ) as calc_sum, (case when ((select character_id from tb_baysale_docitems where id=d.id)=2 or (select mode_id from tb_baysale_docitems where id=d.id)=3) then -- брокерская (select item_name from t_items where id=(select direction_id from tb_baysale_docitems where id=d.id)) else -- прямая (select partner_name from t_partners where id=(select contragent_id from tb_baysale_docitems where id=d.id)) end) as brok from #tmp_oss o, td_depo_docs d, t_items, t_types where o.subc2_id = d.id and o.q_saldo_de > 0 and o.subc2_id = t_items.id and t_items.type_id = t_types.id order by d.in_date, d.in_no end $ENDTEXT(17551736) $ENDFORM $FORM(FORM_VIEW) name=Данные class=5 filter=null target_state= uo=uo_depo_p2_edit dw=d_stock_out_view procedure=aptd_stock_out_view_p2 patterns=GENERIC_VIEW_ITEM_P2 user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551736) create procedure dbo.%PROC% @sid varchar(30) = null as declare @id numeric, @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @new_state_id numeric begin select @id = convert(numeric, @sid) select @action_id = %ACTION_ID% .CHECK_USER .CHECK_VIEW_ITEM .VIEW_ITEM(ALL,2) end $ENDTEXT(17551736) $ACTION2RELATION(REL4.DEPO_SUBACC_NAME) relation=REL4 where=null prop=DEPO_SUBACC_NAME order=5 alias=keep_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL4.DEPO_SUBACC_NO) relation=REL4 where=null prop=DEPO_SUBACC_NO order=13 alias=keep_subacc_no $ENDACTION2RELATION $ACTION2RELATION(REL3.DEPO_SUBACC_NAME) relation=REL3 where=null prop=DEPO_SUBACC_NAME order=5 alias=s_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL3.DEPO_SUBACC_NO) relation=REL3 where=null prop=DEPO_SUBACC_NO order=13 alias=s_subacc_no $ENDACTION2RELATION $ACTION2RELATION(REL2.STOCK_CODE) relation=REL2 where=null prop=STOCK_CODE order=3 alias=stock_code $ENDACTION2RELATION $ACTION2RELATION(REL2.STOCK_NAME) relation=REL2 where=null prop=STOCK_NAME order=4 alias=stock_name $ENDACTION2RELATION $ENDFORM $FORM(FORM_VIEW1) name=Просмотр class=5 filter=null target_state= uo=uo_depooper_edit dw=d_depooper_p1 procedure=ap_10725000000002049 patterns=GENERIC_VIEW_ITEM_P1 user_define=1 isvisible=0 istab=1 posx=0 posy=0 width=2368 height=1908 proc_text=$TEXT(17551736) create procedure dbo.%PROC% @sid varchar(30) = null as declare @id numeric, @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @type_id_s varchar(30), @new_state_id numeric, @state_name_id_s varchar(30) begin select @id = convert(numeric, @sid) select @action_id = %ACTION_ID% select @type_id_s = NULL select @state_name_id_s = NULL .CHECK_USER .CHECK_VIEW_ITEM if @id = -1 begin begin tran .GET_PROPS .CHECK_INSERT .INIT_VARS(B) .INSERT_ITEMS .INSERT commit tran end .VIEW_ITEM(ALL,1) /* .ACTION_HISTORY */ end $ENDTEXT(17551736) $ACTION2RELATION(REL6.PARTNER_CODE) relation=REL6 where=null prop=PARTNER_CODE order=1 alias=initiator_code $ENDACTION2RELATION $ACTION2RELATION(REL6.PARTNER_SHORT_NAME) relation=REL6 where=null prop=PARTNER_SHORT_NAME order=4 alias=initiator_short_name $ENDACTION2RELATION $ACTION2RELATION(REL7.PARTNER_CODE) relation=REL7 where=null prop=PARTNER_CODE order=1 alias=corr_code $ENDACTION2RELATION $ACTION2RELATION(REL7.PARTNER_SHORT_NAME) relation=REL7 where=null prop=PARTNER_SHORT_NAME order=4 alias=corr_short_name $ENDACTION2RELATION $ACTION2RELATION(REL1.PARTNER_CODE) relation=REL1 where=null prop=PARTNER_CODE order=1 alias=payer_code $ENDACTION2RELATION $ACTION2RELATION(REL1.PARTNER_SHORT_NAME) relation=REL1 where=null prop=PARTNER_SHORT_NAME order=4 alias=payer_short_name $ENDACTION2RELATION $BIND(BIND1) type=d_stock_out action=FORM_VIEW class=1 order=1 idname=null $ENDBIND $BIND(BIND2) type=d_stock_out action=ACTION_UPDATE class=1 order=2 idname=null $ENDBIND $BIND(BIND3) type=activdocs action=ACTION2 class=0 order=3 idname=null $ENDBIND $BIND(BIND4) type=arh_edit action=d_perevodarchiv_p3 class=1 order=4 idname=sid $ENDBIND $ENDFORM $FORM(FORM_VIEW2) name=Просмотр поручения class=5 filter=null target_state= uo=uo_list_rep dw=d_order_for_view procedure=ap_20010000000552250 patterns=GENERIC_VIEW_ITEM user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=3232 height=1900 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @id numeric, @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @type_id_s varchar(30), @new_state_id numeric, @state_name_id_s varchar(30) begin select @id = convert(numeric, @sid) select @action_id = %ACTION_ID% select @type_id_s = NULL select @state_name_id_s = NULL .CHECK_USER .CHECK_VIEW_ITEM .GET_PROPS declare @type_name varchar(255) select @type_name = (select type_name from t_types where id = @type_id) declare @s_subacc_no varchar(100) declare @t_subacc_no varchar(100) declare @s_subacc_name varchar(150) declare @t_subacc_name varchar(150) declare @s_acc_id numeric declare @t_acc_id numeric declare @s_acc_no varchar(100) declare @t_acc_no varchar(100) declare @partner_id numeric declare @partner_name varchar(255) declare @t_partner_id numeric declare @t_partner_name varchar(255) declare @t_nomacc_name varchar(255) select @s_acc_id = depo_acc_id, @s_subacc_no = depo_subacc_no from td_depo_subacc where id = @s_subacc_id select @t_acc_id = depo_acc_id, @t_subacc_no =depo_subacc_no, @t_subacc_name = depo_subacc_name from td_depo_subacc where id = @t_subacc_id select @s_acc_no = depo_acc_number, @partner_id = partner_id from td_depo_accounts where id = @s_acc_id select @t_acc_no = depo_acc_number, @t_partner_id = partner_id from td_depo_accounts where id = @t_acc_id select @partner_name = (select partner_short_name from t_partners where id = @partner_id) select @t_subacc_no = @contr_account select @t_subacc_name = null select @t_partner_name = @move_contragent_name select @t_nomacc_name = @contragent_comment declare @stock_name varchar(255) declare @stock_nominal money declare @emiss_statereg_no varchar(100) declare @emiss_statereg_date datetime select @stock_name = stock_name, @stock_nominal = stock_nominal, @emiss_statereg_no = emiss_statereg_no, @emiss_statereg_date = emiss_statereg_date from td_stock_emis, td_emissions where td_stock_emis.id = @stock_id and td_stock_emis.emmission_id = td_emissions.id declare @stock_qty_txt varchar(255),@stock_qty_dig varchar(33) select @stock_qty_dig=convert(varchar,@stock_qty) exec ap_dig2txt @stock_qty_dig,'.',1,'шт.','шт.','шт.',1,'шт.','шт.','шт.',1,@stock_qty_txt out declare @stock_price_cur varchar(100) select @stock_price_cur = (select cur_code from t_currencies where id = @stock_price_cur_id) declare @move_name varchar(255) select @move_name = (select partner_short_name from t_partners where id = @keep_traject_end_id) declare @partner_hran_id numeric, @partner_hran_short_name varchar(100), @act_subacc_id numeric .DEPO_ACT_SUBACC(@act_subacc_id,@s_subacc_id,@stock_id) select @partner_hran_id=td_depo_accounts.partner_id from td_depo_accounts,td_depo_subacc where td_depo_subacc.id=@act_subacc_id and td_depo_accounts.id=td_depo_subacc.depo_acc_id select @partner_hran_short_name=t_partners.partner_short_name from t_partners where t_partners.id=@partner_hran_id select sid = @sid, in_no = @in_no, in_date = @in_date, s_acc_no = @s_acc_no, s_subacc_no = @s_subacc_no, s_subacc_name = @s_subacc_name, partner_name = @partner_name, stock_name = @stock_name, stock_nominal = @stock_nominal, emiss_statereg_no = @emiss_statereg_no, emiss_statereg_date = @emiss_statereg_date, stock_qty = @stock_qty, stock_price = @stock_price, stock_price_cur = @stock_price_cur, t_acc_no = @t_acc_no, t_subacc_no = @t_subacc_no, t_subacc_name = @t_subacc_name, t_partner_name = @t_partner_name, t_nomacc_name = @t_nomacc_name, type_name = @type_name, move_name = @move_name, foundation_remark = @foundation_remark, move_comment=@move_comment, far_node_d=@reestr_oper_date, near_node_d=@depocorr_oper_date, stock_qty_txt='('+@stock_qty_txt+')', (select partner_short_name from t_partners where id=@payer_id) payer_short_name, @pay_sum pay_sum, (select cur_code from t_currencies where id=@sum_cur_id) pay_cur_code, @partner_hran_short_name as partner_hran_short_name end $ENDTEXT(17551737) $ENDFORM $FORM(REPORT4OPER_HEADERKVAS1) name=просмотр поручения class=5 filter=null target_state= uo=uo_print dw=d_report4operation_headerkvas1 procedure=ap_51230000000032823 patterns=null user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=3141 height=1808 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @id numeric, @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @type_id_s varchar(30), @new_state_id numeric, @state_name_id_s varchar(30) begin select @id = convert(numeric, @sid) select @action_id = %ACTION_ID% select @type_id_s = NULL select @state_name_id_s = NULL /*.CHECK_USER .CHECK_VIEW_ITEM*/ declare @zagolovok1_1 varchar(255), @zagolovok1_11 varchar(255), @num varchar(150), @nom varchar(100), @nu varchar(15), @zagolovok1_2 varchar(255), @zagolovok2_1 varchar(255), @n varchar(100), @n1 varchar(100), @op varchar(20), @st varchar(100), @pekom varchar(50), @pope varchar(50), -- @z money, @z3 varchar(120), @z4 varchar(120), @zz varchar(120), @zagolovok2_2 varchar(255), @nomer varchar(100), @z1 varchar(255), @z2 varchar(255), @sto varchar(255), @class_id numeric, @operator numeric, @init_id numeric, @fo_id numeric, @oper datetime, @user_name varchar(100), @partner_short_name varchar(50), @type_code varchar(255), @in_no1 varchar(15), @peredpope varchar(50), @t numeric, @t1 numeric, @t2 numeric, @gg1 numeric .GET_PROPS select @in_no1=@in_no select @init_id=foundation_docs.initiator_id,@class_id=foundation_docs.class_id, @zagolovok2_2=foundation_docs.foundation_remark, @gg1=foundation_docs.correspondent_id, @fo_id = foundation_docs.foundation_id from td_depo_docs foundation_docs -- where foundation_docs.id=@foundation_id where foundation_docs.foundation_remark=@foundation_remark select @partner_short_name=t_partners.partner_short_name from t_partners where t_partners.id=@gg1 select @operator=td_linked_persons.agent_type_id from td_linked_persons where td_linked_persons.partner_id=@gg1 if @operator=1 begin select @op='оператор счета' end else if @operator=2 select @op='распорядитель счета' else select @op='' select --@z = td_stock_moves.stock_qty, @z2= td_stock_moves.move_contragent_name, @z1 = td_stock_moves.contragent_comment, @nomer =@contr_account, @t1 = td_stock_moves.s_subacc_id from td_stock_moves where td_stock_moves.stock_qty=@stock_qty and td_stock_moves.reestr_oper_date=@reestr_oper_date --td_stock_moves.depocorr_oper_date=@in_date and td_stock_moves.s_subacc_id=@s_subacc_id --select @sto=convert(varchar,@z) select @sto=convert(varchar,@stock_qty) execute ap_dig2txt @sto,'.',1,'','','',1,'','','',1,@z4 out select @z3=upper(@z4) select @zz='('+@z3+') шт.' select @nom=td_depo_subacc.depo_subacc_name, @nu=substring(td_depo_subacc.depo_subacc_no,1,6), @t2=td_depo_subacc.depo_acc_id from td_depo_subacc where td_depo_subacc.id=@t1 select @num=@nu+' '+td_depo_accounts.depo_acc_name /*@num=td_depo_accounts.depo_acc_number*/ from td_depo_accounts where td_depo_accounts.id=@t2 select @n = td_stock_emis.stock_name, @t=td_stock_emis.stock_type_id, @st = td_stock_emis.stock_code from td_stock_emis where td_stock_emis.id=@stock_id select @n1=t_simples.simple_name+', ' from t_simples where t_simples.id=@t and t_simples.type_id=3029 select @zagolovok1_1='ПОРУЧЕНИЕ НА ДЕПОЗИТАРНУЮ ОПЕРАЦИЮ № '+@out_no select @zagolovok1_11=convert(varchar,@in_date,104)+' г.' select @zagolovok1_2='Прием ценных бумаг' select @zagolovok2_1=partner_name, @pekom=partner_code from t_partners where id=@init_id --if @pekom="ПЭКО-М" begin select @pope='', @peredpope='', @op='Генеральный директор' end if @pekom like '%ПЭКО-М%' begin select @pope='', @peredpope='', @op='Генеральный директор' end else select @pope=@partner_short_name, @peredpope='Распорядитель' select @user_name=user_name from t_users where login_name=suser_name() select @sid as sid, @type_code as type_code, @zagolovok1_1 as zagolovok1_1, @zagolovok1_11 as zagolovok1_11, @num as num, @nom as nom, @zagolovok2_1 as zagolovok2_1, @peredpope as peredpope, @pope as pope, @partner_short_name as psn, @n as stock_id, @n1 as type, @st as st, -- @z as stock_qty, @stock_qty as stock_qty, @zz as zz, @zagolovok1_2 as zagolovok1_2, @zagolovok2_2 as zagolovok2_2, @contr_account as contr_account, @z1 as contragent_comment, @z2 as contragent_name, @op as op, @class_id as class_id, @oper as oper, @user_name as user_name, @in_no as in_no end $ENDTEXT(17551737) $ENDFORM $ACTION(ACTION13) name=Изменить привязку к партиям class=2 form=D_ASSETS2ITEMS_EDIT target_state=null procedure=ap_50760000000029195 patterns=GENERIC_INSERT user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null, @part_id_s varchar(30), @calc_sum varchar(30) as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric begin begin tran declare @docitem_id numeric declare @paydoc_id numeric declare @covered_sum money select @action_id = %ACTION_ID% select @docitem_id = convert(numeric, @sid) select @paydoc_id = convert(numeric, @part_id_s) select @covered_sum = convert(decimal(18,4), @calc_sum) select @covered_sum = isnull(@covered_sum, 0) .CHECK_USER if not exists( select 1 from t_pays2items where t_pays2items.docitem_id = @docitem_id and t_pays2items.paydoc_id = @paydoc_id and .ITEMS_EXISTS_BY_TYPE(t_pays2items.id,'assets2items') ) begin if @covered_sum > 0 begin .TYPE_INIT('assets2items') .TYPE_ASSIGN(docitem_id, @docitem_id) .TYPE_ASSIGN(paydoc_id, @paydoc_id) .TYPE_ASSIGN(covered_sum, @covered_sum) .TYPE_INSERT('assets2items', 'CRT') end end else begin if @covered_sum > 0 update t_pays2items set covered_sum = @covered_sum where docitem_id = @docitem_id and paydoc_id = @paydoc_id and .ITEMS_EXISTS_BY_TYPE(t_pays2items.id,'assets2items') else begin delete t_items from t_pays2items where t_pays2items.id = t_items.id and t_pays2items.docitem_id = @docitem_id and paydoc_id = @paydoc_id and .ITEMS_EXISTS_BY_TYPE(t_pays2items.id,'assets2items') delete t_pays2items where t_pays2items.docitem_id = @docitem_id and paydoc_id = @paydoc_id and .ITEMS_EXISTS_BY_TYPE(t_pays2items.id,'assets2items') end end commit tran select sid = convert(varchar, @id) end $ENDTEXT(17551737) $ENDACTION $ACTION(ACTION_DELETE) name=Удалить class=3 form=FORM_VIEW1 target_state=DEL procedure=ap_10570000000001819 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=2560 height=2020 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .UPDATE_STATE .ACTION_HISTORY /*-------Проводки ----------*/ commit tran $ENDTEXT(17551737) $BIND(BIND1) type=d_stock_out action=FORM_VIEW class=1 order=1 idname=null $ENDBIND $ENDACTION $ACTION(ACTION_INSERT) name=Добавить class=1 form=FORM_VIEW1 target_state=ED procedure=ap_10570000000001817 patterns=GENERIC_INSERT_P1 user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=2990 height=1848 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST(ALL,1) as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric begin select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .OPERDAY_TEST .ARGCONVERT(ALL,1) .INIT_VARS(AFTER,ALL,1) .DEPO_GEN_NO(@in_no,@depo_doc_type) begin tran .UPDATE(ALL,1) .RELGEN .UPDATE_STATE .ACTION_HISTORY commit tran select @sid = convert(varchar,@id) select @sid end $ENDTEXT(17551737) $BIND(BIND1) type=d_stock_out action=d_stock_out_view class=1 order=1 idname=null $ENDBIND $BIND(BIND2) type=activdocs action=ACTION2 class=0 order=2 idname=null $ENDBIND $ENDACTION $ACTION(ACTION_MOVE) name=На подтверждение class=9 form=null target_state=TST procedure=ap_11115000000025347 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .UPDATE_STATE .ACTION_HISTORY /*-------Проводки ----------*/ commit tran $ENDTEXT(17551737) $ENDACTION $ACTION(ACTION_MOVE1) name=Уточнить параметры проведения class=9 form=null target_state=ED_END procedure=ap_11115000000025348 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE /* .DEPO_TEST_FOUNDATION(2,@id) */ .UPDATE_STATE .ACTION_HISTORY /*-------Проводки ----------*/ .OPERS_ROLL('complete') .DEPO_CHK_REPS(@id,'reports_report_for_operation') commit tran $ENDTEXT(17551737) $ENDACTION $ACTION(ACTION_MOVE2) name=В операцию class=9 form=null target_state=ED_END procedure=ap_11115000000025349 patterns=GENERIC_MOVE user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .DEPO_TEST_FOUNDATION(1,@id) .UPDATE_STATE .ACTION_HISTORY /*-------Проводки ----------*/ .GET_PROPS .UPDATE_ITEMS .DEPO_FINS .DEPO_SFSTEST_STOCK(@stock_id ,OPERDAY) .DEPO_BLTEST_STOCK( @stock_id ,OPERDAY) .DEPO_BLTEST_SUBACC(@s_subacc_id ,'D',OPERDAY,1) .DEPO_BLTEST_SUBACC(@keep_subacc_id ,'C',OPERDAY,1) .DEPO_TEST_CLOSE_SUBACC(@keep_subacc_id,OPERDAY) .DEPO_TEST_CLOSE_SUBACC(@s_subacc_id,OPERDAY) .ID_VAR(@act_subacc_id) .ID_VAR(@blk_subacc_id) .ID_VAR(@b_depo_acc_id) .NAME_VAR(@blk_subacc_no) select @blk_subacc_no = null select @act_subacc_id = act_subacc_id from td_depo_subacc where id = @s_subacc_id select @b_depo_acc_id = .DEPO_ACC_FROM_SUBACC(@s_subacc_id) select @blk_subacc_id = .DEPO_GET_BLOP_SUBACC(@b_depo_acc_id,@act_subacc_id,'OP') if @blk_subacc_id is null begin .DEPO_CREATE_SUBACC(@blk_subacc_no,@b_depo_acc_id,'OP',@blk_subacc_id,@act_subacc_id,2,'BLK_OP', 'ЦБ в операции') end if @s_subacc_id != @blk_subacc_id begin declare @operday datetime, @ret int select @operday=(.OPERDAY) exec @ret = ap_subacc_check_qty @plan_owner_code='DEPO', @plan_code='DEPO', @subacc_id=@s_subacc_id, @stock_id=@stock_id, @check_date=@operday, @check_qty=@stock_qty, @check_deb_or_cred=1 if @ret!=0 .EXIT_MESSAGE('Операция приводит к отрицательным остаткам на пассивном разделе') declare @doc_name varchar(255) select @doc_name = .ITEM_NAME(@id) .DEPOOPERATION('DEPO','DEPO', @operday,'2','2',@stock_qty,@stock_id,@s_subacc_id,@blk_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_REG',@operday,'2','2',@stock_qty,@stock_id,@s_subacc_id,@blk_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_DOM',@operday,'2','2',@stock_qty,@stock_id,@s_subacc_id,@blk_subacc_id,,@doc_name) end commit tran $ENDTEXT(17551737) $ENDACTION $ACTION(ACTION_MOVE3) name=Отказать class=9 form=null target_state=REF procedure=ap_50460000000000680 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .DEPO_TEST_FOUNDATION(2,@id) .UPDATE_STATE .ACTION_HISTORY .ARH_NUMBER_UPDATE /*-------Проводки ----------*/ .OPERS_ROLL(ALL,'DEPO',B,N,O,@id) .OPERS_ROLL(ALL,'DEPO_DOM',B,N,O,@id) .OPERS_ROLL(ALL,'DEPO_REG',B,N,O,@id) .GET_PROPS .CREATE_DEPO_REPORT('report4refus_oper','CREATE',11) commit tran $ENDTEXT(17551737) $ENDACTION $ACTION(ACTION_MOVE4) name=В сторнирование class=9 form=null target_state=WAIT_STNO procedure=ap_20015000000554298 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .UPDATE_STATE .ACTION_HISTORY /*-------Проводки ----------*/ commit tran $ENDTEXT(17551737) $ENDACTION $ACTION(ACTION_MOVE5) name=На уточнение class=9 form=null target_state=ED procedure=ap_10570000000001822 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .UPDATE_STATE .ACTION_HISTORY /*-------Проводки ----------*/ .GET_PROPS declare @ret int,@operday datetime select @operday = .OPERDAY if .STATE_CODE(@type_id,@state_id)='ED_END' begin .ID_VAR(@act_subacc_id) .ID_VAR(@blk_subacc_id) .ID_VAR(@b_depo_acc_id) .NAME_VAR(@blk_subacc_no) select @blk_subacc_no = null select @act_subacc_id = act_subacc_id from td_depo_subacc where id = @s_subacc_id select @b_depo_acc_id = .DEPO_ACC_FROM_SUBACC(@s_subacc_id) select @blk_subacc_id = .DEPO_GET_BLOP_SUBACC(@b_depo_acc_id,@act_subacc_id,'OP') exec @ret = ap_subacc_check_qty @plan_owner_code='DEPO', @plan_code='DEPO', @subacc_id=@blk_subacc_id, @stock_id=@stock_id, @check_date=@operday, @check_qty=@stock_qty, @check_deb_or_cred=1 if @ret!=0 .EXIT_MESSAGE('Операция приводит к отрицательным остаткам на блокировочном разделе') end .OPERS_ROLL(ALL,'DEPO') .OPERS_ROLL(ALL,'DEPO_DOM') .OPERS_ROLL(ALL,'DEPO_REG') .DEPO_REPORT_DESTROY('reports_report_for_operation','CRT',1) .ARH_FLAG_CLEAR commit tran $ENDTEXT(17551737) $ENDACTION $ACTION(ACTION_MOVE6) name=На проверку class=9 form=null target_state=WAIT_REPL procedure=ap_10570000000001823 patterns=GENERIC_MOVE user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=2575 height=1981 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .UPDATE_STATE .ACTION_HISTORY /*--------- Проводки ------------*/ .GET_PROPS /*-------- .DEPO_BLTEST_SUBACC(@keep_subacc_id ,'К',OPERDAY,1) --------*/ .ID_VAR(@act_subacc_id) .ID_VAR(@blk_subacc_id) .ID_VAR(@b_depo_acc_id) .NAME_VAR(@blk_subacc_no) select @blk_subacc_no = null select @act_subacc_id = act_subacc_id from td_depo_subacc where id = @s_subacc_id select @b_depo_acc_id = .DEPO_ACC_FROM_SUBACC(@s_subacc_id) select @blk_subacc_id = .DEPO_GET_BLOP_SUBACC(@b_depo_acc_id,@act_subacc_id,'OP') if @blk_subacc_id is null begin .DEPO_CREATE_SUBACC(@blk_subacc_no,@b_depo_acc_id,'OP',@blk_subacc_id,@act_subacc_id,2,'BLK_OP', 'ЦБ в операции')--,98040) end if @s_subacc_id != @blk_subacc_id begin .DEPO_TEST_SALDO(OPERDAY, @s_subacc_id , @stock_id ,'DEPO','K',@stock_qty) .DEPO_OPERS_MOVE(@s_subacc_id,@blk_subacc_id,@stock_id,@stock_qty,1,0) end commit tran $ENDTEXT(17551737) $ENDACTION $ACTION(ACTION_MOVE7) name=Сторнировать class=9 form=null target_state=STR procedure=ap_10570000000001827 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .DEPO_TEST_FOUNDATION(3,@id) .UPDATE_STATE .ACTION_HISTORY /*-------Проводки ----------*/ /*Проверки и проводки*/ .GET_PROPS declare @test_date datetime select @test_date = .DATE_NORM(OPERDAY) .DEPO_BLTEST_STOCK(@stock_id,@test_date) .DEPO_BLTEST_SUBACC(@s_subacc_id,'K',@test_date,1) .DEPO_BLTEST_SUBACC(@keep_subacc_id,'D',@test_date,1) declare @doc_name varchar(255) select @doc_name = 'Сторнирование:' + .ITEM_NAME(@id) from t_types where id = @type_id /* .OPERATION('DEPO','DEPO',OPERDAY,'1','2',@stock_qty,NULL,OPERDAY,1,1,@doc_name) .OPERATION('DEPO','DEPO_REG',@reestr_oper_date ,'1','2',@stock_qty,NULL, @reestr_oper_date ,1,1,@doc_name) .OPERATION('DEPO','DEPO_DOM',@depocorr_oper_date,'1','2',@stock_qty,NULL,@depocorr_oper_date,1,1,@doc_name) */ declare @operday datetime select @operday = .OPERDAY .DEPOOPERATION('DEPO','DEPO', @operday, '1','2',@stock_qty,@stock_id,@keep_subacc_id,@s_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_REG',@reestr_oper_date, '1','2',@stock_qty,@stock_id,@keep_subacc_id,@s_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_DOM',@depocorr_oper_date,'1','2',@stock_qty,@stock_id,@keep_subacc_id,@s_subacc_id,@doc_name) .ARH_NUMBER_UPDATE commit tran $ENDTEXT(17551737) $ENDACTION $ACTION(ACTION_UPDATE) name=Данные (ввод данных по провед.) class=2 form=FORM_VIEW target_state=null procedure=ap_11085000000025450 patterns=GENERIC_UPDATE_P2 user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST(ALL, 2) as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .ARGCONVERT(ALL, 2) if @depocorr_oper_date is null .EXIT_MESSAGE('Не введена дата операции в ближнем узле') if @reestr_oper_date is null select @reestr_oper_date = @depocorr_oper_date .GET_PROPS(ALL,1) .TEST_UNIQUE .UPDATE_ITEMS .UPDATE(td_stock_moves,2) .RELGEN .UPDATE_STATE .ACTION_HISTORY commit tran $ENDTEXT(17551737) $ENDACTION $ACTION(ACTION_UPDATE1) name=Изменить class=2 form=FORM_VIEW1 target_state=null procedure=ap_10570000000001818 patterns=GENERIC_UPDATE_P1 user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=2766 height=1932 proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST(ALL,1) as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .ARGCONVERT(ALL,1) .DEPO_CHK_NO(@id,@in_no,@depo_doc_type) .UPDATE(ALL,1) .RELGEN .UPDATE_STATE .ACTION_HISTORY commit tran select sid = convert(varchar, @id) $ENDTEXT(17551737) $BIND(BIND1) type=d_stock_out action=d_stock_out_view class=1 order=1 idname=null $ENDBIND $BIND(BIND2) type=activdocs action=ACTION2 class=0 order=2 idname=null $ENDBIND $ENDACTION $ACTION(PARTS_DEL_D) name=______________ class=9 form=null target_state=null procedure=ap_51490000000126001 patterns=null user_define=1 isvisible=0 istab=0 posx=null posy=null width=null height=null proc_text=$TEXT(17551737) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .UPDATE_STATE .ACTION_HISTORY declare @docitem_id numeric select @docitem_id=convert(numeric,@sid) delete t_items from t_pays2items where t_pays2items.id = t_items.id and t_pays2items.docitem_id = @docitem_id and .ITEMS_EXISTS_BY_TYPE(t_pays2items.id,'assets2items') delete t_pays2items where t_pays2items.docitem_id = @docitem_id and .ITEMS_EXISTS_BY_TYPE(t_pays2items.id,'assets2items') commit tran $ENDTEXT(17551737) $ENDACTION $ACTION(SD_OPERS) name=Провести по СД class=9 form=null target_state=OP_END_SD procedure=ap_50755000000028347 patterns=GENERIC_MOVE user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551739) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .UPDATE_STATE .ACTION_HISTORY .GET_PROPS .ID_VAR(@doc_id) .ID_VAR(@depo_owner_id) .ID_VAR(@stock_owner_id) .ID_VAR(@pif_cont_comp_id) .NAME_VAR(@f_type_code) declare @oper_date datetime /* select @doc_id=fd.id from td_foundation_docs fd, .ACTUAL_TABLES , t_types where fd.depo_doc_id=@id and fd.function_id=1 .ACTUAL_WHERE(fd.id) and t_types.id=t_items.type_id and upper(t_types.type_code)=upper('foundation_docs_sd') */ if not exists (select 1 from td_foundation_docs fd where fd.depo_doc_id=@id and fd.function_id=1 and .ITEMS_EXISTS_BY_TYPE(fd.id,'FOUNDATION_DOCS_SD')) .EXIT_MESSAGE('Не заданы документы-основания проведения по СД') if isnull((select sum(sm.stock_qty) from td_foundation_docs fd, ts_sd_stock_moves sm where fd.depo_doc_id=@id and fd.function_id=1 and fd.id=sm.id and .ITEMS_EXISTS_BY_TYPE(fd.id,'FOUNDATION_DOCS_SD')),0) <> @stock_qty .EXIT_MESSAGE('Количество ЦБ по документам-основаниям проведения по СД не соответствует количеству ЦБ в поручении') ---------------------- -- Проверки по каждому ---------------------- declare fdocs_ch cursor for select fd.id from td_foundation_docs fd where fd.depo_doc_id=@id and fd.function_id=1 and .ITEMS_EXISTS_BY_TYPE(fd.id,'FOUNDATION_DOCS_SD') for read only open fdocs_ch fetch fdocs_ch into @doc_id while .CURSOR_STATE=0 begin .TYPE_GET('foundation_docs_sd',@doc_id,1) select @f_type_code = lower(.ITEM_TYPE_CODE(@owner_id1)) select @depo_owner_id = a.partner_id, @stock_owner_id = a.fund_id from td_depo_subacc s, td_depo_accounts a where s.id = @s_subacc_id and s.depo_acc_id = a.id -- Проверка владельца счета Депо if @f_type_code = 'pif_fund' begin select @pif_cont_comp_id = .GET_CTRL_COMP_ID(@owner_id1) if @depo_owner_id != @pif_cont_comp_id .EXIT_MESSAGE('Владельцем счета ДЕПО назначения должна быть управляющая компания ПИФ') if (@stock_owner_id != @owner_id1) and (@stock_owner_id != @pif_cont_comp_id) -- nikoil .EXIT_MESSAGE('Владельцем бумаг на счете ДЕПО типа ДУ должен быть фонд') end if @f_type_code = 'npf_fund' /* Проводки НПФ */ begin if @initiator_id1 is null /* При размещении самостоятельно НПФ*/ begin if @depo_owner_id != @owner_id1 .EXIT_MESSAGE('Владельцем счета ДЕПО назначения должен быть НПФ') end else /* При размещении через УК*/ begin /* if @depo_owner_id != @initiator_id1 .EXIT_MESSAGE('Владельцем счета ДЕПО назначения должен быть управляющий') if @stock_owner_id != @owner_id1 .EXIT_MESSAGE('Владельцем бумаг на счете ДЕПО типа ДУ должен быть фонд') */ if @depo_owner_id = @initiator_id1 and @stock_owner_id != @owner_id1 .EXIT_MESSAGE('Владельцем бумаг на счете ДЕПО управляющего типа ДУ должен быть фонд') if @depo_owner_id = @owner_id1 and not exists(select 1 from td_linked_persons where td_linked_persons.partner_id=@initiator_id1 and td_linked_persons.depo_subacc_id=@s_subacc_id and .ITEMS_EXISTS_BY_TYPE(td_linked_persons.id,'linked_persons')) .EXIT_MESSAGE('Оператором-распорядителем на счете ДЕПО фонда должен быть управляющий') end end -- если бумага не задана или для фонда метод учета - по поручению if @stock_id1 is null or (select registr_mode_id from td_pay_fond where id=@owner_id1) = 1 update ts_sd_stock_moves set stock_id=@stock_id where id=@doc_id else begin .CHECK_STOCK_EMM_AND_TYPE(@stock_id,@stock_id1,'Эммитент и тип ЦБ в документе-основании проведения по СД должны соответствовать ЦБ в поручении') end fetch fdocs_ch into @doc_id end -- fdocs close fdocs_ch .DEALLOCATE fdocs_ch ------------- -- Проведение ------------- select @oper_date = (select arch_date from td_depo_docs where id=@id) if not exists(select 1 from td_foundation_docs fd, ts_sd_stock_moves sm where fd.depo_doc_id=@id and fd.function_id=1 and fd.id=sm.id and .PURPOSE_CODE(sm.perpose_id)<>6005 and .ITEMS_EXISTS_BY_TYPE(fd.id,'FOUNDATION_DOCS_SD')) declare fdocs cursor for select fd.id from td_foundation_docs fd, ts_sd_stock_moves sm, td_depo_docs dd where fd.depo_doc_id=@id and fd.function_id=1 and fd.id=sm.id and sm.foundation_id=dd.id and .ITEMS_EXISTS_BY_TYPE(fd.id,'FOUNDATION_DOCS_SD') order by dd.in_no for read only else declare fdocs cursor for select fd.id from td_foundation_docs fd where fd.depo_doc_id=@id and fd.function_id=1 and .ITEMS_EXISTS_BY_TYPE(fd.id,'FOUNDATION_DOCS_SD') for read only open fdocs fetch fdocs into @doc_id declare @is_first int select @is_first=1 while .CURSOR_STATE=0 begin exec ap_sd_oper_out @doc_id=@doc_id, @oper_doc_id=@id, @oper_action_id=@action_id, @oper_action_history_id=@action_history_id, @oper_date=@oper_date, @first_foundation=@is_first if @@error != 0 begin begin tran .EXEC_ACTION(@sid,'D_STOCK_OUT','STORNO_SD') update t_actions_history set dst_id=@state_id where id=@action_history_id update t_items set state_id = @state_id where id=@id commit tran return end select @is_first=0 fetch fdocs into @doc_id end -- fdocs close fdocs .DEALLOCATE fdocs commit tran $ENDTEXT(17551739) $ENDACTION $ACTION(STORNO_SD) name=Отменить проведение по СД class=9 form=null target_state=OP_END procedure=ap_50755000000028348 patterns=GENERIC_MOVE user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551739) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .UPDATE_STATE .ACTION_HISTORY .ID_VAR(@doc_id) /* select @doc_id=fd.id from td_foundation_docs fd, .ACTUAL_TABLES , t_types where fd.depo_doc_id=@id and fd.function_id=1 .ACTUAL_WHERE(fd.id) and t_types.id=t_items.type_id and upper(t_types.type_code)=upper('foundation_docs_sd') */ .OPERS_ROLL('SD_OPERS') declare fdocs cursor for select fd.id from td_foundation_docs fd where fd.depo_doc_id=@id and fd.function_id=1 and .ITEMS_EXISTS_BY_TYPE(fd.id,'FOUNDATION_DOCS_SD') for read only open fdocs fetch fdocs into @doc_id while .CURSOR_STATE=0 begin exec ap_sd_oper_roll @doc_id=@doc_id, @oper_doc_id=@id fetch fdocs into @doc_id end -- fdocs close fdocs .DEALLOCATE fdocs commit tran $ENDTEXT(17551739) $ENDACTION $ACTION(COMPLETE) name=Исполнить class=9 form=null target_state=OP_END procedure=ap_10570000000001826 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551739) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .UPDATE_STATE .ACTION_HISTORY /*-------Проводки ----------*/ .GET_PROPS declare @operday datetime select @operday = .OPERDAY if (@operday < @in_date) .EXIT_MESSAGE('Документ создан позже даты опердня') if @depocorr_oper_date is null .EXIT_MESSAGE('Не введена дата операции в ближнем узле') /*declare @dk_oper_date datetime*/ if @reestr_oper_date is null begin select @reestr_oper_date = @depocorr_oper_date .UPDATE end if (@operday < @reestr_oper_date) or (@operday < @depocorr_oper_date) or (@reestr_oper_date > @depocorr_oper_date) .EXIT_MESSAGE('Введите правильный порядок дат') .ID_VAR(@act_subacc_id) .ID_VAR(@blk_subacc_id) .ID_VAR(@b_depo_acc_id) .NAME_VAR(@blk_subacc_no) select @blk_subacc_no = null select @act_subacc_id = act_subacc_id from td_depo_subacc where id = @s_subacc_id select @b_depo_acc_id = .DEPO_ACC_FROM_SUBACC(@s_subacc_id) select @blk_subacc_id = .DEPO_GET_BLOP_SUBACC(@b_depo_acc_id,@act_subacc_id,'OP') if @blk_subacc_id is null .EXIT_MESSAGE('Раздел в операции не найден на данном счете') declare @doc_name varchar(255) select @doc_name = .ITEM_NAME(@id) declare @ret int exec @ret = ap_subacc_check_qty @plan_owner_code='DEPO', @plan_code='DEPO', @subacc_id=@blk_subacc_id, @stock_id=@stock_id, @check_date=@operday, @check_qty=@stock_qty, @check_deb_or_cred=1 if @ret!=0 .EXIT_MESSAGE('Операция приводит к отрицательным остаткам на блокировочном разделе') .DEPOOPERATION('DEPO','DEPO', @operday, '2','1',@stock_qty,@stock_id,@blk_subacc_id,@keep_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_REG',@reestr_oper_date, '2','1',@stock_qty,@stock_id,@blk_subacc_id,@keep_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_DOM',@depocorr_oper_date,'2','1',@stock_qty,@stock_id,@blk_subacc_id,@keep_subacc_id,@doc_name) .TYPE_INIT('reports_report_for_operation',1) .DEPO_GEN_NO(@in_no1_1,2) .TYPE_ASSIGN(correspondent_id,@correspondent_id,1) .TYPE_ASSIGN(in_date,@operday,1) .TYPE_ASSIGN(depo_doc_type,2,1) .TYPE_ASSIGN(folder_id,@folder_id,1) .TYPE_ASSIGN(foundation_id,@id,1) .TYPE_ASSIGN(document_form_id,@document_form_id,1) .TYPE_INSERT('reports_report_for_operation','CREATE',1) /* update td_depo_docs set foundation_remark = @foundation_remark where id = @id1_1 */ .ARH_NUMBER_UPDATE commit tran $ENDTEXT(17551739) $ENDACTION $ACTION(D_STOCK_OUT_VIEW) name=Данные (изм.) class=2 form=FORM_VIEW target_state=null procedure=ap_10570000000001824 patterns=GENERIC_UPDATE_P2 user_define=1 isvisible=1 istab=1 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(17551739) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST(ALL, 2) as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .ARGCONVERT(ALL, 2) /***************************/ if @stock_id is null .EXIT_MESSAGE('Не задана ЦБ') if (select stock_activ_flag from td_stock_emis where id = @stock_id) != 1 .EXIT_MESSAGE('Для заданной ЦБ нет подтверждения прав на актив') if @stock_qty is null .EXIT_MESSAGE('Не задано количество бумаг ') if @stock_qty <= 0 .EXIT_MESSAGE('Количество бумаг не может быть отрицательным или 0') if @s_subacc_id is null .EXIT_MESSAGE('Раздел поставщик не задан') .DEPO_ACT_SUBACC(@keep_subacc_id,@s_subacc_id,@stock_id) if @keep_subacc_id is null .EXIT_MESSAGE('Активный раздел не задан') select @t_subacc_id = @keep_subacc_id /***************************/ .TEST_UNIQUE(ALL, 2) .GET_PROPS(ALL,1) .UPDATE_ITEMS declare @ini_id numeric select @ini_id=td_depo_accounts.partner_id from td_depo_accounts,td_depo_subacc where td_depo_subacc.id=@s_subacc_id and td_depo_accounts.id=td_depo_subacc.depo_acc_id if @initiator_id is null begin update td_depo_docs set initiator_id=@ini_id where id=@id end .UPDATE(td_stock_moves,2) .RELGEN .UPDATE_STATE .ACTION_HISTORY /* ======= Автоматическая вставка документов-оснований ======== */ declare @id_fnd_s varchar(30) .ID_VAR(@id_fnd) ---------- док.основание типа Депозитарный договор --------------- .NAME_VAR(@acc_doc_no) declare @acc_doc_date datetime select @acc_doc_no = isnull(a.depo_doc_no,'Не задан'), @acc_doc_date = a.operator_doc_date from td_depo_subacc s, td_depo_accounts a where s.id = @s_subacc_id and s.depo_acc_id = a.id select @id_fnd = null select @id_fnd = min(td_foundation_docs.id) from td_foundation_docs, .ACTUAL_TABLES where td_foundation_docs.depo_doc_id = @id and td_foundation_docs.function_id = 1 and td_foundation_docs.doc_found_type_id = 600 .ACTUAL_WHERE(td_foundation_docs.id) .TYPE_INIT('foundation_docs',2) if not(@id_fnd is null) begin .TYPE_GET('foundation_docs',@id_fnd,2_1) end .TYPE_ASSIGN(depo_doc_id,@id,2) .TYPE_ASSIGN(function_id,1,2) .TYPE_ASSIGN(doc_date,@acc_doc_date,2) .TYPE_ASSIGN(doc_number,@acc_doc_no,2) .TYPE_ASSIGN(doc_found_type_id,600,2) .TYPE_ASSIGN(doc_comment,'',2) if @id_fnd is null begin .TYPE_INSERT('foundation_docs','CRT',2) select @id_fnd_s=convert(varchar,@id2_1) end else begin .TYPE_UPDATE(@id_fnd,'foundation_docs',2) select @id_fnd_s=convert(varchar,@id_fnd) end .EXEC_ACTION(@id_fnd_s,'foundation_docs_group','update_remark') commit tran $ENDTEXT(17551739) $ENDACTION $STATE2ACTION(BEG.ACTION_INSERT) state=BEG action=ACTION_INSERT $ENDSTATE2ACTION $STATE2ACTION(CAN.FORM_VIEW) state=CAN action=FORM_VIEW $ENDSTATE2ACTION $STATE2ACTION(CAN.FORM_VIEW1) state=CAN action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION_DELETE) state=ED action=ACTION_DELETE $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION_MOVE2) state=ED action=ACTION_MOVE2 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION_MOVE3) state=ED action=ACTION_MOVE3 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION_UPDATE1) state=ED action=ACTION_UPDATE1 $ENDSTATE2ACTION $STATE2ACTION(ED.FORM_VIEW) state=ED action=FORM_VIEW $ENDSTATE2ACTION $STATE2ACTION(ED.FORM_VIEW1) state=ED action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(ED.FORM_VIEW2) state=ED action=FORM_VIEW2 $ENDSTATE2ACTION $STATE2ACTION(ED.D_STOCK_OUT_VIEW) state=ED action=D_STOCK_OUT_VIEW $ENDSTATE2ACTION $STATE2ACTION(ED.REPORT4OPER_HEADERKVAS1) state=ED action=REPORT4OPER_HEADERKVAS1 $ENDSTATE2ACTION $STATE2ACTION(ED_END.ACTION_MOVE3) state=ED_END action=ACTION_MOVE3 $ENDSTATE2ACTION $STATE2ACTION(ED_END.ACTION_MOVE5) state=ED_END action=ACTION_MOVE5 $ENDSTATE2ACTION $STATE2ACTION(ED_END.ACTION_UPDATE) state=ED_END action=ACTION_UPDATE $ENDSTATE2ACTION $STATE2ACTION(ED_END.FORM_VIEW1) state=ED_END action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(ED_END.FORM_VIEW2) state=ED_END action=FORM_VIEW2 $ENDSTATE2ACTION $STATE2ACTION(ED_END.COMPLETE) state=ED_END action=COMPLETE $ENDSTATE2ACTION $STATE2ACTION(OP_END.ACTION13) state=OP_END action=ACTION13 $ENDSTATE2ACTION $STATE2ACTION(OP_END.ACTION_MOVE5) state=OP_END action=ACTION_MOVE5 $ENDSTATE2ACTION $STATE2ACTION(OP_END.FORM_VIEW) state=OP_END action=FORM_VIEW $ENDSTATE2ACTION $STATE2ACTION(OP_END.FORM_VIEW1) state=OP_END action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(OP_END.FORM_VIEW2) state=OP_END action=FORM_VIEW2 $ENDSTATE2ACTION $STATE2ACTION(OP_END.PARTS_DEL_D) state=OP_END action=PARTS_DEL_D $ENDSTATE2ACTION $STATE2ACTION(OP_END.SD_OPERS) state=OP_END action=SD_OPERS $ENDSTATE2ACTION $STATE2ACTION(OP_END.REPORT4OPER_HEADERKVAS1) state=OP_END action=REPORT4OPER_HEADERKVAS1 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.FORM_VIEW) state=OP_END_SD action=FORM_VIEW $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.FORM_VIEW1) state=OP_END_SD action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.STORNO_SD) state=OP_END_SD action=STORNO_SD $ENDSTATE2ACTION $STATE2ACTION(REF.ACTION_MOVE5) state=REF action=ACTION_MOVE5 $ENDSTATE2ACTION $STATE2ACTION(REF.FORM_VIEW) state=REF action=FORM_VIEW $ENDSTATE2ACTION $STATE2ACTION(REF.FORM_VIEW1) state=REF action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(STR.FORM_VIEW) state=STR action=FORM_VIEW $ENDSTATE2ACTION $STATE2ACTION(STR.FORM_VIEW1) state=STR action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(STR.FORM_VIEW2) state=STR action=FORM_VIEW2 $ENDSTATE2ACTION $STATE2ACTION(TST.ACTION_UPDATE) state=TST action=ACTION_UPDATE $ENDSTATE2ACTION $STATE2ACTION(TST.FORM_VIEW) state=TST action=FORM_VIEW $ENDSTATE2ACTION $STATE2ACTION(TST.FORM_VIEW1) state=TST action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(TST.FORM_VIEW2) state=TST action=FORM_VIEW2 $ENDSTATE2ACTION $STATE2ACTION(WAIT_BLK.FORM_VIEW) state=WAIT_BLK action=FORM_VIEW $ENDSTATE2ACTION $STATE2ACTION(WAIT_BLK.FORM_VIEW1) state=WAIT_BLK action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(WAIT_BLK.FORM_VIEW2) state=WAIT_BLK action=FORM_VIEW2 $ENDSTATE2ACTION $STATE2ACTION(WAIT_BLK.COMPLETE) state=WAIT_BLK action=COMPLETE $ENDSTATE2ACTION $STATE2ACTION(WAIT_PAY.FORM_VIEW) state=WAIT_PAY action=FORM_VIEW $ENDSTATE2ACTION $STATE2ACTION(WAIT_PAY.FORM_VIEW1) state=WAIT_PAY action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(WAIT_PAY.FORM_VIEW2) state=WAIT_PAY action=FORM_VIEW2 $ENDSTATE2ACTION $STATE2ACTION(WAIT_PAY.COMPLETE) state=WAIT_PAY action=COMPLETE $ENDSTATE2ACTION $STATE2ACTION(WAIT_REPL.FORM_VIEW) state=WAIT_REPL action=FORM_VIEW $ENDSTATE2ACTION $STATE2ACTION(WAIT_REPL.FORM_VIEW1) state=WAIT_REPL action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(WAIT_REPL.FORM_VIEW2) state=WAIT_REPL action=FORM_VIEW2 $ENDSTATE2ACTION $STATE2ACTION(WAIT_STNO.FORM_VIEW) state=WAIT_STNO action=FORM_VIEW $ENDSTATE2ACTION $STATE2ACTION(WAIT_STNO.FORM_VIEW1) state=WAIT_STNO action=FORM_VIEW1 $ENDSTATE2ACTION $STATE2ACTION(WAIT_STNO.FORM_VIEW2) state=WAIT_STNO action=FORM_VIEW2 $ENDSTATE2ACTION $STATE2PROP(BEG.CONTRAGENT_COMMENT) state=BEG prop=CONTRAGENT_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.CONTR_ACCOUNT) state=BEG prop=CONTR_ACCOUNT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.CONTR_JURADRESS) state=BEG prop=CONTR_JURADRESS enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.CONTR_OWNER_TYPE_ID) state=BEG prop=CONTR_OWNER_TYPE_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.CONTR_REGISTER_DATE) state=BEG prop=CONTR_REGISTER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.CONTR_REGISTER_NO) state=BEG prop=CONTR_REGISTER_NO enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.CONTR_REGISTRATOR) state=BEG prop=CONTR_REGISTRATOR enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.CORRESPONDENT_ID) state=BEG prop=CORRESPONDENT_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.DEPOCORR_OPER_DATE) state=BEG prop=DEPOCORR_OPER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.DEPOCORR_OPER_ID) state=BEG prop=DEPOCORR_OPER_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.DEPO_DOC_TYPE) state=BEG prop=DEPO_DOC_TYPE enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.DOCUMENT_FORM_ID) state=BEG prop=DOCUMENT_FORM_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.DOC_COMMENT) state=BEG prop=DOC_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.FOLDER_ID) state=BEG prop=FOLDER_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.INITIATOR_ID) state=BEG prop=INITIATOR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.IN_DATE) state=BEG prop=IN_DATE enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.IN_NO) state=BEG prop=IN_NO enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.KEEP_SUBACC_ID) state=BEG prop=KEEP_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.KEEP_TRAJECT_END_ID) state=BEG prop=KEEP_TRAJECT_END_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.MOVE_COMMENT) state=BEG prop=MOVE_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.MOVE_CONTRAGENT_NAME) state=BEG prop=MOVE_CONTRAGENT_NAME enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.OPER_FORM_ID) state=BEG prop=OPER_FORM_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.OUT_DATE) state=BEG prop=OUT_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.OUT_NO) state=BEG prop=OUT_NO enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.PAYER_ID) state=BEG prop=PAYER_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.PAY_SUM) state=BEG prop=PAY_SUM enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.REESTR_OPER_DATE) state=BEG prop=REESTR_OPER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.REESTR_OPER_ID) state=BEG prop=REESTR_OPER_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.STOCK_ID) state=BEG prop=STOCK_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.STOCK_PRICE) state=BEG prop=STOCK_PRICE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.STOCK_PRICE_CUR_ID) state=BEG prop=STOCK_PRICE_CUR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.STOCK_QTY) state=BEG prop=STOCK_QTY enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.SUM_CUR_ID) state=BEG prop=SUM_CUR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.S_SUBACC_ID) state=BEG prop=S_SUBACC_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.T_SUBACC_ID) state=BEG prop=T_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.WHO_GET) state=BEG prop=WHO_GET enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.WHO_PUT) state=BEG prop=WHO_PUT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CONTRAGENT_COMMENT) state=ED prop=CONTRAGENT_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CONTR_ACCOUNT) state=ED prop=CONTR_ACCOUNT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CONTR_JURADRESS) state=ED prop=CONTR_JURADRESS enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CONTR_OWNER_TYPE_ID) state=ED prop=CONTR_OWNER_TYPE_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CONTR_REGISTER_DATE) state=ED prop=CONTR_REGISTER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CONTR_REGISTER_NO) state=ED prop=CONTR_REGISTER_NO enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CONTR_REGISTRATOR) state=ED prop=CONTR_REGISTRATOR enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CORRESPONDENT_ID) state=ED prop=CORRESPONDENT_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.DEPOCORR_OPER_DATE) state=ED prop=DEPOCORR_OPER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.DEPOCORR_OPER_ID) state=ED prop=DEPOCORR_OPER_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.DEPO_DOC_TYPE) state=ED prop=DEPO_DOC_TYPE enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.DOCUMENT_FORM_ID) state=ED prop=DOCUMENT_FORM_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.DOC_COMMENT) state=ED prop=DOC_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.FOLDER_ID) state=ED prop=FOLDER_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.INITIATOR_ID) state=ED prop=INITIATOR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.IN_DATE) state=ED prop=IN_DATE enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.IN_NO) state=ED prop=IN_NO enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.KEEP_SUBACC_ID) state=ED prop=KEEP_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.KEEP_TRAJECT_END_ID) state=ED prop=KEEP_TRAJECT_END_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.MOVE_COMMENT) state=ED prop=MOVE_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.MOVE_CONTRAGENT_NAME) state=ED prop=MOVE_CONTRAGENT_NAME enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.OPER_FORM_ID) state=ED prop=OPER_FORM_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.OUT_DATE) state=ED prop=OUT_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.OUT_NO) state=ED prop=OUT_NO enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.PAYER_ID) state=ED prop=PAYER_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.PAY_SUM) state=ED prop=PAY_SUM enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.REESTR_OPER_DATE) state=ED prop=REESTR_OPER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.REESTR_OPER_ID) state=ED prop=REESTR_OPER_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.STOCK_ID) state=ED prop=STOCK_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.STOCK_PRICE) state=ED prop=STOCK_PRICE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.STOCK_PRICE_CUR_ID) state=ED prop=STOCK_PRICE_CUR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.STOCK_QTY) state=ED prop=STOCK_QTY enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.SUM_CUR_ID) state=ED prop=SUM_CUR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.S_SUBACC_ID) state=ED prop=S_SUBACC_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.T_SUBACC_ID) state=ED prop=T_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.WHO_GET) state=ED prop=WHO_GET enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.WHO_PUT) state=ED prop=WHO_PUT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED_END.CONTR_REGISTER_DATE) state=ED_END prop=CONTR_REGISTER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED_END.CONTR_REGISTER_NO) state=ED_END prop=CONTR_REGISTER_NO enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED_END.DEPOCORR_OPER_DATE) state=ED_END prop=DEPOCORR_OPER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED_END.MOVE_COMMENT) state=ED_END prop=MOVE_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED_END.MOVE_CONTRAGENT_NAME) state=ED_END prop=MOVE_CONTRAGENT_NAME enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED_END.REESTR_OPER_DATE) state=ED_END prop=REESTR_OPER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(OP_END.DOC_COMMENT) state=OP_END prop=DOC_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(OP_END.PAY_SUM) state=OP_END prop=PAY_SUM enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(OP_END.SUM_CUR_ID) state=OP_END prop=SUM_CUR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(TST.DEPOCORR_OPER_DATE) state=TST prop=DEPOCORR_OPER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(TST.DOC_COMMENT) state=TST prop=DOC_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(TST.MOVE_COMMENT) state=TST prop=MOVE_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(TST.REESTR_OPER_DATE) state=TST prop=REESTR_OPER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $ENDDOC