<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Icon  
    $Date: 2014-10-27 上午10:23:11  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure><![CDATA[
		
	]]></a:init-procedure>
    <a:view>
        <a:link id="csh_payment_readOnly_link" url="${/request/@context_path}/modules/csh/CSH506/csh_payment_readonly.lview"/>
        <script type="text/javascript"><![CDATA[
			function csh506_payment_reset() {
			    $('csh_payment_req_query_ds').reset();
			}
			
			function csh506_payment_query() {
			    $('csh_payment_req_queryDs').query();
			}
			
			function csh506_payment_print() {
			    var records=$('csh_payment_req_queryDs').getSelected();
				if(records.length<1) {
				    Leaf.showMessage('${l:PROMPT}', '请至少选择一条记录');
				    return;
				}
				for(var i=0;i<records.length;i++) {
				    if(records[i].get('print_status')!='PRINT') {
				        Leaf.showMessage('${l:PROMPT}', '状态必须为待打印!');
				    	return;
				    }
				    records[i].set('_status', 'update', false);
				}
				$('csh_payment_req_queryDs').submitSelected('${/request/@context_path}/autocrud/csh.CSH506.csh_payment_print_query/batch_update');
			}
			
			function csh_payment_submitsuccess(ds) {
			    $('csh_payment_req_query_ds').reset();
			    $('csh_payment_req_queryDs').query();
			}
			
			function render_objectDs_grid(value, record, name) {
                if (!record.isNew) {
                    return '<a href="javascript:winOpen_req_pay_readOnly(' + record.get('payment_req_id') + ')">' + value + '</a>';
                }          
            }
            
            function winOpen_req_pay_readOnly(payment_req_id) {
                new Leaf.Window({
                    id: 'csh_payment_readOnly_window',
                    url: $('csh_payment_readOnly_link').getUrl(),
                    params: {
                        payment_req_id: payment_req_id
                    },
                    title: '',
                    fullScreen: true
                });
            }
		]]></script>
        <a:dataSets>
            <a:dataSet id="csh_payment_req_query_ds">
                <a:fields>
                    <a:field name="amount_from"/>
                    <a:field name="amount_to"/>
                    <a:field name="bp_code_from" lovGridHeight="350" lovHeight="500" lovService="basic.hls_bp_master_v_for_lov" lovWidth="500">
                        <a:mapping>
                            <a:map from="bp_code" to="bp_code_from"/>
                            <a:map from="bp_name" to="bp_code_desc_from"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_code_to" lovGridHeight="350" lovHeight="500" lovService="basic.hls_bp_master_v_for_lov" lovWidth="500">
                        <a:mapping>
                            <a:map from="bp_code" to="bp_code_to"/>
                            <a:map from="bp_name" to="bp_code_desc_to"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="csh_payment_req_queryDs" autoPageSize="true" autoQuery="true" model="csh.CSH506.csh_payment_print_query" queryDataSet="csh_payment_req_query_ds" selectable="true">
                <a:events>
                    <a:event name="submitsuccess" handler="csh_payment_submitsuccess"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="csh506_payment_reset" text="HLS.RESET"/>
                <a:gridButton click="csh506_payment_query" text="HAP_QUERY"/>
                <a:gridButton click="csh506_payment_print" text="付款承诺书打印"/>
                <!-- <a:gridButton click="csh502_payment_close" text="HLS.CLOSE"/> -->
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="100" title="CSH501.CSH_REQ_MAINTAIN">
                <a:textField name="payment_req_number_from" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_REQ_NO_FROM" width="150"/>
                <a:textField name="payment_req_number_to" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_REQ_NO_TO" width="150"/>
                <a:datePicker name="req_date_from" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_REQ_DATE_FROM" width="150"/>
                <a:datePicker name="req_date_to" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_REQ_DATE_TO" width="150"/>
                <a:lov name="bp_code_from" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_PAYMENT_OBJ_FROM" width="150">
                    <a:events>
                        <a:event name="focus" handler="function(object){on_std_focus(object,&apos;BP&apos;)}"/>
                    </a:events>
                </a:lov>
                <a:lov name="bp_code_to" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_PAYMENT_OBJ_TO" width="150">
                    <a:events>
                        <a:event name="focus" handler="function(object){on_std_focus(object,&apos;BP&apos;)}"/>
                    </a:events>
                </a:lov>
                <a:numberField name="amount_from" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_APPLIED_TOTAL_AMOUNT_FROM" width="150"/>
                <a:numberField name="amount_to" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_APPLIED_TOTAL_AMOUNT_TO" width="150"/>
                <!-- <a:textField name="submitted_flag" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_SUBMIT_STATE" width="150"/> -->
                <!-- <a:checkBox name="closed_flag" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_CLOSED_FLAG" width="70"/> -->
            </a:form>
            <a:grid id="csh_payment_req_grid_ds" bindTarget="csh_payment_req_queryDs" marginHeight="230" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="payment_req_number" prompt="CSH502.CSH_REQ_NO" renderer="render_objectDs_grid" width="150"/>
                    <a:column name="req_date" prompt="CSH502.CSH_REQ_DATE"/>
                    <!-- <a:column name="document_type_dis" prompt="CSH502.CSH_REQ_TYPE"/> -->
                    <a:column name="bp_code" prompt="CSH501.CSH_PAYMENT_OBJ"/>
                    <a:column name="bp_name" prompt="CSH501.CSH_PAYMENT_OBJ_NAME" width="170"/>
                    <a:column name="apply_amount" align="right" prompt="CSH501.CSH_APPLIED_TOTAL_AMOUNT" renderer="Leaf.formatMoney" width="130"/>
                    <!-- <a:column name="bp_category_dis" prompt="CSH502.CSH_OBJ_CATEGORY"/> -->
                    <a:column name="print_status_n" prompt="打印状态" width="70"/>
                    <!-- <a:column name="closed_flag" editor="grid_checkbox" prompt="CSH502.CSH_CLOSED_FLAG"/> -->
                </a:columns>
                <a:editors>
                    <a:checkBox id="grid_checkbox"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>