# Date: 13/04/06 # Version: 105 $DOC(REPORT_FOR_NPF) name=Типовой отчет для СД, обслуживающего НПФ class=6 product=ALD_NPF name_formula=$TEXT(14563787) .TYPE_NAME((.TYPE_ID_FROM_CODE_FUNC('report_for_npf'))) + ' по срезу ' + .ITEM_NAME(@foundation_id) $ENDTEXT(14563787) remark_formula=$TEXT(14563787) .TYPE_NAME((.TYPE_ID_FROM_CODE_FUNC('report_for_npf'))) + ' по срезу ' + .ITEM_NAME(@foundation_id) $ENDTEXT(14563787) $STATE(CRT) 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=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(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=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_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=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(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=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(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=0 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(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=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(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=0 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=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(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=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(FOUNDATION_ID) name=Документ основание field_name=foundation_id table_name=td_depo_docs field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=16 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(OWNER_ID) name=Владелец field_name=owner_id table_name=td_depo_docs field_type=numeric field_length=9 field_scale=0 field_prec=18 page=1 order=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(DATE_E) name=Дата отправки field_name=date_e table_name=td_queries field_type=datetime field_length=8 field_scale=3 field_prec=23 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(DATE_B) name=Дата отчета field_name=date_b table_name=td_queries field_type=datetime field_length=8 field_scale=3 field_prec=23 page=2 order=18 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(REL2) class=0 type=PARTNERS form=null prop=CORRESPONDENT_ID idname=null order=null $ENDRELATION $RELATION(REL1) class=0 type=PARTNERS form=null prop=PAYER_ID idname=null order=null $ENDRELATION $RELATION(REL5) class=0 type=PARTNERS form=null prop=INITIATOR_ID idname=null order=null $ENDRELATION $RELATION(REL3) class=0 type=ITEMS form=null prop=FOUNDATION_ID idname=null order=null $ENDRELATION $RELATION(REL4) class=0 type=NPF_FUND form=null prop=OWNER_ID idname=null order=null $ENDRELATION $RELATION(REL6) class=1 type=REPORT_FOR_NPF_DET form=FORM1 prop=null idname=report_id_s order=10 $ENDRELATION $FORM(D_REP_NPF_DET) name=Перечень отчета class=5 filter=null target_state= uo=null dw=d_sdrep_npf_det procedure=ap_sdrep_npf_det patterns=GENERIC_VIEW_ITEM user_define=1 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(14563790) 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) .GET_PROPS declare @user_name varchar(100), @bookkeeper_name varchar(150), @head_last_name varchar(150) select @user_name=user_name from t_users where login_name=.SUSER_NAME select @head_last_name=j_head_last_name,@bookkeeper_name=j_bookkeeper_name from t_partners_jur where id=@owner_id /*----test update ts_invest_npf_report set rep_sum=999 where ts_invest_npf_report.line_code='110' and ts_invest_npf_report.report_id=@id and .ITEMS_EXISTS(ts_invest_npf_report.id)*/ select a.line_name as line_name, a.line_code as line_code, convert(decimal(18,4),round(a.rep_sum/1000,4)) as rep_sum, convert(decimal(18,4),a.rep_qty) as rep_qty, convert(decimal(18,4),a.rep_percent) as rep_percent, convert(decimal(18,4),(select min_lim_value from ts_restrict_values where organization_id=@owner_id and lim_id=a.line_id)) as min_proc, convert(decimal(18,4),(select max_lim_value from ts_restrict_values where organization_id=@owner_id and lim_id=a.line_id)) as max_proc, @user_name as user_name, @head_last_name as head_last_name, @bookkeeper_name as bookkeeper_name from ts_invest_npf_report a where a.report_id=@id and .ITEMS_EXISTS(a.id) order by a.line_code end $ENDTEXT(14563790) $ENDFORM $FORM(D_REP_NPF_HEADER) name=Просмотр отчета class=5 filter=null target_state= uo=uo_list_rep dw=d_sdrep_npf_header procedure=ap_10000000000087730 patterns=GENERIC_VIEW_ITEM user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(14563790) 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 .CHECK_VIEW_ITEM .GET_PROPS .NAME_VAR(@lic) select @lic=max(l.lic_no) from t_licence l, td_pay_fond where td_pay_fond.id=@owner_id and .ITEMS_EXISTS(l.id) and l.partner_id=td_pay_fond.id and l.activity_id=6 select convert(varchar(30),@id) as sid, t_partners.partner_name as full_name, t_partners.jur_code+' '+t_partners.juraddress as jur_adr, t_partners.real_code+' '+t_partners.partner_address as fact_adr, isnull(@lic,'') as reg_no, t_partners.j_inn as j_inn, 'на '+convert(varchar(50),@date_b,104)+' г.' as rep_date from t_partners, td_pay_fond where t_partners.id=@owner_id and t_partners.id=td_pay_fond.id end $ENDTEXT(14563790) $ENDFORM $FORM(FORM1) name=Данные class=5 filter=null target_state= uo=uo_edit dw=d_sdrep_npf_p2 procedure=ap_10000000000087731 patterns=GENERIC_VIEW_ITEM_P2 user_define=1 isvisible=1 istab=1 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(14563790) 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(14563790) $ENDFORM $FORM(FORM2) name=Просмотр class=5 filter=null target_state= uo=uo_edit dw=d_pif_depooper_p1 procedure=ap_10000000000085420 patterns=GENERIC_VIEW_ITEM_P1 user_define=0 isvisible=1 istab=1 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(14563790) 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) end $ENDTEXT(14563790) $ACTION2RELATION(REL3.ITEM_NAME) relation=REL3 where=null prop=ITEM_NAME order=null alias=foundation_name $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_CODE) relation=REL4 where=null prop=PARTNER_CODE order=null alias=found_code $ENDACTION2RELATION $ACTION2RELATION(REL4.PARTNER_SHORT_NAME) relation=REL4 where=null prop=PARTNER_SHORT_NAME order=null alias=found_name $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_CODE) relation=REL5 where=null prop=PARTNER_CODE order=null alias=initiator_code $ENDACTION2RELATION $ACTION2RELATION(REL5.PARTNER_SHORT_NAME) relation=REL5 where=null prop=PARTNER_SHORT_NAME order=null alias=initiator_short_name $ENDACTION2RELATION $ACTION2RELATION(REL2.PARTNER_CODE) relation=REL2 where=null prop=PARTNER_CODE order=null alias=corr_code $ENDACTION2RELATION $ACTION2RELATION(REL2.PARTNER_SHORT_NAME) relation=REL2 where=null prop=PARTNER_SHORT_NAME order=null alias=corr_short_name $ENDACTION2RELATION $ACTION2RELATION(REL1.PARTNER_CODE) relation=REL1 where=null prop=PARTNER_CODE order=null alias=payer_code $ENDACTION2RELATION $ACTION2RELATION(REL1.PARTNER_SHORT_NAME) relation=REL1 where=null prop=PARTNER_SHORT_NAME order=null alias=payer_short_name $ENDACTION2RELATION $BIND(BIND1) type=REPORT_FOR_NPF action=FORM1 class=1 order=2 idname=null $ENDBIND $ENDFORM $FORM(FORM_EXP2WORD) name=Форма для экспорта в Word class=5 filter=null target_state= uo=uo_word dw=d_sdrep_npf_exp_word procedure=ap_30000000000096304 patterns=null user_define=0 isvisible=1 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(14563790) 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 .CHECK_VIEW_ITEM declare @reg_no varchar(50), @inn varchar(30), @jur_adr varchar(255), @fact_adr varchar(255), @fullname varchar(255), @rep_date varchar(50), @RepSum110 decimal(18,2), @RepSum111 decimal(18,2), @RepSum112 decimal(18,2), @RepSum113 decimal(18,2), @RepPercent310 decimal(18,2), @MinProc310 decimal(18), @MaxProc310 decimal(18), @RepQty310 decimal(18,2), @RepPercent311 decimal(18,2), @MinProc311 decimal(18), @MaxProc311 decimal(18), @RepQty311 decimal(18,2), @RepPercent312 decimal(18,2), @MinProc312 decimal(18), @MaxProc312 decimal(18), @RepQty312 decimal(18,2), @RepPercent320 decimal(18,2), @MinProc320 decimal(18), @MaxProc320 decimal(18), @RepQty320 decimal(18,2), @RepPercent321 decimal(18,2), @MinProc321 decimal(18), @MaxProc321 decimal(18), @RepQty321 decimal(18,2), @RepPercent330 decimal(18,2), @MinProc330 decimal(18), @MaxProc330 decimal(18), @RepQty330 decimal(18,2), @RepPercent331 decimal(18,2), @MinProc331 decimal(18), @MaxProc331 decimal(18), @RepQty331 decimal(18,2), @RepPercent340 decimal(18,2), @MinProc340 decimal(18), @MaxProc340 decimal(18), @RepQty340 decimal(18,2), @RepPercent343 decimal(18,2), @MinProc343 decimal(18), @MaxProc343 decimal(18), @RepQty343 decimal(18,2), @RepPercent345 decimal(18,2), @MinProc345 decimal(18), @MaxProc345 decimal(18), @RepQty345 decimal(18,2), @RepPercent350 decimal(18,2), @MinProc350 decimal(18), @MaxProc350 decimal(18), @RepQty350 decimal(18,2), @RepPercent351 decimal(18,2), @MinProc351 decimal(18), @MaxProc351 decimal(18), @RepQty351 decimal(18,2), @RepPercent352 decimal(18,2), @MinProc352 decimal(18), @MaxProc352 decimal(18), @RepQty352 decimal(18,2), @RepPercent360 decimal(18,2), @MinProc360 decimal(18), @MaxProc360 decimal(18), @RepQty360 decimal(18,2), @RepPercent380 decimal(18,2), @MinProc380 decimal(18), @MaxProc380 decimal(18), @RepQty380 decimal(18,2), @RepPercent381 decimal(18,2), @MinProc381 decimal(18), @MaxProc381 decimal(18), @RepQty381 decimal(18,2), @RepPercent382 decimal(18,2), @MinProc382 decimal(18), @MaxProc382 decimal(18), @RepQty382 decimal(18,2), @RepPercent383 decimal(18,2), @MinProc383 decimal(18), @MaxProc383 decimal(18), @RepQty383 decimal(18,2), @RepPercent384 decimal(18,2), @MinProc384 decimal(18), @MaxProc384 decimal(18), @RepQty384 decimal(18,2), @RepPercent385 decimal(18,2), @MinProc385 decimal(18), @MaxProc385 decimal(18), @RepQty385 decimal(18,2), @RepPercent386 decimal(18,2), @MinProc386 decimal(18), @MaxProc386 decimal(18), @RepQty386 decimal(18,2), @RepPercent390 decimal(18,2), @MinProc390 decimal(18), @MaxProc390 decimal(18), @RepQty390 decimal(18,2), @RepPercent510 decimal(18,2), @MinProc510 decimal(18), @MaxProc510 decimal(18), @RepQty510 decimal(18,2), @RepPercent520 decimal(18,2), @MinProc520 decimal(18), @MaxProc520 decimal(18), @RepQty520 decimal(18,2), @RepPercent610 decimal(18,2), @MinProc610 decimal(18), @MaxProc610 decimal(18), @RepQty610 decimal(18,2), @RepPercent620 decimal(18,2), @MinProc620 decimal(18), @MaxProc620 decimal(18), @RepQty620 decimal(18,2), @RepPercent630 decimal(18,2), @MinProc630 decimal(18), @MaxProc630 decimal(18), @RepQty630 decimal(18,2), @RepPercent640 decimal(18,2), @MinProc640 decimal(18), @MaxProc640 decimal(18), @RepQty640 decimal(18,2) .GET_PROPS select @reg_no = regist_sertificate_no from t_partners where t_partners.id=@owner_id select @inn = j_inn from t_partners where t_partners.id=@owner_id select @jur_adr = jur_code+' '+juraddress from t_partners where t_partners.id=@owner_id select @fact_adr = real_code+' '+partner_address from t_partners where t_partners.id=@owner_id select @fullname = partner_name from t_partners where t_partners.id=@owner_id select @rep_date = convert(varchar(50),@date_b,104) Select @RepSum110 = convert(decimal(18,2),round(a.rep_sum/1000.00,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='110' Select @RepSum111 = convert(decimal(18,2),round(a.rep_sum/1000.00,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='111' Select @RepSum112 = convert(decimal(18,2),round(a.rep_sum/1000.00,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='112' Select @RepSum113 = convert(decimal(18,2),round(a.rep_sum/1000.00,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='113' Select @RepPercent310 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='310' Select @RepPercent311 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='311' Select @RepPercent312 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='312' Select @RepPercent320 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='320' Select @RepPercent321 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='321' Select @RepPercent330 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='330' Select @RepPercent331 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='331' Select @RepPercent340 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='340' Select @RepPercent343 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='343' Select @RepPercent345 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='345' Select @RepPercent350 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='350' Select @RepPercent351 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='351' Select @RepPercent352 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='352' Select @RepPercent360 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='360' Select @RepPercent380 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='380' Select @RepPercent381 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='381' Select @RepPercent382 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='382' Select @RepPercent383 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='383' Select @RepPercent384 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='384' Select @RepPercent385 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='385' Select @RepPercent386 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='386' Select @RepPercent390 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='390' Select @RepPercent510 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='510' Select @RepPercent520 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='520' Select @RepPercent610 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='610' Select @RepPercent620 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='620' Select @RepPercent630 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='630' Select @RepPercent640 = convert(decimal(18,2),round(a.rep_percent,2)) from ts_invest_npf_report a where a.report_id=@id and a.line_code='640' Select @RepQty310 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='310' Select @RepQty311 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='311' Select @RepQty312 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='312' Select @RepQty320 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='320' Select @RepQty321 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='321' Select @RepQty330 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='330' Select @RepQty331 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='331' Select @RepQty340 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='340' Select @RepQty343 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='343' Select @RepQty345 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='345' Select @RepQty350 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='350' Select @RepQty351 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='351' Select @RepQty352 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='352' Select @RepQty360 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='360' Select @RepQty380 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='380' Select @RepQty381 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='381' Select @RepQty382 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='382' Select @RepQty383 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='383' Select @RepQty384 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='384' Select @RepQty385 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='385' Select @RepQty386 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='386' Select @RepQty390 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='390' Select @RepQty510 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='510' Select @RepQty520 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='520' Select @RepQty610 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='610' Select @RepQty620 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='620' Select @RepQty630 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='630' Select @RepQty640 = convert(decimal(18,2),a.rep_qty) from ts_invest_npf_report a where a.report_id=@id and a.line_code='640' select @MaxProc310 = convert(decimal(18,0),rv.max_lim_value),@MinProc310 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='310' select @MaxProc311 = convert(decimal(18,0),rv.max_lim_value),@MinProc311 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='311' select @MaxProc312 = convert(decimal(18,0),rv.max_lim_value),@MinProc312 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='312' select @MaxProc320 = convert(decimal(18,0),rv.max_lim_value),@MinProc320 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='320' select @MaxProc321 = convert(decimal(18,0),rv.max_lim_value),@MinProc321 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='321' select @MaxProc330 = convert(decimal(18,0),rv.max_lim_value),@MinProc330 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='330' select @MaxProc331 = convert(decimal(18,0),rv.max_lim_value),@MinProc331 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='331' select @MaxProc340 = convert(decimal(18,0),rv.max_lim_value),@MinProc340 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='340' select @MaxProc343 = convert(decimal(18,0),rv.max_lim_value),@MinProc343 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='343' select @MaxProc345 = convert(decimal(18,0),rv.max_lim_value),@MinProc345 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='345' select @MaxProc350 = convert(decimal(18,0),rv.max_lim_value),@MinProc350 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='350' select @MaxProc351 = convert(decimal(18,0),rv.max_lim_value),@MinProc351 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='351' select @MaxProc352 = convert(decimal(18,0),rv.max_lim_value),@MinProc352 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='352' select @MaxProc360 = convert(decimal(18,0),rv.max_lim_value),@MinProc360 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='360' select @MaxProc380 = convert(decimal(18,0),rv.max_lim_value),@MinProc380 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='380' select @MaxProc381 = convert(decimal(18,0),rv.max_lim_value),@MinProc381 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='381' select @MaxProc382 = convert(decimal(18,0),rv.max_lim_value),@MinProc382 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='382' select @MaxProc383 = convert(decimal(18,0),rv.max_lim_value),@MinProc383 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='383' select @MaxProc384 = convert(decimal(18,0),rv.max_lim_value),@MinProc384 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='384' select @MaxProc385 = convert(decimal(18,0),rv.max_lim_value),@MinProc385 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='385' select @MaxProc386 = convert(decimal(18,0),rv.max_lim_value),@MinProc386 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='386' select @MaxProc390 = convert(decimal(18,0),rv.max_lim_value),@MinProc390 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='390' select @MaxProc510 = convert(decimal(18,0),rv.max_lim_value),@MinProc510 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='510' select @MaxProc520 = convert(decimal(18,0),rv.max_lim_value),@MinProc520 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='520' select @MaxProc610 = convert(decimal(18,0),rv.max_lim_value),@MinProc610 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='610' select @MaxProc620 = convert(decimal(18,0),rv.max_lim_value),@MinProc620 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='620' select @MaxProc630 = convert(decimal(18,0),rv.max_lim_value),@MinProc630 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='630' select @MaxProc640 = convert(decimal(18,0),rv.max_lim_value),@MinProc640 = convert(decimal(18,0),rv.min_lim_value) from ts_restrict_values rv, ts_invest_npf_report a where rv.organization_id=@owner_id and rv.lim_id=a.line_id and a.report_id=@id and a.line_code='640' select @reg_no as reg_no , @inn as inn , @jur_adr as jur_adr , @fact_adr as fact_adr , @fullname as full_name , @rep_date as rep_date , convert(varchar(20),@RepSum110) as RepSum110, convert(varchar(20),@RepSum111) as RepSum111, convert(varchar(20),@RepSum112) as RepSum112, convert(varchar(20),@RepSum113) as RepSum113, convert(varchar(20),@RepPercent310) as RepPercent310, convert(varchar(20),@RepPercent311) as RepPercent311, convert(varchar(20),@RepPercent312) as RepPercent312, convert(varchar(20),@RepPercent320) as RepPercent320, convert(varchar(20),@RepPercent321) as RepPercent321, convert(varchar(20),@RepPercent330) as RepPercent330, convert(varchar(20),@RepPercent331) as RepPercent331, convert(varchar(20),@RepPercent340) as RepPercent340, convert(varchar(20),@RepPercent343) as RepPercent343, convert(varchar(20),@RepPercent345) as RepPercent345, convert(varchar(20),@RepPercent350) as RepPercent350, convert(varchar(20),@RepPercent351) as RepPercent351, convert(varchar(20),@RepPercent352) as RepPercent352, convert(varchar(20),@RepPercent360) as RepPercent360, convert(varchar(20),@RepPercent380) as RepPercent380, convert(varchar(20),@RepPercent381) as RepPercent381, convert(varchar(20),@RepPercent382) as RepPercent382, convert(varchar(20),@RepPercent383) as RepPercent383, convert(varchar(20),@RepPercent384) as RepPercent384, convert(varchar(20),@RepPercent385) as RepPercent385, convert(varchar(20),@RepPercent386) as RepPercent386, convert(varchar(20),@RepPercent390) as RepPercent390, convert(varchar(20),@RepPercent510) as RepPercent510, convert(varchar(20),@RepPercent520) as RepPercent520, convert(varchar(20),@RepPercent610) as RepPercent610, convert(varchar(20),@RepPercent620) as RepPercent620, convert(varchar(20),@RepPercent630) as RepPercent630, convert(varchar(20),@RepPercent640) as RepPercent640, case when @MinProc310 is not null or @MaxProc310 is not null then convert(varchar(20),isnull(@MinProc310,0))+' - '+convert(varchar(20),isnull(@MaxProc310,0)) else '' end as MaxProc310, convert(varchar(20),@RepQty310) as RepQty310, case when @MinProc311 is not null or @MaxProc311 is not null then convert(varchar(20),isnull(@MinProc311,0))+' - '+convert(varchar(20),isnull(@MaxProc311,0)) else '' end as MaxProc311, convert(varchar(20),@RepQty311) as RepQty311, case when @MinProc312 is not null or @MaxProc312 is not null then convert(varchar(20),isnull(@MinProc312,0))+' - '+convert(varchar(20),isnull(@MaxProc312,0)) else '' end as MaxProc312, convert(varchar(20),@RepQty312) as RepQty312, case when @MinProc320 is not null or @MaxProc320 is not null then convert(varchar(20),isnull(@MinProc320,0))+' - '+convert(varchar(20),isnull(@MaxProc320,0)) else '' end as MaxProc320, convert(varchar(20),@RepQty320) as RepQty320, case when @MinProc321 is not null or @MaxProc321 is not null then convert(varchar(20),isnull(@MinProc321,0))+' - '+convert(varchar(20),isnull(@MaxProc321,0)) else '' end as MaxProc321, convert(varchar(20),@RepQty321) as RepQty321, case when @MinProc330 is not null or @MaxProc330 is not null then convert(varchar(20),isnull(@MinProc330,0))+' - '+convert(varchar(20),isnull(@MaxProc330,0)) else '' end as MaxProc330, convert(varchar(20),@RepQty330) as RepQty330, case when @MinProc331 is not null or @MaxProc331 is not null then convert(varchar(20),isnull(@MinProc331,0))+' - '+convert(varchar(20),isnull(@MaxProc331,0)) else '' end as MaxProc331, convert(varchar(20),@RepQty331) as RepQty331, case when @MinProc340 is not null or @MaxProc340 is not null then convert(varchar(20),isnull(@MinProc340,0))+' - '+convert(varchar(20),isnull(@MaxProc340,0)) else '' end as MaxProc340, convert(varchar(20),@RepQty340) as RepQty340, case when @MinProc343 is not null or @MaxProc343 is not null then convert(varchar(20),isnull(@MinProc343,0))+' - '+convert(varchar(20),isnull(@MaxProc343,0)) else '' end as MaxProc343, convert(varchar(20),@RepQty343) as RepQty343, case when @MinProc345 is not null or @MaxProc345 is not null then convert(varchar(20),isnull(@MinProc345,0))+' - '+convert(varchar(20),isnull(@MaxProc345,0)) else '' end as MaxProc345, convert(varchar(20),@RepQty345) as RepQty345, case when @MinProc350 is not null or @MaxProc350 is not null then convert(varchar(20),isnull(@MinProc350,0))+' - '+convert(varchar(20),isnull(@MaxProc350,0)) else '' end as MaxProc350, convert(varchar(20),@RepQty350) as RepQty350, case when @MinProc351 is not null or @MaxProc351 is not null then convert(varchar(20),isnull(@MinProc351,0))+' - '+convert(varchar(20),isnull(@MaxProc351,0)) else '' end as MaxProc351, convert(varchar(20),@RepQty351) as RepQty351, case when @MinProc352 is not null or @MaxProc352 is not null then convert(varchar(20),isnull(@MinProc352,0))+' - '+convert(varchar(20),isnull(@MaxProc352,0)) else '' end as MaxProc352, convert(varchar(20),@RepQty352) as RepQty352, case when @MinProc360 is not null or @MaxProc360 is not null then convert(varchar(20),isnull(@MinProc360,0))+' - '+convert(varchar(20),isnull(@MaxProc360,0)) else '' end as MaxProc360, convert(varchar(20),@RepQty360) as RepQty360, case when @MinProc380 is not null or @MaxProc380 is not null then convert(varchar(20),isnull(@MinProc380,0))+' - '+convert(varchar(20),isnull(@MaxProc380,0)) else '' end as MaxProc380, convert(varchar(20),@RepQty380) as RepQty380, case when @MinProc381 is not null or @MaxProc381 is not null then convert(varchar(20),isnull(@MinProc381,0))+' - '+convert(varchar(20),isnull(@MaxProc381,0)) else '' end as MaxProc381, convert(varchar(20),@RepQty381) as RepQty381, case when @MinProc382 is not null or @MaxProc382 is not null then convert(varchar(20),isnull(@MinProc382,0))+' - '+convert(varchar(20),isnull(@MaxProc382,0)) else '' end as MaxProc382, convert(varchar(20),@RepQty382) as RepQty382, case when @MinProc383 is not null or @MaxProc383 is not null then convert(varchar(20),isnull(@MinProc383,0))+' - '+convert(varchar(20),isnull(@MaxProc383,0)) else '' end as MaxProc383, convert(varchar(20),@RepQty383) as RepQty383, case when @MinProc384 is not null or @MaxProc384 is not null then convert(varchar(20),isnull(@MinProc384,0))+' - '+convert(varchar(20),isnull(@MaxProc384,0)) else '' end as MaxProc384, convert(varchar(20),@RepQty384) as RepQty384, case when @MinProc385 is not null or @MaxProc385 is not null then convert(varchar(20),isnull(@MinProc385,0))+' - '+convert(varchar(20),isnull(@MaxProc385,0)) else '' end as MaxProc385, convert(varchar(20),@RepQty385) as RepQty385, case when @MinProc386 is not null or @MaxProc386 is not null then convert(varchar(20),isnull(@MinProc386,0))+' - '+convert(varchar(20),isnull(@MaxProc386,0)) else '' end as MaxProc386, convert(varchar(20),@RepQty386) as RepQty386, case when @MinProc390 is not null or @MaxProc390 is not null then convert(varchar(20),isnull(@MinProc390,0))+' - '+convert(varchar(20),isnull(@MaxProc390,0)) else '' end as MaxProc390, convert(varchar(20),@RepQty390) as RepQty390, case when @MinProc510 is not null or @MaxProc510 is not null then convert(varchar(20),isnull(@MinProc510,0))+' - '+convert(varchar(20),isnull(@MaxProc510,0)) else '' end as MaxProc510, convert(varchar(20),@RepQty510) as RepQty510, case when @MinProc520 is not null or @MaxProc520 is not null then convert(varchar(20),isnull(@MinProc520,0))+' - '+convert(varchar(20),isnull(@MaxProc520,0)) else '' end as MaxProc520, convert(varchar(20),@RepQty520) as RepQty520, case when @MinProc610 is not null or @MaxProc610 is not null then convert(varchar(20),isnull(@MinProc610,0))+' - '+convert(varchar(20),isnull(@MaxProc610,0)) else '' end as MaxProc610, convert(varchar(20),@RepQty610) as RepQty610, case when @MinProc620 is not null or @MaxProc620 is not null then convert(varchar(20),isnull(@MinProc620,0))+' - '+convert(varchar(20),isnull(@MaxProc620,0)) else '' end as MaxProc620, convert(varchar(20),@RepQty620) as RepQty620, case when @MinProc630 is not null or @MaxProc630 is not null then convert(varchar(20),isnull(@MinProc630,0))+' - '+convert(varchar(20),isnull(@MaxProc630,0)) else '' end as MaxProc630, convert(varchar(20),@RepQty630) as RepQty630, case when @MinProc640 is not null or @MaxProc640 is not null then convert(varchar(20),isnull(@MinProc640,0))+' - '+convert(varchar(20),isnull(@MaxProc640,0)) else '' end as MaxProc640, convert(varchar(20),@RepQty640) as RepQty640, convert(varchar(20),case when @RepPercent310<@MinProc310 then (@MinProc310-@RepPercent310) else (case when @RepPercent310>@MaxProc310 then @RepPercent310-@MaxProc310 else null end) end) as Delta310, convert(varchar(20),case when @RepPercent311<@MinProc311 then (@MinProc311-@RepPercent311) else (case when @RepPercent311>@MaxProc311 then @RepPercent311-@MaxProc311 else null end) end) as Delta311, convert(varchar(20),case when @RepPercent312<@MinProc312 then (@MinProc312-@RepPercent312) else (case when @RepPercent312>@MaxProc312 then @RepPercent312-@MaxProc312 else null end) end) as Delta312, convert(varchar(20),case when @RepPercent320<@MinProc320 then (@MinProc320-@RepPercent320) else (case when @RepPercent320>@MaxProc320 then @RepPercent320-@MaxProc320 else null end) end) as Delta320, convert(varchar(20),case when @RepPercent321<@MinProc321 then (@MinProc321-@RepPercent321) else (case when @RepPercent321>@MaxProc321 then @RepPercent321-@MaxProc321 else null end) end) as Delta321, convert(varchar(20),case when @RepPercent330<@MinProc330 then (@MinProc330-@RepPercent330) else (case when @RepPercent330>@MaxProc330 then @RepPercent330-@MaxProc330 else null end) end) as Delta330, convert(varchar(20),case when @RepPercent331<@MinProc331 then (@MinProc331-@RepPercent331) else (case when @RepPercent331>@MaxProc331 then @RepPercent331-@MaxProc331 else null end) end) as Delta331, convert(varchar(20),case when @RepPercent340<@MinProc340 then (@MinProc340-@RepPercent340) else (case when @RepPercent340>@MaxProc340 then @RepPercent340-@MaxProc340 else null end) end) as Delta340, convert(varchar(20),case when @RepPercent343<@MinProc343 then (@MinProc343-@RepPercent343) else (case when @RepPercent343>@MaxProc343 then @RepPercent343-@MaxProc343 else null end) end) as Delta343, convert(varchar(20),case when @RepPercent345<@MinProc345 then (@MinProc345-@RepPercent345) else (case when @RepPercent345>@MaxProc345 then @RepPercent345-@MaxProc345 else null end) end) as Delta345, convert(varchar(20),case when @RepPercent350<@MinProc350 then (@MinProc350-@RepPercent350) else (case when @RepPercent350>@MaxProc350 then @RepPercent350-@MaxProc350 else null end) end) as Delta350, convert(varchar(20),case when @RepPercent351<@MinProc351 then (@MinProc351-@RepPercent351) else (case when @RepPercent351>@MaxProc351 then @RepPercent351-@MaxProc351 else null end) end) as Delta351, convert(varchar(20),case when @RepPercent352<@MinProc352 then (@MinProc352-@RepPercent352) else (case when @RepPercent352>@MaxProc352 then @RepPercent352-@MaxProc352 else null end) end) as Delta352, convert(varchar(20),case when @RepPercent360<@MinProc360 then (@MinProc360-@RepPercent360) else (case when @RepPercent360>@MaxProc360 then @RepPercent360-@MaxProc360 else null end) end) as Delta360, convert(varchar(20),case when @RepPercent380<@MinProc380 then (@MinProc380-@RepPercent380) else (case when @RepPercent380>@MaxProc380 then @RepPercent380-@MaxProc380 else null end) end) as Delta380, convert(varchar(20),case when @RepPercent381<@MinProc381 then (@MinProc381-@RepPercent381) else (case when @RepPercent381>@MaxProc381 then @RepPercent381-@MaxProc381 else null end) end) as Delta381, convert(varchar(20),case when @RepPercent382<@MinProc382 then (@MinProc382-@RepPercent382) else (case when @RepPercent382>@MaxProc382 then @RepPercent382-@MaxProc382 else null end) end) as Delta382, convert(varchar(20),case when @RepPercent383<@MinProc383 then (@MinProc383-@RepPercent383) else (case when @RepPercent383>@MaxProc383 then @RepPercent383-@MaxProc383 else null end) end) as Delta383, convert(varchar(20),case when @RepPercent384<@MinProc384 then (@MinProc384-@RepPercent384) else (case when @RepPercent384>@MaxProc384 then @RepPercent384-@MaxProc384 else null end) end) as Delta384, convert(varchar(20),case when @RepPercent385<@MinProc385 then (@MinProc385-@RepPercent385) else (case when @RepPercent385>@MaxProc385 then @RepPercent385-@MaxProc385 else null end) end) as Delta385, convert(varchar(20),case when @RepPercent386<@MinProc386 then (@MinProc386-@RepPercent386) else (case when @RepPercent386>@MaxProc386 then @RepPercent386-@MaxProc386 else null end) end) as Delta386, convert(varchar(20),case when @RepPercent390<@MinProc390 then (@MinProc390-@RepPercent390) else (case when @RepPercent390>@MaxProc390 then @RepPercent390-@MaxProc390 else null end) end) as Delta390, convert(varchar(20),case when @RepPercent510<@MinProc510 then (@MinProc510-@RepPercent510) else (case when @RepPercent510>@MaxProc510 then @RepPercent510-@MaxProc510 else null end) end) as Delta510, convert(varchar(20),case when @RepPercent520<@MinProc520 then (@MinProc520-@RepPercent520) else (case when @RepPercent520>@MaxProc520 then @RepPercent520-@MaxProc520 else null end) end) as Delta520, convert(varchar(20),case when @RepPercent610<@MinProc610 then (@MinProc610-@RepPercent610) else (case when @RepPercent610>@MaxProc610 then @RepPercent610-@MaxProc610 else null end) end) as Delta610, convert(varchar(20),case when @RepPercent620<@MinProc620 then (@MinProc620-@RepPercent620) else (case when @RepPercent620>@MaxProc620 then @RepPercent620-@MaxProc620 else null end) end) as Delta620, convert(varchar(20),case when @RepPercent630<@MinProc630 then (@MinProc630-@RepPercent630) else (case when @RepPercent630>@MaxProc630 then @RepPercent630-@MaxProc630 else null end) end) as Delta630, convert(varchar(20),case when @RepPercent640<@MinProc640 then (@MinProc640-@RepPercent640) else (case when @RepPercent640>@MaxProc640 then @RepPercent640-@MaxProc640 else null end) end) as Delta640 end $ENDTEXT(14563790) $ENDFORM $ACTION(ACTION1) name=Изменить class=2 form=FORM2 target_state=null procedure=ap_10000000000087738 patterns=GENERIC_UPDATE_P1 user_define=0 isvisible=0 istab=1 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(14563790) create procedure dbo.%PROC% @sid varchar(30) = null, .ARGLIST(ALL,1) as declare @action_id numeric, @id numeric, @user_id numeric, @state_id numeric, @type_id numeric, @item_name varchar(100), @new_state_id numeric begin tran select @action_id = %ACTION_ID% select @id = convert(numeric, @sid) .CHECK_USER .CHECK_UPDATE /* .ARGCONVERT(ALL,1) .TEST_UNIQUE(ALL,1) .UPDATE(ALL,1) .RELGEN .UPDATE_STATE .ACTION_HISTORY */ commit tran select sid = convert(varchar, @id) $ENDTEXT(14563790) $BIND(BIND1) type=REPORT_FOR_NPF action=ACTION2 class=1 order=2 idname=null $ENDBIND $ENDACTION $ACTION(ACTION2) name=Данные (изм) class=2 form=FORM1 target_state=null procedure=ap_10000000000087739 patterns=GENERIC_UPDATE_P2 user_define=0 isvisible=1 istab=1 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(14563790) 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) .TEST_UNIQUE(ALL, 2) .GET_PROPS(ALL,1) .UPDATE_ITEMS .UPDATE(ALL,2) .RELGEN .UPDATE_STATE .ACTION_HISTORY commit tran $ENDTEXT(14563790) $ENDACTION $ACTION(ACTION_EXP2WORD) name=Экспорт в Word class=2 form=FORM_EXP2WORD target_state=null procedure=npf2word patterns=null user_define=0 isvisible=0 istab=0 posx=0 posy=0 width=1966 height=460 proc_text=null $ENDACTION $ACTION(REP_NPF_RECALC) name=Пересчет отчета class=9 form=null target_state=CRT procedure=ap_sdrep_npf_recalc patterns=GENERIC_MOVE user_define=1 isvisible=0 istab=0 posx=0 posy=0 width=0 height=0 proc_text=$TEXT(14563791) 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 .ID_VAR(@t_id) .ID_VAR(@t_line_id) .ID_VAR(@t_nclass_id) .ID_VAR(@t_nclass_value_id) .ID_VAR(@t_calc_type_id) if not exists(select 1 from ts_npf_reps_tuning where rep_type_id=@type_id) .EXIT_MESSAGE('Нет настроек для отчета') delete t_items from ts_invest_npf_report where ts_invest_npf_report.id=t_items.id and ts_invest_npf_report.report_id=@id delete ts_invest_npf_report where ts_invest_npf_report.report_id=@id .TRANSACTION_SAVE declare @tuning_id numeric, @calk_type_id numeric, @rep_sum money, @rep_qty money, @rep_percent money, @t_line_code varchar(50), @rep_line_code varchar(50), @rep_line_name varchar(255), @lim_code_eff varchar(50) create table #rep( tuning_id numeric null, rep_sum money null, rep_qty money null, rep_percent money null, item_id numeric null) create table #report_res( tuning_id numeric null, rep_sum money null, rep_qty money null, rep_percent money null) create table #obj(id numeric) declare lines cursor for select t.id,t.line_id,t.nclass_id,t.nclass_value_id,t.calc_type_id,t.line_code from ts_npf_reps_tuning t where t.rep_type_id=@type_id and t.form_type=1 and .ITEMS_EXISTS_BY_TYPE(t.id,'REPORT_NPF_TUNING') for read only open lines fetch lines into @t_id,@t_line_id,@t_nclass_id,@t_nclass_value_id,@t_calc_type_id,@t_line_code while (.CURSOR_STATE=0) begin if @t_line_id is not null begin select @lim_code_eff=lim_code_eff, @calk_type_id=calk_type_id from ts_restrict_types where id=@t_line_id if @t_nclass_value_id is not null begin if @t_nclass_id is not null begin .GET_NCLASS_ITEMS(#obj,@t_nclass_id,@t_nclass_value_id,@owner_id,@date_b) end end if @t_calc_type_id=2 -- по объектам begin -- один банк insert into #rep(tuning_id,rep_sum,rep_qty,rep_percent,item_id) select @t_id, sum(isnull(sr.asset_bal_sum,0)),1, sum(isnull(sr.fact_percent,0)), -- b.partner_id a.bank_id from ts_asset_structure_report sr, t_bank_accounts a --, t_banks b where sr.srez_id=@foundation_id and ((sr.line_code_eff like @lim_code_eff+'%' and sr.line_id!=@t_line_id and @calk_type_id=3) -- сумма вложенных без разбивки or (sr.line_id=@t_line_id and @calk_type_id!=3)) and ((sr.asset_id in (select id from #obj) and @t_nclass_value_id is not null) or @t_nclass_value_id is null) and a.id=sr.asset_id and ((@t_line_code='331' and a.bank_acc_cur_id<>.CUR('RUR') and a.bank_acc_cur_id is not null) or @t_line_code<>'331') -- and a.bank_id=b.id -- group by b.partner_id group by a.bank_id -- один эмитент (не гос.бумаги) insert into #rep(tuning_id,rep_sum,rep_qty,rep_percent,item_id) select @t_id, sum(isnull(sr.asset_bal_sum,0)),1, sum(isnull(sr.fact_percent,0)), e.partner_id from ts_asset_structure_report sr, td_emitent_info e, td_stock_emis s where sr.srez_id=@foundation_id and ((sr.line_code_eff like @lim_code_eff+'%' and sr.line_id!=@t_line_id and @calk_type_id=3) -- сумма вложенных без разбивки or (sr.line_id=@t_line_id and @calk_type_id!=3)) and ((sr.asset_id in (select id from #obj) and @t_nclass_value_id is not null) or @t_nclass_value_id is null) and s.id=sr.asset_id and ((@t_line_code='351' and s.stock_curr_id<>.CUR('RUR') and s.stock_curr_id is not null) or @t_line_code<>'351') and s.emmitent_id=e.id and (select cv.value_code from t_nclass_types ct, t_nclass_values cv, t_nclass_value2item cvi where upper(ct.class_code)='STOCK_EMITENT_TYPE' and cvi.item_id=sr.asset_id and cvi.class_type_id=ct.id and cvi.class_value_id=cv.id and cvi.set_date is null and cvi.partner_id is null) not in ('STOCK_GOS_PARTNER','STOCK_SUB_FED') group by e.partner_id -- один актив (гос.бумаги) insert into #rep(tuning_id,rep_sum,rep_qty,rep_percent,item_id) select @t_id, sum(isnull(sr.asset_bal_sum,0)),1, sum(isnull(sr.fact_percent,0)), sr.asset_id from ts_asset_structure_report sr where sr.srez_id=@foundation_id and ((sr.line_code_eff like @lim_code_eff+'%' and sr.line_id!=@t_line_id and @calk_type_id=3) -- сумма вложенных без разбивки or (sr.line_id=@t_line_id and @calk_type_id!=3)) and ((sr.asset_id in (select id from #obj) and @t_nclass_value_id is not null) or @t_nclass_value_id is null) and ((@t_line_code in ('312','321') and exists(select 1 from td_stock_emis where td_stock_emis.id=sr.asset_id and td_stock_emis.stock_curr_id<>.CUR('RUR') and td_stock_emis.stock_curr_id is not null)) or @t_line_code not in ('312','321')) group by sr.asset_id having sr.asset_id is not null and .ITEMS_EXISTS_BY_TYPE(sr.asset_id,'td_stock_emis') and (select cv.value_code from t_nclass_types ct, t_nclass_values cv, t_nclass_value2item cvi where upper(ct.class_code)='STOCK_EMITENT_TYPE' and cvi.item_id=sr.asset_id and cvi.class_type_id=ct.id and cvi.class_value_id=cv.id and cvi.set_date is null and cvi.partner_id is null) in ('STOCK_GOS_PARTNER','STOCK_SUB_FED') -- один прочий актив insert into #rep(tuning_id,rep_sum,rep_qty,rep_percent,item_id) select @t_id, sum(isnull(sr.asset_bal_sum,0)), (case when .ITEM_TYPE_CODE(sr.asset_id) in ('NCLASS_MANUALLY') then 0 else 1 end), sum(isnull(sr.fact_percent,0)), sr.asset_id from ts_asset_structure_report sr where sr.srez_id=@foundation_id and ((sr.line_code_eff like @lim_code_eff+'%' and sr.line_id!=@t_line_id and @calk_type_id=3) -- сумма вложенных без разбивки or (sr.line_id=@t_line_id and @calk_type_id!=3)) and ((sr.asset_id in (select id from #obj) and @t_nclass_value_id is not null) or @t_nclass_value_id is null) group by sr.asset_id having sr.asset_id is not null and not .ITEMS_EXISTS_BY_TYPE(sr.asset_id,'td_stock_emis') and not .ITEMS_EXISTS_BY_TYPE(sr.asset_id,'bank_accounts') and .ITEMS_EXISTS(sr.asset_id) end if @t_calc_type_id=1 -- без группировки по объектам insert into #rep(tuning_id,rep_sum, rep_percent) select @t_id, sum(isnull(sr.asset_bal_sum,0)), sum(isnull(sr.fact_percent,0)) from ts_asset_structure_report sr where sr.srez_id=@foundation_id and sr.line_id=@t_line_id and ((sr.asset_id in (select id from #obj) and @t_nclass_value_id is not null) or @t_nclass_value_id is null) end truncate table #obj fetch lines into @t_id,@t_line_id,@t_nclass_id,@t_nclass_value_id,@t_calc_type_id,@t_line_code end close lines .DEALLOCATE lines -- Новация - п.311 ---------------------------------------------------------------------------------------- .ID_VAR(@stock_id) .ID_VAR(@line_id) .ID_VAR(@fund_plan_id) .ID_VAR(@stock_account_id) .ID_VAR(@coupon_account_id) select @fund_plan_id = .ARG_PLAN('NPF_ACCOUNT') select @stock_account_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'58.1') select @coupon_account_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'76.6') create table #nov_docs ( doc_id numeric not null, stock_id numeric not null, doc_sum money null, doc_qty money null) .TOTALS_QUERY_SUB(@owner_id,@fund_plan_id,@date_b,@date_b,@stock_account_id,'stock_emis',N,'doc_item',N,N,N,L,N,Y,N,Y) .TOTALS_QUERY_SUB(@owner_id,@fund_plan_id,@date_b,@date_b,@coupon_account_id,'stock_emis',N,'doc_item',N,N,N,L,N,Y,N,Y,#tmp_coupon) insert into #nov_docs(doc_id,stock_id) select d.id, s.stock_id from td_depo_docs d, ts_sd_stock_moves s, td_foundation_docs f where d.id=f.depo_doc_id and f.id=s.id and f.function_id=1 and .ITEMS_EXISTS_BY_TYPE(d.id,'D_STOCK_IN') and .ITEMS_EXISTS_BY_TYPE(f.id,'FOUNDATION_DOCS_SD') and .PURPOSE_CODE(s.perpose_id) in (6017,6019) and s.stock_id in (select #rep.item_id from #rep, ts_npf_reps_tuning where #rep.item_id is not null and #rep.tuning_id=ts_npf_reps_tuning.id and ts_npf_reps_tuning.line_code='311') and s.owner_id=@owner_id insert into #nov_docs(doc_id,stock_id) select d.id, s.stock_id from td_depo_docs d, ts_sd_stock_moves s where d.id=s.id and .ITEMS_EXISTS_BY_TYPE(d.id,'D_STOCK_IN_OTHER_DEPO_SD') and .PURPOSE_CODE(s.perpose_id) in (6017,6019) and s.stock_id in (select #rep.item_id from #rep, ts_npf_reps_tuning where #rep.item_id is not null and #rep.tuning_id=ts_npf_reps_tuning.id and ts_npf_reps_tuning.line_code='311') and d.owner_id=@owner_id insert into #nov_docs(doc_id,stock_id) select d.id, s.stock_new_id from td_depo_docs d, ts_sd_stock_moves s where d.id=s.id and .ITEMS_EXISTS_BY_TYPE(d.id,'STOCK_REDEMPTION') and .PURPOSE_CODE(d.perpose_id)=6018 and s.stock_new_id in (select #rep.item_id from #rep, ts_npf_reps_tuning where #rep.item_id is not null and #rep.tuning_id=ts_npf_reps_tuning.id and ts_npf_reps_tuning.line_code='311') and d.owner_id=@owner_id update #nov_docs set doc_sum=#tmp_oss.saldo_de, doc_qty=#tmp_oss.q_saldo_de from #tmp_oss where #tmp_oss.subc2_id = #nov_docs.doc_id and #tmp_oss.q_saldo_de>0 update #nov_docs set doc_sum=doc_sum + isnull(#tmp_coupon.saldo_de,0) from #tmp_coupon where #tmp_coupon.subc2_id = #nov_docs.doc_id and #tmp_coupon.q_saldo_de>0 and #nov_docs.doc_qty is not null delete #nov_docs where doc_qty is null delete #rep from ts_npf_reps_tuning where #rep.tuning_id=ts_npf_reps_tuning.id and ts_npf_reps_tuning.line_code='311' and #rep.item_id not in (select stock_id from #nov_docs) update #rep set rep_percent=#rep.rep_percent*(select sum(#nov_docs.doc_sum) from #nov_docs where #nov_docs.stock_id=#rep.item_id)/#rep.rep_sum from ts_npf_reps_tuning where #rep.tuning_id=ts_npf_reps_tuning.id and ts_npf_reps_tuning.line_code='311' update #rep set rep_percent=round(#rep.rep_percent,2), rep_sum=(select sum(#nov_docs.doc_sum) from #nov_docs where #nov_docs.stock_id=#rep.item_id) from ts_npf_reps_tuning where #rep.tuning_id=ts_npf_reps_tuning.id and ts_npf_reps_tuning.line_code='311' .DROP_QUERY_TABLES(#tmp_oss) .DROP_QUERY_TABLES(#tmp_coupon) drop table #nov_docs -------------------------------------------------------------------------------------------------------- /* select trep.line_code, #rep.tuning_id, convert(decimal(18,4),#rep.rep_sum), convert(decimal(18,4),#rep.rep_qty), convert(decimal(18,4), #rep.rep_percent), #rep.item_id, (select item_name from t_items where id=#rep.item_id), (select type_id from t_items where id=#rep.item_id), trep.line_name, trep.line_id, trep.nclass_id, trep.nclass_value_id, trep.rep_type_id from #rep, ts_npf_reps_tuning trep where #rep.tuning_id=trep.id order by trep.id, trep.line_code */ insert into #report_res(tuning_id,rep_sum,rep_qty,rep_percent) select tuning_id,sum(isnull(rep_sum,0)),sum(rep_qty),sum(isnull(rep_percent,0)) from #rep group by tuning_id insert into #report_res(tuning_id,rep_sum,rep_qty,rep_percent) select t.id,0,0,0 from ts_npf_reps_tuning t where t.rep_type_id=@type_id and t.form_type=1 and t.id not in (select tuning_id from #rep) and .ITEMS_EXISTS_BY_TYPE(t.id,'REPORT_NPF_TUNING') insert into #report_res(tuning_id,rep_sum,rep_qty,rep_percent) select t.id,null,null,null from ts_npf_reps_tuning t where t.rep_type_id=@type_id and t.form_type=2 and t.id not in (select tuning_id from #rep) and .ITEMS_EXISTS_BY_TYPE(t.id,'REPORT_NPF_TUNING') declare @npf_acc_ctrl varchar(255), @tuning111_id numeric select @npf_acc_ctrl=isnull(max(v.code),'YES') from t_item2class i, t_classvalues v, t_classes c where i.item_id=@owner_id and i.value_id=v.id and v.class_id=c.id and c.code='NPF_ACC_CTRL' and .ITEMS_EXISTS(i.id) select @tuning111_id=max(t.id) from ts_npf_reps_tuning t where t.line_code='111' and t.rep_type_id=@type_id and .ITEMS_EXISTS_BY_TYPE(t.id,'REPORT_NPF_TUNING') declare curres cursor for select tuning_id,rep_sum,rep_qty,rep_percent from #report_res for read only open curres fetch curres into @tuning_id,@rep_sum,@rep_qty,@rep_percent while(.CURSOR_STATE=0) begin select @rep_line_code=line_code, @rep_line_name=line_name, @t_line_id=line_id from ts_npf_reps_tuning where id=@tuning_id if @rep_line_code='110' or @rep_line_code='111' select @rep_percent=null if @rep_line_code not like '1%' select @rep_sum=null if @rep_line_code='112' and @npf_acc_ctrl='RPR' select @rep_sum=@rep_sum+isnull(r.rep_sum,0), @rep_percent=@rep_percent+isnull(r.rep_percent,0) from #report_res r where r.tuning_id=@tuning111_id .TYPE_INIT('report_for_npf_det') .TYPE_ASSIGN(line_code,@rep_line_code) .TYPE_ASSIGN(line_name,@rep_line_name) .TYPE_ASSIGN(rep_percent,@rep_percent) .TYPE_ASSIGN(rep_sum,@rep_sum) .TYPE_ASSIGN(rep_qty,@rep_qty) .TYPE_ASSIGN(report_id,@id) .TYPE_ASSIGN(line_id,@t_line_id) .TYPE_INSERT('report_for_npf_det','CRT') fetch curres into @tuning_id,@rep_sum,@rep_qty,@rep_percent end close curres .DEALLOCATE curres -- валютные р.счета (п.113) -- declare @acc51_id numeric, @cur_acc_sum money select @acc51_id = .SD_ACCID_FROM_EFFNO(@fund_plan_id,'51') select @cur_acc_sum=(select sum(p.bal_sum) from tp_pif_srez_portfolio p, t_bank_accounts a where p.srez_id=@foundation_id and a.id=p.stock_id and a.bank_acc_cur_id<>.CUR('RUR') and a.bank_acc_cur_id is not null and p.acc_id=@acc51_id) -- and isnull(a.acc_type_id,1)<>3) update ts_invest_npf_report set rep_sum = rep_sum - isnull(@cur_acc_sum,0) where report_id=@id and line_code='111' update ts_invest_npf_report set rep_sum = @cur_acc_sum where report_id=@id and line_code='113' -------------------------------- drop table #rep drop table #report_res drop table #obj .TRANSACTION_RESTORE .UPDATE_STATE .ACTION_HISTORY commit tran $ENDTEXT(14563791) $ENDACTION $STATE2ACTION(CRT.ACTION1) state=CRT action=ACTION1 $ENDSTATE2ACTION $STATE2ACTION(CRT.ACTION2) state=CRT action=ACTION2 $ENDSTATE2ACTION $STATE2ACTION(CRT.ACTION_EXP2WORD) state=CRT action=ACTION_EXP2WORD $ENDSTATE2ACTION $STATE2ACTION(CRT.D_REP_NPF_DET) state=CRT action=D_REP_NPF_DET $ENDSTATE2ACTION $STATE2ACTION(CRT.D_REP_NPF_HEADER) state=CRT action=D_REP_NPF_HEADER $ENDSTATE2ACTION $STATE2ACTION(CRT.FORM1) state=CRT action=FORM1 $ENDSTATE2ACTION $STATE2ACTION(CRT.FORM2) state=CRT action=FORM2 $ENDSTATE2ACTION $STATE2ACTION(CRT.FORM_EXP2WORD) state=CRT action=FORM_EXP2WORD $ENDSTATE2ACTION $STATE2ACTION(CRT.REP_NPF_RECALC) state=CRT action=REP_NPF_RECALC $ENDSTATE2ACTION $STATE2PROP(CRT.DATE_E) state=CRT prop=DATE_E enable=1 mandatory=0 visible=1 $ENDSTATE2PROP $ENDDOC