csh_deposit_write_off.lview 9.41 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: gaoyang  
    $Date: 2013-5-21 下午07:36:37  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="csh.CSH511.csh_transaction_default_exchange_rate_type" rootPath="default_exchange_rate_type_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="csh_transaction_receipt_write_off_detail_link" url="${/request/@context_path}/modules/csh/CSH520/csh_transaction_receipt_write_off_detail.lview"/>
        <a:link id="csh520_transaction_receipt_id" url="${/request/@context_path}/modules/csh/CSH520/csh_transaction_receipt.lview"/>
        <a:link id="get_period_name_id" model="csh.CSH511.csh_transaction_get_period_name" modelaction="query"/>
        <script type="text/javascript"><![CDATA[
        	function csh520_receipt_ref_con_query(){
        	    $('csh520_deposit_result_ds').query();
        	}
        	function csh520_receipt_ref_con_reset(){
        	    $('csh520_deposit_header_ds').reset();
        	}
        	
        	
        	function csh520_write_off()
        	{
        	    //
        	    var transaction_date = new Date();
        	    //alert(transaction_date);
        	    //transaction_date = Leaf.formatDate(transaction_date);
        	    Leaf.request({
                    url: $('get_period_name_id').getUrl(),             //得到当前时间对应期间period_name,和internal_period_num
                    para: {
                        p_date: transaction_date
                    },
                    success: function(res)
                    {
                        var saveData = [];
                        var record = $('csh520_deposit_result_ds').getCurrentRecord();
                        record.set('_status', 'insert');
		        	    var bp_id = record.get('bp_id_tenant');
		        	    record.set('bp_id',bp_id);
		        	    var bp_name = record.get('bp_id_tenant_n');
		        	    record.set('bp_name',bp_name);
		        	    var transaction_amount = record.get('residue_amount');
		        	    record.set('transaction_amount',transaction_amount);
		        	    var source_doc_id = record.get('contract_id');
		        	    record.set('source_doc_id',source_doc_id);
		        	    var source_doc_line_id = record.get('cashflow_id');
		        	    record.set('source_doc_line_id',source_doc_line_id);
		        	    var source_doc_type = record.get('document_type');
		        	    record.set('source_doc_type',source_doc_type);
                        var internal_period_num = res.result.record.internal_period_num;
                        record.set('internal_period_num',internal_period_num);
                        var period_name = res.result.record.period_name;
                        record.set('period_name',period_name);
                        var currency_code = 'CNY';
                        record.set('currency_code',currency_code);
		        	    var exchange_rate = 1;
		        	    record.set('exchange_rate',exchange_rate);
		        	    //var bank_account_id = 21;
		        	    //record.set('bank_account_id',bank_account_id);
		        	    var bp_category = 'TENANT';
		        	    record.set('bp_category',bp_category);
		        	    var source_doc_category = 'CONTRACT';
		        	    record.set('source_doc_category',source_doc_category);
		        	    record.set('posted_flag','Y');
		        	    record.set('transaction_date',transaction_date);
		        	    saveData.push(record.data);
                   		Leaf.request({
                        url: '${/request/@context_path}/autocrud/csh.CSH520.csh_transaction_receipt_save/batch_update',
                        para: saveData,
                        success: function(res) {
                            var transaction_type = 'RECEIPT';
                            var auto_filt_penalty = 'N';
                            var auto_filt_prinicipal_interest= 'Y';
                            var url = $('csh_transaction_receipt_write_off_detail_link').getUrl()+ '?transaction_id=' + res.result.transaction_id+'&transaction_type='+transaction_type+'&auto_filt_penalty='+auto_filt_penalty+'&auto_filt_prinicipal_interest='+auto_filt_prinicipal_interest+'&contract_id='+source_doc_id;
                            var win= new Leaf.Window({
			                    id: 'receipt_write_off_detail',
			                    params: {
			                        winId: 'receipt_write_off_detail'
			                    },
			                    url: url,
			                    title: '${l:CSH520.租金核销}',
			                    fullScreen: true
			                });
			                win.on('close', function() {                           
                                $('csh520_deposit_result_ds').query();
                        }); 
                           
                        },
                        failure: function() {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        error: function() {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        scope: this
                    });
                    },
                    scope: this,
                    sync : true
                });  
                
        	}
   		]]></script>
        <a:dataSets>
            <a:dataSet id="csh520_deposit_header_ds">
                <a:fields>
                    <a:field name="contract_number" lovGridHeight="350" lovHeight="500" lovService="csh.CSH520.con_contract_lov" lovWidth="470" title="合同">
                        <a:mapping>
                            <a:map from="contract_id" to="contract_id"/>
                            <a:map from="contract_number" to="contract_number"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id_agent_level1"/>
                    <a:field name="bp_id_agent_desc" lovGridHeight="350" lovHeight="500" lovService="basic.hls_bp_master_v_for_lov?bp_category=AGENT" lovWidth="500">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id_agent_level1"/>
                            <a:map from="bp_name" to="bp_id_agent_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id_tenant"/>
                    <a:field name="bp_id_tenant_desc" lovGridHeight="350" lovHeight="500" lovLabelWidth="120" lovService="basic.hls_bp_master_v_for_lov?bp_category=TENANT" lovWidth="520">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id_tenant"/>
                            <a:map from="bp_name" to="bp_id_tenant_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="due_date_from"/>
                    <a:field name="due_date_to"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="csh520_deposit_result_ds" autoQuery="true" model="csh.CSH520.csh_deposit_write_off_v" pageSize="15" queryDataSet="csh520_deposit_header_ds" selectable="true" selectionModel="single"><![CDATA[
			]]></a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="csh520_receipt_ref_con_query" text="HLS.QUERY"/>
                <a:gridButton click="csh520_receipt_ref_con_reset" text="HLS.RESET"/>
                <a:gridButton click="csh520_write_off" text="抵扣"/>
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="110" marginWidth="30" title="CSH513.WRITE_OFF_OBJECT_QUERY">
                <a:lov name="contract_number" bindTarget="csh520_deposit_header_ds" prompt="合同编号"/>
                <a:lov name="bp_id_tenant_desc" bindTarget="csh520_deposit_header_ds" prompt="承租人"/>
                <!--<a:lov name="bp_id_agent_desc" bindTarget="csh520_deposit_header_ds" prompt="经销商"/>-->
                <a:datePicker name="due_date_from" bindTarget="csh520_deposit_header_ds" prompt="预定退还日从"/>
                <a:datePicker name="due_date_to" bindTarget="csh520_deposit_header_ds" prompt="预定退还日到"/>
            </a:form>
            <a:grid bindTarget="csh520_deposit_result_ds" height="400" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="contract_number" prompt="合同编号" width="130"/>
                    <!--<a:column name="bp_id_agent_level1_n" prompt="经销商" width="180"/>-->
                    <a:column name="bp_id_tenant_desc" prompt="承租人" width="180"/>
                    <a:column name="lease_item_amount" align="right" prompt="租赁物总价" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="cf_item_desc" align="center" prompt="抵扣项目"/>
                    <a:column name="due_amount" align="right" prompt="金额" renderer="Leaf.formatMoney"/>
                    <a:column name="due_date" align="center" prompt="预定退还日" renderer="Leaf.formatDate" width="80"/>
                    <a:column name="received_amount" align="right" prompt="已抵扣金额" renderer="Leaf.formatMoney"/>
                    <a:column name="residue_amount" align="right" prompt="未处理金额" renderer="Leaf.formatMoney"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>