csh_refund_entry_detail.lview 22.1 KB
Newer Older
lizhe's avatar
lizhe 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 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: niminmin
    $Date: 2019-10-29 上午09:19:57
    $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.enabled_flag=&apos;Y&apos;" fetchAll="true"
                       model="basic.csh_payment_method_for_lov" rootPath="payment_method_path"/>
        <a:model-query fetchAll="true" model="gld.gld_currency_vl" rootPath="currency"/>
        <a:model-query fetchAll="true" model="gld.gld_exchangerate_type_lov" rootPath="exchangerate_type_path"/>
        <a:model-query fetchAll="true" model="csh.CSH511.fnd_financial_option" rootPath="fnd_financial_option_path"/>
        <a:model-query fetchAll="true" model="csh.CSH511.csh_transaction_default_exchange_rate_type"
                       rootPath="default_exchange_rate_type_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="hn2050_upload_win_link" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="csh_receipt_import_link"
                url="${/request/@context_path}/modules/csh/CSH511/csh_transaction_receipt_impiort.lview"/>
        <a:link id="csh_transaction_receipt_id"
                url="${/request/@context_path}/modules/csh/CSH511/csh_transaction_receipt.lview"/>
        <a:link id="get_exchange_rate_link_id" model="csh.CSH511.csh_transaction_get_exchange_rate"
                modelaction="query"/>
        <a:link id="get_period_name_id" model="csh.CSH511.csh_transaction_get_period_name" modelaction="query"/>
        <a:link id="csh510_update_bp_info_link" model="csh.CSH510.csh_transaction_update_bp_info" modelaction="update"/>
        <script src="${/request/@context_path}/javascripts/calculate.js" type="text/javascript"/>
        <a:link id="transaction_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
        <a:link id="csh_transaction_deposit_write_off_link_id"
                url="${/request/@context_path}/modules/cus_deposit/CUS_DEPOSIT100/csh_transaction_deposit_write_off.lsc"/>
        <script type="text/javascript"><![CDATA[
        function csh1300_receipt_exit() {
            $('${/parameter/@winId}').close();
        }

        function csh1300_receipt_submit() {
            if ($('refund_ertry_detail_result_ds').validate()) {
                var head_record = $('csh_transaction_receipt_head_ds').getAt(0);
                var deposit_records = $('refund_ertry_detail_result_ds').getAll();
                var param = {};
                var saveData = [];
                debugger;
                param['transaction_id'] = '${/parameter/@transaction_id}';
                param['bp_id'] = head_record.get('bp_id');
                param['bp_category'] = head_record.get('bp_category');
                if (deposit_records.length < 1) {
                    Leaf.showMessage('提示', '请先新增日立为优质客户付租金入账明细!');
                    return;
                }
                for (var i = 0; i < deposit_records.length; i++) {
                    var deposit_record;
                    deposit_record = deposit_records[i];
                    deposit_record.set('_status', 'insert');
                    deposit_record.set('write_off_date', head_record.get('transaction_date'));
                    deposit_record.set('transaction_id', '${/parameter/@transaction_id}');
                    deposit_record.set('bp_id_agent_level1', '${/parameter/@bp_id}');
                    saveData.push(deposit_record.data);
                }
                param['details'] = saveData;
                Leaf.showConfirm('${l:PROMPT}', '确定进行日立为优质客户付租金入账?', function () {
                    Leaf.Masker.mask($('${/parameter/@winId}').wrap, "正在执行。。。");
                    Leaf.request({
                        url: $('csh_transaction_deposit_write_off_link_id').getUrl(),
                        para: param,
                        success: function () {
                            Leaf.Masker.unmask($('${/parameter/@winId}').wrap);
                            Leaf.SideBar.show({
                                msg: '${l:HLS.SUBMIT_SUCCESS}',
                                duration: 2000
                            });
                            csh1300_receipt_exit();
                        },
                        failure: function () {
                            Leaf.Masker.unmask($('${/parameter/@winId}').wrap);
                        },
                        error: function () {
                            Leaf.Masker.unmask($('${/parameter/@winId}').wrap);
                        },
                        scope: this
                    });
                }, function () {
                    Leaf.Masker.unmask($('${/parameter/@winId}').wrap);
                    return;
                }, null, null);
            }
        }

        function get_current_amount(amt) {
            if (!Ext.isEmpty(amt)) {
                return amt;
            } else {
                return 0;
            }
        }

        function get_minus_amount(amt1, amt2) {
            var value1 = get_current_amount(amt1),
                value2 = get_current_amount(amt2);
            var value = minus(value1, value2);
            return value;
        }

        function get_min_amount(amt1, amt2) {
            if (!Ext.isEmpty(amt1) && !Ext.isEmpty(amt2)) {
                if (amt1 > amt2) {
                    return amt2;
                } else {
                    return amt1;
                }
            } else if (Ext.isEmpty(amt1)) {
                return amt2;
            } else if (Ext.isEmpty(amt2)) {
                return amt1;
            } else {
                return null;
            }
        }

        function on_csh_trx_deposit_write_off_update(ds, record, name, value, oldvalue) {
            debugger;
            var head_record = $('csh_transaction_receipt_head_ds').getAt(0);
            var unwrite_off_amount = head_record.get("unwrite_off_amount") || 0;
            if (name == 'deposit_amount') {
                // if (value) {
                // record.getField('write_off_due_amount').setRequired(false);
                // }
                // if (!value) {
                // record.getField('write_off_due_amount').setRequired(true);
                // }
                if (value && value != oldvalue) {
                    oldvalue = oldvalue || 0;
                    var change_value = get_minus_amount(value, oldvalue);
                    var current_apply_amount = get_current_amount(head_record.get('current_apply_amount') || 0);
                    if (((current_apply_amount - oldvalue + (value || 0))) < 0) {
                        Leaf.showMessage('${l:PROMPT}', "本次入账金额不能为负!");
                        setTimeout(function () {
                            record.set('deposit_amount', '');
                        }, 10);
                        head_record.set('current_apply_amount', 0);
                        return;
                    }
                    if ((current_apply_amount - oldvalue + (value || 0)) <= unwrite_off_amount && (current_apply_amount - oldvalue + (value || 0)) >= 0) {
                        head_record.set('current_apply_amount', current_apply_amount - oldvalue + (value || 0));
                    } else {
                        Leaf.showMessage('${l:PROMPT}', "本次入账金额小于剩余可入账金额!");
                        head_record.set('current_apply_amount', 0);
                        setTimeout(function () {
                            record.set('deposit_amount', '');
                        }, 10);
                        return;
                    }
                }
            }
        }

        function on_csh_trx_deposit_write_off_remove(ds, record, index) {

            var head_record = $('csh_transaction_receipt_head_ds').getAt(0);
            var change_value = record.get('deposit_amount') || 0,
                current_apply_amount = head_record.get('current_apply_amount') || 0;
            setTimeout(function () {
                head_record.set('current_apply_amount', current_apply_amount - change_value);
            }, 10);

        }

        function on_csh_trx_deposit_write_off_add(ds, record, index) {
            var head_record = $('csh_transaction_receipt_head_ds').getAt(0);
            if (head_record.data.bp_category == 'TENANT' && head_record.data.collection_classes == 'DEPOSIT') {
                $('refund_ertry_detail_result_ds').fields.contract_number.pro.lovservice = 'cus_deposit.CUS_DEPOSIT100.con_deposit100_v?bp_id_tenant=${/parameter/@bp_id}';
            }
            record.set('je_date', head_record.get('transaction_date'));
            record.set('write_off_type', 'REFUND_ENTRY');

        }


        ]]></script>
        <a:dataSets>
            <a:dataSet id="PAID_BYOTHER_FLAG_DS" lookupCode="PAID_BYOTHER_FLAG"/>
            <a:dataSet id="DEPOSIT_TRANS_TYPE_DS" lookupCode="DEPOSIT_TRANS_TYPE"/>
            <a:dataSet id="exchangerate_type_ds">
                <a:datas dataSource="/model/exchangerate_type_path"/>
            </a:dataSet>
            <a:dataSet id="csh_transaction_receipt_head_ds" autoCreate="true" loadData="true"
                       model="csh.CSH511.csh_transaction">
                <a:fields>
                    <a:field name="current_apply_amount" defaultValue="0"/>
                    <a:field name="transaction_date" required="true"/>
                    <a:field name="currency_name" displayField="currency_name" options="currency_ds" readOnly="true"
                             required="true" returnField="currency_code" valueField="currency_code">
                        <a:mapping>
                            <a:map from="precision" to="precision"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="currency_code"/>
                    <a:field name="precision"/>
                    <a:field name="functional_currency_code"
                             defaultValue="${/model/default_exchange_rate_type_path/record/@functional_currency_code}"/>
                    <a:field name="bp_name" lovGridHeight="350" lovHeight="500" lovLabelWidth="90"
                             lovService="basic.hls_bp_master_v_for_lov" lovWidth="550" title="HLS.BP_TITLE">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id"/>
                            <a:map from="bp_name" to="bp_name"/>
                            <a:map from="bp_name" to="csh_bp_name"/>
                            <a:map from="bp_category" to="bp_category"/>
                            <a:map from="bp_category_name" to="bp_category_display"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_category_display" readOnly="true"/>
                    <a:field name="transaction_num" readOnly="true"/>
                    <a:field name="exchange_rate_type_display" displayField="type_name" options="exchangerate_type_ds"
                             readOnly="true" returnField="exchange_rate_type" valueField="type_code">
                        <a:mapping>
                            <a:map from="type_code" to="exchange_rate_type"/>
                            <a:map from="rate_method_code" to="rate_method_code"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="exchange_rate_type"/>
                    <a:field name="exchange_rate" readOnly="true" required="true"/>
                    <a:field name="rate_method_code"/>
                    <a:field name="transaction_amount" required="true"/>
                    <a:field name="transaction_functional_amount" readOnly="true"/>
                    <a:field name="bank_account_name" autoComplete="true" lovGridHeight="350" lovHeight="550"
                             lovLabelWidth="90" lovService="csh.CSH101.csh_bank_account_lov" lovWidth="850"
                             required="true" title="CSH511.BANK_ACCOUNT_CODE">
                        <a:mapping>
                            <a:map from="precision" to="precision"/>
                            <a:map from="zero_amounts_allowed" to="zero_amounts_allowed"/>
                            <a:map from="bank_account_id" to="bank_account_id"/>
                            <a:map from="bank_account_num" to="bank_account_num"/>
                            <a:map from="bank_account_name" to="bank_account_name"/>
                            <a:map from="bank_account_code" to="bank_account_code"/>
                            <a:map from="currency_code" to="currency_code"/>
                            <a:map from="currency_name" to="currency_name"/>
                            <a:map from="bank_account_type" to="bank_account_type"/>
                            <a:map from="bank_account_type_name" to="bank_account_type_name"/>
                            <a:map from="bank_branch_name" to="bank_branch_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="zero_amounts_allowed"/>
                    <a:field name="bp_bank_account_code" autoComplete="true" lovGridHeight="350" lovHeight="550"
                             lovLabelWidth="90" lovService="basic.hls_bp_master_bank_account_v_for_lov?enabled_flag=Y"
                             lovWidth="580" title="CSH511.BP_BANK_ACCOUNT_CODE">
                        <a:mapping>
                            <a:map from="bank_account_id" to="bp_bank_account_id"/>
                            <a:map from="bank_account_num" to="bp_bank_account_num"/>
                            <a:map from="bank_account_name" to="bp_bank_account_name"/>
                            <a:map from="bank_account_code" to="bp_bank_account_code"/>
                            <a:map from="bank_branch_name" to="bp_bank_branch_name"/>
                            <a:map from="bank_full_name" to="bp_bank_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="ref_contract_number" lovGridHeight="320" lovHeight="530"
                             lovService="csh.CSH510.csh_transaction_contract_query" lovWidth="800" title="合同编号">
                        <a:mapping>
                            <a:map from="bp_id" to="bp_id"/>
                            <a:map from="bp_name" to="bp_name"/>
                            <a:map from="bp_category" to="bp_category"/>
                            <a:map from="bp_category_n" to="bp_category_display"/>
                            <a:map from="contract_id" to="ref_contract_id"/>
                            <a:map from="contract_number" to="ref_contract_number"/>
                            <a:map from="bp_id_agent_level1_n" to="bp_id_agent_level1_n"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_bank_account_num"/>
                    <a:field name="bp_bank_account_name" required="true"/>

                </a:fields>
                <a:events>
                    <!--<a:event name="update" handler="onUpdate_csh511_receipt"/>
                    <a:event name="add" handler="onAdd_csh511_receipt"/>
                    <a:event name="load" handler="onAdd_csh511_receipt"/>-->
                </a:events>
            </a:dataSet>
            <a:dataSet id="refund_ertry_detail_result_ds" loadData="true" selectable="true">
                <a:fields>
                    <a:field name="deposit_amount" required="true"/>
                    <a:field name="transaction_category" defaultValue="BUSINESS"/>
                    <a:field name="transaction_type" defaultValue="RECEIPT"/>
                    <a:field name="document_category" defaultValue="CONTRACT"/>
                    <a:field name="contract_id"/>
                    <a:field name="bp_id_agent_level1"/>
                    <a:field name="bp_id_agent_level1_n"/>
                    <a:field name="bp_name"/>
                    <a:field name="bp_id_tenant"/>
                    <a:field name="deposit_trans_type"/>
                    <!--<a:field name="je_date"/>-->
<!--                    lovService="csh.CSH1300.con_refund_lov?bp_id_agent_level1=${/parameter/@bp_id}"-->
                    <a:field name="contract_number" lovGridHeight="300" lovHeight="430"
                             lovService="csh.CSH1300.con_refund_lov"
                             lovWidth="500" required="true">
                        <a:mapping>
                            <a:map from="contract_number" to="contract_number"/>
                            <a:map from="contract_id" to="contract_id"/>
                            <a:map from="bp_id_agent_level1" to="bp_id_agent_level1"/>
                            <a:map from="bp_id_agent_level1_n" to="bp_id_agent_level1_n"/>
                            <a:map from="bp_name" to="bp_name"/>
                            <a:map from="bp_id_tenant" to="bp_id_tenant"/>
                        </a:mapping>
                    </a:field>
<!--                    <a:field name="deposit_trans_type_desc" options="DEPOSIT_TRANS_TYPE_DS"-->
<!--                             returnField="deposit_trans_type" displayField="code_value_name" valueField="code_value"-->
<!--                             required="true"/>-->
                </a:fields>
                <a:events>
                    <a:event name="update" handler="on_csh_trx_deposit_write_off_update"/>
                    <a:event name="remove" handler="on_csh_trx_deposit_write_off_remove"/>
                    <a:event name="add" handler="on_csh_trx_deposit_write_off_add"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton id="csh1300_receipt_submit_id" click="csh1300_receipt_submit" text="提交"/>
                <a:gridButton id="csh1300_receipt_exit_id" click="csh1300_receipt_exit" text="返回"/>
            </a:screenTopToolbar>
            <a:fieldSet title="日立为优质客户付租金入账信息">
                <a:box column="3" labelWidth="100">
                    <a:textField name="transaction_num" bindTarget="csh_transaction_receipt_head_ds" readOnly="true"/>
                    <a:datePicker name="transaction_date" bindTarget="csh_transaction_receipt_head_ds" readOnly="true"/>
                    <a:numberField name="transaction_amount" allowDecimals="true" allowFormat="true"
                                   allowNegative="false" bindTarget="csh_transaction_receipt_head_ds" readOnly="true"/>
                    <a:textField name="bank_slip_num" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.BANK_CASH_CODE" readOnly="true"/>
                    <a:numberField name="unwrite_off_amount" bindTarget="csh_transaction_receipt_head_ds"
                                   prompt="剩余可用金额" readOnly="true"/>
                    <a:numberField name="current_apply_amount" bindTarget="csh_transaction_receipt_head_ds"
                                   prompt="当前申请金额" readOnly="true" renderer="Leaf.formatMoney"/>

                </a:box>
            </a:fieldSet>
            <!--添加两方的账户信息和附件-->
            <a:fieldSet title="账户信息">
                <a:box column="3" labelWidth="100">
                    <a:lov name="bank_account_name" bindTarget="csh_transaction_receipt_head_ds"
                           prompt="CSH510.CSH_TRANSACTION.MY_ACCOUNT_NAME" readOnly="true"/>
                    <a:textField name="bank_branch_name" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.MY_BANK_NAME" readOnly="true"/>
                    <a:textField name="bank_account_num" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.MY_ACCOUNT_USERNAME" readOnly="true"/>
                    <!--对方账户-->
                    <a:textField name="bp_bank_account_name" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.YOUR_ACCOUNT_NAME" readOnly="true"/>
                    <a:textField name="opposite_band_na" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.YOUR_BANK_NAME" readOnly="true"/>
                    <a:textField name="bp_bank_account_num" bindTarget="csh_transaction_receipt_head_ds"
                                 prompt="CSH510.CSH_TRANSACTION.YOUR_ACCOUNT_USERNAME" readOnly="true"/>
                </a:box>
            </a:fieldSet>
            <a:grid id="deposit_ertry_detail_result_grid" bindTarget="refund_ertry_detail_result_ds" height="200"
                    navBar="false" width="800">
                <a:toolBar>
                    <a:button type="add"/>
                    <a:button type="delete"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="contract_number" align="center" editor="contract_number_lov" prompt="合同编号"
                              width="150"/>
                    <a:column name="bp_id_agent_level1_n" align="center" prompt="代理店" width="180"/>
                    <a:column name="bp_name" align="center" prompt="承租人" width="180"/>
<!--                    <a:column name="deposit_trans_type_desc" align="center" editor="deposit_type_box" prompt="保证金类型"-->
<!--                              width="124"/>-->
                    <a:column name="deposit_amount" align="right" editor="deposit_amount_nb" prompt="分配金额"
                              renderer="Leaf.formatMoney" width="120"/>
                    <a:column name="je_date" align="center" prompt="经济业务发生日" renderer="Leaf.formatDate" width="120"/>
                </a:columns>
                <a:editors>
                    <a:datePicker id="je_date_picker"/>
                    <a:comboBox id="deposit_type_box"/>
                    <a:lov id="contract_number_lov"/>
                    <a:numberField id="deposit_amount_nb"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>