<?xml version="1.0" encoding="UTF-8"?>

<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:view>
        <script type="text/javascript"><![CDATA[
        function arch_agreement_query() {
            $('arch_agreement_grid_ds').query();
        }

        function arch_agreement_reset(){
            $('arch_agreement_form_ds').reset();
        }

        function arch_agreement_add() {
            $('arch_agreement_grid_ds').create();
        }

        function arch_agreement_remove() {
            var records = $('arch_agreement_grid_ds').getSelected();
            if (!records.length) {
                Leaf.showMessage('${l:PROMPT}', '请至少选择一条记录');
                return;
            }
            else {
                $('source_to_grid').remove();
            }
        }

        function arch_agreement_submit() {
            $('arch_agreement_grid_ds').submit();
        }

        function  hls2030_editor_fuc(record,name){
            if(name == 'bp_name'){
                if(record.isNew){
                    return 'arch_agreement_contract_lov';
                }
            }
        }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="sngl_unt_cd_ds" lookupCode="HLS_SNGL_UNT_CD"/>
            <a:dataSet id="sngl_prc_cd_ds" lookupCode="HLS_SNGL_PRC_CD"/>
            <a:dataSet id="trm_calc_way_ds" lookupCode="HLS_TRM_CALC_WAY"/>
            <a:dataSet id="arch_agreement_form_ds">
            </a:dataSet>
            <a:dataSet id="arch_agreement_grid_ds"
                       model="hls.HLS2030.hls_lease_arch_agreement"
                       queryDataSet="arch_agreement_form_ds" selectable="true" autoQuery="true" >
                <a:fields>
                    <a:field name="bp_name" lovGridHeight="400" lovHeight="500" lovLabelWidth="100" lovService="hls.HLS2030.hls_lease_bp_master_lov" lovWidth="500"  title="客户名称" required="true">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id" />
                            <a:map from="bp_name" to="bp_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id" />
                    <a:field name="sngl_unt_cd_n" displayField="code_value_name" options="sngl_unt_cd_ds" returnField="sngl_unt_cd" valueField="code_value"/>
                    <a:field name="sngl_unt_cd"/>
                    <a:field name="sngl_prc_cd_n" displayField="code_value_name" options="sngl_prc_cd_ds" returnField="sngl_prc_cd" valueField="code_value"/>
                    <a:field name="sngl_prc_cd"/>
                    <a:field name="trm_calc_way_n" displayField="code_value_name" options="trm_calc_way_ds" returnField="trm_calc_way" valueField="code_value"/>
                    <a:field name="trm_calc_way"/>
                </a:fields>
                <a:events>
                    <a:event name="submitSuccess" handler="arch_agreement_query"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="arch_agreement_query" text="查询"/>
                <a:gridButton click="arch_agreement_reset" text="重置"/>
                <a:gridButton click="arch_agreement_add" text="新增"/>
                <a:gridButton click="arch_agreement_remove" text="删除"/>
                <a:gridButton click="arch_agreement_submit" text="保存"/>
            </a:screenTopToolbar>
            <a:form column="4" marginWidth="100" title="查询条件">
                <a:textField name="bp_name" bindTarget="arch_agreement_form_ds" prompt="客户名称"/>
                <a:textField name="seq" bindTarget="arch_agreement_form_ds" prompt="合作次数"/>
            </a:form>
            <a:grid id="source_to_grid" bindTarget="arch_agreement_grid_ds" navBar="true" height="400" marginWidth="100">
                <a:columns>
                    <a:column name="bp_name" align="center" prompt="客户名称" width="150" editor="arch_agreement_contract_textField"  editorFunction="hls2030_editor_fuc"/>
                    <a:column name="seq" align="center" prompt="合作次数" width="130"/>
                    <a:column name="strt_ymd" align="center" prompt="合同日期" width="130" renderer="Leaf.formatDate" editor="arch_agreement_contract_datePicker"/>
                    <a:column name="expr_ymd" align="center" prompt="期满日期" width="130" renderer="Leaf.formatDate" editor="arch_agreement_contract_datePicker"/>
                    <a:column name="lmt_amt" align="center" prompt="额度" width="130" renderer="Leaf.formatMoney" editor="arch_agreement_contract_numberField"/>
                    <a:column name="lmt_jamt" align="center" prompt="残值" width="130" renderer="Leaf.formatMoney" editor="arch_agreement_contract_numberField"/>
                    <a:column name="obtn_cst_ratio" align="center" width="130" prompt="金融公司授信比率" editor="arch_agreement_contract_numberField"/>
                    <a:column name="assu_ratio" align="center" width="130" prompt="金融公司保证金比率" editor="arch_agreement_contract_numberField"/>
                    <a:column name="imp_fee_ratio" align="center" width="130" prompt="金融公司手续费比率" editor="arch_agreement_contract_numberField"/>
                    <a:column name="stm_ratio" align="center" prompt="印花税比率" editor="arch_agreement_contract_numberField"/>
                    <a:column name="uarv_rtn_ratio" align="center" prompt="残值比率" editor="arch_agreement_contract_numberField"/>
                    <a:column name="mrepay_fee_ratio" align="center" width="130" prompt="中途偿还违约金比率" editor="arch_agreement_contract_numberField"/>
                    <a:column name="sngl_unt_cd_n" align="center" width="130" prompt="尾数处理单位" editor="arch_agreement_contract_comboBox"/>
                    <a:column name="sngl_prc_cd_n" align="center" prompt="尾数处理方法" editor="arch_agreement_contract_comboBox"/>
                    <a:column name="trm_calc_way_n" align="center" prompt="日期计算方法" editor="arch_agreement_contract_comboBox"/>
                </a:columns>
                <a:editors>
                    <a:lov id="arch_agreement_contract_lov" />
                    <a:textField id="arch_agreement_contract_textField" />
                    <a:numberField id="arch_agreement_contract_numberField" />
                    <a:datePicker id="arch_agreement_contract_datePicker" />
                    <a:comboBox id="arch_agreement_contract_comboBox" />
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>