# Date: 21/11/06 # Version: 105 $DOC(D_STOCK_OUT_OTHER_DEPO) name=Снятие ЦБ (спецдеп) class=1 product=ALD_FUND name_formula=.DEPO_OPER_ITEM_NAME remark_formula=$TEXT(15501981) .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(15501981) $STATE(BEG) name=Начальный class=1 $ENDSTATE $STATE(DEL) name=Удален class=2 $ENDSTATE $STATE(ED) name=Редактируется class=0 $ENDSTATE $STATE(OP_END_SD) 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=null ref_display=null 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=17 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(OWNER_ID) name=Фонд field_name=owner_id table_name=td_depo_docs field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=18 init_class=1 init_formula=.ORGANIZATION 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=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(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=23 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=24 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=26 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=27 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=null ref_display=null 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=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(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=29 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=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(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=31 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=null ref_display=null 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=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_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=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=null ref_display=null 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=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(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=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(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=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(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=37 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=null ref_display=null 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=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 $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=39 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=40 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=ts_sd_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=20 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_PRICE) name=Сумма сделки field_name=stock_price table_name=ts_sd_stock_moves field_type=money field_length=8 field_scale=null field_prec=null page=2 order=41 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_PRICE_CUR_ID) name=Валюта сделки field_name=stock_price_cur_id table_name=ts_sd_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=42 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(COUPON_SUM) name=УНКД field_name=coupon_sum table_name=ts_sd_stock_moves field_type=money field_length=8 field_scale=null field_prec=null page=2 order=43 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(FOUND_DOC_ID) name=Договор счета ДЕПО field_name=found_doc_id table_name=ts_sd_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 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(STOCK_QTY) name=Количество field_name=stock_qty table_name=ts_sd_stock_moves field_type=money field_length=8 field_scale=null field_prec=null 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(CONTRAG_ID) name=Контрагент по учету в СД field_name=contrag_id table_name=ts_sd_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=44 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_ID) name=Сделка field_name=foundation_id table_name=ts_sd_stock_moves field_type=numeric field_length=9 field_scale=0 field_prec=18 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(PERPOSE_ID) name=Назначение field_name=perpose_id table_name=ts_sd_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(IS_COUPON_IN_PRICE) name=УНКД в том числе field_name=is_coupon_in_price table_name=ts_sd_stock_moves field_type=int field_length=4 field_scale=null field_prec=null page=2 order=45 init_class=1 init_formula=0 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(IS_COMPLETED) name=Проведено по СД field_name=is_completed table_name=ts_sd_stock_moves field_type=int field_length=4 field_scale=null field_prec=null page=10 order=46 init_class=1 init_formula=0 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(REL20) class=1 type=SD_INDOC2DOC form=FORM2 prop=null idname=doc_id_s order=2000 $ENDRELATION $RELATION(REL17) class=0 type=TARGET_PURPOSES form=null prop=PERPOSE_ID idname=null order=70 $ENDRELATION $RELATION(REL18) class=0 type=partners form=null prop=CONTRAG_ID idname=null order=80 $ENDRELATION $RELATION(REL19) 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=INITIATOR_ID idname=null order=null $ENDRELATION $RELATION(REL2) class=0 type=partners form=null prop=CORRESPONDENT_ID idname=null order=null $ENDRELATION $RELATION(REL3) class=1 type=t_operations form=item_opers_list prop=null idname=item_id_s order=130 $ENDRELATION $RELATION(REL4) class=1 type=actions_history form=uo_actions_history_list prop=null idname=null order=120 $ENDRELATION $RELATION(REL5) class=1 type=reports form=uo_reports_page_list prop=null idname=foundation_id_s order=110 $ENDRELATION $RELATION(REL6) class=1 type=foundation_docs form=uo_foundation_docs_list prop=null idname=depo_doc_id_s order=20 $ENDRELATION $RELATION(REL7) class=1 type=activdocs form=ACTION2 prop=null idname=null order=1000 $ENDRELATION $RELATION(REL8) class=0 type=pif_fund form=null prop=OWNER_ID idname=null order=null $ENDRELATION $RELATION(REL9) class=0 type=items form=null prop=FOUNDATION_ID idname=null order=50 $ENDRELATION $RELATION(REL10) class=0 type=DOG_DEALINGS_SALE form=null prop=FOUNDATION_ID idname=null order=60 $ENDRELATION $RELATION(REL11) class=0 type=partners form=null prop=PAYER_ID idname=null order=null $ENDRELATION $RELATION(REL12) class=0 type=td_stock_emis form=null prop=STOCK_ID idname=null order=10 $ENDRELATION $RELATION(REL13) class=0 type=depo_subacc form=null prop=S_SUBACC_ID idname=null order=30 $ENDRELATION $RELATION(REL14) class=0 type=depo_subacc form=null prop=KEEP_SUBACC_ID idname=null order=20 $ENDRELATION $RELATION(REL15) class=4 type=d_depo_folders form=null prop=FOLDER_ID idname=null order=null $ENDRELATION $RELATION(REL16) class=0 type=items form=null prop=FOUND_DOC_ID idname=null order=40 $ENDRELATION $FORM(D_ASSETS2ITEMS_EDIT) name=Список для привязки партий class=5 filter=null target_state= uo=uo_assets2items dw=d_assets2items_edit procedure=ap_60660000000027817 patterns=null user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(15501995) 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 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 @operday = .OPERDAY if @owner_id is null .EXIT_MESSAGE('Не задан фонд') select @fund_type_code = .ITEM_TYPE_CODE(@owner_id) select @fund_type_code = lower(@fund_type_code) 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 = .SD_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_id end else begin select @subc3_type_id = .SUBCTYPE_FROM_CODE('asset_manager') select @subc3_item_id = isnull(@initiator_id, @owner_id) end .TOTALS_QUERY_SUB(@owner_id,@fund_plan_id,@operday,@operday,@stock_account_id,'stock_emis',@stock_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 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(15501995) $ENDFORM $FORM(D_STOCK_OUT_VIEW_NOTSD) name=Данные class=5 filter=null target_state= uo=uo_edit dw=d_stock_out_view_notsd procedure=ap_50630000000029630 patterns=GENERIC_VIEW_ITEM_P2 user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(15501995) 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 .MONEY_VAR(@dog_stock_covered_qty) .ID_VAR(@foundation_id) .ID_VAR(@perpose_id) select @foundation_id = foundation_id,@perpose_id=perpose_id from ts_sd_stock_moves where id =@id if not(@perpose_id is null) begin if .PURPOSE_CODE(@perpose_id) = 6005 and not(@foundation_id is null) begin select @dog_stock_covered_qty = 0 select @dog_stock_covered_qty = .STOCK_COVERED_BY_DEAL_QTY(@id,@foundation_id) end end .VIEW_ITEM(ALL,2) end $ENDTEXT(15501995) $ACTION2RELATION(REL14.DEPO_SUBACC_NAME) relation=REL14 where=null prop=DEPO_SUBACC_NAME order=5 alias=keep_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL14.DEPO_SUBACC_NO) relation=REL14 where=null prop=DEPO_SUBACC_NO order=13 alias=keep_subacc_no $ENDACTION2RELATION $ACTION2RELATION(REL13.DEPO_SUBACC_NAME) relation=REL13 where=null prop=DEPO_SUBACC_NAME order=5 alias=s_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL13.DEPO_SUBACC_NO) relation=REL13 where=null prop=DEPO_SUBACC_NO order=13 alias=s_subacc_no $ENDACTION2RELATION $ACTION2RELATION(REL12.EMMITENT_ID) relation=REL12 where=null prop=EMMITENT_ID order=1 alias=emmitent_id_s $ENDACTION2RELATION $ACTION2RELATION(REL12.STOCK_CODE) relation=REL12 where=null prop=STOCK_CODE order=3 alias=stock_code $ENDACTION2RELATION $ACTION2RELATION(REL12.STOCK_NAME) relation=REL12 where=null prop=STOCK_NAME order=4 alias=stock_name $ENDACTION2RELATION $ACTION2RELATION(REL12.STOCK_TYPE_ID) relation=REL12 where=null prop=STOCK_TYPE_ID order=6 alias=stock_type_id_s $ENDACTION2RELATION $ACTION2RELATION(REL9.ITEM_NAME) relation=REL9 where=null prop=ITEM_NAME order=2 alias=dog_name $ENDACTION2RELATION $ACTION2RELATION(REL9.ITEM_REMARK) relation=REL9 where=null prop=ITEM_REMARK order=4 alias=dog_remark $ENDACTION2RELATION $ACTION2RELATION(REL10.STOCK_ID) relation=REL10 where=null prop=STOCK_ID order=4 alias=dog_stock_id_s $ENDACTION2RELATION $ACTION2RELATION(REL10.STOCK_QTY) relation=REL10 where=null prop=STOCK_QTY order=6 alias=dog_stock_qty $ENDACTION2RELATION $ACTION2RELATION(REL16.ITEM_NAME) relation=REL16 where=null prop=ITEM_NAME order=2 alias=dog_depo_name $ENDACTION2RELATION $ACTION2RELATION(REL16.ITEM_REMARK) relation=REL16 where=null prop=ITEM_REMARK order=4 alias=dog_depo_remark $ENDACTION2RELATION $ACTION2RELATION(REL17.CODE) relation=REL17 where=null prop=CODE order=1 alias=purpose_code $ENDACTION2RELATION $ACTION2RELATION(REL17.NAME) relation=REL17 where=null prop=NAME order=2 alias=purpose_name $ENDACTION2RELATION $ACTION2RELATION(REL18.PARTNER_CODE) relation=REL18 where=null prop=PARTNER_CODE order=1 alias=partner_code $ENDACTION2RELATION $ACTION2RELATION(REL18.PARTNER_SHORT_NAME) relation=REL18 where=null prop=PARTNER_SHORT_NAME order=4 alias=partner_short_name $ENDACTION2RELATION $CALC(DOG_STOCK_COVERED_QTY) class=1 type=money calc_lenght=null calc_prec=null calc_scale=null formula=@dog_stock_covered_qty label=null order=1 $ENDCALC $ENDFORM $FORM(FORM1) name=Просмотр class=5 filter=null target_state= uo=uo_depooper_edit dw=d_sdepo_oper_p1 procedure=ap_50630000000029625 patterns=GENERIC_VIEW_ITEM_P1 user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=3168 height=1944 proc_text=$TEXT(15501996) 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 .INSERT_INFO4OPER(@id) .VIEW_ITEM(ALL,1) /* .ACTION_HISTORY */ end $ENDTEXT(15501996) $ACTION2RELATION(REL1.PARTNER_CODE) relation=REL1 where=null prop=PARTNER_CODE order=1 alias=initiator_code $ENDACTION2RELATION $ACTION2RELATION(REL1.PARTNER_SHORT_NAME) relation=REL1 where=null prop=PARTNER_SHORT_NAME order=4 alias=initiator_short_name $ENDACTION2RELATION $ACTION2RELATION(REL2.PARTNER_CODE) relation=REL2 where=null prop=PARTNER_CODE order=1 alias=corr_code $ENDACTION2RELATION $ACTION2RELATION(REL2.PARTNER_SHORT_NAME) relation=REL2 where=null prop=PARTNER_SHORT_NAME order=4 alias=corr_short_name $ENDACTION2RELATION $ACTION2RELATION(REL11.PARTNER_CODE) relation=REL11 where=null prop=PARTNER_CODE order=1 alias=payer_code $ENDACTION2RELATION $ACTION2RELATION(REL11.PARTNER_SHORT_NAME) relation=REL11 where=null prop=PARTNER_SHORT_NAME order=4 alias=payer_short_name $ENDACTION2RELATION $ACTION2RELATION(REL8.CTRL_COMP_ID) relation=REL8 where=null prop=CTRL_COMP_ID order=null alias=ctrl_comp_id_s $ENDACTION2RELATION $ACTION2RELATION(REL8.PARTNER_CODE) relation=REL8 where=null prop=PARTNER_CODE order=null alias=fond_code $ENDACTION2RELATION $ACTION2RELATION(REL8.PARTNER_NAME) relation=REL8 where=null prop=PARTNER_NAME order=null alias=fond_name $ENDACTION2RELATION $BIND(BIND1) type=D_STOCK_OUT_OTHER_DEPO action=D_STOCK_OUT_VIEW_NOTSD class=1 order=1 idname=null $ENDBIND $BIND(BIND3) type=activdocs action=ACTION1 class=0 order=3 idname=null $ENDBIND $BIND(BIND2) type=SD_INFO4OPER action=FORM_ED class=1 order=10 idname=sid $ENDBIND $ENDFORM $ACTION(ACTION1) name=Данные (изменение) class=2 form=D_STOCK_OUT_VIEW_NOTSD target_state=null procedure=ap_50630000000029646 patterns=GENERIC_UPDATE_P2 user_define=0 isvisible=1 istab=1 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(15501998) 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) .GET_PROPS(ALL,1) /***************************/ if @perpose_id is null .EXIT_MESSAGE('Не задано целевое назначение ') if @stock_id is null .EXIT_MESSAGE('Не задана ЦБ') if .PURPOSE_CODE(@perpose_id) = 6005 and @foundation_id is null .EXIT_MESSAGE('Не задан договор основание') if @contrag_id is null .EXIT_MESSAGE('Не задан контрагент по учету в СД') if @found_doc_id is null .EXIT_MESSAGE('Не задан договор счета ДЕПО') .TYPE_GET('FUND_CONTRACTS',@found_doc_id,1) if @owner_id != @owner_id1 .EXIT_MESSAGE('Выбран договор счета ДЕПО другого фонда') else begin if @initiator_id is null and @initiator_id1 is not null .EXIT_MESSAGE('Выберите договор счета ДЕПО для фонда') else begin if @initiator_id != @initiator_id1 .EXIT_MESSAGE('Выберите договор счета ДЕПО для заданного управляющего') end end if @stock_qty <= 0 .EXIT_MESSAGE('Количество бумаг не может быть отрицательным или 0') if (@stock_price <= 0 or @stock_price is null) and -- кроме сделок предпоставки not (.PURPOSE_CODE(@perpose_id) = 6005 and (select mode_id from tb_baysale_docitems where id=@foundation_id) = 2) .EXIT_MESSAGE('Введите сумму поручения') if @stock_price <= @coupon_sum and isnull(@stock_price,0) > 0 .EXIT_MESSAGE('Сумма УНКД должна быть меньше Суммы сделки') /* if @s_subacc_id is null .EXIT_MESSAGE('Раздел поставщик не задан') */ .TEST_UNIQUE(ALL, 2) if not(@foundation_id is null) and .PURPOSE_CODE(@perpose_id) = 6005 begin .TYPE_GET('dog_dealings_sale',@foundation_id,3) .MONEY_VAR(@dog_stock_covered_qty) .MONEY_VAR(@dog_sum) .MONEY_VAR(@dog_coupon_sum) .ID_VAR(@dog_pif_cont_comp_id) .ID_VAR(@asset_manager_id) .ID_VAR(@dog_asset_manager_id) .ID_VAR(@pif_cont_comp_id) .NAME_VAR(@f_type_code) select @f_type_code = .ITEM_TYPE_CODE(@owner_id) select @f_type_code = lower(@f_type_code) if @f_type_code = 'pif_fund' begin select @pif_cont_comp_id = .GET_CTRL_COMP_ID(@owner_id) select @dog_pif_cont_comp_id = .GET_CTRL_COMP_ID(@owner_id3) if @dog_pif_cont_comp_id != @pif_cont_comp_id .EXIT_MESSAGE('УК ПИФ в сделке и в поручении должна быть одна и та же.') end if @f_type_code = 'npf_fund' begin select @asset_manager_id = isnull(@initiator_id,@owner_id) select @dog_asset_manager_id = isnull(@initiator_id3,@owner_id3) if @dog_asset_manager_id != @asset_manager_id if @initiator_id is null /* При размещении самостоятельно НПФ*/ begin if @dog_asset_manager_id != @asset_manager_id .EXIT_MESSAGE('В поручении не задан управляющий - должна быть выбрана сделка для НПФ') end else /* При размещении через УК*/ begin if @dog_asset_manager_id != @asset_manager_id .EXIT_MESSAGE('В сделке и в поручении заданы разные управляющие.') end end select @dog_stock_covered_qty = 0 select @dog_sum = 0 select @dog_coupon_sum = 0 .STOCK_COVERED_BY_DEAL(@stock_qty3,@sum_in_paycur3,@coupon_account_sum3,@dog_stock_covered_qty,@dog_sum,@dog_coupon_sum,@id,@foundation_id) if @dog_stock_covered_qty + @stock_qty > @stock_qty3 begin .EXIT_MESSAGE('Превышено количество ценных бумаг по Договору ') end if @stock_qty + @dog_stock_covered_qty < @stock_qty3 begin select @stock_price = .ROUND_MONEY((convert(double precision,@sum_in_paycur3) * @stock_qty / @stock_qty3),2) select @coupon_sum = .ROUND_MONEY((@coupon_account_sum3 * @stock_qty / @stock_qty3),2) end else begin select @stock_price = @sum_in_paycur3 - @dog_sum select @coupon_sum = @coupon_account_sum3 - @dog_coupon_sum end select @is_coupon_in_price=@is_coupon_in_sum3 end .UPDATE_ITEMS .UPDATE(ALL,2) .RELGEN .UPDATE_STATE .ACTION_HISTORY commit tran $ENDTEXT(15501998) $ENDACTION $ACTION(ACTION10) name=Изменить class=2 form=FORM1 target_state=null procedure=ap_50630000000029647 patterns=GENERIC_UPDATE_P1 user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=3241 height=1920 proc_text=$TEXT(15501998) 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(15501998) $BIND(BIND1) type=D_STOCK_OUT_OTHER_DEPO action=ACTION1 class=1 order=1 idname=null $ENDBIND $BIND(BIND2) type=activdocs action=ACTION1 class=0 order=2 idname=null $ENDBIND $BIND(BIND3) type=SD_INFO4OPER action=ACTION_UPDATE class=1 order=10 idname=sid $ENDBIND $ENDACTION $ACTION(ACTION11) name=Удалить class=9 form=null target_state=DEL procedure=ap_50630000000029650 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(15501998) 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 /*-------Проводки ----------*/ .OPERS_ROLL commit tran $ENDTEXT(15501998) $BIND(BIND1) type=D_STOCK_OUT_OTHER_DEPO action=D_STOCK_OUT_VIEW_NOTSD class=1 order=1 idname=null $ENDBIND $ENDACTION $ACTION(ACTION13) name=Отменить class=9 form=null target_state=ED procedure=ap_50630000000029653 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(15501998) 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 exec ap_sd_oper_roll @doc_id=@id, @oper_doc_id=@id .OPERS_ROLL(ALL) .ARH_FLAG_CLEAR commit tran $ENDTEXT(15501998) $ENDACTION $ACTION(ACTION15) name=Изменить привязку к партиям class=2 form=D_ASSETS2ITEMS_EDIT target_state=null procedure=ap_50630000000029655 patterns=null user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(15501999) 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(15501999) $ENDACTION $ACTION(ACTION2) name=Подтверждение class=9 form=null target_state=OP_END_SD procedure=ap_50630000000029656 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(15501999) 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 .ARH_NUMBER_UPDATE update ts_sd_stock_moves set owner_id=@owner_id, initiator_id=@initiator_id where id=@id declare @oper_date datetime select @oper_date = (select arch_date from td_depo_docs where id=@id) exec ap_sd_oper_out @doc_id=@id, @oper_doc_id=@id, @oper_action_id=@action_id, @oper_action_history_id=@action_history_id, @oper_date=@oper_date if @@error != 0 begin begin tran .ARH_FLAG_CLEAR 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 commit tran $ENDTEXT(15501999) $ENDACTION $ACTION(ACTION9) name=Добавить class=1 form=FORM1 target_state=ED procedure=ap_50630000000029662 patterns=GENERIC_INSERT_P1 user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=2926 height=2124 proc_text=$TEXT(15501999) 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(15501999) $BIND(BIND1) type=D_STOCK_OUT_OTHER_DEPO action=ACTION1 class=1 order=1 idname=null $ENDBIND $BIND(BIND2) type=activdocs action=ACTION1 class=0 order=2 idname=null $ENDBIND $BIND(BIND3) type=SD_INFO4OPER action=ACTION_UPDATE class=1 order=10 idname=sid $ENDBIND $ENDACTION $ACTION(CORRECT_PROFIT) name=# Корректировка прибыли class=9 form=null target_state=null procedure=ap_correct_profit_not_broker patterns=null user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(15501999) create procedure dbo.%PROC% @sid varchar(30) = null as .BEGIN('N') declare @acc581_id numeric(18,0) declare @acc5810_id numeric(18,0) declare @acc5811_id numeric(18,0) declare @acc901_id numeric(18,0) declare @acc902_id numeric(18,0) declare @acc903_id numeric(18,0) declare @acc551_id numeric(18,0) declare @acc863_id numeric(18,0) declare @fund_plan_id numeric(18,0) declare @del_op_id numeric(18,0) declare @subc_stock_id numeric(18,0) declare @subc_doc_id numeric(18,0) declare @subc_assman_id numeric(18,0) declare @subc1_id numeric(18,0) declare @subc2_id numeric(18,0) declare @subc3_id numeric(18,0) declare @op_cur_id numeric(18,0) declare @asset_manager_id numeric(18,0) declare @oper_sum money declare @bal_sum money declare @sale_sum money declare @overv_sum money declare @all_comis_sum money declare @all_overv_sum money declare @profit_sum money declare @sale_comis money declare @other_comis money declare @fund_type_code varchar(50) declare @oper_name varchar(50) declare @doc_name varchar(255) declare @oper_doc_name varchar(255) declare @oper_date datetime .GET_PROPS .ACTION_HISTORY select @fund_type_code=upper(.ITEM_TYPE_CODE(@owner_id)) select @op_cur_id=.CUR('RUR') select @asset_manager_id=isnull(@initiator_id,@owner_id) .TRANSACTION_SAVE create table #opers ( op_id numeric(18,0) not null, op_sum money not null, op_name varchar(255) null, subc1_id numeric(18,0) null, subc2_id numeric(18,0) null, subc3_id numeric(18,0) null ) if @fund_type_code = 'PIF_FUND' begin select @fund_plan_id = .ARG_PLAN('PIF_ACCOUNT') select @acc581_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.1') select @acc5810_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.10') select @acc5811_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.11') select @acc901_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'90') select @acc902_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'90') select @acc903_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'90') select @acc551_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'76.5.4') select @acc863_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'96.3.1') end if @fund_type_code = 'NPF_FUND' begin select @fund_plan_id = .ARG_PLAN('NPF_ACCOUNT') select @acc581_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.1') select @acc5810_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.10') select @acc5811_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.11') select @acc901_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'90.1') select @acc551_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'55.1') select @acc903_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'48') if @owner_id = @asset_manager_id begin select @acc902_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'80.2') select @acc863_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'80.2') end else begin select @acc902_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'80.1') select @acc863_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'80.1') end end select @subc_stock_id = .SUBCTYPE_FROM_CODE('STOCK_EMIS') select @subc_doc_id = .SUBCTYPE_FROM_CODE('DOC_ITEM') select @subc_assman_id = .SUBCTYPE_FROM_CODE('ASSET_MANAGER') .GET_SD_OPER_DATE(@oper_date,@id) select @doc_name=.ITEM_NAME(@id) -- Переоценка (+/-) insert into #opers (op_id,op_sum,op_name) select op.id, op.op_sum, op.op_name from t_operations op, t_oper_list ol where op.item_id = @id and op.id = ol.head_id and ol.acc_id = @acc5811_id and op.op_name not like '##%' update #opers set subc1_id=os.item_id from t_oper_list ol, t_oper_subconto os where ol.head_id = #opers.op_id and ol.deb_or_cred = -1 and ol.id = os.id and os.subconto_type_id = @subc_stock_id update #opers set subc2_id=os.item_id from t_oper_list ol, t_oper_subconto os where ol.head_id = #opers.op_id and ol.deb_or_cred = -1 and ol.id = os.id and os.subconto_type_id = @subc_doc_id update #opers set subc3_id=os.item_id from t_oper_list ol, t_oper_subconto os where ol.head_id = #opers.op_id and ol.deb_or_cred = -1 and ol.id = os.id and os.subconto_type_id = @subc_assman_id -- Комиссии продажи select @sale_comis=isnull((select sum(tb_plan_pays.plan_sum) from tb_plans, tb_plan_pays, ts_sd_stock_moves where ts_sd_stock_moves.id = @id and ts_sd_stock_moves.foundation_id = tb_plans.item_id and tb_plans.id = tb_plan_pays.id and tb_plan_pays.pay_perpose_id <> 1 and .ITEMS_EXISTS(tb_plan_pays.id)),0) select @other_comis=0 -- Сумма продажи if isnull(@is_coupon_in_price,0) = 0 select @sale_sum=@stock_price else select @sale_sum=@stock_price-isnull(@coupon_sum,0) -- Балансовая стоимость select @bal_sum=isnull((select sum(op.op_sum) from t_operations op, t_oper_list ol where op.item_id = @id and op.id = ol.head_id and ol.acc_id = @acc581_id),0) -- Комиссии покупки select @all_comis_sum=isnull((select sum(op.op_sum) from t_operations op, t_oper_list ol where op.item_id = @id and op.id = ol.head_id and ol.acc_id = @acc5810_id),0) begin tran -- Удаляем проводки по переоценке если они отрицательные delete t_operations where id in (select op.id from t_operations op, t_oper_list ol where op.item_id = @id and op.id = ol.head_id and op.op_sum < 0 and ol.acc_id = @acc5811_id) -- Удаляем проводки по прибыли delete t_operations where id in (select op.id from t_operations op, t_oper_list ol where op.item_id = @id and op.id = ol.head_id and ol.acc_id = @acc903_id) declare op_cur cursor for select op_sum, op_name, subc1_id, subc2_id, subc3_id from #opers for read only open op_cur fetch op_cur into @oper_sum, @oper_name, @subc1_id, @subc2_id, @subc3_id while .CURSOR_STATE = 0 begin select @oper_doc_name='##Коррекция - '+@oper_name select @overv_sum=@oper_sum if isnull(@overv_sum,0) > 0 begin .OPERATION(@owner_id,@fund_plan_id,@oper_date,@acc902_id,@acc5811_id,@overv_sum,@op_cur_id,@oper_date,0,null,@oper_doc_name,N) .UPDATE_SUBC(K,'stock_emis',@subc1_id) .UPDATE_SUBC(К,'doc_item',@subc2_id) if @fund_type_code = 'NPF_FUND' begin .UPDATE_SUBC(K,'asset_manager',@subc3_id) end end else if isnull(@overv_sum,0) < 0 begin select @overv_sum=@overv_sum*-1 .OPERATION(@owner_id,@fund_plan_id,@oper_date,@acc5811_id,@acc902_id,@overv_sum,@op_cur_id,@oper_date,0,null,@oper_doc_name,N) .UPDATE_SUBC(D,'stock_emis',@subc1_id) .UPDATE_SUBC(D,'doc_item',@subc2_id) if @fund_type_code = 'NPF_FUND' begin .UPDATE_SUBC(D,'asset_manager',@subc3_id) end end .SUBC_CHECK fetch op_cur into @oper_sum, @oper_name, @subc1_id, @subc2_id, @subc3_id end close op_cur .DEALLOCATE op_cur select @all_overv_sum=isnull((select sum(op.op_sum) from t_operations op, t_oper_list ol where op.item_id = @id and op.id = ol.head_id and ol.acc_id = @acc5811_id and ol.deb_or_cred = -1),0) -isnull((select sum(op.op_sum) from t_operations op, t_oper_list ol where op.item_id = @id and op.id = ol.head_id and ol.acc_id = @acc5811_id and ol.deb_or_cred = 1),0) if (select profit_oper_mode_id from td_pay_fond where id=@owner_id) = 1 begin if .GET_CLASS_VALUE_CODE_FOR_ITEM(@owner_id,'PIF_COMIS_IN_TRADES_ACC','58') <> '58' select @sale_comis=0 select @profit_sum=isnull(@sale_sum,0)-(isnull(@bal_sum,0)+isnull(@all_comis_sum,0)+isnull(@all_overv_sum,0))-isnull(@sale_comis,0)-isnull(@other_comis,0) if @profit_sum > 0 begin select @oper_doc_name='##Коррекция - Прибыль при реализации ЦБ по биржевой сделке: '+@doc_name .OPERATION(@owner_id,@fund_plan_id,@oper_date,@acc903_id,@acc863_id,@profit_sum,@op_cur_id,@oper_date,0,0,@oper_doc_name,N) if @fund_type_code = 'NPF_FUND' begin .UPDATE_SUBC(D,'asset_manager',@asset_manager_id) .UPDATE_SUBC(K,'asset_manager',@asset_manager_id) end .SUBC_CHECK end else if @profit_sum < 0 begin select @oper_doc_name='##Коррекция - Убыток при реализация ЦБ по биржевой сделке: '+@doc_name select @profit_sum = abs(@profit_sum) .OPERATION(@owner_id,@fund_plan_id,@oper_date,@acc863_id,@acc903_id,@profit_sum,@op_cur_id,@oper_date,0,0,@oper_doc_name,N) if @fund_type_code = 'NPF_FUND' begin .UPDATE_SUBC(D,'asset_manager',@asset_manager_id) .UPDATE_SUBC(K,'asset_manager',@asset_manager_id) end .SUBC_CHECK end end commit tran drop table #opers .TRANSACTION_RESTORE .END $ENDTEXT(15501999) $ENDACTION $ACTION(RUN_PROFIT_CORRECT) name=# Запуск корректировки class=9 form=null target_state=null procedure=ap_run_correct_profit patterns=null user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(15501999) create procedure dbo.%PROC% @date_bd varchar(8) = null, @date_ed varchar(8) = null, @fund_id_s varchar(30) = null as declare @date_b datetime declare @date_e datetime declare @fund_b_id numeric(18,0) declare @fund_e_id numeric(18,0) declare @doc_id numeric(18,0) declare @type_id int declare @doc_sid varchar(30) set nocount on if isnull(@date_bd,'') = '' begin select @date_b=convert(datetime,(.GET_CONST('SD_SCHA_2005')),3) end else begin select @date_b=convert(datetime,@date_bd,3) end if isnull(@date_ed,'') = '' begin select @date_e=convert(datetime,'31/12/05',3) end else begin select @date_e=convert(datetime,@date_ed,3) end if isnull(@fund_id_s,'') = '' begin select @fund_b_id=-999999999999999998 select @fund_e_id=999999999999999999 end else begin select @fund_b_id=convert(numeric(18,0),@fund_id_s) select @fund_e_id=@fund_b_id end declare deal_cur cursor for select tb.id, 1 from tb_baysale_docitems tb, td_depo_docs td where tb.id = td.id and td.owner_id between @fund_b_id and @fund_e_id and tb.transaction_date between @date_b and @date_e and .ITEMS_EXISTS_BY_TYPE(tb.id,'SD_BROK_SALE') union select sm.id, 2 from ts_sd_stock_moves sm, td_depo_docs td where sm.id = td.id and td.owner_id between @fund_b_id and @fund_e_id and td.in_date between @date_b and @date_e and .ITEMS_EXISTS_BY_TYPE(sm.id,'D_STOCK_OUT_OTHER_DEPO') for read only open deal_cur fetch deal_cur into @doc_id, @type_id while .CURSOR_STATE = 0 begin select @doc_sid=convert(varchar(30),@doc_id) /* if @type_id = 1 exec ap_correct_profit_broker @sid=@doc_sid else*/ if @type_id = 2 exec ap_correct_profit_not_broker @sid=@doc_sid fetch deal_cur into @doc_id, @type_id end close deal_cur .DEALLOCATE deal_cur $ENDTEXT(15501999) $ENDACTION $ACTION(SD_OPER_OUT) name=Проведение по СД (снятие ЦБ) class=9 form=null target_state=null procedure=ap_sd_oper_out patterns=null user_define=1 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(15501999) create proc dbo.%PROC% @doc_id numeric, -- id док-та основания поручения (=id поручения для приема не в нашем) @oper_doc_id numeric, -- id поручения @oper_action_id numeric, -- id метода поручения @oper_action_history_id numeric, @oper_date datetime -- дата проведения as begin begin tran .GET_SD_OPER_DATE(@oper_date,@doc_id) ------------ -- GET_PROPS ------------ .ID_VAR(@foundation_id) .ID_VAR(@perpose_id) .ID_VAR(@stock_id) .ID_VAR(@stock_price_cur_id) .ID_VAR(@contrag_id) .ID_VAR(@part_id) .ID_VAR(@owner_id) .ID_VAR(@initiator_id) .MONEY_VAR(@stock_price) .MONEY_VAR(@stock_qty) .MONEY_VAR(@coupon_sum) .INT_VAR(@is_coupon_in_price) select @foundation_id=foundation_id, @perpose_id=perpose_id, @stock_id=stock_id, @stock_price_cur_id=stock_price_cur_id, @contrag_id=contrag_id, @part_id=part_id, @owner_id=owner_id, @initiator_id=initiator_id, @stock_price=stock_price, @stock_qty=stock_qty, @coupon_sum=coupon_sum, @is_coupon_in_price=is_coupon_in_price from ts_sd_stock_moves where id=@doc_id declare @sd_scha_2005_d datetime select @sd_scha_2005_d=convert(datetime,(.GET_CONST('SD_SCHA_2005')),3) ------------ -- ------------ .ID_VAR(@oper_id) .ID_VAR(@asset_manager_id) .ID_VAR(@contr_id) .ID_VAR(@stock_account_id) .ID_VAR(@fund_plan_id) .ID_VAR(@doc_method_id) .ID_VAR(@sum_method_id) .ID_VAR(@subc3_type_id) .ID_VAR(@subc3_item_id) .ID_VAR(@coupon_acc_id) .ID_VAR(@pol_coupon_acc_id) .ID_VAR(@contr_account_id) .ID_VAR(@add_account_id) .ID_VAR(@acc48_id) .INT_VAR(@purpose_code) .MONEY_VAR(@stock_op_sum) .MONEY_VAR(@stock_add_sum) .MONEY_VAR(@sum_in_dog) .MONEY_VAR(@qty_saldo_coupon) .MONEY_VAR(@bal_saldo_coupon) .MONEY_VAR(@stock_price_out_coupon) .MONEY_VAR(@coupon_bal_sum_lf) .MONEY_VAR(@coupon_qty_sum_lf) .MONEY_VAR(@coupon_covered_sum) .MONEY_VAR(@coupon_bal_sum_total) .MONEY_VAR(@pol_coupon_sum) .MONEY_VAR(@coupon_add_sum) .MONEY_VAR(@stock_sum) .MONEY_VAR(@qty_saldo) .MONEY_VAR(@bal_saldo) .MONEY_VAR(@stock_price_out) .MONEY_VAR(@dog_stock_covered_qty) .MONEY_VAR(@dog_stock_covered_sum) .NAME_VAR(@stock_subc_str) .NAME_VAR(@fund_type_code) declare @comm_48_6 varchar(255), @dog_brok_name varchar(255), @comm_76_48 varchar(255) declare @cur_pay decimal(18,8) declare @r_date datetime declare @comis5810_id numeric(18,0) declare @acc5811_id numeric(18,0) declare @comis_bal_sum money declare @oper_doc_name varchar(255) declare @comis_deb_id numeric(18,0) declare @overv_sum money declare @all_overv_sum money declare @all_comis_sum money declare @check_sum_b money declare @check_sum_e money declare @stock_qty_b money declare @correct_sum money if @owner_id is null .EXIT_MESSAGE('Задайте фонд') select @fund_type_code = lower(.ITEM_TYPE_CODE(@owner_id)) ------------------- -- Счета ------------------- if @fund_type_code = 'pif_fund' begin select @fund_plan_id = .ARG_PLAN('PIF_ACCOUNT') select @acc48_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'48') select @coupon_acc_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'76.6') select @pol_coupon_acc_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'76.7') select @contr_account_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'76.5.1') select @add_account_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'96.3.1') select @comis5810_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.10') select @acc5811_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.11') select @comis_deb_id=.SD_ACCID_FROM_EFFNO(@fund_plan_id,'90') end if @fund_type_code = 'npf_fund' begin select @fund_plan_id = .ARG_PLAN('NPF_ACCOUNT') select @asset_manager_id = isnull(@initiator_id,@owner_id) select @acc48_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'48') select @coupon_acc_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'76.6') select @pol_coupon_acc_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'76.7') if @owner_id = @asset_manager_id /* При размещении НПФ*/ begin select @comis_deb_id=.SD_ACCID_FROM_EFFNO(@fund_plan_id,'80.2') select @add_account_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'80.2') select @contr_account_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'76.4') end else /* При размещении УК*/ begin select @comis_deb_id=.SD_ACCID_FROM_EFFNO(@fund_plan_id,'80.1') select @add_account_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'80.1') select @contr_account_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'76.5') end select @comis5810_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.10') select @acc5811_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.11') end -- Раскоментарить exit_message_parm в случае ошибки. -- .EXIT_MESSAGE_PARM('@asset_manager_id', @asset_manager_id) ---------------------- -- Подготовка проводок ---------------------- select @purpose_code=.PURPOSE_CODE(@perpose_id) -- Списание ЦБ по сделке if @purpose_code = 6005 begin if upper(.ITEM_STATE_CODE(@foundation_id)) = 'COMPLETE' .EXIT_MESSAGE('Cделка-основание уже перерегистрирована') if upper(.ITEM_STATE_CODE(@foundation_id)) != 'CRT' .EXIT_MESSAGE('Cделка-основание не подписана') .TYPE_GET('dog_dealings_sale',@foundation_id,2_1) if @owner_id != @owner_id2_1 .EXIT_MESSAGE('Выбрана сделка другого фонда') else begin if @initiator_id is null and @initiator_id2_1 is not null .EXIT_MESSAGE('Не задан управляющий - выберите сделку для фонда') else begin if @initiator_id != @initiator_id2_1 .EXIT_MESSAGE('Выберите сделку для заданного управляющего') end end .CHECK_STOCK_EMM_AND_TYPE(@stock_id,@stock_id2_1,'Эммитент и тип ЦБ в сделке-основании должен соответствовать эммитенту и типу ЦБ в поручении') if (select registr_mode_id from td_pay_fond where id=@owner_id) = 2 -- ЦБ из сделки begin select @stock_id = @stock_id2_1 update ts_sd_stock_moves set stock_id=@stock_id where id=@doc_id end if @mode_id2_1 is null .EXIT_MESSAGE('В сделке не задан способ расчетов по сделке') -- поставка против платежа - другой счет для ПИФ if (@mode_id2_1 = 3) and (@fund_type_code = 'pif_fund') select @contr_account_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'76.5.4') if @character_id2_1 = 1 -- Дилерская сделка select @contr_id = @contragent_id2_1 else -- Клиентская сделка select @contr_id = @organisation_id2_1 select @doc_method_id = @stock_out_method_id2_1 select @sum_method_id = @stock_out_sum_method_id2_1 select @is_coupon_in_price=@is_coupon_in_sum2_1 if @mode_id2_1 = 2 -- предпоставка select @sum_in_dog = @summ_doc_total2_1 else -- предоплата, поставка против платежа select @sum_in_dog = @sum_in_paycur2_1 .STOCK_COVERED_BY_DEAL(@stock_qty2_1,@sum_in_dog,@coupon_account_sum2_1,@dog_stock_covered_qty,@dog_stock_covered_sum,@coupon_covered_sum,@doc_id,@foundation_id) if @dog_stock_covered_qty + @stock_qty > @stock_qty2_1 .EXIT_MESSAGE('Превышено количество ценных бумаг по сделке') select @dog_brok_name = ' по сделке ' + .ITEM_NAME(@foundation_id) +' по поручению ' + .ITEM_NAME(@oper_doc_id) select @comm_48_6 ='Списание балансовой стоимости ЦБ '+ @dog_brok_name select @comm_76_48 ='Отражение задолженности покупателя ЦБ '+ @dog_brok_name end -- Другие списания else begin select @doc_method_id = out_method_id, @sum_method_id = out_sum_method_id from td_pay_fond where id = @owner_id select @contr_id = @contrag_id select @dog_stock_covered_qty = 0 select @dog_stock_covered_sum = 0 select @coupon_covered_sum = 0 select @dog_brok_name = ' по поручению ' + .ITEM_NAME(@oper_doc_id) select @comm_48_6 ='Списание балансовой стоимости ЦБ '+ @dog_brok_name select @comm_76_48 ='Отражение задолженности покупателя ЦБ '+ @dog_brok_name if @fund_type_code = 'pif_fund' begin select @contr_account_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'76.5.3') end end if @doc_method_id is null .EXIT_MESSAGE('Не задан метод списания ЦБ') if @sum_method_id is null .EXIT_MESSAGE('Не задан метод задания суммы списания ЦБ') select @stock_account_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.1') select @coupon_bal_sum_total = 0 ------------------------------------------------ -- Проверка количества ЦБ на балансе ------------------------------------------------ if @fund_type_code = 'pif_fund' begin .SALDO_FAST(@owner_id,@fund_plan_id,@oper_date,@stock_account_id,D,Y,'stock_emis',@stock_id,N,N,N,@qty_saldo) end if @fund_type_code = 'npf_fund' begin .SALDO_FAST(@owner_id,@fund_plan_id,@oper_date,@stock_account_id,D,Y,'stock_emis',@stock_id,'asset_manager',@asset_manager_id,N,@qty_saldo) end if @qty_saldo < @stock_qty begin .EXIT_MESSAGE('Не хватает ценных бумаг на счете 58.1 бухгалтерского учета фонда') end ------------------------------------------------------------------------- -- Получение данных по остаткам в разрезе документов поступления (партий) ------------------------------------------------------------------------- .TRANSACTION_SAVE if @fund_type_code = 'pif_fund' begin select @subc3_type_id = .SUBCTYPE_FROM_CODE('stock_emis') select @subc3_item_id = @stock_id end else begin select @subc3_type_id = .SUBCTYPE_FROM_CODE('asset_manager') select @subc3_item_id = @asset_manager_id end .TOTALS_QUERY_SUB(@owner_id,@fund_plan_id,@oper_date,@oper_date,@stock_account_id,'stock_emis',@stock_id,'doc_item',N,(.FROM_SUBC3),(.WHERE_SUBC3(@subc3_type_id,@subc3_item_id)),L,N,Y,N,Y) delete #tmp_oss where q_saldo_de<=0 or saldo_de<0 if isnull((select count(*) from #tmp_oss),0)=0 begin .DROP_QUERY_TABLES(#tmp_oss) .TRANSACTION_RESTORE .EXIT_MESSAGE('Не выдана разбивка по документам') end -- по остаткам по УНКД .TOTALS_QUERY_SUB(@owner_id,@fund_plan_id,@oper_date,@oper_date,@coupon_acc_id,'stock_emis',@stock_id,'doc_item',N,(.FROM_SUBC3),(.WHERE_SUBC3(@subc3_type_id,@subc3_item_id)),L,N,Y,N,Y,#tmp_coupon) delete #tmp_coupon where q_saldo_de<=0 or saldo_de<0 -- по остаткам комиссий .TOTALS_QUERY_SUB(@owner_id,@fund_plan_id,@oper_date,@oper_date,@comis5810_id,'stock_emis',@stock_id,'doc_item',N,(.FROM_SUBC3),(.WHERE_SUBC3(@subc3_type_id,@subc3_item_id)),L,Y,Y,N,Y,#tmp_comis) delete #tmp_comis where saldo_de<0 -- по остаткам комиссий .TOTALS_QUERY_SUB(@owner_id,@fund_plan_id,@oper_date,@oper_date,@acc5811_id,'stock_emis',@stock_id,'doc_item',N,(.FROM_SUBC3),(.WHERE_SUBC3(@subc3_type_id,@subc3_item_id)),L,Y,Y,N,Y,#tmp_overv) delete #tmp_overv where saldo_de = 0 ----------- -- Проводки ----------- begin tran select @check_sum_e=0 -------------------------------- -- Проводки списания (lifo-fifo) -------------------------------- .LIFO_FIFO_BEGIN(#tmp_oss,@doc_method_id,@stock_qty,@oper_doc_id) select @check_sum_b=0 --select @check_sum_e=0 select @stock_qty_b=0 select @stock_qty_b=o.q_saldo_de from #tmp_oss o,td_depo_docs d where o.subc2_id = d.id and d.id = @subc2_id_lf select @check_sum_b=isnull(@check_sum_b,0)+isnull(@saldo_lf,0) select @check_sum_e=isnull(@check_sum_e,0)+isnull(@op_sum_lf,0) -- ! валюта в проводку = валюте плана(RUR) .OPERATION(@owner_id,@fund_plan_id,@oper_date,@acc48_id,@stock_account_id,@op_sum_lf,'RUR',@oper_date,@op_qty_lf,@op_qty_lf,@comm_48_6,N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) .UPDATE_SUBC(K,'stock_emis',@stock_id,@oper_id) .UPDATE_SUBC(К,'doc_item',@subc2_id_lf,@oper_id) if @fund_type_code = 'npf_fund' begin .UPDATE_SUBC(D,'asset_manager',@asset_manager_id,@oper_id) .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) end .SUBC_CHECK(@oper_id) -- Списание УНКД if exists(select 1 from #tmp_coupon o where o.subc2_id = @subc2_id_lf) begin -- Расчет суммы списания УНКД и кол-ва по 76.6 ------------------------------------------------------------------------ /* -- old 03/09/03 select @coupon_bal_sum_lf = o.saldo_de, @coupon_qty_sum_lf = o.q_saldo_de from #tmp_coupon o where o.subc2_id = @subc2_id_lf if @coupon_qty_sum_lf > @op_qty_lf begin select @coupon_bal_sum_lf = .ROUND_MONEY((@coupon_bal_sum_lf * @op_qty_lf / @coupon_qty_sum_lf),2) select @coupon_qty_sum_lf = @op_qty_lf end */ declare @coupon_saldo_qty money select @coupon_bal_sum_lf = o.saldo_de, @coupon_saldo_qty = o.q_saldo_de from #tmp_coupon o where o.subc2_id = @subc2_id_lf select @coupon_qty_sum_lf = @q_saldo_lf -- кол-во для проводки = кол-во по текущей партии по 58.1 -- если кол-во по текущей партии по 58.1 > списанного кол-ва по текущей партии с 58.1 if @coupon_qty_sum_lf > @op_qty_lf begin -- сумма для проводки = пропорционально кол-ву, списанному по текущей партии с 58.1 select @coupon_bal_sum_lf = .ROUND_MONEY( (convert(float,1.0) * @coupon_bal_sum_lf/@coupon_qty_sum_lf * @op_qty_lf),2) -- количество для проводки = кол-ву, списанному по текущей партии с 58.1 select @coupon_qty_sum_lf = @op_qty_lf end -- если списанное кол-во по текущей партии с 58.1 > кол-ва по текущей партии по 76.6 if @coupon_qty_sum_lf > @coupon_saldo_qty select @coupon_qty_sum_lf = @coupon_saldo_qty -- количество для проводки = кол-ву по текущей партии 76.6 ------------------------------------------------------------------------------------------------------------------------- -- ! валюта в проводку = валюте плана(RUR) .OPERATION(@owner_id,@fund_plan_id,@oper_date,@pol_coupon_acc_id,@coupon_acc_id,@coupon_bal_sum_lf,'RUR',@oper_date,0,@coupon_qty_sum_lf,'Списание УНКД',N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) .UPDATE_SUBC(D,'stock_emis',@stock_id,@oper_id) .UPDATE_SUBC(K,'stock_emis',@stock_id,@oper_id) .UPDATE_SUBC(К,'doc_item',@subc2_id_lf,@oper_id) if @fund_type_code = 'npf_fund' begin .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) .UPDATE_SUBC(D,'asset_manager',@asset_manager_id,@oper_id) end .SUBC_CHECK(@oper_id) select @coupon_bal_sum_total = @coupon_bal_sum_total + @coupon_bal_sum_lf end if @sd_scha_2005_d <= @oper_date begin -- Списание расходов на приобретение ЦБ (58.10) if exists(select 1 from #tmp_comis o where o.subc2_id = @subc2_id_lf) begin if @doc_method_lf <> 3 if @q_saldo_lf < @qty_rest_lf select @comis_bal_sum=o.saldo_de -- Партия целиком from #tmp_comis o where o.subc2_id = @subc2_id_lf else begin select @comis_bal_sum=o.saldo_de -- Часть партии from #tmp_comis o where o.subc2_id = @subc2_id_lf select @comis_bal_sum=.ROUND_MONEY(( convert(float,1.0) * @comis_bal_sum / @q_saldo_lf * @op_qty_lf ),2) end else begin select @comis_bal_sum=o.saldo_de -- Выбранная партия from #tmp_comis o where o.subc2_id = @subc2_id_lf select @comis_bal_sum=.ROUND_MONEY(( convert(float,1.0) * @comis_bal_sum / @q_saldo_lf * @part_qty_lf),2) end select @check_sum_b=isnull(@check_sum_b,0)+isnull((select isnull(o.saldo_de,0) from #tmp_comis o where o.subc2_id = @subc2_id_lf),0) select @check_sum_e=isnull(@check_sum_e,0)+isnull(@comis_bal_sum,0) select @oper_doc_name='Списание расходов на приобретение ЦБ по партии: '+.ITEM_NAME(@subc2_id_lf) select @all_comis_sum=isnull(@all_comis_sum,0)+isnull(@comis_bal_sum,0) .OPERATION(@owner_id,@fund_plan_id,@oper_date,@comis_deb_id,@comis5810_id,@comis_bal_sum,@stock_price_cur_id,@oper_date,0,null,@oper_doc_name,N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) .UPDATE_SUBC(K,'stock_emis',@stock_id,@oper_id) .UPDATE_SUBC(К,'doc_item',@subc2_id_lf,@oper_id) if upper(@fund_type_code) = 'NPF_FUND' begin .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) .UPDATE_SUBC(D,'asset_manager',@asset_manager_id,@oper_id) end .SUBC_CHECK end -- Списание переоценки ЦБ (58.11) if exists(select 1 from #tmp_overv o where o.subc2_id = @subc2_id_lf) begin if @doc_method_lf <> 3 if @q_saldo_lf < @qty_rest_lf select @overv_sum=o.saldo_de -- Партия целиком from #tmp_overv o where o.subc2_id = @subc2_id_lf else begin select @overv_sum=o.saldo_de -- Часть партии from #tmp_overv o where o.subc2_id = @subc2_id_lf select @overv_sum=.ROUND_MONEY(( convert(float,1.0) * @overv_sum / @q_saldo_lf * @op_qty_lf ),2) end else begin select @overv_sum=o.saldo_de -- Выбранная партия from #tmp_overv o where o.subc2_id = @subc2_id_lf select @overv_sum=.ROUND_MONEY(( convert(float,1.0) * @overv_sum / @q_saldo_lf * @part_qty_lf ),2) end select @check_sum_b=isnull(@check_sum_b,0)+isnull((select isnull(o.saldo_de,0) from #tmp_overv o where o.subc2_id = @subc2_id_lf),0) select @check_sum_e=isnull(@check_sum_e,0)+isnull(@overv_sum,0) select @oper_doc_name='Списание переоценки ЦБ по партии: '+.ITEM_NAME(@subc2_id_lf) select @all_overv_sum=isnull(@all_overv_sum,0)+isnull(@overv_sum,0) if isnull(@overv_sum,0) > 0 begin .OPERATION(@owner_id,@fund_plan_id,@oper_date,@comis_deb_id,@acc5811_id,@overv_sum,@stock_price_cur_id,@oper_date,0,null,@oper_doc_name,N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) .UPDATE_SUBC(K,'stock_emis',@stock_id,@oper_id) .UPDATE_SUBC(К,'doc_item',@subc2_id_lf,@oper_id) if upper(@fund_type_code) = 'NPF_FUND' begin .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) .UPDATE_SUBC(D,'asset_manager',@asset_manager_id,@oper_id) end .SUBC_CHECK end else if isnull(@overv_sum,0) < 0 begin select @overv_sum=@overv_sum*-1 .OPERATION(@owner_id,@fund_plan_id,@oper_date,@acc5811_id,@comis_deb_id,@overv_sum,@stock_price_cur_id,@oper_date,0,null,@oper_doc_name,N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) .UPDATE_SUBC(D,'stock_emis',@stock_id,@oper_id) .UPDATE_SUBC(D,'doc_item',@subc2_id_lf,@oper_id) if upper(@fund_type_code) = 'NPF_FUND' begin .UPDATE_SUBC(D,'asset_manager',@asset_manager_id,@oper_id) .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) end .SUBC_CHECK end end end ---было здесь .LIFO_FIFO_END ----- Корректировка ------- select @correct_sum=0 select @check_sum_b=convert(decimal(18,2),round((convert(float,1.0) * @check_sum_b / @stock_qty_b * @stock_qty),2)) select @correct_sum=@check_sum_b-@check_sum_e if @sd_scha_2005_d <= @oper_date begin if .GET_CLASS_VALUE_CODE_FOR_ITEM(@owner_id,'CORRECT_ACC_58','NO') = 'YES' begin if @correct_sum > 0 begin .OPERATION(@owner_id,@fund_plan_id,@oper_date,@acc48_id,@stock_account_id,@correct_sum,'RUR',@oper_date,0,0,@comm_48_6,N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) .UPDATE_SUBC(K,'stock_emis',@stock_id,@oper_id) .UPDATE_SUBC(К,'doc_item',@subc2_id_lf,@oper_id) if @fund_type_code = 'npf_fund' begin .UPDATE_SUBC(D,'asset_manager',@asset_manager_id,@oper_id) .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) end end if @correct_sum < 0 begin select @correct_sum=@correct_sum*-1 .OPERATION(@owner_id,@fund_plan_id,@oper_date,@stock_account_id,@acc48_id,@correct_sum,'RUR',@oper_date,0,0,@comm_48_6,N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) .UPDATE_SUBC(D,'stock_emis',@stock_id,@oper_id) .UPDATE_SUBC(D,'doc_item',@subc2_id_lf,@oper_id) if @fund_type_code = 'npf_fund' begin .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) .UPDATE_SUBC(D,'asset_manager',@asset_manager_id,@oper_id) end end .SUBC_CHECK(@oper_id) end end ------------------------------------------------------------- ---------------------------- -- Проводки по задолженности ---------------------------- -- подготовка if @purpose_code = 6005 -- Списание ЦБ по сделке begin if @dog_stock_covered_qty + @stock_qty < @stock_qty2_1 begin select @stock_sum = .ROUND_MONEY( ( convert(float,1.0) * @sum_in_dog * @stock_qty / @stock_qty2_1),2) select @pol_coupon_sum = .ROUND_MONEY((@coupon_account_sum2_1 * @stock_qty / @stock_qty2_1),2) select @pol_coupon_sum = isnull(@pol_coupon_sum,0) end else begin select @stock_sum = @sum_in_dog - @dog_stock_covered_sum select @pol_coupon_sum = isnull(@coupon_account_sum2_1 - @coupon_covered_sum,0) end if @mode_id2_1 = 2 and @pay_cur_id2_1 != @cur_id2_1 -- предпоставка на другую валюту begin -- .CONVERT_SUM(@cur_id2_1,@pay_cur_id2_1,@oper_date,0,@stock_sum,@stock_op_sum,@cur_pay,@r_date) if isnull(@cur_price2pay_rate2_1,0) != 0 -- курс задан в сделке begin select @stock_op_sum = .ROUND_MONEY((@stock_sum * @cur_price2pay_rate2_1),2) end else begin .CONVERT_SUM(@cur_id2_1,@pay_cur_id2_1,@oper_date,0,@stock_sum,@stock_op_sum,@cur_pay,@r_date) end end else -- предоплата, поставка против платежа select @stock_op_sum = @stock_sum select @stock_op_sum=.ROUND_MONEY(@stock_op_sum,2) update ts_sd_stock_moves set stock_price=@stock_op_sum, coupon_sum=@pol_coupon_sum, is_coupon_in_price=@is_coupon_in_price where id=@doc_id end -- Другие списания else begin select @stock_sum = @stock_price select @pol_coupon_sum = isnull(@coupon_sum,0) select @stock_op_sum = @stock_sum end if @is_coupon_in_price = 1 select @stock_op_sum = @stock_op_sum - @pol_coupon_sum -- задолженность покупателя .OPERATION(@owner_id,@fund_plan_id,@oper_date,@contr_account_id,@acc48_id,@stock_op_sum,@stock_price_cur_id,@oper_date,0,@stock_qty,@comm_76_48,N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) if @fund_type_code = 'npf_fund' begin if @asset_manager_id=@owner_id begin .UPDATE_SUBC(D,'partners',@contr_id,@oper_id) end else begin .UPDATE_SUBC(D,'partners_cont',@contr_id,@oper_id) .UPDATE_SUBC(D,'partners',@asset_manager_id,@oper_id) end .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) end else begin .UPDATE_SUBC(D,'partners',@contr_id,@oper_id) end .SUBC_CHECK(@oper_id) -- отражение ПНКД в случае его наличия if @pol_coupon_sum != 0 begin .OPERATION(@owner_id,@fund_plan_id,@oper_date,@contr_account_id,@pol_coupon_acc_id,@pol_coupon_sum,@stock_price_cur_id,@oper_date,0,0,'Отражение накопленного купонного дохода',N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) .UPDATE_SUBC(K,'stock_emis',@stock_id,@oper_id) if @fund_type_code = 'npf_fund' begin if @asset_manager_id=@owner_id begin .UPDATE_SUBC(D,'partners',@contr_id,@oper_id) end else begin .UPDATE_SUBC(D,'partners_cont',@contr_id,@oper_id) .UPDATE_SUBC(D,'partners',@asset_manager_id,@oper_id) end .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) end else begin .UPDATE_SUBC(D,'partners',@contr_id,@oper_id) end .SUBC_CHECK(@oper_id) end ---------------------------------------------------------------------------- -- Проводки на прибыль при реализации (задолженность - балансовая стоимость) ---------------------------------------------------------------------------- --! валюта в проводку=валюте плана(RUR), @stock_op_sum - д.б. в валюте плана -- Способ отражения прибыли при реализации для фонда = по операциям if (select profit_oper_mode_id from td_pay_fond where id=@owner_id) = 1 begin --- select @stock_add_sum = @stock_op_sum - @bal_sum_total_lf select @stock_add_sum = isnull(@stock_op_sum,0) - (isnull(@bal_sum_total_lf,0) + isnull(@all_overv_sum,0) + isnull(@all_comis_sum,0)+isnull(@correct_sum,0)) if @stock_add_sum > 0 begin .OPERATION(@owner_id,@fund_plan_id,@oper_date,@acc48_id,@add_account_id,@stock_add_sum,'RUR',@oper_date,0,0,'Прибыль при реализации ЦБ',N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) if @fund_type_code = 'npf_fund' begin .UPDATE_SUBC(D,'asset_manager',@asset_manager_id,@oper_id) .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) end .SUBC_CHECK(@oper_id) end else if @stock_add_sum < 0 begin select @stock_add_sum = abs(@stock_add_sum) .OPERATION(@owner_id,@fund_plan_id,@oper_date,@add_account_id,@acc48_id,@stock_add_sum,'RUR',@oper_date,0,0,'Убыток от реализации ЦБ',N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) if @fund_type_code = 'npf_fund' begin .UPDATE_SUBC(D,'asset_manager',@asset_manager_id,@oper_id) .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) end .SUBC_CHECK(@oper_id) end end ---------------------------------- -- Проводки на разницу ПНКД - УНКД ---------------------------------- --! валюта в проводку=валюте плана(RUR), @pol_coupon_sum - д.б. в валюте плана select @coupon_add_sum = @pol_coupon_sum - @coupon_bal_sum_total if @coupon_add_sum > 0 begin .OPERATION(@owner_id,@fund_plan_id,@oper_date,@pol_coupon_acc_id,@add_account_id,@coupon_add_sum,'RUR',@oper_date,0,0,'Прирост стоимости имущеста от накопленного купонного дохода',N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) .UPDATE_SUBC(D,'stock_emis',@stock_id,@oper_id) if @fund_type_code = 'npf_fund' begin .UPDATE_SUBC(D,'asset_manager',@asset_manager_id,@oper_id) .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) end .SUBC_CHECK(@oper_id) end else if @coupon_add_sum < 0 begin select @coupon_add_sum = abs(@coupon_add_sum) .OPERATION(@owner_id,@fund_plan_id,@oper_date,@add_account_id,@pol_coupon_acc_id,@coupon_add_sum,'RUR',@oper_date,0,0,'Уменьшение стоимости имущеста от накопленного купонного дохода',N,@oper_id,@oper_doc_id,@oper_action_id,@oper_action_history_id) .UPDATE_SUBC(K,'stock_emis',@stock_id,@oper_id) if @fund_type_code = 'npf_fund' begin .UPDATE_SUBC(D,'asset_manager',@asset_manager_id,@oper_id) .UPDATE_SUBC(K,'asset_manager',@asset_manager_id,@oper_id) end .SUBC_CHECK(@oper_id) end ----------------- -- конец проводок ----------------- declare @j_sum money select @j_sum=@stock_op_sum+(case when @is_coupon_in_price=0 then @pol_coupon_sum else 0 end) .SD_ASSENT_ADD(@doc_id,@stock_id,@j_sum,@stock_qty,@owner_id,@perpose_id) .SD_ASSET_OPER_ADD(@doc_id,@stock_id,@j_sum,@stock_qty,@owner_id,@perpose_id,2) commit tran .DROP_QUERY_TABLES(#tmp_oss) .DROP_QUERY_TABLES(#tmp_coupon) .DROP_QUERY_TABLES(#tmp_comis) .DROP_QUERY_TABLES(#tmp_overv) .TRANSACTION_RESTORE -------------------- -- Завершение сделки -------------------- update ts_sd_stock_moves set is_completed=1 where id=@doc_id if @purpose_code = 6005 begin update td_depo_docs set foundation_id=@foundation_id where id=@oper_doc_id if @dog_stock_covered_qty + @stock_qty = @stock_qty2_1 begin declare @foundation_id_s varchar(30) select @foundation_id_s=convert(varchar(30),@foundation_id) .EXEC_ACTION(@foundation_id_s,'dog_dealings_sale','complete_sale',Y) end end commit tran end $ENDTEXT(15501999) $ENDACTION $STATE2ACTION(BEG.ACTION1) state=BEG action=ACTION1 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(BEG.ACTION10) state=BEG action=ACTION10 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(BEG.ACTION11) state=BEG action=ACTION11 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(BEG.ACTION13) state=BEG action=ACTION13 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(BEG.ACTION15) state=BEG action=ACTION15 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(BEG.ACTION2) state=BEG action=ACTION2 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(BEG.ACTION9) state=BEG action=ACTION9 is_available=1 $ENDSTATE2ACTION $STATE2ACTION(BEG.CORRECT_PROFIT) state=BEG action=CORRECT_PROFIT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(BEG.D_ASSETS2ITEMS_EDIT) state=BEG action=D_ASSETS2ITEMS_EDIT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(BEG.D_STOCK_OUT_VIEW_NOTSD) state=BEG action=D_STOCK_OUT_VIEW_NOTSD is_available=0 $ENDSTATE2ACTION $STATE2ACTION(BEG.FORM1) state=BEG action=FORM1 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(BEG.RUN_PROFIT_CORRECT) state=BEG action=RUN_PROFIT_CORRECT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(BEG.SD_OPER_OUT) state=BEG action=SD_OPER_OUT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.ACTION1) state=DEL action=ACTION1 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.ACTION10) state=DEL action=ACTION10 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.ACTION11) state=DEL action=ACTION11 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.ACTION13) state=DEL action=ACTION13 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.ACTION15) state=DEL action=ACTION15 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.ACTION2) state=DEL action=ACTION2 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.ACTION9) state=DEL action=ACTION9 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.CORRECT_PROFIT) state=DEL action=CORRECT_PROFIT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.D_ASSETS2ITEMS_EDIT) state=DEL action=D_ASSETS2ITEMS_EDIT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.D_STOCK_OUT_VIEW_NOTSD) state=DEL action=D_STOCK_OUT_VIEW_NOTSD is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.FORM1) state=DEL action=FORM1 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.RUN_PROFIT_CORRECT) state=DEL action=RUN_PROFIT_CORRECT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(DEL.SD_OPER_OUT) state=DEL action=SD_OPER_OUT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION1) state=ED action=ACTION1 is_available=1 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION10) state=ED action=ACTION10 is_available=1 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION11) state=ED action=ACTION11 is_available=1 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION13) state=ED action=ACTION13 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION15) state=ED action=ACTION15 is_available=1 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION2) state=ED action=ACTION2 is_available=1 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION9) state=ED action=ACTION9 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(ED.CORRECT_PROFIT) state=ED action=CORRECT_PROFIT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(ED.D_ASSETS2ITEMS_EDIT) state=ED action=D_ASSETS2ITEMS_EDIT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(ED.D_STOCK_OUT_VIEW_NOTSD) state=ED action=D_STOCK_OUT_VIEW_NOTSD is_available=1 $ENDSTATE2ACTION $STATE2ACTION(ED.FORM1) state=ED action=FORM1 is_available=1 $ENDSTATE2ACTION $STATE2ACTION(ED.RUN_PROFIT_CORRECT) state=ED action=RUN_PROFIT_CORRECT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(ED.SD_OPER_OUT) state=ED action=SD_OPER_OUT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.ACTION1) state=OP_END_SD action=ACTION1 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.ACTION10) state=OP_END_SD action=ACTION10 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.ACTION11) state=OP_END_SD action=ACTION11 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.ACTION13) state=OP_END_SD action=ACTION13 is_available=1 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.ACTION15) state=OP_END_SD action=ACTION15 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.ACTION2) state=OP_END_SD action=ACTION2 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.ACTION9) state=OP_END_SD action=ACTION9 is_available=0 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.CORRECT_PROFIT) state=OP_END_SD action=CORRECT_PROFIT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.D_ASSETS2ITEMS_EDIT) state=OP_END_SD action=D_ASSETS2ITEMS_EDIT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.D_STOCK_OUT_VIEW_NOTSD) state=OP_END_SD action=D_STOCK_OUT_VIEW_NOTSD is_available=1 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.FORM1) state=OP_END_SD action=FORM1 is_available=1 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.RUN_PROFIT_CORRECT) state=OP_END_SD action=RUN_PROFIT_CORRECT is_available=0 $ENDSTATE2ACTION $STATE2ACTION(OP_END_SD.SD_OPER_OUT) state=OP_END_SD action=SD_OPER_OUT is_available=0 $ENDSTATE2ACTION $STATE2PROP(BEG.CONTRAGENT_COMMENT) state=BEG prop=CONTRAGENT_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.CONTRAG_ID) state=BEG prop=CONTRAG_ID 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.COUPON_SUM) state=BEG prop=COUPON_SUM 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=0 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.FOUNDATION_ID) state=BEG prop=FOUNDATION_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.FOUNDATION_REMARK) state=BEG prop=FOUNDATION_REMARK enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(BEG.FOUND_DOC_ID) state=BEG prop=FOUND_DOC_ID enable=1 mandatory=0 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.IS_COMPLETED) state=BEG prop=IS_COMPLETED enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(BEG.IS_COUPON_IN_PRICE) state=BEG prop=IS_COUPON_IN_PRICE 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.OWNER_ID) state=BEG prop=OWNER_ID enable=0 mandatory=0 visible=0 $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.PERPOSE_ID) state=BEG prop=PERPOSE_ID 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=0 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=1 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=0 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(DEL.CONTRAGENT_COMMENT) state=DEL prop=CONTRAGENT_COMMENT enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.CONTRAG_ID) state=DEL prop=CONTRAG_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.CONTR_ACCOUNT) state=DEL prop=CONTR_ACCOUNT enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.CONTR_JURADRESS) state=DEL prop=CONTR_JURADRESS enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.CONTR_OWNER_TYPE_ID) state=DEL prop=CONTR_OWNER_TYPE_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.CONTR_REGISTER_DATE) state=DEL prop=CONTR_REGISTER_DATE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.CONTR_REGISTER_NO) state=DEL prop=CONTR_REGISTER_NO enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.CONTR_REGISTRATOR) state=DEL prop=CONTR_REGISTRATOR enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.CORRESPONDENT_ID) state=DEL prop=CORRESPONDENT_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.COUPON_SUM) state=DEL prop=COUPON_SUM enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.DEPOCORR_OPER_DATE) state=DEL prop=DEPOCORR_OPER_DATE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.DEPOCORR_OPER_ID) state=DEL prop=DEPOCORR_OPER_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.DEPO_DOC_TYPE) state=DEL prop=DEPO_DOC_TYPE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.DOCUMENT_FORM_ID) state=DEL prop=DOCUMENT_FORM_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.DOC_COMMENT) state=DEL prop=DOC_COMMENT enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.FOLDER_ID) state=DEL prop=FOLDER_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.FOUNDATION_ID) state=DEL prop=FOUNDATION_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.FOUNDATION_REMARK) state=DEL prop=FOUNDATION_REMARK enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.FOUND_DOC_ID) state=DEL prop=FOUND_DOC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.INITIATOR_ID) state=DEL prop=INITIATOR_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.IN_DATE) state=DEL prop=IN_DATE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.IN_NO) state=DEL prop=IN_NO enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.IS_COMPLETED) state=DEL prop=IS_COMPLETED enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.IS_COUPON_IN_PRICE) state=DEL prop=IS_COUPON_IN_PRICE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.KEEP_SUBACC_ID) state=DEL prop=KEEP_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.KEEP_TRAJECT_END_ID) state=DEL prop=KEEP_TRAJECT_END_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.MOVE_COMMENT) state=DEL prop=MOVE_COMMENT enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.MOVE_CONTRAGENT_NAME) state=DEL prop=MOVE_CONTRAGENT_NAME enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.OPER_FORM_ID) state=DEL prop=OPER_FORM_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.OUT_DATE) state=DEL prop=OUT_DATE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.OUT_NO) state=DEL prop=OUT_NO enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.OWNER_ID) state=DEL prop=OWNER_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.PAYER_ID) state=DEL prop=PAYER_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.PAY_SUM) state=DEL prop=PAY_SUM enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.PERPOSE_ID) state=DEL prop=PERPOSE_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.REESTR_OPER_DATE) state=DEL prop=REESTR_OPER_DATE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.REESTR_OPER_ID) state=DEL prop=REESTR_OPER_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.STOCK_ID) state=DEL prop=STOCK_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.STOCK_PRICE) state=DEL prop=STOCK_PRICE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.STOCK_PRICE_CUR_ID) state=DEL prop=STOCK_PRICE_CUR_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.STOCK_QTY) state=DEL prop=STOCK_QTY enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.SUM_CUR_ID) state=DEL prop=SUM_CUR_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.S_SUBACC_ID) state=DEL prop=S_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.T_SUBACC_ID) state=DEL prop=T_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.WHO_GET) state=DEL prop=WHO_GET enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.WHO_PUT) state=DEL prop=WHO_PUT enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(ED.CONTRAGENT_COMMENT) state=ED prop=CONTRAGENT_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CONTRAG_ID) state=ED prop=CONTRAG_ID 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.COUPON_SUM) state=ED prop=COUPON_SUM 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=0 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.FOUNDATION_ID) state=ED prop=FOUNDATION_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.FOUNDATION_REMARK) state=ED prop=FOUNDATION_REMARK enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(ED.FOUND_DOC_ID) state=ED prop=FOUND_DOC_ID enable=1 mandatory=0 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.IS_COMPLETED) state=ED prop=IS_COMPLETED enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(ED.IS_COUPON_IN_PRICE) state=ED prop=IS_COUPON_IN_PRICE 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.OWNER_ID) state=ED prop=OWNER_ID enable=0 mandatory=0 visible=0 $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.PERPOSE_ID) state=ED prop=PERPOSE_ID 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=0 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=1 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=0 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(OP_END_SD.CONTRAGENT_COMMENT) state=OP_END_SD prop=CONTRAGENT_COMMENT enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.CONTRAG_ID) state=OP_END_SD prop=CONTRAG_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.CONTR_ACCOUNT) state=OP_END_SD prop=CONTR_ACCOUNT enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.CONTR_JURADRESS) state=OP_END_SD prop=CONTR_JURADRESS enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.CONTR_OWNER_TYPE_ID) state=OP_END_SD prop=CONTR_OWNER_TYPE_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.CONTR_REGISTER_DATE) state=OP_END_SD prop=CONTR_REGISTER_DATE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.CONTR_REGISTER_NO) state=OP_END_SD prop=CONTR_REGISTER_NO enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.CONTR_REGISTRATOR) state=OP_END_SD prop=CONTR_REGISTRATOR enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.CORRESPONDENT_ID) state=OP_END_SD prop=CORRESPONDENT_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.COUPON_SUM) state=OP_END_SD prop=COUPON_SUM enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.DEPOCORR_OPER_DATE) state=OP_END_SD prop=DEPOCORR_OPER_DATE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.DEPOCORR_OPER_ID) state=OP_END_SD prop=DEPOCORR_OPER_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.DEPO_DOC_TYPE) state=OP_END_SD prop=DEPO_DOC_TYPE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.DOCUMENT_FORM_ID) state=OP_END_SD prop=DOCUMENT_FORM_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.DOC_COMMENT) state=OP_END_SD prop=DOC_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.FOLDER_ID) state=OP_END_SD prop=FOLDER_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.FOUNDATION_ID) state=OP_END_SD prop=FOUNDATION_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.FOUNDATION_REMARK) state=OP_END_SD prop=FOUNDATION_REMARK enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.FOUND_DOC_ID) state=OP_END_SD prop=FOUND_DOC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.INITIATOR_ID) state=OP_END_SD prop=INITIATOR_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.IN_DATE) state=OP_END_SD prop=IN_DATE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.IN_NO) state=OP_END_SD prop=IN_NO enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.IS_COMPLETED) state=OP_END_SD prop=IS_COMPLETED enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.IS_COUPON_IN_PRICE) state=OP_END_SD prop=IS_COUPON_IN_PRICE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.KEEP_SUBACC_ID) state=OP_END_SD prop=KEEP_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.KEEP_TRAJECT_END_ID) state=OP_END_SD prop=KEEP_TRAJECT_END_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.MOVE_COMMENT) state=OP_END_SD prop=MOVE_COMMENT enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.MOVE_CONTRAGENT_NAME) state=OP_END_SD prop=MOVE_CONTRAGENT_NAME enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.OPER_FORM_ID) state=OP_END_SD prop=OPER_FORM_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.OUT_DATE) state=OP_END_SD prop=OUT_DATE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.OUT_NO) state=OP_END_SD prop=OUT_NO enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.OWNER_ID) state=OP_END_SD prop=OWNER_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.PAYER_ID) state=OP_END_SD prop=PAYER_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.PAY_SUM) state=OP_END_SD prop=PAY_SUM enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.PERPOSE_ID) state=OP_END_SD prop=PERPOSE_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.REESTR_OPER_DATE) state=OP_END_SD prop=REESTR_OPER_DATE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.REESTR_OPER_ID) state=OP_END_SD prop=REESTR_OPER_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.STOCK_ID) state=OP_END_SD prop=STOCK_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.STOCK_PRICE) state=OP_END_SD prop=STOCK_PRICE enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.STOCK_PRICE_CUR_ID) state=OP_END_SD prop=STOCK_PRICE_CUR_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.STOCK_QTY) state=OP_END_SD prop=STOCK_QTY enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.SUM_CUR_ID) state=OP_END_SD prop=SUM_CUR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.S_SUBACC_ID) state=OP_END_SD prop=S_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.T_SUBACC_ID) state=OP_END_SD prop=T_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.WHO_GET) state=OP_END_SD prop=WHO_GET enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END_SD.WHO_PUT) state=OP_END_SD prop=WHO_PUT enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $ENDDOC