hls_financial_test.lview 11.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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: ericyin  
    $Date: 2013-3-26 上午11:06:41  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="sys_service_welcome_link" url="${/request/@context_path}/welcome.lview"/>
        <script type="text/javascript"><![CDATA[
            function hls_test_back() {
                history.go(-1);
            }
            
            function hls_test_next() {
                history.go(1);
            }
            
            function hls_test_quit() {
                location.href = $('sys_service_welcome_link').getUrl();
                parent.shMenu('show');
            }
            
            function hls_test_grid_clear() {
                $('hls_test_result_ds_grid').clear();
            }
            
            function cal_pv() {
                if (!$('hls_test_head_ds').validate()) {
                    return;
                }
                var head_rec = $('hls_test_head_ds').getAt(0);
                head_rec.set('function_type','PV');
                head_rec.set('_status','update');
                var param = [];
                param.push(head_rec.data); 
                
                Leaf.request({
                    url: '${/request/@context_path}/autocrud/hls.HLS_TST.hls_financial_test_tmp/batch_update',
                    para: param,
                    success: function(response) {
                        //
                        var result_value = response.result.record.return_value;
                        if (result_value == -1) {
                            Leaf.showMessage('提示', 'rate、nper、pmt不能为空!');
                        } else{
                            var result1_rec = $('hls_test_result1_ds').getAt(0);
                            result1_rec.set('pv',result_value);
                        }
                    },
                    scope: this
                });
            }
            
            function cal_fv() {
                if (!$('hls_test_head_ds').validate()) {
                    return;
                }
                var head_rec = $('hls_test_head_ds').getAt(0);
                head_rec.set('function_type','FV');
                head_rec.set('_status','update');
                var param = [];
                param.push(head_rec.data); 
                
                Leaf.request({
                    url: '${/request/@context_path}/autocrud/hls.HLS_TST.hls_financial_test_tmp/batch_update',
                    para: param,
                    success: function(response) {
                        //
                        var result_value = response.result.record.return_value;
                        if (result_value == -1) {
                            Leaf.showMessage('提示', 'rate、nper、pmt不能为空!');
                        } else{
                            var result1_rec = $('hls_test_result1_ds').getAt(0);
                            result1_rec.set('fv',result_value);
                        }
                    },
                    scope: this
                });
            }
            /*
            function cal_rate() {
                if (!$('hls_test_head_ds').validate()) {
                    return;
                }
                var head_rec = $('hls_test_head_ds').getAt(0);
                head_rec.set('function_type','RATE');
                head_rec.set('_status','update');
                var param = [];
                param.push(head_rec.data); 
                
                Leaf.request({
                    url: '${/request/@context_path}/autocrud/hls.HLS_TST.hls_financial_test_tmp/batch_update',
                    para: param,
                    success: function(response) {
                        //
                        var result_value = response.result.record.return_value;
                        if (result_value == -1) {
                            Leaf.showMessage('提示', 'rate、nper、pmt不能为空!');
                        } else{
                            var result1_rec = $('hls_test_result1_ds').getAt(0);
                            result1_rec.set('pv',result_value);
                        }
                    },
                    scope: this
                });
            }
            */
            function cal_pmt() {
                if (!$('hls_test_head_ds').validate()) {
                    return;
                }
                var head_rec = $('hls_test_head_ds').getAt(0);
                head_rec.set('function_type','PMT');
                head_rec.set('_status','update');
                var param = [];
                param.push(head_rec.data); 
                
                Leaf.request({
                    url: '${/request/@context_path}/autocrud/hls.HLS_TST.hls_financial_test_tmp/batch_update',
                    para: param,
                    success: function(response) {
                        //
                        var result_value = response.result.record.return_value;
                        if (result_value == -1) {
                            Leaf.showMessage('提示', 'rate、nper、pv不能为空!');
                        } else{
                            $('hls_test_result2_ds').query();
                        }
                    },
                    scope: this
                });
            }
            
            function cal_ipmt() {
                if (!$('hls_test_head_ds').validate()) {
                    return;
                }
                var head_rec = $('hls_test_head_ds').getAt(0);
                head_rec.set('function_type','IPMT');
                head_rec.set('_status','update');
                var param = [];
                param.push(head_rec.data); 
                
                Leaf.request({
                    url: '${/request/@context_path}/autocrud/hls.HLS_TST.hls_financial_test_tmp/batch_update',
                    para: param,
                    success: function(response) {
                        //
                        var result_value = response.result.record.return_value;
                        if (result_value == -1) {
                            Leaf.showMessage('提示', 'rate、nper、pv不能为空!');
                        } else{
                            $('hls_test_result2_ds').query();
                        }
                    },
                    scope: this
                });
            }
            
            function hls_test_excel(){
                $('hls_test_result_ds_grid')._export();
            }
            
            function formatMoney(v){
                return Leaf.formatNumber(v,8);
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="type_ds">
                <a:datas>
                    <a:record name="0" value="0"/>
                    <a:record name="1" value="1"/>
                </a:datas>
            </a:dataSet>
            <a:dataSet id="hls_test_head_ds" autoCreate="true">
                <a:fields>
                    <a:field name="pv" datatype="java.lang.Long"/>
                    <a:field name="fv" datatype="java.lang.Long"/>
                    <a:field name="rate" datatype="java.lang.Long"/>
                    <a:field name="pmt" datatype="java.lang.Long"/>
                    <a:field name="nper" datatype="java.lang.Long"/>
                    <a:field name="type_desc" datatype="java.lang.Long" displayField="name" options="type_ds" returnField="type" valueField="value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls_test_result1_ds" autoCreate="true">
                <a:fields>
                    <a:field name="pv" readOnly="true"/>
                    <a:field name="fv" readOnly="true"/>
                    <a:field name="rate" readOnly="true"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="hls_test_result2_ds" autoQuery="true" model="hls.HLS_TST.hls_financial_test_tmp" pageSize="50" selectable="true">
                <a:fields>
                    <a:field name="per" readOnly="true"/>
                    <a:field name="pmt" readOnly="true"/>
                    <a:field name="ipmt" readOnly="true"/>
                    <a:field name="outstanding" readOnly="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar height="29">
                <a:button click="hls_test_back" height="20" icon="${/request/@context_path}/images/back.png" iconAlign="left" text="HLS.BACK" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="hls_test_next" height="20" icon="${/request/@context_path}/images/forward.png" iconAlign="left" text="HLS.FORWARD" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="hls_test_quit" height="20" icon="${/request/@context_path}/images/quit.png" iconAlign="left" text="HLS.EXIT" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="hls_test_grid_clear" height="20" icon="${/request/@context_path}/images/clear.png" iconAlign="left" text="HLS.CLEAR" width="50"/>
                <a:separator style="margin-left:3px;"/>
                <a:button click="hls_test_excel" height="20" icon="${/request/@context_path}/images/excel_16.png" iconAlign="left" text="导出" width="50"/>
                <a:separator style="margin-left:3px;"/>
            </a:screenTopToolbar>
            <a:hBox>
                <a:form column="2" title="租赁测算表" width="500">
                    <a:numberField name="pv" allowFormat="true" bindTarget="hls_test_head_ds" decimalPrecision="2" prompt="PV"/>
                    <a:numberField name="nper" bindTarget="hls_test_head_ds" decimalPrecision="0" prompt="NPER"/>
                    <a:numberField name="fv" allowFormat="true" bindTarget="hls_test_head_ds" decimalPrecision="2" prompt="FV"/>
                    <a:comboBox name="type_desc" bindTarget="hls_test_head_ds" prompt="TYPE"/>
                    <a:numberField name="rate" allowDecimals="true" allowFormat="true" bindTarget="hls_test_head_ds" decimalPrecision="10" prompt="RATE"/>
                    <a:numberField name="pmt" allowFormat="true" bindTarget="hls_test_head_ds" decimalPrecision="2" prompt="PMT"/>
                </a:form>
                <a:vBox>
                    <a:form column="3" title="显示结果" width="500">
                        <a:numberField name="pv" allowFormat="true" bindTarget="hls_test_result1_ds" decimalPrecision="8" prompt="PV"/>
                        <a:numberField name="fv" allowFormat="true" bindTarget="hls_test_result1_ds" decimalPrecision="8" prompt="FV"/>
                        <a:numberField name="rate" allowFormat="true" bindTarget="hls_test_result1_ds" decimalPrecision="8" prompt="RATE"/>
                    </a:form>
                    <a:hBox>
                        <a:button id="b_pv" click="cal_pv" text="PV"/>
                        <a:button id="b_fv" click="cal_fv" text="FV"/>
                        <a:button id="b_irr" text="IRR"/>
                        <a:button id="b_pmt" click="cal_pmt" text="PMT"/>
                        <a:button id="b_ipmt" click="cal_ipmt" text="IPMT"/>
                    </a:hBox>
                </a:vBox>
            </a:hBox>
            <a:grid id="hls_test_result_ds_grid" Height="450" bindTarget="hls_test_result2_ds" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="per" prompt="PER" width="100"/>
                    <a:column name="pmt" prompt="PMT" renderer="formatMoney" width="140"/>
                    <a:column name="ipmt" prompt="IPMT" renderer="formatMoney" width="140"/>
                    <a:column name="outstanding" prompt="本金余额" renderer="formatMoney" width="140"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>