<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ronghui.xu  
    $Date: 2012-3-27 上午17:17:44  
    $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="fnd_set_book_asign_com_link" url="${/request/@context_path}/modules/fnd/FND2410/pur_sys_vender_asign_com.lsc"/>
        <script type="text/javascript"><![CDATA[
            function FND2510_saveFunction() {
                
                var records = $('fnd_set_book_batch_assign_result_ds').getSelected();
                if (records.length < 1) {
                    Leaf.showMessage('${l:PROMPT}', '${l:PROMPT.PLEASE_SELECT}');
                    return false;
                }
                for(var i=0;i<records.length;i++){
                    records[i].set('responsibility_center_id','${/parameter/@responsibility_center_id}');
                }
               $('fnd_set_book_batch_assign_result_ds').submitSelected();
            }
            
            function FND2510_On_submitsuccess_result_ds() {
                Leaf.showInfoMessage('${l:PROMPT}','${l:FND_CODING_RULE_DET.OPER_SUC}',null,250,100);
                $('fnd_set_book_resp_company_ds').query();
             
            }
            
           
            function FND2510_query_company() {
                $('fnd_set_book_batch_assign_result_ds').query();
            }
            
            function FND2510_reset() {
                $('fnd_set_book_batch_assign_query_ds').reset();
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="fnd_set_book_batch_assign_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="company_code"/>
                    <a:field name="company_code_from_display" autoComplete="true" autoCompleteField="company_code" lovGridHeight="320" lovHeight="450" lovService="fnd.fnd_companies?set_of_books_id=${/parameter/@set_of_books_id}" lovWidth="500" title="FND_COMPANIES.COMPANY_FROM">
                        <a:mapping>
                            <a:map from="company_code_name" to="company_code_from_display"/>
                            <a:map from="company_code" to="company_code_from"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="company_code_to_display" autoComplete="true" autoCompleteField="company_code" lovGridHeight="320" lovHeight="450" lovService="fnd.fnd_companies?set_of_books_id=${/parameter/@set_of_books_id}" lovWidth="500" title="FND_COMPANIES.COMPANY_TO">
                        <a:mapping>
                            <a:map from="company_code_name" to="company_code_to_display"/>
                            <a:map from="company_code" to="company_code_to"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="vender_id" defaultValue="${/parameter/@vender_id}"/>
                    <a:field name="payment_term_id" defaultValue="${/parameter/@payment_term_id}"/>
                    <a:field name="currency_code" defaultValue="${/parameter/@currency_code}"/>
                    <a:field name="tax_type_id" defaultValue="${/parameter/@tax_type_id}"/>
                    <a:field name="approved_vender_flag" defaultValue="${/parameter/@approved_vender_flag}"/>
                    <a:field name="payment_method" defaultValue="${/parameter/@payment_method}"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="fnd_set_book_batch_assign_result_ds" autoCreate="true" autoQuery="true" fetchAll="false" model="fnd.FND2515.ord_system_customers_assign_company" pageSize="10" queryDataSet="fnd_set_book_batch_assign_query_ds" queryUrl="${/request/@context_path}/autocrud/fnd.FND2515.ord_system_customers_assign_company/query?set_of_books_id=${/parameter/@set_of_books_id}" selectable="true" submitUrl="${/request/@context_path}/autocrud/fnd.FND2510.fnd_set_book_resp_assign_com/batch_update">
                <a:fields>
                    <a:field name="responsibility_center_id" defaultValue="${/parameter/@responsibility_center_id}"/>
                </a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="FND2510_On_submitsuccess_result_ds"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:form title="PUR_BUYERS_COMPANY_ASSIGN.BATCH_COMPANY" width="550">
                <a:vBox>
                    <a:hBox>
                        <a:lov name="company_code_from_display" bindTarget="fnd_set_book_batch_assign_query_ds" prompt="FND_COMPANIES.COMPANY_FROM"/>
                        <a:lov name="company_code_to_display" bindTarget="fnd_set_book_batch_assign_query_ds" prompt="FND_COMPANIES.COMPANY_TO"/>
                    </a:hBox>
                </a:vBox>
            </a:form>
            <a:hBox>
                <a:button click="FND2510_query_company" text="HAP_QUERY"/>
                <a:button click="FND2510_reset" text="HAP_RESET"/>
            </a:hBox>
            <a:grid bindTarget="fnd_set_book_batch_assign_result_ds" height="330" navBar="true" width="545">
                <a:toolBar>
                    <a:button click="FND2510_saveFunction" icon="${/request/@context_path}/images/save.gif" style="height:16px;" text="PUR_BUYERS_COMPANY_ASSIGN.ASSIGN"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="company_code" prompt="COMPANY_CODE" width="200"/>
                    <a:column name="company_short_name" prompt="FND_COMPANIES.COMPANY_SHORT_NAME" width="200"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>