<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2013-12-28 下午1:24:13  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
    <a:init-procedure>
        <a:model-query defaultWhereClause="t1.role_id=${/session/@role_id} and t1.company_id=${/session/@company_id}"
                       fetchAll="true" model="hls.HLS109.hls_default_parameter" rootPath="hls_default_parameter_path"/>
        <a:model-query defaultWhereClause="fc.company_id=${/session/@company_id}" fetchAll="true"
                       model="fnd.fnd_companies" rootPath="default_company_path"/>
        <a:model-query autoCount="false" fetchAll="true" model="gld.FND5800.gld_period_status_fieldset"
                       rootPath="fieldset"/>
        <a:model-query autoCount="false" model="hls.HLS801.sys_role_flag" rootPath="sys_role_path"/>
        <a:model-query defaultWhereClause="t1.role_id=${/session/@role_id}" fetchAll="true"
                       model="cont.CON733.query_roles_info" rootPath="role_code"/>
        <a:model-query  model="hls.HLS801.con_exist_approving" rootPath="con_status"/>
    </a:init-procedure>
    <a:view>
        <a:link id="con_finance_income_link"
                url="${/request/@context_path}/modules/cont/CON901/con_finance_income.lview"/>
        <!--   <a:link id="tre_accrued_interest_link" url="${/request/@context_path}/modules/hls/HLS801/tre_accrued_interest.lview"/>
        <a:link id="con_unearned_finance_income_link" url="${/request/@context_path}/modules/hls/HLS801/con_unearned_finance_income.lview"/> -->
        <a:link id="hls_monthly_statement_link"
                url="${/request/@context_path}/modules/hls/HLS801/hls_monthly_statement.lview"/>
        <a:link id="gld_period_pkg_init_period_link" model="db.gld_period_pkg.init_period" modelaction="update"/>
        <a:link id="gld_period_pkg_close_period_link" model="db.gld_period_pkg.close_period" modelaction="execute"/>
        <a:link id="gld_period_pkg_open_period_link" model="db.gld_period_pkg.open_period" modelaction="execute"/>
        <a:link id="formula_sheets_excel_id"
                url="${/request/@context_path}/modules/hls/HLS801/con_unearned_finance_income_excel_sheets.lsc"/>
        <a:link id="insert_tre_accrued_interest_link" model="hls.HLS801.insert_tre_accrued_interest"
                modelaction="execute"/>
        <a:link id="insert_con_finance_income_link" model="hls.HLS801.con_finance_income" modelaction="update"/>
        <a:link id="period_month_close_link" model="hls.HLS801.period_month_close" modelaction="execute"/>
        <a:link id="tre_interest_confirm_link" model="hls.HLS801.tre_interest_confirm" modelaction="execute"/>
        <a:link id="main_link" url="${/request/@context_path}/welcome.lview"/>
        <a:link id="user_main_link" url="${/request/@context_path}/user_role_home_page.lview"/>
        <a:link id="csh_current_period_link" model="hls.HLS801.csh_current_period_query" modelaction="update"/>
        <a:link id="csh_check_acr_link" model="hls.HLS801.csh_current_period_query" modelaction="execute"/>
        <a:link id="hls_tax_confirm_link" model="hls.HLS801.hls_tax_act_confirm" modelaction="update"/>
        <a:link id="hls_tax_refresh_link" model="hls.HLS801.hls_tax_act_confirm" modelaction="execute"/>
        <a:link id="hls_tax_confirm_create_je_link"
                url="${/request/@context_path}/modules/hls/HLS801/tax_confirm.lsc"/>
        <a:link id="create_con_monthly_statement_link" model="hls.HLS801.con_monthly_statement" modelaction="update"/>
        <a:link id="con_monthly_submit_link" model="hls.HLS801.con_monthly_statement_wfl" modelaction="update"/>
        <a:link id="con_reset_monthlyend_link" model="hls.HLS801.get_wfl_status" modelaction="update"/>
        <!--        <a:link id="acp_invoice_attachment_uploadFile_id" url="${/request/@context_path}/check_uploadFile.lview"/>-->
        <a:link id="hls_attachment_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="hls_attachment_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
        <a:link id="hls_attachment_uploadonlyFile_id" url="${/request/@context_path}/uploadonlyFile.lview"/>
        <a:link id="con_exist_approving_id" model="hls.HLS801.con_exist_approving" modelaction="query"/>
        <a:link id="gld_close_period_check_link" model="db.gld_period_pkg.close_period" modelaction="update"/>
        <script><![CDATA[
        //HLS801.NEXT_STEP
        var step = 1;
        var g_company_id;
        var g_company_id_2;

        var first_flag = 'Y';
        //alert('${/model/sys_role_path/record/@role_code}');

        $L.onReady(function () {
            if ('${/model/sys_role_path/record/@role_code}' == 'N') {
                var win = $L.showInfoMessage('${l:PROMPT}', '您暂无权限查看!');
                win.on('close', function () {
                    history.back();
                });
            }
            if('${/model/role_code/record/@role_code}'!='0013'&&'${/model/role_code/record/@role_code}'!='HAND'&&'${/model/role_code/record/@role_code}'!='0017'){
                document.getElementById('step_0').style.display = "none";
                document.getElementById('step_next').style.display = "none";
                document.getElementById('reset_monthlyend_id').style.display = "none";
            }
           if('${/model/con_status/record/@wfl_count}'>0){
              var rocode= $('attachment_list_ds');
               rocode.getField('report_name').setReadOnly(true);
               document.getElementById('hls801_delete_id').style.display = "none";
           }
            $('attachment_list_ds').query();
        });

        function nextStep() {
            var stepTabPanel = $('step');
            step = step + 1;
            stepTabPanel.setEnabled(step);
            stepTabPanel.selectTab(step);
            stepTabPanel.setDisabled(step - 1);
        }

        //HLS801.LAST_STEP

        function upStep() {
            var stepTabPanel = $('step');

            step = step - 1;
            stepTabPanel.setEnabled(step);
            stepTabPanel.selectTab(step);
            stepTabPanel.setDisabled(step + 1);

        }

        //取消

        function cancelFun() {
            //history.go(-1);
            window.location.href = $('main_link').getUrl();
        }

        function backFun() {
            Leaf.showConfirm('${l:HLS.PROMPT}', '确定返回？', function okFun() {
                window.location.href = $('hls_monthly_statement_link').getUrl();
            }, function canFun() {
            });
        }

        function step_0NextStep() {
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            var period_name = typeof (record.get('period_name')) == 'undefined' ? 0 : record.get('period_name');
            var calc_end_date = typeof (record.get('calc_end_date')) == 'undefined' ? 0 : record.get('calc_end_date');
            if (period_name == 0 || period_name == '' || calc_end_date == 0 || calc_end_date == '') {
                Leaf.showMessage('${l:HLS.PROMPT}', '请确认期间以及截止日！');
            } else {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
                Leaf.request({
                    url: $('hls_tax_confirm_link').getUrl(),
                    para: {
                        internal_period_num: record.get('internal_period_num'),
                        first_flag: first_flag,
                        period_name: record.get('period_name'),
                        calc_end_date: record.get('calc_end_date')
                    },
                    success: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                        first_flag = 'N';
                        $('hl_sales_tax_act_ds').setQueryParameter('period_name', record.get('period_name'));
                        $('hl_sales_tax_act_ds').query();
                        nextStep();

                    },
                    failure: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });


            }
        }

        function step_1NextStep() {
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            var period_name = record.get('period_name');
            var calc_end_date = record.get('calc_end_date');

            $('unearned_finance_income_ds').setQueryParameter('calc_end_date', record.get('calc_end_date'));
            $('unearned_finance_income_ds').query();
            nextStep();
            /* year = period_name.substring(0, 4);
             month = period_name.substring(5, 7);
             var query_ds = $('unearned_finance_income_query_ds');
             var qrecord = query_ds.getAt(0);
             qrecord.set('year',year);
             qrecord.set('month',month);
             $('unearned_finance_income_ds').setQueryParameter('calc_end_date', record.get('calc_end_date'));
             $('unearned_finance_income_ds').query(); */

        }

        function step_2NextStep() {
            nextStep();
        }

        function hls202_link_con901_fun() {
            // window.location.href = $('con_finance_income_link').getUrl();
            new Leaf.Window({
                id: 'con_finance_income_window',
                url: $('con_finance_income_link').getUrl(),
                params: {
                    winId: 'con_finance_income_window'
                },
                title: '',
                fullScreen: true
            });
        }


        function accrued_interest_query() {
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            $('tre_accrued_interest_ds').setQueryParameter('calc_end_date', record.get('calc_end_date'));
            $('tre_accrued_interest_ds').query();

        }

        function do_accrued_interest_excel() {
            var url;
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            if (Ext.isEmpty(g_company_id)) {
                url = $('formula_sheets_excel_id').getUrl() + '?internal_period_num=' + record.get('internal_period_num') + '&period_name=' + record.get('period_name') + '&datasoure_type=accrued_interest';
            } else {
                url = $('formula_sheets_excel_id').getUrl() + '?company_id=' + g_company_id + '&internal_period_num=' + record.get('internal_period_num') + '&period_name=' + record.get('period_name') + '&datasoure_type=accrued_interest';
            }
            window.open(url);
        }

        function accrued_interest_Onupdate(ds, record, name, value, oldVlaue) {
            if (name == 'company_id') {
                g_company_id = value;
            }


        }

        function unearned_finance_income_query() {
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            $('unearned_finance_income_ds').setQueryParameter('calc_end_date', record.get('calc_end_date'));
            $('unearned_finance_income_ds').query();

        }

        function do_unearned_finance_income_excel() {
            var url;
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            if (Ext.isEmpty(g_company_id_2)) {
                url = $('formula_sheets_excel_id').getUrl() + '?internal_period_num=' + record.get('internal_period_num') + '&period_name=' + record.get('period_name') + '&datasoure_type=unearned_finance_income';
            } else {
                url = $('formula_sheets_excel_id').getUrl() + '?company_id=' + g_company_id_2 + '&internal_period_num=' + record.get('internal_period_num') + '&period_name=' + record.get('period_name') + '&datasoure_type=unearned_finance_income';
            }
            window.open(url);
        }

        function unearned_finance_income_Onupdate(ds, record, name, value, oldVlaue) {
            if (name == 'company_id') {
                g_company_id_2 = value;
            }
        }

        function monthly_statement_Onupdate(ds, record, name, value, oldVlaue) {
            if (name == 'period_name') {
                year = value.substring(0, 4);
                month = value.substring(5, 7);
                var query_ds = $('accrued_interest_query_ds');
                var qrecord = query_ds.getAt(0);
                var query_ds_1 = $('unearned_finance_income_query_ds');
                var qrecord_1 = query_ds_1.getAt(0);

                record.set('calc_end_date', '');

                qrecord.set('year', year);
                qrecord.set('month', month);
                qrecord_1.set('year', year);
                qrecord_1.set('month', month);
                $('tre_accrued_interest_ds').setQueryParameter('internal_period_num', record.get('internal_period_num'));
                $('tre_accrued_interest_ds').query();
                $('unearned_finance_income_ds').setQueryParameter('internal_period_num', record.get('internal_period_num'));
                $('unearned_finance_income_ds').query();
                $('close_open_ds').setQueryParameter('internal_period_num', record.get('internal_period_num'));
                $('close_open_ds').setQueryParameter('period_set_code', '${/model/fieldset/record/@period_set_code}');
                $('close_open_ds').query();
                record.getField('calc_end_date').setLovPara('internal_period_num', record.get('internal_period_num'));
            } else if (name == 'calc_end_date') {
                // day = value.substring(8, 10);
                // var quer_ds_1 = $('unearned_finance_income_query_ds');
                // var qrec_1 = quer_ds_1.getAt(0);
                // qrec_1.set('day', day);
                // qrec_1.set('calc_end_date', value);	
                $('unearned_finance_income_ds').setQueryParameter('calc_end_date', record.get('calc_end_date'));
                $('unearned_finance_income_ds').query();
            }
        }


        function openPeriodDs(value, record, name) {

            var period_status_code = record.get('period_status_code');
            var ds = "close_open_ds";
            if (period_status_code == 'C' || period_status_code == 'U') {
                var url = $('gld_period_pkg_open_period_link').getUrl();
                return '<a href="javascript:executeOpen(\'' + ds + '\',\'' + url + '\',' + record.id + ')">${l:OPEN_PERIOD}</a>';
            } else if (period_status_code == 'O') {
                return '';
            }
        }

        function closePeriodDs(value, record, name) {
            var period_status_code = record.get('period_status_code');
            var ds = "close_open_ds";
            if (period_status_code == 'C' || period_status_code == 'U') {
                return '';
            } else if (period_status_code == 'O') {
                var url = $('gld_period_pkg_close_period_link').getUrl();
                return '<a href="javascript:executeClose(\'' + ds + '\',\'' + url + '\',' + record.id + ')">${l:CLOSE_PERIOD}</a>';
            }
        }


        function statusRenderer(value, record, name) {

            if (value == null || value == undefined) {
                return '${l:PROMPT.NOT_OPEN}';
            } else if (value == 'O') {
                return '${l:PROMPT.OPENED}';
            } else if (value == 'C') {
                return '${l:PROMPT.CLOSED}';
            }
        }

        function executeOpen(ds, url, id) {
            record = $(ds).findById(id);
            Leaf.request({
                url: url,
                para: record.data,
                success: function () {

                    record.set('period_status_code', 'O');
                    Leaf.SideBar.enable = true;
                    Leaf.SideBar.show({
                        msg: '打开成功',
                        duration: 3000
                    });

                },
                scope: this
            });
        }

        function executeClose(ds, url, id) {
            record = $(ds).findById(id);
            if ($('close_open_ds').getAll().length == 0) {
                Leaf.request({
                    url: $('gld_period_pkg_init_period_link').getUrl(),
                    para: record.data,
                    success: function () {
                        Leaf.showMessage('${l:PROMPT}', '${l:FND_DIMENSION_VALUES.OPR_SUC}', function (cmp) {
                            document.location.reload();
                            cmp.close();
                        });
                    },
                    scope: this
                });
            } else {
               $L.request({
               url: $('gld_close_period_check_link').getUrl(),
                para: record.data,
                success: function (args) {
                    if (args.result.p_err_msg) {
                   Leaf.showConfirm('提示', args.result.p_err_msg, function okFun() {
                     Leaf.request({
                      url: url,
                      para: record.data,
                      success: function() {
                      record.set('period_status_code','C');
                      Leaf.SideBar.enable = true;
                          Leaf.SideBar.show({
                              msg: '关闭成功',
                              duration: 3000
                          });
                    },
                      scope: this
                  });
              },function canFun(){},700,400);
            } else {
                    Leaf.request({
                       url: url,
                       para: record.data,
                       success: function() {

                           record.set('period_status_code','C');

                           Leaf.SideBar.enable = true;
                           Leaf.SideBar.show({
                               msg: '关闭成功',
                               duration: 3000
                           });

                       },
                       scope: this
                   });
                   }

               },
               failure: function () {
                 },
               error: function () {
                },
               scope: this
           });
            }
        }

        function unearned_finance_income_clear() {
            $('unearned_finance_income_grid').clear();
        }

        function accrued_interest_clear() {
            $('tre_accrued_interest_grid').clear();
        }

        var g_return_value_1;

        function accrued_interest_calculate() {
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            year = record.get('period_name').substring(0, 4);
            month = record.get('period_name').substring(5, 7);
            Leaf.showConfirm('${l:HLS.PROMPT}', year + '年' + month + '月' + '结算，确认计算计提利息？', function okFun() {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
                Leaf.request({
                    url: $('insert_tre_accrued_interest_link').getUrl(),
                    para: {
                        internal_period_num: record.get('internal_period_num')
                    },
                    success: function (args) {
                        var result = args.result;
                        if (!result) {
                            Leaf.showWarningMessage('', '${l:PRJ509.DATA_NOT_BACK}', null, 200, 100);
                            return;
                        }
                        g_return_value_1 = result.return_value_1;
                        if (g_return_value_1 != 'SUCCESS') {
                            Leaf.showWarningMessage('', '计提利息计算出错！', null, 200, 100);
                            Leaf.Masker.unmask(Ext.getBody());
                            return;
                        }
                        Leaf.Masker.unmask(Ext.getBody());
                        $('tre_accrued_interest_ds').setQueryParameter('internal_period_num', record.get('internal_period_num'));
                        $('tre_accrued_interest_ds').query();

                    },
                    failure: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
            }, Leaf.Masker.unmask(Ext.getBody()));
        }

        var g_return_value;
        function month_end_next() {
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            var year = record.get('period_name').substring(0, 4);
            var month = record.get('period_name').substring(5, 7);
            var date  = year+month;
            var wfl_count;
            $L.request({
                url: '${/request/@context_path}/autocrud/hls.HLS801.get_wfl_status/query',
                para: {
                    date: date
                },
                sync: true,
                success: function (res) {
                    wfl_count=res.result.record.wfl_count;
                },
                error: function () {

                },
                failure: function () {

                },
                scope: this,
                sync: true,
            });

            if( wfl_count ==0){
                $L.showMessage('提示','请先提交审批在再进行下一步');
                return ;
            }else{
                nextStep();
            }
        }
        //add  by gzj
        function next_monthly_end() {
            //nextStep();
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            var year = record.get('period_name').substring(0, 4);
            var month = record.get('period_name').substring(5, 7);
            var date  = year+month;
            Leaf.request({
                url: $('create_con_monthly_statement_link').getUrl(),
                para: {
                    date: date
                },
                success: function () {
                    $('month_report_ds').query();
                    nextStep();
                },
                scope: this
            });

        }
        //add  by 月结报表提交审批
        function submit() {
            Leaf.showConfirm('${l:HLS.PROMPT}', '是否确定提交审批？', function() {
                var headers_ds = $('hls_monthly_statement_ds');
                var record = headers_ds.getAt(0);
                var year = record.get('period_name').substring(0, 4);
                var month = record.get('period_name').substring(5, 7);
                var date  = year+month;
                Leaf.request({
                    url: $('con_monthly_submit_link').getUrl(),
                    para: {
                        date: date
                    },
                    success: function () {
                        Leaf.showMessage('${l:HLS.PROMPT}', '提交审批成功');
                        $('month_report_ds').query();
                    },
                    scope: this
                });
            });
        }

        //add by 34291 重置月结
        function  reset_monthlyend (){
            Leaf.showConfirm('${l:HLS.PROMPT}', '请确认是否重置当月月结？', function() {
                var headers_ds = $('hls_monthly_statement_ds');
                var record = headers_ds.getAt(0);
                var year = record.get('period_name').substring(0, 4);
                var month = record.get('period_name').substring(5, 7);
                var date  = year+month;
                Leaf.request({
                    url: $('con_reset_monthlyend_link').getUrl(),
                    para: {
                        date: date
                    },
                    success: function () {
                        Leaf.showMessage('${l:HLS.PROMPT}', '操作成功');
                        $('month_report_ds').query();
                    },
                    scope: this
                });
            }, null, null, 85);
        }
        function detail_upload_window(record_id) {
            var record = $('month_report_ds').getAll()[0];
            var status=record.get('status_name');
            if('${/model/role_code/record/@role_code}'=='0014'){
                if(status=='APPROVING'||status=='APPROVED'){
                    var url = $('hls_attachment_downloadFile_id').getUrl() + '?table_name=BUSINESS_REPORT&header_id=' + record_id;
                    var win = new Leaf.Window({
                        url: url,
                        title: '${l:HLS.SUPPORTING_DOCUMENT}',
                        id: 'month_downloadFile_id',
                        width: 850,
                        height: 400
                    });
                    win.on('close', function() {
                        $('month_report_ds').query();
                    });
                }else{
                    var url = $('hls_attachment_uploadFile_id').getUrl() + '?table_name=BUSINESS_REPORT&header_id=' + record_id;
                    var win = new Leaf.Window({
                        url: url,
                        title: '${l:HLS.SUPPORTING_DOCUMENT}',
                        id: 'month_uploadFile_id',
                        width: 850,
                        height: 400
                    });
                }
                win.on('close', function() {
                    $('month_report_ds').query();
                });
            }else{
                var url = $('hls_attachment_downloadFile_id').getUrl() + '?table_name=BUSINESS_REPORT&header_id=' + record_id;
                var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'month_downloadFile_id',
                    width: 850,
                    height: 400
                });
                win.on('close', function() {
                    $('month_report_ds').query();
                });
            }

        }
        function attachment_upload(val,rec,name) {
            return '<a href=javascript:detail_upload_window('+rec.get('tab_id')+')>附件上传</a>';
        }
        function sbo_detail_upload_window(record_id) {

            var record = $('month_report_ds').getAll()[0];
            var status=record.get('status_name');
            if('${/model/role_code/record/@role_code}'=='0014'){
                if(status=='APPROVING'||status=='APPROVED'){
                    var url = $('hls_attachment_downloadFile_id').getUrl() + '?table_name=SBO_REPORT&header_id=' + record_id;
                    var win = new Leaf.Window({
                        url: url,
                        title: '${l:HLS.SUPPORTING_DOCUMENT}',
                        id: 'sbo_month_downloadFile_id',
                        width: 850,
                        height: 400
                    });
                    win.on('close', function() {
                        $('month_report_ds').query();
                    });
                }else{
                    var url = $('hls_attachment_uploadFile_id').getUrl() + '?table_name=SBO_REPORT&header_id=' + record_id;
                    var win = new Leaf.Window({
                        url: url,
                        title: '${l:HLS.SUPPORTING_DOCUMENT}',
                        id: 'sbo_month_uploadFile_id',
                        width: 850,
                        height: 400
                    });
                    win.on('close', function() {
                        $('month_report_ds').query();
                    });
                }
            }else{
                var url = $('hls_attachment_downloadFile_id').getUrl() + '?table_name=SBO_REPORT&header_id=' + record_id;
                var win = new Leaf.Window({
                    url: url,
                    title: '${l:HLS.SUPPORTING_DOCUMENT}',
                    id: 'sbo_month_downloadFile_id',
                    width: 850,
                    height: 400
                });
                win.on('close', function() {
                    $('month_report_ds').query();
                });
            }
        }
        function sbo_attachment_upload(val,rec,name) {
            return '<a href=javascript:sbo_detail_upload_window('+rec.get('tab_id')+')>附件上传</a>';
        }


        function unearned_finance_income_confirm() {
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);

            //add by wdd 20180514
            // var income_ds = $('unearned_finance_income_ds');
            // var income_record = income_ds.getAll();
            // if (income_record.length) {
            //     for (var i = 0; i < income_record.length; i++) {
            //         var line_income_record = income_record[i];
            //         var finance_income_recognized = line_income_record.get('finance_income_recognized');
            //         if (finance_income_recognized == 'Y') {
            //             Leaf.showMessage('提示', '该日收入已确认，请勿重复确认！', null, 250, 100);
            //             return;
            //         }
            //
            //     }
            // }
            //end by wdd
            year = record.get('period_name').substring(0, 4);
            month = record.get('period_name').substring(5, 7);
            day = record.get('calc_end_date').substring(8, 10);
            Leaf.showConfirm('${l:HLS.PROMPT}', year + '年' + month + '月' + day + '日' + '结算，确定执行收入确认？', function okFun() {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
                Leaf.request({
                    url: $('insert_con_finance_income_link').getUrl(),
                    para: {
                        internal_period_num: record.get('internal_period_num'),
                        calc_end_date: record.get('calc_end_date')
                    },
                    success: function (args) {
                        // modify by wdd 20180514
                        // 收入确认出错校验移至PKG
                        // var result = args.result;
                        // if (!result) {
                        // Leaf.showWarningMessage('', '${l:PRJ509.DATA_NOT_BACK}', null, 200, 100);
                        // return;
                        // }
                        // g_return_value = result.return_value;
                        // if (g_return_value != 'SUCCESS') {
                        // Leaf.showWarningMessage('', '收入确认出错！', null, 200, 100);
                        // Leaf.Masker.unmask(Ext.getBody());
                        // return;
                        // }
                        //end by wdd
                        Leaf.Masker.unmask(Ext.getBody());
                        $('unearned_finance_income_ds').setQueryParameter('calc_end_date', record.get('calc_end_date'));
                        $('unearned_finance_income_ds').query();

                    },
                    failure: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
            }, Leaf.Masker.unmask(Ext.getBody()));
        }

        function monthlyendFun() {
            /*
             @Added: Liyuan.Chen
             @Date: 2020/5/20
             @Description: 月结结束校验
             @Param:
             */
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            var role_flag = '${/model/sys_role_path/record/@role_code}';
            //add by 34291 月结结束前需要提交审批
            var year = record.get('period_name').substring(0, 4);
            var month = record.get('period_name').substring(5, 7);
            var date  = year+month;
            var wfl_count;
            $L.request({
                url: '${/request/@context_path}/autocrud/hls.HLS801.get_wfl_status/query',
                para: {
                    date: date
                },
                sync: true,
                success: function (res) {
                    wfl_count=res.result.record.wfl_count;
                },
                error: function () {

                },
                failure: function () {

                },
                scope: this,
                sync: true,
            });

            if( wfl_count ==0){
                $L.showMessage('提示','请先提交审批通过后在再进行下一步');
                return ;
            }
            Leaf.showConfirm('${l:HLS.PROMPT}', '本次月结结束后不可执行当月其他相关操作，是否确认结束？', function okFun() {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
                $L.request({
                    url: $('csh_current_period_link').getUrl(),
                    para: {
                        csh_date: record.get('period_name'),
                        role_flag: role_flag
                    },
                    success: function (args) {
                        Leaf.request({
                            url: $('period_month_close_link').getUrl(),
                            para: {
                                internal_period_num: record.get('internal_period_num'),
                                calc_end_date: record.get('calc_end_date')
                            },
                            success: function (args) {
                                var result = args.result;
                                if (!result) {
                                    Leaf.showWarningMessage('', '${l:PRJ509.DATA_NOT_BACK}', null, 200, 100);
                                    return;
                                }
                                var period_return_value = result.period_return_value;
                                if (period_return_value != 'SUCCESS') {
                                    Leaf.showWarningMessage('', '月结结束出错！', null, 200, 100);
                                    Leaf.Masker.unmask(Ext.getBody());
                                    return;
                                }
                                Leaf.Masker.unmask(Ext.getBody());

                            },
                            failure: function () {
                                Leaf.Masker.unmask(Ext.getBody());
                            },
                            error: function () {
                                Leaf.Masker.unmask(Ext.getBody());
                            },
                            scope: this
                        });
                    },
                    failure: function () {
                        $L.Masker.unmask(Ext.getBody());
                    },
                    error: function () {
                        $L.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });

            }, Leaf.Masker.unmask(Ext.getBody()));
        }

        function accrued_interest_confirm() {
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            year = record.get('period_name').substring(0, 4);
            month = record.get('period_name').substring(5, 7);
            Leaf.showConfirm('${l:HLS.PROMPT}', year + '年' + month + '月' + '结算，确认计提利息？', function okFun() {
                Leaf.Masker.mask(Ext.getBody(), '${l:HLS.SAVING}');
                Leaf.request({
                    url: $('tre_interest_confirm_link').getUrl(),
                    para: {
                        internal_period_num: record.get('internal_period_num'),
                        calc_end_date: record.get('calc_end_date')
                    },
                    success: function (args) {
                        var result = args.result;
                        if (!result) {
                            Leaf.showWarningMessage('', '${l:PRJ509.DATA_NOT_BACK}', null, 200, 100);
                            return;
                        }
                        var confirm_return_value = result.confirm_return_value;
                        if (confirm_return_value != 'SUCCESS') {
                            Leaf.showWarningMessage('', '计提利息确认出错！', null, 200, 100);
                            Leaf.Masker.unmask(Ext.getBody());
                            return;
                        }
                        Leaf.Masker.unmask(Ext.getBody());

                    },
                    failure: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
            }, Leaf.Masker.unmask(Ext.getBody()));

        }

        function ratePercentRender(value, record, name) {
            if (!Ext.isEmpty(value)) {
                return parseFloat(mul(value, 100)) + '%';
            }
        }

        function csh_onload(ds) {
            if ('${/model/sys_role_path/record/@role_code}' == 'NO') {
                var records = $(ds.id).getAll();
                records.forEach(function (v, i) {
                    if (v.get('csh_confirm_flag') == 'Y') {
                        v.getField('ref_v04').setReadOnly(true);
                    }
                });
            }
        }

        function csh_transaction_confirm() {
            //gzj
            var role_flag = '${/model/sys_role_path/record/@role_code}';
            var record = $('csh_transaction_confirm_ds').getSelected()[0];
            //校验是否还有未审核的保证金划转
            var trans_review_count;

            $L.request({
                url: '${/request/@context_path}/autocrud/csh.CSH531.get_trans_review_status/query',
                para: {
                    csh_date: record.get('csh_date')
                },
                sync: true,
                success: function (res) {
                    trans_review_count=res.result.record.trans_review_number;
                },
                error: function () {

                },
                failure: function () {

                },
                scope: this,
                sync: true,
            });

            if( trans_review_count >0){
                $L.showMessage('提示','有复核中的保证金，请完成复核后，再进行会计关账');
                return ;
            }



            if (role_flag == 'NO') {
                if (record.get('csh_confirm_flag') == 'Y') {
                    $L.showMessage('提示', '该月收款已确认,无需再次确认');
                    return;
                }
                $L.showConfirm('提示', '是否进行月结确认?', function () {
                    $L.Masker.mask(Ext.getBody(), '正在确认......');
                    $L.request({
                        url: $('csh_current_period_link').getUrl(),
                        para: {
                            ref_v04: record.get('ref_v04'),
                            csh_date: record.get('csh_date'),
                            role_flag: role_flag
                        },
                        success: function (args) {
                            $L.Masker.unmask(Ext.getBody());
                            if (args.result.p_err_msg) {
                                $L.showErrorMessage("提示", args.result.p_err_msg, null, 800, 300);
                            } else {
                                $L.SideBar.show({
                                    msg: '已确认',
                                    duration: 2000
                                });
                                $('csh_transaction_confirm_ds').query();

                            }

                        },
                        failure: function () {
                            $L.Masker.unmask(Ext.getBody());
                        },
                        error: function () {
                            $L.Masker.unmask(Ext.getBody());
                        },
                        scope: this,
                        sync: true,
                    });
                });
            }

            if (role_flag == 'YES') {
                /*if (record.get('csh_confirm_flag') == 'N') {
                    $L.showMessage('提示', '请先进行营业确认');
                    return;
                }*/
                $L.Masker.mask(Ext.getBody(), '正在执行......');
                $L.request({
                    url: $('csh_check_acr_link').getUrl(),
                    para: {
					csh_date: record.get('csh_date')
                    },
                    success: function (args) {
                        $L.Masker.unmask(Ext.getBody());
                        if (args.result.p_err_msg) {
                            $L.Masker.unmask(Ext.getBody());

                            $L.showConfirm('提示', args.result.p_err_msg, function () {
                                set_value_for_next_step(record.get('csh_date'));
                            });
                            //$L.showErrorMessage("提示", args.result.p_err_msg, null, 800, 400);

                        } else {
                            set_value_for_next_step(record.get('csh_date'));
                        }

                    },
                    failure: function () {
                        $L.Masker.unmask(Ext.getBody());
                    },
                    error: function () {
                        $L.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
                /*$L.showConfirm('提示', '是否确认下一步?', function() {
                    $L.Masker.mask(Ext.getBody(), '正在执行......');
                    $L.request({
                        url: $('csh_current_period_link').getUrl(),
                        para: {
                            ref_v04 : record.get('ref_v04'),
                            csh_date : record.get('csh_date'),
                            role_flag : role_flag
                        },
                        success: function(args) {
                            $L.SideBar.show({
                                msg: '操作成功',
                                duration: 2000
                            });
                            $L.Masker.unmask(Ext.getBody());
                            set_value_for_next_step(record.get('csh_date'));
                        },
                        failure: function() {
                            $L.Masker.unmask(Ext.getBody());
                        },
                        error: function() {
                            $L.Masker.unmask(Ext.getBody());
                        },
                        scope: this
                    });
                });*/
            }

        }

        function set_value_for_next_step(value) {
            var internal_period_num = (value.substr(0, 4) + value.substr(5, 2)) * 1;
            var year = value.substring(0, 4);
            var month = value.substring(5, 7);
            var record = $('hls_monthly_statement_ds').getAt(0);
            record.set('internal_period_num', internal_period_num);
            record.set('period_name', value);
            var lastDay = new Date(year, month, 0);
            record.set('calc_end_date', Leaf.formatDate(lastDay));
            nextStep();
        }

        function hl_sales_tax_act_refresh() {
            var record = $('hls_monthly_statement_ds').getAt(0);
            Leaf.Masker.mask(Ext.getBody(), '正在刷新...');
            Leaf.request({
                url: $('hls_tax_refresh_link').getUrl(),
                para: {
                    period_name: record.get('period_name'),
                    calc_end_date: record.get('calc_end_date')
                },
                success: function () {
                    Leaf.Masker.unmask(Ext.getBody());
                    Leaf.SideBar.enable = true;
                    Leaf.SideBar.show({
                        msg: '刷新成功',
                        duration: 3000
                    });
                    $('hl_sales_tax_act_ds').setQueryParameter('period_name', record.get('period_name'));
                    $('hl_sales_tax_act_ds').query();
                },
                failure: function () {
                    Leaf.Masker.unmask(Ext.getBody());
                },
                error: function () {
                    Leaf.Masker.unmask(Ext.getBody());
                },
                scope: this
            });
        }

        function tax_confirm_beforeremove(ds, records) {
            for (var i = 0; i < records.length; i++) {
                if (records[i].get('tax_create_je_flag') == 'Y') {
                    Leaf.showMessage('${l:HLS.PROMPT}', '本该期间内增值税已确认，不能删除!');
                    return false;
                }
            }
        }

        function tax_confirm() {
            var records = $('hl_sales_tax_act_ds').getAll();
            var calc_end_date = $('hls_monthly_statement_ds').getAt(0).get('calc_end_date');
            var period_name = $('hls_monthly_statement_ds').getAt(0).get('period_name');
            var param = {};
            var saveData = [];
            for (i = 0; i < records.length; i++) {
                var record = records[i];
                if (record.get('tax_create_je_flag') == 'Y') {
                    Leaf.showMessage('${l:HLS.PROMPT}', '该期间内增值税已确认!');
                    return false;
                }
                record.set('_status', 'update');
                saveData.push(record.data);
            }
            param['details'] = saveData;
            param['calc_end_date']=calc_end_date;
            param['period_name']=period_name;
            $L.showConfirm('提示', '是否进行增值税确认?', function () {
                Leaf.Masker.mask(Ext.getBody(), '正在进行增值税确认...');
                Leaf.request({
                    url: $('hls_tax_confirm_create_je_link').getUrl(),
                    para: param,
                    success: function (args) {
                        Leaf.SideBar.enable = true;
                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 3000
                        });
                        Leaf.Masker.unmask(Ext.getBody());
                        $('hl_sales_tax_act_ds').setQueryParameter('period_name', record.get('period_name'));
                        $('hl_sales_tax_act_ds').query();
                    },
                    failure: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    error: function () {
                        Leaf.Masker.unmask(Ext.getBody());
                    },
                    scope: this
                });
            });
        }

        function hls801_add() {
            var ds = $('attachment_list_ds');
            var record = ds.create(ds.currentIndex);
            $('attachment_list_id').showEditorByRecord(record);

        }
        function hls801_delete() {
            var ds = $('attachment_list_ds');
            var records = ds.getSelected();
            if (records.length != 0) {
                Leaf.showConfirm('${l:HLS.PROMPT}', '${l:HLS030.CONFIRM_DELETE}', function() {
                    ds.remove(records);
                });
            }

        }
        function hls801_save() {
            Leaf.request({
                url: $('con_exist_approving_id').getUrl(),
                success: function(res) {
                    var wfl_count = res.result.record.wfl_count;
                    if (wfl_count==0){
                        var ds = $('attachment_list_ds');
                        if (ds.validate()) {
                            ds.submit();
                        }
                        //$('attachment_list_ds').query();
                    }else{
                        Leaf.showMessage('${l:HLS.PROMPT}', '存在审批中的数据,无法修改月结资料!');
                        return false;
                    }

                },
                scope: this
            });


        }
        function process_monitoring(){
            var headers_ds = $('hls_monthly_statement_ds');
            var record = headers_ds.getAt(0);
            var year = record.get('period_name').substring(0, 4);
            var month = record.get('period_name').substring(5, 7);
            var date  = year+month;
            var win = new Leaf.Window({
                id: 'history_check',
                url: '${/request/@context_path}/modules/hls/HLS801/zj_wfl_approve_history_check.lview',
                params: {
                    date: date
                },
                title: '单据历史查看',
                height: 500,
                width: 860,
                fullScreen: true
            });
        }

        ]]></script>
        <a:dataSets>
            <a:dataSet id="yes_no_ds" lookupCode="YES_NO"/>
            <a:dataSet id="csh_transaction_confirm_ds" selectable="true" selectionModel="single" autoQuery="true"
                       fetchAll="true" model="hls.HLS801.csh_current_period_query"
                       queryUrl="${/request/@context_path}/autocrud/hls.HLS801.csh_current_period_query/query">
                <a:fields>
                    <a:field name="csh_date" readOnly="true"/>
                    <a:field name="csh_count" readOnly="true"/>
                    <a:field name="csh_not" readOnly="true"/>
                    <a:field name="csh_partial" readOnly="true"/>
                    <a:field name="ref_v04"/>
                    <a:field name="csh_confirm_flag" readOnly="true" checkedValue="Y" uncheckedValue="N"/>
                </a:fields>
                <a:events>
                    <a:event name="load" handler="csh_onload"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="hls_monthly_statement_ds" autoCreate="true">
                <a:fields>
                    <a:field name="period_name" lovGridHeight="300" lovHeight="500"
                             lovService="gld.gld_period_lov?monthly_closed_flag=N&amp;period_status_code=O"
                             lovWidth="500" required="true" title="GLD_PERIODS.PERIOD_NAME" readOnly="true">
                        <a:mapping>
                            <a:map from="internal_period_num" to="internal_period_num"/>
                            <a:map from="period_name" to="period_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="internal_period_num"/>
                    <a:field name="calc_end_date" lovGridHeight="300" lovHeight="500"
                             lovService="hls.HLS801.calc_end_date_ds" lovWidth="500" required="true" title="截止日查询"
                             readOnly="true">
                        <a:mapping>
                            <!--   <a:map from="internal_period_num" to="internal_period_num"/> -->
                            <a:map from="calc_end_date" to="calc_end_date"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="monthly_statement_Onupdate"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="accrued_interest_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="company_code" lovGridHeight="300" lovHeight="450"
                             lovService="hls.HLS801.fnd_companies_for_lov" lovWidth="500" title="">
                        <a:mapping>
                            <a:map from="company_id" to="company_id"/>
                            <a:map from="company_code" to="company_code"/>
                            <a:map from="company_short_name" to="company_short_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="year" defaultValue="${/parameter/@year}"/>
                    <a:field name="month" defaultValue="${/parameter/@month}"/>
                    <a:field name="internal_period_num" defaultValue="${/parameter/@internal_period_num}"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="accrued_interest_Onupdate"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="tre_accrued_interest_ds" autoPageSize="true" autoQuery="false"
                       model="hls.HLS801.tre_accrued_interest" queryDataSet="accrued_interest_query_ds"
                       selectable="true">
                <a:fields>
                    <a:field name="recognized_flag" checkedValue="Y" defaultValue="Y" readOnly="true"
                             uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="unearned_finance_income_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="company_code" lovGridHeight="300" lovHeight="450"
                             lovService="hls.HLS801.fnd_companies_for_lov" lovWidth="500" title="">
                        <a:mapping>
                            <a:map from="company_id" to="company_id"/>
                            <a:map from="company_code" to="company_code"/>
                            <a:map from="company_short_name" to="company_short_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="year" defaultValue="${/parameter/@year}"/>
                    <a:field name="month" defaultValue="${/parameter/@month}"/>
                    <a:field name="internal_period_num" defaultValue="${/parameter/@internal_period_num}"/>
                    <a:field name="calc_end_date" defaultValue="${/parameter/@calc_end_date}"/>
                    <a:field name="finance_income_recognized" displayField="code_value_name" options="yes_no_ds"
                             returnField="finance_income_recognized" valueField="code_value"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="unearned_finance_income_Onupdate"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="unearned_finance_income_ds" autoPageSize="true" autoQuery="false"
                       model="hls.HLS801.con_unearned_finance_income" queryDataSet="unearned_finance_income_query_ds"
                       selectable="true">
                <a:fields>
                    <a:field name="finance_income_recognized" checkedValue="Y" defaultValue="Y" readOnly="true"
                             uncheckedValue="N"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="close_open_ds" autoQuery="false" fetchAll="true" model="hls.HLS801.hls_current_period_query"
                       queryUrl="${/request/@context_path}/autocrud/hls.HLS801.hls_current_period_query/query">
            </a:dataSet>
            <a:dataSet id="hl_sales_tax_act_ds" autoQuery="true" fetchAll="true"
                       model="hls.HLS801.hls_tax_act_confirm"
                       queryUrl="${/request/@context_path}/autocrud/hls.HLS801.hls_tax_act_confirm/query"
                       selectable="true" selectionModel="multiple">
                <a:events>
                    <a:event name="beforeremove" handler="tax_confirm_beforeremove"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="report_name_ds" lookupCode="HLS_REPORT_NAME"/>
            <a:dataSet id="month_report_ds" autoQuery="false" fetchAll="true" model="hls.HLS801.con_monthly_statement"
                       queryDataSet="unearned_finance_income_query_ds">
                <a:fields>
                    <a:field name="report_name" />
                </a:fields>
            </a:dataSet>
            <a:dataSet id="attachment_list_ds" autoQuery="true" fetchAll="true" model="hls.HLS801.hls_attachment_list" selectable="true"
                       queryUrl="${/request/@context_path}/autocrud/hls.HLS801.hls_attachment_list/query">
                <a:fields>
                    <a:field name="report_name" required="true"/>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
            </a:screenTopToolbar>
            <!--——————————————————————美丽的分割线————————————————————————-->
            <a:switch test="/model/sys_role_path/record/@role_code">
                <a:case value="NO">
                    <a:hBox>
                        <a:tabPanel id="step" marginHeight="80" marginWidth="50">
                            <a:tabs>
                                <a:tab id="step_1" disabled="false" marginHeight="20" width="100" prompt="营业月结"
                                       selected="true">
                                    <a:hBox height="50">
                                        <!--<a:button click="upStep" text="HLS801.LAST_STEP"/>-->
                                        <!--<a:label width="5"/>
                                        <a:button click="nextStep" text="HLS801.NEXT_STEP"/>-->
                                        <a:label width="5"/>
                                        <a:button click="csh_transaction_confirm" text="月结确认"/>
                                        <a:label width="5"/>
                                    </a:hBox>
                                    <p/>
                                    <a:grid id="csh_transaction_confirm_grid" bindTarget="csh_transaction_confirm_ds"
                                            marginHeight="200" marginWidth="80" navBar="true" style="margin-left:3px">
                                        <a:toolBar>
                                            <!--<a:button click="unearned_finance_income_query"
                                                      icon="${/request/@context_path}/images/search.png" text="HLS.QUERY"/>-->
                                            <!--                                    <a:button type="clear"/>-->
                                            <a:button icon="${/request/@context_path}/images/excel_16.png"
                                                      text="HLS.EXPORT"
                                                      type="excel"/>
                                        </a:toolBar>
                                        <a:columns>
                                            <a:column name="csh_date" prompt="月结日期" width="150" align="center"/>
                                            <a:column name="csh_count" prompt="收款总个数" width="120" align="center"/>
                                            <a:column name="csh_not" prompt="未核销收款数" width="120" align="center"/>
                                            <a:column name="csh_partial" prompt="部分核销收款数" width="120" align="center"/>
                                            <a:column name="ref_v04" prompt="备注" width="250" editor="csh_area_id"/>
                                            <a:column name="csh_confirm_flag" prompt="营业月结确认" width="80"
                                                      editor="csh_check_id"/>
                                        </a:columns>
                                        <a:editors>
                                            <a:textArea id="csh_area_id"/>
                                            <a:checkBox id="csh_check_id"/>
                                        </a:editors>
                                    </a:grid>
                                </a:tab>
                            </a:tabs>
                        </a:tabPanel>
                    </a:hBox>
                </a:case>
                <a:case value="YES">
                    <a:hBox>
                        <a:tabPanel id="step" marginHeight="80" marginWidth="50">
                            <a:tabs>
                                <a:tab id="step_0" disabled="true" prompt="月结资料维护" selected="false"
                                       width="100">
                                    <a:hBox height="50">
                                        <a:button disabled="true" click="upStep" text="HLS801.LAST_STEP"/>
                                        <a:label width="5"/>
                                        <a:button click="nextStep" text="HLS801.NEXT_STEP"/>
                                        <a:label width="80"/>
                                        <a:gridButton click="hls801_add" text="新增"/>
                                        <a:gridButton id="hls801_delete_id" click="hls801_delete" text="删除"/>
                                        <a:gridButton click="hls801_save" text="HLS.SAVE"/>
                                    </a:hBox>
                                    <p/>
                                    <a:grid id="attachment_list_id" bindTarget="attachment_list_ds" marginHeight="200"
                                            marginWidth="80" navBar="true" >
                                        <a:columns>
                                            <a:column name="report_name" align="center" prompt="报表名称" editor="report_name_edit"
                                                      width="100" />
                                        </a:columns>
                                        <a:editors>
                                            <a:textField id="report_name_edit"/>
                                        </a:editors>
                                    </a:grid>
                                </a:tab>
                                <a:tab id="step_1" disabled="false" marginHeight="20" width="100" prompt="营业月结"
                                       selected="true">
                                    <a:hBox height="50">
                                        <a:button id="step_next"  click="upStep" text="HLS801.LAST_STEP"/>
                                        <a:label width="5"/>
                                        <a:button click="csh_transaction_confirm" text="HLS801.NEXT_STEP"/>
                                    </a:hBox>
                                    <p/>
                                    <a:grid id="csh_transaction_confirm_grid" bindTarget="csh_transaction_confirm_ds"
                                            marginHeight="200" marginWidth="80" navBar="true" style="margin-left:3px">
                                        <a:toolBar>
                                            <!--<a:button click="unearned_finance_income_query"
                                                      icon="${/request/@context_path}/images/search.png" text="HLS.QUERY"/>-->
                                            <!--                                    <a:button type="clear"/>-->
                                            <a:button icon="${/request/@context_path}/images/excel_16.png"
                                                      text="HLS.EXPORT"
                                                      type="excel"/>
                                        </a:toolBar>
                                        <a:columns>
                                            <a:column name="csh_date" prompt="月结日期" width="150" align="center"/>
                                            <a:column name="csh_count" prompt="收款总个数" width="120" align="center"/>
                                            <a:column name="csh_not" prompt="未核销收款数" width="120" align="center"/>
                                            <a:column name="csh_partial" prompt="部分核销收款数" width="120" align="center"/>
                                            <a:column name="ref_v04" prompt="备注" width="250" editor="csh_area_id"/>
                                            <a:column name="csh_confirm_flag" prompt="营业月结确认" width="80"
                                                      editor="csh_check_id"/>
                                        </a:columns>
                                        <a:editors>
                                            <a:textArea id="csh_area_id" readOnly="true"/>
                                            <a:checkBox id="csh_check_id"/>
                                        </a:editors>
                                    </a:grid>
                                </a:tab>

                                <a:tab id="step_2" disabled="true" prompt="GLD_PERIODS.PERIOD_NAME" selected="false"
                                       width="100">
                                    <a:hBox height="50">
                                        <a:button click="upStep" text="HLS801.LAST_STEP"/>
                                        <a:label width="5"/>
                                        <a:button click="step_0NextStep" text="HLS801.NEXT_STEP"/>
                                    </a:hBox>
                                    <a:hBox>
                                        <a:fieldSet height="250" title="GLD_PERIODS.PERIOD_NAME" width="300">
                                            <a:lov name="period_name" bindTarget="hls_monthly_statement_ds"
                                                   prompt="GLD_PERIODS.PERIOD_NAME" width="200"/>
                                            <a:lov name="calc_end_date" bindTarget="hls_monthly_statement_ds"
                                                   prompt="截止日"
                                                   width="200"/>
                                        </a:fieldSet>
                                    </a:hBox>
                                </a:tab>
                                <a:tab id="step_3" disabled="true" marginHeight="200" prompt="提前收款确认增值税"
                                       selected="false"
                                       width="140">
                                    <a:hBox height="50">
                                        <a:button click="upStep" text="HLS801.LAST_STEP"/>
                                        <a:label width="5"/>
                                        <a:button click="nextStep" text="HLS801.NEXT_STEP"/>
                                        <a:label width="80"/>
                                        <a:button click="tax_confirm" text="增值税确认" width="95"/>
                                        <a:label width="5"/>
                                    </a:hBox>
                                    <p/>
                                    <a:grid id="hl_sales_tax_act_grid" bindTarget="hl_sales_tax_act_ds"
                                            marginHeight="195" marginWidth="80" navBar="true" style="margin-left:3px">
                                        <a:toolBar>
                                            <a:button click="hl_sales_tax_act_refresh"
                                                      icon="${/request/@context_path}/images/zjwfl/zjwfl_refresh.png"
                                                      text="刷新"/>
                                            <a:button type="delete"/>
                                            <a:button icon="${/request/@context_path}/images/excel_16.png"
                                                      text="HLS.EXPORT"
                                                      type="excel"/>
                                        </a:toolBar>
                                        <a:columns>
                                            <a:column name="contract_number" align="center" prompt="合同编号" width="150"/>
                                            <a:column name="times" prompt="期数" width="60" align="center"/>
                                            <a:column name="cf_item_n" prompt="现金流项目" align="center" width="90"/>
                                            <a:column name="due_date" align="center" prompt="应收日"
                                                      renderer="Leaf.formatDate"
                                                      width="100"/>
                                            <a:column name="due_amount" align="right" renderer="Leaf.formatMoney" prompt="应收金额" width="100"/>
                                            <a:column name="vat_due_amount" align="right" prompt="增值税金额"
                                                      width="100" renderer="Leaf.formatMoney"/>
                                            <a:column name="received_amount" align="right" prompt="已收金额"
                                                      renderer="Leaf.formatMoney" width="100"/>
                                            <a:column name="last_received_date" align="center" prompt="最后收款日"
                                                      renderer="Leaf.formatDate" width="105"/>
                                            <a:column name="full_write_off_date" align="center" prompt="核销日"
                                                      renderer="Leaf.formatDate"
                                                      width="105"/>
                                            <a:column name="tax_create_je_flag" prompt="增值税确认标志" align="center"
                                                      width="90"/>
                                        </a:columns>
                                    </a:grid>
                                </a:tab>
                                <a:tab id="step_4" disabled="true" marginHeight="20" prompt="HLS801.INCOME"
                                       selected="false"
                                       width="100">
                                    <a:hBox height="50">
                                        <a:button click="upStep" text="HLS801.LAST_STEP"/>
                                        <a:label width="5"/>
                                        <a:button click="nextStep" text="HLS801.NEXT_STEP"/>
                                        <a:label width="80"/>
                                        <a:button click="unearned_finance_income_confirm" text="HLS801.INCOME_CONFIRM"/>
                                        <a:label width="5"/>
                                    </a:hBox>
                                    <a:form column="1" marginWidth="80" style="margin-left:3px" title="HLS.QUERY_TITLE">
                                        <a:box column="2" labelWidth="150" style="margin-left:-80px">
                                            <a:textField name="year" bindTarget="unearned_finance_income_query_ds"
                                                         prompt="HLS801.YEAR" readOnly="true"/>
                                            <a:textField name="month" bindTarget="unearned_finance_income_query_ds"
                                                         prompt="HLS801.MONTH" readOnly="true"/>
                                            <!--   <a:textField name="day" bindTarget="unearned_finance_income_query_ds" prompt="日" readOnly="true"/> -->
                                            <a:lov name="company_code" bindTarget="unearned_finance_income_query_ds"
                                                   prompt="HLS.COMPANY_CODE"/>
                                            <a:textField name="company_short_name"
                                                         bindTarget="unearned_finance_income_query_ds"
                                                         prompt="HLS.COMPANY_NAME" readOnly="true"/>
                                            <a:comboBox name="finance_income_recognized"
                                                        bindTarget="unearned_finance_income_query_ds" prompt="是否确认"/>
                                        </a:box>
                                    </a:form>
                                    <p/>
                                    <a:grid id="unearned_finance_income_grid" bindTarget="unearned_finance_income_ds"
                                            marginHeight="300" marginWidth="80" navBar="true" style="margin-left:3px">
                                        <a:toolBar>
                                            <a:button click="unearned_finance_income_query"
                                                      icon="${/request/@context_path}/images/search.png"
                                                      text="HLS.QUERY"/>
                                            <!--                                    <a:button type="clear"/>-->
                                            <a:button icon="${/request/@context_path}/images/excel_16.png"
                                                      text="HLS.EXPORT"
                                                      type="excel"/>
                                        </a:toolBar>
                                        <a:columns>
                                            <a:column name="seq" prompt="HLS801.SEQ" width="50"/>
                                            <a:column name="contract_number" prompt="合同编号" width="150"/>
                                            <a:column name="contract_name" prompt="合同名称" width="150"/>
                                            <a:column name="finance_amount" align="right" prompt="HLS.FINANCE_AMOUNT"
                                                      renderer="Leaf.formatMoney" width="110"/>
                                            <a:column name="times" prompt="期数" width="80" align="center"/>
                                            <a:column name="period" prompt="GLD_BALANCES.PERIOD_NAME" width="150"/>
                                            <a:column name="calc_end_date" align="center" prompt="截止日"
                                                      renderer="Leaf.formatDate" width="150"/>
                                            <a:column name="interest" align="right" prompt="HLS801.INTEREST"
                                                      renderer="Leaf.formatMoney" width="100"/>
                                            <a:column name="int_rate_implicit" align="right" prompt="HLS801.INT_RATE"
                                                      renderer="ratePercentRender" width="70"/>
                                            <a:column name="calc_period" prompt="HLS801.CALC_PERIOD" width="150"/>
                                            <a:column name="calc_date_count" prompt="HLS801.CALC_DATE_COUNT"
                                                      width="100"/>
                                            <a:column name="vat_unearned_finance_income" align="right"
                                                      prompt="HLS801.VAT_UNEARNED_FINANCE_INCOME"
                                                      renderer="Leaf.formatMoney"
                                                      width="110"/>
                                            <a:column name="adjustvat" align="right"
                                                      prompt="税改16%调整额" renderer="Leaf.formatMoney"
                                                      width="110"/>
                                            <a:column name="adjustvat13" align="right"
                                                      prompt="税改13%调整额" renderer="Leaf.formatMoney"
                                                      width="110"/>

                                            <a:column name="unearned_finance_income" align="right"
                                                      prompt="HLS801.UNEARNED_FINANCE_INCOME"
                                                      renderer="Leaf.formatMoney"
                                                      width="110"/>
                                            <a:column name="finance_income_recognized"
                                                      prompt="HLS801.FINANCE_INCOME_RECOGNIZED"
                                                      width="80"/>

                                        </a:columns>
                                    </a:grid>
                                </a:tab>
                                <a:tab id="step_4" disabled="true" prompt="HLS801.PERIOD_CONTROL" selected="false"
                                       width="100">
                                    <a:hBox height="50">
                                        <a:button click="upStep" text="HLS801.LAST_STEP"/>
                                        <a:label width="5"/>
                                        <a:button  click="next_monthly_end" text="HLS801.NEXT_STEP"/>
                                        <a:label width="50"/>
                                    </a:hBox>
                                    <a:grid id="close_open_grid" bindTarget="close_open_ds" marginHeight="300"
                                            marginWidth="80">
                                        <a:columns>
                                            <a:column name="period_year" align="center" prompt="GLD_PERIODS.PERIOD_YEAR"
                                                      sortable="true" width="100"/>
                                            <a:column name="period_num" align="center"
                                                      prompt="FND_DIMENSIONS.DIMENSION_SEQUENCE" sortable="true"
                                                      width="80"/>
                                            <a:column name="start_date_c" align="center"
                                                      prompt="GLD_EXCHANGE_RATE.START_DATE"
                                                      sortable="true" width="150"/>
                                            <a:column name="end_date_c" align="center"
                                                      prompt="GLD_EXCHANGE_RATE.END_DATE"
                                                      sortable="true" width="150"/>
                                            <a:column name="quarter_num" align="center"
                                                      prompt="GLD_PERIOD_STATUS.QUARTER"
                                                      sortable="true" width="80"/>
                                            <a:column name="period_name" align="center" prompt="GLD_PERIODS.PERIOD_NAME"
                                                      sortable="true" width="120"/>
                                            <a:column name="adjustment_flag" align="center"
                                                      prompt="GLD_PERIOD_STATUS.ADJUST"
                                                      width="100"/>
                                            <a:column name="period_status_code" align="center"
                                                      prompt="GLD_PERIOD_STATUS.PERIOD_STATUS" renderer="statusRenderer"
                                                      width="120"/>
                                            <a:column name="actionOpen" align="center" prompt="HLS.OPEN_PERIOD"
                                                      renderer="openPeriodDs" sortable="true" width="120"/>
                                            <a:column name="actionClose" align="center" prompt="HLS.CLOSE_PERIOD"
                                                      renderer="closePeriodDs" sortable="true" width="120"/>
                                        </a:columns>
                                        <a:editors>
                                            <a:checkBox id="closed_grid_cb"/>
                                        </a:editors>
                                    </a:grid>
                                </a:tab>
                                <a:tab id="step_5" disabled="true" prompt="HLS801.MONTH_END" selected="false"
                                       width="100">
                                    <a:hBox height="50">
                                        <a:button click="upStep" text="HLS801.LAST_STEP"/>
                                        <a:label width="5"/>
                                        <a:button disabled="true" click="month_end_next" text="HLS801.NEXT_STEP"/>
                                        <a:label width="80"/>
                                        <a:button click="submit" text="提交审批"/>
                                        <a:button id="reset_monthlyend_id" click="reset_monthlyend" text="重置月结"/>
                                        <a:button click="process_monitoring" text="流程监控"/>
<!--                                        <a:button click="monthlyendFun" text="HLS801.MONTH_END"/>-->
                                    </a:hBox>
                                    <a:form column="1" marginWidth="80" style="margin-left:3px" title="HLS.QUERY_TITLE">
                                        <a:box column="2" labelWidth="150" style="margin-left:-80px">
                                            <a:textField name="year" bindTarget="unearned_finance_income_query_ds"
                                                         prompt="HLS801.YEAR" readOnly="true"/>
                                            <a:textField name="month" bindTarget="unearned_finance_income_query_ds"
                                                         prompt="HLS801.MONTH" readOnly="true"/>
                                        </a:box>
                                    </a:form>
                                    <a:grid id="month_report_id" bindTarget="month_report_ds" marginHeight="300"
                                            marginWidth="80">
                                        <a:columns>
                                            <a:column name="report_name" align="center" prompt="报表名称"
                                                      width="100" />
                                            <a:column name="sbo_attachment_upload" align="center" prompt="SB0报表" renderer="sbo_attachment_upload" width="80"/>
                                            <a:column name="sbo_file_name" align="center" prompt="附件名称"
                                                      width="100" />
                                            <a:column name="attachment_upload" align="center" prompt="业务系统报表" renderer="attachment_upload" width="80"/>
                                            <a:column name="business_file_name" align="center" prompt="附件名称"
                                                      width="100" />
                                        </a:columns>
                                    </a:grid>
                                </a:tab>
                            </a:tabs>
                        </a:tabPanel>
                    </a:hBox>
                </a:case>
            </a:switch>
        </a:screenBody>
    </a:view>
</a:screen>
