csh_contract_cashflow_modify.lview 3.04 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Harry
    $Date: 2018-7-5 下午3:51:50
    $Revision: 1.0
    $Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true">
    <a:view>
        <a:link id="update_data_link" url="${/request/@context_path}/modules/csh/CSH555/csh_contract_cashflow_modify.lsc"/>
        <script type="text/javascript"><![CDATA[
            window['${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function(ds, record, config_records, bp_seq) {
                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_cashflow');
                if (ds.id == ds_id) {
                    var records = $(ds_id).getAll();
                    for (i = 0;i < records.length;i++) {
                        records[i].getField('cf_direction_n').setReadOnly(true);
                        records[i].getField('times').setReadOnly(true);
                        records[i].getField('cf_item_n').setReadOnly(true);
                        records[i].getField('due_date').setReadOnly(true);
                        records[i].getField('due_amount').setReadOnly(true);
                        records[i].getField('principal').setReadOnly(true);
                        records[i].getField('interest').setReadOnly(true);
                        records[i].getField('received_amount').setReadOnly(true);
                        records[i].getField('last_write_off_date').setReadOnly(true);
                    }
                }
                window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            };

        window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res, bp_seq) {
            debugger
            window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_cashflow');
            var records = $(ds_id).getAll();
            var param = {};
            var saveData = [];
            for (var i = 0; i < records.length; i++) {
                saveData.push({
                    'cashflow_id' : records[i].get('cashflow_id'),
                    'calc_date' : records[i].get('due_date'),
                    'fin_income_date' : records[i].get('due_date'),
                    '_status' : 'update'
                });
            }
            param['details'] = saveData;
            Leaf.request({
                url: $('update_data_link').getUrl(),
                para: param,
                success: function ()  {
                    window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                },
                error: function() {
                },
                failure: function() {
                },
                sync: true,
                scope: this
            });
        };
        ]]></script>
    </a:view>
</a:screen>