hls_calc_estimate.lview 21.1 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 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: xuls  
    $Date: 2017-2-20 下午4:26:13  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true">
    <a:init-procedure/>
    <a:view>
        <a:link id="prj507_hls_calc_estimate_link" url="${/request/@context_path}/modules/prj/PRJ507/hls_calc_estimate.lview"/>
        <script type="text/javascript"><![CDATA[
            //保存submitsuccess调用
            window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res) {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                //
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_fin_calculator_hd');
                if (ds_id) {
                    record = $(ds_id).getAt(0);
                    var ln_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_fin_calculator_ln');
                    var calc_session_id = $(ds_id).getAt(0).get('calc_session_id');
                    Leaf.request({
                        url: '${/request/@context_path}/autocrud/prj.PRJ507.calc_quotation/update',
                        para: {
                            calc_session_id: calc_session_id
                        },
                        success: function(res) {
                            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            $(ln_ds_id).setQueryParameter('calc_session_id', calc_session_id);
                            $(ln_ds_id).query();
                            $(ds_id).setQueryParameter('calc_session_id', calc_session_id);
                            $(ds_id).query();
                        },
                        scope: this
                    });
                    // var calculator_hd_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_fin_calculator_hd');
            
                    // window.location.href = $('prj507_hls_calc_estimate_link').getUrl() + '?calc_session_id=' + calc_session_id + '&layout_code=HLS_RENT_CALC&function_code=PRJ507';
                }
                
            };
            
            
            
            // window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function(ds, record, name, value, old_value, bp_seq) {
            // var hls_estimate_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_calc_estimate');
            // if (hls_estimate_ds_id == ds.id) {
            // if (name == 'product_plan_id') {
            // var down_payment_ratio = record.get('down_payment_ratio');
            // var finance_amount = record.get('finance_amount');
            // record.set('down_payment', '');
            // record.set('discount', '');
            // record.set('invoice_price');
            // if (down_payment_ratio) {
            // record.set('down_payment_ratio', down_payment_ratio);
            // }
            // if (finance_amount) {
            // record.set('finance_amount', finance_amount);
            // }
            // } else if (name == 'discount_method') {
            // /* if(value == 'NO_DISCOUNT'){
            // record.set('discount_limit_flag','');
            // record.set('discount_limit_flag_n','');
            // record.getField('discount_limit_flag_n').setReadOnly(true);
            // }else if(value == 'DISCOUNT'){
            // record.getField('discount_limit_flag_n').setReadOnly(false);
            // } */
            // }
            // if (name == 'series_id_n') {
            // record.getField('product_plan_id_n').setLovPara('series_id', record.get('series_id'));
            // }
            // if(name=='discount_method_n'){
            // record.getField('product_plan_id_n').setLovPara('discount_method',record.get('discount_method'));
            // }
            // if(name=='discount_method'){
            // record.getField('product_plan_id_n').setLovPara('discount_method',record.get('discount_method'));
            // }
            // if(name=='times'){
            // record.getField('product_plan_id_n').setLovPara('times',record.get('times'));
            // }
            // if (name == 'lease_times') {
            // var min_dp_ratio = record.get('min_dp_ratio');
            // var min_dp_ratio_visit = record.get('min_dp_ratio_visit');
            // var times_limit = record.get('times_limit');
            // var times_limit_visit = record.get('times_limit_visit');
            // var finance_amt_max = record.get('finance_amt_max');
            // var finance_amt_max_visit = record.get('finance_amt_max_visit');
            // var finance_amount = record.get('finance_amount');
            // var down_payment_ratio = record.get('down_payment_ratio');
            // var lease_times_temp = record.get('lease_times_temp');
            // if (!lease_times_temp) {
            // record.getField('lease_times').setReadOnly(false);
            // } else {
            // record.getField('lease_times').setReadOnly(true);
            // }
            // if (Ext.isEmpty(times_limit) && Ext.isEmpty(min_dp_ratio) && Ext.isEmpty(finance_amt_max)) {
            // record.set('gps_install_flag', 'Y');
            // record.set('gps_install_flag_n', '是');
            // } else {
            // if (Ext.isEmpty(times_limit)) {
            // times_limit = value;
            // }
            // if (Ext.isEmpty(min_dp_ratio)) {
            // min_dp_ratio = 0;
            // }
            // if (Ext.isEmpty(finance_amt_max)) {
            // finance_amt_max = 999999999999;
            // }
            // if (value == times_limit && down_payment_ratio >= min_dp_ratio && finance_amount <= finance_amt_max) {
            // record.set('gps_install_flag', 'N');
            // record.set('gps_install_flag_n', '否');
            // } else {
            // record.set('gps_install_flag', 'Y');
            // record.set('gps_install_flag_n', '是');
            // }
            // }
            // if (Ext.isEmpty(times_limit_visit) && Ext.isEmpty(min_dp_ratio_visit) && Ext.isEmpty(finance_amt_max_visit)) {
            // record.set('visit_flag', 'Y');
            // record.set('visit_flag_n', '是');
            // } else {
            // if (Ext.isEmpty(times_limit_visit)) {
            // times_limit_visit = value;
            // }
            // if (Ext.isEmpty(min_dp_ratio_visit)) {
            // min_dp_ratio_visit = 0;
            // }
            // if (Ext.isEmpty(finance_amt_max_visit)) {
            // finance_amt_max_visit = 999999999999;
            // }
            // if (value == times_limit_visit && down_payment_ratio >= min_dp_ratio_visit && finance_amount <= finance_amt_max_visit) {
            // record.set('visit_flag', 'N');
            // record.set('visit_flag_n', '否');
            // } else {
            // record.set('visit_flag', 'Y');
            // record.set('visit_flag_n', '是');
            // }
            // }
            // } else if (name == 'min_dp_ratio' || name == 'min_dp_ratio_visit' || name == 'finance_amt_max_visit' || name == 'finance_amt_max' || name == 'times_limit' || name == 'times_limit_visit') {
            // var min_dp_ratio = record.get('min_dp_ratio');
            // var min_dp_ratio_visit = record.get('min_dp_ratio_visit');
            // var times_limit = record.get('times_limit');
            // var times_limit_visit = record.get('times_limit_visit');
            // var finance_amt_max = record.get('finance_amt_max');
            // var finance_amt_max_visit = record.get('finance_amt_max_visit');
            // var finance_amount = record.get('finance_amount');
            // var down_payment_ratio = record.get('down_payment_ratio');
            // if (Ext.isEmpty(times_limit) && Ext.isEmpty(min_dp_ratio) && Ext.isEmpty(finance_amt_max)) {
            // record.set('gps_install_flag', 'Y');
            // record.set('gps_install_flag_n', '是');
            // } else {
            // if (Ext.isEmpty(times_limit)) {
            // times_limit = value;
            // }
            // if (Ext.isEmpty(min_dp_ratio)) {
            // min_dp_ratio = 0;
            // }
            // if (Ext.isEmpty(finance_amt_max)) {
            // finance_amt_max = 999999999999;
            // }
            // if (value == times_limit && down_payment_ratio >= min_dp_ratio && finance_amount <= finance_amt_max) {
            // record.set('gps_install_flag', 'N');
            // record.set('gps_install_flag_n', '否');
            // } else {
            // record.set('gps_install_flag', 'Y');
            // record.set('gps_install_flag_n', '是');
            // }
            // }
            // if (Ext.isEmpty(times_limit_visit) && Ext.isEmpty(min_dp_ratio_visit) && Ext.isEmpty(finance_amt_max_visit)) {
            // record.set('visit_flag', 'Y');
            // record.set('visit_flag_n', '是');
            // } else {
            // if (Ext.isEmpty(times_limit_visit)) {
            // times_limit_visit = value;
            // }
            // if (Ext.isEmpty(min_dp_ratio_visit)) {
            // min_dp_ratio_visit = 0;
            // }
            // if (Ext.isEmpty(finance_amt_max_visit)) {
            // finance_amt_max_visit = 999999999999;
            // }
            // if (value == times_limit_visit && down_payment_ratio >= min_dp_ratio_visit && finance_amount <= finance_amt_max_visit) {
            // record.set('visit_flag', 'N');
            // record.set('visit_flag_n', '否');
            // } else {
            // record.set('visit_flag', 'Y');
            // record.set('visit_flag_n', '是');
            // }
            // }
            
            // }
            // if (name == 'down_payment_ratio') {
            // var min_dp_ratio = record.get('min_dp_ratio');
            // var min_dp_ratio_visit = record.get('min_dp_ratio_visit');
            // var times_limit = record.get('times_limit');
            // var times_limit_visit = record.get('times_limit_visit');
            // var finance_amt_max = record.get('finance_amt_max');
            // var finance_amt_max_visit = record.get('finance_amt_max_visit');
            // var finance_amount = record.get('finance_amount');
            // var lease_times = record.get('lease_times');
            // if (Ext.isEmpty(times_limit) && Ext.isEmpty(min_dp_ratio) && Ext.isEmpty(finance_amt_max)) {
            // record.set('gps_install_flag', 'Y');
            // record.set('gps_install_flag_n', '是');
            // } else {
            // if (Ext.isEmpty(times_limit)) {
            // times_limit = lease_times;
            // }
            // if (Ext.isEmpty(min_dp_ratio)) {
            // min_dp_ratio = 0;
            // }
            // if (Ext.isEmpty(finance_amt_max)) {
            // finance_amt_max = 999999999999;
            // }
            // if (lease_times == times_limit && value >= min_dp_ratio && finance_amount <= finance_amt_max) {
            // record.set('gps_install_flag', 'N');
            // record.set('gps_install_flag_n', '否');
            // } else {
            // record.set('gps_install_flag', 'Y');
            // record.set('gps_install_flag_n', '是');
            // }
            // }
            // if (Ext.isEmpty(times_limit_visit) && Ext.isEmpty(min_dp_ratio_visit) && Ext.isEmpty(finance_amt_max_visit)) {
            // record.set('visit_flag', 'Y');
            // record.set('visit_flag_n', '是');
            // } else {
            // if (Ext.isEmpty(times_limit_visit)) {
            // times_limit_visit = lease_times;
            // }
            // if (Ext.isEmpty(min_dp_ratio_visit)) {
            // min_dp_ratio_visit = 0;
            // }
            // if (Ext.isEmpty(finance_amt_max_visit)) {
            // finance_amt_max_visit = 999999999999;
            // }
            // if (lease_times == times_limit_visit && value >= min_dp_ratio_visit && finance_amount <= finance_amt_max_visit) {
            // record.set('visit_flag', 'N');
            // record.set('visit_flag_n', '否');
            // } else {
            // record.set('visit_flag', 'Y');
            // record.set('visit_flag_n', '是');
            // }
            // }
            // }
            // if (name == 'deposit_ratio') {
            // if (value != 0) {
            // record.getField('deposit_deduction_n').setReadOnly(false);
            // record.set('deposit_deduction_n', '最后几期租金');
            // record.set('deposit_deduction', 'K');
            // } else {
            // record.getField('deposit_deduction_n').setReadOnly(true);
            // record.set('deposit_deduction_n', '');
            // record.set('deposit_deduction', '');
            // }
            // var finance_amount = record.get('finance_amount') || 0;
            // var deposit = parseInt(finance_amount) * parseFloat(value);
            // record.set('deposit', deposit);
            // }
            // if (name == 'down_payment') {
            // var invoice_price = record.get('invoice_price') || 0;
            // var insurance_amount = record.get('insurance_amount') || 0;
            // var purchase_tax = record.get('purchase_tax') || 0;
            // var plate_price = record.get('plate_price') || 0;
            // var down_payment_ratio = parseInt(value) / (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price));
            // var finance_amount = parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price) - parseInt(value);
            // record.set('finance_amount', finance_amount);
            // record.set('down_payment_ratio', down_payment_ratio);
            // }
            // if (name == 'invoice_price') {
            // var down_payment = record.get('down_payment') || 0;
            // var insurance_amount = record.get('insurance_amount') || 0;
            // var purchase_tax = record.get('purchase_tax') || 0;
            // var plate_price = record.get('plate_price') || 0;
            // var balloon_ratio = record.get('balloon_ratio') || 0;
            // var balloon = parseFloat(balloon_ratio) * (parseInt(value) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price));
            // record.set('balloon', balloon);
            // if (down_payment) {
            // var finance_amount = parseInt(value) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price) - parseInt(down_payment);
            // record.set('finance_amount', finance_amount);
            // var down_payment_ratio = parseInt(down_payment) / (parseInt(value) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price));
            // record.set('down_payment_ratio', down_payment_ratio);
            // }
            // }
            // if (name == 'finance_amount') {
            // var deposit_ratio = record.get('deposit_ratio') || 0;
            // 0
            // var deposit = parseFloat(deposit_ratio) * parseInt(value);
            // var lease_charge_ratio = record.get('lease_charge_ratio') || 0;
            // var lease_charge = parseFloat(lease_charge_ratio) * parseInt(value);
            // record.set('deposit', deposit);
            // record.set('lease_charge', lease_charge);
            // var down_payment_ratio = parseInt(value) / (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price));
            // }
            // if (name == 'balloon_ratio') {
            // var invoice_price = record.get('invoice_price') || 0;
            // var insurance_amount = record.get('insurance_amount') || 0;
            // var purchase_tax = record.get('purchase_tax') || 0;
            // var plate_price = record.get('plate_price') || 0;
            // var balloon = parseFloat(value) * (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(plate_price));
            // record.set('balloon', balloon);
            // }
            // if (name == 'license_fee_flag') {
            // if (value == 'N') {
            // record.getField('plate_price').setReadOnly(true);
            // record.getField('plate_price').setRequired(false);
            // record.set('plate_price', '');
            // } else {
            // record.getField('plate_price').setReadOnly(false);
            // record.getField('plate_price').setRequired(true);
            // }
            // }
            // if (name == 'insurance_flag') {
            // if (value == 'N') {
            // record.getField('insurance_amount').setReadOnly(true);
            // record.getField('insurance_purchase_n').setReadOnly(true);
            // record.getField('insurance_amount').setRequired(false);
            // record.getField('insurance_purchase_n').setRequired(false);
            // record.set('insurance_purchase_n', '其他');
            // record.set('insurance_purchase', 'OTHER');
            // record.set('insurance_amount', '');
            // } else {
            // record.getField('insurance_amount').setReadOnly(false);
            // record.getField('insurance_purchase_n').setReadOnly(false);
            // record.getField('insurance_amount').setRequired(true);
            // record.getField('insurance_purchase_n').setRequired(true);
            // }
            // }
            // if (name == 'purchase_tax_flag') {
            // if (value == 'N') {
            // record.getField('purchase_tax').setReadOnly(true);
            // record.getField('purchase_tax').setRequired(false);
            // record.set('purchase_tax', '');
            // } else {
            // record.getField('purchase_tax').setReadOnly(false);
            // record.getField('purchase_tax').setRequired(true);
            // }
            // }
            // if (name == 'plate_price') {
            // var invoice_price = record.get('invoice_price') || 0;
            // var insurance_amount = record.get('insurance_amount') || 0;
            // var purchase_tax = record.get('purchase_tax') || 0;
            // var down_payment = record.get('down_payment') || 0;
            // var balloon_ratio = record.get('balloon_ratio') || 0;
            // var balloon = parseFloat(balloon_ratio) * (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(value));
            // record.set('balloon', balloon);
            // var finance_amount = parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(value) - parseInt(down_payment);
            // var down_payment_ratio = parseInt(down_payment) / (parseInt(value) + parseInt(insurance_amount) + parseInt(purchase_tax) + parseInt(invoice_price));
            // record.set('finance_amount', finance_amount);
            // record.set('down_payment_ratio', down_payment_ratio);
            // }
            // if (name == 'purchase_tax') {
            // var invoice_price = record.get('invoice_price') || 0;
            // var insurance_amount = record.get('insurance_amount') || 0;
            // var plate_price = record.get('plate_price') || 0;
            // var down_payment = record.get('down_payment') || 0;
            // var balloon_ratio = record.get('balloon_ratio') || 0;
            // var balloon = parseFloat(balloon_ratio) * (parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(value) + parseInt(plate_price));
            // record.set('balloon', balloon);
            // var finance_amount = parseInt(invoice_price) + parseInt(insurance_amount) + parseInt(plate_price) + parseInt(value) - parseInt(down_payment);
            // var down_payment_ratio = parseInt(down_payment) / (parseInt(value) + parseInt(insurance_amount) + parseInt(plate_price) + parseInt(invoice_price));
            // record.set('finance_amount', finance_amount);
            // record.set('down_payment_ratio', down_payment_ratio);
            // }
            // if (name == 'insurance_amount') {
            // var invoice_price = record.get('invoice_price') || 0;
            // var plate_price = record.get('plate_price') || 0;
            // var purchase_tax = record.get('purchase_tax') || 0;
            // var down_payment = record.get('down_payment') || 0;
            // var balloon_ratio = record.get('balloon_ratio') || 0;
            // var balloon = parseFloat(balloon_ratio) * (parseInt(invoice_price) + parseInt(value) + parseInt(purchase_tax) + parseInt(plate_price));
            // record.set('balloon', balloon);
            // var finance_amount = parseInt(invoice_price) + parseInt(plate_price) + parseInt(purchase_tax) + parseInt(value) - parseInt(down_payment);
            // var down_payment_ratio = parseInt(down_payment) / (parseInt(value) + parseInt(plate_price) + parseInt(purchase_tax) + parseInt(invoice_price));
            // record.set('finance_amount', finance_amount);
            // record.set('down_payment_ratio', down_payment_ratio);
            // } else if (name == 'lease_charge_ratio') {
            // var finance_amount = record.get('finance_amount') || 0;
            // var lease_charge = parseFloat(value) * parseInt(finance_amount)
            // record.set('lease_charge', lease_charge);
            // }
            // }
            
            // };
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>