hls_journal_merge_details.lview 4.14 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Clocc  
    $Date: 2015-9-11 下午2:16:27  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:view>
        <a:link id="hls531_journal_merge_link" model="hls.HLS531.hls_journal_merge" modelaction="batch_update"/>
        <script type="text/javascript"><![CDATA[
            function hls531_merge_journal() {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
                var ds = $('hls531_result_ds');
                var status_record = $('hls531_query_ds').getCurrentRecord();
                var calc_date = status_record.get('calc_date');
                var records = ds.getSelected();
                if (records.length == 0) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请选择数据!');
                    return;
                }
                var datas = [];
                for (var i = 0;i < records.length;i++) {
                    var obj = {};
                    obj['journal_date'] = calc_date;
                    obj['je_transaction_code'] = records[i].get('je_transaction_code');
                    obj['_status'] = 'execute';
                    datas[i] = obj;
                }
                Leaf.showConfirm('${l:PROMPT}', '确认合并?', function() {
                    journal_submit_merge(datas);
                });
            }
            
            function journal_submit_merge(datas) {
                Leaf.request({
                    url: $('hls531_journal_merge_link').getUrl(),
                    para: datas,
                    success: function(res) {
                        Leaf.Masker.unmask(Ext.getBody());
                        Leaf.SideBar.show({
                            msg: '${l:HLS.SUBMIT_SUCCESS}',
                            duration: 2000
                        });
                        $('hls531_result_ds').query();
                    },
                    failure: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function() {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
            }
            
            function queryFunction() {
                var record = $('hls531_query_ds').getCurrentRecord();
                if (record && record.get('calc_date')) {
                    eg_rpt100_head_query();
                } else {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请输入凭证日期!');
                    return;
                }
            }
            
            function eg_rpt100_head_query() {
                $('hls531_result_ds').query();
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="hls531_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="calc_date"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls531_result_ds" autoPageSize="true" autoQuery="true" model="hls.HLS531.hls_journal_merge_detail" queryDataSet="hls531_query_ds" selectable="true"><![CDATA[
            ]]></a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="queryFunction" text="刷新"/>
                <a:gridButton click="hls531_merge_journal" text="合并"/>
            </a:screenTopToolbar>
            <a:form bindTarget="hls531_query_ds" column="4" labelWidth="130">
                <a:datePicker name="calc_date" bindTarget="hls531_query_ds" prompt="凭证日期"/>
            </a:form>
            <a:grid id="hls531_result_ds_id" bindTarget="hls531_result_ds" height="430" navBar="true" width="850">
                <a:columns>
                    <a:column name="je_transaction_code" prompt="凭证事务代码" width="230"/>
                    <a:column name="je_transaction_desc" prompt="凭证事务描述" width="160"/>
                    <a:column name="seq" prompt="数量"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>