gld_period_status.lview 9.9 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 99 100 101 102 103 104 105
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: zhangyi2652 $
    $Date: 2010/11/03 04:08:03 $
    $Revision: 1.1 $
    $Purpose: "会计期间控制"页面文件
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <a:model-query autoCount="false" fetchAll="true" model="gld.FND5800.gld_period_status_fieldset" rootPath="fieldset"/>
    </a:init-procedure>
    <a:view>
        <a:link id="gld_period_pkg_init_period_link" model="db.gld_period_pkg.init_period" modelaction="update"/>
        <a:link id="gld_period_pkg_close_period_link" model="db.gld_period_pkg.close_period" modelaction="execute"/>
        <a:link id="gld_period_pkg_open_period_link" model="db.gld_period_pkg.open_period" modelaction="execute"/>
        <script type="text/javascript"><![CDATA[
            function openPeriodDs(value, record, name) {
                
                var period_status_code = record.get('period_status_code');
                var ds = "close_open_ds";
                if (period_status_code == 'C' || period_status_code == 'U') {
                    var url = $('gld_period_pkg_open_period_link').getUrl();
                    return '<a href="javascript:executeOpen(\'' + ds + '\',\'' + url + '\',' + record.id + ')">${l:OPEN_PERIOD}</a>';
                } else if (period_status_code == 'O') {
                    return '';
                }
            }
            
            function closePeriodDs(value, record, name) {
                var period_status_code = record.get('period_status_code');
                var ds = "close_open_ds";
                if (period_status_code == 'C' || period_status_code == 'U') {
                    return '';
                } else if (period_status_code == 'O') {
                    var url = $('gld_period_pkg_close_period_link').getUrl();
                    return '<a href="javascript:executeClose(\'' + ds + '\',\'' + url + '\',' + record.id + ')">${l:CLOSE_PERIOD}</a>';
                }
            }
          
            
            function statusRenderer(value, record, name) {
                
                if (value == null || value == undefined) {
                    return '${l:PROMPT.NOT_OPEN}';
                } else if (value == 'O') {
                    return '${l:PROMPT.OPENED}';
                } else if (value == 'C') {
                    return '${l:PROMPT.CLOSED}';
                }
            }
            
            function executeOpen(ds, url, id) {
                	record = $(ds).findById(id);
                    Leaf.request({
                        url: url,
                        para: record.data,
                        success: function() {
            				
            				record.set('period_status_code','O');
            			    Leaf.SideBar.enable = true;
                            Leaf.SideBar.show({
                                msg: '打开成功',
                                duration: 3000
                            });
            
                        },
                        scope: this
                    });
            }
            
            function executeClose(ds, url, id) {
                record = $(ds).findById(id);
                if ($('close_open_ds').getAll().length == 0) {
                    Leaf.request({
                        url: $('gld_period_pkg_init_period_link').getUrl(),
                        para: record.data,
                        success: function() {
            					Leaf.showMessage('${l:PROMPT}', '${l:FND_DIMENSION_VALUES.OPR_SUC}', function(cmp) {
                                document.location.reload();
                                cmp.close();
                            });
                        },
                        scope: this
                    });
                } else {
                    Leaf.request({
                        url: url,
                        para: record.data,
                        success: function() {
                           
                            record.set('period_status_code','C');
                            
                           	Leaf.SideBar.enable = true;
                            Leaf.SideBar.show({
                                msg: '关闭成功',
                                duration: 3000
                            });
            
                        },
                        scope: this
                    });
                }
            }
            
            
106 107 108 109 110
            // function doQuery() {
            //     $('close_open_ds').setQueryParameter('period_set_code', '${/model/fieldset/record/@period_set_code}');
            //     $('close_open_ds').query();
            //
            // }
Spencer Chang's avatar
Spencer Chang committed
111 112
            
            function find_index() {
113 114 115 116 117 118
               // var close_open_ds = $('close_open_ds');
              //  var ds_length = close_open_ds.getAll().length;
              //  var internal_period_num_max = close_open_ds.getCurrentRecord(0).get('internal_period_num_max');
              //  var record = close_open_ds.find('internal_period_num', internal_period_num_max);
              //  var index = close_open_ds.indexOf(record);
             //   index = index + 3;
Spencer Chang's avatar
Spencer Chang committed
119 120
            
                // 如果查询的数据是倒数第一条至倒数第三条,则直接定位到倒数第一条
121 122 123 124 125
                // if (index > ds_length) {
                //     close_open_ds.locate(ds_length);
                // } else {
                //     close_open_ds.locate(index);
                // }
Spencer Chang's avatar
Spencer Chang committed
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
            
            }
            function monthly_closed_flag_save(){
                $('close_open_ds').submit();
            }
            
            function close_open_cellclick(grid, row, name, record){
                if (name == 'monthly_closed_flag_desc') {
                    grid.setEditor('monthly_closed_flag_desc','closed_grid_comb');
                }
                
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="monthly_closed_flag_ds" lookupCode="YES_NO"/>
            <a:dataSet id="status_fieldset_ds">
                <a:datas dataSource="/model/fieldset"/>
                <a:fields>
                    <a:field name="period_set_code" prompt="GLD_PERIOD_SET.PERIOD_SET_CODE" readOnly="true"/>
                    <a:field name="total_period_num" prompt="GLD_PERIOD_SET.TOTAL_PERIOD_NUM" readOnly="true"/>
                    <a:field name="period_set_name" prompt="GLD_PERIOD_SET.PERIOD_SET_NAME" readOnly="true"/>
                    <a:field name="company_short_name" prompt="FND_COMPANIES.COMPANY_SHORT_NAME" readOnly="true"/>
                </a:fields>
            </a:dataSet>
150
            <a:dataSet selectable="true" selectionModel="single" id="close_open_ds" autoQuery="true" fetchAll="true" model="gld.FND5800.gld_period_status_u_query" queryDataSet="status_fieldset_ds" queryUrl="${/request/@context_path}/autocrud/gld.FND5800.gld_period_status_u_query/query?period_set_code=${/model/fieldset/record/@period_set_code}">
Spencer Chang's avatar
Spencer Chang committed
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
                <a:fields>
                    <a:field name="monthly_closed_flag_desc" displayField="code_value_name" options="monthly_closed_flag_ds" returnField="monthly_closed_flag" valueField="code_value"/>
                </a:fields>
                <a:events>
                    <a:event name="load" handler="find_index"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton id="monthly_closed_flag_save_id" click="monthly_closed_flag_save" text="HLS.SAVE"/>
            </a:screenTopToolbar>
            <a:fieldSet column="4" marginWidth="30" title="GLD_PERIOD_STATUS.TITLE">
                <a:textField name="period_set_code" bindTarget="status_fieldset_ds"/>
                <a:textField name="total_period_num" bindTarget="status_fieldset_ds"/>
                <a:textField name="period_set_name" bindTarget="status_fieldset_ds"/>
                <a:textField name="company_short_name" bindTarget="status_fieldset_ds"/>
            </a:fieldSet>
169
            <a:grid id="close_open_grid" bindTarget="close_open_ds" marginHeight="165" marginWidth="30" >
Spencer Chang's avatar
Spencer Chang committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
                <a:columns>
                    <a:column name="period_year" align="center" prompt="GLD_PERIODS.PERIOD_YEAR" sortable="true" width="100"/>
                    <a:column name="period_num" align="center" prompt="FND_DIMENSIONS.DIMENSION_SEQUENCE" sortable="true" width="80"/>
                    <a:column name="start_date_c" align="center" prompt="GLD_EXCHANGE_RATE.START_DATE" sortable="true" width="150"/>
                    <a:column name="end_date_c" align="center" prompt="GLD_EXCHANGE_RATE.END_DATE" sortable="true" width="150"/>
                    <a:column name="quarter_num" align="center" prompt="GLD_PERIOD_STATUS.QUARTER" sortable="true" width="80"/>
                    <a:column name="period_name" align="center" prompt="GLD_PERIODS.PERIOD_NAME" sortable="true" width="120"/>
                    <a:column name="adjustment_flag" align="center" prompt="GLD_PERIOD_STATUS.ADJUST" width="70"/>
                    <a:column name="period_status_code" align="center" prompt="GLD_PERIOD_STATUS.PERIOD_STATUS" renderer="statusRenderer" width="100"/>
                    <a:column name="monthly_closed_flag_desc" align="center" prompt="月结关闭标志" width="100"/>
                    <a:column name="actionOpen" align="center" prompt="HLS.OPEN_PERIOD" renderer="openPeriodDs" sortable="true" width="120"/>
                    <a:column name="actionClose" align="center" prompt="HLS.CLOSE_PERIOD" renderer="closePeriodDs" sortable="true" width="120"/>
                </a:columns>
                <a:editors>
                    <a:checkBox id="closed_grid_cb"/>
                    <a:comboBox id="closed_grid_comb"/>
                </a:editors>
                <a:events>
                    <a:event name="cellclick" handler="close_open_cellclick"/>
                </a:events>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>