csh_accounts_receivable.lview 18.1 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 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 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: syj  
    $Date: 2015年7月27日10:13:53
    $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="cf_item in (&apos;1&apos;,&apos;2&apos;,&apos;3&apos;,&apos;4&apos;,&apos;8&apos;,&apos;9&apos;,&apos;15&apos;,&apos;16&apos;,&apos;51&apos;)" fetchAll="true" model="csh.CSH560.csh_cf_item" rootPath="cf_item"/>
        <a:model-query fetchAll="true" model="csh.CSH560.csh_due_date" rootPath="due_date"/>
    </a:init-procedure>
    <a:view>
        <!-- <a:link id="csh_batch_accounts_insert_link" url="${/request/@context_path}/modules/csh/CSH560/sdic_batch_accounts_insert.lsc"/> -->
        <a:link id="csh_batch_accounts_insert_link" url="${/request/@context_path}/modules/csh/CSH560/hn_batch_accounts_insert.lsc"/>
        <a:link id="csh560_report_print_link" url="${/request/@context_path}/modules/csh/CSH560/csh_accounts_receivable_print.lview"/>
        <a:link id="cashflow_confirm_export_link" url="${/request/@context_path}/modules/csh/CSH560/hn_con_cashflow_confirm_export.lview"/>
        <script type="text/javascript"><![CDATA[
            function csh560_query() {
                $('result_ds').query();
            }
            
            function csh560_reset() {
                $('query_ds').reset();
            }
            
            
            function csh560_print() {
                
                var rec = $('result_ds').getSelected();
                // var bp_name = rec[0].get('bp_name');
                // var contract_number_substr = rec[0].get('contract_number_substr');
                // var bank_account_id = rec[0].get('bank_account_id');
                if (rec.length <= 0) {
                    Leaf.showMessage('${l:PROMPT}', '至少选择一条数据!');
                    return;
                }
                for (var i = 0;i < rec.length;i++) {
                    var cf_item;
                    if (cf_item) {
                        if (rec[i].get('cf_item') != cf_item) {
                            Leaf.showMessage('${l:PROMPT}', '费用类型必须相同');
                            return;
                        }
                    }
                    cf_item = rec[i].get('cf_item');
                    if (cf_item != '1' && rec.length != 1) {
                        Leaf.showMessage('${l:PROMPT}', '非租金的费用类型必须单独打印');
                        return;
                    }
            
                    // else if (rec[i].get('contract_number_substr') != contract_number_substr) {
                    // Leaf.showMessage('${l:PROMPT}', '项目不同,不能一起批量生成!');
                    // return;
                    // } else if (rec[i].get('bank_account_id') != bank_account_id) {
                    // Leaf.showMessage('${l:PROMPT}', '同一项目下收款账号不同,不能一起批量生成!');
                    // return;
                    // }
                }
                var param = {};
                var saveData = [];
                for (var j = 0;j < rec.length;j++) {
                    var lineData = {};
                    lineData['cashflow_id'] = rec[j].get('cashflow_id');
                    lineData['contract_id'] = rec[j].get('contract_id');
                    saveData.push(lineData);
                }
                param['details'] = saveData;
                //Leaf.Masker.mask(Ext.getBody(), '正在提交');
                Leaf.showConfirm('提示', '确定要打印选中项吗?', function() {
                    Leaf.request({
                        url: $('csh_batch_accounts_insert_link').getUrl(),
                        para: {
                            param: param
                        },
                        success: function(res) {
                            Leaf.Masker.unmask(Ext.getBody()); //解锁
                            var templt_name = 'hn_csh_payment_notice.xml';
                            var url = $('csh560_report_print_link').getUrl() + '?templt_name=' + templt_name;
                            var form = document.createElement("form");
                            form.target = "word_export_window";
                            form.method = "post";
                            form.action = url;
                            var iframe = Ext.get('word_export_window') || new Ext.Template('<iframe id ="word_export_window" name="word_export_window" style="position:absolute;left:-10000px;top:-10000px;width:1px;height:1px;display:none"></iframe>').insertFirst(document.body, {}, true);
                            document.body.appendChild(form);
                            form.submit();
                            Ext.fly(form).remove();
                        },
                        failure: function() {
                            Leaf.Masker.unFmask(Ext.getBody());
                        },
                        error: function() {
                            Leaf.Masker.unmask(Ext.getBody());
                        },
                        scope: this
                    });
                    // var rec = $('result_ds').getSelected()[0];
                    // var templt_name = 'sdic_csh_payment_notice.xml';
                    // var cashflow_id = rec.get('cashflow_id');
                    // var url = $('csh560_report_print_link').getUrl()+'?templt_name='+templt_name+'&cashflow_id='+cashflow_id;
                    // var form = document.createElement("form");
                    // form.target = "word_export_window";
                    // form.method = "post";
                    // form.action = url;
                    // var iframe = Ext.get('word_export_window') || new Ext.Template('<iframe id ="word_export_window" name="word_export_window" style="position:absolute;left:-10000px;top:-10000px;width:1px;height:1px;display:none"></iframe>').insertFirst(document.body, {}, true);
                    // document.body.appendChild(form);
                    // form.submit();
                    // Ext.fly(form).remove();
                    // Leaf.Masker.unmask(Ext.getBody());
                });
            }
            
            function csh_confirm_export() {
                $('accounts_receivable_grid_id')._export();
            }
            
            function receivableSumInfo(data, name) {
                if (name == 'bp_name') {
                    return '<font color=red>' + '合计:' + '</font>';
                } else if (name == 'due_amount') {
                    return colum_caculateTotal(data, name);
                } else if (name == 'principal') {
                    return colum_caculateTotal(data, name);
                } else if (name == 'net_due_amount') {
                    return colum_caculateTotal(data, name);
                } else if (name == 'vat_due_amount') {
                    return colum_caculateTotal(data, name);
                } else if (name == 'sum_principal') {
                    return colum_caculateTotal(data, name);
                } else if (name == 'net_principal') {
                    return colum_caculateTotal(data, name);
                } else if (name == 'vat_principal') {
                    return colum_caculateTotal(data, name);
                } else if (name == 'net_interest') {
                    return colum_caculateTotal(data, name);
                } else if (name == 'vat_interest') {
                    return colum_caculateTotal(data, name);
                } else if (name == 'net_lease_charge') {
                    return colum_caculateTotal(data, name);
                } else if (name == 'vat_lease_charge') {
                    return colum_caculateTotal(data, name);
                } else if (name == 'penalty_amount') {
                    return colum_caculateTotal(data, name);
                }
            }
            
            function colum_caculateTotal(data, name) {
                var total = 0;
                var length = data.length;
                var value = 0;
                for (var i = 0;i < length;i++) {
                    if (Ext.isEmpty(data[i].get(name))) {
                        value = 0;
                    } else {
                        value = data[i].get(name);
                    }
                    total = plus(total, value);
                }
                return '<font color=red>' + Leaf.formatMoney(total) + '</font>';
            
            }
            
            function cashflow_confirm_export(contract_id, times) {
                new Leaf.Window({
                    id: 'cashflow_confirm_export_winid',
                    url: $('cashflow_confirm_export_link').getUrl(),
                    params: {
                        contract_id: contract_id,
                        times: times,
                        win_id: 'cashflow_confirm_export_winid'
                    },
                    title: '确认单',
                    fullScreen: true
                })
            }
            
            function cashflow_confirm(value, record, name) {
                if (name == 'contract_number') {
                    var cf_item = record.get('cf_item');
                    var contract_id = record.get('contract_id');
                    var times = record.get('times');
                    if (cf_item == '1') {
                        return '<a href="javascript:cashflow_confirm_export(' + contract_id + ',' + times + ');">' + '<font color=red>' + value + '</font></a>';
                    } else {
                        return value;
                    }
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="write_off_flag_ds" lookupCode="CON_PENALTY_WRITE_OFF_FLAG"/>
            <a:dataSet id="cshMaintain_organizationDs" loadData="true" model="basic.hls_lease_organization_for_lov"/>
            <a:dataSet id="cf_item_ds">
                <a:datas dataSource="/model/cf_item"/>
            </a:dataSet>
            <a:dataSet id="query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="cf_item_desc" displayField="description" options="cf_item_ds" returnField="cf_item" valueField="cf_item"/>
                    <!-- <a:field name="cf_item" defaultValue="1"/> -->
                    <a:field name="contract_number"/>
                    <a:field name="lease_organization_n" displayField="description" options="cshMaintain_organizationDs" returnField="lease_organization" valueField="lease_organization"/>
                    <a:field name="employee_id"/>
                    <a:field name="employee_id_n" lovGridHeight="300" lovHeight="450" lovService="basic.hls_salesman_v_for_lov" lovWidth="500" title="PRJ501.PRJ_PROJECT.EMPLOYEE_NAME">
                        <a:mapping>
                            <a:map from="employee_id" to="employee_id"/>
                            <a:map from="name" to="employee_id_n"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="due_date_from" defaultValue="${/model/due_date/record/@due_date_from}"/>
                    <a:field name="due_date_to" defaultValue="${/model/due_date/record/@due_date_to}"/>
                    <a:field name="write_off_flag_desc" defaultValue="未核销" displayField="code_value_name" options="write_off_flag_ds" returnField="write_off_flag" valueField="code_value"/>
                    <a:field name="write_off_flag" defaultValue="NOT"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="result_ds" autoPageSize="true" autoQuery="true" model="csh.CSH560.csh_accounts_receivable" queryDataSet="query_ds" selectable="true"/>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="csh560_query" text="HLS.QUERY"/>
                <a:gridButton click="csh560_reset" text="HLS.RESET"/>
                <a:gridButton click="csh_confirm_export" text="导出"/>
                <a:gridButton click="csh560_print" text="生成租金支付通知书"/>
            </a:screenTopToolbar>
            <a:form column="3" labelWidth="110" title="HLS.QUERY_TITLE">
                <a:textField name="contract_number" bindTarget="query_ds" prompt="合同号"/>
                <a:datePicker name="due_date_from" bindTarget="query_ds" prompt="收款日期从"/>
                <a:datePicker name="due_date_to" bindTarget="query_ds" prompt="收款日期到"/>
                <a:comboBox name="cf_item_desc" bindTarget="query_ds" prompt="应收项目"/>
                <a:comboBox name="lease_organization_n" bindTarget="query_ds" prompt="业务部"/>
                <a:lov name="employee_id_n" bindTarget="query_ds" prompt="项目经理"/>
                <a:comboBox name="write_off_flag_desc" bindTarget="query_ds" prompt="核销状态"/>
                <a:textField name="bp_name" bindTarget="query_ds" colspan="2" prompt="承租人名称" width="418"/>
            </a:form>
            <a:grid id="accounts_receivable_grid_id" bindTarget="result_ds" marginHeight="200" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="hn_industry_classification_n" lock="true" prompt="集团内/市场化" width="120"/>
                    <a:column name="employee_manager" lock="true" prompt="项目经理" width="100"/>
                    <a:column name="lease_organization_desc" lock="true" prompt="业务部" width="100"/>
                    <a:column name="contract_number" lock="true" prompt="合同编号" renderer="cashflow_confirm" width="150"/>
                    <a:column name="cf_item_n" align="center" lock="true" prompt="现金流项目" width="100"/>
                    <a:column name="bp_name" footerRenderer="receivableSumInfo" prompt="承租人名称" width="150"/>
                    <a:column name="sum_principal" align="right" footerRenderer="receivableSumInfo" prompt="租赁本金" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="lease_form_n" prompt="租赁形式" width="150"/>
                    <a:column name="bank_account_num" prompt="收款账号" width="150"/>
                    <a:column name="bank_name" prompt="收款银行" width="150"/>
                    <a:column name="annual_pay_times_n" align="center" prompt="付款频率" width="100"/>
                    <a:column name="csh_payment_method_n" prompt="付款方式" width="100"/>
                    <a:column name="times" align="center" prompt="期数" width="80"/>
                    <a:column name="due_date" align="center" prompt="收款日期" renderer="Leaf.formatDate" width="100"/>
                    <a:column name="calc_date" align="center" prompt="计算日" renderer="Leaf.formatDate" width="100"/>
                    <a:column name="outstanding_prin_tax_incld" align="right" footerRenderer="receivableSumInfo" prompt="本期之后本金余额" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="outstanding_rental_tax_incld" align="right" footerRenderer="receivableSumInfo" prompt="本期之后租金余额" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="lease_end_date" align="center" prompt="合同到期日" renderer="Leaf.formatDate" width="100"/>
                    <a:column name="due_amount" align="right" footerRenderer="receivableSumInfo" prompt="收款金额" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="net_due_amount" align="right" footerRenderer="receivableSumInfo" prompt="租金(不含税)" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="vat_due_amount" align="right" footerRenderer="receivableSumInfo" prompt="利息增值税税额" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="net_principal" align="right" footerRenderer="receivableSumInfo" prompt="本金(不含税)" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="vat_principal" align="right" footerRenderer="receivableSumInfo" prompt="本金增值税额" renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="net_interest" align="right" footerRenderer="receivableSumInfo" prompt="利息(不含税)" renderer="Leaf.formatMoney" width="120"/>
                    <!-- <a:column name="vat_interest" align="right" footerRenderer="receivableSumInfo" prompt="利息增值税额" renderer="Leaf.formatMoney" width="120"/> -->
                    <!-- <a:column name="net_lease_charge" align="right" footerRenderer="receivableSumInfo" prompt="手续费(不含税)" renderer="Leaf.formatMoney" width="120"/> -->
                    <!-- <a:column name="vat_lease_charge" align="right" footerRenderer="receivableSumInfo" prompt="手续费增值税额" renderer="Leaf.formatMoney" width="120"/> -->
                    <!-- <a:column name="penalty_amount" align="right" footerRenderer="receivableSumInfo" prompt="滞纳金" renderer="Leaf.formatMoney" width="120"/> -->
                    <a:column name="adjust_rate_type_n" prompt="调息规则" width="100"/>
                    <a:column name="flt_next_adj_date" align="center" prompt="调息日期" renderer="Leaf.formatDate" width="100"/>
                    <a:column name="adjust_flag_n" align="center" prompt="是否次期调整" width="100"/>
                    <a:column name="contact_person" prompt="联系人" width="100"/>
                    <a:column name="cell_phone" prompt="联系人电话" width="120"/>
                    <a:column name="email" prompt="E-mail" width="100"/>
                    <a:column name="contact_person_fm" prompt="财务经理" width="100"/>
                    <a:column name="cell_phone_fm" prompt="财务经理联系方式" width="100"/>
                    <a:column name="address" prompt="邮寄地址" width="200"/>
                    <a:column name="zipcode" prompt="邮编" width="100"/>
                    <a:column name="write_off_flag_desc" prompt="核销状态"/>
                    <a:column name="full_write_off_date" prompt="实际收款日" renderer="Leaf.formatDate" width="100"/>
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>