<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true"
          trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="prj.PRJ500D.user_agent_description" rootPath="user_agent_description"/>
    </a:init-procedure>
    <a:view>

        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
                modelaction="update"/>
        <a:link id="business_write_detail_link" model="cont.CON3100N.business_write_detail_report"
                modelaction="execute"/>
        <script src="${/request/@context_path}/javascripts/hap/dynamicStopAutoQuery.js" type="text/javascript"/>
        <script type="text/javascript"><![CDATA[


        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
           if(name=='transaction_date_from' &&value){
               if(!record.get('transaction_date_to')){
                   record.set('transaction_date_to',value)
               }
           }else if(name=='journal_date_from' && value){
               if(!record.get('journal_date_to')){
                   record.set('journal_date_to',value)

               }
           }
        };

        /*window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_cashflow');
             var form_ds_id = '${/parameter/@layout_code}_F_QUERY__ds';

            Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
            Leaf.request({
                url: $('business_write_detail_link').getUrl(),
                para: {},
                success: function() {
                    $(ds_id).setQueryUrl('${/request/@context_path}/autocrud/cont.CON3100N.business_write_detail_report/query');
                    $(ds_id).setQueryDataSet($(form_ds_id));
                    Leaf.Masker.unmask(Ext.getBody());
                    $(ds_id).query();
                },
                failure: function() {
                    Leaf.Masker.unmask(detail_mask);
                },
                error: function() {
                    Leaf.Masker.unmask(detail_mask);
                },
                scope: this
            });
        }*/


        window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_cashflow');
            var form_ds_id = '${/parameter/@layout_code}_F_QUERY__ds';
			var record = $(ds_id).getCurrentRecord();
            $(ds_id).setQueryUrl('${/request/@context_path}/autocrud/cont.CON3100N.csh_write_detail_report/query');
            $(ds_id).setQueryDataSet($(form_ds_id));
            Leaf.Masker.unmask(Ext.getBody());
            $(ds_id).query();
        };
		//页面加载事件
        Leaf.onReady(function() {
            var bp_code='${/model/user_agent_description/record/@bp_code}';

            // if (!Ext.isEmpty(bp_code)&&bp_code!== 'C00010168') {
            //     $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').hideColumn('branch_code_n');
            //     $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').hideColumn('branch_code');
            // }
            // if (!Ext.isEmpty(bp_code)) {
            //     if (bp_code == 'C00010168' || bp_code == 'C00010198' || bp_code == 'C00010170') {
            //         $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').showColumn('large_balance_n');
            //         $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').showColumn('large_balance');
            //     }else {
            //         $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').hideColumn('large_balance_n');
            //         $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').hideColumn('large_balance');
            //     }
            // }

            if (!Ext.isEmpty(bp_code)&&bp_code!== 'D00010001'&&bp_code!=='D00000009') {
                $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').hideColumn('branch_code_n');
                $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').hideColumn('branch_code');
            }
            if (!Ext.isEmpty(bp_code)) {
                if (bp_code == 'D00000041' || bp_code == 'D00010001' || bp_code == 'D00000026') {
                    $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').showColumn('large_balance_n');
                    $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').showColumn('large_balance');

                    document.getElementById('CSH_WRITE_OFF_QUERY_F_QUERY_NULL_LARGE_BALANCE_prompt').style.display = 'block';
                    document.getElementById('CSH_WRITE_OFF_QUERY_F_QUERY_NULL_LARGE_BALANCE').style.display = 'block';
                }else {
                    $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').hideColumn('large_balance_n');
                    $('CSH_WRITE_OFF_QUERY_F_WRITE_OFF_LIST_con_contract_cashflow_layout_grid_id').hideColumn('large_balance');

                    document.getElementById('CSH_WRITE_OFF_QUERY_F_QUERY_NULL_LARGE_BALANCE_prompt').style.display = 'none';
                    document.getElementById('CSH_WRITE_OFF_QUERY_F_QUERY_NULL_LARGE_BALANCE').style.display = 'none';
                }
            }
        });

       // stopDymanicAutoQuery('${/parameter/@layout_code}', 'F_WRITE_OFF_LIST', 'con_contract_cashflow');

        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>
