webservices.factory('vatImportService', ['$http', 'apiConfig', 'vatSessionService','FileSaver', function ($http, apiConfig, vatSessionService,FileSaver) { 'use strict'; return { sample: function () { return $http.get('url', apiConfig.createVat()); }, /************************************************input invoice*********************************************************/ importInputInvoiceData: function (inputInvoiceList, importType) { return $http.post('/inputInvoiceImport/importInputInvoice', { InputInvoiceList: inputInvoiceList, ImportType: importType }, apiConfig.createVat()); }, getInputInvoiceList: function (period) { return $http.get('/inputInvoiceImport/getInputInvoiceList/' + period, apiConfig.createVat()); }, deleteInputInvoiceDuplicateData: function (invoiceIDs) { return $http.post('/inputInvoiceImport/deleteDuplicateData', invoiceIDs, apiConfig.createVat()); }, validateInputInvoiceInfo: function (period) { return $http.get('/inputInvoiceImport/validateInputInvoiceInfo/' + period, apiConfig.createVat()); }, clearInputInvoiceData: function (period) { return $http.get('/inputInvoiceImport/clearInputInvoiceData/' + period, apiConfig.createVat()); }, /************************************************input invoice item*********************************************************/ importInputInvoiceItemData: function (inputInvoiceItemList, importType) { return $http.post('/inputInvoiceImport/importInputInvoiceItem', { InputInvoiceItemList: inputInvoiceItemList, ImportType: importType }, apiConfig.createVat()); }, getInputInvoiceItemList: function (period) { return $http.get('/inputInvoiceImport/getInputInvoiceItemList/' + period, apiConfig.createVat()); }, validateInputInvoiceItemInfo: function (period) { return $http.get('/inputInvoiceImport/validateInputInvoiceItemInfo/' + period, apiConfig.createVat()); }, clearInputInvoiceItemData: function (period) { return $http.get('/inputInvoiceImport/clearInputInvoiceItemData/' + period, apiConfig.createVat()); }, /************************************************journal entry*********************************************************/ importJournalEntryData: function (journalEntryList, importType) { return $http.post('/journalEntryImport/importJournalEntry', { VoucherList: journalEntryList, ImportType: importType }, apiConfig.createVat()); }, getValidationDtoInfo: function (type, period) { return $http.get('/journalEntryImport/getValidationInfo/' + type + '/' + period, apiConfig.createVat()); }, getJournalEntryData: function (period) { return $http.get('/journalEntryImport/getJournalEntryData/' + period, apiConfig.createVat()); }, queryJournalEntryData: function (queryDto) { return $http.post('/journalEntryImport/queryJournalEntryData', { PageInfo: queryDto.pageInfo, PeriodId: queryDto.periodId, }, apiConfig.createVat()); }, deleteAdjustAudit: function (deleteDto){ return $http.post('/journalEntryImport/deleteAdjustAudit', { ServiceTypeId: deleteDto.serviceTypeId, PeriodIds: deleteDto.periodIds }, apiConfig.createVat()); }, deleteJournalEntryData: function (voucherIDs) { return $http.post('/journalEntryImport/deleteDuplicateData', voucherIDs, apiConfig.createVat()); }, validateJournalEntryData: function (period) { return $http.get('/journalEntryImport/validateJournalEntryData/' + period, apiConfig.createVat()); }, clearJournalEntryData: function (period) { return $http.get('/journalEntryImport/clearJournalEntryData/' + period, apiConfig.createVat()); }, //auditAdjust ImportAuditAdjust: function (list, period, importType) { return $http.post('/journalEntryImport/importAuditAdjust/' + period, { VoucherList: list, ImportType: importType }, apiConfig.createVat()); }, GetAuditAdjust: function (period) { return $http.get('/journalEntryImport/getAuditAdjust/' + period, apiConfig.createVat()); }, queryAuditAdjust: function (queryDto) { return $http.post('/journalEntryImport/queryAuditAdjust', { PageInfo: queryDto.pageInfo, PeriodId: queryDto.periodId, }, apiConfig.createVat()); }, IsImportAuditAdjustOnly: function(projectId,periodId){ return $http.get('/journalEntryImport/isImportAuditAdjustOnly/' + projectId + '/' + periodId, apiConfig.createVat()); }, /************************************************Import output*********************************************************/ importOutputInvoiceData: function (outputInvoiceList, outputInvoiceItemList, importType) { return $http.post('/outputInvoiceImport/importOutputInvoice', { OutputInvoiceList: outputInvoiceList, OutputInvoiceItemList: outputInvoiceItemList, ImportType: importType }, apiConfig.createVat()); }, importOutputValidate: function (outputInvoiceList) { return $http.post('/outputInvoiceImport/importValidate', outputInvoiceList, apiConfig.createVat()); }, getOutputInvoiceList: function (period) { return $http.get('/outputInvoiceImport/getOutputInvoiceList' + '/' + period, apiConfig.createVat()); }, deleteOutputDupData: function (invoiceIDs) { return $http.post('/outputInvoiceImport/deleteOutputDuplicateData', invoiceIDs, apiConfig.createVat()); }, refreshOutputInvoice: function (period) { return $http.get('/outputInvoiceImport/refreshOutputInvoice/' + period, apiConfig.createVat()); }, clearOutputData: function (periodID) { return $http.get('/outputInvoiceImport/clearOutputData/' + periodID, apiConfig.createVat()); }, /************************************************Import Evidence*********************************************************/ getEvidenceList: function (param) { return $http.post('/outputInvoiceImport/getEvidenceList', { QueryType: param.queryType, QueryString: param.queryString, IsCurrentPeriod: param.isCurrentPeriod, PeriodId: param.periodId }, apiConfig.createVat()); }, deleteEvidences: function (evidencelist) { return $http.post('/outputInvoiceImport/deleteEvidences', evidencelist, apiConfig.createVat()); }, downloadEvidence: function (param) { return $http.post('/outputInvoiceImport/DownLoadEvidence', { filePath: param.filePath, fileName: param.fileName }, apiConfig.createVat({ responseType: 'arraybuffer' })); }, /************************************************Tb entry*********************************************************/ deleteTbData: function (periodID) { return $http.get('/DataImport/ClearTbData/' + periodID, apiConfig.createVat()); }, clearServiceTbData: function (dto){ return $http.post('/DataImport/ClearServiceTbData', { ServiceTypeId: dto.serviceTypeId, Periods: dto.periods, ProjectId: dto.projectId }, apiConfig.createVat()); }, clearErpData: function (periodId) { return $http.get('/financeImportData/clearErpTable/' + periodId, apiConfig.create()); }, updatePeriodStatus: function (queryImportDto) { return $http.post('/ProjectInfo/updatePeriodStatus', { serviceTypeId: queryImportDto.serviceTypeId, periods: queryImportDto.periods, projectId: queryImportDto.projectId, importTypeId: queryImportDto.importTypeId }, apiConfig.createVat()); }, //此处是vat系统,默认servcieType = 2 getImportType: function (projectID, periodID) { return $http.get('/ProjectInfo/getImportType/' + projectID + '/' + periodID + '/' + constant.serviceType.VAT, apiConfig.createVat()); }, getFileContent: function (tempFileName, selectedSheetIndex, topRowNumber) { return $http.get('/DataImport/FileContent/' + tempFileName + '/' + selectedSheetIndex + '/' + topRowNumber, apiConfig.createVat()); }, //getFileContentByDbName: function(tempFileName, selectedSheetIndex,topRowNumber){ // return $http.get('/DataImport/FileContent/' + tempFileName + '/' + selectedSheetIndex + '/' + topRowNumber, apiConfig.createVat({dbName:dbName})); //}, importBalanceList: function (balanceList, importType,serviceTypeId) { return $http.post('/DataImport/ImportBalance', { balanceList: balanceList, importType: importType, serviceTypeId: serviceTypeId }, apiConfig.createVat()); }, getBalanceList: function (period,projectId) { return $http.get('/DataImport/GetBalanceList/' + period + '/' + projectId, apiConfig.createVat()); }, queryTrialBalanceData: function(queryDto){ return $http.post('/DataImport/queryTrialBalanceData', { PageInfo: queryDto.pageInfo, PeriodId: queryDto.periodId, ProjectId: queryDto.projectId, ServiceTypeId: queryDto.serviceTypeId }, apiConfig.createVat()); }, deleteDuplicateTbData: function (balanceIds) { return $http.post('/DataImport/DeleteDuplicateTbData', balanceIds, apiConfig.createVat()); }, refreshTrialBalance: function (period,serviceTypeId) { return $http.get('/DataImport/RefreshTrialBalance/' + period + "/" + serviceTypeId, apiConfig.createVat()); }, refreshTrialBalancePeriods: function (queryDto) { return $http.post('/DataImport/RefreshTrialBalancePeriods', { Periods: queryDto.periods, ServiceTypeId: queryDto.serviceTypeId }, apiConfig.createVat()); }, getValidationList: function (type, period) { return $http.get('/DataImport/GetValidationList/' + type + '/' + period, apiConfig.createVat()); }, getServiceValidationList : function (type, period, serviceTypeId, projectId){ return $http.get('/DataImport/GetServiceValidationList/' + type + '/' + period + '/' + serviceTypeId + '/' + projectId, apiConfig.createVat()); }, getTBImportedPeriods: function (projectId, serviceTypeId) { return $http.get("/DataImport/getTBImportedPeriods/" + projectId + '/' + serviceTypeId, apiConfig.createVat()); }, isImportData: function (projectId, importTypeId) { return $http.get('/ProjectInfo/isProjectImportedData/' + projectId + '/' + importTypeId, apiConfig.createVat()); }, getProjectImportType: function (queryImportType) { return $http.post('/ProjectInfo/getProjectImportType', { serviceTypeId: queryImportType.serviceTypeId, periods: queryImportType.periods, projectId: queryImportType.projectId }, apiConfig.createVat()); }, clearTableByPeriods: function (periods) { return $http.post("/DataImport/clearTableByPeriods", { periods: periods }, apiConfig.createVat()); }, getAdjustAuditPeriods: function () { return $http.get("/journalEntryImport/getAdjustAuditPeriods", apiConfig.createVat()); }, validateJournalEntryByPeriods: function () { return $http.get("/journalEntryImport/validateJournalEntryByPeriods", apiConfig.createVat()); }, /****************************************************************************************************/ /* Tony's Beatup services */ getBalanceDataForDisplay: function (category, fromPeriod, toPeriod, criteria, orgId) { return $http.post('/DataImport/GetBalanceDataForDisplay', { category: category, fromPeriod: fromPeriod, toPeriod: toPeriod, criteria: criteria, orgId: orgId }, apiConfig.createVat()); // return $http.get('/DataImport/GetBalanceDataForDisplay?category=' + category + '&fromPeriod=' + fromPeriod + '&toPeriod=' + toPeriod + '&criteria=' + criteria, apiConfig.createVat()); }, queryGlBalance: function (fromPeriod, toPeriod, orgId) { return $http.post('/DataImport/queryGlBalance', { fromPeriod: fromPeriod, toPeriod: toPeriod, orgId: orgId }, apiConfig.createVat()); }, updateACustomPrice: function (customId, invoiceAmount) { return $http.get('/CustomsInvoice/UpdateACustomPrice?customId=' + customId + '&invoiceAmount=' + invoiceAmount, apiConfig.createVat()); }, getCustomsInvoiceDataForDisplay: function (fromPeriod, toPeriod, criteria, pagination) { return $http.get('/CustomsInvoice/GetCustomsInvoiceDataForDisplay?fromPeriod=' + fromPeriod + '&toPeriod=' + toPeriod + '&criteria=' + criteria + '&pagination=' + pagination, apiConfig.createVat()); }, getExportCustomInvoiceList: function (criteria) { return $http.post('/CustomsInvoice/ExportQueryData/get?criteria=' + criteria, {},apiConfig.createVat({ responseType: 'arraybuffer' })); }, getParentCodesForDisplay: function (category) { return $http.get('/DataImport/GetParentCodesForDisplay?category=' + category , apiConfig.createVat()); }, /* workflow */ getVoucherList: function (param) { return $http.post('/outputInvoiceImport/getVoucherList', { QueryType: param.queryType, QueryString: param.queryString, IsCurrentPeriod: param.isCurrentPeriod, PeriodId: param.periodId }, apiConfig.createVat()); }, updateEvidencesComments: function (commentsWithFileId) { return $http.post('/outputInvoiceImport/updateEvidencesComments', commentsWithFileId, apiConfig.createVat()); }, getJePeriods: function () { return $http.get("/journalEntryImport/getJePeriods", apiConfig.createVat()); }, /************************************************Mappings*********************************************************/ SaveVourcherMappings: function (list, period, isAddition) { return $http.post('/vimapping/savevmappings' + '/' + period + '/' + isAddition, list, apiConfig.createVat()); }, GetVourcherMappings: function (period) { return $http.get('/vimapping/getvmappings' + '/' + period, apiConfig.createVat()); }, SaveInvoiceMappings: function (list, period, isAddition) { return $http.post('/vimapping/saveimappings' + '/' + period + '/' + isAddition, list, apiConfig.createVat()); }, GetInvoiceMappings: function (period) { return $http.get('/vimapping/getimappings' + '/' + period, apiConfig.createVat()); }, deleteVourcherMappings: function (ids) { return $http.post('/vimapping/deletevmappings', ids, apiConfig.createVat()); }, validDBVoucherMapping: function (period) { return $http.post('/vimapping/validvmappings/' + '/' + period, null, apiConfig.createVat()); }, deleteInvoiceMappings: function (ids) { return $http.post('/vimapping/deleteimappings', ids, apiConfig.createVat()); }, validDBInvoiceMapping: function (period) { return $http.post('/vimapping/validimappings/' + '/' + period, null, apiConfig.createVat()); }, /************************************************CustomsInvoice*********************************************************/ importCustomsInvoiceList: function (custList, importType) { return $http.post('/CustomsInvoice/ImportCustomsInvoice', { customsList: custList, importType: importType }, apiConfig.createVat()); }, getCustomsInvoiceList: function () { return $http.get('/CustomsInvoice/GetCustomsInvoices', apiConfig.createVat()); }, getCustomsInvoicesByPeriodId: function (periodId) { return $http.get('/CustomsInvoice/GetCustomsInvoicesByPeriodId/' + periodId, apiConfig.createVat()); }, deleteCustomsInvoicesByPeriodId: function (periodId) { return $http.get('/CustomsInvoice/DeleteCustomsInvoices/' + periodId, apiConfig.createVat()); }, getCustomsInvoicesValidates: function (periodId) { return $http.get('/CustomsInvoice/getCustomsInvoicesValidates/' + periodId, apiConfig.createVat()); }, getPayNumDuplicateDetails: function () { return $http.get('/CustomsInvoice/getPayNumDuplicateDetails', apiConfig.createVat()); }, deleteCustomInvoiceByIds: function (customsIds) { return $http.post('/CustomsInvoice/deleteCustomInvoiceByIds',customsIds,apiConfig.createVat()); }, updateCustomsInvoiceValidation: function (periodId) { return $http.get('/CustomsInvoice/updateCustomsInvoiceValidation/'+ periodId,apiConfig.createVat()); }, /************************************************CustomsInvoice*********************************************************/ /***************************************批量数据导入服务 start**************************************************************/ getAllTables: function (serviceType) { return $http.get('/DataImport/getAllTables/' + serviceType, apiConfig.createVat()); }, getTableInfoList: function (serviceType, orgID) { return $http.get('/DataImport/getTableInfoList/' + serviceType + '/' + orgID, apiConfig.createVat()); }, getMappedList: function (tableInfoId, orgID) { return $http.get('/DataImport/getMappedList/' + tableInfoId + '/' + orgID, apiConfig.createVat()); }, getTableMenuList: function () { return $http.get('/DataImport/getTableMenuList', apiConfig.createVat()); }, getTempFileContent: function (tempFileName, selectedSheetIndex, topRowNumber) { return $http.get('/DataImport/TempFileContent/' + tempFileName + '/' + selectedSheetIndex + '/' + topRowNumber, apiConfig.createVat()); }, importData: function (importDto) { return $http.post('/DataImport/importData', importDto, apiConfig.createVat()); }, GetDataFromExcelByChunk: function (ChunkDto) { return $http.post('/DataImport/getDataFromExcelByChunk', ChunkDto, apiConfig.createVat()); }, GetDataFromExcelByChunkByBack: function (ChunkDto) { return $http.post('/DataImport/getDataFromExcelByChunkByBack', ChunkDto, apiConfig.createVat()); }, getImportedData: function (queryDto) { return $http.post('/DataImport/getImportedData', queryDto, apiConfig.createVat()); }, getFilterImportedData: function (queryDto) { return $http.post('/DataImport/getFilterImportedData', queryDto, apiConfig.createVat()); }, getSelectedFilterImportedData: function (queryDto) { return $http.post('/DataImport/getSelectedFilterImportedData', queryDto, apiConfig.createVat()); }, getPeriodList: function (tableInfoId) { return $http.get('/DataImport/getPeriodList/' + tableInfoId, apiConfig.createVat()); }, deleteDataByPeriod: function (period, tableInfoId) { return $http.get('/DataImport/deleteDataByPeriod/' + period + '/' + tableInfoId, apiConfig.createVat()); }, /***************************************批量数据导入服务 end**************************************************************/ /***************************************批量数据导入服务(真) start**************************************************************/ displayImportLog: function (pageInfo, type) { return $http.post('/DataImport/displayImportLog', {pageInfo: pageInfo, type: type}, apiConfig.create()); }, displayImportLogAll: function (param) { return $http.post('/DataImport/displayImportLogAll', param, apiConfig.create()); }, displayProcessLog: function (queryParams) { return $http.post('/DataImport/displayProcessLog', queryParams, apiConfig.create()); }, displayAnalysisImportData: function (param) { return $http.post('/Analysis/displayAnalysisImportData' , param ,apiConfig.create()); }, displayAnalysisInternationalImportData: function (param) { return $http.post('/Analysis/displayAnalysisInternationalImportData',param,apiConfig.create()); }, getAnalysisInternationalCompanyList: function (type,period) { return $http.get('/Analysis/getAnalysisInternationalCompanyList?type=' + type + '&period=' + period, apiConfig.create()); }, getAnalysisInternationalCountryList: function (type,period) { return $http.get('/Analysis/getAnalysisInternationalCountryList?type=' + type + '&period=' + period, apiConfig.create()); }, downloadDomesticFile: function (queryParm, fileName) { var thisConfig = apiConfig.create(); thisConfig.responseType = "arraybuffer"; return $http.post('/Analysis/downloadDomesticFile/get', queryParm, thisConfig).then(function (response) { var data = new Blob([response.data], {type: response.headers('Content-Type')}); FileSaver.saveAs(data, fileName + '.xlsx'); }); }, downloadInternationalFile: function (queryParm, fileName) { var thisConfig = apiConfig.create(); thisConfig.responseType = "arraybuffer"; return $http.post('/Analysis/downloadInternationalFile/get', queryParm, thisConfig).then(function (response) { var data = new Blob([response.data], {type: response.headers('Content-Type')}); FileSaver.saveAs(data, fileName + '.xlsx'); }); } /***************************************批量数据导入服务(真) end**************************************************************/ }; }]);