<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="basic.get_sys_default_time" rootPath="sys_default_time"/>
        <a:model-query fetchAll="true" model="csh.CSH531N.csh_transaction" rootPath="csh_transaction_path"/>
        <a:model-query defaultWhereClause="v.code=&apos;DS_CSH_WRITE_OFF_CLASSIFICATION&apos; and v.ref_v03=&apos;PRE&apos;" fetchAll="true" model="basic.sys_code_default_value" rootPath="sys_code_default_value_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="csh532n_csh_assigns_confirm_link" model="csh.CSH532N.csh_assigns_confirm" modelaction="update"/>
        <a:link id="transaction_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <script type="text/javascript"><![CDATA[
        function csh532d_lock_current_window(){
            Leaf.Masker.mask($('${/parameter/@winid}').wrap, '${l:HLS.EXECUTING}');
        }

        function csh532d_unlock_current_window(){
            Leaf.Masker.unmask($('${/parameter/@winid}').wrap);
        }
        function init() {
            var batch_status = '${/parameter/@batch_status}';
            if (batch_status == 'SUBMIT') {
                $('csh_grid_add_bt').setVisible(false);
                $('csh_grid_delete_bt').setVisible(false);
                $('csh_grid_save_bt').setVisible(false);
                $('csh_write_off_grid').hideColumn('left_amount');
                $('csh_write_off_grid').hideColumn('left_principal');
                $('csh_write_off_grid').hideColumn('left_interest');
            } else {
                $('csh_grid_add_bt').setVisible(true);
                $('csh_grid_delete_bt').setVisible(true);
                $('csh_grid_save_bt').setVisible(true);
            }
        }

        // function csh_write_off_add(){
        //     var record = $('csh_write_off_assigns_ds').create();
        //     record.set('csh_bank_slip_num','${/parameter/@csh_bank_slip_num}');
        //     $('csh_write_off_grid').showEditorByRecord(record);
        // }

        function csh_edit_function(record, name) {
            var batch_status = '${/parameter/@batch_status}';
            var write_off_type = record.get('write_off_type');
            if (batch_status == 'SUBMIT') {
                return;
            } else {
                if (name == 'contract_number') {
                    if (write_off_type != 'DEPOSIT_POOL_CREDIT') {
                        return 'csh_write_off_grid_lv';
                    }

                }
                if (name == 'write_off_type_desc') {
                    return 'csh_write_off_grid_cb';
                }
                // if (name == 'write_off_bp_name') {
                //     return 'csh_write_off_grid_lv';
                // }
                if (name == 'write_off_times') {
                    if (write_off_type == 'RECEIPT_CREDIT') {
                        return 'csh_write_off_grid_lv';
                    }
                }
                if (name == 'write_off_amount' || name == 'write_off_principal' || name == 'write_off_interest') {
                    return 'csh_write_off_grid_nf';
                }
                if (name == 'write_off_date') {
                    return 'csh_write_off_grid_dp';
                }
                if (name == 'agent_id_desc') {
                    if (write_off_type == 'DEPOSIT_POOL_CREDIT') {
                        return 'csh_write_off_grid_lv';
                    }
                }
                if (name == 'write_off_classification_desc') {
                    return 'csh_write_off_grid_cb';
                }
                return;
            }
        }

        function summaryRenderer(datas, name) {
            var sum = 0;
            var sum_2 = 0;
            for (var i = 0; i < datas.length; i++) {
                record = datas[i];
                if (name == "write_off_amount") {
                    var t_1 = record.get("write_off_amount");
                    var t_2 = parseFloat(t_1);
                    if (!isNaN(t_2)) {
                        sum += t_2;
                    }
                }
                if (name == "unreceived_amount") {
                    var n_1 = record.get("unreceived_amount");
                    var n_2 = parseFloat(n_1);
                    if (!isNaN(n_2)) {
                        sum_2 += n_2;
                    }
                }
            }
            if (name == "csh_bank_slip_num") {
                return '<div align="right">合计:</div>';
            }
            if (name == "unreceived_amount") {
                return '<font color="red">' + Leaf.formatNumber(sum_2, 2) + '</font>';
            }
            if (name == "write_off_amount") {
                return '<font color="red">' + Leaf.formatNumber(sum, 2) + '</font>';
            }
        }

        function csh531_load_fun(ds){
            var records = ds.getAll();
            for(var i=0;i<records.length;i++){
                record.getField('write_off_times').setLovPara('contract_id', records[i].get('contract_id'));
            }
        }

        function csh531_update_fun(ds, record, name, value, oldValue) {

            if (name == 'write_off_amount') {
                var left_amount = record.get('left_amount');
                var left_principal = record.get('left_principal');
                var left_interest = record.get('left_interest');
                var x_amount;
                if (value) {
                    if (value <= left_interest) {
                        record.set('write_off_interest', value);
                        record.set('write_off_principal', null);
                    } else if (value > left_interest) {
                        record.set('write_off_interest', left_interest);
                        x_amount = value - left_interest;
                        record.set('write_off_principal', x_amount);
                    }
                } else {
                    record.set('write_off_interest', null);
                    record.set('write_off_principal', null);
                }
            }
            if (name == 'write_off_type') {
                if (value != oldValue) {
                    //收款核销
                    if (value == 'RECEIPT_CREDIT') {
                        record.getField('contract_number').setRequired(true);

                        record.getField('write_off_times').setReadOnly(false);
                        record.getField('write_off_times').setRequired(false);

                    } else {
                        record.getField('write_off_times').setRequired(false);
                        record.getField('write_off_times').setReadOnly(true);
                    }
                    //收款核销预收款
                    if (value == 'RECEIPT_ADVANCE_RECEIPT') {
                        record.getField('contract_number').setRequired(true);

                        record.set('agent_id_desc', '');
                        record.set('agent_id', '');
                        record.set('write_off_times', '');
                        record.set('write_off_cf_item', '');
                        record.set('write_off_cf_item_desc', '');
                        record.set('write_off_cashflow_id', '');
                        record.set('due_date', '');

                        record.set('write_off_principal', '');
                        record.set('write_off_interest', '');
                        record.set('left_amount', '');
                        record.set('left_principal', '');
                        record.set('left_interest', '');
                    }
                    //核销为保证金池
                    if (value == 'DEPOSIT_POOL_CREDIT') {
                        record.getField('contract_number').setRequired(false);

                        record.getField('agent_id_desc').setReadOnly(false);
                        record.getField('agent_id_desc').setRequired(true);

                        record.set('contract_number', '');
                        record.set('contract_name', '');
                        record.set('contract_id', '');
                        record.set('write_off_bp_id', '');
                        record.set('write_off_bp_name', '');

                        record.set('write_off_times', '');
                        record.set('write_off_cf_item', '');
                        record.set('write_off_cf_item_desc', '');
                        record.set('write_off_cashflow_id', '');
                        record.set('due_date', '');

                        record.set('write_off_principal', '');
                        record.set('write_off_interest', '');
                        record.set('left_amount', '');
                        record.set('left_principal', '');
                        record.set('left_interest', '');
                    } else {
                        record.getField('agent_id_desc').setRequired(false);
                        record.getField('agent_id_desc').setReadOnly(true);
                    }
                }
            }
            if (name == 'contract_id') {
                record.getField('write_off_times').setLovPara('contract_id', value);
            }
        }

        function csh531_wf_amount_validate(record, name, value) {
            var batch_status = '${/parameter/@batch_status}';
            if (batch_status == 'SUBMIT') {
                return true;
            } else {
                if (record.get('write_off_type') == 'RECEIPT_CREDIT') {
                    if (value > record.get('left_amount')) {
                        return '分配金额不能大于剩余金额';
                    }
                }
            }
            return true;
        }

        function csh532n_csh_assigns_confirm(){
            var ds = $('csh_write_off_assigns_ds');

            if (ds.validate()) {
                if (ds.isModified()) {
                    Leaf.showErrorMessage('提示', '请先保存后再点击预核销!');
                    return;
                }
                Leaf.showConfirm('提示', '该操作会覆盖预核销结果,是否确认?', function () {
                    csh532d_lock_current_window();
                    var record = ds.getCurrentRecord();
                    Leaf.request({
                        url: $('csh532n_csh_assigns_confirm_link').getUrl(),
                        para: {
                            transaction_id: record.get('transaction_id')
                        },
                        success: function () {
                            csh532d_unlock_current_window();
                            $('csh_write_off_assigns_ds').query();
                            $('csh_write_off_interface_ds').query();
                        },
                        failure: function () {
                            csh532d_unlock_current_window();
                        },
                        error: function () {
                            csh532d_unlock_current_window();
                        },
                        scope: this
                    });
                });
            }
        }

        function attachment_upload() {

            if ('${/parameter/@transaction_id}') {
                //
                // ds = $('csh_transaction_receipt_head_ds');
                // record = ds.getCurrentRecord();
                // var header_id = record.get('transaction_id');
                var header_id = '${/parameter/@transaction_id}';
                var url = $('transaction_uploadFile_id').getUrl() + '?table_name=CSH_TRANSACTION&header_id=' + header_id;
                var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'transaction_uploadFile_winid',
                    width: 850,
                    height: 400
                });
                win.on('close', function () {
                    window.location.href = $('csh_transaction_receipt_id').getUrl();
                    // var url = $('csh_transaction_receipt_id').getUrl();
                    // Leaf.go(url);
                });
            } else {
                Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
                return;
            }
        }

        function csh531n_save() {
            $('csh_transaction_receipt_write_off_detail_head_ds').submit();
        }


        ]]></script>
        <a:dataSets>
            <!--<a:dataSet id="ds_csh_write_off_classification_ds" lookupCode="DS_CSH_WRITE_OFF_CLASSIFICATION"/>-->
            <a:dataSet id="ds_csh_write_off_classification_ds" >
                <a:datas dataSource="/model/sys_code_default_value_path"/>
            </a:dataSet>

            <a:dataSet id="write_off_cf_item_ds" autoQuery="true" model="csh.CSH531N.hls_cashflow_item_v"/>
            <a:dataSet id="write_off_type_ds" autoQuery="true" model="csh.CSH531N.write_off_type_cb"/>
            <a:dataSet id="csh_transaction_receipt_write_off_detail_head_ds" model="csh.CSH531N.csh_transaction">
                <a:datas dataSource="/model/csh_transaction_path"/>
                <a:fields>
                    <!--  <a:field name="write_off_date" defaultValue="${/model/sys_default_value/record/@now_time}" required="true"/> -->
                    <a:field name="write_off_date" />
                    <a:field name="ref_contract_num" readOnly="true"/>
                    <a:field name="bank_slip_num" readOnly="true"/>
                    <a:field name="bp_code" readOnly="true"/>
                    <a:field name="bp_category" readOnly="true"/>
                    <a:field name="bp_category_n" readOnly="true"/>
                    <a:field name="transaction_num" readOnly="true"/>
                    <a:field name="currency_name" readOnly="true"/>
                    <a:field name="bp_name" readOnly="true"/>
                    <a:field name="transaction_amount" readOnly="true"/>
                    <a:field name="returned_amount" readOnly="true"/>
                    <a:field name="write_off_amount" readOnly="true"/>
                    <a:field name="unwrite_off_amount" readOnly="true"/>
                    <a:field name="csh_bp_name" readOnly="true"/>
                    <a:field name="bank_account_name" readOnly="true"/>
                    <a:fidld name="transaction_date" readOnly="true"/>
                    <a:field name="bp_bank_account_name" readOnly="true"/>
                    <a:field name="bp_bank_account_num" readOnly="true"/>
                    <a:field name="write_off_flag_desc" readOnly="true"/>
                    <a:field name="review_status_desc" readOnly="true"/>
                    <a:field name="bank_account_num" readOnly="true"/>
                    <a:field name="approving_return_amount" readOnly="true"/>
                    <a:field/>
                    <a:field name="ref_v01"/>
                </a:fields>

            </a:dataSet>
            <a:dataSet id="csh_write_off_assigns_ds" autoQuery="true" fetchAll="true" model="csh.CSH532N.csh_write_off_assigns" queryUrl="${/request/@context_path}/autocrud/csh.CSH532N.csh_write_off_assigns/query?transaction_id=${/parameter/@transaction_id}" selectable="true">
                <a:fields>
                    <a:field name="company_id" defaultValue="${/parameter/@company_id}"/>
                    <a:field name="write_off_date" required="true" defaultValue="${/parameter/@transaction_date}"/>
                    <a:field name="journal_date"  required="true" datatype="date" defaultValue="${/model/sys_default_time/record/@now_date}"/>
                    <a:field name="write_off_period_name" defaultValue="${/parameter/@period_name}"/>
                    <a:field name="write_off_period_num" defaultValue="${/parameter/@internal_period_num}"/>
                    <a:field name="check_flag" defaultValue="Y"/>
                    <a:field name="record_type" defaultValue="MANUAL"/>
                    <a:field name="write_off_times"/>
                    <a:field name="write_off_amount" required="true" validator="csh531_wf_amount_validate"/>
                    <a:field name="due_date"/>
                    <a:field name="unreceived_amount"/>
                    <a:field name="write_off_cashflow_id"/>
                    <a:field name="contract_id"/>
                    <a:field name="transaction_id"  defaultValue="${/parameter/@transaction_id}"/>
                    <a:field name="trx_number" defaultValue="${/parameter/@transaction_num}"/>
                    <a:field name="trx_interface_id" defaultValue="${/parameter/@transaction_id}"/>
                    <a:field name="contract_number" prompt="HLS.CONTRACT_NUMBER"  required="true" autoComplete="true" lovAutoQuery="true" lovGridHeight="300" lovHeight="450" lovService="csh.CSH531N.csh_con_contract_lov" lovWidth="450" title="合同号选择">
                        <a:mapping>
                            <a:map from="contract_number" to="contract_number"/>
                            <a:map from="contract_name" to="contract_name"/>
                            <a:map from="contract_id" to="contract_id"/>
                            <a:map from="bp_id_tenant" to="write_off_bp_id"/>
                            <a:map from="bp_id_tenant_name" to="write_off_bp_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="write_off_times" lovHeight="780" lovUrl="${/request/@context_path}/modules/csh/CSH531N/csh_write_off_ref_contract.lview" lovWidth="900" title="合同选择">
                        <a:mapping>
                            <!--<a:map from="contract_id" to="contract_id"/>-->
                            <!--<a:map from="contract_number" to="contract_number"/>-->
                            <!--<a:map from="contract_name" to="contract_name"/>-->
                            <a:map from="times" to="write_off_times"/>
                            <a:map from="cf_item" to="write_off_cf_item"/>
                            <a:map from="cf_item_desc" to="write_off_cf_item_desc"/>
                            <a:map from="left_amount" to="write_off_amount"/>
                            <a:map from="due_date" to="due_date"/>
                            <!-- <a:map from="unreceived_amount" to="unreceived_amount"/> -->
                            <a:map from="cashflow_id" to="write_off_cashflow_id"/>
                            <a:map from="left_principal" to="write_off_principal"/>
                            <a:map from="left_interest" to="write_off_interest"/>
                            <a:map from="left_amount" to="left_amount"/>
                            <a:map from="left_principal" to="left_principal"/>
                            <a:map from="left_interest" to="left_interest"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="batch_id" defaultValue="${/parameter/@batch_id}"/>
                    <a:field name="write_off_type" required="true" defaultValue="RECEIPT_CREDIT"/>
                    <a:field name="write_off_type_desc"  displayField="code_value_name" options="write_off_type_ds" returnField="write_off_type" valueField="code_value"/>
                    <a:field name="write_off_bp_id"/>
                    <!--<a:field name="write_off_bp_name" autoComplete="true" autoCompleteField="true" lovAutoQuery="true" lovGridHeight="300" lovHeight="450" lovService="csh.CSH531N.hls_bp_master" lovWidth="500" title="分配对象选择">-->
                    <!--<a:mapping>-->
                    <!--<a:map from="bp_id" to="write_off_bp_id"/>-->
                    <!--<a:map from="bp_name" to="write_off_bp_name"/>-->
                    <!--</a:mapping>-->
                    <!--</a:field>-->
                    <a:field name="write_off_classification"/>
                    <a:field name="write_off_classification_desc" required="true" options="ds_csh_write_off_classification_ds" returnField="write_off_classification" valueField="code_value" displayField="code_value_name"/>
                    <a:field name="write_off_cf_item" readOnly="true"/>
                    <a:field name="write_off_cf_item_desc" displayField="cf_item_desc" options="write_off_cf_item_ds" returnField="write_off_cf_item" valueField="cf_item"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="csh531_update_fun"/>
                    <!--<a:event name="load" handler="csh531_load_fun"/>-->
                </a:events>
            </a:dataSet>

            <a:dataSet id="csh_write_off_interface_ds" autoQuery="true" fetchAll="true" model="csh.CSH531N.csh_write_off_interface" queryUrl="${/request/@context_path}/autocrud/csh.CSH531N.csh_write_off_interface/query?trx_interface_id=${/parameter/@transaction_id}" selectable="true">
                <a:fields>
                    <a:field name="company_id" defaultValue="${/parameter/@company_id}"/>
                    <a:field name="write_off_date" prompt="核销基准日期" required="true" defaultValue="${/parameter/@transaction_date}"/>
                    <a:field name="write_off_period_name" defaultValue="${/parameter/@period_name}"/>
                    <a:field name="write_off_period_num" defaultValue="${/parameter/@internal_period_num}"/>
                    <a:field name="check_flag" defaultValue="Y"/>
                    <a:field name="record_type" defaultValue="MANUAL"/>
                    <a:field name="write_off_times"/>
                    <a:field name="write_off_amount" required="true" validator="csh531_wf_amount_validate"/>
                    <a:field name="due_date"/>
                    <a:field name="unreceived_amount"/>
                    <a:field name="write_off_cashflow_id"/>
                    <a:field name="contract_id"/>
                    <a:field name="trx_interface_id" defaultValue="${/parameter/@transaction_id}"/>
                    <a:field name="contract_number" prompt="HLS.CONTRACT_NUMBER"  autoComplete="true" lovAutoQuery="true" lovGridHeight="300"  lovHeight="480" lovService="csh.CSH531N.csh_con_contract_lov" lovWidth="800" title="合同号选择">
                        <a:mapping>
                            <a:map from="contract_number" to="contract_number"/>
                            <a:map from="contract_name" to="contract_name"/>
                            <a:map from="contract_id" to="contract_id"/>
                            <a:map from="bp_id_tenant" to="write_off_bp_id"/>
                            <a:map from="bp_id_tenant_name" to="write_off_bp_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="write_off_times" lovHeight="780" lovUrl="${/request/@context_path}/modules/csh/CSH531N/csh_write_off_ref_contract.lview" lovWidth="900" title="合同选择">
                        <a:mapping>
                            <!--<a:map from="contract_id" to="contract_id"/>-->
                            <!--<a:map from="contract_number" to="contract_number"/>-->
                            <!--<a:map from="contract_name" to="contract_name"/>-->
                            <a:map from="times" to="write_off_times"/>
                            <a:map from="cf_item" to="write_off_cf_item"/>
                            <a:map from="cf_item_desc" to="write_off_cf_item_desc"/>
                            <a:map from="left_amount" to="write_off_amount"/>
                            <a:map from="due_date" to="due_date"/>
                            <!-- <a:map from="unreceived_amount" to="unreceived_amount"/> -->
                            <a:map from="cashflow_id" to="write_off_cashflow_id"/>
                            <a:map from="left_principal" to="write_off_principal"/>
                            <a:map from="left_interest" to="write_off_interest"/>
                            <a:map from="left_amount" to="left_amount"/>
                            <a:map from="left_principal" to="left_principal"/>
                            <a:map from="left_interest" to="left_interest"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="batch_id" defaultValue="${/parameter/@batch_id}"/>
                    <a:field name="write_off_type" required="true" defaultValue="RECEIPT_CREDIT"/>
                    <a:field name="write_off_type_desc"   displayField="code_value_name" options="write_off_type_ds" returnField="write_off_type" valueField="code_value"/>
                    <a:field name="write_off_bp_id"/>
                    <!--<a:field name="write_off_bp_name" autoComplete="true" autoCompleteField="true" lovAutoQuery="true" lovGridHeight="300" lovHeight="450" lovService="csh.CSH531N.hls_bp_master" lovWidth="500" title="分配对象选择">-->
                    <!--<a:mapping>-->
                    <!--<a:map from="bp_id" to="write_off_bp_id"/>-->
                    <!--<a:map from="bp_name" to="write_off_bp_name"/>-->
                    <!--</a:mapping>-->
                    <!--</a:field>-->
<!--                    <a:field name="write_off_classification_desc" prompt="核销分类" options="ds_csh_write_off_classification_ds" returnField="write_off_classification" valueField="code_value" displayField="code_value_name"/>-->
                    <a:field name="write_off_cf_item" readOnly="true"/>
                    <a:field name="write_off_cf_item_desc" displayField="cf_item_desc" options="write_off_cf_item_ds" returnField="write_off_cf_item" valueField="cf_item"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
               <a:gridButton id="csh511_receipt_upload_id" click="attachment_upload" text="附件上传"/>
            </a:screenTopToolbar>
            <a:form title="CSH513.RECEIPT_WRITE_OFF" marginWidth="50">
                <a:box column="4" labelWidth="100">
                    <a:textField name="transaction_num" bindTarget="csh_transaction_receipt_write_off_detail_head_ds"/>
                    <a:textField name="bank_account_name" bindTarget="csh_transaction_receipt_write_off_detail_head_ds"/>
                    <a:textField name="bank_slip_num" bindTarget="csh_transaction_receipt_write_off_detail_head_ds"/>
                    <a:textField name="bank_account_num" bindTarget="csh_transaction_receipt_write_off_detail_head_ds"/>
                </a:box>
                <a:box column="4" labelWidth="100">
                    <a:numberField name="transaction_amount" allowFormat="true" bindTarget="csh_transaction_receipt_write_off_detail_head_ds"/>
                    <a:numberField name="returned_amount" allowFormat="true" bindTarget="csh_transaction_receipt_write_off_detail_head_ds" prompt="HLS.RETURNED_AMOUNT"/>
                    <a:numberField name="write_off_amount" allowFormat="true" bindTarget="csh_transaction_receipt_write_off_detail_head_ds" prompt="HLS.WRITEOFF_AMOUNT"/>
                    <a:numberField name="unwrite_off_amount" allowFormat="true" bindTarget="csh_transaction_receipt_write_off_detail_head_ds" prompt="CSH513.REMAINING_WRITEOFF_AMOUNT"/>
                </a:box>
                <a:box column="4" labelWidth="100">
                    <a:datePicker name="transaction_date" bindTarget="csh_transaction_receipt_write_off_detail_head_ds"/>
                    <a:textField name="csh_bp_name" prompt="收款对象" bindTarget="csh_transaction_receipt_write_off_detail_head_ds"/>
                    <a:textField name="bp_bank_account_name" prompt="对方账户" bindTarget="csh_transaction_receipt_write_off_detail_head_ds"/>
                    <a:textField name="bp_bank_account_num" prompt="对方账号" bindTarget="csh_transaction_receipt_write_off_detail_head_ds"/>
                </a:box>
                <a:box column="4" labelWidth="100">
                    <a:textField name="write_off_flag_desc" prompt="核销状态" bindTarget="csh_transaction_receipt_write_off_detail_head_ds"/>
                    <a:textField name="review_status_desc" prompt="分配状态" bindTarget="csh_transaction_receipt_write_off_detail_head_ds"/>
                    <a:textField name="description" bindTarget="csh_transaction_receipt_write_off_detail_head_ds" prompt="摘要" readOnly="true"/>
                    <a:numberField name="approving_return_amount" allowFormat="true" bindTarget="csh_transaction_receipt_write_off_detail_head_ds" prompt="审批中退款金额"/>
                </a:box>
                <a:box column="4" labelWidth="100">
                <a:textArea colspan="2" name="ref_v05" bindTarget="csh_transaction_receipt_write_off_detail_head_ds" prompt="备注" width="370"/>
                <a:gridButton click="csh531n_save" text="HLS.SAVE"/>
                </a:box>
                <!--<a:box column="2" labelWidth="100">-->
                <!--<a:textArea name="description" bindTarget="csh_transaction_receipt_write_off_detail_head_ds" prompt="摘要" readOnly="true" width="405"/>-->
                <!--</a:box>-->
            </a:form>
            <a:tabPanel height="500" marginWidth="50">
                <a:tabs >
                    <a:tab prompt="预核销" width="120">
                        <a:grid id="csh_write_off_assigns_grid" bindTarget="csh_write_off_assigns_ds" height="370"  marginWidth="100">
                            <a:toolBar>
                                <a:button id="csh_grid_add_bt" type="add"/>
                                <a:button id="csh_grid_delete_bt" type="delete"/>
                                <a:button id="csh_grid_save_bt" type="save"/>
                                <a:button di="csh_grid_submit_bt" text="预核销" click="csh532n_csh_assigns_confirm"/>
                            </a:toolBar>
                            <a:columns>
                                <!--<a:column name="csh_bank_slip_num" footerRenderer="summaryRenderer" prompt="CSH531.BANK_SLIP_NUM" width="120"/>-->
                                <!--<a:column name="write_off_type_desc" editorFunction="csh_edit_function" prompt="HLS.WRITE_OFF_TYPE" width="100"/>-->
                                <a:column name="contract_number" editorFunction="csh_edit_function" prompt="HLS.CONTRACT_NUMBER" width="120"/>
                                <a:column name="write_off_bp_name" editorFunction="csh_edit_function" prompt="CSH531.WRITE_OFF_BP_NAME" width="100"/>
                                <!--<a:column name="write_off_times" editorFunction="csh_edit_function" prompt="HLS.TIMES" width="80"/>-->
                                <!--<a:column name="write_off_cf_item_desc" editorFunction="csh_edit_function" prompt="CSH531.CF_ITEM" width="80"/>-->
                                <!--<a:column name="due_date" editorFunction="csh_edit_function" prompt="CSH531.WRITE_OFF_DATE" renderer="Leaf.formatDate" width="80"/>-->
                                <!--<a:column name="left_amount" align="right" footerRenderer="summaryRenderer" prompt="剩余金额" renderer="Leaf.formatMoney" width="120"/>-->
                                <!--&lt;!&ndash;<a:column name="left_principal" align="right" footerRenderer="summaryRenderer" prompt="剩余本金" renderer="Leaf.formatMoney" width="120"/>&ndash;&gt;-->
                                <!--<a:column name="left_interest" align="right" footerRenderer="summaryRenderer" prompt="剩余利息" renderer="Leaf.formatMoney" width="120"/>-->
<!--                                <a:column name="write_off_classification_desc" editorFunction="csh_edit_function" prompt="核销分类" />-->
                                <a:column name="write_off_date" align="center" editorFunction="csh_edit_function" renderer="Leaf.formatDate" prompt="核销基准日期" width="120"/>
                                <a:column name="write_off_amount" align="right" editorFunction="csh_edit_function" footerRenderer="summaryRenderer" prompt="CSH531.AMOUNT" renderer="Leaf.formatMoney" width="120"/>
                                <!--<a:column name="write_off_principal" align="right" prompt="分配本金" renderer="Leaf.formatMoney" width="120"/>-->
                                <!--<a:column name="write_off_interest" align="right" prompt="分配利息" renderer="Leaf.formatMoney" width="120"/>-->
                                <!--<a:column name="agent_id_desc" editorFunction="csh_edit_function" prompt="代理商"/>-->
                            </a:columns>
                            <a:editors>
                                <a:textField id="csh_write_off_grid_tf"/>
                                <a:numberField id="csh_write_off_grid_nf"  allowNegative="false" />
                                <a:datePicker id="csh_write_off_grid_dp"/>
                                <a:comboBox id="csh_write_off_grid_cb"/>
                                <a:lov id="csh_write_off_grid_lv"/>
                            </a:editors>
                        </a:grid>
                    </a:tab>
                    <a:tab prompt="预核销结果" width="120">
                        <a:grid id="csh_write_off_interface_grid" bindTarget="csh_write_off_interface_ds" height="370"   marginWidth="100">

                            <a:columns>
                                <!--<a:column name="csh_bank_slip_num" footerRenderer="summaryRenderer" prompt="CSH531.BANK_SLIP_NUM" width="120"/>-->
                                <a:column name="write_off_type_desc" prompt="HLS.WRITE_OFF_TYPE" width="100"/>
                                <a:column name="contract_number" prompt="HLS.CONTRACT_NUMBER" width="120"/>
                                <a:column name="write_off_bp_name" prompt="CSH531.WRITE_OFF_BP_NAME" width="100"/>
                                <a:column name="write_off_times" editorFunction="csh_edit_function" prompt="HLS.TIMES" width="80"/>
                                <a:column name="write_off_cf_item_desc" editorFunction="csh_edit_function" prompt="CSH531.CF_ITEM" width="80"/>
                                <a:column name="due_date" editorFunction="csh_edit_function" prompt="CSH531.WRITE_OFF_DATE" renderer="Leaf.formatDate" width="80"/>
                                <a:column name="left_amount" align="right" footerRenderer="summaryRenderer" prompt="剩余金额" renderer="Leaf.formatMoney" width="120"/>
                                <!--<a:column name="left_principal" align="right" footerRenderer="summaryRenderer" prompt="剩余本金" renderer="Leaf.formatMoney" width="120"/>-->
                                <!--<a:column name="left_interest" align="right" footerRenderer="summaryRenderer" prompt="剩余利息" renderer="Leaf.formatMoney" width="120"/>-->
<!--                                <a:column name="write_off_classification_desc" editorFunction="csh_edit_function" prompt="核销分类"/>-->
                                <a:column name="write_off_date" align="center" editorFunction="csh_edit_function" renderer="Leaf.formatDate" prompt="核销基准日" width="120"/>
                                <a:column name="write_off_amount" align="right" editorFunction="csh_edit_function" footerRenderer="summaryRenderer" prompt="CSH531.AMOUNT" renderer="Leaf.formatMoney" width="120"/>
                                <!--<a:column name="write_off_principal" align="right" prompt="分配本金" renderer="Leaf.formatMoney" width="120"/>-->
                                <!--<a:column name="write_off_interest" align="right" prompt="分配利息" renderer="Leaf.formatMoney" width="120"/>-->
                                <!--<a:column name="agent_id_desc" editorFunction="csh_edit_function" prompt="代理商"/>-->
                            </a:columns>

                        </a:grid>
                    </a:tab>
                </a:tabs>
            </a:tabPanel>

        </a:screenBody>
        <script type="text/javascript"><![CDATA[
        Leaf.onReady(init);
        ]]></script>
    </a:view>
</a:screen>