ccb_ebank_create.lview 16.7 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: Eugene Song $
    $Date: 2018年11月2日10:19:17 $
    $Revision: 1.1 $
    $Purpose: 网银代扣管理
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query model="basic.get_sys_default_time" rootPath="create_date_path"/>

    </a:init-procedure>
    <a:view>
        <a:link id="hls_ebank_create_link" model="ccb.CCB600.hls_ebank_batch" modelaction="execute"/>
15
        <a:link id="hls_ebank_create_lsc_link" url="${/request/@context_path}/modules/ccb/CCB600/ccb_ebank_create.lsc" modelaction="insert"/>
Spencer Chang's avatar
Spencer Chang committed
16 17 18 19 20
        <a:link id="ebank_detail_link" url="${/request/@context_path}/modules/ccb/CCB600/ccb_ebank_detail.lview"/>
        <script type="text/javascript"><![CDATA[

        function create_batch() {
            var ds = $('hls_ccb_form_create_ds');
21 22 23 24 25 26 27 28
            var ln_ds = $('hls_ccb_grid_ln_ds');

            if(ln_ds.getAll().length == 0){
                Leaf.showInfoMessage("提示","请先查询需要扣款的合同");
                return;
            }

            if (ds.validate() && ln_ds.validate()) {
Spencer Chang's avatar
Spencer Chang committed
29
                var record = $('hls_ccb_form_create_ds').getAt(0);
30 31 32 33 34
                var params = {};
                params._status = 'insert';
                params.bank_account_id = record.get('bank_account_id');
                params.merger_rules = record.get('merger_rules');
                params.pay_method = record.get('pay_method');
35
                params.due_date = record.get('due_date');
36 37 38 39 40 41 42 43 44 45 46

                //处理行
                var details = [];
                var ln_r = ln_ds.getAll();
                for(var i=0;i<ln_r.length;i++){
                    var r = ln_r[i].data;
                    r._status = 'insert';
                    details.push(r);
                }
                params.details = details;

Spencer Chang's avatar
Spencer Chang committed
47 48
                Leaf.Masker.mask(Ext.getBody(), '生成中...'); //锁屏
                Leaf.request({
49 50
                    url: $('hls_ebank_create_lsc_link').getUrl(),
                    para: params,
Spencer Chang's avatar
Spencer Chang committed
51 52 53 54 55 56
                    success: function (res) {
                        Leaf.SideBar.show({
                            msg: '操作成功',
                            duration: 2000
                        });
                        Leaf.Masker.unmask(Ext.getBody()); //解锁
57 58 59
                        $('create_ebank_link_winId').close();
                        // $('hls_ccb_grid_create_ds').setQueryParameter('batch_id', res.result.batch_id);
                        // $('hls_ccb_grid_create_ds').query();
Spencer Chang's avatar
Spencer Chang committed
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
                    },
                    failure: function () {
                    },
                    error: function () {
                    },
                    scope: this
                });
            }
        }

        function reset_batch() {
            $('hls_ccb_form_create_ds').reset();
        }

        function return_batch() {
            $('${/parameter/@winid}').close();
        }

        function batch_detail_renderer(value ,record,name) {
            return '<a href="javascript:open_batch_detail_window(' + record.get('hd_id') + ')">' + '${l:PROMPT.DETAIL}' + '</a>';
        }


        function open_batch_detail_window(hd_id){
            var win = new Leaf.Window({
                id: 'batch_link_winId',
                url: $('ebank_detail_link').getUrl(),
                params: {
                    hd_id: hd_id,
                    winid: 'batch_link_winId'
                },
                title: '代扣指令明细',
                draggable: true,
                width: 900,
                height: 680
            });
        }
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

        function ccb_form_update_fun(ds,record,name,value,oldvalue){
            if(name == "pay_method"){
                if(value){
                    $('hls_ccb_form_query_ds').getField('contract_number').setLovPara("pay_method",value);
                    $('hls_ccb_grid_ln_ds').setQueryParameter("pay_method",value);
                }
            }
        }

        function hls_ccb_grid_ln_query(){
            $('hls_ccb_grid_ln_ds').query();
        }

        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 sumAmount(record,name){
            if(name == 'cf_item_desc'){
                return '<font color=red>合计:</font>';
            }
            if(name == 'due_amount' || name == 'manual_amount'){
                return '<font color=red>' + colum_caculateTotal(record,name) + '</font>';
            }
        }

        function check_manual_amount(record, name, value){
            if(value > record.get('due_amount')){
                Leaf.showInfoMessage("提示","扣款金额不能大于应付金额");
                return false;
            }
            return true;
        }
142 143 144 145 146 147 148 149 150 151

        function hls_ccb_form_update(ds,record,name,value,oldvalue){
            if(name == 'due_date_to'){
                var r =$('hls_ccb_form_create_ds').getCurrentRecord();
                if(r){
                    r.set('due_date',value);
                }
            }

        }
Darming's avatar
Darming committed
152 153 154 155 156 157 158 159
        function created_date(cell,date,text){
            debugger;
            v_date = new Date().format('yyyy-mm-dd');  //获取当前时间日期
            v_dates = date.format('yyyy-mm-dd');  //页面中选择的时间日期
            if(v_dates > v_date){    //比较当前时间和选择的时间
                cell.disabled = true;   //不可选择打开
            }
        }
Spencer Chang's avatar
Spencer Chang committed
160 161
        ]]></script>
        <a:dataSets>
162 163
            <a:dataSet id="pay_methods_ds">
                <a:datas>
164
<!--                    <a:record code_value="AGRI_THREE" code_value_name="农行扣款(三方)"/>-->
165
                    <a:record code_value="CCB_THREE" code_value_name="建行扣款(三方)"/>
166
<!--                    <a:record code_value="AGRI_TWO" code_value_name="农行扣款(两方)"/>-->
167 168
                </a:datas>
            </a:dataSet>
169 170 171
            <a:dataSet id="hls_ccb_form_query_ds">
                <a:fields>
                    <a:field name="due_date_from" />
Darming's avatar
Darming committed
172
                    <a:field name="due_date_to" required="true" defaultValue="${/model/create_date_path/record/@now_date}" />
173 174 175 176 177 178 179 180 181 182
                    <a:field name="bp_agent_name" lovGridHeight="350" lovHeight="550" lovLabelWidth="50" lovWidth="550"
                             autoComplete="true" autoCompleteField="bp_agent_name"
                             lovService="basic.hls_bp_master_v_for_lov?bp_category=AGENT"
                             title="HLS.BP_TITLE">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id_agent"/>
                            <a:map from="bp_name" to="bp_agent_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_tenant_name" lovGridHeight="350" lovHeight="550" lovLabelWidth="50" lovWidth="550"
183 184
                             autoComplete="true" autoCompleteField="bp_name"
                             lovService="ccb.CCB600.hls_bp_master_v_for_lov?bp_category=TENANT"
185 186 187 188 189 190 191 192
                             title="HLS.BP_TITLE">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id_tenant"/>
                            <a:map from="bp_name" to="bp_tenant_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id_agent" />
                    <a:field name="bp_id_tenant"/>
Darming's avatar
Darming committed
193
                    <a:field name="contract_number" lovGridHeight="350" lovHeight="500" lovService="ccb.CCB600.con_contract_lov?pay_method=CCB_THREE" lovWidth="470" title="合同">
194 195 196 197 198 199 200 201 202 203 204 205 206 207
                        <a:mapping>
                            <a:map from="contract_id" to="contract_id"/>
                            <a:map from="contract_number" to="contract_number"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="contract_id"/>
                    <a:field name="cf_item_desc" lovGridHeight="300" lovHeight="500" lovService="hls.HLS005.hls_cashflow_item_v_lov" lovWidth="850" title="HLS005.HLS_CASHFLOW_ITEM.CF_ITEM">
                        <a:mapping>
                            <a:map from="cf_item" to="cf_item"/>
                            <a:map from="cf_item_desc" to="cf_item_desc"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="cf_item"/>
                </a:fields>
208 209 210
                <a:events>
                    <a:event name="update" handler="hls_ccb_form_update"/>
                </a:events>
211
            </a:dataSet>
Spencer Chang's avatar
Spencer Chang committed
212 213 214 215 216 217 218 219 220 221 222
            <a:dataSet id="hls_ccb_form_create_ds" autoCreate="true">
                <a:fields>
                    <a:field name="bank_account_num" autoComplete="true" lovGridHeight="350" lovHeight="550"
                             lovService="ccb.CCB600.hls_ebank_bank" lovWidth="1000" required="true"
                             title="银行账户" prompt="银行账户">
                        <a:mapping>
                            <a:map from="bank_account_name" to="bank_account_name"/>
                            <a:map from="bank_account_num" to="bank_account_num"/>
                            <a:map from="bank_short_name" to="bank_name"/>
                            <a:map from="bank_account_id" to="bank_account_id"/>
                            <a:map from="currency_code" to="currency"/>
223
                            <a:map from="currency_name" to="currency_name"/>
Spencer Chang's avatar
Spencer Chang committed
224 225
                        </a:mapping>
                    </a:field>
226
                    <a:field name="currency_name" readOnly="true"/>
227 228
                    <a:field name="pay_method_desc" defaultValue="建行扣款(三方)" required="true" prompt="支付方式" displayField="code_value_name" options="pay_methods_ds" returnField="pay_method" valueField="code_value"/>
                    <a:field name="pay_method" defaultValue="CCB_THREE"/>
Spencer Chang's avatar
Spencer Chang committed
229 230 231 232
                    <a:field name="bank_account_name" readOnly="true"/>
                    <a:field name="bank_name" readOnly="true"/>
                    <a:field name="currency" readOnly="true"/>
                    <a:field name="due_date" datatype="date" defaultValue="${/model/create_date_path/record/@now_date}" required="true" prompt="应收日期"/>
Darming's avatar
Darming committed
233
                    <a:field name="merger_rules" defaultValue="CUSTOMER"/>
234
<!--                    <a:field name="merger_rules" defaultValue="CONTRACT"/>-->
Spencer Chang's avatar
Spencer Chang committed
235
                </a:fields>
236 237 238
                <a:events>
                    <a:event name="update" handler="ccb_form_update_fun"/>
                </a:events>
Spencer Chang's avatar
Spencer Chang committed
239 240 241 242 243 244 245
            </a:dataSet>

            <a:dataSet id="hls_ccb_grid_create_ds" model="ccb.CCB600.hls_ebank_batch_hd" pageSize="15"
                       queryUrl="${/request/@context_path}/autocrud/ccb.CCB600.hls_ebank_batch_hd/query"
                       selectable="true">
            </a:dataSet>

Darming's avatar
Darming committed
246
            <a:dataSet id="hls_ccb_grid_ln_ds" fetchAll="true" queryDataSet="hls_ccb_form_query_ds" model="ccb.CCB600.hls_ebank_batch_ln" queryUrl="${/request/@context_path}/autocrud/ccb.CCB600.con_contract_cashflow_query/query?pay_method=CCB_THREE">
247 248 249 250 251 252 253 254
                <a:fields>
                    <a:field name="cashflow_id"/>
                    <a:field name="bp_tenant_name" readOnly="true"/>
                    <a:field name="contract_id"/>
                    <a:field name="contract_number" readOnly="true"/>
                    <a:field name="times" readOnly="true"/>
                    <a:field name="cf_item" readOnly="true"/>
                    <a:field name="due_amount" readOnly="true"/>
Darming's avatar
Darming committed
255
                    <a:field name="manual_amount" datatype="java.lang.Double" required="true" prompt="扣款金额" validator="check_manual_amount"/>
256 257 258 259
                    <a:field name="description"/>
                </a:fields>
            </a:dataSet>

Spencer Chang's avatar
Spencer Chang committed
260 261 262
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar height="29">
263
                <a:gridButton click="hls_ccb_grid_ln_query" text="查询"/>
Spencer Chang's avatar
Spencer Chang committed
264 265 266 267 268
                <a:gridButton click="create_batch" text="指令生成"/>
                <a:gridButton click="reset_batch" text="重置"/>
                <a:gridButton click="return_batch" text="返回"/>
            </a:screenTopToolbar>

269
            <a:fieldSet title="本方账户" column="3">
Spencer Chang's avatar
Spencer Chang committed
270 271 272
                <a:lov name="bank_account_num" bindTarget="hls_ccb_form_create_ds" prompt="银行账户"/>
                <a:textField name="bank_account_name" bindTarget="hls_ccb_form_create_ds" prompt="账户名"/>
                <a:textField name="bank_name" bindTarget="hls_ccb_form_create_ds" prompt="银行"/>
273
                <a:comboBox name="pay_method_desc" bindTarget="hls_ccb_form_create_ds" prompt="支付方式"/>
274
                <a:textField name="currency_name" bindTarget="hls_ccb_form_create_ds" prompt="币种"/>
Spencer Chang's avatar
Spencer Chang committed
275 276 277 278
            </a:fieldSet>
            <a:fieldSet title="合并规则" column="2">
                <a:radio name="merger_rules" bindTarget="hls_ccb_form_create_ds" layout="horizontal" width="600">
                    <a:items>
Darming's avatar
Darming committed
279 280 281 282
<!--                        <a:item label="按合同" value="CONTRACT"/>-->
<!--                        <a:item label="按期数" value="TIMES"/>-->
                        <a:item label="按客户" value="CUSTOMER"/>
<!--                        <a:item label="不合并" value="NONE"/>-->
Spencer Chang's avatar
Spencer Chang committed
283 284 285
                    </a:items>
                </a:radio>
            </a:fieldSet>
286
            <a:fieldSet title="查询条件" column="3">
Darming's avatar
Darming committed
287
<!--                <a:datePicker name="due_date_from" bindTarget="hls_ccb_form_query_ds" prompt="付款日期从"/>-->
Darming's avatar
Darming committed
288
                <a:datePicker name="due_date_to" bindTarget="hls_ccb_form_query_ds" prompt="付款日期到" dayRenderer="created_date" />
289 290 291
                <a:lov name="bp_agent_name" bindTarget="hls_ccb_form_query_ds" prompt="代理店"/>
                <a:lov name="bp_tenant_name" bindTarget="hls_ccb_form_query_ds" prompt="客户名称"/>
                <a:lov name="contract_number" bindTarget="hls_ccb_form_query_ds" prompt="合同号"/>
Darming's avatar
Darming committed
292
<!--                <a:lov name="cf_item_desc" bindTarget="hls_ccb_form_query_ds" prompt="现金流类型"/>-->
293 294
<!--                <a:numberField name="payment_amount_from" bindTarget="hls_ccb_form_create_ds" prompt="付款金额从"/>-->
<!--                <a:numberField name="payment_amount_to" bindTarget="hls_ccb_form_create_ds" prompt="付款金额到"/>-->
Spencer Chang's avatar
Spencer Chang committed
295 296
            </a:fieldSet>

297 298 299 300 301 302
<!--            <a:grid id="hls_ccb_create_grid" bindTarget="hls_ccb_grid_create_ds" height="300" width="800" navBar="true">-->
<!--                <a:columns>-->
<!--                    <a:column name="num" align="left" prompt="序号" width="80"/>-->
<!--                    <a:column name="detail" align="center" prompt="明细" renderer="batch_detail_renderer" width="100"/>-->
<!--                </a:columns>-->
<!--            </a:grid>-->
303
            <a:grid id="hls_ccb_ln_grid" bindTarget="hls_ccb_grid_ln_ds" height="340" width="850" navBar="true">
Spencer Chang's avatar
Spencer Chang committed
304
                <a:columns>
305
                    <a:column name="bp_tenant_name" prompt="客户名称" align="center"  />
Darming's avatar
Darming committed
306
                    <a:column name="bank_account_num" prompt="扣款账号"/>
307 308 309 310 311 312 313
                    <a:column name="contract_number" prompt="合同号" align="center" />
                    <a:column name="times" prompt="期数" align="center"/>
                    <a:column name="due_date" prompt="应付日期" align="center" renderer="Leaf.formatDate"/>
                    <a:column name="cf_item_desc" prompt="现金流类型" align="center" footerRenderer="sumAmount"/>
                    <a:column name="due_amount" prompt="应收金额" align="right" renderer="Leaf.formatMoney" footerRenderer="sumAmount"/>
                    <a:column name="manual_amount" prompt="扣款金额" editor="hls_ccb_ln_grid_nf" align="right" renderer="Leaf.formatMoney" footerRenderer="sumAmount"/>
                    <a:column name="description" prompt="备注" editor="hls_ccb_ln_grid_tf" width="200" />
Spencer Chang's avatar
Spencer Chang committed
314
                </a:columns>
315 316 317 318
                <a:editors>
                    <a:numberField id="hls_ccb_ln_grid_nf"/>
                    <a:textField id="hls_ccb_ln_grid_tf"/>
                </a:editors>
Spencer Chang's avatar
Spencer Chang committed
319
            </a:grid>
320 321 322
<!--            <a:fieldSet title="应收日期" column="2">-->
<!--                <a:datePicker name="due_date" bindTarget="hls_ccb_form_create_ds" prompt="应收日期"/>-->
<!--            </a:fieldSet>-->
Spencer Chang's avatar
Spencer Chang committed
323 324 325
        </a:screenBody>
    </a:view>
</a:screen>