lsh312_report_month.lview 17.2 KB
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Clocc  
    $Date: 2015-7-30 下午3:09:16  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query model="cus.CUS100.cus_default_values" rootPath="cus_default_value"/>
    </a:init-procedure>
    <a:view>
        <a:link id="con643_submit_link" model="cus.CUS312.cus_rpt_cus312_submit_rpt" modelaction="execute"/>
        <a:link id="con643_get_control_id_link" model="db.rpt_report_control_pkg.checkin_rpt" modelaction="execute"/>
        <a:link id="con643_refresh_link" model="db.rpt_report_control_pkg.refresh_rpt" modelaction="execute"/>
        <script type="text/javascript"><![CDATA[
			function eg_rpt100_status_find(control_id){			    
                Leaf.request({
                    url: $('con643_refresh_link').getUrl(),
                    para: {'control_id':control_id},
                    success: function(res) {
                        if (res.result.job_stauts == 'FINISH') {
                            var result_ds = $('cus312_result_ds');
                            var record = $('cus312_head_ds').getCurrentRecord();
                            record.set('status', res.result.job_stauts);
                            result_ds.setQueryParameter('control_id', control_id);
                            result_ds.query();
                        } else {
                            eg_rpt100_head_query();
                        }
                    },
                    failure: function() {
                        cus312_unlock_current_window();
                    },
                    error: function() {
                        cus312_unlock_current_window();
                    },
                    scope: this
                });
			}
			
			function cus312_lock_current_window() {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
            }
			
			function cus312_unlock_current_window() {
                Leaf.Masker.unmask(Ext.getBody());
            }
			
			function cus312_load(ds) {
                result_load_flag = 'Y';
                unlock_window_after_load();
            }
			
			function cus312_query() {
                var record = $('cus312_status_ds').getCurrentRecord();
                if (record && record.get('calc_date')) {
                    eg_rpt100_head_query();
                } else {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请输入计算日期!');
                    return;
                }
            }
            
			function on_cus312_head_ds_load(ds) {
                head_load_flag = 'Y';
                if (from_update_flag == 'N') {
                    var record = $('cus312_head_ds').getCurrentRecord();
                    var control_id = null,
                        status = null;
                    if (record) {
                        control_id = record.get('control_id');
                        status = record.get('status');
                    }
            
                    if (status == 'FINISH') {
                        var result_ds = $('cus312_result_ds');
                        record.set('status', status);
                        result_ds.setQueryParameter('control_id', control_id);
                        result_ds.query();
                    } else {
                        eg_rpt100_status_find(control_id);
                    }
                } else {
                    from_update_flag = 'N';
                    unlock_window_after_load();
                }
            }
			
			function cus312_submit(){
			    var record = $('cus312_head_ds').getCurrentRecord(),
                    status_record = $('cus312_status_ds').getCurrentRecord();
                var control_id = record.get('control_id');
                var calc_date = status_record.get('calc_date');
			    if (status_record && calc_date) {
			    Leaf.showConfirm('${l:PROMPT}', '计算将清除上次运行结果,并且执行时间较长,是否确认提交?', function() {
			        $('cus312_result_ds').removeAll();			       
	                Leaf.request({
	                    url: $('con643_submit_link').getUrl(),
	                    para: {'control_id':control_id,
	                        	'check_company_id' : ${/session/@company_id},
	                          'calc_date':calc_date},
	                    success: function(res) {
	                        eg_rpt100_head_query();
	                    },
	                    failure: function() {
	                        cus312_unlock_current_window();
	                    },
	                    error: function() {
	                        cus312_unlock_current_window();
	                    },
	                    scope: this
	                });  
			    });			    
			} else {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请输入计算日期!');
                    return;
                }
            }
			
			function eg_rpt100_head_query(){
                $('cus312_head_ds').query();
			}
			function cus312_red_fun(value,record,name){
			    return '<font style="color:red;bold:true">'+value+'</font>';
			}
				
			function cus312_excel(){
			    $('cus312_result_grid_ds')._export('xls','excel_report');
			}
			
			function unlock_window_after_load() {
                if (head_load_flag == 'Y' && result_load_flag == 'Y') {
                    head_load_flag = 'N';
                    result_load_flag = 'N';
                    cus312_unlock_current_window();
                }
            }
            
            var head_load_flag = 'N';
            var result_load_flag = 'N';
            var from_update_flag = 'N';
			
			function cus312_update(ds,record,name,value,oldvalue){
			    if (value){
			        var date = Leaf.formatDate(value);
			        date = date.substring(0,7).replace(/-/g,"");
			        cus312_lock_current_window();
			        Leaf.request({
	                    url: $('con643_get_control_id_link').getUrl(),
	                    para: {'report_name':'CUS312',
	                        	'check_company_id' : ${/session/@company_id},
	                           // 'check_date':value,
	                           'check_period':date},
	                    success: function(res) {
	                        from_update_flag = 'Y';
                            var head_ds = $('cus312_head_ds');
                            var result_ds = $('cus312_result_ds');
                            if (res.result.control_id) {
                                head_ds.setQueryParameter('control_id', res.result.control_id);
                                result_ds.setQueryParameter('control_id', res.result.control_id);
                                head_ds.query();
                                result_ds.query();
                                } else {
                                cus312_unlock_current_window();
                            }
	                    },
	                    failure: function() {
	                        cus312_unlock_current_window();
	                    },
	                    error: function() {
	                        cus312_unlock_current_window();
	                    },
	                    scope: this
	                	});
				    }
			}
			
			function cus312_reset() {
                $('cus312_query_ds').reset();
            }
		]]></script>
        <a:dataSets>
            <a:dataSet id="lease_channel_desc_ds" fetchAll="true" loadData="true" model="basic.hls_lease_channel_for_lov"/>
            <a:dataSet id="cus312_head_ds" model="cus.CUS312.cus_rpt_report_control">
                <a:events>
                    <a:event name="load" handler="on_cus312_head_ds_load"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="cus312_status_ds" autoCreate="true">
                <a:events>
                    <a:event name="update" handler="cus312_update"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="cus312_query_ds">
                <a:fields>
                    <a:field name="bp_id_tenant_n"/>
                    <a:field name="search_term_1"/>
                    <a:field name="contract_number"/>
                    <a:field name="period_name"/>
                    <a:field name="lease_channel_n" displayField="description" options="lease_channel_desc_ds" returnField="lease_channel" valueField="lease_channel"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="cus312_result_ds" autoPageSize="true" autoQuery="true" model="cus.CUS312.cus_rpt_cus312_o" queryDataSet="cus312_query_ds">
                <a:events>
                    <a:event name="load" handler="cus312_load"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:toolbarButton click="cus312_query" text="查询"/>
                <a:toolbarButton click="cus312_submit" text="计算"/>
                <a:toolbarButton click="cus312_reset" text="重置"/>
                <a:toolbarButton click="cus312_excel" text="导出"/>
            </a:screenTopToolbar>
            <a:form column="4" marginWidth="100" title="数据刷新状态">
                <a:datePicker name="calc_date" bindTarget="cus312_status_ds" prompt="计算时间"/>
                <a:label name="last_submit_date" bindTarget="cus312_head_ds" prompt="最后刷新时间" renderer="cus312_red_fun"/>
                <a:label name="last_submitted_by" bindTarget="cus312_head_ds" prompt="最后刷新人" renderer="cus312_red_fun"/>
                <a:label name="status" bindTarget="cus312_head_ds" prompt="状态" renderer="cus312_red_fun"/>
            </a:form>
            <a:form column="5" marginWidth="100" title="查询条件">
                <a:textField name="search_term_1" bindTarget="cus312_query_ds" prompt="合同号"/>
                <a:textField name="contract_number" bindTarget="cus312_query_ds" prompt="合同序号"/>
                <a:textField name="period_name" bindTarget="cus312_query_ds" prompt="会计期间"/>
                <a:textField name="bp_id_tenant_n" bindTarget="cus312_query_ds" prompt="承租人"/>
                <a:comboBox name="lease_channel_n" bindTarget="cus312_query_ds" prompt="HLS.LEASE_CHANNEL"/>
            </a:form>
            <a:grid id="cus312_result_grid_ds" bindTarget="cus312_result_ds" marginHeight="230" marginWidth="80" navBar="true">
                <!-- <a:toolBar>
                    <a:button type="excel"/>
                </a:toolBar> -->
                <a:columns>
                    <a:column name="search_term_1" align="left" prompt="合同号" width="100"/>
                    <a:column name="contract_number" align="left" prompt="合同序号" width="100"/>
                    <a:column name="bp_id_tenant_n" align="left" prompt="客户名称" width="100"/>
                    <a:column name="period_name" align="center" prompt="会计期间" width="100"/>
                    <a:column name="inception_of_lease" align="center" prompt="起租日" renderer="Leaf.formatDate" width="100"/>
                    <a:column name="vat_flag" align="right" prompt="增值税合同" width="100"/>
                    <a:column name="received_date" align="center" prompt="付款日期" renderer="Leaf.formatDate" width="100"/>
                    <a:column name="division_n" align="center" prompt="产品线" width="100"/>
                    <a:column name="lease_channel_n" align="center" prompt="商业模式" width="100"/>
                    <a:column name="specification" align="left" prompt="设备型号" width="100"/>
                    <a:column name="serial_number" align="left" prompt="设备编号" width="100"/>
                    <a:column name="bp_id_vender_n" align="left" prompt="供应商" width="100"/>
                    <a:column name="branch_company_n" align="left" prompt="分公司"/>
                    <a:column name="province_id_n" align="left" prompt="省份" width="100"/>
                    <a:column name="lease_item_amount" align="right" prompt="整机价格" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="insurance_fee" align="right" prompt="保险费" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="csa" align="right" prompt="CSA" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="payment_others" align="right" prompt="应付其他" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="payment_amount" align="right" prompt="应付账款" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="operation_fee" align="right" prompt="管理费" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="residual_value" align="right" prompt="抵押金" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="deposit" align="right" prompt="保证金" renderer="Leaf.formatMoney" width="100"/>
                    <!-- <a:column name="operation_fee_three" align="right" prompt="第三方管理费" renderer="Leaf.formatMoney" width="100"/> -->
                    <a:column name="down_payment" align="right" prompt="DOWNPAYMENT" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="down_payment_1" align="right" prompt="首期付款" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="reschedule_flag" align="right" prompt="是否支付日调整" width="100"/>
                    <a:column name="et_flag" align="right" prompt="是否提前结清" width="100"/>
                    <a:column name="cashflow_change_flag" align="right" prompt="是否租金计划变更" width="100"/>
                    <a:column name="change_req_date" align="right" prompt="变更时间" renderer="Leaf.formatDate" width="100"/>
                    <a:column name="ccr_fee" align="right" prompt="变更手续费" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="actual_finance_amount" align="right" prompt="净融资额" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="total_interest" align="right" prompt="利息总额" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="gross" align="right" prompt="应收未收余额" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="net_fin" align="right" prompt="净投资额" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="unearned_income_fin" align="right" prompt="未实现利息余额" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="total_rental" align="right" prompt="月租金总和" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="due_amount" align="right" prompt="租金总和" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="int_rate" align="right" prompt="名义利率" width="100"/>
                    <a:column name="collected_times" align="right" prompt="已付租期" width="100"/>
                    <a:column name="uncollected_times" align="right" prompt="未付租期" width="100"/>
                    <a:column name="overdue_times" align="right" prompt="逾期(月)" width="100"/>
                    <a:column name="lease_times" align="right" prompt="总租期" width="100"/>
                    <a:column name="received_amount" align="right" prompt="当月收到租金" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="penalty" align="right" prompt="延迟履行金" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="interest_current" align="right" prompt="本月确认利息" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="huichong" align="right" prompt="逾期3期以上收入回冲" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="interest_straight" align="right" prompt="直线法每期利息" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="uncollected_interest_straight" align="right" prompt="未到期直线法利息" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="collected_rental" align="right" prompt="累计已收租金" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="principal_implicit_next_12" align="right" prompt="次12个月剩余本金" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="principal_implicit_next_12_p" align="right" prompt="次12个月后剩余本金" renderer="Leaf.formatMoney" width="100"/>
                    <a:column name="contract_status_n" align="center" prompt="合同状态" width="100"/>
                    <a:column name="legal_status_n" align="center" prompt="法务状态" width="100"/>
                    <a:column name="lawsuit_status_n" align="center" prompt="诉讼状态" width="100"/>
                    <a:column name="all_file_confirm_status_n" align="right" prompt="付款状态" width="100"/>
                    <a:column name="document_type" align="center" prompt="租赁类型" width="100"/>
                    <a:column name="company_id_n" align="right" prompt="公司名称" width="100"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>