# Date: 06/10/06 # Version: 108 $DOC(SUBACC2OPER) name=Разделы счетов депо к операции class=1 product=ALD_DEPO name_formula=null remark_formula=null $STATE(CRT) name=Создан class=0 $ENDSTATE $STATE(DEL) name=Удален class=2 $ENDSTATE $STATE(NEW) name=Начальный class=1 $ENDSTATE $PROP(DEPO_SUBACC_ID) name=Раздел field_name=depo_subacc_id table_name=td_stock_convert_list field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=1 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(STOCK_QTY) name=Количество ЦБ field_name=stock_qty table_name=td_stock_convert_list field_type=money field_length=8 field_scale=4 field_prec=19 page=1 order=2 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(ITEM_ID) name=Документ конвертации field_name=item_id table_name=td_stock_convert_list field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=3 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(SREZ_LIST_ID) name=Строка среза field_name=srez_list_id table_name=td_stock_convert_list field_type=numeric field_length=9 field_scale=0 field_prec=18 page=-1 order=4 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $RELATION(REL1) class=0 type=DEPO_SUBACC form=null prop=DEPO_SUBACC_ID idname=null order=null $ENDRELATION $FORM(D_SUBACC2OPER_EDIT) name=Просмотр class=5 filter=null target_state= uo=uo_edit dw=d_subacc2oper_edit procedure=ap_10000000000018087 patterns=GENERIC_VIEW_ITEM_O user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(548) 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 if @id = -1 begin .VIEW_INIT end else begin .VIEW_ITEM end end $ENDTEXT(548) $ACTION2RELATION(REL1.DEPO_SUBACC_NAME) relation=REL1 where=null prop=DEPO_SUBACC_NAME order=null alias=depo_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL1.DEPO_SUBACC_NO) relation=REL1 where=null prop=DEPO_SUBACC_NO order=null alias=depo_subacc_no $ENDACTION2RELATION $ENDFORM $FORM(D_SUBACC2OPER_LIST) name=Разделы к операции(изм) class=4 filter=null target_state= uo=uo_list dw=d_subacc2oper_list procedure=ap_10000000000018089 patterns=GENERIC_VIEW_LIST user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1368) create procedure dbo.%PROC% @sid varchar(30) = null .ARGLIST_FILTER as declare @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric begin set nocount on select @action_id = %ACTION_ID% .CHECK_USER .CHECK_VIEW .ARGCONVERT_FILTER select sid = convert(varchar, t_items.id), state_sid = convert(varchar, t_items.state_id), type_sid = convert(varchar, t_items.type_id), t_items.item_name , state_name=(select t_states.state_name from t_states where t_states.id=t_items.state_id), type_name=(select t_types.type_name from t_types where t_types.id=t_items.type_id), convert(varchar,td_stock_convert_list.depo_subacc_id) as depo_subacc_id_s, convert(decimal(18,4),td_stock_convert_list.stock_qty) as stock_qty, convert(varchar,td_stock_convert_list.item_id) as item_id_s, r1246627484_60045000000000275.depo_subacc_name as depo_subacc_name, r1246627484_60045000000000275.depo_subacc_no as depo_subacc_no --.VIEW_CALC from #state_list, t_items , td_stock_convert_list , td_depo_subacc r1246627484_60045000000000275 where #state_list.state_id = t_items.state_id and t_items.id = td_stock_convert_list.id and td_stock_convert_list.depo_subacc_id *= r1246627484_60045000000000275.id and td_stock_convert_list.item_id = @item_id end $ENDTEXT(1368) $ACTION2RELATION(REL1.DEPO_SUBACC_NAME) relation=REL1 where=null prop=DEPO_SUBACC_NAME order=null alias=depo_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL1.DEPO_SUBACC_NO) relation=REL1 where=null prop=DEPO_SUBACC_NO order=null alias=depo_subacc_no $ENDACTION2RELATION $FILTER(ITEM_ID) type=11 label=Значение документа конвертации prop=ITEM_ID arg_code=null arg_type=null arg_length=null arg_prec=null arg_scale=null $ENDFILTER $ENDFORM $FORM(FORM1) name=Разделы к операции class=4 filter=null target_state= uo=uo_list_disable dw=d_subacc2oper_list procedure=ap_10000000000018092 patterns=GENERIC_VIEW_LIST user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1368) create procedure dbo.%PROC% @sid varchar(30) = null .ARGLIST_FILTER as declare @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric begin set nocount on select @action_id = %ACTION_ID% .CHECK_USER .CHECK_VIEW .ARGCONVERT_FILTER select sid = convert(varchar, t_items.id), state_sid = convert(varchar, t_items.state_id), type_sid = convert(varchar, t_items.type_id), t_items.item_name , state_name=(select t_states.state_name from t_states where t_states.id=t_items.state_id), type_name=(select t_types.type_name from t_types where t_types.id=t_items.type_id), convert(varchar,td_stock_convert_list.depo_subacc_id) as depo_subacc_id_s, convert(decimal(18,4),td_stock_convert_list.stock_qty) as stock_qty, convert(varchar,td_stock_convert_list.item_id) as item_id_s, r1246627484_60045000000000275.depo_subacc_name as depo_subacc_name, r1246627484_60045000000000275.depo_subacc_no as depo_subacc_no --.VIEW_CALC from #state_list, t_items , td_stock_convert_list , td_depo_subacc r1246627484_60045000000000275 where #state_list.state_id = t_items.state_id and t_items.id = td_stock_convert_list.id and td_stock_convert_list.depo_subacc_id *= r1246627484_60045000000000275.id and td_stock_convert_list.item_id = @item_id end $ENDTEXT(1368) $ACTION2RELATION(REL1.DEPO_SUBACC_NAME) relation=REL1 where=null prop=DEPO_SUBACC_NAME order=null alias=depo_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL1.DEPO_SUBACC_NO) relation=REL1 where=null prop=DEPO_SUBACC_NO order=null alias=depo_subacc_no $ENDACTION2RELATION $FILTER(ITEM_ID) type=11 label=ITEM_ID prop=ITEM_ID arg_code=null arg_type=null arg_length=null arg_prec=null arg_scale=null $ENDFILTER $ENDFORM $ACTION(ACTION1) name=Добавить class=1 form=D_SUBACC2OPER_EDIT target_state=CRT procedure=ap_10000000000018095 patterns=GENERIC_INSERT_O user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=2043 height=680 proc_text=$TEXT(3668) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric select @action_id = %ACTION_ID% .CHECK_USER .CHECK_INSERT .ARGCONVERT .INIT_VARS .TEST_UNIQUE if (select act_or_pass from td_depo_subacc where id=@depo_subacc_id)=1 .EXIT_MESSAGE('Раздел должен быть пассивным') if upper(.ITEM_TYPE_CODE(@item_id))='STOCK_UNDEPLOY' and not exists(select 1 from td_depo_subacc,td_stock_deploument where td_depo_subacc.id=@depo_subacc_id and td_stock_deploument.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_deploument.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') if upper(.ITEM_TYPE_CODE(@item_id)) in('STOCK_DEPLOY') and not exists(select 1 from td_depo_subacc,td_stock_converts where td_depo_subacc.id=@depo_subacc_id and td_stock_converts.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_converts.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') if upper(.ITEM_TYPE_CODE(@item_id)) in('STOCK_CONVERT') and not exists(select 1 from td_depo_subacc,td_stock_converts where td_depo_subacc.id=@depo_subacc_id and td_stock_converts.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_converts.s_keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') declare @stock_id numeric, @operday datetime, @oper_code varchar(30) select @oper_code=ltrim(rtrim(upper(.TYPE_CODE(((select item_id from td_stock_convert_list where id=@id)))))) if @oper_code=upper('STOCK_UNDEPLOY') begin .TRANSACTION_SAVE /*Проверка наличия количества ЦБ на разделе*/ select @stock_id=(select stock_id from td_stock_deploument where id=@item_id) select @operday=.OPERDAY .DEPO_QUERY_DECLARE(#query) .DEPO_QUERY_CREATE(#query,0) /* Задание бумаги */ insert #query_stocks(id) select td_stock_emis.id from td_stock_emis where td_stock_emis.id=@stock_id and .ITEMS_EXISTS_BY_STOCK(td_stock_emis.id) /* Задание раздела счета */ insert #query_subs(id,acc_id) select td_depo_subacc.id,td_depo_subacc.depo_acc_id from td_depo_subacc where td_depo_subacc.id=@depo_subacc_id and .ITEMS_EXISTS_BY_TYPE(td_depo_subacc.id,'DEPO_SUBACC') if @@error!=0 return set forceplan on .DEPO_QUERY_EXEC(#query,0,'DEPO','DEPO',@operday,@operday) set forceplan off declare @qty money select @qty=(select -1*sum(qty*deb_or_cred) from #query_ops where stock_id =@stock_id and sub_id=@depo_subacc_id) select @stock_qty=isnull(@stock_qty,@qty) if @qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') .DEPO_QUERY_DESTROY(#query,0) .TRANSACTION_RESTORE end else begin begin tran declare @srez_id numeric, @srez_qty money select @srez_id=td_srez_list.srez_doc_id from td_srez_list where id=(select srez_id from td_stock_converts where id=@item_id) select @srez_qty=stock_qty from td_srez_list where depo_subacc_id=@depo_subacc_id and stock_id = @stock_id if @srez_qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') end .INSERT_ITEMS .INSERT .UPDATE_STATE .RELGEN .ACTION_HISTORY select sid = convert(varchar, @id) commit tran $ENDTEXT(3668) $ENDACTION $ACTION(ACTION2) name=Изменить class=2 form=D_SUBACC2OPER_EDIT target_state=null procedure=ap_10000000000018096 patterns=GENERIC_UPDATE user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(3246) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .ARGCONVERT .TEST_UNIQUE if (select act_or_pass from td_depo_subacc where id=@depo_subacc_id)=1 .EXIT_MESSAGE('Раздел должен быть пассивным') if upper(.ITEM_TYPE_CODE(@item_id))='STOCK_UNDEPLOY' and not exists(select 1 from td_depo_subacc,td_stock_deploument where td_depo_subacc.id=@depo_subacc_id and td_stock_deploument.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_deploument.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') if upper(.ITEM_TYPE_CODE(@item_id)) in('STOCK_DEPLOY','STOCK_CONVERT') and not exists(select 1 from td_depo_subacc,td_stock_converts where td_depo_subacc.id=@depo_subacc_id and td_stock_converts.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_converts.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') declare @stock_id numeric, @operday datetime, @oper_code varchar(30) select @oper_code=ltrim(rtrim(upper(.TYPE_CODE(((select item_id from td_stock_convert_list where id=@id)))))) if @oper_code=upper('STOCK_UNDEPLOY') begin .TRANSACTION_SAVE /*Проверка наличия количества ЦБ на разделе*/ select @stock_id=(select stock_id from td_stock_deploument where id=@item_id) select @operday=.OPERDAY .DEPO_QUERY_DECLARE(#query) .DEPO_QUERY_CREATE(#query,0) /* Задание бумаги */ insert #query_stocks(id) select td_stock_emis.id from td_stock_emis where td_stock_emis.id=@stock_id and .ITEMS_EXISTS_BY_STOCK(td_stock_emis.id) /* Задание раздела счета */ insert #query_subs(id,acc_id) select td_depo_subacc.id,td_depo_subacc.depo_acc_id from td_depo_subacc where td_depo_subacc.id=@depo_subacc_id and .ITEMS_EXISTS_BY_TYPE(td_depo_subacc.id,'DEPO_SUBACC') if @@error!=0 return set forceplan on .DEPO_QUERY_EXEC(#query,0,'DEPO','DEPO',@operday,@operday) set forceplan off declare @qty money select @qty=(select -1*sum(qty*deb_or_cred) from #query_ops where stock_id =@stock_id and sub_id=@depo_subacc_id) select @stock_qty=isnull(@stock_qty,@qty) if @qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') .DEPO_QUERY_DESTROY(#query,0) .TRANSACTION_RESTORE end else begin begin tran declare @srez_id numeric, @srez_qty money select @srez_id=td_srez_list.srez_doc_id from td_srez_list where id=(select srez_id from td_stock_converts where id=@item_id) select @srez_qty=stock_qty from td_srez_list where depo_subacc_id=@depo_subacc_id and stock_id = @stock_id if @srez_qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') end .UPDATE_ITEMS .UPDATE .RELGEN .UPDATE_STATE .ACTION_HISTORY commit tran $ENDTEXT(3246) $ENDACTION $ACTION(DEL_SUBACC) name=Удалить class=9 form=null target_state=DEL procedure=ap_10000000000018097 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(431) 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 .ACTION_HISTORY .TYPE_DELETE(@id) /*-------Проводки ----------*/ commit tran $ENDTEXT(431) $ENDACTION $STATE2ACTION(CRT.ACTION2) state=CRT action=ACTION2 $ENDSTATE2ACTION $STATE2ACTION(CRT.D_SUBACC2OPER_EDIT) state=CRT action=D_SUBACC2OPER_EDIT $ENDSTATE2ACTION $STATE2ACTION(CRT.D_SUBACC2OPER_LIST) state=CRT action=D_SUBACC2OPER_LIST $ENDSTATE2ACTION $STATE2ACTION(CRT.DEL_SUBACC) state=CRT action=DEL_SUBACC $ENDSTATE2ACTION $STATE2ACTION(CRT.FORM1) state=CRT action=FORM1 $ENDSTATE2ACTION $STATE2ACTION(NEW.ACTION1) state=NEW action=ACTION1 $ENDSTATE2ACTION $STATE2ACTION(NEW.D_SUBACC2OPER_LIST) state=NEW action=D_SUBACC2OPER_LIST $ENDSTATE2ACTION $STATE2PROP(CRT.DEPO_SUBACC_ID) state=CRT prop=DEPO_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(CRT.STOCK_QTY) state=CRT prop=STOCK_QTY enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(NEW.DEPO_SUBACC_ID) state=NEW prop=DEPO_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(NEW.STOCK_QTY) state=NEW prop=STOCK_QTY enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $ENDDOC $DOC(SUBACC2CONVERT) name=Разделы счетов депо к конвертации class=1 product=ALD_DEPO name_formula=null remark_formula=null $STATE(CRT) name=Создан class=0 $ENDSTATE $STATE(DEL) name=Удален class=2 $ENDSTATE $STATE(NEW) name=Начальный class=1 $ENDSTATE $PROP(DEPO_SUBACC_ID) name=Раздел field_name=depo_subacc_id table_name=td_stock_convert_list field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=1 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(STOCK_QTY) name=Количество ЦБ field_name=stock_qty table_name=td_stock_convert_list field_type=money field_length=8 field_scale=4 field_prec=19 page=1 order=2 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(ITEM_ID) name=Документ конвертации field_name=item_id table_name=td_stock_convert_list field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=3 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $RELATION(REL1) class=0 type=DEPO_SUBACC form=null prop=DEPO_SUBACC_ID idname=null order=null $ENDRELATION $FORM(D_SUBACC2OPER_EDIT) name=Просмотр class=5 filter=null target_state= uo=uo_edit dw=d_subacc2oper_edit procedure=ap_10000000000018112 patterns=GENERIC_VIEW_ITEM_O user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(548) 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 if @id = -1 begin .VIEW_INIT end else begin .VIEW_ITEM end end $ENDTEXT(548) $ACTION2RELATION(REL1.DEPO_SUBACC_NAME) relation=REL1 where=null prop=DEPO_SUBACC_NAME order=null alias=depo_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL1.DEPO_SUBACC_NO) relation=REL1 where=null prop=DEPO_SUBACC_NO order=null alias=depo_subacc_no $ENDACTION2RELATION $ENDFORM $FORM(D_SUBACC2OPER_LIST) name=Разделы к конвертации class=4 filter=null target_state= uo=uo_list_disable dw=d_subacc2oper_list procedure=ap_10000000000018114 patterns=GENERIC_VIEW_LIST user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1368) create procedure dbo.%PROC% @sid varchar(30) = null .ARGLIST_FILTER as declare @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric begin set nocount on select @action_id = %ACTION_ID% .CHECK_USER .CHECK_VIEW .ARGCONVERT_FILTER select sid = convert(varchar, t_items.id), state_sid = convert(varchar, t_items.state_id), type_sid = convert(varchar, t_items.type_id), t_items.item_name , state_name=(select t_states.state_name from t_states where t_states.id=t_items.state_id), type_name=(select t_types.type_name from t_types where t_types.id=t_items.type_id), convert(varchar,td_stock_convert_list.depo_subacc_id) as depo_subacc_id_s, convert(decimal(18,4),td_stock_convert_list.stock_qty) as stock_qty, convert(varchar,td_stock_convert_list.item_id) as item_id_s, r1246627484_60045000000000275.depo_subacc_name as depo_subacc_name, r1246627484_60045000000000275.depo_subacc_no as depo_subacc_no --.VIEW_CALC from #state_list, t_items , td_stock_convert_list , td_depo_subacc r1246627484_60045000000000275 where #state_list.state_id = t_items.state_id and t_items.id = td_stock_convert_list.id and td_stock_convert_list.depo_subacc_id *= r1246627484_60045000000000275.id and td_stock_convert_list.item_id = @item_id end $ENDTEXT(1368) $ACTION2RELATION(REL1.DEPO_SUBACC_NAME) relation=REL1 where=null prop=DEPO_SUBACC_NAME order=7 alias=depo_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL1.DEPO_SUBACC_NO) relation=REL1 where=null prop=DEPO_SUBACC_NO order=1 alias=depo_subacc_no $ENDACTION2RELATION $FILTER(ITEM_ID) type=11 label=ITEM_ID prop=ITEM_ID arg_code=null arg_type=null arg_length=null arg_prec=null arg_scale=null $ENDFILTER $ENDFORM $FORM(FORM1) name=Разделы к конвертации(изм) class=4 filter=null target_state= uo=uo_list dw=d_subacc2oper_list procedure=ap_10000000000018106 patterns=GENERIC_VIEW_LIST user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1368) create procedure dbo.%PROC% @sid varchar(30) = null .ARGLIST_FILTER as declare @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric begin set nocount on select @action_id = %ACTION_ID% .CHECK_USER .CHECK_VIEW .ARGCONVERT_FILTER select sid = convert(varchar, t_items.id), state_sid = convert(varchar, t_items.state_id), type_sid = convert(varchar, t_items.type_id), t_items.item_name , state_name=(select t_states.state_name from t_states where t_states.id=t_items.state_id), type_name=(select t_types.type_name from t_types where t_types.id=t_items.type_id), convert(varchar,td_stock_convert_list.depo_subacc_id) as depo_subacc_id_s, convert(decimal(18,4),td_stock_convert_list.stock_qty) as stock_qty, convert(varchar,td_stock_convert_list.item_id) as item_id_s, r1246627484_60045000000000275.depo_subacc_name as depo_subacc_name, r1246627484_60045000000000275.depo_subacc_no as depo_subacc_no --.VIEW_CALC from #state_list, t_items , td_stock_convert_list , td_depo_subacc r1246627484_60045000000000275 where #state_list.state_id = t_items.state_id and t_items.id = td_stock_convert_list.id and td_stock_convert_list.depo_subacc_id *= r1246627484_60045000000000275.id and td_stock_convert_list.item_id = @item_id end $ENDTEXT(1368) $ACTION2RELATION(REL1.DEPO_SUBACC_NAME) relation=REL1 where=null prop=DEPO_SUBACC_NAME order=null alias=depo_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL1.DEPO_SUBACC_NO) relation=REL1 where=null prop=DEPO_SUBACC_NO order=null alias=depo_subacc_no $ENDACTION2RELATION $FILTER(ITEM_ID) type=11 label=Значение документа конвертации prop=ITEM_ID arg_code=null arg_type=null arg_length=null arg_prec=null arg_scale=null $ENDFILTER $ENDFORM $FORM(FORM2) name=Разделы к погашению class=4 filter=null target_state= uo=uo_list_disable dw=d_subacc2oper_list procedure=ap_10000000000018109 patterns=GENERIC_VIEW_LIST user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1372) create procedure dbo.%PROC% @sid varchar(30) = null .ARGLIST_FILTER as declare @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric begin set nocount on select @action_id = %ACTION_ID% .CHECK_USER .CHECK_VIEW .ARGCONVERT_FILTER select sid = convert(varchar, t_items.id), state_sid = convert(varchar, t_items.state_id), type_sid = convert(varchar, t_items.type_id), t_items.item_name , state_name=(select t_states.state_name from t_states where t_states.id=t_items.state_id), type_name=(select t_types.type_name from t_types where t_types.id=t_items.type_id), convert(varchar,td_stock_convert_list.depo_subacc_id) as depo_subacc_id_s, convert(decimal(18,4),td_stock_convert_list.stock_qty) as stock_qty, convert(varchar,td_stock_convert_list.item_id) as item_id_s, r1246627484_60045000000000275.depo_subacc_name as depo_subacc_name, r1246627484_60045000000000275.depo_subacc_no as depo_subacc_no --.VIEW_CALC from #state_list, t_items , td_stock_convert_list , td_depo_subacc r1246627484_60045000000000275 where #state_list.state_id = t_items.state_id and t_items.id = td_stock_convert_list.id and td_stock_convert_list.depo_subacc_id *= r1246627484_60045000000000275.id and td_stock_convert_list.item_id = @item_id end $ENDTEXT(1372) $ACTION2RELATION(REL1.DEPO_SUBACC_NAME) relation=REL1 where=null prop=DEPO_SUBACC_NAME order=7 alias=depo_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL1.DEPO_SUBACC_NO) relation=REL1 where=null prop=DEPO_SUBACC_NO order=1 alias=depo_subacc_no $ENDACTION2RELATION $FILTER(ITEM_ID) type=11 label=ITEM_ID prop=ITEM_ID arg_code=null arg_type=null arg_length=null arg_prec=null arg_scale=null $ENDFILTER $ENDFORM $ACTION(ACTION1) name=Добавить class=1 form=D_SUBACC2OPER_EDIT target_state=CRT procedure=ap_10000000000018117 patterns=GENERIC_INSERT_O user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(3242) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric select @action_id = %ACTION_ID% .CHECK_USER .CHECK_INSERT .ARGCONVERT .INIT_VARS .TEST_UNIQUE if (select act_or_pass from td_depo_subacc where id=@depo_subacc_id)=1 .EXIT_MESSAGE('Раздел должен быть пассивным') if upper(.ITEM_TYPE_CODE(@item_id))='STOCK_UNDEPLOY' and not exists(select 1 from td_depo_subacc,td_stock_deploument where td_depo_subacc.id=@depo_subacc_id and td_stock_deploument.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_deploument.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') if upper(.ITEM_TYPE_CODE(@item_id))='STOCK_DEPLOY' and not exists(select 1 from td_depo_subacc,td_stock_converts where td_depo_subacc.id=@depo_subacc_id and td_stock_converts.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_converts.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') declare @stock_id numeric, @operday datetime, @oper_code varchar(30) select @oper_code=ltrim(rtrim(upper(.TYPE_CODE(((select item_id from td_stock_convert_list where id=@id)))))) if @oper_code=upper('STOCK_UNDEPLOY') begin .TRANSACTION_SAVE /*Проверка наличия количества ЦБ на разделе*/ select @stock_id=(select stock_id from td_stock_deploument where id=@item_id) select @operday=.OPERDAY .DEPO_QUERY_DECLARE(#query) .DEPO_QUERY_CREATE(#query,0) /* Задание бумаги */ insert #query_stocks(id) select td_stock_emis.id from td_stock_emis where td_stock_emis.id=@stock_id and .ITEMS_EXISTS_BY_STOCK(td_stock_emis.id) /* Задание раздела счета */ insert #query_subs(id,acc_id) select td_depo_subacc.id,td_depo_subacc.depo_acc_id from td_depo_subacc where td_depo_subacc.id=@depo_subacc_id and .ITEMS_EXISTS_BY_TYPE(td_depo_subacc.id,'DEPO_SUBACC') if @@error!=0 return set forceplan on .DEPO_QUERY_EXEC(#query,0,'DEPO','DEPO',@operday,@operday) set forceplan off declare @qty money select @qty=(select -1*sum(qty*deb_or_cred) from #query_ops where stock_id =@stock_id and sub_id=@depo_subacc_id) select @stock_qty=isnull(@stock_qty,@qty) if @qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') .DEPO_QUERY_DESTROY(#query,0) .TRANSACTION_RESTORE end else begin begin tran declare @srez_id numeric, @srez_qty money select @srez_id=td_srez_list.srez_doc_id from td_srez_list where id=(select srez_id from td_stock_converts where id=@item_id) select @srez_qty=stock_qty from td_srez_list where depo_subacc_id=@depo_subacc_id and stock_id = @stock_id if @srez_qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') end .INSERT_ITEMS .INSERT .UPDATE_STATE .RELGEN .ACTION_HISTORY select sid = convert(varchar, @id) commit tran $ENDTEXT(3242) $ENDACTION $ACTION(ACTION2) name=Изменить class=2 form=D_SUBACC2OPER_EDIT target_state=null procedure=ap_10000000000018118 patterns=GENERIC_UPDATE user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(3226) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .ARGCONVERT .TEST_UNIQUE if (select act_or_pass from td_depo_subacc where id=@depo_subacc_id)=1 .EXIT_MESSAGE('Раздел должен быть пассивным') if upper(.ITEM_TYPE_CODE(@item_id))='STOCK_UNDEPLOY' and not exists(select 1 from td_depo_subacc,td_stock_deploument where td_depo_subacc.id=@depo_subacc_id and td_stock_deploument.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_deploument.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') if upper(.ITEM_TYPE_CODE(@item_id))='STOCK_DEPLOY' and not exists(select 1 from td_depo_subacc,td_stock_converts where td_depo_subacc.id=@depo_subacc_id and td_stock_converts.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_converts.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') declare @stock_id numeric, @operday datetime, @oper_code varchar(30) select @oper_code=ltrim(rtrim(upper(.TYPE_CODE(((select item_id from td_stock_convert_list where id=@id)))))) if @oper_code=upper('STOCK_UNDEPLOY') begin .TRANSACTION_SAVE /*Проверка наличия количества ЦБ на разделе*/ select @stock_id=(select stock_id from td_stock_deploument where id=@item_id) select @operday=.OPERDAY .DEPO_QUERY_DECLARE(#query) .DEPO_QUERY_CREATE(#query,0) /* Задание бумаги */ insert #query_stocks(id) select td_stock_emis.id from td_stock_emis where td_stock_emis.id=@stock_id and .ITEMS_EXISTS_BY_STOCK(td_stock_emis.id) /* Задание раздела счета */ insert #query_subs(id,acc_id) select td_depo_subacc.id,td_depo_subacc.depo_acc_id from td_depo_subacc where td_depo_subacc.id=@depo_subacc_id and .ITEMS_EXISTS_BY_TYPE(td_depo_subacc.id,'DEPO_SUBACC') if @@error!=0 return set forceplan on .DEPO_QUERY_EXEC(#query,0,'DEPO','DEPO',@operday,@operday) set forceplan off declare @qty money select @qty=(select -1*sum(qty*deb_or_cred) from #query_ops where stock_id =@stock_id and sub_id=@depo_subacc_id) select @stock_qty=isnull(@stock_qty,@qty) if @qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') .DEPO_QUERY_DESTROY(#query,0) .TRANSACTION_RESTORE end else begin begin tran declare @srez_id numeric, @srez_qty money select @srez_id=td_srez_list.srez_doc_id from td_srez_list where id=(select srez_id from td_stock_converts where id=@item_id) select @srez_qty=stock_qty from td_srez_list where depo_subacc_id=@depo_subacc_id and stock_id = @stock_id if @srez_qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') end .UPDATE_ITEMS .UPDATE .RELGEN .UPDATE_STATE .ACTION_HISTORY commit tran $ENDTEXT(3226) $ENDACTION $ACTION(ACTION3) name=Удалить class=9 form=null target_state=DEL procedure=ap_10000000000018119 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(431) 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 .ACTION_HISTORY .TYPE_DELETE(@id) /*-------Проводки ----------*/ commit tran $ENDTEXT(431) $ENDACTION $STATE2ACTION(CRT.ACTION2) state=CRT action=ACTION2 $ENDSTATE2ACTION $STATE2ACTION(CRT.ACTION3) state=CRT action=ACTION3 $ENDSTATE2ACTION $STATE2ACTION(CRT.D_SUBACC2OPER_EDIT) state=CRT action=D_SUBACC2OPER_EDIT $ENDSTATE2ACTION $STATE2ACTION(CRT.D_SUBACC2OPER_LIST) state=CRT action=D_SUBACC2OPER_LIST $ENDSTATE2ACTION $STATE2ACTION(CRT.FORM1) state=CRT action=FORM1 $ENDSTATE2ACTION $STATE2ACTION(CRT.FORM2) state=CRT action=FORM2 $ENDSTATE2ACTION $STATE2ACTION(NEW.ACTION1) state=NEW action=ACTION1 $ENDSTATE2ACTION $STATE2ACTION(NEW.FORM1) state=NEW action=FORM1 $ENDSTATE2ACTION $STATE2PROP(CRT.DEPO_SUBACC_ID) state=CRT prop=DEPO_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(CRT.STOCK_QTY) state=CRT prop=STOCK_QTY enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(NEW.DEPO_SUBACC_ID) state=NEW prop=DEPO_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(NEW.STOCK_QTY) state=NEW prop=STOCK_QTY enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $ENDDOC $DOC(SUBACC_AFTER_CONVERT) name=Разделы счетов депо после конвертации class=1 product=ALD_DEPO name_formula=null remark_formula=null $STATE(CRT) name=Создан class=0 $ENDSTATE $STATE(DEL) name=Удален class=2 $ENDSTATE $STATE(NEW) name=Начальный class=1 $ENDSTATE $PROP(DEPO_SUBACC_ID) name=Раздел field_name=depo_subacc_id table_name=td_stock_convert_list field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=1 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(STOCK_QTY) name=Количество ЦБ field_name=stock_qty table_name=td_stock_convert_list field_type=money field_length=8 field_scale=4 field_prec=19 page=1 order=2 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(ITEM_ID) name=Документ конвертации field_name=item_id table_name=td_stock_convert_list field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=3 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $RELATION(REL1) class=0 type=DEPO_SUBACC form=null prop=DEPO_SUBACC_ID idname=null order=null $ENDRELATION $FORM(FORM1) name=Разделы после конвертации class=4 filter=null target_state= uo=uo_list_disable dw=d_subacc2oper_list procedure=ap_10000000000018148 patterns=GENERIC_VIEW_LIST user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1368) create procedure dbo.%PROC% @sid varchar(30) = null .ARGLIST_FILTER as declare @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric begin set nocount on select @action_id = %ACTION_ID% .CHECK_USER .CHECK_VIEW .ARGCONVERT_FILTER select sid = convert(varchar, t_items.id), state_sid = convert(varchar, t_items.state_id), type_sid = convert(varchar, t_items.type_id), t_items.item_name , state_name=(select t_states.state_name from t_states where t_states.id=t_items.state_id), type_name=(select t_types.type_name from t_types where t_types.id=t_items.type_id), convert(varchar,td_stock_convert_list.depo_subacc_id) as depo_subacc_id_s, convert(decimal(18,4),td_stock_convert_list.stock_qty) as stock_qty, convert(varchar,td_stock_convert_list.item_id) as item_id_s, r1246627484_60045000000000275.depo_subacc_name as depo_subacc_name, r1246627484_60045000000000275.depo_subacc_no as depo_subacc_no --.VIEW_CALC from #state_list, t_items , td_stock_convert_list , td_depo_subacc r1246627484_60045000000000275 where #state_list.state_id = t_items.state_id and t_items.id = td_stock_convert_list.id and td_stock_convert_list.depo_subacc_id *= r1246627484_60045000000000275.id and td_stock_convert_list.item_id = @item_id end $ENDTEXT(1368) $ACTION2RELATION(REL1.DEPO_SUBACC_NAME) relation=REL1 where=null prop=DEPO_SUBACC_NAME order=null alias=depo_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL1.DEPO_SUBACC_NO) relation=REL1 where=null prop=DEPO_SUBACC_NO order=null alias=depo_subacc_no $ENDACTION2RELATION $FILTER(ITEM_ID) type=11 label=ITEM_ID prop=ITEM_ID arg_code=null arg_type=null arg_length=null arg_prec=null arg_scale=null $ENDFILTER $ENDFORM $FORM(FORM2) name=Просмотр class=5 filter=null target_state= uo=uo_edit dw=d_subacc2oper_edit procedure=ap_10000000000018151 patterns=GENERIC_VIEW_ITEM_O user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(548) 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 if @id = -1 begin .VIEW_INIT end else begin .VIEW_ITEM end end $ENDTEXT(548) $ACTION2RELATION(REL1.DEPO_SUBACC_NAME) relation=REL1 where=null prop=DEPO_SUBACC_NAME order=null alias=depo_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL1.DEPO_SUBACC_NO) relation=REL1 where=null prop=DEPO_SUBACC_NO order=null alias=depo_subacc_no $ENDACTION2RELATION $ENDFORM $FORM(FORM3) name=Разделы после конвертации(изм) class=4 filter=null target_state= uo=uo_list dw=d_subacc2oper_list procedure=ap_10000000000018153 patterns=GENERIC_VIEW_LIST user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1368) create procedure dbo.%PROC% @sid varchar(30) = null .ARGLIST_FILTER as declare @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric begin set nocount on select @action_id = %ACTION_ID% .CHECK_USER .CHECK_VIEW .ARGCONVERT_FILTER select sid = convert(varchar, t_items.id), state_sid = convert(varchar, t_items.state_id), type_sid = convert(varchar, t_items.type_id), t_items.item_name , state_name=(select t_states.state_name from t_states where t_states.id=t_items.state_id), type_name=(select t_types.type_name from t_types where t_types.id=t_items.type_id), convert(varchar,td_stock_convert_list.depo_subacc_id) as depo_subacc_id_s, convert(decimal(18,4),td_stock_convert_list.stock_qty) as stock_qty, convert(varchar,td_stock_convert_list.item_id) as item_id_s, r1246627484_60045000000000275.depo_subacc_name as depo_subacc_name, r1246627484_60045000000000275.depo_subacc_no as depo_subacc_no --.VIEW_CALC from #state_list, t_items , td_stock_convert_list , td_depo_subacc r1246627484_60045000000000275 where #state_list.state_id = t_items.state_id and t_items.id = td_stock_convert_list.id and td_stock_convert_list.depo_subacc_id *= r1246627484_60045000000000275.id and td_stock_convert_list.item_id = @item_id end $ENDTEXT(1368) $ACTION2RELATION(REL1.DEPO_SUBACC_NAME) relation=REL1 where=null prop=DEPO_SUBACC_NAME order=null alias=depo_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL1.DEPO_SUBACC_NO) relation=REL1 where=null prop=DEPO_SUBACC_NO order=null alias=depo_subacc_no $ENDACTION2RELATION $FILTER(ITEM_ID) type=11 label=Значение документа конвертации prop=ITEM_ID arg_code=null arg_type=null arg_length=null arg_prec=null arg_scale=null $ENDFILTER $ENDFORM $ACTION(ACTION1) name=Удалить class=9 form=null target_state=DEL procedure=ap_10000000000018156 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(431) 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 .ACTION_HISTORY .TYPE_DELETE(@id) /*-------Проводки ----------*/ commit tran $ENDTEXT(431) $ENDACTION $ACTION(ACTION2) name=Добавить class=1 form=FORM2 target_state=CRT procedure=ap_10000000000018157 patterns=GENERIC_INSERT_O user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(3242) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric select @action_id = %ACTION_ID% .CHECK_USER .CHECK_INSERT .ARGCONVERT .INIT_VARS .TEST_UNIQUE if (select act_or_pass from td_depo_subacc where id=@depo_subacc_id)=1 .EXIT_MESSAGE('Раздел должен быть пассивным') if upper(.ITEM_TYPE_CODE(@item_id))='STOCK_UNDEPLOY' and not exists(select 1 from td_depo_subacc,td_stock_deploument where td_depo_subacc.id=@depo_subacc_id and td_stock_deploument.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_deploument.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') if upper(.ITEM_TYPE_CODE(@item_id))='STOCK_DEPLOY' and not exists(select 1 from td_depo_subacc,td_stock_converts where td_depo_subacc.id=@depo_subacc_id and td_stock_converts.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_converts.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') declare @stock_id numeric, @operday datetime, @oper_code varchar(30) select @oper_code=ltrim(rtrim(upper(.TYPE_CODE(((select item_id from td_stock_convert_list where id=@id)))))) if @oper_code=upper('STOCK_UNDEPLOY') begin .TRANSACTION_SAVE /*Проверка наличия количества ЦБ на разделе*/ select @stock_id=(select stock_id from td_stock_deploument where id=@item_id) select @operday=.OPERDAY .DEPO_QUERY_DECLARE(#query) .DEPO_QUERY_CREATE(#query,0) /* Задание бумаги */ insert #query_stocks(id) select td_stock_emis.id from td_stock_emis where td_stock_emis.id=@stock_id and .ITEMS_EXISTS_BY_STOCK(td_stock_emis.id) /* Задание раздела счета */ insert #query_subs(id,acc_id) select td_depo_subacc.id,td_depo_subacc.depo_acc_id from td_depo_subacc where td_depo_subacc.id=@depo_subacc_id and .ITEMS_EXISTS_BY_TYPE(td_depo_subacc.id,'DEPO_SUBACC') if @@error!=0 return set forceplan on .DEPO_QUERY_EXEC(#query,0,'DEPO','DEPO',@operday,@operday) set forceplan off declare @qty money select @qty=(select -1*sum(qty*deb_or_cred) from #query_ops where stock_id =@stock_id and sub_id=@depo_subacc_id) select @stock_qty=isnull(@stock_qty,@qty) if @qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') .DEPO_QUERY_DESTROY(#query,0) .TRANSACTION_RESTORE end else begin begin tran declare @srez_id numeric, @srez_qty money select @srez_id=td_srez_list.srez_doc_id from td_srez_list where id=(select srez_id from td_stock_converts where id=@item_id) select @srez_qty=stock_qty from td_srez_list where depo_subacc_id=@depo_subacc_id and stock_id = @stock_id if @srez_qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') end .INSERT_ITEMS .INSERT .UPDATE_STATE .RELGEN .ACTION_HISTORY select sid = convert(varchar, @id) commit tran $ENDTEXT(3242) $ENDACTION $ACTION(ACTION3) name=Изменить class=2 form=FORM2 target_state=null procedure=ap_10000000000018158 patterns=GENERIC_UPDATE user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(3226) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .ARGCONVERT .TEST_UNIQUE if (select act_or_pass from td_depo_subacc where id=@depo_subacc_id)=1 .EXIT_MESSAGE('Раздел должен быть пассивным') if upper(.ITEM_TYPE_CODE(@item_id))='STOCK_UNDEPLOY' and not exists(select 1 from td_depo_subacc,td_stock_deploument where td_depo_subacc.id=@depo_subacc_id and td_stock_deploument.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_deploument.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') if upper(.ITEM_TYPE_CODE(@item_id))='STOCK_DEPLOY' and not exists(select 1 from td_depo_subacc,td_stock_converts where td_depo_subacc.id=@depo_subacc_id and td_stock_converts.id=@item_id and td_depo_subacc.act_subacc_id=td_stock_converts.keep_subacc_id) .EXIT_MESSAGE('Активный раздел данного раздела счета не соответствует документу') declare @stock_id numeric, @operday datetime, @oper_code varchar(30) select @oper_code=ltrim(rtrim(upper(.TYPE_CODE(((select item_id from td_stock_convert_list where id=@id)))))) if @oper_code=upper('STOCK_UNDEPLOY') begin .TRANSACTION_SAVE /*Проверка наличия количества ЦБ на разделе*/ select @stock_id=(select stock_id from td_stock_deploument where id=@item_id) select @operday=.OPERDAY .DEPO_QUERY_DECLARE(#query) .DEPO_QUERY_CREATE(#query,0) /* Задание бумаги */ insert #query_stocks(id) select td_stock_emis.id from td_stock_emis where td_stock_emis.id=@stock_id and .ITEMS_EXISTS_BY_STOCK(td_stock_emis.id) /* Задание раздела счета */ insert #query_subs(id,acc_id) select td_depo_subacc.id,td_depo_subacc.depo_acc_id from td_depo_subacc where td_depo_subacc.id=@depo_subacc_id and .ITEMS_EXISTS_BY_TYPE(td_depo_subacc.id,'DEPO_SUBACC') if @@error!=0 return set forceplan on .DEPO_QUERY_EXEC(#query,0,'DEPO','DEPO',@operday,@operday) set forceplan off declare @qty money select @qty=(select -1*sum(qty*deb_or_cred) from #query_ops where stock_id =@stock_id and sub_id=@depo_subacc_id) select @stock_qty=isnull(@stock_qty,@qty) if @qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') .DEPO_QUERY_DESTROY(#query,0) .TRANSACTION_RESTORE end else begin begin tran declare @srez_id numeric, @srez_qty money select @srez_id=td_srez_list.srez_doc_id from td_srez_list where id=(select srez_id from td_stock_converts where id=@item_id) select @srez_qty=stock_qty from td_srez_list where depo_subacc_id=@depo_subacc_id and stock_id = @stock_id if @srez_qty<@stock_qty .EXIT_MESSAGE('Операция приводит к отрицательным остаткам') end .UPDATE_ITEMS .UPDATE .RELGEN .UPDATE_STATE .ACTION_HISTORY commit tran $ENDTEXT(3226) $ENDACTION $STATE2ACTION(CRT.ACTION1) state=CRT action=ACTION1 $ENDSTATE2ACTION $STATE2ACTION(CRT.ACTION3) state=CRT action=ACTION3 $ENDSTATE2ACTION $STATE2ACTION(CRT.FORM1) state=CRT action=FORM1 $ENDSTATE2ACTION $STATE2ACTION(CRT.FORM2) state=CRT action=FORM2 $ENDSTATE2ACTION $STATE2ACTION(CRT.FORM3) state=CRT action=FORM3 $ENDSTATE2ACTION $STATE2ACTION(NEW.ACTION2) state=NEW action=ACTION2 $ENDSTATE2ACTION $STATE2ACTION(NEW.FORM3) state=NEW action=FORM3 $ENDSTATE2ACTION $STATE2PROP(CRT.DEPO_SUBACC_ID) state=CRT prop=DEPO_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(CRT.STOCK_QTY) state=CRT prop=STOCK_QTY enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(NEW.DEPO_SUBACC_ID) state=NEW prop=DEPO_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(NEW.STOCK_QTY) state=NEW prop=STOCK_QTY enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $ENDDOC $DOC(STOCK_CONVERT) name=Конвертация ЦБ class=1 product=ALD_DEPO name_formula='Конвертация (дробление, консолидация) ценных бумаг № '+@in_no+' от '+.DATE_TO_STR(@in_date) remark_formula=$TEXT(109) .ITEM_NAME(@s_stock_id) + ' ' + .TO_STR(@s_qty) + '->'+ .ITEM_NAME(@t_stock_id) + ' ' + .TO_STR(@t_qty) $ENDTEXT(109) $STATE(BEG) name=Начальный class=1 $ENDSTATE $STATE(DEL) name=Удален class=2 $ENDSTATE $STATE(DISTR) name=Распределено class=0 $ENDSTATE $STATE(ED) name=В обработке class=0 $ENDSTATE $STATE(ED_END) name=В операции class=0 $ENDSTATE $STATE(LIST_COMPL) name=Список сформирован class=0 $ENDSTATE $STATE(OP_END) name=Исполнен class=0 $ENDSTATE $STATE(REF) name=Отказано class=0 $ENDSTATE $STATE(WAIT_PAY) 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=3 field_prec=23 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=3 field_prec=23 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=100 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=100 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=50 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=50 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=4 field_prec=19 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=0 field_prec=10 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=255 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(ROUND_SIZE) name=Кол-во знаков в округлении дробных бумаг field_name=round_size table_name=td_stock_convert_parm field_type=int field_length=4 field_scale=0 field_prec=10 page=3 order=30 init_class=1 init_formula=4 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(ROUND_MODE) name=Способ округления field_name=round_mode table_name=td_stock_convert_parm field_type=int field_length=4 field_scale=0 field_prec=10 page=3 order=31 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(CONVERT_PART_MODE_0) name=Способ начисления дробных бумаг, если целых не получено field_name=convert_part_mode_0 table_name=td_stock_convert_parm field_type=int field_length=4 field_scale=0 field_prec=10 page=3 order=32 init_class=1 init_formula=2 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(CONVERT_PART_MODE_1) name=Способ начисления дробных бумаг, если целых получено field_name=convert_part_mode_1 table_name=td_stock_convert_parm field_type=int field_length=4 field_scale=0 field_prec=10 page=3 order=33 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(S_STOCK_ID) name=Исходная бумага field_name=s_stock_id table_name=td_stock_converts field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=17 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(T_STOCK_ID) name=Целевая бумага field_name=t_stock_id table_name=td_stock_converts field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=18 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(S_QTY) name=Исходное количество field_name=s_qty table_name=td_stock_converts field_type=decimal field_length=9 field_scale=8 field_prec=18 page=2 order=19 init_class=0 init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(T_QTY) name=Целевое количество field_name=t_qty table_name=td_stock_converts field_type=decimal field_length=9 field_scale=8 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(PASS_SUBACC_ID) name=Пассивный раздел field_name=pass_subacc_id table_name=td_stock_converts field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=24 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(SREZ_ID) name=Срез field_name=srez_id table_name=td_stock_converts 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(NL_SUBACC_ID) name=Раздел для дробных остатков field_name=nl_subacc_id table_name=td_stock_converts field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=26 init_class=null init_formula=null unique_index=null numerator=null import_type=null import_table=null import_field=null import_where=null ref_table=null ref_key=null ref_display=null ref_alias=null ref_where=null $ENDPROP $PROP(REESTR_OPER_DATE) name=Дата проведения реестром field_name=reestr_oper_date table_name=td_stock_converts field_type=datetime field_length=8 field_scale=3 field_prec=23 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(DEPO_OPER_DATE) name=Дата проведения депозитарием field_name=depo_oper_date table_name=td_stock_converts field_type=datetime field_length=8 field_scale=3 field_prec=23 page=2 order=27 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(CONVERT_TYPE_ID) name=Тип конвертации field_name=convert_type_id table_name=td_stock_converts field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=16 init_class=1 init_formula=3 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(REGISTR_OR_DEPO) name=Вид конвертации field_name=registr_or_depo table_name=td_stock_converts field_type=int field_length=4 field_scale=0 field_prec=10 page=2 order=21 init_class=2 init_formula=2 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_KEEP_SUBACC_ID) name=Активный раздел исходный field_name=s_keep_subacc_id table_name=td_stock_converts 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_KEEP_SUBACC_ID) name=Активный раздел целевой field_name=t_keep_subacc_id table_name=td_stock_converts field_type=numeric field_length=9 field_scale=0 field_prec=18 page=2 order=23 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(ORDER_SUBACC_TYPE) name=Тип целевого раздела field_name=order_subacc_type table_name=td_stock_converts field_type=numeric field_length=9 field_scale=0 field_prec=18 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 $RELATION(REL7) class=1 type=T_OPERATIONS form=ITEM_OPERS_LIST prop=null idname=item_id_s order=999 $ENDRELATION $RELATION(REL3) class=4 type=D_DEPO_FOLDERS form=null prop=FOLDER_ID idname=null order=null $ENDRELATION $RELATION(REL4) class=0 type=PARTNERS form=null prop=CORRESPONDENT_ID idname=null order=null $ENDRELATION $RELATION(REL5) class=0 type=PARTNERS form=null prop=PAYER_ID idname=null order=null $ENDRELATION $RELATION(REL6) class=0 type=PARTNERS form=null prop=INITIATOR_ID idname=null order=null $ENDRELATION $RELATION(REL15) class=0 type=ITEMS form=null prop=SREZ_ID idname=null order=null $ENDRELATION $RELATION(REL10) class=1 type=ACTIONS_HISTORY form=UO_ACTIONS_HISTORY_LIST prop=null idname=null order=998 $ENDRELATION $RELATION(REL8) class=1 type=ACTIVDOCS form=ACTION2 prop=null idname=null order=1000 $ENDRELATION $RELATION(REL1) class=0 type=TD_STOCK_EMIS form=null prop=S_STOCK_ID idname=null order=null $ENDRELATION $RELATION(REL2) class=0 type=TD_STOCK_EMIS form=null prop=T_STOCK_ID idname=null order=null $ENDRELATION $RELATION(REL12) class=0 type=DEPO_SUBACC form=null prop=S_KEEP_SUBACC_ID idname=null order=null $ENDRELATION $RELATION(REL13) class=0 type=DEPO_SUBACC form=null prop=T_KEEP_SUBACC_ID idname=null order=null $ENDRELATION $RELATION(REL14) class=0 type=DEPO_SUBACC form=null prop=PASS_SUBACC_ID idname=null order=null $ENDRELATION $RELATION(REL17) class=0 type=DEPO_SUBACC form=null prop=NL_SUBACC_ID idname=null order=null $ENDRELATION $RELATION(REL11) class=1 type=REPORTS form=UO_REPORTS_PAGE_LIST prop=null idname=foundation_id_s order=997 $ENDRELATION $RELATION(REL9) class=1 type=FOUNDATION_DOCS form=UO_FOUNDATION_DOCS_LIST prop=null idname=depo_doc_id_s order=996 $ENDRELATION $RELATION(REL16) class=0 type=SREZ form=null prop=SREZ_ID idname=null order=null $ENDRELATION $RELATION(REL18) class=0 type=D_DEPO_SUBACC_TYPES form=null prop=ORDER_SUBACC_TYPE idname=null order=null $ENDRELATION $FORM(D_STOCK_UNDEPLOY_ACC) name=Выбор счета class=5 filter=null target_state= uo=uo_edit dw=d_stock_undeploy_acc procedure=ap_10000000000018553 patterns=GENERIC_VIEW_ITEM user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(540) 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 declare @depo_acc_id numeric, @depo_acc_no varchar(100), @depo_acc_name varchar(255) end select @sid as sid, convert(varchar(30),@depo_acc_id) as depo_acc_id_s, @depo_acc_no as depo_acc_no, @depo_acc_name as depo_acc_name $ENDTEXT(540) $ENDFORM $FORM(FORM1) name=Данные class=5 filter=null target_state= uo=uo_depo_p2_edit dw=d_stock_convert_edit procedure=apt_stock_converts_all_p2_view patterns=GENERIC_VIEW_ITEM_P2 user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(377) create procedure dbo.%PROC% @sid varchar(30) = null as declare @id numeric, @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @new_state_id numeric begin select @id = convert(numeric, @sid) select @action_id = %ACTION_ID% .CHECK_USER .CHECK_VIEW_ITEM .VIEW_ITEM(ALL,2) end $ENDTEXT(377) $ACTION2RELATION(REL1.STOCK_CODE) relation=REL1 where=null prop=STOCK_CODE order=3 alias=s_stock_code $ENDACTION2RELATION $ACTION2RELATION(REL1.STOCK_NAME) relation=REL1 where=null prop=STOCK_NAME order=4 alias=s_stock_name $ENDACTION2RELATION $ACTION2RELATION(REL2.STOCK_CODE) relation=REL2 where=null prop=STOCK_CODE order=3 alias=t_stock_code $ENDACTION2RELATION $ACTION2RELATION(REL2.STOCK_NAME) relation=REL2 where=null prop=STOCK_NAME order=4 alias=t_stock_name $ENDACTION2RELATION $ACTION2RELATION(REL12.DEPO_SUBACC_NAME) relation=REL12 where=null prop=DEPO_SUBACC_NAME order=17 alias=s_keep_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL12.DEPO_SUBACC_NO) relation=REL12 where=null prop=DEPO_SUBACC_NO order=18 alias=s_keep_subacc_no $ENDACTION2RELATION $ACTION2RELATION(REL13.DEPO_SUBACC_NAME) relation=REL13 where=null prop=DEPO_SUBACC_NAME order=17 alias=t_keep_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL13.DEPO_SUBACC_NO) relation=REL13 where=null prop=DEPO_SUBACC_NO order=18 alias=t_keep_subacc_no $ENDACTION2RELATION $ACTION2RELATION(REL14.DEPO_SUBACC_NAME) relation=REL14 where=null prop=DEPO_SUBACC_NAME order=17 alias=depo_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL14.DEPO_SUBACC_NO) relation=REL14 where=null prop=DEPO_SUBACC_NO order=18 alias=depo_subacc_no $ENDACTION2RELATION $ACTION2RELATION(REL15.ITEM_NAME) relation=REL15 where=null prop=ITEM_NAME order=null alias=srez_name $ENDACTION2RELATION $ACTION2RELATION(REL16.DATE_E) relation=REL16 where=null prop=DATE_E order=null alias=srez_date $ENDACTION2RELATION $ACTION2RELATION(REL17.DEPO_SUBACC_NAME) relation=REL17 where=null prop=DEPO_SUBACC_NAME order=18 alias=nl_subacc_name $ENDACTION2RELATION $ACTION2RELATION(REL17.DEPO_SUBACC_NO) relation=REL17 where=null prop=DEPO_SUBACC_NO order=17 alias=nl_subacc_no $ENDACTION2RELATION $ENDFORM $FORM(FORM2) name=Допуска для группы class=5 filter=null target_state= uo=null dw=null procedure=null patterns=null user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=null $ENDFORM $FORM(FORM3) name=Доп. параметры class=5 filter=null target_state= uo=uo_edit dw=d_stock_convert_parm procedure=ap_20000000001521965 patterns=GENERIC_VIEW_ITEM_P3 user_define=1 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(274) create procedure dbo.%PROC% @sid varchar(30) = null as .BEGIN('N') .CHECK_USER .CHECK_VIEW_ITEM -- John 07.07.06 IF not exists(select 1 from td_stock_convert_parm where id = @id) INSERT INTO td_stock_convert_parm(id) VALUES (@id) .VIEW_ITEM(ALL,3) .END $ENDTEXT(274) $ENDFORM $FORM(VIEW_CRT) name=Просмотр в создан class=5 filter=null target_state= uo=uo_depooper_edit dw=d_depooper_p1 procedure=ap_10000000000018554 patterns=GENERIC_VIEW_ITEM_P1 user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=3794 height=2160 proc_text=$TEXT(648) create procedure dbo.%PROC% @sid varchar(30) = null as declare @id numeric, @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @type_id_s varchar(30), @new_state_id numeric, @state_name_id_s varchar(30) begin select @id = convert(numeric, @sid) select @action_id = %ACTION_ID% select @type_id_s = NULL select @state_name_id_s = NULL .CHECK_USER .CHECK_VIEW_ITEM if @id = -1 begin begin tran .GET_PROPS .CHECK_INSERT .INIT_VARS(B) .INSERT_ITEMS .INSERT commit tran end .VIEW_ITEM(ALL,1) /* .ACTION_HISTORY */ end $ENDTEXT(648) $ACTION2RELATION(REL6.PARTNER_CODE) relation=REL6 where=null prop=PARTNER_CODE order=1 alias=initiator_code $ENDACTION2RELATION $ACTION2RELATION(REL6.PARTNER_SHORT_NAME) relation=REL6 where=null prop=PARTNER_SHORT_NAME order=2 alias=initiator_short_name $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_CODE) relation=REL4 where=null prop=PARTNER_CODE order=1 alias=corr_code $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_SHORT_NAME) relation=REL4 where=null prop=PARTNER_SHORT_NAME order=2 alias=corr_short_name $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_CODE) relation=REL5 where=null prop=PARTNER_CODE order=1 alias=payer_code $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_SHORT_NAME) relation=REL5 where=null prop=PARTNER_SHORT_NAME order=2 alias=payer_short_name $ENDACTION2RELATION $BIND(BIND6) type=STOCK_CONVERT action=FORM3 class=1 order=2 idname=null $ENDBIND $BIND(BIND1) type=STOCK_CONVERT action=FORM1 class=1 order=1 idname=null $ENDBIND $BIND(BIND2) type=SUBACC_IN_OPER action=SUBACC_IN_OPER_VIEW class=1 order=6 idname=item_id_s $ENDBIND $BIND(BIND3) type=SUBACC2CONVERT action=D_SUBACC2OPER_LIST class=1 order=5 idname=item_id_s $ENDBIND $BIND(BIND4) type=SUBACC2OPER action=FORM1 class=1 order=3 idname=item_id_s $ENDBIND $BIND(BIND5) type=SUBACC_AFTER_CONVERT action=FORM3 class=1 order=10 idname=item_id_s $ENDBIND $ENDFORM $FORM(VIEW_EDIT) name=Просмотр в редактируется class=5 filter=null target_state= uo=uo_depooper_edit dw=d_depooper_p1 procedure=ap_10000000000018563 patterns=GENERIC_VIEW_ITEM_P1 user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=3291 height=1632 proc_text=$TEXT(648) create procedure dbo.%PROC% @sid varchar(30) = null as declare @id numeric, @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @type_id_s varchar(30), @new_state_id numeric, @state_name_id_s varchar(30) begin select @id = convert(numeric, @sid) select @action_id = %ACTION_ID% select @type_id_s = NULL select @state_name_id_s = NULL .CHECK_USER .CHECK_VIEW_ITEM if @id = -1 begin begin tran .GET_PROPS .CHECK_INSERT .INIT_VARS(B) .INSERT_ITEMS .INSERT commit tran end .VIEW_ITEM(ALL,1) /* .ACTION_HISTORY */ end $ENDTEXT(648) $ACTION2RELATION(REL6.PARTNER_CODE) relation=REL6 where=null prop=PARTNER_CODE order=1 alias=initiator_code $ENDACTION2RELATION $ACTION2RELATION(REL6.PARTNER_SHORT_NAME) relation=REL6 where=null prop=PARTNER_SHORT_NAME order=2 alias=initiator_short_name $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_CODE) relation=REL4 where=null prop=PARTNER_CODE order=1 alias=corr_code $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_SHORT_NAME) relation=REL4 where=null prop=PARTNER_SHORT_NAME order=2 alias=corr_short_name $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_CODE) relation=REL5 where=null prop=PARTNER_CODE order=1 alias=payer_code $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_SHORT_NAME) relation=REL5 where=null prop=PARTNER_SHORT_NAME order=2 alias=payer_short_name $ENDACTION2RELATION $BIND(BIND3) type=STOCK_CONVERT action=FORM3 class=1 order=2 idname=null $ENDBIND $BIND(BIND2) type=SUBACC2OPER action=FORM1 class=1 order=3 idname=item_id_s $ENDBIND $BIND(BIND1) type=STOCK_CONVERT action=FORM1 class=1 order=1 idname=null $ENDBIND $ENDFORM $FORM(VIEW_IN_DISTRIB) name=Просмотр в распределено class=5 filter=null target_state= uo=uo_depooper_edit dw=d_depooper_p1 procedure=ap_10000000000018569 patterns=null user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=3008 height=1948 proc_text=$TEXT(648) create procedure dbo.%PROC% @sid varchar(30) = null as declare @id numeric, @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @type_id_s varchar(30), @new_state_id numeric, @state_name_id_s varchar(30) begin select @id = convert(numeric, @sid) select @action_id = %ACTION_ID% select @type_id_s = NULL select @state_name_id_s = NULL .CHECK_USER .CHECK_VIEW_ITEM if @id = -1 begin begin tran .GET_PROPS .CHECK_INSERT .INIT_VARS(B) .INSERT_ITEMS .INSERT commit tran end .VIEW_ITEM(ALL,1) /* .ACTION_HISTORY */ end $ENDTEXT(648) $ACTION2RELATION(REL6.PARTNER_CODE) relation=REL6 where=null prop=PARTNER_CODE order=1 alias=initiator_code $ENDACTION2RELATION $ACTION2RELATION(REL6.PARTNER_SHORT_NAME) relation=REL6 where=null prop=PARTNER_SHORT_NAME order=2 alias=initiator_short_name $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_CODE) relation=REL4 where=null prop=PARTNER_CODE order=1 alias=corr_code $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_SHORT_NAME) relation=REL4 where=null prop=PARTNER_SHORT_NAME order=2 alias=corr_short_name $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_CODE) relation=REL5 where=null prop=PARTNER_CODE order=1 alias=payer_code $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_SHORT_NAME) relation=REL5 where=null prop=PARTNER_SHORT_NAME order=2 alias=payer_short_name $ENDACTION2RELATION $BIND(BIND6) type=STOCK_CONVERT action=FORM3 class=1 order=2 idname=null $ENDBIND $BIND(BIND1) type=STOCK_CONVERT action=FORM1 class=1 order=1 idname=null $ENDBIND $BIND(BIND2) type=SUBACC2OPER action=FORM1 class=1 order=3 idname=item_id_s $ENDBIND $BIND(BIND3) type=SUBACC2CONVERT action=D_SUBACC2OPER_LIST class=1 order=5 idname=item_id_s $ENDBIND $BIND(BIND4) type=SUBACC_IN_OPER action=SUBACC_IN_OPER_VIEW class=1 order=7 idname=item_id_s $ENDBIND $BIND(BIND5) type=SUBACC_AFTER_CONVERT action=FORM1 class=1 order=9 idname=item_id_s $ENDBIND $ENDFORM $FORM(VIEW_IN_OPER) name=Просмотр в операции class=5 filter=null target_state= uo=uo_depooper_edit dw=d_depooper_p1 procedure=ap_10000000000018578 patterns=GENERIC_VIEW_ITEM_P1 user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=2967 height=2140 proc_text=$TEXT(648) create procedure dbo.%PROC% @sid varchar(30) = null as declare @id numeric, @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @type_id_s varchar(30), @new_state_id numeric, @state_name_id_s varchar(30) begin select @id = convert(numeric, @sid) select @action_id = %ACTION_ID% select @type_id_s = NULL select @state_name_id_s = NULL .CHECK_USER .CHECK_VIEW_ITEM if @id = -1 begin begin tran .GET_PROPS .CHECK_INSERT .INIT_VARS(B) .INSERT_ITEMS .INSERT commit tran end .VIEW_ITEM(ALL,1) /* .ACTION_HISTORY */ end $ENDTEXT(648) $ACTION2RELATION(REL6.PARTNER_CODE) relation=REL6 where=null prop=PARTNER_CODE order=1 alias=initiator_code $ENDACTION2RELATION $ACTION2RELATION(REL6.PARTNER_SHORT_NAME) relation=REL6 where=null prop=PARTNER_SHORT_NAME order=2 alias=initiator_short_name $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_CODE) relation=REL4 where=null prop=PARTNER_CODE order=1 alias=corr_code $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_SHORT_NAME) relation=REL4 where=null prop=PARTNER_SHORT_NAME order=2 alias=corr_short_name $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_CODE) relation=REL5 where=null prop=PARTNER_CODE order=1 alias=payer_code $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_SHORT_NAME) relation=REL5 where=null prop=PARTNER_SHORT_NAME order=2 alias=payer_short_name $ENDACTION2RELATION $BIND(BIND5) type=STOCK_CONVERT action=FORM3 class=1 order=2 idname=null $ENDBIND $BIND(BIND1) type=SUBACC2OPER action=FORM1 class=1 order=3 idname=item_id_s $ENDBIND $BIND(BIND2) type=SUBACC2CONVERT action=D_SUBACC2OPER_LIST class=1 order=4 idname=item_id_s $ENDBIND $BIND(BIND3) type=STOCK_CONVERT action=FORM1 class=1 order=1 idname=null $ENDBIND $BIND(BIND4) type=SUBACC_IN_OPER action=D_SUBACC_IN_OPER_LIST class=1 order=5 idname=item_id_s $ENDBIND $ENDFORM $FORM(VIEW_LIST_COMP) name=Просмотр созд.списка class=5 filter=null target_state= uo=uo_depooper_edit dw=d_depooper_p1 procedure=ap_10000000000018586 patterns=GENERIC_VIEW_ITEM_P1 user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=2418 height=1672 proc_text=$TEXT(648) create procedure dbo.%PROC% @sid varchar(30) = null as declare @id numeric, @action_id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @type_id_s varchar(30), @new_state_id numeric, @state_name_id_s varchar(30) begin select @id = convert(numeric, @sid) select @action_id = %ACTION_ID% select @type_id_s = NULL select @state_name_id_s = NULL .CHECK_USER .CHECK_VIEW_ITEM if @id = -1 begin begin tran .GET_PROPS .CHECK_INSERT .INIT_VARS(B) .INSERT_ITEMS .INSERT commit tran end .VIEW_ITEM(ALL,1) /* .ACTION_HISTORY */ end $ENDTEXT(648) $ACTION2RELATION(REL6.PARTNER_CODE) relation=REL6 where=null prop=PARTNER_CODE order=1 alias=initiator_code $ENDACTION2RELATION $ACTION2RELATION(REL6.PARTNER_SHORT_NAME) relation=REL6 where=null prop=PARTNER_SHORT_NAME order=2 alias=initiator_short_name $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_CODE) relation=REL4 where=null prop=PARTNER_CODE order=1 alias=corr_code $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_SHORT_NAME) relation=REL4 where=null prop=PARTNER_SHORT_NAME order=2 alias=corr_short_name $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_CODE) relation=REL5 where=null prop=PARTNER_CODE order=1 alias=payer_code $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_SHORT_NAME) relation=REL5 where=null prop=PARTNER_SHORT_NAME order=2 alias=payer_short_name $ENDACTION2RELATION $BIND(BIND4) type=STOCK_CONVERT action=FORM3 class=1 order=2 idname=null $ENDBIND $BIND(BIND1) type=STOCK_CONVERT action=FORM1 class=1 order=1 idname=null $ENDBIND $BIND(BIND2) type=SUBACC2OPER action=FORM1 class=1 order=3 idname=item_id_s $ENDBIND $BIND(BIND3) type=SUBACC2CONVERT action=D_SUBACC2OPER_LIST class=1 order=4 idname=item_id_s $ENDBIND $ENDFORM $ACTION(ACTION1) name=Сформировать разделы по пассивному class=2 form=D_STOCK_UNDEPLOY_ACC target_state=null procedure=ap_10000000000018593 patterns=GENERIC_UPDATE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(2474) create procedure dbo.%PROC% @sid varchar(30) = null, @depo_acc_id_s varchar(30), @depo_acc_no varchar(100), @depo_acc_name varchar(255) 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 .GET_PROPS declare @sub_id numeric, @stock_qty money, @srez_list_id numeric, @pass_acc_id numeric select @pass_acc_id=convert(numeric, @depo_acc_id_s) if @pass_acc_id is null .EXIT_MESSAGE('Не задан пассивный раздел') ---- Удаление привязанных разделов по этому счету delete t_items from td_stock_convert_list,td_depo_subacc,t_types where td_stock_convert_list.item_id = @id and td_depo_subacc.id=td_stock_convert_list.depo_subacc_id and td_depo_subacc.depo_acc_id = @pass_acc_id and t_items.id=td_stock_convert_list.id and t_types.id=t_items.type_id and ltrim(rtrim(upper(t_types.type_code)))=ltrim(rtrim(upper('subacc2oper'))) delete td_stock_convert_list from td_depo_subacc where td_stock_convert_list.item_id = @id and td_depo_subacc.id=td_stock_convert_list.depo_subacc_id and td_depo_subacc.depo_acc_id = @pass_acc_id and (not exists(select 1 from t_items where t_items.id=td_stock_convert_list.id)) ---- Формирование списка разделов .TYPE_INIT('subacc2oper') declare ins_subacc cursor for select td_srez_list.depo_subacc_id,td_srez_list.stock_qty,td_srez_list.id from td_srez_list,td_depo_subacc where td_srez_list.act_or_pass=2 and td_srez_list.srez_doc_id=@srez_id and td_srez_list.stock_id=@s_stock_id and td_depo_subacc.id = td_srez_list.depo_subacc_id and td_depo_subacc.act_subacc_id=@s_keep_subacc_id and td_depo_subacc.depo_acc_id=@pass_acc_id open ins_subacc fetch ins_subacc into @sub_id, @stock_qty,@srez_list_id while .CURSOR_STATE=0 begin .TYPE_ASSIGN(item_id,@id) .TYPE_ASSIGN(stock_qty,@stock_qty) .TYPE_ASSIGN(depo_subacc_id,@sub_id) .TYPE_INSERT('subacc2oper','CRT') update td_stock_convert_list set srez_list_id=@srez_list_id where id=@id1_1 fetch ins_subacc into @sub_id, @stock_qty,@srez_list_id end close ins_subacc .DEALLOCATE ins_subacc .ACTION_HISTORY commit tran $ENDTEXT(2474) $ENDACTION $ACTION(ACTION10) name=Доп. параметры (изм.) class=2 form=FORM3 target_state=null procedure=ap_20000000001521986 patterns=GENERIC_UPDATE_P2 user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(300) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST(ALL, 3) as .BEGIN('N') .CHECK_USER .CHECK_UPDATE .ARGCONVERT(ALL, 3) .TEST_UNIQUE(ALL, 3) --.GET_PROPS(ALL,1) begin tran --.UPDATE_ITEMS .UPDATE(ALL,3) .RELGEN .UPDATE_STATE .ACTION_HISTORY commit tran .END $ENDTEXT(300) $ENDACTION $ACTION(ACTION2) name=Удалить разделы по пассивному class=2 form=D_STOCK_UNDEPLOY_ACC target_state=null procedure=ap_10000000000018594 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1320) create procedure dbo.%PROC% @sid varchar(30) = null, @depo_acc_id_s varchar(30), @depo_acc_no varchar(100), @depo_acc_name varchar(255) 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 declare @depo_acc_id numeric select @depo_acc_id = convert(numeric, @depo_acc_id_s) delete t_items from td_stock_convert_list,td_depo_subacc,t_types where td_stock_convert_list.item_id = @id and td_depo_subacc.id=td_stock_convert_list.depo_subacc_id and td_depo_subacc.depo_acc_id = @depo_acc_id and t_items.id=td_stock_convert_list.id and t_types.id=t_items.type_id and ltrim(rtrim(upper(t_types.type_code)))=ltrim(rtrim(upper('subacc2oper'))) delete td_stock_convert_list from td_depo_subacc where td_stock_convert_list.item_id = @id and td_depo_subacc.id=td_stock_convert_list.depo_subacc_id and td_depo_subacc.depo_acc_id = @depo_acc_id and (not exists(select 1 from t_items where t_items.id=td_stock_convert_list.id)) .ACTION_HISTORY /*-------Проводки ----------*/ commit tran $ENDTEXT(1320) $ENDACTION $ACTION(ACTION3) name=Отказать class=9 form=null target_state=REF procedure=ap_10000000000018595 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(533) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .DEPO_TEST_FOUNDATION(2,@id) .UPDATE_STATE .ACTION_HISTORY .ARH_NUMBER_UPDATE /*-------Проводки ---------- .GET_PROPS .CREATE_DEPO_REPORT('report4refus_oper','CREATE',11) */ commit tran $ENDTEXT(533) $ENDACTION $ACTION(ACTION4) name=Добавить class=1 form=VIEW_EDIT target_state=ED procedure=ap_10000000000018596 patterns=GENERIC_INSERT_P1 user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=2505 height=2104 proc_text=$TEXT(637) 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(637) $BIND(BIND2) type=STOCK_CONVERT action=ACTION10 class=1 order=2 idname=null $ENDBIND $BIND(BIND1) type=STOCK_CONVERT action=D_STOCK_CONVERTS_ALL_VIEW class=1 order=1 idname=null $ENDBIND $ENDACTION $ACTION(ACTION5) name=Изменить class=2 form=VIEW_EDIT target_state=null procedure=ap_10000000000018599 patterns=GENERIC_UPDATE user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=2953 height=1768 proc_text=$TEXT(517) 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, @new_state_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .OPERDAY_TEST .ARGCONVERT(ALL,1) .DEPO_CHK_NO(@id,@in_no,@depo_doc_type) .UPDATE(ALL,1) .RELGEN .UPDATE_STATE .ACTION_HISTORY commit tran $ENDTEXT(517) $BIND(BIND3) type=STOCK_CONVERT action=ACTION10 class=1 order=2 idname=null $ENDBIND $BIND(BIND2) type=SUBACC2OPER action=D_SUBACC2OPER_LIST class=1 order=3 idname=item_id_s $ENDBIND $BIND(BIND1) type=STOCK_CONVERT action=D_STOCK_CONVERTS_ALL_VIEW class=1 order=1 idname=null $ENDBIND $ENDACTION $ACTION(ACTION6) name=Удалить class=9 form=null target_state=DEL procedure=ap_10000000000018602 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=2103 height=1448 proc_text=$TEXT(1171) 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 declare @id_del numeric, @del_subacc_id numeric .TRANSACTION_SAVE create table #tmp_id ( id numeric(18) not null, depo_subacc_id numeric(18) null ) insert into #tmp_id select id,depo_subacc_id from td_stock_convert_list where item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'SUBACC2OPER') begin tran declare cur1 cursor for select id,depo_subacc_id from #tmp_id open cur1 fetch cur1 into @id_del,@del_subacc_id while .CURSOR_STATE=0 begin begin tran .TYPE_DELETE(@id_del,'subacc2oper') commit tran fetch cur1 into @id_del,@del_subacc_id end close cur1 .DEALLOCATE cur1 .UPDATE_STATE .ACTION_HISTORY /*-------Проводки ----------*/ commit tran drop table #tmp_id .TRANSACTION_RESTORE commit tran $ENDTEXT(1171) $BIND(BIND1) type=STOCK_CONVERT action=FORM1 class=1 order=1 idname=null $ENDBIND $ENDACTION $ACTION(ACTION7) name=На редактирование class=9 form=null target_state=ED procedure=ap_10000000000018604 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=2103 height=1436 proc_text=$TEXT(672) 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 .ARH_FLAG_CLEAR /*-------Проводки ----------*/ .OPERS_ROLL(ALL,'DEPO') .OPERS_ROLL(ALL,'DEPO_DOM') .OPERS_ROLL(ALL,'DEPO_REG') /* declare @rep_id numeric select @rep_id=id from td_depo_docs where foundation_id=@id .TYPE_DELETE(@rep_id,'reports_report_for_convstocks') */ commit tran $ENDTEXT(672) $BIND(BIND1) type=STOCK_CONVERT action=FORM1 class=1 order=1 idname=null $ENDBIND $ENDACTION $ACTION(ACTION8) name=Сформировать разделы по активному class=9 form=null target_state=null procedure=ap_10000000000018606 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(2175) 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 .GET_PROPS declare @sub_id numeric, @stock_qty money, @srez_list_id numeric ---- Удаление разделов по активному delete t_items from td_stock_convert_list,td_depo_subacc,t_types where td_stock_convert_list.item_id = @id and td_depo_subacc.id=td_stock_convert_list.depo_subacc_id and td_depo_subacc.act_subacc_id = @s_keep_subacc_id and t_items.id=td_stock_convert_list.id and t_types.id=t_items.type_id and ltrim(rtrim(upper(t_types.type_code)))=ltrim(rtrim(upper('subacc2oper'))) delete td_stock_convert_list from td_depo_subacc where td_stock_convert_list.item_id = @id and td_depo_subacc.id=td_stock_convert_list.depo_subacc_id and td_depo_subacc.act_subacc_id = @s_keep_subacc_id and (not exists(select 1 from t_items where t_items.id=td_stock_convert_list.id)) ---- Формирование списка разделов .TYPE_INIT('subacc2oper') declare ins_subacc cursor for select td_srez_list.depo_subacc_id,td_srez_list.stock_qty,td_srez_list.id from td_srez_list,td_depo_subacc where td_srez_list.act_or_pass=2 and td_srez_list.srez_doc_id=@srez_id and td_srez_list.stock_id=@s_stock_id and td_depo_subacc.id = td_srez_list.depo_subacc_id and td_depo_subacc.act_subacc_id=@s_keep_subacc_id open ins_subacc fetch ins_subacc into @sub_id, @stock_qty, @srez_list_id while .CURSOR_STATE=0 begin .TYPE_ASSIGN(item_id,@id) .TYPE_ASSIGN(stock_qty,@stock_qty) .TYPE_ASSIGN(depo_subacc_id,@sub_id) .TYPE_INSERT('subacc2oper','CRT') update td_stock_convert_list set srez_list_id=@srez_list_id where id=@id1_1 fetch ins_subacc into @sub_id, @stock_qty,@srez_list_id end close ins_subacc .DEALLOCATE ins_subacc .ACTION_HISTORY /*-------Проводки ----------*/ commit tran $ENDTEXT(2175) $ENDACTION $ACTION(ACTION9) name=Удалить разделы по активному class=9 form=null target_state=null procedure=ap_10000000000018607 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1155) 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 .GET_PROPS delete t_items from td_stock_convert_list,td_depo_subacc,t_types where td_stock_convert_list.item_id = @id and td_depo_subacc.id=td_stock_convert_list.depo_subacc_id and td_depo_subacc.act_subacc_id = @s_keep_subacc_id and t_items.id=td_stock_convert_list.id and t_types.id=t_items.type_id and ltrim(rtrim(upper(t_types.type_code)))=ltrim(rtrim(upper('subacc2oper'))) delete td_stock_convert_list from td_depo_subacc where td_stock_convert_list.item_id = @id and td_depo_subacc.id=td_stock_convert_list.depo_subacc_id and td_depo_subacc.act_subacc_id = @s_keep_subacc_id and (not exists(select 1 from t_items where t_items.id=td_stock_convert_list.id)) .ACTION_HISTORY /*-------Проводки ----------*/ commit tran $ENDTEXT(1155) $ENDACTION $ACTION(CANCEL_DICTRIB) name=Отменить распределение class=9 form=null target_state=OP_END procedure=ap_10000000000018609 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1205) 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 select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE declare @id_del numeric, @del_subacc_id numeric .TRANSACTION_SAVE create table #del_rep ( id numeric(18) not null, ) insert into #del_rep select id from td_depo_docs where foundation_id=@id begin tran .UPDATE_STATE .ACTION_HISTORY .OPERS_ROLL('distrib_stocks','DEPO') .OPERS_ROLL('distrib_stocks','DEPO_DOM') .OPERS_ROLL('distrib_stocks','DEPO_REG') declare cur2 cursor for select id from #del_rep open cur2 fetch cur2 into @id_del while .CURSOR_STATE=0 begin .TYPE_DELETE(@id_del,'REPORT4STOCK_CONVERT_CL') .TYPE_DELETE(@id_del,'REPORT4PART_STOCK_CONVERT_DP') .TYPE_DELETE(@id_del,'REPORT4PART_STOCK_CONVERT_CL') fetch cur2 into @id_del end close cur2 .DEALLOCATE cur2 /*-------Проводки ----------*/ commit tran drop table #del_rep .TRANSACTION_RESTORE end $ENDTEXT(1205) $ENDACTION $ACTION(CANCEL_ED_END) name=Отменить "в операцию" class=9 form=null target_state=LIST_COMPL procedure=ap_10000000000018610 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1230) 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 select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE declare @id_del numeric, @del_subacc_id numeric .TRANSACTION_SAVE create table #tmp_id ( id numeric(18) not null, depo_subacc_id numeric(18) null ) insert into #tmp_id select id,depo_subacc_id from td_stock_convert_list where item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'subacc_in_oper') begin tran declare cur1 cursor for select id,depo_subacc_id from #tmp_id .UPDATE_STATE .ACTION_HISTORY open cur1 fetch cur1 into @id_del,@del_subacc_id while .CURSOR_STATE=0 begin begin tran .TYPE_DELETE(@id_del,'subacc_in_oper') commit tran fetch cur1 into @id_del,@del_subacc_id end close cur1 .DEALLOCATE cur1 /*-------Проводки ----------*/ commit tran drop table #tmp_id .TRANSACTION_RESTORE .EXEC_ACTION(@sid,'STOCK_CONVERT','cancel_list_compl') end $ENDTEXT(1230) $ENDACTION $ACTION(CANCEL_LIST_COMPL) name=Отменить создание списка class=9 form=null target_state=ED procedure=ap_10000000000018611 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1305) 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 select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) /*.CHECK_USER .CHECK_UPDATE*/ declare @id_del numeric, @del_subacc_id numeric .TRANSACTION_SAVE create table #tmp_id ( id numeric(18) not null, depo_subacc_id numeric(18) null ) insert into #tmp_id select id,depo_subacc_id from td_stock_convert_list where item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'SUBACC2CONVERT') begin tran declare cur1 cursor for select id,depo_subacc_id from #tmp_id .UPDATE_STATE .ACTION_HISTORY .OPERS_ROLL(ALL,'DEPO') .OPERS_ROLL(ALL,'DEPO_DOM') .OPERS_ROLL(ALL,'DEPO_REG') open cur1 fetch cur1 into @id_del,@del_subacc_id while .CURSOR_STATE=0 begin begin tran .TYPE_DELETE(@del_subacc_id,'depo_subacc') .TYPE_DELETE(@id_del,'subacc2convert') commit tran fetch cur1 into @id_del,@del_subacc_id end close cur1 .DEALLOCATE cur1 /*-------Проводки ----------*/ commit tran drop table #tmp_id .TRANSACTION_RESTORE end $ENDTEXT(1305) $ENDACTION $ACTION(CANCEL_OP_END) name=Отменить исполнение class=9 form=null target_state=ED_END procedure=ap_10000000000018612 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(1508) 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('TO_OP_END','DEPO') .OPERS_ROLL('TO_OP_END','DEPO_DOM') .OPERS_ROLL('TO_OP_END','DEPO_REG') .OPERS_ROLL('TO_OP_END','SEC_PARTS') .OPERS_ROLL('distrib_stocks','DEPO') .OPERS_ROLL('distrib_stocks','DEPO_DOM') .OPERS_ROLL('distrib_stocks','DEPO_REG') .OPERS_ROLL('distrib_stocks','SEC_PARTS') .ARH_FLAG_CLEAR declare @id_del numeric, @del_subacc_id numeric /*-------Проводки ----------*/ .TRANSACTION_SAVE create table #tmp_id ( id numeric(18) not null, depo_subacc_id numeric(18) null ) insert into #tmp_id select id,depo_subacc_id from td_stock_convert_list where item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'SUBACC_AFTER_CONVERT') declare cur1 cursor for select id,depo_subacc_id from #tmp_id begin tran open cur1 fetch cur1 into @id_del,@del_subacc_id while .CURSOR_STATE=0 begin begin tran .TYPE_DELETE(@id_del,'subacc_after_convert') commit tran fetch cur1 into @id_del,@del_subacc_id end close cur1 .DEALLOCATE cur1 commit tran drop table #tmp_id .TRANSACTION_RESTORE commit tran $ENDTEXT(1508) $ENDACTION $ACTION(D_STOCK_CONVERTS_ALL_VIEW) name=Данные (изм.) class=2 form=FORM1 target_state=null procedure=ap_10000000000018597 patterns=GENERIC_UPDATE_P2 user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(3569) 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) /*-------------TESTS-----------------*/ if @reestr_oper_date is null select @reestr_oper_date=@depo_oper_date declare @operday datetime declare @errmes varchar(255) select @operday = .OPERDAY select @errmes='Неправильно задана датa в ближнем узле: '+convert(varchar,@depo_oper_date,3) if @depo_oper_date<@reestr_oper_date .EXIT_MESSAGE('Неправильно заданы даты в ближнем и дальнем узлах') if @depo_oper_date>dateadd(dd,1,@operday) .EXIT_MESSAGE(@errmes) if @s_stock_id is null .EXIT_MESSAGE('Не задана исходная ценная бумага ') if @t_stock_id is null .EXIT_MESSAGE('Не задана целевая ценная бумага ') if @s_qty is null .EXIT_MESSAGE('Не задано исходное количество бумаг в соотношении ') if @s_qty <= 0 .EXIT_MESSAGE('Исходное количество бумаг в соотношении не может быть отрицательным или 0') if @t_qty is null .EXIT_MESSAGE('Не задано исходное количество бумаг в соотношении ') if @t_qty <= 0 .EXIT_MESSAGE('Исходное количество бумаг в соотношении не может быть отрицательным или 0') if not((select srez_id from td_stock_converts where id=@id) = @srez_id) and (exists(select 1 from td_stock_convert_list where item_id=@id)) .EXIT_MESSAGE('Нельзя изменять активный раздел при наличии разделов счетов') if not((select s_keep_subacc_id from td_stock_converts where id=@id) = @s_keep_subacc_id) and (exists(select 1 from td_stock_convert_list where item_id=@id)) .EXIT_MESSAGE('Нельзя изменять активный раздел при наличии разделов счетов') -- John /* if not((select t_keep_subacc_id from td_stock_converts where id=@id) = @t_keep_subacc_id) and (exists(select 1 from td_stock_convert_list where item_id=@id)) .EXIT_MESSAGE('Нельзя изменять активный раздел при наличии разделов счетов') */ if not((select s_stock_id from td_stock_converts where id=@id) = @s_stock_id) and (exists(select 1 from td_stock_convert_list where item_id=@id)) .EXIT_MESSAGE('Нельзя изменять ЦБ при наличии разделов счетов') /* if not((select t_stock_id from td_stock_converts where id=@id) = @t_stock_id) and (exists(select 1 from td_stock_convert_list where item_id=@id)) .EXIT_MESSAGE('Нельзя изменять ЦБ при наличии разделов счетов') */ if @registr_or_depo = 1 .EXIT_MESSAGE('Реестровая конвертация в настоящий момент не поддерживается') /*-------------END TESTS-----------------*/ .TEST_UNIQUE(ALL, 2) .GET_PROPS(ALL,1) .UPDATE_ITEMS --- разруливание активных разделов if @pass_subacc_id is not null select @s_keep_subacc_id=(select act_subacc_id from td_depo_subacc where id=@pass_subacc_id), @t_keep_subacc_id=(select act_subacc_id from td_depo_subacc where id=@pass_subacc_id) if @t_keep_subacc_id is null select @t_keep_subacc_id=@s_keep_subacc_id if @s_keep_subacc_id is null .EXIT_MESSAGE('Не задан исходный активный раздел') -- John 13.12.05 /* if (select depo_acc_id from td_depo_subacc where id=@s_keep_subacc_id)<>(select depo_acc_id from td_depo_subacc where id=@t_keep_subacc_id) .EXIT_MESSAGE('Исходный и целевой активные разделы должны принадлежать одному счету') */ .UPDATE(ALL,2) .RELGEN .UPDATE_STATE .ACTION_HISTORY commit tran $ENDTEXT(3569) $ENDACTION $ACTION(DISTRIB_STOCKS) name=Распределить начисленное class=9 form=null target_state=DISTR procedure=ap_10000000000018613 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(7689) create procedure dbo.%PROC% @sid varchar(30) = null as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @new_state_id numeric, @type_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE .UPDATE_STATE .ACTION_HISTORY .GET_PROPS declare @t_subacc_id numeric, @to_qty money, @s_subacc_id numeric, @from_qty money, @d_subacc_id numeric, @d_qty money, @op_qty money, @sum_qty money, @doc_name varchar(255), @oper_date datetime, @ret int, @error_mess varchar(255), @acc_id numeric, @foundation_remark varchar(255) select @foundation_remark=.ITEM_NAME(@id) select @doc_name = .ITEM_NAME(@id) select @oper_date=.OPERDAY /*-------Проводки ----------*/ declare distrib_cur cursor for select td_stock_convert_list.depo_subacc_id,td_stock_convert_list.stock_qty from td_stock_convert_list where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'SUBACC_AFTER_CONVERT') -- Выбор начисленного количества open distrib_cur fetch distrib_cur into @t_subacc_id,@op_qty while .CURSOR_STATE=0 begin --Выбор раздела для списания --select @d_subacc_id=(select max(s.depo_subacc_id) -- John ???? select @d_subacc_id= (select distinct s.depo_subacc_id from td_stock_convert_list s,td_stock_convert_list t, td_depo_subacc s_subacc,td_depo_subacc t_subacc where .ITEMS_EXISTS_BY_TYPE(t.id,'SUBACC_AFTER_CONVERT') and .ITEMS_EXISTS_BY_TYPE(s.id,'SUBACC_in_OPER') and t.item_id=@id and s.item_id=@id and s.depo_subacc_id<>@nl_subacc_id and t.depo_subacc_id=@t_subacc_id and s_subacc.id=s.depo_subacc_id and t_subacc.id=t.depo_subacc_id and t_subacc.depo_acc_id=s_subacc.depo_acc_id ) if @d_subacc_id is null begin select @error_mess='Раздел '+.ITEM_NAME(@d_subacc_id)+' не соответствует списку разделов в операции' .EXIT_MESSAGE(@error_mess) end if @d_subacc_id<>@t_subacc_id begin select @error_mess='Операция приводит к отрицательным остаткам '+.ITEM_NAME(@t_subacc_id) exec @ret = ap_subacc_check_qty @plan_owner_code='DEPO', @plan_code='DEPO', @subacc_id=@t_subacc_id, @stock_id=@t_stock_id, @check_date=@oper_date, @check_qty=@op_qty, @check_deb_or_cred=-1 if @ret!=0 .EXIT_MESSAGE(@error_mess) .DEPOOPERATION('DEPO','DEPO', @oper_date, '2','2',@op_qty,@t_stock_id,@d_subacc_id,@t_subacc_id,@doc_name) -- John 22.02.06 .DEPOOPERATION('DEPO','DEPO_REG',@reestr_oper_date, '2','2',@op_qty,@t_stock_id,@d_subacc_id,@t_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_DOM',@depo_oper_date, '2','2',@op_qty,@t_stock_id,@d_subacc_id,@t_subacc_id,@doc_name) .DEPO_SINT_OPERATION('DEPO','BANK_ACCOUNT_DEPO',@oper_date,@op_qty,@t_stock_id,@d_subacc_id,@t_subacc_id,@doc_name) end fetch distrib_cur into @t_subacc_id,@op_qty end close distrib_cur .DEALLOCATE distrib_cur ----- Создание отчетов declare crt_rep cursor for select depo_subacc_id from td_stock_convert_list where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'SUBACC_AFTER_CONVERT') .TYPE_INIT('report4stock_convert_cl',2) open crt_rep fetch crt_rep into @d_subacc_id while .CURSOR_STATE=0 begin select @acc_id=depo_acc_id from td_depo_subacc where id=@d_subacc_id if not exists(select 1 from td_depo_docs, td_queries where td_depo_docs.foundation_id=@id and td_queries.id=td_depo_docs.id and td_queries.depo_acc_id=@acc_id and .ITEMS_EXISTS_BY_TYPE(td_depo_docs.id,'report4stock_convert_cl')) begin ---- Клиенту депозитария по операции select @in_no2_1=null .DEPO_GEN_NO(@in_no2_1,2) .TYPE_ASSIGN(folder_id,@folder_id,2) .TYPE_ASSIGN(foundation_id,@id,2) .TYPE_ASSIGN(correspondent_id,@correspondent_id,2) .TYPE_ASSIGN(in_date,@oper_date,2) .TYPE_ASSIGN(depo_doc_type,2,2) .TYPE_ASSIGN(depo_acc_id,@acc_id,2) .TYPE_INSERT('report4stock_convert_cl','CREATE',2) update td_depo_docs set foundation_remark=@foundation_remark where id=@id2_1 end --- Клиенту о дробных остатках .TYPE_INIT('REPORT4PART_STOCK_CONVERT_CL',4) if (select sum(isnull(td_stock_convert_list.partition_qty,0)) from td_stock_convert_list where td_stock_convert_list.item_id=@id and (select td_depo_subacc.depo_acc_id from td_depo_subacc where td_depo_subacc.id=td_stock_convert_list.depo_subacc_id)=@acc_id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'SUBACC_IN_OPER'))>0 begin if not exists(select 1 from td_depo_docs, td_queries where td_depo_docs.foundation_id=@id and td_queries.id=td_depo_docs.id and td_queries.depo_acc_id=@acc_id and .ITEMS_EXISTS_BY_TYPE(td_depo_docs.id,'REPORT4PART_STOCK_CONVERT_CL')) begin select @in_no4_1=null .DEPO_GEN_NO(@in_no4_1,2) .TYPE_ASSIGN(folder_id,@folder_id,4) .TYPE_ASSIGN(foundation_id,@id,4) .TYPE_ASSIGN(correspondent_id,@correspondent_id,4) .TYPE_ASSIGN(in_date,@oper_date,4) .TYPE_ASSIGN(depo_doc_type,2,4) .TYPE_ASSIGN(depo_acc_id,@acc_id,4) .TYPE_INSERT('REPORT4PART_STOCK_CONVERT_CL','CREATE',4) update td_depo_docs set foundation_remark=@foundation_remark where id=@id4_1 end end fetch crt_rep into @d_subacc_id end close crt_rep .DEALLOCATE crt_rep --- Отчет депозитарию о дробных остатках if exists(select 1 from td_stock_convert_list where td_stock_convert_list.item_id=@id and isnull(td_stock_convert_list.partition_qty,0)<>0 and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'SUBACC_IN_OPER')) begin .TYPE_INIT('REPORT4PART_STOCK_CONVERT_DP',3) select @acc_id=(select min(td_depo_accounts.id) from td_depo_accounts,td_depo_acctypes,t_partners where ltrim(rtrim(upper(td_depo_acctypes.depo_acctype_code)))='НЛ' and td_depo_accounts.depo_acctypes_id=td_depo_acctypes.id and .ITEMS_EXISTS_BY_TYPE(td_depo_accounts.id,'depo_account') and ltrim(rtrim(upper(t_partners.partner_code)))='DEPO' and .ITEMS_EXISTS_BY_TYPE(t_partners.id,'partners_jur') and td_depo_accounts.partner_id=t_partners.id) select @in_no3_1=null .DEPO_GEN_NO(@in_no3_1,2) .TYPE_ASSIGN(folder_id,@folder_id,3) .TYPE_ASSIGN(foundation_id,@id,3) .TYPE_ASSIGN(correspondent_id,@correspondent_id,3) .TYPE_ASSIGN(in_date,@oper_date,3) .TYPE_ASSIGN(depo_doc_type,2,3) .TYPE_ASSIGN(depo_acc_id,@acc_id,3) .TYPE_INSERT('REPORT4PART_STOCK_CONVERT_DP','CREATE',3) update td_depo_docs set foundation_remark=@foundation_remark where id=@id3_1 end commit tran $ENDTEXT(7689) $ENDACTION $ACTION(TO_ED_END) name=В операцию class=9 form=null target_state=ED_END procedure=ap_10000000000018614 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=2103 height=1456 proc_text=$TEXT(5123) 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 .EXEC_ACTION(@sid,'STOCK_CONVERT','to_list_compl') .GET_PROPS .DEPO_TEST_FOUNDATION(1,@id) if @s_stock_id is null .EXIT_MESSAGE('Не задана исходная ценная бумага ') if @t_stock_id is null .EXIT_MESSAGE('Не задана размещаемоя ценная бумага ') if @s_qty is null .EXIT_MESSAGE('Не задано исходное количество бумаг в соотношении ') if @s_qty <= 0 .EXIT_MESSAGE('Исходное количество бумаг в соотношении не может быть отрицательным или 0') if @t_qty is null .EXIT_MESSAGE('Не задано размещаемая количество бумаг в соотношении ') if @t_qty <= 0 .EXIT_MESSAGE('Целевое количество бумаг в соотношении не может быть отрицательным или 0') declare @add_qty money, @depo_subacc_id numeric, @acc_id numeric, @new_subacc_id numeric, @error_mess varchar(255), @p_qty decimal(18,8), @new_subacc_no varchar(50), @tmp_qty money, @convert_mode int, @round_p_qty decimal(18,8) declare ins_cur cursor for select depo_subacc_id,stock_qty from td_stock_convert_list where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'subacc2convert') .TYPE_INIT('subacc_in_oper') open ins_cur fetch ins_cur into @depo_subacc_id, @tmp_qty while .CURSOR_STATE=0 begin -- -- Исходный и целевой МХ совпадают? -- if @t_keep_subacc_id=@s_keep_subacc_id -- да select @new_subacc_id=@depo_subacc_id -- Берем найденный раздел else begin -- нет select @acc_id=.DEPO_ACC_FROM_SUBACC(@depo_subacc_id) -- Создаем новый раздел с целевым МХ select @new_subacc_no=null select @new_subacc_id=null .DEPO_CREATE_SUBACC(@new_subacc_no,@acc_id,'RD',@new_subacc_id,@t_keep_subacc_id,1,'CRT','Ценные бумаги в конвертации (дроблении, консолидации)') end -- -- Расчет количества целых бумаг -- select @add_qty = floor(convert(decimal(36,17),@tmp_qty) / @s_qty * @t_qty) -- -- Расчет дроби, Округление дроби -- select @p_qty = round(convert(decimal(36,17),@tmp_qty) / @s_qty * @t_qty, @round_size, 1) - @add_qty -- -- Начисление целой бумаги -- if @add_qty=0 select @convert_mode=@convert_part_mode_0 else select @convert_mode=@convert_part_mode_1 if @convert_mode=1 -- математический BEGIN SELECT @add_qty = round(@add_qty + @p_qty, 0) SELECT @p_qty=0 END else if @convert_mode=2 -- вверх BEGIN SELECT @add_qty = CEILING(@add_qty + @p_qty) SELECT @p_qty = 0 END else if @convert_mode=3 -- вниз BEGIN SELECT @p_qty = 0 END -- ELSE -- НЕ округляем .TYPE_ASSIGN(depo_subacc_id,@new_subacc_id) .TYPE_ASSIGN(stock_qty,@add_qty) .TYPE_ASSIGN(partition_qty,@p_qty) .TYPE_ASSIGN(item_id,@id) .TYPE_INSERT('subacc_in_oper','CRT') fetch ins_cur into @depo_subacc_id, @tmp_qty end close ins_cur .DEALLOCATE ins_cur --- Пересчет количества бумаг к начислению на счет невыясненного лица declare @old_qty money, @new_qty money -- John 05.07.06 IF @convert_part_mode_1 = 0 BEGIN select @old_qty=(select sum(td_stock_convert_list.stock_qty) from td_stock_convert_list where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'subacc2convert') group by td_stock_convert_list.item_id) select @new_qty=(select sum(td_stock_convert_list.stock_qty) from td_stock_convert_list where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'subacc_in_oper') group by td_stock_convert_list.item_id) -- Учет округления при расчете общего количества ЦБ if @round_mode is null .EXIT_MESSAGE('Не задан порядок округления при расчете общего количества бумаг') IF @round_mode = 1 -- математический select @add_qty=round(convert(decimal(36,17),@old_qty) / @s_qty * @t_qty, 0) - @new_qty ELSE IF @round_mode = 2 -- вверх select @add_qty=CEILING(convert(decimal(36,17),@old_qty) / @s_qty * @t_qty) - @new_qty ELSE IF @round_mode = 3 -- вниз select @add_qty=floor(convert(decimal(36,17),@old_qty) / @s_qty * @t_qty) - @new_qty ELSE select @add_qty = 0 ---- Выбор раздела невыясненного лица --.EXIT_MESSAGE_PARM('@add_qty',@add_qty) declare @depo_acc_id numeric if @add_qty>0 begin if @nl_subacc_id is null .EXIT_MESSAGE('Раздел счета неустановленного лица не задан') select @depo_acc_id=(select depo_acc_id from td_depo_subacc where id=@nl_subacc_id) select @new_subacc_id=@nl_subacc_id select @partition_qty1_1=0 .TYPE_ASSIGN(depo_subacc_id,@new_subacc_id) .TYPE_ASSIGN(stock_qty,@add_qty) .TYPE_ASSIGN(item_id,@id) .TYPE_INSERT('subacc_in_oper','CRT') end END commit tran $ENDTEXT(5123) $BIND(BIND1) type=STOCK_CONVERT action=FORM1 class=1 order=1 idname=null $ENDBIND $ENDACTION $ACTION(TO_LIST_COMPL) name=Сформировать список к конвертации class=9 form=null target_state=LIST_COMPL procedure=ap_10000000000018616 patterns=GENERIC_MOVE user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(5133) 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*/ .GET_PROPS .DEPO_TEST_FOUNDATION(1,@id) if exists(select 1 from td_stock_convert_list,td_depo_subacc,td_depo_subacc_types where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'SUBACC2OPER') and td_depo_subacc.id=td_stock_convert_list.depo_subacc_id and td_depo_subacc_types.id=td_depo_subacc.depo_subacc_type_id and ltrim(rtrim(upper(td_depo_subacc_types.depo_subacc_type_code)))='OP') .EXIT_MESSAGE('Невозможно проводить операцию на разделе типа OP (ЦБ в операции)') IF @reestr_oper_date is null .EXIT_MESSAGE('Не задана дата операции в дальнем узле') IF @depo_oper_date is null .EXIT_MESSAGE('Не задана дата операции в ближнем узле') /*.UPDATE_STATE*/ .ACTION_HISTORY declare @acc_id numeric, @new_subacc_id numeric, @acc_sum money, @new_subacc_no varchar(50), @error_mess varchar(255), @doc_name varchar(255), @oper_date datetime, @oper_subacc_id numeric, @ret int, @foundation_remark varchar(255), @op_qty money, @list_folder_id numeric select @foundation_remark=.ITEM_NAME(@id) select @doc_name = .ITEM_NAME(@id) select @oper_date=.OPERDAY -- declare depo_acc cursor for select td_depo_subacc.depo_acc_id,sum(td_stock_convert_list.stock_qty) from td_depo_subacc,td_stock_convert_list where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'SUBACC2OPER') and td_depo_subacc.id=td_stock_convert_list.depo_subacc_id and .ITEMS_EXISTS_BY_TYPE(td_depo_subacc.id,'depo_subacc') group by td_depo_subacc.depo_acc_id -- .TYPE_INIT('subacc2convert') open depo_acc fetch depo_acc into @acc_id,@acc_sum while .CURSOR_STATE=0 begin --- Создание раздела В конвертации select @new_subacc_no=null select @new_subacc_id=null .DEPO_CREATE_SUBACC(@new_subacc_no,@acc_id,'RD',@new_subacc_id,@s_keep_subacc_id,1,'CRT','Ценные бумаги в конвертации (дроблении, консолидации)') -- --Обновление папки -- select @list_folder_id = list_folder_id from td_depo_accounts where id=@acc_id update td_depo_subacc set list_folder_id=@list_folder_id where id=@new_subacc_id .TYPE_ASSIGN(depo_subacc_id,@new_subacc_id) .TYPE_ASSIGN(stock_qty,@acc_sum) .TYPE_ASSIGN(item_id,@id) .TYPE_INSERT('subacc2convert','CRT') --- проводки на созданный раздел declare subacc2oper cursor for select td_stock_convert_list.depo_subacc_id,td_stock_convert_list.stock_qty from td_stock_convert_list,td_depo_subacc where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'SUBACC2OPER') and td_depo_subacc.id=td_stock_convert_list.depo_subacc_id and td_depo_subacc.depo_acc_id=@acc_id open subacc2oper fetch subacc2oper into @oper_subacc_id,@op_qty while .CURSOR_STATE=0 begin select @error_mess='Операция приводит к отрицательным остаткам '+.ITEM_NAME(@oper_subacc_id) exec @ret = ap_subacc_check_qty @plan_owner_code='DEPO', @plan_code='DEPO', @subacc_id=@oper_subacc_id, @stock_id=@s_stock_id, @check_date=@oper_date, @check_qty=@op_qty, @check_deb_or_cred=1 if @ret!=0 .EXIT_MESSAGE(@error_mess) .DEPOOPERATION('DEPO','DEPO', @oper_date, '2','2',@op_qty,@s_stock_id,@oper_subacc_id,@new_subacc_id,@doc_name) -- John 22.02.06 .DEPOOPERATION('DEPO','DEPO_REG',@reestr_oper_date, '2','2',@op_qty,@s_stock_id,@oper_subacc_id,@new_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_DOM',@depo_oper_date, '2','2',@op_qty,@s_stock_id,@oper_subacc_id,@new_subacc_id,@doc_name) -- .DEPOOPERATION('DEPO','DEPO_REG',@oper_date, '2','2',@op_qty,@s_stock_id,@oper_subacc_id,@new_subacc_id,@doc_name) -- .DEPOOPERATION('DEPO','DEPO_DOM',@oper_date, '2','2',@op_qty,@s_stock_id,@oper_subacc_id,@new_subacc_id,@doc_name) -- .DEPO_SINT_OPERATION('DEPO','BANK_ACCOUNT_DEPO',@oper_date,@op_qty,@s_stock_id,@oper_subacc_id,@new_subacc_id,@doc_name) fetch subacc2oper into @oper_subacc_id,@op_qty end close subacc2oper .DEALLOCATE subacc2oper fetch depo_acc into @acc_id,@acc_sum end close depo_acc .DEALLOCATE depo_acc /*-------Проводки ----------*/ commit tran $ENDTEXT(5133) $ENDACTION $ACTION(TO_OP_END) name=Исполнить class=9 form=null target_state=OP_END procedure=ap_10000000000018608 patterns=GENERIC_MOVE user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=2103 height=1432 proc_text=$TEXT(13710) 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 .ACTION_HISTORY .GET_PROPS if @s_stock_id is null .EXIT_MESSAGE('Не задана исходная ценная бумага ') if @t_stock_id is null .EXIT_MESSAGE('Не задана целевая ценная бумага ') declare @doc_name varchar(255), @ret int, @oper_date datetime, @op_subacc_id numeric, @op_qty decimal(24,4),-- John 10.04.06 @p_qty money, @error_mess varchar(255), @t_subacc_id numeric, @to_qty money, @s_subacc_id numeric, @from_qty money, @d_subacc_id numeric, @d_qty money, @sum_qty money, @acc_id numeric, @lost_qty money, @new_subacc_type_code varchar(30), @new_subacc_type_name varchar(255), @d_subacc_no varchar(50) select @doc_name = .ITEM_NAME(@id) select @oper_date=.OPERDAY -- Проводки по списанию ЦБ declare charge_cur cursor for select depo_subacc_id,stock_qty from td_stock_convert_list where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'subacc2convert') open charge_cur fetch charge_cur into @op_subacc_id,@op_qty while .CURSOR_STATE=0 begin if @pass_subacc_id is null begin if @op_qty>0 begin select @error_mess='Операция приводит к отрицательным остаткам '+.ITEM_NAME(@op_subacc_id)+' '+convert(varchar,@op_qty)+' ЦБ '+.ITEM_NAME(@s_stock_id) -- .EXIT_MESSAGE_PARM('QTY1',@op_qty) exec @ret = ap_subacc_check_qty @plan_owner_code='DEPO', @plan_code='DEPO', @subacc_id=@op_subacc_id, @stock_id=@s_stock_id, @check_date=@oper_date, @check_qty=@op_qty, @check_deb_or_cred=1 if @ret!=0 .EXIT_MESSAGE(@error_mess) .DEPOOPERATION('DEPO','DEPO', @oper_date, '2','1',@op_qty,@s_stock_id,@op_subacc_id,@s_keep_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_REG',@reestr_oper_date, '2','1',@op_qty,@s_stock_id,@op_subacc_id,@s_keep_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_DOM',@depo_oper_date, '2','1',@op_qty,@s_stock_id,@op_subacc_id,@s_keep_subacc_id,@doc_name) -- .DEPO_SINT_OPERATION('DEPO','BANK_ACCOUNT_DEPO',@oper_date,@op_qty,@s_stock_id,@op_subacc_id,@s_keep_subacc_id,@doc_name) end end else if @op_qty>0 begin select @error_mess='Операция приводит к отрицательным остаткам '+.ITEM_NAME(@op_subacc_id) -- .EXIT_MESSAGE_PARM('QTY2',@op_qty) exec @ret = ap_subacc_check_qty @plan_owner_code='DEPO', @plan_code='DEPO', @subacc_id=@op_subacc_id, @stock_id=@s_stock_id, @check_date=@oper_date, @check_qty=@op_qty, @check_deb_or_cred=1 if @ret!=0 .EXIT_MESSAGE(@error_mess) .DEPOOPERATION('DEPO','DEPO', @oper_date, '2','2',@op_qty,@s_stock_id,@op_subacc_id,@pass_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_REG',@oper_date, '2','2',@op_qty,@s_stock_id,@op_subacc_id,@pass_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_DOM',@oper_date, '2','2',@op_qty,@s_stock_id,@op_subacc_id,@pass_subacc_id,@doc_name) -- .DEPO_SINT_OPERATION('DEPO','BANK_ACCOUNT_DEPO',@oper_date,@op_qty,@s_stock_id,@op_subacc_id,@pass_subacc_id,@doc_name) end fetch charge_cur into @op_subacc_id,@op_qty end close charge_cur .DEALLOCATE charge_cur --- проводки Зачисление ЦБ declare distrib_cur cursor for select depo_subacc_id, stock_qty, partition_qty from td_stock_convert_list where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'subacc_in_oper') open distrib_cur fetch distrib_cur into @op_subacc_id,@op_qty,@p_qty while .CURSOR_STATE=0 begin if @pass_subacc_id is null begin if @op_qty>0 begin .DEPOOPERATION('DEPO','DEPO', @oper_date, '1','2',@op_qty,@t_stock_id,@t_keep_subacc_id,@op_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_REG',@reestr_oper_date, '1','2',@op_qty,@t_stock_id,@t_keep_subacc_id,@op_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_DOM',@depo_oper_date, '1','2',@op_qty,@t_stock_id,@t_keep_subacc_id,@op_subacc_id,@doc_name) -- .DEPO_SINT_OPERATION('DEPO','BANK_ACCOUNT_DEPO',@oper_date,@op_qty,@t_stock_id,@t_keep_subacc_id,@op_subacc_id,@doc_name) end if @p_qty>0 begin .DEPOOPERATION('DEPO','SEC_PARTS',@oper_date, '1','2',@p_qty,@t_stock_id,@t_keep_subacc_id,@op_subacc_id,@doc_name) end end else begin if @op_qty>0 begin select @error_mess='Операция приводит к отрицательным остаткам '+.ITEM_NAME(@pass_subacc_id) -- .EXIT_MESSAGE_PARM('QTY3',@op_qty) exec @ret = ap_subacc_check_qty @plan_owner_code='DEPO', @plan_code='DEPO', @subacc_id=@pass_subacc_id, @stock_id=@t_stock_id, @check_date=@oper_date, @check_qty=@op_qty, @check_deb_or_cred=1 -- .EXIT_MESSAGE('1') if @ret!=0 .EXIT_MESSAGE(@error_mess) .DEPOOPERATION('DEPO','DEPO', @oper_date, '2','2',@op_qty,@t_stock_id,@pass_subacc_id,@op_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_REG',@oper_date, '2','2',@op_qty,@t_stock_id,@pass_subacc_id,@op_subacc_id,@doc_name) .DEPOOPERATION('DEPO','DEPO_DOM',@oper_date, '2','2',@op_qty,@t_stock_id,@pass_subacc_id,@op_subacc_id,@doc_name) -- .DEPO_SINT_OPERATION('DEPO','BANK_ACCOUNT_DEPO',@oper_date,@op_qty,@t_stock_id,@pass_subacc_id,@op_subacc_id,@doc_name) end if @p_qty>0 begin .DEPOOPERATION('DEPO','SEC_PARTS',@oper_date, '2','2',@p_qty,@t_stock_id,@pass_subacc_id,@op_subacc_id,@doc_name) end end fetch distrib_cur into @op_subacc_id,@op_qty,@p_qty end close distrib_cur .DEALLOCATE distrib_cur ---- Формирование списка для распределения бумаг .TYPE_INIT('SUBACC_AFTER_CONVERT') if @s_keep_subacc_id=@t_keep_subacc_id begin declare accrued_cur cursor for select td_stock_convert_list.depo_subacc_id, td_stock_convert_list.stock_qty from td_stock_convert_list where td_stock_convert_list.item_id=@id and td_stock_convert_list.depo_subacc_id<>@nl_subacc_id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'subacc_in_oper') -- Выбор начисленного количества open accrued_cur fetch accrued_cur into @t_subacc_id,@to_qty while .CURSOR_STATE=0 begin -- Выбор исходного количества select @s_subacc_id=(select td_stock_convert_list.depo_subacc_id from td_stock_convert_list, td_depo_subacc s_subacc, td_depo_subacc d_subacc where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'subacc2convert') and s_subacc.id=@t_subacc_id and d_subacc.depo_acc_id=s_subacc.depo_acc_id and td_stock_convert_list.depo_subacc_id=d_subacc.id) select @from_qty=(select td_stock_convert_list.stock_qty from td_stock_convert_list, td_depo_subacc s_subacc, td_depo_subacc d_subacc where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'subacc2convert') and s_subacc.id=@t_subacc_id and d_subacc.depo_acc_id=s_subacc.depo_acc_id and td_stock_convert_list.depo_subacc_id=d_subacc.id) select @sum_qty=0 if @s_keep_subacc_id=@t_keep_subacc_id begin declare distrib_cur cursor for select td_stock_convert_list.depo_subacc_id, td_stock_convert_list.stock_qty from td_stock_convert_list, td_depo_subacc s_subacc, td_depo_subacc d_subacc where td_stock_convert_list.item_id=@id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'subacc2oper') and s_subacc.id=@s_subacc_id and d_subacc.depo_acc_id=s_subacc.depo_acc_id and td_stock_convert_list.depo_subacc_id=d_subacc.id open distrib_cur --- Рассчет распределяемого количества fetch distrib_cur into @d_subacc_id,@d_qty select @sum_qty=0 while .CURSOR_STATE=0 begin -- Owerflow select @op_qty=floor((convert(decimal(36,17),@to_qty)*@d_qty)/@from_qty) select @sum_qty=@sum_qty+@op_qty if @op_qty>0 begin .TYPE_ASSIGN(item_id,@id) .TYPE_ASSIGN(stock_qty,@op_qty) .TYPE_ASSIGN(depo_subacc_id,@d_subacc_id) .TYPE_INSERT('SUBACC_AFTER_CONVERT','CRT') end fetch distrib_cur into @d_subacc_id,@d_qty end close distrib_cur .DEALLOCATE distrib_cur end select @lost_qty=@to_qty-@sum_qty if @lost_qty>0 begin select @sum_qty=@to_qty-@sum_qty .TYPE_ASSIGN(item_id,@id) .TYPE_ASSIGN(stock_qty,@lost_qty) .TYPE_ASSIGN(depo_subacc_id,@t_subacc_id) .TYPE_INSERT('SUBACC_AFTER_CONVERT','CRT') end fetch accrued_cur into @t_subacc_id,@to_qty end close accrued_cur .DEALLOCATE accrued_cur end -- -- Не равны активные -- else begin IF @order_subacc_type is null .EXIT_MESSAGE('В случае разных активных разделов, введите тип целевого пассивного раздела') declare cur cursor for select td_stock_convert_list.depo_subacc_id, td_stock_convert_list.stock_qty from td_stock_convert_list where td_stock_convert_list.item_id=@id and td_stock_convert_list.depo_subacc_id<>@nl_subacc_id and .ITEMS_EXISTS_BY_TYPE(td_stock_convert_list.id,'subacc_in_oper') select @new_subacc_type_code=depo_subacc_type_code, @new_subacc_type_name = depo_subacc_type_name from td_depo_subacc_types where id=@order_subacc_type open cur fetch cur into @t_subacc_id,@to_qty while .CURSOR_STATE =0 begin if exists(select 1 from td_depo_subacc s_subacc, td_depo_subacc t_subacc where s_subacc.depo_acc_id=t_subacc.depo_acc_id and t_subacc.act_subacc_id=@t_keep_subacc_id and t_subacc.depo_subacc_type_id=@order_subacc_type and .ITEMS_EXISTS_BY_TYPE(t_subacc.id,'td_depo_subacc')) select @d_subacc_id=(select min(t_subacc.id) from td_depo_subacc s_subacc, td_depo_subacc t_subacc where s_subacc.depo_acc_id=t_subacc.depo_acc_id and t_subacc.act_subacc_id=@t_keep_subacc_id and t_subacc.depo_subacc_type_id=@order_subacc_type and .ITEMS_EXISTS_BY_TYPE(t_subacc.id,'td_depo_subacc') ) else begin select @d_subacc_no=null select @d_subacc_id=null .DEPO_CREATE_SUBACC(@d_subacc_no,@acc_id,@new_subacc_type_code,@d_subacc_id,@t_keep_subacc_id,1,'CRT',@new_subacc_type_name) end .TYPE_ASSIGN(item_id,@id) .TYPE_ASSIGN(stock_qty,@to_qty) .TYPE_ASSIGN(depo_subacc_id,@d_subacc_id) .TYPE_INSERT('SUBACC_AFTER_CONVERT','CRT') fetch cur into @t_subacc_id,@to_qty end end -- -- Отчеты -- .ARH_NUMBER_UPDATE .UPDATE_STATE commit tran $ENDTEXT(13710) $ENDACTION $STATE2ACTION(BEG.ACTION4) state=BEG action=ACTION4 $ENDSTATE2ACTION $STATE2ACTION(DISTR.CANCEL_DICTRIB) state=DISTR action=CANCEL_DICTRIB $ENDSTATE2ACTION $STATE2ACTION(DISTR.FORM1) state=DISTR action=FORM1 $ENDSTATE2ACTION $STATE2ACTION(DISTR.FORM2) state=DISTR action=FORM2 $ENDSTATE2ACTION $STATE2ACTION(DISTR.FORM3) state=DISTR action=FORM3 $ENDSTATE2ACTION $STATE2ACTION(DISTR.VIEW_IN_DISTRIB) state=DISTR action=VIEW_IN_DISTRIB $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION1) state=ED action=ACTION1 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION10) state=ED action=ACTION10 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION2) state=ED action=ACTION2 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION3) state=ED action=ACTION3 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION5) state=ED action=ACTION5 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION6) state=ED action=ACTION6 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION8) state=ED action=ACTION8 $ENDSTATE2ACTION $STATE2ACTION(ED.ACTION9) state=ED action=ACTION9 $ENDSTATE2ACTION $STATE2ACTION(ED.D_STOCK_CONVERTS_ALL_VIEW) state=ED action=D_STOCK_CONVERTS_ALL_VIEW $ENDSTATE2ACTION $STATE2ACTION(ED.FORM1) state=ED action=FORM1 $ENDSTATE2ACTION $STATE2ACTION(ED.FORM2) state=ED action=FORM2 $ENDSTATE2ACTION $STATE2ACTION(ED.FORM3) state=ED action=FORM3 $ENDSTATE2ACTION $STATE2ACTION(ED.TO_ED_END) state=ED action=TO_ED_END $ENDSTATE2ACTION $STATE2ACTION(ED.TO_LIST_COMPL) state=ED action=TO_LIST_COMPL $ENDSTATE2ACTION $STATE2ACTION(ED.VIEW_EDIT) state=ED action=VIEW_EDIT $ENDSTATE2ACTION $STATE2ACTION(ED_END.ACTION10) state=ED_END action=ACTION10 $ENDSTATE2ACTION $STATE2ACTION(ED_END.ACTION5) state=ED_END action=ACTION5 $ENDSTATE2ACTION $STATE2ACTION(ED_END.CANCEL_ED_END) state=ED_END action=CANCEL_ED_END $ENDSTATE2ACTION $STATE2ACTION(ED_END.D_STOCK_CONVERTS_ALL_VIEW) state=ED_END action=D_STOCK_CONVERTS_ALL_VIEW $ENDSTATE2ACTION $STATE2ACTION(ED_END.FORM1) state=ED_END action=FORM1 $ENDSTATE2ACTION $STATE2ACTION(ED_END.FORM2) state=ED_END action=FORM2 $ENDSTATE2ACTION $STATE2ACTION(ED_END.FORM3) state=ED_END action=FORM3 $ENDSTATE2ACTION $STATE2ACTION(ED_END.TO_OP_END) state=ED_END action=TO_OP_END $ENDSTATE2ACTION $STATE2ACTION(ED_END.VIEW_IN_OPER) state=ED_END action=VIEW_IN_OPER $ENDSTATE2ACTION $STATE2ACTION(LIST_COMPL.CANCEL_LIST_COMPL) state=LIST_COMPL action=CANCEL_LIST_COMPL $ENDSTATE2ACTION $STATE2ACTION(LIST_COMPL.FORM1) state=LIST_COMPL action=FORM1 $ENDSTATE2ACTION $STATE2ACTION(LIST_COMPL.FORM2) state=LIST_COMPL action=FORM2 $ENDSTATE2ACTION $STATE2ACTION(LIST_COMPL.FORM3) state=LIST_COMPL action=FORM3 $ENDSTATE2ACTION $STATE2ACTION(LIST_COMPL.TO_ED_END) state=LIST_COMPL action=TO_ED_END $ENDSTATE2ACTION $STATE2ACTION(LIST_COMPL.VIEW_LIST_COMP) state=LIST_COMPL action=VIEW_LIST_COMP $ENDSTATE2ACTION $STATE2ACTION(OP_END.CANCEL_OP_END) state=OP_END action=CANCEL_OP_END $ENDSTATE2ACTION $STATE2ACTION(OP_END.DISTRIB_STOCKS) state=OP_END action=DISTRIB_STOCKS $ENDSTATE2ACTION $STATE2ACTION(OP_END.FORM1) state=OP_END action=FORM1 $ENDSTATE2ACTION $STATE2ACTION(OP_END.FORM2) state=OP_END action=FORM2 $ENDSTATE2ACTION $STATE2ACTION(OP_END.FORM3) state=OP_END action=FORM3 $ENDSTATE2ACTION $STATE2ACTION(OP_END.VIEW_CRT) state=OP_END action=VIEW_CRT $ENDSTATE2ACTION $STATE2ACTION(REF.ACTION7) state=REF action=ACTION7 $ENDSTATE2ACTION $STATE2ACTION(REF.FORM1) state=REF action=FORM1 $ENDSTATE2ACTION $STATE2ACTION(REF.FORM2) state=REF action=FORM2 $ENDSTATE2ACTION $STATE2ACTION(REF.FORM3) state=REF action=FORM3 $ENDSTATE2ACTION $STATE2ACTION(REF.VIEW_EDIT) state=REF action=VIEW_EDIT $ENDSTATE2ACTION $STATE2ACTION(WAIT_PAY.ACTION10) state=WAIT_PAY action=ACTION10 $ENDSTATE2ACTION $STATE2ACTION(WAIT_PAY.FORM1) state=WAIT_PAY action=FORM1 $ENDSTATE2ACTION $STATE2ACTION(WAIT_PAY.FORM2) state=WAIT_PAY action=FORM2 $ENDSTATE2ACTION $STATE2ACTION(WAIT_PAY.FORM3) state=WAIT_PAY action=FORM3 $ENDSTATE2ACTION $STATE2ACTION(WAIT_PAY.VIEW_EDIT) state=WAIT_PAY action=VIEW_EDIT $ENDSTATE2ACTION $STATE2PROP(BEG.CONVERT_PART_MODE_0) state=BEG prop=CONVERT_PART_MODE_0 enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.CONVERT_PART_MODE_1) state=BEG prop=CONVERT_PART_MODE_1 enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.CONVERT_TYPE_ID) state=BEG prop=CONVERT_TYPE_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.CORRESPONDENT_ID) state=BEG prop=CORRESPONDENT_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.DEPO_OPER_DATE) state=BEG prop=DEPO_OPER_DATE enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.DOC_COMMENT) state=BEG prop=DOC_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.DOCUMENT_FORM_ID) state=BEG prop=DOCUMENT_FORM_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.FOLDER_ID) state=BEG prop=FOLDER_ID enable=1 mandatory=1 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.INITIATOR_ID) state=BEG prop=INITIATOR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.NL_SUBACC_ID) state=BEG prop=NL_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.ORDER_SUBACC_TYPE) state=BEG prop=ORDER_SUBACC_TYPE 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.PASS_SUBACC_ID) state=BEG prop=PASS_SUBACC_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.PAYER_ID) state=BEG prop=PAYER_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.REGISTR_OR_DEPO) state=BEG prop=REGISTR_OR_DEPO enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.ROUND_MODE) state=BEG prop=ROUND_MODE enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.ROUND_SIZE) state=BEG prop=ROUND_SIZE enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.S_KEEP_SUBACC_ID) state=BEG prop=S_KEEP_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.S_QTY) state=BEG prop=S_QTY enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.S_STOCK_ID) state=BEG prop=S_STOCK_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.SREZ_ID) state=BEG prop=SREZ_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.SUM_CUR_ID) state=BEG prop=SUM_CUR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.T_KEEP_SUBACC_ID) state=BEG prop=T_KEEP_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.T_QTY) state=BEG prop=T_QTY enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(BEG.T_STOCK_ID) state=BEG prop=T_STOCK_ID enable=1 mandatory=1 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.S_KEEP_SUBACC_ID) state=DEL prop=S_KEEP_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(DEL.T_KEEP_SUBACC_ID) state=DEL prop=T_KEEP_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(ED.CONVERT_PART_MODE_0) state=ED prop=CONVERT_PART_MODE_0 enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CONVERT_PART_MODE_1) state=ED prop=CONVERT_PART_MODE_1 enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CONVERT_TYPE_ID) state=ED prop=CONVERT_TYPE_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.CORRESPONDENT_ID) state=ED prop=CORRESPONDENT_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.DEPO_OPER_DATE) state=ED prop=DEPO_OPER_DATE enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.DOC_COMMENT) state=ED prop=DOC_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.DOCUMENT_FORM_ID) state=ED prop=DOCUMENT_FORM_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.FOLDER_ID) state=ED prop=FOLDER_ID enable=1 mandatory=1 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.INITIATOR_ID) state=ED prop=INITIATOR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.NL_SUBACC_ID) state=ED prop=NL_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.ORDER_SUBACC_TYPE) state=ED prop=ORDER_SUBACC_TYPE 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.PASS_SUBACC_ID) state=ED prop=PASS_SUBACC_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.PAYER_ID) state=ED prop=PAYER_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.REGISTR_OR_DEPO) state=ED prop=REGISTR_OR_DEPO enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.ROUND_MODE) state=ED prop=ROUND_MODE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.ROUND_SIZE) state=ED prop=ROUND_SIZE enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.S_KEEP_SUBACC_ID) state=ED prop=S_KEEP_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.S_QTY) state=ED prop=S_QTY enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.S_STOCK_ID) state=ED prop=S_STOCK_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.SREZ_ID) state=ED prop=SREZ_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.SUM_CUR_ID) state=ED prop=SUM_CUR_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.T_KEEP_SUBACC_ID) state=ED prop=T_KEEP_SUBACC_ID enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.T_QTY) state=ED prop=T_QTY enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.T_STOCK_ID) state=ED prop=T_STOCK_ID enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.WHO_GET) state=ED prop=WHO_GET enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED.WHO_PUT) state=ED prop=WHO_PUT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED_END.DEPO_OPER_DATE) state=ED_END prop=DEPO_OPER_DATE enable=1 mandatory=1 visible=1 $ENDSTATE2PROP $STATE2PROP(ED_END.DOC_COMMENT) state=ED_END prop=DOC_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED_END.REESTR_OPER_DATE) state=ED_END prop=REESTR_OPER_DATE enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(ED_END.S_KEEP_SUBACC_ID) state=ED_END prop=S_KEEP_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(ED_END.T_KEEP_SUBACC_ID) state=ED_END prop=T_KEEP_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END.DOC_COMMENT) state=OP_END prop=DOC_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(OP_END.S_KEEP_SUBACC_ID) state=OP_END prop=S_KEEP_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(OP_END.T_KEEP_SUBACC_ID) state=OP_END prop=T_KEEP_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(WAIT_PAY.DOC_COMMENT) state=WAIT_PAY prop=DOC_COMMENT enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $STATE2PROP(WAIT_PAY.S_KEEP_SUBACC_ID) state=WAIT_PAY prop=S_KEEP_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $STATE2PROP(WAIT_PAY.T_KEEP_SUBACC_ID) state=WAIT_PAY prop=T_KEEP_SUBACC_ID enable=0 mandatory=0 visible=0 $ENDSTATE2PROP $ENDDOC