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

<!--
    $Author: chenlingfeng7543
$Date: 2018/10/16 18:21
$Revision: 1.0 
$Purpose: 简式合同
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure/>
    <a:view>
<a:link id="con1050_ds_con_simple_org_contract_link" model="cont.CON1050.ds_con_simple_org_contract" modelaction="execute"/>
        <a:link id="con1050_ds_con_simple_np_contract_link" model="cont.CON1050.ds_con_simple_np_contract" modelaction="execute"/>
        <script type="text/javascript"><![CDATA[

        function con1050_calcConfigScreen_getTabType() {
            var config = {
                0: 'H',
                1: 'L'
            };
            return config[$('con1050_tabpanel_id').selectedIndex];

        }

        function con1050_lock_current_window() {
            Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
        }

        function con1050_unlock_current_window() {
            Leaf.Masker.unmask(Ext.getBody());
        }

        function con1050_calcConfigScreen_getDs() {
            var config = {
                'H': 'con1050_con_simple_np_contract_ds',
                'L': 'con1050_con_simple_org_contract_ds'
            };
            return config[con1050_calcConfigScreen_getTabType()];
        }

        function con1050_query() {
            var dsName = con1050_calcConfigScreen_getDs();
            $(dsName).query();
        }

        function con1050_reset() {
            $('con1050_con_simple_contract_query_ds').reset();
        }
        
        function create_simple_contract(){
            var dsName = con1050_calcConfigScreen_getDs();
            var ds = $(dsName);
            var  records = ds.getSelected();
            if (records.length != 1) {
                Leaf.showMessage('${l:PROMPT}', '${l:HLS.SELECT_RECORD}');
                return;
            }
            var record = records[0];
            if(record){
                con1050_lock_current_window();
                var url
                if(dsName=='con1050_con_simple_np_contract_ds') {
                     url = $('con1050_ds_con_simple_np_contract_link').getUrl();
                }else if(dsName=='con1050_con_simple_org_contract_ds'){
                     url = $('con1050_ds_con_simple_org_contract_link').getUrl();
                }
                Leaf.request({
                    url: url,
                    para: {
                        dealer_cd:record.get('dealer_cd'),
                        chance_no:record.get('chance_no'),
                        machine_type:record.get('machine_type')
                    },
                    success: function (res) {
                       ds.query(ds.currentPage);
                       con1050_unlock_current_window();
                    },
                    error: function () {
                       con1050_unlock_current_window();
                    },
                    failure: function () {
                       con1050_unlock_current_window();
                    },
                    scope: this
                });
            }
        }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="con1050_con_simple_contract_query_ds">

            </a:dataSet>
            <a:dataSet selectable="true" selectionModel="single" id="con1050_con_simple_np_contract_ds" autoPageSize="true" queryDataSet="con1050_con_simple_contract_query_ds" model="cont.CON1050.ds_con_simple_np_contract">

            </a:dataSet>
            <a:dataSet selectable="true" selectionModel="single" id="con1050_con_simple_org_contract_ds" autoPageSize="true" queryDataSet="con1050_con_simple_contract_query_ds" model="cont.CON1050.ds_con_simple_org_contract">

            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="con1050_query" text="HLS.QUERY"/>
                <a:gridButton click="con1050_reset" text="HLS.RESET"/>

                <a:gridButton click="create_simple_contract" text="创建简式合同"/>
            </a:screenTopToolbar>
            <a:form column="2" marginWidth="30">
                <a:numberField allowDecimals="false" bindTarget="con1050_con_simple_contract_query_ds" name="dealer_cd" prompt="app经销商编号"/>
                <a:numberField   allowDecimals="false"  bindTarget="con1050_con_simple_contract_query_ds" name="chance_no" prompt="app商机编号"/>
            </a:form>
            <a:tabPanel id="con1050_tabpanel_id" marginWidth="30" marginHeight="150">
                <a:tabs>
                    <a:tab id="con1050_np_tab_id" width="150" prompt="个人">
                        <a:grid bindTarget="con1050_con_simple_np_contract_ds" marginWidth="60" navBar="true" marginHeight="200">
                            <a:columns>
                                <a:column name="dealer_cd" prompt="代理商编号"/>
                                <a:column name="chance_no" prompt="商机号"/>
                                <a:column name="brc_card_name" prompt="本人姓名"/>
                                <a:column name="brc_card_code" prompt="本人身份证"/>
                                <a:column name="brc_card_address" prompt="本人身份证地址"/>
                                <a:column name="brc_hand_phone" prompt="本人电话"/>
                                <a:column name="poc_card_name" prompt="配偶姓名"/>
                                <a:column name="poc_card_code" prompt="配偶身份证"/>
                                <a:column name="poc_card_address" prompt="配偶身份证地址"/>
                                <a:column name="poc_hand_phone" prompt="配偶电话"/>
                                <a:column name="dbr1c_card_name" prompt="担保人1姓名"/>
                                <a:column name="dbr1c_card_code" prompt="担保人1身份证"/>
                                <a:column name="dbr1c_card_address" prompt="担保人1身份证地址"/>
                                <a:column name="dbr1c_cssi_tel" prompt="担保人1电话"/>
                                <a:column name="dbr2c_card_name" prompt="担保人2姓名"/>
                                <a:column name="dbr2c_card_code" prompt="担保人2身份证"/>
                                <a:column name="dbr2c_card_address" prompt="担保人2身份证地址"/>
                                <a:column name="dbr2c_cssi_tel" prompt="担保人2电话"/>
                                <a:column name="model_name" prompt="机型"/>
                                <a:column name="f6020_r" prompt="首付款金额"/>
                                <a:column name="f2060_r" prompt="期次"/>
                                <!--<a:column name="f4010_r" prompt="客户保证金金额"/>-->
                                <!--<a:column name="f4040_r" prompt="客户手续费金额"/>-->
                                <!--<a:column name="f5120_r" prompt="租赁物总价款"/>-->
                                <!--<a:column name="dcfl_code" prompt="融资商品code"/>-->
                                <a:column name="f6020_l" prompt="首付比例"/>
                                <a:column name="f3010_r" prompt="合同价格"/>
                                <!--<a:column name="dcfl_cycle_code" prompt="付款周期code"/>-->
                               <a:column name="machine_type_n" prompt="设备类型"/>  <!--, 01：挖掘机，02：装载机，10：OEM-->
                            </a:columns>
                        </a:grid>
                    </a:tab>
                    <a:tab id="con1050_org_tab_id" width="150" prompt="法人">
                        <a:grid bindTarget="con1050_con_simple_org_contract_ds" marginWidth="30" navBar="true" marginHeight="200">
                            <a:columns>
                                <a:column name="dealer_cd" prompt="供应商"/>
                                <a:column name="chance_no" prompt="商机号"/>
                                <a:column name="cust_name" prompt="法人客户"/>
                                <a:column name="company_name" prompt="信审app营业执照公司名称"/>
                                <a:column name="company_address" prompt="信审app营业执照公司驻址"/>
                                <a:column name="company_legal" prompt="信审app营业执照法人代表"/>
                                <a:column name="har_address" prompt="公司地址"/>
                                <a:column name="hand_phone" prompt="法人电话"/>
                                <a:column name="brc_card_name" prompt="法人代表身份证姓名"/>
                                <a:column name="brc_card_code" prompt="法人代表身份证"/>
                                <a:column name="brc_card_address" prompt="法人身份证地址"/>
                                <a:column name="gdc_cssi_tel" prompt="法人代表电话"/>
                                <a:column name="gdc_card_name" prompt="最大股东身份证姓名"/>
                                <a:column name="gdc_card_code" prompt="最大股东身份证号"/>
                                <a:column name="gdc_card_address" prompt="最大股东身份证地址"/>
                                <a:column name="gdpoc_cssi_tel" prompt="最大股东电话"/>
                                <a:column name="model_name" prompt="机型"/>
                                <a:column name="f6020_r" prompt="首付款金额"/>
                                <a:column name="f6020_l" prompt="首付比率"/>
                                <a:column name="f2060_r" prompt="期次"/>
                                <!--<a:column name="f4010_r" prompt="客户保证金金额"/>-->
                                <!--<a:column name="f4040_r" prompt="客户手续费金额"/>-->
                                <!--<a:column name="f5120_r" prompt="租赁物总价款"/>-->
                                <!--<a:column name="dcfl_code" prompt="融资商品code"/>-->
                                <a:column name="f6020_l" prompt="首付比例"/>
                                <a:column name="f3010_r" prompt="合同价格"/>
                                <!--<a:column name="dcfl_cycle_code" prompt="付款周期code"/>-->
                                <a:column name="machine_type_n" prompt="设备类型"/>
                                <a:column name="unique_code" prompt="企业统一信用代码"/>
                            </a:columns>
                        </a:grid>
                    </a:tab>
                </a:tabs>
            </a:tabPanel>
        </a:screenBody>
    </a:view>
</a:screen>