hls_bp_master_billing.lview 14.8 KB
Newer Older
1 2 3 4 5
<?xml version="1.0" encoding="UTF-8"?>

<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true">
    <a:init-procedure/>
    <a:view>
liyuan.chen's avatar
liyuan.chen committed
6 7 8 9
        <a:link id="hls214N_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="hls214N_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/input_validator.js" type="text/javascript"/>
        <a:link id="hls214_bp_master_req_submit_link_id" model="hls.HLS214N.hls_bp_master_req_submit" modelaction="execute"/>
10
        <script><![CDATA[
11
        // 加载事件(form)
liyuan.chen's avatar
liyuan.chen committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function (ds, record, config_records, bp_seq) {
            if (record.get('invoice_method')) {
                var value = record.get('invoice_method');
                if (record.get('bp_class') == 'ORG') {
                    if (value == 'BILLING') {
                        record.getField('taxpayer_type').setRequired(true);
                        record.getField('taxpayer_type_n').setRequired(true);
                        record.getField('tax_registry_num').setRequired(true);
                        record.getField('invoice_title').setRequired(true);
                        record.getField('invoice_bp_address').setRequired(true);
                        record.getField('invoice_bp_phone_num').setRequired(true);
                        record.getField('invoice_bp_bank').setRequired(true);
                        record.getField('invoice_bp_bank_account').setRequired(true);
                    }
                    if (value == 'NO_BILLING') {
27 28
                        record.getField('taxpayer_type').setRequired(true);
                        record.getField('taxpayer_type_n').setRequired(true);
liyuan.chen's avatar
liyuan.chen committed
29 30 31 32 33 34 35
                        record.getField('tax_registry_num').setRequired(false);
                        record.getField('invoice_title').setRequired(false);
                        record.getField('invoice_bp_address').setRequired(false);
                        record.getField('invoice_bp_phone_num').setRequired(false);
                        record.getField('invoice_bp_bank').setRequired(false);
                        record.getField('invoice_bp_bank_account').setRequired(false);
                    }
36 37 38 39
                }
            }
        };
        // 更新事件
liyuan.chen's avatar
liyuan.chen committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
        window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_update'] = function (ds, record, name, value, old_value, bp_seq) {
            if (name == 'invoice_title') {
                if (value != record.get('bp_name')) {
                    setTimeout(function () {
                        record.set('invoice_title', record.get('bp_name'));
                    }, 20);
                }
            }
            if (name == 'tax_registry_num') {
                if (value != record.get('social_code')) {
                    setTimeout(function () {
                        record.set('tax_registry_num', record.get('social_code'));
                    }, 20);
                }
            }
55
            /*if (name == 'invoice_bp_phone_num' && value) {
liyuan.chen's avatar
liyuan.chen committed
56 57 58 59 60 61 62
                if (!checkMobile(value)) {
                    Leaf.showMessage('提示', '基本信息中,请输入正确格式的手机号码!');
                    setTimeout(function () {
                        record.set('invoice_bp_phone_num', '');
                    }, 20);
                    return false;
                }
63
            }*/
64 65


liyuan.chen's avatar
liyuan.chen committed
66 67
            if (name == 'invoice_method' && value) {
                if (record.get('bp_class') == 'ORG') {
68
                    //开票
liyuan.chen's avatar
liyuan.chen committed
69
                    if (value == 'BILLING') {
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
                        //一般纳税人
                        if( record.get('taxpayer_type') == 'GENERAL_TAXPAYER'){
                            record.getField('taxpayer_type').setRequired(true);
                            record.getField('taxpayer_type_n').setRequired(true);
                            record.getField('tax_registry_num').setRequired(true);
                            record.getField('invoice_title').setRequired(true);
                            record.getField('invoice_bp_address').setRequired(true);
                            record.getField('invoice_bp_phone_num').setRequired(true);
                            record.getField('invoice_bp_bank').setRequired(true);
                            record.getField('invoice_bp_bank_account').setRequired(true);
                        }else if(record.get('taxpayer_type') == 'SMALL_SCALE_TAXPAYER'){
                            //小规模纳税人
                            record.getField('taxpayer_type').setRequired(true);
                            record.getField('taxpayer_type_n').setRequired(true);
                            record.getField('tax_registry_num').setRequired(true);
                            record.getField('invoice_title').setRequired(true);

                            record.getField('invoice_bp_address').setRequired(false);
                            record.getField('invoice_bp_phone_num').setRequired(false);
                            record.getField('invoice_bp_bank').setRequired(false);
                            record.getField('invoice_bp_bank_account').setRequired(false);
                        }

                    }else if (value == 'NO_BILLING'){//暂时不开票
                        //一般纳税人
liyuan.chen's avatar
liyuan.chen committed
95 96 97 98
                        record.getField('taxpayer_type').setRequired(true);
                        record.getField('taxpayer_type_n').setRequired(true);
                        record.getField('tax_registry_num').setRequired(true);
                        record.getField('invoice_title').setRequired(true);
99 100 101 102 103

                        record.getField('invoice_bp_address').setRequired(false);
                        record.getField('invoice_bp_phone_num').setRequired(false);
                        record.getField('invoice_bp_bank').setRequired(false);
                        record.getField('invoice_bp_bank_account').setRequired(false);
liyuan.chen's avatar
liyuan.chen committed
104
                    }
105 106 107 108 109 110 111 112 113 114 115
                }
            }
            if (name == 'taxpayer_type' && value) {
                if (record.get('bp_class') == 'ORG') {
                    if (value == 'SMALL_SCALE_TAXPAYER') {

                        record.getField('taxpayer_type').setRequired(true);
                        record.getField('taxpayer_type_n').setRequired(true);
                        record.getField('tax_registry_num').setRequired(true);
                        record.getField('invoice_title').setRequired(true);

liyuan.chen's avatar
liyuan.chen committed
116 117 118 119
                        record.getField('invoice_bp_address').setRequired(false);
                        record.getField('invoice_bp_phone_num').setRequired(false);
                        record.getField('invoice_bp_bank').setRequired(false);
                        record.getField('invoice_bp_bank_account').setRequired(false);
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143

                    }else if (value == 'GENERAL_TAXPAYER') {
                        if (record.get('invoice_method') == 'BILLING'){
                            record.getField('taxpayer_type').setRequired(true);
                            record.getField('taxpayer_type_n').setRequired(true);
                            record.getField('tax_registry_num').setRequired(true);
                            record.getField('invoice_title').setRequired(true);

                            record.getField('invoice_bp_address').setRequired(true);
                            record.getField('invoice_bp_phone_num').setRequired(true);
                            record.getField('invoice_bp_bank').setRequired(true);
                            record.getField('invoice_bp_bank_account').setRequired(true);

                        }else if ( record.get('invoice_method') == 'NO_BILLING'){
                            record.getField('taxpayer_type').setRequired(true);
                            record.getField('taxpayer_type_n').setRequired(true);
                            record.getField('tax_registry_num').setRequired(true);
                            record.getField('invoice_title').setRequired(true);

                            record.getField('invoice_bp_address').setRequired(false);
                            record.getField('invoice_bp_phone_num').setRequired(false);
                            record.getField('invoice_bp_bank').setRequired(false);
                            record.getField('invoice_bp_bank_account').setRequired(false);
                        }
liyuan.chen's avatar
liyuan.chen committed
144
                    }
145 146 147
                }
            }
        };
148

liyuan.chen's avatar
liyuan.chen committed
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
        function upload_file(id, name, query_only) {
            var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
            if (record.get('check_id')) {
                var url;
                if (query_only == 'Y') {
                    url = $('hls214N_cdd_downloadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                } else {
                    url = $('hls214N_cdd_uploadFile_id').getUrl() + '?table_name=PRJ_CDD_ITEM_CHECK&header_id=' + record.get('check_id');
                }

                var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'prj500_cdd_uploadFile_screen_id',
                    width: 850,
                    height: 400
                });

                win.on('close', function () {
                    record.ds.query();
                });
            } else {
                Leaf.showMessage('${l:HLS.PROMPT}', '请先保存!');

            }
        }
175

liyuan.chen's avatar
liyuan.chen committed
176 177
        //超链接渲染
        window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) {
178

liyuan.chen's avatar
liyuan.chen committed
179 180 181
            window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
            if (name == 'attachment') {
                link_function = 'upload_file';
182 183 184 185 186 187 188 189 190 191 192 193
                if('${/parameter/@query_only}' == 'Y'){
                    if (record.get('attach_count') == 0 || !record.get('attach_count')) {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + '${/parameter/@query_only}' + '\');">' + '附件下载' + '</a>';
                    } else {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + '${/parameter/@query_only}' + '\');">' + '附件下载' + '(' + record.get('attach_count') + ')' + '</a>';
                    }
                }else{
                    if (record.get('attach_count') == 0 || !record.get('attach_count')) {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '</a>';
                    } else {
                        return '<a href="javascript:window[\'' + link_function + '\'](\'' + record.id + '\',\'' + name + '\',\'' + config_record.get('query_only') + '\');">' + config_record.get('prompt') + '(' + record.get('attach_count') + ')' + '</a>';
                    }
liyuan.chen's avatar
liyuan.chen committed
194
                }
195

liyuan.chen's avatar
liyuan.chen committed
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
            } else if (name == 'attach_file_name') {
                if (value != null) {
                    var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
                    var str = value.split(';;');
                    var url = '';
                    for (var i = 0; i < str.length; i++) {
                        var temp = str[i].split('--');
                        if (!Leaf.isEmpty(temp[0])) {
                            var file_name = temp[0].toUpperCase();
                            var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
                            if (file_name.indexOf('.PDF') >= 0) {
                                url = url + '<a href=javascript:view_pdf(\'' + temp[1] + '\')>' + temp[0] + '</a>' + ',';
                            } else if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
                                url = url + '<a href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ',';
                            } else {
                                url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
                            }
                        }
                    }
                    return url;

                }
            } else if (name == 'description') {
                if (record.get('important_flag') == 'Y') {
                    return '<font color="RED">' + value + '</font>';
                }
                return value;
            }
        };
        // 提交审批
        window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
            var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_req');
            var record = $(ds_id).getAt(0);
            if(record.dirty){
                Leaf.showMessage('提示','请先保存!');
                return;
            }
            if ($(ds_id).validate()) {
                var record = $(ds_id).getAt(0);
                Leaf.showConfirm('${l:HLS.PROMPT}', '确定提交审批吗?', function() {
                    window['${/parameter/@bp_seq}${/parameter/@layout_code}_lock_layout_dynamic_window']();
                    Leaf.request({
                        url: $('hls214_bp_master_req_submit_link_id').getUrl(),
                        para: {
                            change_req_id: record.get('change_req_id')
                        },
                        success: function(res) {
                            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                            $('${/parameter/@winid}').close();
                        },
                        failure: function() {
                            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        },
                        error: function() {
                            window['${/parameter/@bp_seq}${/parameter/@layout_code}_unlock_layout_dynamic_window']();
                        },
                        scope: this
                    });
                });
            }
        };

        /*Leaf.onReady(function () {
            var billing_ds = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master');
260
            // console.log($(billing_ds));
liyuan.chen's avatar
liyuan.chen committed
261
            $(billing_ds).setQueryParameter("change_req_id", "${/parameter/@change_req_id}");
262
            $(billing_ds).query();
liyuan.chen's avatar
liyuan.chen committed
263
        });*/
264 265 266 267
        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>