<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true"
          trace="true">
    <a:view>
        <a:link id="hn9040_project_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
                modelaction="update"/>
        <a:link id="ap_invoice_confirm_link" model="acp.ACP523.ap_invoice_confirm" modelaction="update"/>
        <script><![CDATA[
        //确认按钮
        window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'],'acp_invoice_ln');
            var records = $(ds_id).getSelected();
            if (records.length == 0) {
                Leaf.showMessage('${l:PROMPT}', '${l:HLS.SELECT_RECORD}');
                return;
            }
            var record = records[0];
            var imported_by = record.get('imported_by');
            if(imported_by == '${/session/@user_id}'){
                Leaf.showMessage('${l:PROMPT}', '导入人与确认人相同!');
                return false;
            }
            Leaf.request({
                url: $('ap_invoice_confirm_link').getUrl(),
                para: {
                    contract_id: record.get('contract_id'),
                    invoice_line_id: record.get('invoice_line_id')
                },
                scope: this,
                success: function () {
                    Leaf.SideBar.show({
                        msg: '确认成功',
                        duration: 2000
                    });
                    $(ds_id).query();
                }
            })

        };

            ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>