<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qhw  
    $Date: 2012-7-24 上午10:19:05  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure/>
    <a:view>
        <a:link id="FND1100_csh_sob_companies_link" url="${/request/@context_path}/modules/gld/FND1100/fnd_sob_batch_companiex.lsc"/>
        <a:link id="FND1100_csh_payment_assign_com_link" url="${/request/@context_path}/modules/gld/FND1100/fnd_payment_customers_assign_com_batch_hct.lview"/>
        <script type="text/javascript"><![CDATA[
            function FND011_saveAssignCom() {
                var companyData = $('FND1100_exp_sob_companies_ds').getJsonData(true);
                if(companyData.length == 0){
						Leaf.showInfoMessage('${l:PROMPT}','${l:PROMPT.SELECT_LINE_DATE}',null,250,100);
				        return ;				    
				} 
                Leaf.request({
                    url: $('FND1100_csh_sob_companies_link').getUrl(),
                    para: companyData,
                    success: FND1100_closeAssignPage,
                    scope: this
                });
            }
            
            function FND1100_closeAssignPage() {
                $('gld_exchange_rates_assign_com').close();
            }
            
            function codeEditFunction(record, name) {
                record.getMeta().getField('company_code').setLovPara('exchange_rate_id','${/parameter/@p_exchange_rate_id}'); 
                if (!record.isNew) {
                    return '';
                } else {
                    return 'relation_grid_lov';
                }
            }
            
            function FND1100_loadtype() {
                new Leaf.Window({
                    id: 'fnd_payment_customers_assign_com_id',
                    url: /*csh_payment_customers_assign_com_batch_hct.screen*/
                    $('FND1100_csh_payment_assign_com_link').getUrl() + '?exchange_rate_id=${/parameter/@p_exchange_rate_id}&set_of_books_id=${/parameter/@p_set_of_books_id}',
                    title: '${l:PROMPT.BATCH_ADD}',
                    height: 520,
                    width: 540
                });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="FND1100_system_customers_assign_com_ds" autoCreate="true">
                <a:fields>
                    <a:field name="currency_code" defaultValue="${/parameter/@currency_code}" readOnly="true"/>
                    <a:field name="currency_name" defaultValue="${/parameter/@currency_name}" readOnly="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="FND1100_exp_sob_companies_ds" autoQuery="true" model="gld.FND1100.fnd_assign_batch_query" queryUrl="${/request/@context_path}/autocrud/gld.FND1100.fnd_assign_batch_query/query?exchange_rate_id=${/parameter/@p_exchange_rate_id}&amp;set_of_books_id=${/parameter/@p_set_of_books_id}" selectable="true" submitUrl="${/request/@context_path}/modules/gld/FND1100/fnd_sob_batch_companiex.lsc?exchange_rate_id=${/parameter/@p_exchange_rate_id}">
                <a:fields>
                    <a:field name="company_code" autoComplete="true" lovGridHeight="300" lovHeight="450" lovService="gld.FND1100.fnd_assign_batch_lov?exchange_rate_id=${/parameter/@p_exchange_rate_id}&amp;set_of_books_id=${/parameter/@p_set_of_books_id}" lovWidth="500" prompt="FND_COMPANIES.COMPANY_TO" required="true" title="FND_COMPANIES.COMPANY_TO">
                        <a:mapping>
                            <a:map from="company_short_name" to="company_short_name"/>
                            <a:map from="company_code" to="company_code"/>
                            <a:map from="company_id" to="company_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="exchange_rate_id" defaultValue="${/parameter/@p_exchange_rate_id}"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:fieldSet column="2" title="BGT_BUDGET_ITEM_TYPES.BUDGET_ITEM_TYPE_CODE">
                <a:hBox>
                    <a:textField name="to_currency" bindTarget="gld_exchange_rate_detail_grid_ds" prompt="GLD_EXCHANGE_RATES.TO_CURRENCY_CODE" readOnly="TRUE" width="120"/>
                    <a:textField name="currency_name" bindTarget="gld_exchange_rate_detail_grid_ds" prompt="GLD_CURRENCY.CURRENCY_NAME" readOnly="TRUE" width="176"/>
                </a:hBox>
            </a:fieldSet>
            <a:hBox>
                <!--批量添加公司-->
                <a:button click="FND1100_loadtype" text="PROMPT.BATCH_ADD" width="90"/>
                <a:button click="FND1100_closeAssignPage" text="HAP_BACK" width="90"/>
            </a:hBox>
            <a:grid bindTarget="FND1100_exp_sob_companies_ds" height="340" navBar="true" width="468">
                <a:toolBar>
                    <a:button type="add"/>
                    <a:button type="clear"/>
                    <a:button type="save"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="company_code" Width="130" align="center" editorFunction="codeEditFunction" prompt="FND_COMPANIES.COMPANY_CODE"/>
                    <a:column name="company_short_name" Width="310" prompt="FND_COMPANIES_VL.COMPANY_SHORT_NAME"/>
                </a:columns>
                <a:editors>
                    <a:lov id="relation_grid_lov"/>
                    <a:checkBox id="check_box1"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>