con_contract_cashflow_balance.lview 15.8 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: WangYu  
    $Date: 2014-4-25 上午09:31:11  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true">
    <a:init-procedure>
        <a:model-query defaultWhereClause="t1.document_category=&apos;CONTRACT&apos;" fetchAll="true" model="basic.hls_document_type_for_lov" rootPath="con501_document_type_path"/>
        <a:model-query fetchAll="true" model="basic.get_current_time" rootPath="curr_time"/>
        <a:model-query defaultWhereClause="t1.enabled_flag=&apos;Y&apos;" fetchAll="true" model="basic.csh_payment_method_for_lov" rootPath="payment_method_path"/>
    </a:init-procedure>
    <a:view>
        <a:link id="csh518_write_off_link" url="${/request/@context_path}/modules/csh/CSH518/csh_auto_write_off.lsc"/>
        <a:link id="csh_receipt_import_link" url="${/request/@context_path}/modules/csh/CSH511/csh_receipt_import_trans_upload.lview"/>
        <script type="text/javascript"><![CDATA[
            function CON321_con_contract_query() {
                $('con_contract_cashflow_balance_result_ds').query();
            }
            
            function CON321_con_contract_reset() {
                $('con_contract_cashflow_balance_query_ds').reset();
            }
            
            function CON321_render_contract_number(value, record, name) {
                if (name == "contract_number") {
                    if (record.get('overdue_max_days') >= 1) {
                        return '<u><a style="color:red" >' + value + '</a></u>';
                    } else {
                        return value;
                    }
                }
                if (name == "penalty") {
                    if (value > 0) {
                        return '<u><a style="color:red" >' + value + '</a></u>';
                    } else {
                        return '<a >' + value + '</a>';
                    }
                }
            }
            
            function csh512_write_off() {
                var records = $('con_contract_cashflow_balance_result_ds').getSelected();
                if (records.length == 0) {
                    Leaf.showMessage('${l:HLS.PROMPT}', '请选择数据!');
                    return;
                }
                var datas = [];
                Leaf.showConfirm('${l:PROMPT}', '确认核销?', function() {
                    Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
                    for (var i = 0;i < records.length;i++) {
                        var obj = {};
                        obj['_status'] = 'execute';
                        datas[i] = obj;
                        var cashflow_id = records[i].get('cashflow_id');
                        var contract_account_id = records[i].get('contract_account_id');
                        var payment_method_id = records[i].get('payment_method_id');
                        // var collection_classes = records[i].get('collection_classes');
            
                        //不输入核销日期取due_date
                        if (!records[i].get('write_off_date')) {
                            var calc_date = records[i].get('due_date');
                        } else {
                            calc_date = records[i].get('write_off_date');
                        }
                        if (calc_date) {
                            Leaf.request({
                                url: $('csh518_write_off_link').getUrl(),
                                para: {
                                    cashflow_id: cashflow_id,
                                    contract_account_id: contract_account_id,
                                    write_off_date: calc_date,
                                    payment_method_id: payment_method_id
                                },
                                success: function(res) {
                                    Leaf.SideBar.show({
                                        msg: '${l:核销成功!}',
                                        duration: 2000
                                    });
                                    Leaf.Masker.unmask(Ext.getBody());
                                    $('con_contract_cashflow_balance_result_ds').query();
                                },
                                failure: function() {
                                    Leaf.Masker.unmask(Ext.getBody());
                                },
                                error: function() {
                                    Leaf.Masker.unmask(Ext.getBody());
                                },
                                scope: this
                            });
                        } else {
                            Leaf.Masker.unmask(Ext.getBody());
                            Leaf.showMessage('${l:HLS.PROMPT}', '请选择核销日期!');
                            return;
                        }
                    }
                });
            }
            
            function csh511_receipt_import() {
                var win = new Leaf.Window({
                    url: $('csh_receipt_import_link').getUrl(),
                    title: '收款导入',
                    id: 'csh_receipt_import_window',
                    fullScreen: true
                });
                win.on('close', function() {
                    $('con_contract_cashflow_balance_result_ds').query();
                });
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="con321_contract_status_ds" lookupCode="CON500_CONTRACT_STATUS"/>
            <!-- <a:dataSet id="collection_classes_type_ds" lookupCode="COLLECTION_CLASSES_TYPE"/> -->
            <a:dataSet id="payment_method_ds">
                <a:datas dataSource="/model/payment_method_path"/>
            </a:dataSet>
            <a:dataSet id="over_status_flag_ds">
                <a:datas>
                    <a:record name="Y" value="是"/>
                    <a:record name="N" value="否"/>
                </a:datas>
            </a:dataSet>
            <a:dataSet id="con501_document_type_name_ds">
                <a:datas dataSource="/model/con501_document_type_path"/>
            </a:dataSet>
            <a:dataSet id="con_contract_cashflow_balance_query_ds" autoCreate="true">
                <a:fields>
                    <a:field name="due_date_from" defaultValue="${/model/curr_time/record/@start_date}"/>
                    <a:field name="due_date_to" defaultValue="${/model/curr_time/record/@end_date}"/>
                    <a:field name="document_type_desc" displayField="description" options="con501_document_type_name_ds" returnField="document_type" valueField="document_type"/>
                    <a:field name="contract_number_from" autoComplete="true" lovGridHeight="330" lovHeight="500" lovLabelWidth="100" lovService="cont.CON500.con_contract_number_lov" lovWidth="520" title="合同号">
                        <a:mapping>
                            <a:map from="contract_number" to="contract_number_from"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="contract_number_to" autoComplete="true" lovGridHeight="350" lovHeight="500" lovLabelWidth="100" lovService="cont.CON500.con_contract_number_lov" lovWidth="520" title="合同号">
                        <a:mapping>
                            <a:map from="contract_number" to="contract_number_to"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_id_tenant_n" lovGridHeight="350" lovHeight="500" lovLabelWidth="100" lovService="cont.CON321.rsc_fc_contract_bp_lov" lovWidth="520" title="HLS.BP_TITLE">
                        <a:mapping>
                            <a:map from="bp_name" to="bp_id_tenant_n"/>
                            <a:map from="bp_id" to="bp_id_tenant"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="cf_item_desc" autoComplete="true" lovGridHeight="350" lovHeight="500" lovLabelWidth="100" lovService="csh.CSH518.hls_cashflow_item_v_lov?cf_direction=INFLOW" lovWidth="520" title="现金流项目">
                        <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="price_list_name" autoComplete="true" fetchSingle="true" lovGridHeight="350" lovHeight="500" lovService="hls.HLS050.hls_price_list_for_lov" lovWidth="500" title="HLS.PRICE_LIST">
                        <a:mapping>
                            <a:map from="price_list" to="price_list"/>
                            <a:map from="description" to="price_list_name"/>
                            <a:map from="calc_method" to="calc_method"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="invoice_agent_id_n" lovGridHeight="350" lovHeight="500" lovLabelWidth="100" lovService="basic.hls_bp_master_v_all_lov?bp_category=AGENT" lovWidth="520" title="HLS.BP_TITLE">
                        <a:mapping>
                            <a:map from="bp_name" to="invoice_agent_id_n"/>
                            <a:map from="bp_id" to="invoice_agent_id"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="contract_status"/>
                    <a:field name="contract_status_desc" displayField="code_value_name" options="con321_contract_status_ds" returnField="contract_status" valueField="code_value"/>
                    <a:field name="write_off_flag_desc" displayField="value" options="over_status_flag_ds" returnField="write_off_flag" valueField="name"/>
                    <a:field name="over_status_flag_desc" displayField="value" options="over_status_flag_ds" returnField="overdue_status" valueField="name"/>
                    <a:field name="company_authority" defaultValue="${/session/@company_id}"/>
                    <a:field name="write_off_date"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="con_contract_cashflow_balance_result_ds" autoPageSize="true" autoQuery="true" model="csh.CSH518.con_contract_cashflow_balance" queryDataSet="con_contract_cashflow_balance_query_ds" selectable="true">
                <a:fields>
                    <!-- <a:field name="payment_method_id" defaultValue="1"/> -->
                    <a:field name="payment_method_display" displayField="description" options="payment_method_ds" required="true" returnField="payment_method_id" valueField="payment_method_id"/>
                    <!-- <a:field name="collection_classes" defaultValue="999"/> -->
                    <!-- <a:field name="collection_classes_desc" displayField="code_value_name" options="collection_classes_type_ds" required="true" returnField="collection_classes" valueField="code_value"/> -->
                    <a:field name="contract_account_num" lovGridHeight="350" lovHeight="500" lovLabelWidth="100" lovService="csh.CSH101.csh_bank_account_lov" lovWidth="1000" title="收款账户">
                        <a:mapping>
                            <a:map from="bank_account_id" to="contract_account_id"/>
                            <a:map from="bank_account_code" to="contract_account_code"/>
                            <a:map from="bank_account_num" to="contract_account_num"/>
                        </a:mapping>
                    </a:field>
                </a:fields>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="CON321_con_contract_query" text="HLS.QUERY"/>
                <a:gridButton click="CON321_con_contract_reset" text="HLS.RESET"/>
                <a:gridButton click="csh512_write_off" text="核销"/>
                <!-- <a:gridButton id="csh511_receipt_import_id" click="csh511_receipt_import" text="收款导入"/> -->
            </a:screenTopToolbar>
            <a:form bindTarget="con_contract_cashflow_balance_query_ds" column="4" marginWidth="60" title="查询条件">
                <a:textField name="contract_number" bindTarget="con_contract_cashflow_balance_query_ds" prompt="支付表编号"/>
                <a:comboBox name="contract_status_desc" bindTarget="con_contract_cashflow_balance_query_ds" prompt="支付表状态"/>
                <a:lov name="bp_id_tenant_n" bindTarget="con_contract_cashflow_balance_query_ds" prompt="承租人"/>
                <a:lov name="cf_item_desc" bindTarget="con_contract_cashflow_balance_query_ds" prompt="现金流项目"/>
                <a:lov name="invoice_agent_id_n" bindTarget="con_contract_cashflow_balance_query_ds" prompt="经销商"/>
                <a:datePicker name="due_date_from" bindTarget="con_contract_cashflow_balance_query_ds" prompt="应收日从"/>
                <a:datePicker name="due_date_to" bindTarget="con_contract_cashflow_balance_query_ds" prompt="应收日到"/>
            </a:form>
            <a:grid bindTarget="con_contract_cashflow_balance_result_ds" marginHeight="230" marginWidth="60" navBar="true">
                <a:toolBar>
                    <a:button type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="write_off_date" align="center" editor="wrrite_off_date" lock="true" prompt="核销日期" renderer="Leaf.formatDate" width="90"/>
                    <a:column name="contract_number" align="left" lock="true" prompt="支付表编号" renderer="CON321_render_contract_number" width="120"/>
                    <a:column name="contract_name" align="left" prompt="支付表名称" width="230"/>
                    <a:column name="invoice_agent_id_n" align="left" prompt="经销商" width="180"/>
                    <a:column name="contract_account_num" align="left" editor="contract_account_id" prompt="收款账户" width="230"/>
                    <a:column name="payment_method_display" align="center" editor="edit_combobox" prompt="收款方式" width="120"/>
                    <!-- <a:column name="collection_classes_desc" align="center" editor="edit_combobox" prompt="收款类型" width="120"/> -->
                    <a:column name="cf_item_desc" align="center" prompt="现金流项目"/>
                    <a:column name="times" align="center" prompt="期数" width="50"/>
                    <a:column name="due_date" align="center" prompt="应收日" renderer="Leaf.formatDate" width="80"/>
                    <a:column name="due_amount" align="right" prompt="应收金额" renderer="Leaf.formatMoney" width="90"/>
                    <a:column name="principal" align="right" prompt="应收本金" renderer="Leaf.formatMoney" width="90"/>
                    <a:column name="interest" align="right" prompt="应收利息" renderer="Leaf.formatMoney" width="90"/>
                    <a:column name="received_amount" align="right" prompt="实收金额" renderer="Leaf.formatMoney" width="90"/>
                    <a:column name="received_principal" align="right" prompt="实收本金" renderer="Leaf.formatMoney" width="90"/>
                    <a:column name="received_interest" align="right" prompt="实收利息" renderer="Leaf.formatMoney" width="90"/>
                    <a:column name="unreceived_amount" align="right" prompt="未收金额" renderer="Leaf.formatMoney" width="90"/>
                    <a:column name="unreceived_principal" align="right" prompt="未收本金" renderer="Leaf.formatMoney" width="90"/>
                    <a:column name="unreceived_interest" align="right" prompt="未收利息" renderer="Leaf.formatMoney" width="90"/>
                </a:columns>
                <a:editors>
                    <a:datePicker id="wrrite_off_date"/>
                    <a:lov id="contract_account_id"/>
                    <a:comboBox id="edit_combobox"/>
                </a:editors>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>