vender_deposit_query.lview 14.4 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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qianming  
    $Date: 2014-8-27 上午11:06:56  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" dynamiccreateenabled="true" trace="true">
    <a:init-procedure/>
    <a:view package="leaf.ui.std" template="default">
        <a:link id="save_pay_check_link" model="csh.CSH560.save_pay_check" modelaction=""/>
        <a:link id="csh560_check_wfl_link" model="csh.CSH560.return_workflow_start" modelaction="query"/>
        <a:link id="con505_hls_bp_master_query_link" url="${/request/@context_path}/modules/cont/CON505/hls_bp_master_query.lview"/>
        <a:link id="csh560_get_layout_link" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="csh560_deposit_return_link" url="${/request/@context_path}/modules/csh/CSH560/vender_deposit_return.lview"/>
        <script type="text/javascript"><![CDATA[
        	function reset(){
        	    $('vender_deposit_query_ds').reset();
        	} 	
        	function query(){
        	    $('vender_deposit_result_ds').query();
        	}
        	
        	function bp_query(value, record, name) {
                return '<a href="javascript:winOpen_req_pay(\'' + record.id + '\')">' + value + '</a>';
           }
            function winOpen_req_pay(record_id) {

                var record = $('vender_deposit_result_ds').findById(record_id);
                var param = record.data;
                param['function_code'] = 'CON505H';
                param['function_usage'] = 'MODIFY';
                param['url_title'] = '商业伙伴';
                hls_doc_get_layout_code('csh560_get_layout_link', param, 'con505_hls_bp_master_query_link', record.ds.id,'${/parameter/@layout_code}');
  			 }
  			         	
        	function in_query(){
        	    var transaction_id = $('vender_deposit_result_ds').getSelected()[0].get('transaction_id');
        	    var bp_id = $('vender_deposit_result_ds').getSelected()[0].get('bp_id');
        	    $('vender_deposit_in_ds').setQueryParameter('bp_id',bp_id);
        	    $('vender_deposit_out_ds').setQueryParameter('bp_id',bp_id);
        	    $('vender_deposit_out_ds').query();
        	    $('vender_deposit_in_ds').query();
        	}
        	function selectHandler(ds,rec){
        	    in_query();
        	}
        	function updateHandler(ds,rec,name,val,oldVal){
        	    query();
        	}
        	function deposit_deduction(){

        	    var bp_id = $('vender_deposit_result_ds').getSelected()[0].get('bp_id');
        	    var bp_code = $('vender_deposit_result_ds').getSelected()[0].get('bp_code');
        	    var bp_name = $('vender_deposit_result_ds').getSelected()[0].get('bp_name'); 
        Leaf.request({
            url: $('csh560_check_wfl_link').getUrl(),
            para: {
                bp_id: bp_id
            },
            success: function(res) {
                var check_flag = res.result.record.check_flag;
				if (check_flag == 'Y' || check_flag == 'D' || check_flag == 'R'){
				    Leaf.showMessage('提示','已经有工作流在审批中');
				}else{
	        	    window.location = '${/request/@context_path}/modules/csh/CSH513/csh_transaction_receipt_write_off.lview?deposit_flag=Y&bp_id='+bp_id+'&bp_code='+bp_code+'&bp_name='+bp_name+'&limit_flag=Y&limit2_flag=Y&limit3_flag=N&type=DEPOSIT&bp_limit_flag=Y';
				}
            },
            error: function(res) {
            },
            faliure: function() {
            },
            scope: this
        });   	    
        	}
        	function achieve_status_rendener(val,rec,name){
        	    if(rec.get('contract_number') == '--'){
        	        return val;
        	    }else{
        	        return '未归档';
        	    }
        	}
        	function return_deposit(){
        	    var record = $('vender_deposit_result_ds').getCurrentRecord();
        	    var transaction_amount = record.get('transaction_amount')||0;
        	    var bp_id = record.get('bp_id');
        	    var deposit_total_amount = record.get('deposit_total_amount');
        	    Leaf.request({
            url: $('csh560_check_wfl_link').getUrl(),
            para: {
                bp_id: bp_id
            },
            success: function(res) {
                var check_flag = res.result.record.check_flag;
				if (check_flag == 'Y' || check_flag == 'D'){
				    Leaf.showMessage('提示','已经有工作流在审批中');
				}else{
					if (transaction_amount <=0){
					    Leaf.showMessage('提示','该保证金没有金额可以被退还');
					    return;
					}
					var param = record.data;
					param['function_code'] = 'CSH560R';
					param['url_title'] = '收款退款';
					param['bp_id'] = bp_id;
					param['deposit_total_amount'] = deposit_total_amount;
					hls_doc_get_layout_code('csh560_get_layout_link', param, 'csh560_deposit_return_link', null);
				}
            },
            error: function(res) {
            },
            faliure: function() {
            },
            scope: this
        });
        	}
        	function save_pay_check(){
        	    var records = $('vender_deposit_in_ds').getJsonData(false);
                var datas = [];
                for (var i = 0;i < records.length;i++) {
                 var obj1 = {};
                 obj1['pay_check'] = records[i]['pay_check'];
                 obj1['write_off_id'] = records[i]['write_off_id'];
                 obj1['_status'] = 'update';
                 datas.push(obj1);
                }
            	Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
                Leaf.request({
                    url: '${/request/@context_path}/autocrud/csh.CSH560.save_pay_check/batch_update',
                    para: datas,
                    success: function() {
						Leaf.SideBar.show({
                    			msg: '${l:HLS.SUBMIT_SUCCESS}',
                    			duration: 2000
                				});
        	    		Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
                Leaf.Masker.unmask(Ext.getBody());
        	}
        	
        	function numberRenderer(value,ds,name){
 				return Leaf.formatMoney(value,2);
 			}
        ]]></script>
        <a:dataSets>
            <a:dataSet id="hls_bp_category_ds" loadData="true" model="csh.CSH560.hls_bp_category">
                <a:fields>
                    <a:field name="bp_category"/>
                    <a:field name="description"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="agent_type_ds" lookupCode="HLS_AGENT_TYPE"/>
            <a:dataSet id="quarter_ds" lookupCode="HLS_QUARTER"/>
            <a:dataSet id="month_ds" lookupCode="HLS_MONTHLY"/>
            <a:dataSet id="transfer_type_ds" lookupCode="CSH_DEPOSIT_TRANSFER_TYPE"/>
            <a:dataSet id="vender_deposit_query_ds">
                <a:fields>
                    <a:field name="bp_id"/>
                    <a:field name="bp_name" lovHeight="480" lovService="csh.CSH560.hls_bp_master" lovWidth="510" prompt="商业伙伴名称" title="商业伙伴信息">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id"/>
                            <a:map from="bp_name" to="bp_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_category"/>
                    <a:field name="agent_type_n" displayField="code_value_name" options="agent_type_ds" prompt="经销商类型" returnField="agent_type" valueField="code_value"/>
                    <a:field name="deposit_total_amount_from" prompt="保证金余额从"/>
                    <a:field name="deposit_total_amount_to" prompt="保证金余额到"/>
                    <a:field name="cf_item_desc" displayField="code_value_name" options="transfer_type_ds" prompt="收入项目" returnField="cf_item" valueField="code_value"/>
                    <a:field name="write_off_type_dis" prompt="支出项目"/>
                    <a:field name="write_off_date_from" prompt="收入时间从"/>
                    <a:field name="write_off_date_to" prompt="收入时间到"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="updateHandler"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="vender_deposit_result_ds" autoQuery="true" model="csh.CSH560.vender_deposit_query" pageSize="6" queryDataSet="vender_deposit_query_ds" selectable="true" selectionModel="single">
                <a:events>
                    <a:event name="select" handler="selectHandler"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="vender_deposit_in_ds" autoQuery="true" model="csh.CSH560.vander_deposit_in" pageSize="5" queryDataSet="vender_deposit_query_ds">
                <a:fields>
                    <a:field name="quarter_flag_n" displayField="code_value_name" options="quarter_ds" readOnly="true" returnField="quarter_flag" valueField="code_value"/>
                    <a:field name="month_flag_n" displayField="code_value_name" options="month_ds" readOnly="true" returnField="month_flag" valueField="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="vender_deposit_out_ds" autoQuery="true" model="csh.CSH560.vender_deposit_out" pageSize="5" queryDataSet="vender_deposit_query_ds"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="reset" text="HLS.RESET"/>
                <a:gridButton click="query" text="HLS.QUERY"/>
                <a:gridButton click="deposit_deduction" text="保证金抵扣"/>
                <a:gridButton click="return_deposit" text="保证金退还"/>
                <a:gridButton click="save_pay_check" text="保存"/>
            </a:screenTopToolbar>
            <a:form title="查询条件" width="1065">
                <a:hBox labelWidth="100">
                    <a:lov name="bp_name" bindTarget="vender_deposit_query_ds"/>
                    <a:comboBox name="agent_type_n" bindTarget="vender_deposit_query_ds"/>
                    <a:numberField name="deposit_total_amount_from" bindTarget="vender_deposit_query_ds"/>
                    <a:numberField name="deposit_total_amount_to" bindTarget="vender_deposit_query_ds"/>
                </a:hBox>
                <a:hBox labelWidth="100">
                    <a:comboBox name="cf_item_desc" bindTarget="vender_deposit_query_ds"/>
                    <a:datePicker name="write_off_date_from" bindTarget="vender_deposit_query_ds"/>
                    <a:datePicker name="write_off_date_to" bindTarget="vender_deposit_query_ds"/>
                </a:hBox>
                <a:hBox labelWidth="100"><![CDATA[

                ]]></a:hBox>
            </a:form>
            <a:grid bindTarget="vender_deposit_result_ds" height="228" navBar="true" width="1065">
                <a:toolBar>
                    <a:button type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="bp_code" width="150"/>
                    <a:column name="bp_name" renderer="bp_query" width="220"/>
                    <a:column name="agent_type_n"/>
                    <a:column name="deposit_total_amount" align="right" renderer="numberRenderer"/>
                    <!--                     <a:column name="fin_amount_num" align="right"/>
                    <a:column name="credit_amount" align="right"/> -->
                </a:columns>
            </a:grid>
            <a:tabPanel height="210" width="1175">
                <a:tabs>
                    <a:tab prompt="保证金收入明细" width="120">
                        <a:grid bindTarget="vender_deposit_in_ds" height="180" navBar="true" width="1120">
                            <a:toolBar>
                                <a:button type="excel"/>
                            </a:toolBar>
                            <a:columns>
                                <a:column name="contract_number" prompt="合同编号" width="120"/>
                                <a:column name="bp_name" prompt="承租人" width="100"/>
                                <a:column name="cf_item_desc" prompt="收入项目"/>
                                <a:column name="write_off_due_amount" align="right" prompt="保证金收入"/>
                                <a:column name="write_off_date" prompt="收入时间" width="80"/>
                                <a:column name="lease_times" prompt="租赁期数"/>
                                <a:column name="year_flag" prompt="年度"/>
                                <a:column name="quarter_flag_n" editor="combo_edit" prompt="季度"/>
                                <a:column name="month_flag_n" editor="combo_edit" prompt="月度"/>
                                <a:column name="description" prompt="备注"/>
                                <a:column name="pay_check" editor="text_edit" prompt="支付审核"/>
                            </a:columns>
                            <a:editors>
                                <a:comboBox id="combo_edit"/>
                                <a:textField id="text_edit"/>
                            </a:editors>
                        </a:grid>
                    </a:tab>
                    <a:tab prompt="保证金支出明细" width="120">
                        <a:grid bindTarget="vender_deposit_out_ds" height="180" navBar="true" width="855">
                            <a:toolBar>
                                <a:button type="excel"/>
                            </a:toolBar>
                            <a:columns>
                                <a:column name="contract_number" prompt="合同编号" width="120"/>
                                <a:column name="bp_name" prompt="承租人" width="200"/>
                                <a:column name="write_off_type_dis" prompt="支出项目"/>
                                <a:column name="write_off_due_amount" align="right" prompt="保证金支出"/>
                                <a:column name="write_off_date" prompt="支出时间" width="80"/>
                                <a:column name="lease_times" prompt="租赁期数"/>
                                <a:column name="description" prompt="备注"/>
                            </a:columns>
                        </a:grid>
                    </a:tab>
                </a:tabs>
            </a:tabPanel>
        </a:screenBody>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>