acr_invoice_confirm.lview 22.4 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
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-7-18 上午09:34:28  
    $Revision: 1.0  
    $Purpose: 
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
    <a:init-procedure>
        <a:model-query fetchAll="true" model="gld.gld_currency_vl" rootPath="acr513_currency_list"/>
        <a:model-query fetchAll="true" model="acr.ACR512.acr_invoice_business_type_list"
                       rootPath="acr513_business_type_list"/>
    </a:init-procedure>
    <a:view>
        <a:link id="acr513_invoice_readonly_page"
                url="${/request/@context_path}/modules/cont/CON500/con_contract_update.lview"/>
        <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
                modelaction="update"/>
        <a:link id="receipt_print_link"
                url="${/request/@context_path}/modules/prj/PRJ312/dmegc_emp_loan_cn_print.lview"/>
        <a:link id="cash_deposit_printt_link"
                url="${/request/@context_path}/modules/acr/ACR513/cash_deposit_print.lview"/>
niminmin's avatar
niminmin committed
23
        <a:link id="acr512_invoice_status_change_new" url="${/request/@context_path}/modules/acr/ACR510/acr_invoice_status_change.lsc"/>
Spencer Chang's avatar
Spencer Chang committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
        <script type="text/javascript"><![CDATA[
        function acr513_invoice_query() {
            $('acr513_invoice_result_ds').query();
        }

        function acr513_invoice_reset() {
            $('acr513_invoice_query_ds').reset();
        }

        function acr513_grid_query(reocrd_id, invoice_hd_id, status) {
            var maintain_type = 'READONLY';
            var currency_reocrd = $('acr513_invoice_result_ds').findById(reocrd_id);
            var param = currency_reocrd.data;
            param['function_code'] = 'ACR512';
            param['document_id'] = invoice_hd_id;
            param['function_usage'] = 'QUERY';
            param['maintain_type'] = maintain_type;
            param['url_title'] = '${l:ACR.INVOICE_DETAIL}';
            hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'acr513_invoice_readonly_page', 'acr513_invoice_result_ds');
        }

stone's avatar
stone committed
45 46 47
        // function acr513_document_number_render(value, record, name) {
        //     return '<a href="javascript:acr513_grid_update(' + record.id + ',' + record.get('invoice_hd_id') + ',\'' + record.get('invoice_status') + '\');">' + value + '</a>';
        // }
Spencer Chang's avatar
Spencer Chang committed
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

        function acr513_formatMoney(value, record, name) {
            return Leaf.formatNumber(value);
        }

        function acr513_invoice_query_Onupdate(ds, record, name, value, oldVlaue) {
            if (name == 'document_number_f') {
                if (Leaf.isEmpty(record.get('document_number_t'))) {
                    record.set('document_number_t', value);
                }
            } else if (name == 'project_number_f') {
                if (Leaf.isEmpty(record.get('project_number_t'))) {
                    record.set('project_number_t', value);
                }
            } else if (name == 'invoice_number_f') {
                if (Leaf.isEmpty(record.get('invoice_number_t'))) {
                    record.set('invoice_number_t', value);
                }
            } else if (name == 'contract_number_f') {
                if (Leaf.isEmpty(record.get('contract_number_t'))) {
                    record.set('contract_number_t', value);
                }
            } else if (name == 'invoice_bp_code_f') {
                if (Leaf.isEmpty(record.get('invoice_bp_code_t'))) {
                    record.set('invoice_bp_code_t', value);
                }
            } else if (name == 'total_amount_f') {
                if (Leaf.isEmpty(record.get('total_amount_t'))) {
                    record.set('total_amount_t', value);
                }
            } else if (name == 'invoice_date_f') {
                if (Leaf.isEmpty(record.get('invoice_date_t'))) {
                    record.set('invoice_date_t', value);
                }
            } else if (name == 'accounting_date_f') {
                if (Leaf.isEmpty(record.get('accounting_date_t'))) {
                    record.set('accounting_date_t', value);
                }
            }
            if (Ext.isEmpty(record.get('project_number_f')) && Ext.isEmpty(record.get('project_number_t'))) {
                record.set('query_project_number', '');
            }
            else {
                record.set('query_project_number', 'Y');
            }
            if (Ext.isEmpty(record.get('contract_number_f')) && Ext.isEmpty(record.get('contract_number_t'))) {
                record.set('query_contract_number', '');
            }
            else {
                record.set('query_contract_number', 'Y');
            }
        }

        function acr513_grid_query(reocrd_id, invoice_hd_id, status) {
            var maintain_type = 'READONLY';
            var currency_reocrd = $('acr513_invoice_result_ds').findById(reocrd_id);
            var param = currency_reocrd.data;
            param['function_code'] = 'ACR513';
            param['document_id'] = invoice_hd_id;
            param['function_usage'] = 'QUERY';
            param['maintain_type'] = maintain_type;
109
            param['url_title'] = '销项发票明细';
Spencer Chang's avatar
Spencer Chang committed
110 111 112 113 114 115 116 117 118
            hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'acr513_invoice_readonly_page', 'acr513_invoice_result_ds');
        }


        function acr513_document_number_render(value, record, name) {
            return '<a href="javascript:acr513_grid_query(' + record.id + ',' + record.get('invoice_hd_id') + ',\'' + record.get('invoice_status') + '\');">' + value + '</a>';
        }

        function acr513_invoice_confirm() {
119
            var records = $('acr513_invoice_result_ds').getSelected();
stone's avatar
stone committed
120 121 122 123 124 125
            if (records.length== 0) {
                     Leaf.showMessage('提示', '请至少选择一条数据进行确认!');
                    return;
                 }
            for (var i=0;i<records.length;i++){
                if (records[i].get('created_by') == ' ${/session/@user_id}') {
stone's avatar
stone committed
126
                    Leaf.showMessage('提示', '确认人不能和创建人一样,请勿确认!');
127 128
                    return;
                 }
stone's avatar
stone committed
129 130 131 132 133
                if(records[i].get('invoice_status')!='CONFIRMING'){
                    Leaf.showMessage('提示', '选择的单据中存在状态不为复核中的单据!');
                    return;
                }

134
            }
stone's avatar
stone committed
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
           Leaf.showConfirm("提示",'确认执行该操作?',function(){
               $('acr513_invoice_result_ds').submitSelected();

           });
        }


        function acr513_invoice_reject() {
            var records = $('acr513_invoice_result_ds').getSelected();
            var detail_mask=Ext.getBody();
            if (records.length== 0) {
                Leaf.showMessage('提示', '请至少选择一条数据!');
                return;
            }
            var param = {};
            var saveDate=[];
            for (var i=0;i<records.length;i++){
                if (records[i].get('created_by') == ' ${/session/@user_id}') {
                    Leaf.showMessage('提示', '审批人和开票人一样,不能操作!');
                    return;
                }
                if(records[i].get('invoice_status')!='CONFIRMING'){
                    Leaf.showMessage('提示', '选择的单据中存在状态不为复核中的单据!');
                    return;
                }
                saveDate.push({
                    invoice_hd_id :records[i].get('invoice_hd_id'),
                    want_status   : 'REJECT'
                });
            }
            param['details'] = saveDate;
        Leaf.showConfirm("提示",'确认退回所选择的单据?',function(){
            Leaf.request({
niminmin's avatar
niminmin committed
168
                url: $('acr512_invoice_status_change_new').getUrl(),
stone's avatar
stone committed
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185
                para: param,
                success: function() {
                    Leaf.Masker.unmask(detail_mask);
                    $('acr513_invoice_result_ds').query();
                },
                failure: function() {
                    Leaf.Masker.unmask(detail_mask);
                },
                error: function() {
                    Leaf.Masker.unmask(detail_mask);
                },
                scope: this
            });
        },function(){
            Leaf.Masker.unmask(detail_mask);

        })
186

Spencer Chang's avatar
Spencer Chang committed
187 188 189 190 191 192
        }

        function acr513_invoice_result_ds_submitsuccess(ds) {
            $('acr513_invoice_grid_id').clear();
        }

193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
        // function acr513_print_receipt() {
        //     var records = $('acr513_invoice_result_ds').getSelected();
        //     if (records.length != 1) {
        //         Leaf.showMessage('提示', '请选择一条数据');
        //         return;
        //     }
        //     if (records[0].get('invoice_kind') != 'RECEIPT') {
        //         Leaf.showMessage('提示', '发票种类不为收据,无法打印!');
        //         return;
        //     }
        //     var win = new Leaf.Window({
        //         id: 'receipt_print_winid',
        //         url: $('receipt_print_link').getUrl(),
        //         params: {
        //             invoice_hd_id: records[0].get('invoice_hd_id')
        //         },
        //         title: '收据打印',
        //         fullScreen: true
        //     });
        // }
Spencer Chang's avatar
Spencer Chang committed
213 214 215

        //hongquan.dai 20180125
        //保证金Word打印
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
        // function cash_deposit_print() {
        //
        //     var records = $('acr513_invoice_result_ds').getSelected();
        //     if (records.length != 1) {
        //         Leaf.showMessage('${l:PROMPT}', '请选择且仅选择一条保证金!');
        //         return;
        //     }
        //     var record = records[0];
        //
        //
        //     var invoice_hd_id = record.get('invoice_hd_id');
        //     var templt_name = 'csh_deposit_print.xml';
        //     if (invoice_hd_id) {
        //         Leaf.Masker.unmask(Ext.getBody()); //解锁
        //         var url = $('cash_deposit_printt_link').getUrl() + '?templt_name=' + templt_name + '&invoice_hd_id=' + invoice_hd_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();
        //     }
        //
        // }
Spencer Chang's avatar
Spencer Chang committed
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258


        ]]></script>
        <a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
        <a:dataSets>
            <a:dataSet id="acr513_business_type_ds">
                <a:datas dataSource="/model/acr513_business_type_list"/>
            </a:dataSet>
            <a:dataSet id="acr513_currency_ds">
                <a:datas dataSource="/model/acr513_currency_list"/>
            </a:dataSet>
            <a:dataSet id="acr513_invoice_kind_ds" lookupCode="ACR510_INVOICE_KIND"/>
            <a:dataSet id="acr513_invoice_statu_ds" lookupCode="ACR510_AR_INVOICE_STATUS"/>
            <a:dataSet id="acr513_express_status_ds" lookupCode="ACR518_EXPRESS_STATUS"/>
            <a:dataSet id="acr513_billing_way_ds" lookupCode="DS_INVOICE_CATEGORY"/>
            <a:dataSet id="acr513_invoice_query_ds" autoCreate="true">
                <a:fields>
259 260
                    <a:field name="invoice_status_desc" displayField="code_value_name" options="acr513_invoice_statu_ds"
                             returnField="invoice_status" valueField="code_value"/>
Spencer Chang's avatar
Spencer Chang committed
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
                    <a:field name="currency_name" displayField="currency_name" options="acr513_currency_ds"
                             returnField="currency" valueField="currency_code"/>
                    <a:field name="invoice_kind_desc" displayField="code_value_name" options="acr513_invoice_kind_ds"
                             returnField="invoice_kind" valueField="code_value"/>
                    <a:field name="invoice_status_desc" displayField="code_value_name" options="acr513_invoice_statu_ds"
                             returnField="invoice_status" valueField="code_value"/>
                    <!--<a:field name="business_type_desc" displayField="business_type_desc" options="acr513_business_type_ds" returnField="business_type" valueField="business_type"/>-->
                    <a:field name="billing_way_desc" displayField="code_value_name" options="acr513_billing_way_ds"
                             returnField="billing_way" valueField="code_value"/>
                    <a:field name="created_by_name" lovGridHeight="320" lovHeight="500"
                             lovService="acr.ACR512.acr_invoice_sys_user_lov" lovWidth="500" title="开票人选择">
                        <a:mapping>
                            <a:map from="user_id" to="created_by"/>
                            <a:map from="description" to="created_by_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="confirmed_by_name" lovGridHeight="320" lovHeight="500"
                             lovService="acr.ACR512.acr_invoice_sys_user_lov" lovWidth="500" title="复核人选择">
                        <a:mapping>
                            <a:map from="user_id" to="confirmed_by"/>
                            <a:map from="description" to="confirmed_by_name"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="invoice_bp_code_f" lovGridHeight="320" lovHeight="480"
                             lovService="acr.ACR512.acr_invoice_bp_master_list" lovWidth="500" title="客户选择">
                        <a:mapping>
                            <a:map from="bp_code" to="invoice_bp_code_f"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="invoice_bp_code_t" lovGridHeight="320" lovHeight="480"
                             lovService="acr.ACR512.acr_invoice_bp_master_list" lovWidth="500" title="客户选择">
                        <a:mapping>
                            <a:map from="bp_code" to="invoice_bp_code_t"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="project_number_f" lovGridHeight="320" lovHeight="480"
                             lovService="acr.ACR512.acr_invoice_project_list" lovWidth="500" title="项目选择">
                        <a:mapping>
                            <a:map from="project_number" to="project_number_f"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="project_number_t" lovGridHeight="320" lovHeight="480"
                             lovService="acr.ACR512.acr_invoice_project_list" lovWidth="500" title="项目选择">
                        <a:mapping>
                            <a:map from="project_number" to="project_number_t"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="contract_number_f" lovGridHeight="320" lovHeight="480"
                             lovService="acr.ACR512.acr_invoice_contract_list" lovWidth="500" title="合同选择">
                        <a:mapping>
                            <a:map from="contract_number" to="contract_number_f"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="contract_number_t" lovGridHeight="320" lovHeight="480"
                             lovService="acr.ACR512.acr_invoice_contract_list" lovWidth="500" title="合同选择">
                        <a:mapping>
                            <a:map from="contract_number" to="contract_number_t"/>
                        </a:mapping>
                    </a:field>
                    <a:field name="received_flag" checkedValue="Y" defaultValue="N" uncheckedValue="N"/>
                    <a:field name="express_status_desc" displayField="code_value_name"
                             options="acr513_express_status_ds" returnField="express_status" valueField="code_value"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="acr513_invoice_query_Onupdate"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="acr513_invoice_result_ds" autoPageSize="true" model="acr.ACR513.acr_invoice_confirm"
329
                       queryDataSet="acr513_invoice_query_ds" selectable="true" autoQuery="true">
Spencer Chang's avatar
Spencer Chang committed
330 331 332 333 334 335 336 337 338 339 340
                <a:events>
                    <a:event name="submitsuccess" handler="acr513_invoice_result_ds_submitsuccess"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:toolbarButton click="acr513_invoice_query" text="HLS.QUERY"/>
                <a:toolbarButton click="acr513_invoice_reset" text="HLS.RESET"/>
                <a:toolbarButton click="acr513_invoice_confirm" text="CONFIRM"/>
stone's avatar
stone committed
341 342
                <a:toolbarButton click="acr513_invoice_reject" text="审批拒绝"/>
                <!--<a:toolbarButton click="acr513_invoice_confirm" text="CONFIRM"/>-->
Spencer Chang's avatar
Spencer Chang committed
343 344 345 346 347 348 349 350 351 352 353
                <!-- <a:toolbarButton click="cash_deposit_print" text="保证金打印"/>-->
                <!-- <a:toolbarButton click="acr513_print_receipt" text="收据打印"/> -->
            </a:screenTopToolbar>
            <a:form marginWidth="30" padding="0" title="销项发票确认" column="5">

                <a:datePicker name="invoice_date_f" bindTarget="acr513_invoice_query_ds" prompt="ACR.INVOICE_DATE_FROM"
                              width="135"/>
                <a:datePicker name="invoice_date_t" bindTarget="acr513_invoice_query_ds" prompt="发票日期到" width="135"/>
                <a:lov name="contract_number_f" bindTarget="acr513_invoice_query_ds" prompt="HLS.CONTRACT_NUMBER_FROM"
                width="135"/>
                <a:lov name="contract_number_t" bindTarget="acr513_invoice_query_ds" prompt="合同编号到" width="135"/>
354 355
              <!--  <a:textField name="invoice_title" bindTarget="acr513_invoice_query_ds" prompt="ACR.INVOICE_TITLE"
                             width="135"/>-->
Spencer Chang's avatar
Spencer Chang committed
356
                <a:comboBox name="billing_way_desc" bindTarget="acr513_invoice_query_ds" prompt="开票方式" width="135"/>
357
                <a:lov name="created_by_name" bindTarget="acr513_invoice_query_ds" prompt="创建人"
Spencer Chang's avatar
Spencer Chang committed
358 359
                       width="135"/>

360
             <!--   <a:datePicker name="accounting_date_f" bindTarget="acr513_invoice_query_ds"
Spencer Chang's avatar
Spencer Chang committed
361
                              prompt="HLS.ACCOUNT_DATE_FROM" width="135"/>
362
                <a:datePicker name="accounting_date_t" bindTarget="acr513_invoice_query_ds" prompt="记账日期到" width="135"/>-->
Spencer Chang's avatar
Spencer Chang committed
363

364
            <!--    <a:numberField name="total_amount_f" bindTarget="acr513_invoice_query_ds" prompt="ACR.TOTAL_AMOUNT_FROM"
Spencer Chang's avatar
Spencer Chang committed
365
                               width="135"/>
366
                <a:numberField name="total_amount_t" bindTarget="acr513_invoice_query_ds" prompt="发票金额到" width="135"/>-->
Spencer Chang's avatar
Spencer Chang committed
367 368 369 370 371 372
                <a:comboBox name="invoice_kind_desc" bindTarget="acr513_invoice_query_ds" prompt="ACR.INVOICE_KIND"
                            width="135"/>
                <a:textField name="document_number_f" bindTarget="acr513_invoice_query_ds"
                             prompt="HLS.DOCUMENT_NUMBER_FROM" width="135"/>
                <a:textField name="document_number_t" bindTarget="acr513_invoice_query_ds" prompt="单据号到" width="135"/>
                <a:textField name="bp_agent_name"  bindTarget="acr513_invoice_query_ds" prompt="代理商" width="135"/>
373
                <a:comboBox name="invoice_status_desc"  bindTarget="acr513_invoice_query_ds" prompt="发票状态" width="135"/>
Spencer Chang's avatar
Spencer Chang committed
374
            </a:form>
375
            <a:grid id="acr513_invoice_grid_id" bindTarget="acr513_invoice_result_ds" marginHeight="225"
Spencer Chang's avatar
Spencer Chang committed
376 377
                    marginWidth="30" navBar="true">
                <a:columns>
lijingjing's avatar
lijingjing committed
378

Spencer Chang's avatar
Spencer Chang committed
379 380 381 382 383 384
                    <a:column name="document_number" lock="true" prompt="HLS.DOCUMENT_NUMBER"
                              renderer="acr513_document_number_render" width="120"/>
                    <a:column name="invoice_bp_name" autoAdjust="false" prompt="HLS.CUSTOMER_NAME" showTitle="true"
                              width="100"/>
                    <a:column name="contract_number" autoAdjust="false" prompt="HLS.CONTRACT_NUMBER" showTitle="true"
                              width="150"/>
385
                    <a:column name="contract_name" lock="true" width="150" prompt="合同名称"/>
Spencer Chang's avatar
Spencer Chang committed
386 387 388 389
                    <a:column name="bp_agent_name" prompt="代理商" width="100"/>
                    <!--<a:column name="business_type_desc" prompt="HLS.BUSINESS_TYPE_DESC" width="80"/>-->
                    <a:column name="billing_way_desc" prompt="开票方式" width="80"/>
                    <a:column name="invoice_kind_desc" prompt="ACR.INVOICE_KIND" width="100"/>
lijingjing's avatar
lijingjing committed
390
<!--
Spencer Chang's avatar
Spencer Chang committed
391
                    <a:column name="invoice_number" prompt="ACR.INVOICE_NUMBER" width="120"/>
lijingjing's avatar
lijingjing committed
392
-->
Spencer Chang's avatar
Spencer Chang committed
393 394 395 396 397 398 399 400
                    <a:column name="invoice_date" prompt="ACR.INVOICE_DATE" width="100"/>
                    <!-- <a:column name="project_name" autoAdjust="false" prompt="HLS.PROJECT_NAME" showTitle="true" width="150"/> -->
                    <!-- <a:column name="contract_number" prompt="HLS.CONTRACT_NUMBER" width="120"/> -->
                    <!-- <a:column name="bp_code" prompt="HLS.CUSTOMER_NUMBER" width="100"/> -->
                    <a:column name="invoice_title" autoAdjust="false" prompt="ACR.INVOICE_TITLE" showTitle="true"
                              width="150"/>
                    <!-- <a:column name="total_amount" align="right" prompt="ACR.TOTAL_AMOUNT" renderer="Leaf.formatMoney" width="100"/> -->
                    <!-- <a:column name="currency" prompt="HLS.CURRENCY" width="80"/> -->
401
                    <a:column name="created_by_name" autoAdjust="false" prompt="创建人" showTitle="true"
Spencer Chang's avatar
Spencer Chang committed
402 403
                              width="150"/>
                    <a:column name="invoice_status_desc" prompt="ACR.INVOICE_STATUS" width="100"/>
404
<!--                    <a:column name="accounting_date" prompt="HLS.ACCOUNT_DATE" width="100"/>-->
Spencer Chang's avatar
Spencer Chang committed
405 406 407 408 409 410
                    <!-- <a:column name="project_number" prompt="HLS.PROJECT_NUMBER" width="120"/> -->
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>