csh_payment_query.lview 23 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 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: qwm  
    $Date: 2013-8-30 上午11:11:35  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="gld.gld_currency_vl" rootPath="acr512_currency_list"/>
    </a:init-procedure>
    <a:view>
        <a:link id="csh_payment_req_doc_print_d_link" url="${/request/@context_path}/modules/csh/CSH502/csh_payment_doc_print_d.lview"/>
        <a:link id="csh502_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
        <!-- <a:link id="CSH501D_QUERY_col_detail" url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req.lview"/> -->
        <a:link id="csh_payment_query_detail_link" url="${/request/@context_path}/modules/csh/CSH505/csh_payment_query_detail.lview"/>
        <a:link id="csh_payment_req_doc_print_link" url="${/request/@context_path}/modules/csh/CSH502/csh_payment_doc_print.lview"/>
        <a:link id="csh502_csh_payment_req_link_id" url="${/request/@context_path}/modules/csh/CSH501/csh_payment_req.lview"/>
        <script type="text/javascript"><![CDATA[
            function csh502_payment_query() {
                $('csh_payment_req_queryDs').query();
                $('csh_payment_req_sum_queryDs').query();
            }
            
            function csh502_payment_reset() {
                $('csh_payment_req_query_ds').reset();
            }
            
            function render_objectDs_grid(value, record, name) {
                 if (name === 'payment_req_number') {
                    if (!record.isNew) {
                        return '<a href="javascript:winOpen_req_pay(\'' + record.id + '\')">' + value + '</a>';
                    }
                }
            }
            
            function winOpen_req_pay(record_id) {
                var record = $('csh_payment_req_queryDs').findById(record_id);
                var param = {};
                param['function_usage'] = 'QUERY';
                param['maintain_type'] = 'READONLY';
                param['payment_req_id'] = record.get('payment_req_id');
                param['document_category'] = record.get('document_category');
                param['business_type'] = record.get('business_type');
                param['function_code'] = 'CSH501Q';
                param['winid'] = 'csh_payment_update_window';
                param['url_title'] = '付款申请';
                hls_doc_get_layout_code('csh502_get_layout_code_link_id', param, 'csh502_csh_payment_req_link_id', 'csh_payment_req_queryDs');
            }
            
            
            
            // function openWin(ds_id){
            // var record = $(ds_id).getCurrentRecord();
            // maintain_type = 'UPDATE';
            // param = record.data;
            // param['payment_req_id'] = record.get('payment_req_id');
            // param['function_code'] = 'CSH505D';
            // param['function_usage'] = 'MODIFY';
            // //param['layout_debugger_flag']='Y';
            // param['maintain_type'] = maintain_type;
            // param['url_title'] = '付款申请';
            // hls_doc_get_layout_code('prj_project_get_layout_code_link_id', param, 'csh_payment_query_detail');
            // }
            // function onOpenWin(value, record, name) {
            // return '<a href="javascript:openWin(\'' + record.ds.id + '\')">' + value + '</a>';
            // }
            
            function onUpdate_payment_req(ds, record, name, value, oldvalue) {
                if (name == 'payment_req_number_from') {
                    if (record.get('payment_req_number_to') == 'undefined' || record.get('payment_req_number_to') == null || record.get('payment_req_number_to') == '') {
                        record.set('payment_req_number_to', value);
                    }
                } else if (name == 'payment_req_number_to') {
                    if (record.get('payment_req_number_from') == 'undefined' || record.get('payment_req_number_from') == null || record.get('payment_req_number_from') == '') {
                        record.set('payment_req_number_from', value);
                    }
                } else if (name == 'approval_date_from') {
                    if (record.get('approval_date_to') == 'undefined' || record.get('approval_date_to') == null || record.get('approval_date_to') == '') {
                        record.set('approval_date_to', value);
                    }
                } else if (name == 'approval_date_to') {
                    if (record.get('approval_date_from') == 'undefined' || record.get('approval_date_from') == null || record.get('approval_date_from') == '') {
                        record.set('approval_date_from', value);
                    }
                } else if (name == 'amount_from') {
                    if (record.get('amount_to') == 'undefined' || record.get('amount_to') == null || record.get('amount_to') == '') {
                        record.set('amount_to', value);
                    }
                } else if (name == 'amount_to') {
                    if (record.get('amount_from') == 'undefined' || record.get('amount_from') == null || record.get('amount_from') == '') {
                        record.set('amount_from', value);
                    }
                } else if (name == 'req_date_from') {
                    if (record.get('req_date_to') == 'undefined' || record.get('req_date_to') == null || record.get('req_date_to') == '') {
                        record.set('req_date_to', value);
                    }
                } else if (name == 'req_date_to') {
                    if (record.get('req_date_from') == 'undefined' || record.get('req_date_from') == null || record.get('req_date_from') == '') {
                        record.set('req_date_from', value);
                    }
                } else if (name == 'bp_code_from') {
                    if (record.get('bp_code_to') == 'undefined' || record.get('bp_code_to') == null || record.get('bp_code_to') == '') {
                        record.set('bp_code_to', value);
                    }
                } else if (name == 'bp_code_to') {
                    if (record.get('bp_code_from') == 'undefined' || record.get('bp_code_from') == null || record.get('bp_code_from') == '') {
                        record.set('bp_code_from', value);
                    }
                } else if (name == 'apply_pay_date_from') {
                    if (record.get('apply_pay_date_to') == 'undefined' || record.get('apply_pay_date_to') == null || record.get('apply_pay_date_to') == '') {
                        record.set('apply_pay_date_to', value);
                    }
                } else if (name == 'apply_pay_date_to') {
                    if (record.get('apply_pay_date_from') == 'undefined' || record.get('apply_pay_date_from') == null || record.get('apply_pay_date_from') == '') {
                        record.set('apply_pay_date_from', value);
                    }
                } else if (name == 'approval_date_from') {
                    if (record.get('approval_date_to') == 'undefined' || record.get('approval_date_to') == null || record.get('approval_date_to') == '') {
                        record.set('approval_date_to', value);
                    }
                } else if (name == 'approval_date_to') {
                    if (record.get('approval_date_from') == 'undefined' || record.get('approval_date_from') == null || record.get('approval_date_from') == '') {
                        record.set('approval_date_from', value);
                    }
                } else if (name == 'closed_date_from') {
                    if (record.get('closed_date_to') == 'undefined' || record.get('closed_date_to') == null || record.get('closed_date_to') == '') {
                        record.set('closed_date_to', value);
                    }
                } else if (name == 'closed_date_to') {
                    if (record.get('closed_date_from') == 'undefined' || record.get('closed_date_from') == null || record.get('closed_date_from') == '') {
                        record.set('closed_date_from', value);
                    }
                }
            }
            
            function check_data(records) {
                for (var i = 0;i < records.length;i++) {
                    if (records[i].get('approval_status') === 'APPROVED') {
                        continue;
                    } else {
                        return false;
                    }
                }
                return true;
            }
            
            function csh502_payment_doc_print() {
                var records = $('csh_payment_req_queryDs').getSelected();
                if (records.length === 0) {
                    Leaf.showMessage('${l:PROMPT}', '请选择至少一条记录');
                    return;
                } else if (!check_data(records)) {
                    Leaf.showWarningMessage('提示', '仅能打印汇签单列显示为<font color="red">未打印</font>或已打印的数据!');
                    return;
                }
                var instr = '';
                for (var i = 0;i < records.length;i++) {
                    if (i == 0) {
                        instr = instr + records[i].get('payment_req_id');
                    } else {
                        instr = instr + ',' + records[i].get('payment_req_id');
                    }
                }
                var url = $('csh_payment_req_doc_print_link').getUrl() + '?payment_req_id=' + instr;
                window.open(url);
            }
            
            function csh502_payment_doc_print_d() {
                var records = $('csh_payment_req_queryDs').getSelected();
                if (records.length === 0) {
                    Leaf.showMessage('${l:PROMPT}', '请选择至少一条记录');
                    return;
                } else if (!check_data(records)) {
                    Leaf.showWarningMessage('提示', '仅能打印汇签单列显示为<font color="red">未打印</font>或已打印的数据!');
                    return;
                }
                var instr = '';
                for (var i = 0;i < records.length;i++) {
                    if (i == 0) {
                        instr = instr + records[i].get('payment_req_id');
                    } else {
                        instr = instr + ',' + records[i].get('payment_req_id');
                    }
                }
                var url = $('csh_payment_req_doc_print_d_link').getUrl() + '?payment_req_id=' + instr;
                window.open(url);
            }
            
            function summaryRenderer(datas, name) {
                var sum = 0;
                var sum1 = 0;
                if (name == "approval_status_desc") {
                    return '合计:<font color="red"></font>';
                }
                if (name == "amount") {
                    for (var i = 0;i < datas.length;i++) {
                        var record = datas[i];
                        var payment_amount_vl = record.get("amount");
                        var payment_amount = parseFloat(payment_amount_vl);
                        if (!isNaN(payment_amount)) {
                            sum += payment_amount;
                        }
                    }
                    return '<font color="red">' + Leaf.formatNumber(sum, 2) + '</font>';
                }
                if (name == 'sum_act_amount') {
                    for (var i = 0;i < datas.length;i++) {
                        var record = datas[i];
                        var new_payment_amount_vl = record.get("sum_act_amount");
                        var new_payment_amount = parseFloat(new_payment_amount_vl);
                        if (!isNaN(new_payment_amount)) {
                            sum1 += new_payment_amount;
                        }
                    }
                    return '<font color="red">' + Leaf.formatNumber(sum1, 2) + '</font>';
                }
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="closed_status_ds">
                <a:datas>
                    <a:record code_value="Y" code_value_name="是"/>
                    <a:record code_value="N" code_value_name="否"/>
                    <a:record code_value="" code_value_name="全部"/>
                </a:datas>
            </a:dataSet>
            <a:dataSet id="approval_status_ds" lookupCode="CSH_PAYMENT_REQ_APPROVAL_STATUS"/>
            <a:dataSet id="acr512_currency_ds">
                <a:datas dataSource="/model/acr512_currency_list"/>
            </a:dataSet>
            <a:dataSet id="csh_payment_req_query_ds">
                <a:fields>
                    <a:field name="closed_flag_desc" displayfield="code_value_name" options="closed_status_ds" returnfield="closed_flag" valuefield="code_value"/>
                    <a:field name="approval_status_desc" displayfield="code_value_name" options="approval_status_ds" returnfield="approval_status" valuefield="code_value"/>
                    <a:field name="currency_name" displayField="currency_name" options="acr512_currency_ds" returnField="currency_code" valueField="currency_code"/>
                    <a:field name="payment_flag_n" displayfield="code_value_name" options="closed_status_ds" returnfield="payment_flag" valuefield="code_value"/>
                    <a:field name="print_flag_n" displayfield="code_value_name" options="closed_status_ds" returnfield="print_flag" valuefield="code_value"/>
                    <a:field name="fin_manager"/>
                    <a:field name="fin_manager_n" lovGridHeight="350" lovHeight="500" lovService="basic.fin_manager_lov" lovWidth="500">
                        <a:mapping>
                            <a:map from="value_code" to="fin_manager"/>
                            <a:map from="value_name" to="fin_manager_n"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_name" lovGridHeight="350" lovHeight="500" lovService="basic.hls_bp_master_v_for_lov" lovWidth="500">
                        <a:mapping>
                            <a:map from="bp_code" to="bp_code"/>
                            <a:map from="bp_name" to="bp_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="bp_category_n" lovGridHeight="350" lovHeight="500" lovService="csh.CSH505.hls_bp_category" lovWidth="500">
                        <a:mapping>
                            <a:map from="bp_category" to="bp_category"/>
                            <a:map from="description" to="bp_category_n"/>
                        </a:mapping>
                    </a:field>
                    <!-- <a:field name="bp_code_to" lovGridHeight="350" lovHeight="500" lovService="basic.hls_bp_master_v_for_lov" lovWidth="500">
                        <a:mapping>
                            <a:map from="bp_code" to="bp_code_to"/>
                            <a:map from="bp_name" to="bp_code_desc_to"/>
                        </a:mapping>
                    </a:field> -->
                    <a:field name="bp_id_tenant_n"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="onUpdate_payment_req"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="csh_payment_req_queryDs" autoPageSize="true" autoQuery="true" model="csh.CSH505.csh_payment_query" queryDataSet="csh_payment_req_query_ds" selectable="true">
                <a:fields>
                    <a:field name="closed_flag" checkedValue="Y" defaultValue="Y" readOnly="true" uncheckedValue="N"/>
                    <a:field name="submitted_flag" checkedValue="Y" defaultValue="Y" readOnly="true" uncheckedValue="N"/>
                    <a:field name="payment_flag" checkedValue="Y" readOnly="true" uncheckedValue="N"/>
                    <a:field name="approval_status_desc" displayfield="code_value_name" options="approval_status_ds" returnfield="approval_status" valuefield="code_value"/>
                </a:fields>
            </a:dataSet>
            <a:dataSet id="csh_payment_req_sum_queryDs" autoQuery="true" model="csh.CSH505.csh_payment_sum_amount_query" queryDataSet="csh_payment_req_query_ds"><![CDATA[
                
            ]]></a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:gridButton click="csh502_payment_query" text="HAP_QUERY"/>
                <a:gridButton click="csh502_payment_reset" text="HLS.RESET"/>
                <!--<a:gridButton click="csh502_payment_doc_print" text="汇签单打印"/>-->
                <!--<a:gridButton click="csh502_payment_doc_print_d" text="保证金汇签单"/>-->
            </a:screenTopToolbar>
            <a:form column="4" labelWidth="100" marginWidth="30" title="CSH502.CSH_PAYMENT_REQ_QUERY">
                <a:numberField name="sum_amount" allowFormat="true" bindTarget="csh_payment_req_sum_queryDs" prompt="实际申请总金额" readOnly="true"/>
                <a:textField name="sum_count" bindTarget="csh_payment_req_sum_queryDs" prompt="总笔数" readOnly="true"/>
                <a:textField name="contract_number" bindTarget="csh_payment_req_query_ds" prompt="合同编号"/>
                <!-- <a:datePicker name="req_date_from" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_REQ_DATE_FROM"/> -->
                <!-- <a:datePicker name="req_date_to" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_REQ_DATE_TO"/> -->
                <!-- <a:lov name="bp_code" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_PAYMENT_OBJ"/> -->
                <!--<a:lov name="fin_manager_n" bindTarget="csh_payment_req_query_ds" prompt="驻外经理"/>-->
                <!-- <a:datePicker name="apply_pay_date_from" bindTarget="csh_payment_req_query_ds" prompt="申请付款日期从" width="150"/>
                <a:datePicker name="apply_pay_date_to" bindTarget="csh_payment_req_query_ds" prompt="申请付款日期到" width="150"/> -->
                <!-- <a:numberField name="amount_from" allowDecimals="true" allowFormat="true" bindTarget="csh_payment_req_query_ds" prompt="申请总金额从"/> -->
                <!-- <a:numberField name="amount_to" allowDecimals="true" allowFormat="true" bindTarget="csh_payment_req_query_ds" prompt="申请总金额到"/> -->
                <a:textField name="bp_id_tenant_n" bindTarget="csh_payment_req_query_ds" prompt="申请人"/>
                <a:comboBox name="approval_status_desc" bindTarget="csh_payment_req_query_ds" prompt="审批状态"/>
                <a:datePicker name="approval_date_from" bindTarget="csh_payment_req_query_ds" prompt="审批日期从"/>
                <a:datePicker name="approval_date_to" bindTarget="csh_payment_req_query_ds" prompt="审批日期到"/>
                <!--<a:comboBox name="payment_flag_n" bindTarget="csh_payment_req_query_ds" prompt="是否全额支付"/>-->
                <!--<a:comboBox name="closed_flag_desc" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_CLOSED_FLAG"/>-->
                <!--<a:datePicker name="closed_date_from" bindTarget="csh_payment_req_query_ds" prompt="关闭日期从"/>-->
                <!--<a:datePicker name="closed_date_to" bindTarget="csh_payment_req_query_ds" prompt="关闭日期到"/>-->
                <a:lov name="bp_name" bindTarget="csh_payment_req_query_ds" prompt="对象名称"/>
                <a:lov name="bp_category_n" bindTarget="csh_payment_req_query_ds" prompt="对象类别"/>
                <a:textField name="payment_req_number" bindTarget="csh_payment_req_query_ds" prompt="申请单号"/>
                <!-- <a:comboBox name="print_flag_n" bindTarget="csh_payment_req_query_ds" prompt="汇签单是否打印"/> -->
                <!-- <a:textField name="submitted_flag" bindTarget="csh_payment_req_query_ds" prompt="CSH502.CSH_SUBMIT_STATE" width="150"/> -->
            </a:form>
            <a:grid id="csh_payment_req_grid_ds" bindTarget="csh_payment_req_queryDs" marginHeight="230" marginWidth="30" navBar="true">
                <a:toolBar>
                    <a:button type="excel"/>
                </a:toolBar>
                <a:columns>
                    <a:column name="payment_req_number" lock="true" prompt="CSH502.CSH_REQ_NO" renderer="render_objectDs_grid" width="140"/>
                    <!--<a:column name="print_flag" align="center" prompt="汇签单" renderer="render_objectDs_grid" width="80"/>-->
                    <!--<a:column name="status_n" align="center" prompt="BPM状态" width="80"/>-->
                    <a:column name="req_date" align="center" prompt="CSH502.CSH_REQ_DATE" renderer="Leaf.formatDate" width="80"/>
                    <!-- <a:column name="project_number" prompt="申请编号" showTitle="true" width="100"/> -->
                    <a:column name="bp_id_tenant_n" prompt="申请人" showTitle="true" width="140"/>
                    <!--<a:column name="fin_manager_n" prompt="驻外经理"/>-->
                    <a:column name="contract_number" prompt="合同编号" showTitle="true" width="140"/>
                    <a:column name="approval_date" align="center" prompt="CSH502.CSH_APR_DATE" renderer="Leaf.formatDate" width="80"/>
                    <a:column name="approval_status_desc" align="center" footerRenderer="summaryRenderer" prompt="CSH502.CSH_APR_STATE" width="80"/>
                    <a:column name="amount" align="right" footerRenderer="summaryRenderer" prompt="申请总金额" renderer="Leaf.formatMoney"/>
                    <a:column name="sum_act_amount" align="right" footerRenderer="summaryRenderer" prompt="实际申请金额" renderer="Leaf.formatMoney" width="100"/>
                    <!--<a:column name="price" align="right" prompt="指导价" renderer="Leaf.formatMoney"/>-->
                    <a:column name="bp_name" prompt="CSH501.CSH_PAYMENT_OBJ_NAME" showTitle="true" width="100"/>
                    <a:column name="bp_category_n" prompt="对象类型" width="100"/>
                    <a:column name="bp_num" prompt="对象账号" showTitle="true" width="130"/>
                    <a:column name="bp_bank_account_name" prompt="账户名称" showTitle="true" width="100"/>
                    <!-- <a:column name="bank_full_name" prompt="银行" showTitle="true" width="100"/> -->
                    <!-- <a:column name="bank_account_name" prompt="出租方账户名称" showTitle="true" width="200"/> -->
                    <!--<a:column name="payment_flag" align="center" prompt="是否全额支付" width="80"/>-->
                    <!--<a:column name="closed_date" align="center" prompt="关闭日期" renderer="Leaf.formatDate" width="80"/>-->
                    <!--<a:column name="closed_flag" prompt="CSH502.CSH_CLOSED_FLAG" width="60"/>-->
                    <a:column name="user_name" prompt="提交人"/>
                    <a:column name="currency_code" align="center" prompt="HLS.CURRENCY" width="60"/>
                    <!--  <a:column name="position_name" prompt="岗位"/> -->
                </a:columns>
            </a:grid>
        </a:screenBody>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
    </a:view>
</a:screen>