<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangyu  
    $Date: 2014-11-10 上午11:42:03  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="csh_offset_reverse_query" url="${/request/@context_path}/modules/csh/CSH533/csh_offset_reversed.lview"/>
        <script type="text/javascript"><![CDATA[
			function csh533_offset_reverse(){
               var record = $('csh_offset_reversed_result_ds').getCurrentRecord();
               if (record.validateRecord()){
                   var saveData = [];
                    record.set('_status', 'insert');
                    saveData.push(record.data);
                    Leaf.showConfirm('${l:HLS.PROMPT}', '${l:CSH514.REVERSE_SURE}', function okFun() {
                        Leaf.request({
                            url: '${/request/@context_path}/autocrud/csh.CSH533.csh_offset_reverse_confirm/batch_update',
                            para: saveData,
                            success: function(res) {
                                Leaf.SideBar.show({
                                    msg: '${l:HLS.SUBMIT_SUCCESS}',
                                    duration: 2000
                                });
                                window.location.href = $('csh_offset_reverse_query').getUrl();
                            },
                            failure: function() {
                                Leaf.Masker.unmask(Ext.getBody());
                            },
                            error: function() {
                                Leaf.Masker.unmask(Ext.getBody());
                            },
                            scope: this
                        });
                    });
                   
               }
           }
           
		]]></script>
        <a:dataSets><![CDATA[
		]]></a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton id="csh533_offset_reverse_id" click="csh533_offset_reverse" text="确认反冲"/>
            </a:screenTopToolbar>
            <a:form>
                <a:box column="4" labelWidth="160">
                    <a:textField name="contract_number" bindTarget="csh_offset_reversed_result_ds" prompt="合同编号" width="140"/>
                    <a:textField name="bp_name" bindTarget="csh_offset_reversed_result_ds" prompt="承租人" width="140"/>
                    <a:textField name="offset_amount" bindTarget="csh_offset_reversed_result_ds" prompt="收付抵扣金额" renderer="Leaf.formatMoney" width="140"/>
                    <a:datePicker name="journal_date" bindTarget="csh_offset_reversed_result_ds" prompt="收付抵扣日期" width="140"/>
                </a:box>
                <a:box column="2" labelWidth="95">
                    <a:datePicker name="reverse_date" bindTarget="csh_offset_reversed_result_ds" prompt="反冲日期" width="140"/>
                    <a:textField name="description" bindTarget="csh_offset_reversed_result_ds" prompt="摘要" width="630"/>
                </a:box>
            </a:form>
        </a:screenBody>
        <script type="text/javascript"><![CDATA[
			 Leaf.onReady(init);
        function init() {
            var record = $('csh_offset_reversed_result_ds').getCurrentRecord();
                    record.getField('contract_number').setReadOnly(true);
                    record.getField('bp_name').setReadOnly(true);
                    record.getField('offset_amount').setReadOnly(true);
                    record.getField('journal_date').setReadOnly(true);
                    record.set('description','反冲');
                    record.set('reverse_date' ,Leaf.formatDate(new Date()));
                    
                
        }
		]]></script>
    </a:view>
</a:screen>