hsbc_paying_batch_modify.lview 17.4 KB
Newer Older
panhong18943's avatar
panhong18943 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Hongquan.Dai  代宏全
    $Date: 2018-1-22 上午10:36:25  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true">
    <a:init-procedure>
        <a:model-query model="hsbc.HSBC110.get_limited_user" rootPath="limited_user_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="${/parameter/@layout_code}_con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <a:link id="batch_hsbc_send_link" url="${/request/@context_path}/modules/hsbc/HSBC110/hsbc_paying_batch_send.lsc"/>
        <a:link id="batch_detail_link" url="${/request/@context_path}/modules/hsbc/HSBC110/hsbc_paying_batch_detail.lview"/>
        <a:link id="manual_modify_link" model="hsbc.HSBC110.hsbc_paying_manual_modify" modelaction="execute"/>
        <a:link id="batch_cancel_link" model="hsbc.HSBC110.hsbc_paying_batch_cancel" modelaction="delete"/>
        <script type="text/javascript"><![CDATA[

        function open_batch_win(ds_id, record_id) {
            var record = $(ds_id).findById(record_id);
            var param = record.data;
            param['function_code'] = 'HSBC110D';
            param['maintain_type'] = 'QUERY';
            param['url_title'] = '付款单明细';
            hls_doc_get_layout_code('${/parameter/@layout_code}_con_contract_get_layout_code_link_id', param, 'batch_detail_link', ds_id);
        }

        window['${/parameter/@layout_code}_dynamic_link_renderer'] = function(value, record, name, config_record) {
            if (name == 'reqsn' && value) {
                return '<a href="javascript:open_batch_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
            }
            return value;
        };

        //代付单发送
        window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
            var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_RESULT', 'hl_hsbc_paying_batch');
39
            var r_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'R_RESULT', 'hl_hsbc_paying_batch');
panhong18943's avatar
panhong18943 committed
40
            var m_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'M_RESULT', 'hl_hsbc_paying_batch');
panhong18943's avatar
panhong18943 committed
41 42 43
            var batch_ds = $(ds_id);
            var records = batch_ds.getSelected();

44 45 46
            var r_batch_ds = $(r_ds_id);
            var r_records = r_batch_ds.getSelected();

panhong18943's avatar
panhong18943 committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
            var m_batch_ds = $(m_ds_id);
            var m_records = m_batch_ds.getSelected();

            var length = 0;
            if (records.length != 0){
                length = length + 1;
            }
            if (r_records.length != 0){
                length = length + 1;
            }
            if (m_records.length != 0){
                length = length + 1;
            }
            if (length > 1) {
                Leaf.showMessage('${l:PROMPT}', '不能同时选择多种付款单!');
62 63 64
                return;
            }

panhong18943's avatar
panhong18943 committed
65
            if (records.length == 0  && r_records.length == 0  && m_records.length == 0) {
panhong18943's avatar
panhong18943 committed
66 67 68 69 70 71 72 73 74
                Leaf.showMessage('${l:PROMPT}', '请选择至少一条数据!');
                return;
            }
            var param = {};
            var saveData = [];
            var length = 0;
            var send_url;
            var bank_note='汇丰银行';

75 76 77 78 79 80 81 82
            if (records.length != 0){
                for (var i = 0;i < records.length;i++) {
                    var rec;
                    rec = records[i];
                    rec.set('_status', 'insert');
                    saveData.push(rec.data);
                }
                length = records.length;
panhong18943's avatar
panhong18943 committed
83
            }else if (r_records.length != 0){
84 85 86 87 88 89 90
                for (var i = 0;i < r_records.length;i++) {
                    var rec;
                    rec = r_records[i];
                    rec.set('_status', 'insert');
                    saveData.push(rec.data);
                }
                length = r_records.length;
panhong18943's avatar
panhong18943 committed
91 92 93 94 95 96 97 98
            }else if (m_records.length != 0){
                for (var i = 0;i < m_records.length;i++) {
                    var rec;
                    rec = m_records[i];
                    rec.set('_status', 'insert');
                    saveData.push(rec.data);
                }
                length = m_records.length;
panhong18943's avatar
panhong18943 committed
99 100 101 102 103 104 105 106 107 108 109 110 111
            }
            param['details'] = saveData;

            send_url=$('batch_hsbc_send_link').getUrl();

            Leaf.showConfirm('${l:HLS.PROMPT}', '共选中<font color="red">' + length + '</font>条付款单,确认发送到<font color="red">'+bank_note+'</font>?', function() {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                Leaf.request({
                    url: send_url,
                    para: param,
                    success: function(res) {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        batch_ds.query();
112
                        r_batch_ds.query();
panhong18943's avatar
panhong18943 committed
113
                        m_batch_ds.query();
panhong18943's avatar
panhong18943 committed
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
                    },
                    failure: function(res) {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        batch_ds.query();
                    },
                    error: function() {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        batch_ds.query();
                    },
                    scope: this
                });
            });
        };

        //人工支付  --add by 24976
        window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
            var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_RESULT', 'hl_hsbc_paying_batch');
131
            var r_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'R_RESULT', 'hl_hsbc_paying_batch');
panhong18943's avatar
panhong18943 committed
132
            var m_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'M_RESULT', 'hl_hsbc_paying_batch');
panhong18943's avatar
panhong18943 committed
133 134 135
            var batch_ds = $(ds_id);
            var records = batch_ds.getSelected();

136 137 138
            var r_batch_ds = $(r_ds_id);
            var r_records = r_batch_ds.getSelected();

panhong18943's avatar
panhong18943 committed
139 140 141
            var m_batch_ds = $(m_ds_id);
            var m_records = m_batch_ds.getSelected();

panhong18943's avatar
panhong18943 committed
142 143 144 145 146
            var lease_channel;
            var reqsn;
            var batch_id;
            var bank_item;

panhong18943's avatar
panhong18943 committed
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
            var length = 0;
            if (records.length != 0){
                length = length + 1;
            }
            if (r_records.length != 0){
                length = length + 1;
            }
            if (m_records.length != 0){
                length = length + 1;
            }
            if (length > 1) {
                Leaf.showMessage('${l:PROMPT}', '不能同时选择多种付款单!');
                return;
            }

            if (records.length != 1  && r_records.length == 0  && m_records.length == 0) {
                Leaf.showMessage('${l:PROMPT}', '请选择一条数据!');
164 165 166
                return;
            }

panhong18943's avatar
panhong18943 committed
167
            if (records.length == 0  && r_records.length != 1  && m_records.length == 0) {
168 169 170 171
                Leaf.showMessage('${l:PROMPT}', '请选择一条数据!');
                return;
            }

panhong18943's avatar
panhong18943 committed
172
            if (m_records.length != 1  && records.length == 0  && r_records.length == 0) {
panhong18943's avatar
panhong18943 committed
173 174 175
                Leaf.showMessage('${l:PROMPT}', '请选择一条数据!');
                return;
            }
panhong18943's avatar
panhong18943 committed
176

177 178 179 180
            if (records.length != 0){
                reqsn = records[0].get('reqsn');
                batch_id = records[0].get('batch_id');
                bank_item=records[0].get('bank_item');
panhong18943's avatar
panhong18943 committed
181
            }else if (r_records.length != 0){
182 183 184
                reqsn = r_records[0].get('reqsn');
                batch_id = r_records[0].get('batch_id');
                bank_item=r_records[0].get('bank_item');
panhong18943's avatar
panhong18943 committed
185 186 187 188
            }else if (m_records.length != 0){
                reqsn = m_records[0].get('reqsn');
                batch_id = m_records[0].get('batch_id');
                bank_item=m_records[0].get('bank_item');
189
            }
panhong18943's avatar
panhong18943 committed
190 191 192 193 194 195

            var win = new Leaf.showConfirm('${l:HLS.PROMPT}', '使用人工支付将不能再使用银企直连,确认进行人工支付?', function() {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                Leaf.request({
                    url: $('manual_modify_link').getUrl(),
                    para: {
196 197 198
                        batch_id : batch_id,
                        reqsn : reqsn,
                        bank_item : bank_item
panhong18943's avatar
panhong18943 committed
199 200 201 202
                    },
                    success: function(res) {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        batch_ds.query();
203
                        r_batch_ds.query();
panhong18943's avatar
panhong18943 committed
204
                        m_batch_ds.query();
panhong18943's avatar
panhong18943 committed
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
                    },
                    failure: function(res) {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    error: function() {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    scope: this
                });
            });
        };

        //付款单取消
        window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function() {
            var ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_RESULT', 'hl_hsbc_paying_batch');
220
            var r_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'R_RESULT', 'hl_hsbc_paying_batch');
panhong18943's avatar
panhong18943 committed
221
            var m_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'M_RESULT', 'hl_hsbc_paying_batch');
panhong18943's avatar
panhong18943 committed
222 223 224
            var batch_ds = $(ds_id);
            var records = batch_ds.getSelected();

225 226 227
            var r_batch_ds = $(r_ds_id);
            var r_records = r_batch_ds.getSelected();

panhong18943's avatar
panhong18943 committed
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
            var m_batch_ds = $(m_ds_id);
            var m_records = m_batch_ds.getSelected();

            var length = 0;
            if (records.length != 0){
                length = length + 1;
            }
            if (r_records.length != 0){
                length = length + 1;
            }
            if (m_records.length != 0){
                length = length + 1;
            }
            if (length > 1) {
                Leaf.showMessage('${l:PROMPT}', '不能同时选择多种付款单!');
                return;
            }

            if (records.length != 1  && r_records.length == 0  && m_records.length == 0) {
                Leaf.showMessage('${l:PROMPT}', '请选择一条数据!');
248 249 250
                return;
            }

panhong18943's avatar
panhong18943 committed
251
            if (records.length == 0  && r_records.length != 1  && m_records.length == 0) {
panhong18943's avatar
panhong18943 committed
252 253 254 255
                Leaf.showMessage('${l:PROMPT}', '请选择一条数据!');
                return;
            }

panhong18943's avatar
panhong18943 committed
256
            if (m_records.length != 1  && records.length == 0  && r_records.length == 0) {
257 258 259
                Leaf.showMessage('${l:PROMPT}', '请选择一条数据!');
                return;
            }
panhong18943's avatar
panhong18943 committed
260

261 262 263 264
            if (records.length != 0){
                reqsn = records[0].get('reqsn');
                batch_id = records[0].get('batch_id');
                bank_item=records[0].get('bank_item');
panhong18943's avatar
panhong18943 committed
265
            }else if (r_records.length != 0){
266 267 268
                reqsn = r_records[0].get('reqsn');
                batch_id = r_records[0].get('batch_id');
                bank_item=r_records[0].get('bank_item');
panhong18943's avatar
panhong18943 committed
269 270 271 272
            }else if (m_records.length != 0){
                reqsn = m_records[0].get('reqsn');
                batch_id = m_records[0].get('batch_id');
                bank_item=m_records[0].get('bank_item');
273 274
            }

panhong18943's avatar
panhong18943 committed
275 276 277 278 279
            Leaf.showConfirm('${l:HLS.PROMPT}', '确认取消?', function() {
                window['${/parameter/@layout_code}_lock_layout_dynamic_window']();
                Leaf.request({
                    url: $('batch_cancel_link').getUrl(),
                    para: {
280 281 282
                        batch_id : batch_id,
                        reqsn : reqsn,
                        bank_item : bank_item
panhong18943's avatar
panhong18943 committed
283 284 285 286
                    },
                    success: function(res) {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        batch_ds.query();
287
                        r_batch_ds.query();
panhong18943's avatar
panhong18943 committed
288
                        m_batch_ds.query();
panhong18943's avatar
panhong18943 committed
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308
                    },
                    failure: function(res) {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    error: function() {
                        window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                    },
                    scope: this
                });
            });
        };

        Leaf.onReady(function() {
            if ('${/model/limited_user_path/record/@flag}'=='N') {
                $('${/parameter/@layout_code}_user_button1').hide();
                $('${/parameter/@layout_code}_user_button2').hide();
                $('${/parameter/@layout_code}_user_button3').hide();
            }
        });

309 310 311
        window['${/parameter/@layout_code}_on_layout_dynamic_grid_select'] = function(ds, record, bp_seq) {
            var form_ds_id = '${/parameter/@layout_code}_F_QUERY__ds';
            var formr_r_ds_id = '${/parameter/@layout_code}_R_F_QUERY__ds';
panhong18943's avatar
panhong18943 committed
312
            var formr_m_ds_id = '${/parameter/@layout_code}_M_F_QUERY__ds';
313 314
            var g_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_RESULT', 'hl_hsbc_paying_batch');
            var r_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'R_RESULT', 'hl_hsbc_paying_batch');
panhong18943's avatar
panhong18943 committed
315
            var m_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'M_RESULT', 'hl_hsbc_paying_batch');
316 317
            var form_record = $(form_ds_id).getAt(0);
            var form_r_record = $(formr_r_ds_id).getAt(0);
panhong18943's avatar
panhong18943 committed
318
            var form_m_record = $(formr_m_ds_id).getAt(0);
319 320
            var g_records = $(g_ds_id).getSelected();
            var r_records = $(r_ds_id).getSelected();
panhong18943's avatar
panhong18943 committed
321
            var m_records = $(m_ds_id).getSelected();
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337

            if (g_ds_id == ds.id) {
                var sum = 0;
                for (var i = 0;i < g_records.length;i++) {
                    sum = plus(sum, g_records[i].get('totalamt'));
                }
                form_record.set('total_unpaid_amount', sum);
            }

            if (r_ds_id == ds.id) {
                var sum = 0;
                for (var i = 0;i < r_records.length;i++) {
                    sum = plus(sum, r_records[i].get('totalamt'));
                }
                form_r_record.set('total_unpaid_amount', sum);
            }
panhong18943's avatar
panhong18943 committed
338 339 340 341 342 343 344 345

            if (m_ds_id == ds.id) {
                var sum = 0;
                for (var i = 0;i < m_records.length;i++) {
                    sum = plus(sum, m_records[i].get('totalamt'));
                }
                form_m_record.set('total_unpaid_amount', sum);
            }
346 347 348 349 350
        };

        window['${/parameter/@layout_code}_on_layout_dynamic_grid_unselect'] = function(ds, record, bp_seq) {
            var form_ds_id = '${/parameter/@layout_code}_F_QUERY__ds';
            var formr_r_ds_id = '${/parameter/@layout_code}_R_F_QUERY__ds';
panhong18943's avatar
panhong18943 committed
351
            var formr_m_ds_id = '${/parameter/@layout_code}_M_F_QUERY__ds';
352 353
            var g_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'G_RESULT', 'hl_hsbc_paying_batch');
            var r_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'R_RESULT', 'hl_hsbc_paying_batch');
panhong18943's avatar
panhong18943 committed
354
            var m_ds_id = get_dsid_by_tabcode_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'M_RESULT', 'hl_hsbc_paying_batch');
355 356
            var form_record = $(form_ds_id).getAt(0);
            var form_r_record = $(formr_r_ds_id).getAt(0);
panhong18943's avatar
panhong18943 committed
357
            var form_m_record = $(formr_m_ds_id).getAt(0);
358 359
            var g_records = $(g_ds_id).getSelected();
            var r_records = $(r_ds_id).getSelected();
panhong18943's avatar
panhong18943 committed
360
            var m_records = $(m_ds_id).getSelected();
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376

            if (g_ds_id == ds.id) {
                var sum = 0;
                for (var i = 0;i < g_records.length;i++) {
                    sum = plus(sum, g_records[i].get('totalamt'));
                }
                form_record.set('total_unpaid_amount', sum);
            }

            if (r_ds_id == ds.id) {
                var sum = 0;
                for (var i = 0;i < r_records.length;i++) {
                    sum = plus(sum, r_records[i].get('totalamt'));
                }
                form_r_record.set('total_unpaid_amount', sum);
            }
panhong18943's avatar
panhong18943 committed
377 378 379 380 381 382 383 384

            if (m_ds_id == ds.id) {
                var sum = 0;
                for (var i = 0;i < m_records.length;i++) {
                    sum = plus(sum, m_records[i].get('totalamt'));
                }
                form_m_record.set('total_unpaid_amount', sum);
            }
385 386
        };

panhong18943's avatar
panhong18943 committed
387

388
        ]]></script>
panhong18943's avatar
panhong18943 committed
389 390 391
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>