csh_transaction_receipt.lview 47.3 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2
<?xml version="1.0" encoding="UTF-8"?>
<!--
3 4
    $Author: sf
    $Date: 2019-9-16 下午03:19:57
5 6
    $Revision: 1.0
    $Purpose:
Spencer Chang's avatar
Spencer Chang committed
7 8 9
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure>
Darming's avatar
Darming committed
10 11
        <a:model-query defaultWhereClause="t1.enabled_flag=&apos;Y&apos;" fetchAll="true"
                       model="basic.csh_payment_method_for_lov" rootPath="payment_method_path"/>
Spencer Chang's avatar
Spencer Chang committed
12 13 14
        <a:model-query fetchAll="true" model="gld.gld_currency_vl" rootPath="currency"/>
        <a:model-query fetchAll="true" model="gld.gld_exchangerate_type_lov" rootPath="exchangerate_type_path"/>
        <a:model-query fetchAll="true" model="csh.CSH511.fnd_financial_option" rootPath="fnd_financial_option_path"/>
Darming's avatar
Darming committed
15 16
        <a:model-query fetchAll="true" model="csh.CSH511.csh_transaction_default_exchange_rate_type"
                       rootPath="default_exchange_rate_type_path"/>
Spencer Chang's avatar
Spencer Chang committed
17 18
    </a:init-procedure>
    <a:view>
stone's avatar
stone committed
19
        <a:link id="hn2050_upload_win_link" url="${/request/@context_path}/uploadFile.lview"/>
Darming's avatar
Darming committed
20 21 22 23 24 25
        <a:link id="csh_receipt_import_link"
                url="${/request/@context_path}/modules/csh/CSH511/csh_transaction_receipt_impiort.lview"/>
        <a:link id="csh_transaction_receipt_id"
                url="${/request/@context_path}/modules/csh/CSH511/csh_transaction_receipt.lview"/>
        <a:link id="get_exchange_rate_link_id" model="csh.CSH511.csh_transaction_get_exchange_rate"
                modelaction="query"/>
Spencer Chang's avatar
Spencer Chang committed
26 27 28
        <a:link id="get_period_name_id" model="csh.CSH511.csh_transaction_get_period_name" modelaction="query"/>
        <script src="${/request/@context_path}/javascripts/calculate.js" type="text/javascript"/>
        <a:link id="transaction_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
29 30 31 32
        <a:link id="extra_nam_csh_transaction_receipt_data_link_id"
                model="csh.CSH511.check_extra_nam_count" modelaction="update"/>
        <a:link id="get_extra_nam_csh_transaction_receipt_data_link_id"
                model="csh.CSH511.query_extra_nam_data" modelaction="update"/>
33 34
        <a:link id="get_extra_code_csh_transaction_receipt_data_link_id"
                model="csh.CSH511.query_extra_nam_code" modelaction="update"/>
Spencer Chang's avatar
Spencer Chang committed
35
        <script type="text/javascript"><![CDATA[
Darming's avatar
Darming committed
36 37
        var transaction_id = '';

stone's avatar
stone committed
38 39
        //附件上传
        function upload_attachment_win() {
Darming's avatar
Darming committed
40 41 42 43
            var flag = true;
            if (transaction_id == '') {
                $L.showInfoMessage("提示", '请先保存数据', null, null);
                flag = false;
44 45 46
                return;
            }
            //防止并发
Darming's avatar
Darming committed
47 48 49 50 51 52
            if (flag) {
                var win = new Leaf.Window({
                    id: 'hn2050_upload_win',
                    url: $('hn2050_upload_win_link').getUrl(),
                    params: {
                        winid: 'hn2050_upload_win',
Darming's avatar
Darming committed
53
                        table_name: 'CSH_TRANSACTION',
Darming's avatar
Darming committed
54 55 56 57 58 59 60 61
                        header_id: transaction_id
                    },
                    width: 900,
                    hight: 400
                }).on('close', function () {
                    //record.ds.query();
                });
            }
62

stone's avatar
stone committed
63
        }
64

65
        <!--增加重置功能-->
Darming's avatar
Darming committed
66
        function csh511_receipt_reset() {
67 68
            $('csh_transaction_receipt_head_ds').reset();
        }
Darming's avatar
Darming committed
69

Spencer Chang's avatar
Spencer Chang committed
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
        function csh511_receipt_import_and_write_off() {
            new Leaf.Window({
                url: $('csh_receipt_import_link').getUrl(),
                params: {
                    action_type: 'TRANSACTION_AND_WRITE_OFF'
                },
                title: '收款导入并核销',
                id: 'csh_receipt_import_and_write_off_window',
                fullScreen: true
            });
        }

        function csh511_receipt_import() {
            new Leaf.Window({
                url: $('csh_receipt_import_link').getUrl(),
                params: {
                    action_type: 'TRANSACTION'
                },
                title: '收款导入',
                id: 'csh_receipt_import_window',
                fullScreen: true
            });
        }

        function csh511_receipt_save(flag) {
95
            $('csh511_receipt_save').disable();
Spencer Chang's avatar
Spencer Chang committed
96 97
            if ($('csh_transaction_receipt_head_ds').validate()) {
                var record = $('csh_transaction_receipt_head_ds').getAt(0);
98
				/*if (record.get('collection_classes') == 'COMBINED') {
niminmin's avatar
niminmin committed
99 100 101 102 103
                    if (record.get('paid_byother_flag') != 'T'||record.get('bp_category')!='AGENT') {
                        Leaf.showMessage('${l:PROMPT}', '混合类款项为代理店代付,请检查代付标志和所选商业伙伴!');
                        $('csh511_receipt_save').enable();
                        return;
                    }
104
                }*/
Spencer Chang's avatar
Spencer Chang committed
105 106 107
                if (flag != 'Y') {
                    Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
                }
108

Spencer Chang's avatar
Spencer Chang committed
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
                var saveData = [];
                record.set('receipt_type', 'MANUAL');
                if (flag == 'Y') {
                    record.set('posted_flag', 'Y');
                } else {
                    record.set('posted_flag', 'N');
                }
                record.set('_status', 'insert');
                saveData.push(record.data);
                Leaf.request({
                    url: '${/request/@context_path}/autocrud/csh.CSH511.csh_transaction_receipt_save/batch_update',
                    para: saveData,
                    success: function (res) {
                        //
                        transaction_id = res.result.transaction_id;
124

Spencer Chang's avatar
Spencer Chang committed
125 126 127 128 129
                        Leaf.SideBar.show({
                            msg: '${l:HLS.SUBMIT_SUCCESS}',
                            duration: 2000
                        });
                        // window.location.href = $('csh_transaction_receipt_id').getUrl();
130
                        $('csh511_receipt_save').enable();
Spencer Chang's avatar
Spencer Chang committed
131
                        Leaf.Masker.unmask(Ext.getBody());
Darming's avatar
Darming committed
132
                        $('csh_trx_receipt_id').close();
Spencer Chang's avatar
Spencer Chang committed
133 134
                    },
                    failure: function () {
135
                        $('csh511_receipt_save').enable();
Spencer Chang's avatar
Spencer Chang committed
136 137 138
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function () {
139
                        $('csh511_receipt_save').enable();
Spencer Chang's avatar
Spencer Chang committed
140 141 142 143
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
Darming's avatar
Darming committed
144
            } else {
145
                $('csh511_receipt_save').enable();
Spencer Chang's avatar
Spencer Chang committed
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
            }
        }

        function csh511_receipt_posted() {
            if ($('csh_transaction_receipt_head_ds').validate()) {
                Leaf.Masker.mask(Ext.getBody(), '${l:CSH511.SAVE_AND_POST}');
                csh511_receipt_save('Y');
            }
        }

        function csh511_receipt_back() {
            history.go(-1);
        }

        function onUpdate_csh511_receipt(ds, record, name, value, oldvalue) {
            if (name == 'bp_id') {
                if (value != oldvalue) {
                    record.set('bp_bank_account_id', '');
                    record.set('bp_bank_account_code', '');
                    record.set('bp_bank_account_name', '');
                    record.set('bp_bank_account_num', '');
stone's avatar
stone committed
167
                    record.set('opposite_band_na', '');
Spencer Chang's avatar
Spencer Chang committed
168 169 170 171 172 173 174 175 176 177
                }
                record.getField('bp_bank_account_code').setLovPara('bp_id', value);
            } else if (name == 'currency_code') {
                if (value != oldvalue) {
                    record.set('exchange_rate', '');
                    record.set('exchange_rate_type', '');
                    record.set('rate_method_code', '');
                    record.set('exchange_rate_type_display', '');
                    record.set('exchange_rate_quotation', '');
                    if (oldvalue != null && oldvalue != '') {
stone's avatar
stone committed
178
                        //record.set('transaction_amount', '');
Spencer Chang's avatar
Spencer Chang committed
179 180 181 182 183 184 185 186 187 188 189 190 191
                        record.set('transaction_functional_amount', '');
                    }
                }
                if (value == record.get('functional_currency_code')) {
                    record.getField('exchange_rate_type_display').setRequired(false);
                    record.getField('exchange_rate_type').setReadOnly(true);
                    record.getField('exchange_rate_type_display').setReadOnly(true);
                    record.getField('exchange_rate').setReadOnly(true);
                    record.set('exchange_rate', 1);
                } else {
                    record.set('exchange_rate_type', '${/model/fnd_financial_option_path/record/@default_exchange_rate_type}');
                    record.set('rate_method_code', '${/model/fnd_financial_option_path/record/@rate_method_code}');
                    record.set('exchange_rate_type_display', '${/model/fnd_financial_option_path/record/@exchange_rate_type_display}');
Darming's avatar
Darming committed
192
                    // record.getField('exchange_rate_type_display').setRequired(true);
Spencer Chang's avatar
Spencer Chang committed
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
                    record.getField('exchange_rate_type_display').setReadOnly(false);
                }
            } else if (name == 'rate_method_code' || name == 'period_name') {
                if (record.get('currency_code') != record.get('functional_currency_code')) {
                    var rate_method_code = record.get('rate_method_code');
                    record.set('exchange_rate_quotation', '');
                    record.set('exchange_rate', '');
                    if (rate_method_code == 'PERIOD' || rate_method_code == 'DAILY' || rate_method_code == 'FIXED') {
                        record.getField('exchange_rate').setReadOnly(true);
                        record.set('exchange_rate', '');
                        getExchangeRate({
                            fromCur: record.get('functional_currency_code'),
                            toCur: record.get('currency_code'),
                            exchangeRateType: record.get('exchange_rate_type'),
                            exchangeDate: record.get('transaction_date'),
                            periodName: record.get('period_name')
                        });
                    } else {
                        record.set('exchange_rate_quotation', 'DIRECT QUOTATION');
                        record.getField('exchange_rate').setReadOnly(false);
                        record.set('exchange_rate', '');
                    }
                }
            } else if (name == 'exchange_rate') {
                if (record.get('exchange_rate') != null && record.get('exchange_rate') != '') {
                    setfunctionamount(record);
                } else {
                    record.set('transaction_functional_amount', '');
                }
            } else if (name == 'transaction_amount') {
                if (value === 0 && record.get('zero_amounts_allowed') == 'N') {
                    Leaf.showMessage('${l:PROMPT}', '${l:CSH510.ZERO_AMOUNTS_ALLOWED}');
                }
                if (record.get('currency_code') == record.get('functional_currency_code')) {
                    record.set('transaction_functional_amount', value);
                } else {
                    setfunctionamount(record);
                }
            } else if (name == 'transaction_date') {
                showPeriod(record);
            } else if (name == 'precision') {
                record.getField('transaction_amount').setPropertity('decimalprecision', value);
                record.getField('transaction_functional_amount').setPropertity('decimalprecision', value);
                if (record.get('transaction_amount') || record.get('transaction_amount') == 0) {
                    setfunctionamount(record);
                }
            } else if (name == 'bank_account_id') {
                if (record.get('zero_amounts_allowed') == 'N' && record.get('transaction_amount') === 0) {
                    Leaf.showMessage('${l:PROMPT}', '${l:CSH510.ZERO_AMOUNTS_ALLOWED}');
                }
Darming's avatar
Darming committed
243 244 245 246 247 248
            } else if (name == 'collection_classes') {
                if (value == 'DEPOSIT') {
                    record.set('paid_byother_flag', 'F');
                    record.set('paid_byother_flag_n', '否');
                    record.set('transaction_type', 'DEPOSIT');
                    record.set('deposit_flag', 'Y');
Darming's avatar
Darming committed
249
                    record.set('transaction_type', 'DEPOSIT');
Darming's avatar
Darming committed
250
                    record.getField('paid_byother_flag_n').setReadOnly(true);
18083's avatar
18083 committed
251 252 253
                } else if(value == 'OPERAT_DEPOSIT'){
                    record.set('transaction_type', 'DEPOSIT');
                    record.set('operat_flag', 'Y');
Darming's avatar
Darming committed
254 255
                } else {
                    record.getField('paid_byother_flag_n').setReadOnly(false);
Darming's avatar
Darming committed
256
                    record.set('transaction_type', 'RECEIPT');
Darming's avatar
Darming committed
257
                }
xiaochao's avatar
xiaochao committed
258
            }
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
            // else if(name == 'extra_nam'){
            //     //深圳美鹏
            //     // var extra_nam = record.get('extra_nam');
            //     var bp_code = record.get('bp_code');
            //     //bp_code == 'C00010168'
            //     if (bp_code == 'D00010001' || bp_code == 'D00000009'){
            //         record.getField('guarantor_name_duty_desc').setReadOnly(false);
            //         record.set('guarantor_name_duty_desc','是');
            //         record.set('guarantor_name_duty','Y');
            //         record.getField('guarantor_name_duty_desc').setRequired(true);
            //     }else if (bp_code != 'D00010001' || bp_code == 'D00000009'){
            //         record.getField('guarantor_name_duty_desc').setReadOnly(true);
            //         record.set('guarantor_name_duty_desc','否');
            //         record.set('guarantor_name_duty','N');
            //         record.getField('guarantor_name_duty_desc').setRequired(false);
            //     }
275
            // }
276
            else if (name =='bp_code') {
277 278 279
                var bp_id = record.get('bp_id');
                Leaf.request({
                    url: $('extra_nam_csh_transaction_receipt_data_link_id').getUrl(),
280
                    para: {bp_id: bp_id},
281 282 283 284
                    scope: this,
                    success: function (res) {
                        //先查询数量
                        var count = res.result.extra_name_count;
285 286

                        //根据数量,一个直接查询显示,多个显示空
287
                        if (count == 1) {
288
                            //查询代理点得简称
289 290
                            Leaf.request({
                                url: $('get_extra_nam_csh_transaction_receipt_data_link_id').getUrl(),
291
                                para: {bp_id: bp_id},
292 293 294
                                scope: this,
                                success: function (res) {
                                    var extra_name = res.result.extra_name;
295
                                    record.set('extra_nam', extra_name);
296 297 298
                                    var extra_id = bp_id;
                                    Leaf.request({
                                        url: $('get_extra_code_csh_transaction_receipt_data_link_id').getUrl(),
299
                                        para: {bp_id: extra_id},
300 301 302
                                        scope: this,
                                        success: function (res) {
                                            var unit_code = res.result.unit_code;
303
                                            if (unit_code == 241 || unit_code == 610) {
304
                                                if(record.get('paid_byother_flag') == 'T'){
305 306 307 308
                                                    record.getField('guarantor_name_duty_desc').setReadOnly(false);
                                                    record.set('guarantor_name_duty_desc', '是');
                                                    record.set('guarantor_name_duty', 'Y');
                                                    record.getField('guarantor_name_duty_desc').setRequired(true);
309
                                                }else if(record.get('paid_byother_flag') == 'F'){
310 311 312 313 314 315
                                                    record.getField('guarantor_name_duty_desc').setReadOnly(true);
                                                    record.set('guarantor_name_duty_desc', '否');
                                                    record.set('guarantor_name_duty', 'N');
                                                    record.getField('guarantor_name_duty_desc').setRequired(false);
                                                }
                                            } else if (unit_code != 241 || unit_code != 610) {
xiaochao's avatar
xiaochao committed
316
                                                record.getField('guarantor_name_duty_desc').setReadOnly(true);
317 318
                                                record.set('guarantor_name_duty_desc', ' ');
                                                record.set('guarantor_name_duty', 'NULL');
xiaochao's avatar
xiaochao committed
319
                                                record.getField('guarantor_name_duty_desc').setRequired(false);
320 321 322 323 324 325 326 327 328
                                            }
                                        },
                                        failure: function () {
                                            Leaf.Masker.unmask(Ext.getBody());
                                        },
                                        error: function () {
                                            Leaf.Masker.unmask(Ext.getBody());
                                        }
                                    });
329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
                                },
                                failure: function () {
                                    Leaf.Masker.unmask(Ext.getBody());
                                },
                                error: function () {
                                    Leaf.Masker.unmask(Ext.getBody());
                                }
                            });
                        }
                    },
                    failure: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    }
                });
346 347
            }else if(name == 'paid_byother_flag'){
                if(record.get('paid_byother_flag') =='T'){
348
                    var extra_id = record.get('bp_id');
349
                    if (extra_id != null){
350 351 352 353 354 355 356 357 358 359 360 361 362
                        Leaf.request({
                            url: $('get_extra_code_csh_transaction_receipt_data_link_id').getUrl(),
                            para: {bp_id: extra_id},
                            scope: this,
                            success: function (res) {
                                var unit_code = res.result.unit_code;
                                if (unit_code == 241 || unit_code == 610) {
                                    record.getField('guarantor_name_duty_desc').setReadOnly(false);
                                    record.set('guarantor_name_duty_desc', '是');
                                    record.set('guarantor_name_duty', 'Y');
                                    record.getField('guarantor_name_duty_desc').setRequired(true);
                                } else if (unit_code != 241 || unit_code != 610) {
                                    record.getField('guarantor_name_duty_desc').setReadOnly(true);
363 364
                                    record.set('guarantor_name_duty_desc', '');
                                    record.set('guarantor_name_duty', 'NULL');
365 366 367 368 369 370 371 372 373 374
                                    record.getField('guarantor_name_duty_desc').setRequired(false);
                                }
                            },
                            failure: function () {
                                Leaf.Masker.unmask(Ext.getBody());
                            },
                            error: function () {
                                Leaf.Masker.unmask(Ext.getBody());
                            }
                        });
375
                    }else {
376 377 378 379 380
                        record.getField('guarantor_name_duty_desc').setReadOnly(false);
                        record.set('guarantor_name_duty_desc', '是');
                        record.set('guarantor_name_duty', 'Y');
                        record.getField('guarantor_name_duty_desc').setRequired(true);
                    }
381
                }else if(record.get('paid_byother_flag') =='F'){
382
                    var extra_id = record.get('bp_id');
383
                    if (extra_id != undefined){
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
                        Leaf.request({
                            url: $('get_extra_code_csh_transaction_receipt_data_link_id').getUrl(),
                            para: {bp_id: extra_id},
                            scope: this,
                            success: function (res) {
                                var unit_code = res.result.unit_code;
                                if (unit_code == 241 || unit_code == 610) {
                                    record.getField('guarantor_name_duty_desc').setReadOnly(true);
                                    record.set('guarantor_name_duty_desc', '否');
                                    record.set('guarantor_name_duty', 'N');
                                    record.getField('guarantor_name_duty_desc').setRequired(false);
                                } else if (unit_code != 241 || unit_code != 610) {
                                    record.getField('guarantor_name_duty_desc').setReadOnly(true);
                                    record.set('guarantor_name_duty_desc', '');
                                    record.set('guarantor_name_duty', 'NULL');
                                    record.getField('guarantor_name_duty_desc').setRequired(false);
                                }
                            },
                            failure: function () {
                                Leaf.Masker.unmask(Ext.getBody());
                            },
                            error: function () {
                                Leaf.Masker.unmask(Ext.getBody());
                            }
                        });
409
                    }else {
410 411 412 413 414
                        record.getField('guarantor_name_duty_desc').setReadOnly(true);
                        record.set('guarantor_name_duty_desc', '否');
                        record.set('guarantor_name_duty', 'N');
                        record.getField('guarantor_name_duty_desc').setRequired(false);
                    }
415 416
                }
            }
Spencer Chang's avatar
Spencer Chang committed
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436
        }
        // function onAdd_csh511_receipt(ds, record) {
        // record.set('precision',2);
        // record.set('zero_amounts_allowed','N');
        // record.set('bank_account_id',1531);
        // record.set('bank_account_num','448165800609');
        // record.set('bank_account_name','德融国际融资租赁有限公司');
        // record.set('bank_account_code','0040101');
        // record.set('currency_code','CNY');
        // record.set('currency_name','人民币');
        // }
        function onAdd_csh511_receipt(ds, record) {
            record.set('precision', 2);
            record.set('zero_amounts_allowed', 'N');
            record.set('bank_account_id', 1531);
            // record.set('bank_account_num','448165800609');
            // record.set('bank_account_name','德融国际融资租赁有限公司');
            // record.set('bank_account_code','0040101');
            record.set('currency_code', 'CNY');
            record.set('currency_name', '人民币');
xiaochao's avatar
xiaochao committed
437

xiaochao's avatar
xiaochao committed
438
            record.getField('guarantor_name_duty_desc').setReadOnly(true);
439 440
            record.set('guarantor_name_duty_desc','否');
            record.set('guarantor_name_duty','N');
xiaochao's avatar
xiaochao committed
441

Spencer Chang's avatar
Spencer Chang committed
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537
        }

        function setfunctionamount(record) {
            var quotation = record.get('exchange_rate_quotation');
            var a = record.get('transaction_amount');
            var b = record.get('exchange_rate');
            if (Ext.isDefined(a) && Ext.isDefined(b) && !Ext.isEmpty(a) && !Ext.isEmpty(b)) {
                if (quotation == 'DIRECT QUOTATION') {
                    record.set('transaction_functional_amount', parseFloat(mul(a, b).toFixed(record.get('precision'))));
                } else {
                    record.set('transaction_functional_amount', parseFloat(div(a, b).toFixed(record.get('precision'))));
                }
            }
        }

        function showPeriod(record) {
            var r_date = record.get('transaction_date');
            r_date = Leaf.formatDate(r_date);
            Leaf.request({
                url: $('get_period_name_id').getUrl(),
                para: {
                    p_date: r_date
                },
                success: periodname,
                scope: this
            });
        }

        function periodname(res) {
            var head_record = $('csh_transaction_receipt_head_ds').getAt(0);
            if (res) {
                var period_name = res.result.record.period_name,
                    internal_period_num = res.result.record.internal_period_num;
                if (period_name) {
                    head_record.set('period_name', period_name);
                    head_record.set('internal_period_num', internal_period_num);
                } else {
                    head_record.set('period_name', '');
                    head_record.set('internal_period_num', '');
                    if (head_record.get('transaction_date')) {
                        head_record.set('transaction_date', '');
                        Leaf.showMessage('${l:PROMPT}', '${l:CSH511.PERIOD_ERROR}');
                    }
                }
            }
        }

        function getExchangeRate(param) {
            Leaf.request({
                url: $('get_exchange_rate_link_id').getUrl(),
                para: {
                    from_currency: param.fromCur,
                    to_currency: param.toCur,
                    exchange_date: param.exchangeDate,
                    exchange_period_name: param.periodName,
                    exchange_rate_type: param.exchangeRateType
                },
                success: setRateAndQuotation,
                scope: this
            });
        }

        function setRateAndQuotation(res) {
            var record = $('csh_transaction_receipt_head_ds').getAt(0);
            if (Ext.isDefined(res.result.record.exchange_rate_quotation)) {
                record.set('exchange_rate_quotation', res.result.record.exchange_rate_quotation);
            } else {
                record.set('exchange_rate_quotation', 'DIRECT QUOTATION');
            }
            if (Ext.isDefined(res.result.record.exchange_rate)) {
                record.set('exchange_rate', res.result.record.exchange_rate);
            }
        }

        function attachment_upload() {
            if (transaction_id) {
                //
                // ds = $('csh_transaction_receipt_head_ds');
                // record = ds.getCurrentRecord();
                // var header_id = record.get('transaction_id');
                var header_id = transaction_id;
                var url = $('transaction_uploadFile_id').getUrl() + '?table_name=CSH_TRANSACTION&header_id=' + header_id;
                var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'transaction_uploadFile_winid',
                    width: 850,
                    height: 400
                });
                win.on('close', function () {
                    window.location.href = $('csh_transaction_receipt_id').getUrl();
                    // var url = $('csh_transaction_receipt_id').getUrl();
                    // Leaf.go(url);
                });
            } else {
                Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');
538
                return;
Spencer Chang's avatar
Spencer Chang committed
539 540 541 542 543
            }
        }

        ]]></script>
        <a:dataSets>
xiaochao's avatar
xiaochao committed
544
            <a:dataSet id="yes_no_ds" lookupCode="YES_NO"/>
545
            <a:dataSet id="PAID_BYOTHER_FLAG_DS" lookupCode="PAID_BYOTHER_FLAG"/>
Darming's avatar
Darming committed
546 547 548
            <!--  <a:dataSet id="payment_method_ds">
                  <a:datas dataSource="/model/payment_method_path"/>
              </a:dataSet>-->
549
            <!--<a:dataSet id="currency_ds">
Spencer Chang's avatar
Spencer Chang committed
550
                <a:datas dataSource="/model/currency"/>
551
            </a:dataSet>-->
Spencer Chang's avatar
Spencer Chang committed
552 553 554
            <a:dataSet id="exchangerate_type_ds">
                <a:datas dataSource="/model/exchangerate_type_path"/>
            </a:dataSet>
Darming's avatar
Darming committed
555 556 557
            <!--  <a:dataSet id="ds_collection_classes_ds" lookupCode="DS_COLLECTION_CLASSES"/>-->
            <a:dataSet id="csh_transaction_receipt_head_ds" autoCreate="true" loadData="true"
                       model="csh.CSH511.csh_transaction">
Spencer Chang's avatar
Spencer Chang committed
558 559
                <a:fields>
                    <a:field name="transaction_date" required="true"/>
560
                    <a:field name="bank_slip_num" required="true"/>
561
                    <!--<a:field name="period_name" lovGridHeight="300" lovHeight="500" lovService="gld.gld_period_lov" lovWidth="500" readOnly="true" required="true" title="GLD_PERIODS.PERIOD_NAME">
Spencer Chang's avatar
Spencer Chang committed
562 563 564
                        <a:mapping>
                            <a:map from="period_name" to="period_name"/>
                        </a:mapping>
565 566 567
                    </a:field>-->
                    <!--<a:field name="internal_period_num"/>-->
                    <!--<a:field name="payment_method_display" displayField="description" options="payment_method_ds" returnField="payment_method_id" valueField="payment_method_id"/>-->
Darming's avatar
Darming committed
568 569
                    <a:field name="currency_name" displayField="currency_name" options="currency_ds" readOnly="true"
                             required="true" returnField="currency_code" valueField="currency_code">
Spencer Chang's avatar
Spencer Chang committed
570 571 572
                        <a:mapping>
                            <a:map from="precision" to="precision"/>
                        </a:mapping>
573 574 575
                    </a:field>
                    <a:field name="currency_code"/>
                    <a:field name="precision"/>
Darming's avatar
Darming committed
576 577
                    <a:field name="functional_currency_code"
                             defaultValue="${/model/default_exchange_rate_type_path/record/@functional_currency_code}"/>
578
                    <a:field name="bp_name" required="true" lovGridHeight="350" lovHeight="500" lovLabelWidth="90"
579
                             lovService="basic.hls_bp_master_v_for_agent_lov" lovWidth="550" title="HLS.BP_TITLE">
Spencer Chang's avatar
Spencer Chang committed
580 581 582
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id"/>
                            <a:map from="bp_name" to="bp_name"/>
583
                            <a:map from="bp_code" to="bp_code"/>
Spencer Chang's avatar
Spencer Chang committed
584 585 586 587 588
                            <a:map from="bp_name" to="csh_bp_name"/>
                            <a:map from="bp_category" to="bp_category"/>
                            <a:map from="bp_category_name" to="bp_category_display"/>
                        </a:mapping>
                    </a:field>
xiaochao's avatar
xiaochao committed
589 590
                    <a:field name="bp_id"/>

xiaochao's avatar
xiaochao committed
591
                    <!--代理店简称-->
592
                    <a:field name="bp_code"/>
593
                    <a:field name="extra_id"/>
xiaochao's avatar
xiaochao committed
594 595 596
                    <a:field name="extra_nam" required="true" lovGridHeight="350" lovHeight="500" lovLabelWidth="90"
                             lovService="csh.CSH510.csh_extra_nam_add_lov" lovWidth="550" title="代理店简称">
                        <a:mapping>
597
                            <a:map from="bp_code" to="bp_code"/>
xiaochao's avatar
xiaochao committed
598 599 600
                            <a:map from="extra_nam" to="extra_nam"/>
                        </a:mapping>
                    </a:field>
601

xiaochao's avatar
xiaochao committed
602
                    <!--担保人履行担保义务-->
603
                    <a:field name="guarantor_name_duty_desc" displayField="code_value_name" options="yes_no_ds" prompt="担保人履行担保义务" returnField="guarantor_name_duty" valueField="code_value"/>
xiaochao's avatar
xiaochao committed
604
                    <a:field name="guarantor_name_duty" required="true"/>
xiaochao's avatar
xiaochao committed
605

606 607 608 609 610 611 612 613 614
                    <!-- <a:field name="bank_slip_num" lovGridHeight="350" lovHeight="600" lovService="csh.CSH510.csh_transaction_contract_query" lovWidth="1200" title="合同编号">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id"/>
                            <a:map from="bp_name" to="bp_name"/>
                            <a:map from="bp_category" to="bp_category"/>
                            <a:map from="bp_category_n" to="bp_category_display"/>
                            <a:map from="contract_number" to="bank_slip_num"/>
                        </a:mapping>
                    </a:field> -->
Spencer Chang's avatar
Spencer Chang committed
615 616
                    <a:field name="bp_category_display" readOnly="true"/>
                    <a:field name="transaction_num" readOnly="true"/>
Darming's avatar
Darming committed
617 618
                    <a:field name="exchange_rate_type_display" displayField="type_name" options="exchangerate_type_ds"
                             readOnly="true" returnField="exchange_rate_type" valueField="type_code">
Spencer Chang's avatar
Spencer Chang committed
619 620 621 622 623
                        <a:mapping>
                            <a:map from="type_code" to="exchange_rate_type"/>
                            <a:map from="rate_method_code" to="rate_method_code"/>
                        </a:mapping>
                    </a:field>
624
                    <a:field name="exchange_rate_type"/>
625
                    <a:field name="exchange_rate" readOnly="true"/>
626
                    <a:field name="rate_method_code"/>
Spencer Chang's avatar
Spencer Chang committed
627
                    <a:field name="transaction_amount" required="true"/>
628
                    <a:field name="transaction_functional_amount" readOnly="true"/>
Darming's avatar
Darming committed
629 630 631
                    <a:field name="bank_account_name" autoComplete="true" lovGridHeight="350" lovHeight="550"
                             lovLabelWidth="90" lovService="csh.CSH101.csh_bank_account_lov" lovWidth="850"
                             required="true" title="CSH511.BANK_ACCOUNT_CODE">
Spencer Chang's avatar
Spencer Chang committed
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646
                        <a:mapping>
                            <a:map from="precision" to="precision"/>
                            <a:map from="zero_amounts_allowed" to="zero_amounts_allowed"/>
                            <a:map from="bank_account_id" to="bank_account_id"/>
                            <a:map from="bank_account_num" to="bank_account_num"/>
                            <a:map from="bank_account_name" to="bank_account_name"/>
                            <a:map from="bank_account_code" to="bank_account_code"/>
                            <a:map from="currency_code" to="currency_code"/>
                            <a:map from="currency_name" to="currency_name"/>
                            <a:map from="bank_account_type" to="bank_account_type"/>
                            <a:map from="bank_account_type_name" to="bank_account_type_name"/>
                            <a:map from="bank_branch_name" to="bank_branch_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="zero_amounts_allowed"/>
Darming's avatar
Darming committed
647 648 649
                    <a:field name="bp_bank_account_code" autoComplete="true" lovGridHeight="350" lovHeight="550"
                             lovLabelWidth="90" lovService="basic.hls_bp_master_bank_account_v_for_lov?enabled_flag=Y"
                             lovWidth="580" title="CSH511.BP_BANK_ACCOUNT_CODE">
Spencer Chang's avatar
Spencer Chang committed
650 651 652 653 654 655 656 657 658 659
                        <a:mapping>
                            <a:map from="bank_account_id" to="bp_bank_account_id"/>
                            <a:map from="bank_account_num" to="bp_bank_account_num"/>
                            <a:map from="bank_account_name" to="bp_bank_account_name"/>
                            <a:map from="bank_account_code" to="bp_bank_account_code"/>
                            <a:map from="bank_branch_name" to="bp_bank_branch_name"/>
                            <a:map from="bank_full_name" to="bp_bank_name"/>
                        </a:mapping>
                    </a:field>

660 661 662 663 664 665
                    <!-- <a:field name="ref_contract_number" autoComplete="true" lovGridHeight="350" lovHeight="550" lovLabelWidth="90" lovService="csh.CSH511.csh_con_contract_lov" lovWidth="580" title="CON301.CONTRACT_QUERY">
                        <a:mapping>
                            <a:map from="contract_number" to="ref_contract_number"/>
                            <a:map from="contract_id" to="ref_contract_id"/>
                        </a:mapping>
                    </a:field> -->
Darming's avatar
Darming committed
666 667
                    <a:field name="ref_contract_number" lovGridHeight="320" lovHeight="530"
                             lovService="csh.CSH510.csh_transaction_contract_query" lovWidth="800" title="合同编号">
668 669 670 671 672 673 674 675 676 677
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id"/>
                            <a:map from="bp_name" to="bp_name"/>
                            <a:map from="bp_category" to="bp_category"/>
                            <a:map from="bp_category_n" to="bp_category_display"/>
                            <a:map from="contract_id" to="ref_contract_id"/>
                            <a:map from="contract_number" to="ref_contract_number"/>
                            <a:map from="bp_id_agent_level1_n" to="bp_id_agent_level1_n"/>
                        </a:mapping>
                    </a:field>
xiaochao's avatar
xiaochao committed
678 679


Spencer Chang's avatar
Spencer Chang committed
680 681
                    <a:field name="bp_bank_account_num"/>
                    <a:field name="bp_bank_account_name" required="true"/>
682 683
                    <a:field name="collection_classes" />
                    <a:field name="collection_classes_desc" required="true" options="ds_collection_classes_ds" prompt="款项用途"
Darming's avatar
Darming committed
684 685 686
                             displayField="code_value_name" returnField="collection_classes" valueField="code_value"/>
                    <a:field name="paid_byother_flag_n" options="PAID_BYOTHER_FLAG_DS" returnField="paid_byother_flag"
                             displayField="code_value_name" valueField="code_value" required="true"/>
Spencer Chang's avatar
Spencer Chang committed
687 688 689 690 691 692 693 694 695 696
                </a:fields>
                <a:events>
                    <a:event name="update" handler="onUpdate_csh511_receipt"/>
                    <a:event name="add" handler="onAdd_csh511_receipt"/>
                    <a:event name="load" handler="onAdd_csh511_receipt"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
697
                <a:screenTitle/>
698
                <a:gridButton id="csh511_receipt_save" click="csh511_receipt_save" text="HLS.SAVE"/>
699
                <a:gridButton id="csh511_receipt_reset_id" click="csh511_receipt_reset" text="HLS.RESET"/>
700 701 702
                <!--<a:gridButton id="csh511_receipt_posted_id" click="csh511_receipt_posted" text="HLS.POST"/>-->
                <!--<a:gridButton id="csh511_receipt_upload_id" click="attachment_upload" text="附件上传"/>-->
                <!--<a:gridButton id="csh511_receipt_back_id" click="csh511_receipt_back" text="HLS.EXIT"/>-->
Spencer Chang's avatar
Spencer Chang committed
703
            </a:screenTopToolbar>
704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739
            <!--<a:form title="CSH511.CSH_RECEIPT">-->
            <!--<a:box column="4">-->
            <!--<a:datePicker name="transaction_date" bindTarget="csh_transaction_receipt_head_ds"/>-->
            <!--<a:lov name="period_name" bindTarget="csh_transaction_receipt_head_ds"/>-->
            <!--<a:comboBox name="currency_name" bindTarget="csh_transaction_receipt_head_ds"/>-->
            <!--&lt;!&ndash; <a:comboBox name="exchange_rate_type_display" bindTarget="csh_transaction_receipt_head_ds"/> &ndash;&gt;-->
            <!--</a:box>-->
            <!--<a:box column="4">-->
            <!--<a:lov name="ref_contract_num" bindTarget="csh_transaction_receipt_head_ds" prompt="合同编号"/>-->
            <!--<a:comboBox name="payment_method_display" bindTarget="csh_transaction_receipt_head_ds"/>-->
            <!--<a:textField name="bank_slip_num" bindTarget="csh_transaction_receipt_head_ds" prompt="银行凭证号"/>-->
            <!--<a:numberField name="exchange_rate" allowNegative="false" bindTarget="csh_transaction_receipt_head_ds" decimalPrecision="-1"/>-->
            <!--</a:box>-->
            <!--<a:box column="4">-->
            <!--<a:numberField name="transaction_amount" allowDecimals="true" allowFormat="true" allowNegative="false" bindTarget="csh_transaction_receipt_head_ds"/>-->
            <!--<a:numberField name="ref_n01" allowDecimals="true" allowFormat="true" allowNegative="false" bindTarget="csh_transaction_receipt_head_ds" prompt="税额"/>-->
            <!--&lt;!&ndash;  <a:numberField name="transaction_functional_amount" allowDecimals="true" allowFormat="true" allowNegative="false" bindTarget="csh_transaction_receipt_head_ds"/> &ndash;&gt;-->
            <!---->
            <!--<a:lov name="bp_name" bindTarget="csh_transaction_receipt_head_ds"/>-->
            <!--<a:textField name="bp_category_display" bindTarget="csh_transaction_receipt_head_ds"/>-->
            <!--</a:box>-->
            <!--<a:box column="4">-->
            <!--<a:lov name="bank_account_code" bindTarget="csh_transaction_receipt_head_ds"/>-->
            <!--<a:textField name="bank_account_num" bindTarget="csh_transaction_receipt_head_ds"/>-->
            <!--<a:lov name="bp_bank_account_code" bindTarget="csh_transaction_receipt_head_ds"/>-->
            <!--<a:textField name="bp_bank_account_num" bindTarget="csh_transaction_receipt_head_ds"/>-->
            <!--</a:box>-->
            <!--<a:box column="2">-->
            <!--<a:textField name="bank_account_name" bindTarget="csh_transaction_receipt_head_ds" width="383"/>-->
            <!--<a:textField name="bp_bank_account_name" bindTarget="csh_transaction_receipt_head_ds" width="383"/>-->
            <!--</a:box>-->
            <!--<a:box column="4">-->
            <!--<a:textArea name="description" bindTarget="csh_transaction_receipt_head_ds" width="383"/>-->
            <!--</a:box>-->
            <!--</a:form>-->
            <!--#删除表格头,添加fieldSet-->
Darming's avatar
Darming committed
740
            <!-- <a:form title="收款信息" width="1200">-->
741
            <a:fieldSet title="CSH511.CSH_TRANSACTION.MANUAL_ADD">
742
                <a:box column="3">
Spencer Chang's avatar
Spencer Chang committed
743
                    <a:datePicker name="transaction_date" bindTarget="csh_transaction_receipt_head_ds"/>
Darming's avatar
Darming committed
744 745 746 747 748 749 750 751 752 753
                    <a:numberField name="transaction_amount" allowDecimals="true" allowFormat="true"
                                   allowNegative="false" bindTarget="csh_transaction_receipt_head_ds"/>
                    <!--  # 新增现金流字段,代付,商业伙伴,摘要字段-->
                    <a:textField name="bank_slip_num" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.BANK_CASH_CODE" required="true"/>
                    <a:comboBox name="paid_byother_flag_n" prompt="代付" bindTarget="csh_transaction_receipt_head_ds"
                                required="true"/>
                    <a:lov name="bp_name" bindTarget="csh_transaction_receipt_head_ds"
                           prompt="CSH510.CSH_TRANSACTION.BUSINESS_PARTNER"/>
                    <a:comboBox name="collection_classes_desc" bindTarget="csh_transaction_receipt_head_ds"
754
                                prompt="款项用途"/>
Spencer Chang's avatar
Spencer Chang committed
755
                </a:box>
756 757

                <a:hBox style="width:800px">
758
                        <a:textField width="300" name="description" bindTarget="csh_transaction_receipt_head_ds"/>
759

760 761 762
                        <!--代理店简称-->
                        <a:lov name="extra_nam" bindTarget="csh_transaction_receipt_head_ds"
                               prompt="代理店简称" width="180" readOnly="true" />
763 764 765

                </a:hBox>
                <a:hBox style="width:800px">
766
                    <!--#添加备注字段-->
767 768
                    <a:textField width="300" name="ref_v05" prompt="CSH511.CSH_TRANSACTION.STATEMENT"
                                 bindTarget="csh_transaction_receipt_head_ds"/>
769
                    <!--担保人履行担保义务-->
xiaochao's avatar
xiaochao committed
770
                    <a:comboBox name="guarantor_name_duty_desc" bindTarget="csh_transaction_receipt_head_ds"
771
                                prompt="担保人履行担保义务" width="180" />
772
                </a:hBox>
773
            </a:fieldSet>
Darming's avatar
Darming committed
774 775 776 777 778 779 780 781 782
            <!--删除下面的字段 currency_name,bank_account_name,banka,bank_branch_name,bank_account_num,bank_account_type_name,exchange_rate_type_display-->
            <!-- <a:comboBox name="currency_name" bindTarget="csh_transaction_receipt_head_ds"/>
             <a:lov name="bank_account_name" bindTarget="csh_transaction_receipt_head_ds"/>
             &lt;!&ndash;<a:textField name="banka" bindTarget="csh_transaction_receipt_head_ds" prompt="账户类型"/>&ndash;&gt;
             <a:textField name="bank_branch_name" bindTarget="csh_transaction_receipt_head_ds" readOnly="true" prompt="分行名称"/>
             <a:textField name="bank_account_num" bindTarget="csh_transaction_receipt_head_ds" readOnly="true"/>
             <a:textField name="bank_account_type_name" bindTarget="csh_transaction_receipt_head_ds" readOnly="true" prompt="账户类型"/>
             &lt;!&ndash; <a:comboBox name="exchange_rate_type_display" bindTarget="csh_transaction_receipt_head_ds"/> &ndash;&gt;
         </a:box>-->
783

Darming's avatar
Darming committed
784 785 786 787 788 789 790 791 792 793 794 795
            <!--删除下面的两个box-->
            <!--  <a:box column="4">
                  <a:textField name="description" bindTarget="csh_transaction_receipt_head_ds"/>
                  <a:textField name="purpose" bindTarget="csh_transaction_receipt_head_ds" prompt="用途"/>
              </a:box>
              <a:box column="4">
                  <a:textField name="bank_slip_num" bindTarget="csh_transaction_receipt_head_ds" prompt="银行流水号"/>
                  <a:textField name="gsber" bindTarget="csh_transaction_receipt_head_ds" prompt="业务范围"/>
                  <a:textField name="sus_belnr" bindTarget="csh_transaction_receipt_head_ds" prompt="SAP凭证号"/>
              </a:box>-->
            <!-- </a:form>-->
            <!--添加两方的账户信息和附件-->
796
            <a:fieldSet title="CSH511.CSH_TRANSACTION.BANK_INFO">
797
                <a:box column="3" labelWidth="100">
Darming's avatar
Darming committed
798 799 800 801 802 803
                    <a:lov name="bank_account_name" bindTarget="csh_transaction_receipt_head_ds"
                           prompt="CSH510.CSH_TRANSACTION.MY_ACCOUNT_NAME"/>
                    <a:textField name="bank_branch_name" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.MY_BANK_NAME" readOnly="true"/>
                    <a:textField name="bank_account_num" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.MY_ACCOUNT_USERNAME" readOnly="true"/>
804
                    <!--对方账户-->
Darming's avatar
Darming committed
805 806 807 808 809 810
                    <a:textField name="bp_bank_account_name" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.YOUR_ACCOUNT_NAME"/>
                    <a:textField name="opposite_band_na" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.YOUR_BANK_NAME"/>
                    <a:textField name="bp_bank_account_num" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.YOUR_ACCOUNT_USERNAME"/>
Spencer Chang's avatar
Spencer Chang committed
811
                </a:box>
812
            </a:fieldSet>
813
            <a:fieldSet title="CSH511.CSH_TRANSACTION.ATTACHMENT">
stone's avatar
stone committed
814 815 816 817
                <a:hBox>
                    <a>附件上传:</a><a href="javascript:upload_attachment_win()" style="color:red">上传</a>
                </a:hBox>

818
            </a:fieldSet>
stone's avatar
stone committed
819 820


Darming's avatar
Darming committed
821 822 823 824 825 826 827
            <!-- <a:form title="对方账户信息" width="1200">
                 <a:box column="4">
                     <a:textField name="bp_bank_account_name" bindTarget="csh_transaction_receipt_head_ds"/>
                     <a:textField name="opposite_band_na" bindTarget="csh_transaction_receipt_head_ds" prompt="银行名称"/>
                     <a:textField name="bp_bank_account_num" bindTarget="csh_transaction_receipt_head_ds"/>
                 </a:box>
             </a:form>-->
Spencer Chang's avatar
Spencer Chang committed
828 829 830 831 832


        </a:screenBody>
    </a:view>
</a:screen>