acr_invoice_vat.screen 23.9 KB
Newer Older
stone's avatar
stone committed
1 2 3 4 5 6 7
<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: LR  
    $Date: 2013-7-18 上午09:34:43  
    $Revision: 1.0  
    $Purpose: 
-->
8
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true">
stone's avatar
stone committed
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 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443
    <a:init-procedure>
        <a:model-query fetchAll="true" model="gld.gld_currency_vl" rootPath="acr515_currency_list"/>
        <a:model-query fetchAll="true" model="acr.ACR512.acr_invoice_business_type_list" rootPath="acr515_business_type_list"/>
    </a:init-procedure>
    <a:view>
        <a:link id="bmLink_vat_pause_or_submit" model="acr.ACR515.acr_invoice_vat" modelaction="batch_update"/>
        <a:link id="bmLink_vat_receive" model="acr.ACR515.acr_invoice_vat" modelaction="execute"/>
        <a:link id="acr515_update_post_link" url="${/request/@context_path}/modules/acr/ACR515/acr_invoice_insert_tmp.svc"/>
        <a:link id="acr515_interface_excel_link" url="${/request/@context_path}/modules/acr/ACR515/acr_invoice_interface_excel_sheets.svc"/>
        <a:link id="acr515_interface_network_link" url="${/request/@context_path}/modules/acr/ACR515/acr_invoice_interface_network_sheets.svc"/>
        <a:link id="acr515_interface_import_link" url="${/request/@context_path}/modules/acr/ACR515/hls_acr_vat_import_data.screen"/>
        <a:screen-include screen="modules/hls/hls_common_javascript.screen"/>
        <script><![CDATA[
            function acr515_invoice_query() {
                $('acr515_invoiceVatDs').query();
            }
            
            function acr515_invoice_refresh() {
                var ds = $('acr515_invoiceVatDs');
                ds.query(ds.currentPage);
            }
            
            function acr515_invoice_reset() {
                $('acr515_invoiceVatParaDs').reset();
            }
            
            function onUpdate_acr515_invoiceVatParaDs(ds, record, name, value, oldVlaue) {
                if (name == 'document_number_f') {
                    if (Aurora.isEmpty(record.get('document_number_t'))) {
                        record.set('document_number_t', value);
                    }
                } else if (name == 'project_number_f') {
                    if (Aurora.isEmpty(record.get('project_number_t'))) {
                        record.set('project_number_t', value);
                    }
                } else if (name == 'invoice_number_f') {
                    if (Aurora.isEmpty(record.get('invoice_number_t'))) {
                        record.set('invoice_number_t', value);
                    }
                } else if (name == 'contract_number_f') {
                    if (Aurora.isEmpty(record.get('contract_number_t'))) {
                        record.set('contract_number_t', value);
                    }
                } else if (name == 'invoice_bp_code_f') {
                    if (Aurora.isEmpty(record.get('invoice_bp_code_t'))) {
                        record.set('invoice_bp_code_t', value);
                    }
                } else if (name == 'total_amount_f') {
                    if (Aurora.isEmpty(record.get('total_amount_t'))) {
                        record.set('total_amount_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 onSubmitSuccess_acr515_invoiceVatDs(ds) {
                acr515_invoice_refresh();
            }
            
            function invoiceVat_submitHandle(datas) {
                Aurora.request({
                    url: $('bmLink_vat_pause_or_submit').getUrl(),
                    para: datas,
                    success: function(res) {
                        f_hls.winNoMask();
                        Aurora.SideBar.show({
                            msg: '${l:HLS.SUBMIT_SUCCESS}',
                            duration: 2000
                        });
                        acr515_invoice_refresh();
                    },
                    failure: function() {
                        f_hls.winNoMask();
                    },
                    error: function() {
                        f_hls.winNoMask();
                    },
                    scope: this
                });
            }
            
            function acr515_vat_receive() {
                Aurora.request({
                    url: $('bmLink_vat_receive').getUrl(),
                    para: {},
                    success: function(res) {
                        f_hls.winNoMask();
                        Aurora.SideBar.show({
                            msg: '${l:HLS.SUBMIT_SUCCESS}',
                            duration: 2000
                        });
                        acr515_invoice_refresh();
                    },
                    failure: function() {
                        f_hls.winNoMask();
                    },
                    error: function() {
                        f_hls.winNoMask();
                    },
                    scope: this
                });
            }
            
            
            
            function acr515_vat_create() {
                f_hls.winMask();
            
                var ds = $('acr515_invoiceVatDs');
                var records = ds.getSelected();
                if (records.length == 0) {
                    f_hls.winNoMask();
                    return;
                }
                var datas = [];
                for (var i = 0;i < records.length;i++) {
                    var obj = {};
                    obj['invoice_hd_id'] = records[i].get('invoice_hd_id');
                    obj['_status'] = 'insert';
                    datas[i] = obj;
                }
                invoiceVat_submitHandle(datas);
            }
            
            
            function acr515_vat_handle_pause(type) {
                f_hls.winMask();
            
                var ds = $('acr515_invoiceVatDs');
                var records = ds.getSelected();
                if (records.length == 0) {
                    f_hls.winNoMask();
                    return;
                }
                var datas = [];
                for (var i = 0;i < records.length;i++) {
                    var obj = {};
                    obj['invoice_hd_id'] = records[i].get('invoice_hd_id');
                    obj['type'] = type;
                    obj['_status'] = 'update';
                    datas[i] = obj;
                }
                invoiceVat_submitHandle(datas);
            }
            
            function acr515_vat_pause() {
                acr515_vat_handle_pause('PAUSE');
            }
            
            function acr515_vat_cancel_pause() {
                acr515_vat_handle_pause('CANCEL');
            }
            
            function acr515_vat_delete() {
                var ds = $('acr515_invoiceVatDs');
                var records = ds.getSelected();
                if (records.length == 0) {
                    return;
                }
                var datas = [];
                for (var i = 0;i < records.length;i++) {
                    var obj = {};
                    obj['invoice_hd_id'] = records[i].get('invoice_hd_id');
            
                    obj['_status'] = 'delete';
                    datas[i] = obj;
                }
                invoiceVat_submitHandle(datas);
            
            }
            
            function acr515_invoice_post() {
                debugger;
                var ds = $('acr515_invoiceVatDs');
                var records = ds.getSelected();
                if (records.length == 0) {
                    Aurora.showMessage('提示', '请选择要开票的数据');
                    return;
                }
                var param = {};
                var saveData = [];
                //var kind = $('acr515_invoiceVatParaDs').getAt(0).get('invoice_kind');
             
                // if (kind=='0') {  //如果是转票弹出 正常金税发票
                    // url = $('acr515_interface_excel_link').getUrl();
                // } else {//否则弹出电子发票
                    // url = $('acr515_interface_network_link').getUrl();
                // }
                var detail_mask = Ext.getBody();
                Aurora.Masker.mask(detail_mask, '${l:HLS.EXECUTING}');
                for (var i = 0;i < records.length;i++) {
                    saveData.push({
                        'invoice_hd_id': records[i].get('invoice_hd_id'),
                        '_status': 'insert'
                    });
                }
                param['details'] = saveData;
                Aurora.request({
                    url: $('acr515_update_post_link').getUrl(),
                    para: param,
                    success: function() {
                        Aurora.Masker.unmask(detail_mask);
                      var _url=$('acr515_interface_excel_link').getUrl();
                        window.open(_url);
                        ds.query();
                    },
                    failure: function() {
                        Aurora.Masker.unmask(detail_mask);
                    },
                    error: function() {
                        Aurora.Masker.unmask(detail_mask);
                    },
                    scope: this
                });
            }
            function acr515_invoice_import(){
                var kind = $('acr515_invoiceVatParaDs').getAt(0).get('invoice_kind');
    		    window.location.href = $('acr515_interface_import_link').getUrl()+'?kind='+kind;
    		}
    		function summaryRenderer(datas, name) {
        			var sum=0;
            		var sum1=0;
            		var sum2=0;
            		if(name=="invoice_title"){
            		    return '合计:<font color="red"></font>';
            		}
	        		if(name=="total_amount"){
	        			for(var i=0;i<datas.length;i++){
		            		var record=datas[i];
		            		var payment_amount_vl=record.get("total_amount");
		            		var payment_amount=parseFloat(payment_amount_vl);
		            		if(!isNaN(payment_amount)){
		            			sum+=payment_amount;
		            		}
            			}
		                return '<font color="red">' + Aurora.formatNumber(sum ,2)+ '</font>';
	        		}
	        		if(name=="tax_amount"){
	        			for(var j=0;j<datas.length;j++){
		            		var record1=datas[j];
		            		var payment_amount_vl1=record1.get("tax_amount");
		            		var payment_amount1=parseFloat(payment_amount_vl1);
		            		if(!isNaN(payment_amount1)){
		            			sum1+=payment_amount1;
		            		}
            			}
		                return '<font color="red">' + Aurora.formatNumber(sum1 ,2)+ '</font>';
	        		}
	        		if(name=="net_amount"){
	        			for(var k=0;k<datas.length;k++){
		            		var record2=datas[k];
		            		var payment_amount_vl2=record2.get("net_amount");
		            		var payment_amount2=parseFloat(payment_amount_vl2);
		            		if(!isNaN(payment_amount2)){
		            			sum2+=payment_amount2;
		            		}
            			}
		                return '<font color="red">' + Aurora.formatNumber(sum2 ,2)+ '</font>';
	        		}
            }
        ]]></script>
        <a:dataSets>
            <a:dataSet id="acr515_businessTypeDs">
                <a:datas dataSource="/model/acr515_business_type_list"/>
            </a:dataSet>
            <a:dataSet id="acr515_currencyDs">
                <a:datas dataSource="/model/acr515_currency_list"/>
            </a:dataSet>
            <a:dataSet id="acr515_invoiceKindDs" lookupCode="ACR510_INVOICE_KIND"/>
            <a:dataSet id="acr515_invoiceStatusDs" lookupCode="ACR510_AR_INVOICE_STATUS"/>
            <a:dataSet id="acr515_express_status_ds" lookupCode="ACR518_EXPRESS_STATUS"/>
            <a:dataSet id="acr515_vat_interface_status_ds" lookupCode="ACR515_VAT_INTERFACE_STATUS"/>
            <a:dataSet id="acr515_invoiceVatParaDs" autoCreate="true" model="acr.acr_invoice_hd_v">
                <a:fields>
                    <a:field name="currency_desc" displayField="currency_name" options="acr515_currencyDs" returnField="currency" valueField="currency_code"/>
                    <a:field name="invoice_kind" defaultValue="2"/>
                    <a:field name="invoice_kind_desc" defaultValue="普通发票" displayField="code_value_name" options="acr515_invoiceKindDs" required="true" returnField="invoice_kind" valueField="code_value"/>
                    <a:field name="invoice_status_desc" displayField="code_value_name" options="acr515_invoiceStatusDs" returnField="invoice_status" valueField="code_value"/>
                    <a:field name="vat_interface_status" defaultValue="UNTRANSFERED"/>
                    <a:field name="vat_interface_status_desc" defaultValue="未传金税" displayField="code_value_name" options="acr515_vat_interface_status_ds" returnField="vat_interface_status" valueField="code_value"/>
                    <a:field name="business_type_desc" displayField="business_type_desc" options="acr515_businessTypeDs" returnField="business_type" valueField="business_type"/>
                    <a:field name="created_by_name" lovGridHeight="320" lovHeight="500" lovService="acr.ACR512.acr_invoice_sys_user_lov" lovWidth="500" title="ACR.CREATED_BY_NAME">
                        <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="ACR.CONFIRMED_BY_NAME">
                        <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="ACR.INVOICE_BP_CODE">
                        <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="ACR.INVOICE_BP_CODE">
                        <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="HLS.PROJECT_NUMBER_FROM">
                        <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="HLS.PROJECT_NUMBER_FROM">
                        <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="HLS.CONTRACT_NUMBER_FROM">
                        <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="HLS.CONTRACT_NUMBER_FROM">
                        <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_name" displayField="code_value_name" options="acr515_express_status_ds" returnField="express_status" valueField="code_value"/>
                </a:fields>
                <a:events>
                    <a:event name="update" handler="onUpdate_acr515_invoiceVatParaDs"/>
                </a:events>
            </a:dataSet>
            <a:dataSet id="acr515_invoiceVatDs" autoPageSize="true" maxPageSize="10000" model="acr.acr_invoice_hd_v" queryDataSet="acr515_invoiceVatParaDs" selectable="true">
                <a:fields><![CDATA[
                ]]></a:fields>
                <a:events>
                    <a:event name="submitsuccess" handler="onSubmitSuccess_acr515_invoiceVatDs"/>
                </a:events>
            </a:dataSet>
        </a:dataSets>
        <a:screenBody>
            <a:screenTopToolbar>
                <a:screenTitle/>
                <a:gridButton click="acr515_invoice_query" text="HLS.QUERY"/>
                <a:gridButton click="acr515_invoice_reset" text="HLS.RESET"/>
                <a:gridButton click="acr515_invoice_post" text="开票"/>
                <a:gridButton click="acr515_invoice_import" text="导入开票结果"/>
                <!-- <a:gridButton click="acr515_vat_pause" text="暂挂"/>
                <a:gridButton click="acr515_vat_cancel_pause" text="取消暂挂"/>
                <a:gridButton click="acr515_vat_create" text="传入接口"/>
                <a:gridButton click="acr515_vat_delete" text="删除接口"/>
                <a:gridButton click="acr515_vat_receive" text="更新开票信息"/> -->
            </a:screenTopToolbar>
            <a:form column="1" marginWidth="30" padding="0">
                <a:hBox labelSeparator=" ">
                    <a:textField name="document_number_f" bindTarget="acr515_invoiceVatParaDs" prompt="HLS.DOCUMENT_NUMBER_FROM" width="135"/>
                    <div><![CDATA[${l:HLS.DOCUMENT_NUMBER_TO}]]></div>
                    <a:textField name="document_number_t" bindTarget="acr515_invoiceVatParaDs" prompt="" width="135"/>
                    <a:lov name="project_number_f" bindTarget="acr515_invoiceVatParaDs" prompt="HLS.PROJECT_NUMBER_FROM" width="135"/>
                    <div><![CDATA[${l:HLS.DOCUMENT_NUMBER_TO}]]></div>
                    <a:lov name="project_number_t" bindTarget="acr515_invoiceVatParaDs" prompt="" width="135"/>
                    <a:comboBox name="business_type_desc" bindTarget="acr515_invoiceVatParaDs" width="135"/>
                    <a:comboBox name="currency_desc" bindTarget="acr515_invoiceVatParaDs" width="135"/>
                </a:hBox>
                <a:hBox labelSeparator=" ">
                    <a:textField name="invoice_number_f" bindTarget="acr515_invoiceVatParaDs" prompt="ACR.INVOICE_NUMBER_FROM" width="135"/>
                    <div><![CDATA[${l:ACR.INVOICE_NUMBER_TO}]]></div>
                    <a:textField name="invoice_number_t" bindTarget="acr515_invoiceVatParaDs" prompt="" width="135"/>
                    <a:lov name="contract_number_f" bindTarget="acr515_invoiceVatParaDs" prompt="HLS.CONTRACT_NUMBER_FROM" width="135"/>
                    <div><![CDATA[${l:HLS.CONTRACT_NUMBER_TO}]]></div>
                    <a:lov name="contract_number_t" bindTarget="acr515_invoiceVatParaDs" prompt="" width="135"/>
                    <a:comboBox name="invoice_kind_desc" bindTarget="acr515_invoiceVatParaDs" width="135"/>
                    <a:lov name="created_by_name" bindTarget="acr515_invoiceVatParaDs" width="135"/>
                </a:hBox>
                <a:hBox labelSeparator=" ">
                    <a:datePicker name="invoice_date_f" bindTarget="acr515_invoiceVatParaDs" prompt="ACR.INVOICE_DATE_FROM" width="135"/>
                    <div><![CDATA[${l:ACR.INVOICE_DATE_TO}]]></div>
                    <a:datePicker name="invoice_date_t" bindTarget="acr515_invoiceVatParaDs" prompt="" width="135"/>
                    <a:lov name="invoice_bp_code_f" bindTarget="acr515_invoiceVatParaDs" prompt="HLS.CUSTOMER_NUMBER_FROM" width="135"/>
                    <div><![CDATA[${l:HLS.CUSTOMER_NUMBER_TO}]]></div>
                    <a:lov name="invoice_bp_code_t" bindTarget="acr515_invoiceVatParaDs" prompt="" width="135"/>
                    <a:textField name="invoice_title" bindTarget="acr515_invoiceVatParaDs" width="135"/>
                    <a:lov name="confirmed_by_name" bindTarget="acr515_invoiceVatParaDs" width="135"/>
                </a:hBox>
                <a:hBox labelSeparator=" ">
                    <a:datePicker name="accounting_date_f" bindTarget="acr515_invoiceVatParaDs" prompt="HLS.ACCOUNT_DATE_FROM" width="135"/>
                    <div><![CDATA[${l:HLS.ACCOUNT_DATE_TO}]]></div>
                    <a:datePicker name="accounting_date_t" bindTarget="acr515_invoiceVatParaDs" prompt="" width="135"/>
                    <a:numberField name="total_amount_f" allowFormat="true" bindTarget="acr515_invoiceVatParaDs" prompt="ACR.TOTAL_AMOUNT_FROM" width="135"/>
                    <div><![CDATA[${l:ACR.TOTAL_AMOUNT_TO}]]></div>
                    <a:numberField name="total_amount_t" allowFormat="true" bindTarget="acr515_invoiceVatParaDs" prompt="" width="135"/>
                    <a:comboBox name="invoice_status_desc" bindTarget="acr515_invoiceVatParaDs" width="135"/>
                    <a:comboBox name="vat_interface_status_desc" bindTarget="acr515_invoiceVatParaDs" width="135"/>
                </a:hBox>
            </a:form>
            <a:grid id="acr515_invoiceVatDs_grid" bindTarget="acr515_invoiceVatDs" marginHeight="240" marginWidth="30" navBar="true">
                <a:columns>
                    <a:column name="contract_number" width="120"/>
                    <a:column name="document_number" lock="true" width="120"/>
                    <a:column name="business_type_desc" width="80"/>
                    <a:column name="invoice_kind_desc" width="100"/>
                    <a:column name="invoice_number" width="120"/>
                    <a:column name="invoice_date" renderer="Aurora.formatDate" width="100"/>
                    <a:column name="invoice_bp_code" width="100"/>
                    <a:column name="invoice_bp_name" autoAdjust="false" showTitle="true" width="150"/>
                    <a:column name="invoice_title" autoAdjust="false" footerRenderer="summaryRenderer" showTitle="true" width="150"/>
                    <a:column name="total_amount" align="right" footerRenderer="summaryRenderer" renderer="Aurora.formatMoney" width="100"/>
                    <a:column name="tax_amount" align="right" footerRenderer="summaryRenderer" renderer="Aurora.formatMoney" width="100"/>
                    <a:column name="net_amount" align="right" footerRenderer="summaryRenderer" renderer="Aurora.formatMoney" width="100"/>
                    <a:column name="currency" width="80"/>
                    <a:column name="created_by_name" autoAdjust="false" showTitle="true" width="150"/>
                    <a:column name="confirmed_by_name" autoAdjust="false" showTitle="true" width="150"/>
                    <a:column name="invoice_status_desc" width="100"/>
                    <a:column name="vat_interface_status_desc" width="100"/>
                    <a:column name="accounting_date" renderer="Aurora.formatDate" width="100"/>
                    <!-- <a:column name="create_je_flag" width="60"/> -->
                </a:columns>
            </a:grid>
        </a:screenBody>
    </a:view>
</a:screen>