<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <a:link id="acr_invoice_vat_link" url="${/request/@context_path}/modules/acr/ACR515/acr_invoice_vat.lview"/>
        <a:link id="acr_invoice_import_link" url="${/request/@context_path}/modules/acr/ACR515/acr_invoice_import_upload.lview"/>
        <script type="text/javascript"><![CDATA[

            function back_func() { 
                window.location.href = $('acr_invoice_vat_link').getUrl();
            }
            function query_func(){
                $('tbl_cust_docmaster_ds').query();
            }
            function reset_func(){
                $('excel_query_ds').reset();
            }
            
            function excel_import() {
                $('import_id').disable();
                var win = new Leaf.Window({
                    id: 'upload_handle_winId',
                    params: {
                        session_id: '${/session/@session_id}' 
                    },
                    url: $('acr_invoice_import_link').getUrl(),
                    title: '金税Excel导入',
                    width: 420,
                    height: 275
                });
                win.on('close', function() {
                    $('import_id').enable();
                });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="excel_query_ds">
                <a:fields>
                    <a:field name="document_number_f"/>
                    <a:field name="document_number_t"/>
                    <a:field name="customername"/>
                    <a:field name="productname"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="tbl_cust_docmaster_ds" autoQuery="true" queryDataSet="excel_query_ds" queryUrl="${/request/@context_path}/autocrud/acr.ACR515.tbl_cust_docmaster/query"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="back_func" text="HLS.BACK"/>
                <a:gridButton click="query_func" text="HLS.QUERY"/>
                <a:gridButton click="reset_func" text="HLS.RESET"/>
                <a:gridButton bind="tbl_cust_docmaster_grid" type="excel" width="80"/>
                <a:gridButton id="import_id" click="excel_import" text="HLS.IMPORT"/>
            </a:screenTopToolbar>
            <a:form column="1" marginWidth="30" padding="0" title="导出数据查询">
                <a:hBox labelSeparator="">
                    <a:textField name="document_number_f" bindTarget="excel_query_ds" prompt="HLS.DOCUMENT_NUMBER_FROM" width="135"/>
                    <a:textField name="document_number_t" bindTarget="excel_query_ds" prompt="HLS.DOCUMENT_NUMBER_TO" width="135"/>
                    <a:textField name="customername" bindTarget="excel_query_ds" prompt="购方名称" width="135"/>
                    <a:textField name="productname" bindTarget="excel_query_ds" prompt="主要商品名称" width="135"/>
                </a:hBox>
            </a:form>
            <a:grid id="tbl_cust_docmaster_grid" bindTarget="tbl_cust_docmaster_ds" marginHeight="250" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="documentnr" align="left" prompt="单据号" width="120"/>
                    <a:column name="customername" align="left" prompt="购货方名称" width="120"/>
                    <a:column name="customertaxnr" align="left" prompt="税号" width="120"/>
                    <a:column name="customeraddresstel" align="left" prompt="地址电话" width="120"/>
                    <a:column name="customerbankaccountnr" align="left" prompt="银行账号" width="120"/>
                    <a:column name="productname" align="left" prompt="商品名称" width="120"/>
                    <a:column name="productspec" align="left" prompt="规格型号" width="120"/>
                    <a:column name="productunit" align="left" prompt="计量单位" width="120"/>
                    <a:column name="productquantity" align="left" prompt="数量" width="120"/>
                    <a:column name="productvalue_before" align="right" prompt="单价" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="taxrate" align="right" prompt="税率" width="120"/>
                    <a:column name="net_amount" align="right" prompt="金额" renderer="Leaf.formatMoney" width="120"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>