Commit 6e3260ed authored by chase's avatar chase

Merge branch 'dev_mysql' of http://code.tech.tax.asia.pwcinternal.com/root/atms into dev_mysql

parents af74bb1e 839e2e84
...@@ -235,6 +235,13 @@ public class ReportController { ...@@ -235,6 +235,13 @@ public class ReportController {
return operationResultDto; return operationResultDto;
} }
/**
* 获取模板的report,通过reportid可以获取模板数据
* @param templateId
* @param period
* @param orgId
* @return
*/
@RequestMapping(value = "getReportByTemplateEbit/{templateId}/{period}/{orgId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "getReportByTemplateEbit/{templateId}/{period}/{orgId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<PeriodReportDto> getReportByTemplateEbit(@PathVariable String templateId, @PathVariable Integer period, @PathVariable String orgId) { public OperationResultDto<PeriodReportDto> getReportByTemplateEbit(@PathVariable String templateId, @PathVariable Integer period, @PathVariable String orgId) {
OperationResultDto resultDto = new OperationResultDto(); OperationResultDto resultDto = new OperationResultDto();
...@@ -253,7 +260,6 @@ public class ReportController { ...@@ -253,7 +260,6 @@ public class ReportController {
@RequestMapping("manyExport") @RequestMapping("manyExport")
public OperationResultDto manyExport(@RequestBody RequestParameterDto requestParameterDto){ public OperationResultDto manyExport(@RequestBody RequestParameterDto requestParameterDto){
OperationResultDto operationResultDto = new OperationResultDto(); OperationResultDto operationResultDto = new OperationResultDto();
operationResultDto.setResult(null); operationResultDto.setResult(null);
return operationResultDto; return operationResultDto;
} }
......
...@@ -149,8 +149,7 @@ public class TemplateGroupController { ...@@ -149,8 +149,7 @@ public class TemplateGroupController {
@RequestParam("orgId") String orgId, @RequestParam("orgId") String orgId,
@RequestParam("period") Integer period) { @RequestParam("period") Integer period) {
try { try {
templateGroupService.ebitTemplateImport(file, orgId,period); return templateGroupService.ebitTemplateImport(file, orgId,period);
return OperationResultDto.success();
} catch (ServiceException e) { } catch (ServiceException e) {
return OperationResultDto.error(e.getMessage()); return OperationResultDto.error(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
......
...@@ -938,6 +938,7 @@ public class DataImportService extends BaseService { ...@@ -938,6 +938,7 @@ public class DataImportService extends BaseService {
public OperationResultDto importRLITExcelFile(MultipartFile file,List<String> orgIds, String periodDate, Integer importType) throws ServiceException{ public OperationResultDto importRLITExcelFile(MultipartFile file,List<String> orgIds, String periodDate, Integer importType) throws ServiceException{
try { try {
OperationResultDto operationResultDto = new OperationResultDto();
InputStream inputStream = file.getInputStream(); InputStream inputStream = file.getInputStream();
Workbook workbook = WorkbookFactory.create(inputStream); Workbook workbook = WorkbookFactory.create(inputStream);
if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) { if (StringUtils.isBlank(periodDate) || "null".equals(periodDate)) {
...@@ -960,16 +961,14 @@ public class DataImportService extends BaseService { ...@@ -960,16 +961,14 @@ public class DataImportService extends BaseService {
if (isSuccess < 1) { if (isSuccess < 1) {
return OperationResultDto.error(ErrorMessage.ImportFailed); return OperationResultDto.error(ErrorMessage.ImportFailed);
} }
return OperationResultDto.success(); return operationResultDto.success();
} catch (ServiceException e) {
throw e;
} catch (Exception e) { } catch (Exception e) {
logger.error("importRLITExcelFile error.", e); e.printStackTrace();
throw new ServiceException(ErrorMessage.SystemError); return OperationResultDto.error(e.getMessage());
} }
} }
private void processRlits(String companyCode, List<RedLetterInfoTable> rlits,List<String> orgIds, private void processRlits(String companyCode, List<RedLetterInfoTable> rlits, List<String> orgIds,
Integer tmsPeriod, Integer importType,List<DataImportLog> dataImportLogs ) { Integer tmsPeriod, Integer importType,List<DataImportLog> dataImportLogs ) {
OrganizationExample organizationExample = new OrganizationExample(); OrganizationExample organizationExample = new OrganizationExample();
organizationExample.createCriteria().andCodeEqualTo(companyCode); organizationExample.createCriteria().andCodeEqualTo(companyCode);
...@@ -1014,16 +1013,18 @@ public class DataImportService extends BaseService { ...@@ -1014,16 +1013,18 @@ public class DataImportService extends BaseService {
boolean validateRes = true; boolean validateRes = true;
for (RedLetterInfoTable rlit : rlits) { for (RedLetterInfoTable rlit : rlits) {
// 校验该主体导入所有记录区间是否一致 // 校验该主体导入所有记录区间是否一致
if (!rlit.getFillInDate().equals(period)) { if (!rlit.getPeriod().equals(period)) {
dataImportLog.setImportResult(false); dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.InconsistentPeriod); dataImportLog.setErrorMsg(ErrorMessageCN.InconsistentPeriod);
validateRes = false; validateRes = false;
new Exception(ErrorMessageCN.InconsistentPeriod);
break; break;
} }
if (!rlit.getFillInDate().equals(tmsPeriod)) { if (!rlit.getPeriod().equals(tmsPeriod)) {
dataImportLog.setImportResult(false); dataImportLog.setImportResult(false);
dataImportLog.setErrorMsg(ErrorMessageCN.ExistDataPeriodsError); dataImportLog.setErrorMsg(ErrorMessageCN.ExistDataPeriodsError);
validateRes = false; validateRes = false;
new Exception(ErrorMessageCN.ExistDataPeriodsError);
break; break;
} }
rlit.setOrganizationId(orgId); rlit.setOrganizationId(orgId);
......
...@@ -230,15 +230,19 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -230,15 +230,19 @@ public class TemplateGroupServiceImpl extends AbstractService {
ebitCellDataMapper.deleteByExample(example); ebitCellDataMapper.deleteByExample(example);
} }
for (int j = 1; j <= sheet.getRow(0).getLastCellNum(); j++) { for (int j = 1; j <= sheet.getRow(0).getLastCellNum(); j++) {
for (int m = 1; j < sheet.getLastRowNum(); j++) { for (int m = 1; m <= sheet.getLastRowNum(); m++) {
if (j == 1 || j == 2) { if (j == 1 || j == 2) {
EbitCellData ebitCellData = new EbitCellData(); EbitCellData ebitCellData = new EbitCellData();
ebitCellData.setId(idService.nextId()); ebitCellData.setId(idService.nextId());
ebitCellData.setCol(j); ebitCellData.setCol(j);
ebitCellData.setRow(m); ebitCellData.setRow(m);
ebitCellData.setCreateTime(now); ebitCellData.setCreateTime(now);
if(sheet.getRow(m).getCell(j) != null) try {
ebitCellData.setData(sheet.getRow(m).getCell(j).getStringCellValue()); if(sheet.getRow(m).getCell(j) != null)
ebitCellData.setData(sheet.getRow(m).getCell(j).getStringCellValue());
}catch (Exception e){
//遇到空行,略过
}
ebitCellData.setTemplateId(String.valueOf(idService.nextId())); ebitCellData.setTemplateId(String.valueOf(idService.nextId()));
ebitCellData.setProjectId(projectId); ebitCellData.setProjectId(projectId);
ebitCellData.setOrganizationId(orgId); ebitCellData.setOrganizationId(orgId);
...@@ -249,13 +253,11 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -249,13 +253,11 @@ public class TemplateGroupServiceImpl extends AbstractService {
} }
ebitCellDataMapper.insertBatch(list); ebitCellDataMapper.insertBatch(list);
} }
return operationResultDto.success();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
operationResultDto.success(e.getMessage()); return operationResultDto.error(e.getMessage());
} }
operationResultDto.success();
return operationResultDto;
} }
public class TemplateGroupMessage { public class TemplateGroupMessage {
......
...@@ -20,10 +20,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -20,10 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.CommonUtils; import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.POIUtil; import pwc.taxtech.atms.common.POIUtil;
import pwc.taxtech.atms.common.message.ErrorMessage; import pwc.taxtech.atms.common.message.ErrorMessage;
import pwc.taxtech.atms.common.util.DataUtil; import pwc.taxtech.atms.common.util.*;
import pwc.taxtech.atms.common.util.FileUploadUtil;
import pwc.taxtech.atms.common.util.MyAsserts;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant; import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.*; import pwc.taxtech.atms.constant.enums.*;
import pwc.taxtech.atms.dao.*; import pwc.taxtech.atms.dao.*;
...@@ -138,6 +135,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -138,6 +135,7 @@ public class ReportServiceImpl extends BaseService {
TrialBalanceFinalMapper trialBalanceFinalMapper; TrialBalanceFinalMapper trialBalanceFinalMapper;
@Autowired @Autowired
FormulaAgent agent; FormulaAgent agent;
public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) { public OperationResultDto<List<ReportDto>> getFilterReportTemplate(String projectId, EnumServiceType serviceType, Integer periodParam) {
OperationResultDto<List<ReportDto>> result = new OperationResultDto<>(); OperationResultDto<List<ReportDto>> result = new OperationResultDto<>();
CommonUtils.copyProperties(getReportTemplate(projectId, serviceType, periodParam), result); CommonUtils.copyProperties(getReportTemplate(projectId, serviceType, periodParam), result);
...@@ -303,19 +301,20 @@ public class ReportServiceImpl extends BaseService { ...@@ -303,19 +301,20 @@ public class ReportServiceImpl extends BaseService {
//根据收入类型映射生成开票记录关联数据 //根据收入类型映射生成开票记录关联数据
assembleInvoiceRecord(projectId, period); assembleInvoiceRecord(projectId, period);
//生成trial_balance_final数据 //生成trial_balance_final数据
assembleTrialBalanceFinal(projectId,period); assembleTrialBalanceFinal(projectId, period);
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData); clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
copyTemplateAndConfigFromAdmin(projectId, templates, period); copyTemplateAndConfigFromAdmin(projectId, templates, period);
setStatus(job, STATUS_END); setStatus(job, STATUS_END);
periodJobMapper.updateByPrimaryKey(job); periodJobMapper.updateByPrimaryKey(job);
} }
public void assembleTrialBalanceFinal(String projectId,Integer period){
public void assembleTrialBalanceFinal(String projectId, Integer period) {
Project project = projectMapper.selectByPrimaryKey(projectId); Project project = projectMapper.selectByPrimaryKey(projectId);
MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION); MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION);
String queryPeriod = project.getYear()+""+(period<10?("0"+period):(period+"")); String queryPeriod = project.getYear() + "" + (period < 10 ? ("0" + period) : (period + ""));
Project lastProject = agent.getFixedProject(projectId, project.getYear()); Project lastProject = agent.getFixedProject(projectId, project.getYear());
String lastPeriod = "0"; String lastPeriod = "0";
if(lastProject!=null) { if (lastProject != null) {
if (project.getId().equals(lastProject.getId())) { if (project.getId().equals(lastProject.getId())) {
lastPeriod = project.getYear() + "" + (period - 1 < 10 ? ("0" + (period - 1)) : ((period - 1) + "")); lastPeriod = project.getYear() + "" + (period - 1 < 10 ? ("0" + (period - 1)) : ((period - 1) + ""));
} else { } else {
...@@ -325,10 +324,11 @@ public class ReportServiceImpl extends BaseService { ...@@ -325,10 +324,11 @@ public class ReportServiceImpl extends BaseService {
TrialBalanceFinalExample example = new TrialBalanceFinalExample(); TrialBalanceFinalExample example = new TrialBalanceFinalExample();
example.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(Integer.valueOf(queryPeriod)); example.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(Integer.valueOf(queryPeriod));
trialBalanceFinalMapper.deleteByExample(example); trialBalanceFinalMapper.deleteByExample(example);
trialBalanceFinalMapper.generateFinalData(projectId,Integer.valueOf(queryPeriod),lastProject==null?"0":lastProject.getId(),Integer.valueOf(lastPeriod)); trialBalanceFinalMapper.generateFinalData(projectId, Integer.valueOf(queryPeriod), lastProject == null ? "0" : lastProject.getId(), Integer.valueOf(lastPeriod));
} }
public void assembleInvoiceRecord(String projectId,Integer period){
Project project = projectMapper.selectByPrimaryKey(projectId); public void assembleInvoiceRecord(String projectId, Integer period) {
Project project = projectMapper.selectByPrimaryKey(projectId);
MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION); MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION);
String queryDate = project.getYear() + "-" + (period < 10 ? ("0" + period) : (period + "")); String queryDate = project.getYear() + "-" + (period < 10 ? ("0" + period) : (period + ""));
RevenueTypeMappingExample mappingExample = new RevenueTypeMappingExample(); RevenueTypeMappingExample mappingExample = new RevenueTypeMappingExample();
...@@ -1092,40 +1092,52 @@ public class ReportServiceImpl extends BaseService { ...@@ -1092,40 +1092,52 @@ public class ReportServiceImpl extends BaseService {
return ""; return "";
} }
private static final Integer specialConsideration = 0;//特殊因素考虑
private static final String ebitRate = "1%";//ebit 比率
public List<CellTemplateReferenceDto> getTemplateReferences(int period) { public List<CellTemplateReferenceDto> getTemplateReferences(int period) {
return new ArrayList<>(); return new ArrayList<>();
} }
public OperationResultDto<ReportDataDto> getCellData(Long reportId, String orgId, Integer period) { public OperationResultDto<ReportDataDto> getCellData(Long reportId, String orgId, Integer period) {
orgId="5bbd739c-1a13-4b0f-aba6-32ba41e4de69"; OperationResultDto<ReportDataDto> operationResultDto = new OperationResultDto<>();
OperationResultDto<ReportDataDto> cellData = getCellData(reportId, getProjId(orgId, period)); OperationResultDto<ReportDataDto> operationResultDto1 = loadEbitDataFirst(orgId, period, operationResultDto);//从数据库中加载ebit数据
EbitDataDto ebitDataDto = loadEbitDataFirst(orgId, period); if (operationResultDto1.getData().getEbitData() != null && operationResultDto1.getData().getCellData() != null) {
if (ebitDataDto != null) { return operationResultDto1;
cellData.getData().setEbitData(ebitDataDto); } else if (operationResultDto1.getData().getEbitData() == null && operationResultDto1.getData().getCellData() == null) {
}else{ OperationResultDto<ReportDataDto> cellData = getCellData(reportId, getProjId(orgId, period));
ReportDataDto reportDataDto = new ReportDataDto();
//特殊因素考虑 默认为0 rate 默认为1% //特殊因素考虑 默认为0 rate 默认为1%
EbitDataDto ebitDataDto1 = loadEbitData(orgId, period, 0, "1%"); EbitDataDto ebitDataDto1 = loadEbitData(orgId, period, specialConsideration, ebitRate);
if(ebitDataDto1 !=null) if (cellData.getData() != null) {
if(cellData.getData() != null){ cellData.getData().setEbitData(ebitDataDto1);
cellData.getData().setEbitData(ebitDataDto1); } else {
}else{ reportDataDto.setEbitData(ebitDataDto1);
ReportDataDto reportDataDto = new ReportDataDto(); return cellData;
reportDataDto.setEbitData(ebitDataDto1); }
cellData.setData(reportDataDto); } else if (operationResultDto1.getData().getEbitData() == null && operationResultDto1.getData().getCellData() != null) {
return cellData; EbitDataDto ebitDataDto1 = loadEbitData(orgId, period, specialConsideration, ebitRate);
} operationResultDto1.getData().setEbitData(ebitDataDto1);
} else {
OperationResultDto<ReportDataDto> cellData = getCellData(reportId, getProjId(orgId, period));
operationResultDto1.getData().setCellData(cellData.getData().getCellData());
} }
return cellData; return operationResultDto1;
} }
public EbitDataDto loadEbitDataFirst(String orgId, Integer period) { public OperationResultDto loadEbitDataFirst(String orgId, Integer period, OperationResultDto operationResultDto) {
EbitDataDto ebitDataDto = new EbitDataDto(); EbitDataDto ebitDataDto = new EbitDataDto();
EbitCellDataExample example = new EbitCellDataExample(); EbitCellDataExample example = new EbitCellDataExample();
EbitCellDataExample.Criteria criteria = example.createCriteria(); EbitCellDataExample.Criteria criteria = example.createCriteria();
criteria.andOrganizationIdEqualTo(orgId); criteria.andOrganizationIdEqualTo(orgId);
ReportDataDto reportDataDto = new ReportDataDto();
criteria.andPeriodEqualTo(period); criteria.andPeriodEqualTo(period);
List<EbitCellData> ebitCellData = ebitCellDataMapper.selectByExample(example); List<EbitCellData> ebitCellData = ebitCellDataMapper.selectByExample(example);
ArrayList<CellDataDto> listCelldatas = Lists.newArrayList();
if (ebitCellData.size() == 0)
return null;
boolean bool = false; boolean bool = false;
boolean boo2 = false;
for (EbitCellData ebitCellData1 : ebitCellData) { for (EbitCellData ebitCellData1 : ebitCellData) {
bool = true; bool = true;
switch (ebitCellData1.getRow()) { switch (ebitCellData1.getRow()) {
...@@ -1164,11 +1176,28 @@ public class ReportServiceImpl extends BaseService { ...@@ -1164,11 +1176,28 @@ public class ReportServiceImpl extends BaseService {
break; break;
ebitDataDto.setTotalAmountTax(new BigDecimal(ebitCellData1.getData())); ebitDataDto.setTotalAmountTax(new BigDecimal(ebitCellData1.getData()));
break; break;
default:
if (ebitCellData1.getRow() < 37) {
if (!boo2)
boo2 = true;
CellDataDto cellData = new CellDataDto();
cellData.setColumnIndex(ebitCellData1.getCol());
cellData.setRowIndex(ebitCellData1.getRow());
cellData.setCellValue(ebitCellData1.getData());
listCelldatas.add(cellData);
}
} }
} }
reportDataDto.setCellData(listCelldatas);
reportDataDto.setEbitData(ebitDataDto);
if (!bool) if (!bool)
return null; reportDataDto.setEbitData(null);
return ebitDataDto; if (!boo2)
reportDataDto.setCellData(null);
operationResultDto.setData(reportDataDto);
return operationResultDto;
} }
public OperationResultDto<ReportDataDto> getCellData(Long reportId, String projectId) { public OperationResultDto<ReportDataDto> getCellData(Long reportId, String projectId) {
...@@ -1445,10 +1474,8 @@ public class ReportServiceImpl extends BaseService { ...@@ -1445,10 +1474,8 @@ public class ReportServiceImpl extends BaseService {
ebitDataDto.setTransactionAmount(ebitDataDto.getSpecialFactors().multiply(new BigDecimal(ebitDataDto.getEbitRate()))); ebitDataDto.setTransactionAmount(ebitDataDto.getSpecialFactors().multiply(new BigDecimal(ebitDataDto.getEbitRate())));
ebitDataDto.setTransactionAmount(ebitDataDto.getTransactionAmount().multiply(new BigDecimal(0.06))); ebitDataDto.setTransactionAmount(ebitDataDto.getTransactionAmount().multiply(new BigDecimal(0.06)));
ebitDataDto.setTotalAmountTax(ebitDataDto.getTransactionAmount().multiply(new BigDecimal(0.16))); ebitDataDto.setTotalAmountTax(ebitDataDto.getTransactionAmount().multiply(new BigDecimal(0.16)));
Date now = new Date();
/*//保存 /*//保存
for (int i = 37; i <= 43; i++) { for (int i = 37; i <= 43; i++) {
EbitCellData ebitCellData = new EbitCellData(); EbitCellData ebitCellData = new EbitCellData();
ebitCellData.setData(arr[i - 37]); ebitCellData.setData(arr[i - 37]);
...@@ -1459,6 +1486,7 @@ public class ReportServiceImpl extends BaseService { ...@@ -1459,6 +1486,7 @@ public class ReportServiceImpl extends BaseService {
ebitCellData.setPeriod(period); ebitCellData.setPeriod(period);
ebitCellDataMapper.insert(ebitCellData); ebitCellDataMapper.insert(ebitCellData);
}*/ }*/
return ebitDataDto; return ebitDataDto;
} }
return null; return null;
......
...@@ -50,6 +50,10 @@ ...@@ -50,6 +50,10 @@
<when test="item.projectId != null">#{item.projectId,jdbcType=VARCHAR},</when> <when test="item.projectId != null">#{item.projectId,jdbcType=VARCHAR},</when>
<otherwise>'',</otherwise> <otherwise>'',</otherwise>
</choose> </choose>
<choose>
<when test="item.period != null">#{item.period,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise>
</choose>
<choose> <choose>
<when test="item.tmsPeriod != null">#{item.tmsPeriod,jdbcType=INTEGER},</when> <when test="item.tmsPeriod != null">#{item.tmsPeriod,jdbcType=INTEGER},</when>
<otherwise>0,</otherwise> <otherwise>0,</otherwise>
......
...@@ -31,17 +31,6 @@ ...@@ -31,17 +31,6 @@
scope.projectYear = vatSessionService.year; scope.projectYear = vatSessionService.year;
scope.projectPeriod = scope.serviceType === enums.serviceType.VAT ? vatSessionService.month : 0; scope.projectPeriod = scope.serviceType === enums.serviceType.VAT ? vatSessionService.month : 0;
scope.$watch('templateId', function (newVal, oldValue) {
if (newVal !== oldValue) {
loadSheet(newVal);
}
});
scope.$watchGroup(['reportSource', 'formulaBlocks', 'manualDataSources', 'templateId'], function (newVal, oldValue) {
if (scope.templateId && scope.reportSource) {
setData(true);
}
});
var profileList = ["EBIT考虑资产减值损失", "加:特殊因素考虑", "EBIT(考虑特殊因素)", "EBIT rate", "关联交易金额", "6%增值税", "价税合计金额"]; var profileList = ["EBIT考虑资产减值损失", "加:特殊因素考虑", "EBIT(考虑特殊因素)", "EBIT rate", "关联交易金额", "6%增值税", "价税合计金额"];
// 首次进入页面时,通过promise模式保证在加载完成后再调用locateCell以focus在特定单元格 // 首次进入页面时,通过promise模式保证在加载完成后再调用locateCell以focus在特定单元格
// 如果是在当前页面要focus在特定单元格,通过watch行列号来完成 // 如果是在当前页面要focus在特定单元格,通过watch行列号来完成
...@@ -172,6 +161,7 @@ ...@@ -172,6 +161,7 @@
} }
return $q.when(spread); return $q.when(spread);
}; };
var addEbitRow = function(sheet){ var addEbitRow = function(sheet){
if(sheet == undefined || sheet == null) if(sheet == undefined || sheet == null)
sheet = scope.spread.getActiveSheet(); sheet = scope.spread.getActiveSheet();
...@@ -187,7 +177,6 @@ ...@@ -187,7 +177,6 @@
} }
var setEditable = function (spread, isReadOnly, ifSuspend) { var setEditable = function (spread, isReadOnly, ifSuspend) {
//todo:注册之后这里去掉注释 //todo:注册之后这里去掉注释
var sheet; var sheet;
if (constant.regesterInformation.active) { if (constant.regesterInformation.active) {
......
...@@ -1127,6 +1127,7 @@ ...@@ -1127,6 +1127,7 @@
//period = Number(period); //period = Number(period);
if ($scope.templateId !== undefined) { if ($scope.templateId !== undefined) {
//todo: according to templateId and period get reportId //todo: according to templateId and period get reportId
period = Number(period);//转成Number类型
vatReportService.getReportByTemplateIdEbit($scope.templateId, period, orgId).success(function (report) { vatReportService.getReportByTemplateIdEbit($scope.templateId, period, orgId).success(function (report) {
if (report.result) { if (report.result) {
$scope.reportId = report.data.id; $scope.reportId = report.data.id;
...@@ -2902,6 +2903,9 @@ ...@@ -2902,6 +2903,9 @@
ele1.datepicker("setDate", $scope.selectedDate); ele1.datepicker("setDate", $scope.selectedDate);
//初始化 //初始化
$scope.relation.period = year.toString() + monthRevert(mon); $scope.relation.period = year.toString() + monthRevert(mon);
loadCellData($scope.relation.period, $scope.relation.orgId, function(){
});
}; };
var monthRevert = function(mon){ var monthRevert = function(mon){
...@@ -2949,14 +2953,19 @@ ...@@ -2949,14 +2953,19 @@
.progress(function (evt) { .progress(function (evt) {
}) })
.success(function (data, status, headers, config) { .success(function (data, status, headers, config) {
frontImport(file); debugger;
$('#busy-indicator-container').hide(); if(data.result){
SweetAlert.success("上传成功"); frontImport(file);//前端导入
$scope.relation.fileName = config.file.name; $('#busy-indicator-container').hide();
//重新获取数据 SweetAlert.success("上传成功");
getReportData(function(){ $scope.relation.fileName = config.file.name;
$scope.relation.broadcast = true; //重新获取数据
}, $scope.relation.period); getReportData(function(){
$scope.relation.broadcast = true;
}, $scope.relation.period);
}else{
SweetAlert.error(data.resultMsg);
}
}) })
.error(function (data, status, headers, config) { .error(function (data, status, headers, config) {
...@@ -2984,7 +2993,7 @@ ...@@ -2984,7 +2993,7 @@
$scope.singleExport = function(){ $scope.singleExport = function(){
if($scope.spread != undefined && $scope.spread){ if($scope.spread != undefined && $scope.spread){
var excelIo = new GC.Spread.Excel.IO(); var excelIo = new GC.Spread.Excel.IO();
var fileName = $scope.relation.fileName; var fileName = "利润表.xlsx";
if (fileName.substr(-5, 5) !== '.xlsx') { if (fileName.substr(-5, 5) !== '.xlsx') {
fileName += '.xlsx'; fileName += '.xlsx';
} }
...@@ -3006,6 +3015,39 @@ ...@@ -3006,6 +3015,39 @@
period : $scope.relation.period, period : $scope.relation.period,
templateId : $scope.templateId templateId : $scope.templateId
} }
$timeout(function () {
$('#busy-indicator-container').show();
var mainSpread = new GC.Spread.Sheets.Workbook(document.getElementById("report"), {sheetCount: 1});
mainSpread.isPaintSuspended(true);
mainSpread.sheets.pop();
for (var index = 0; index < $scope.spreads.length; index++) {
var currentSheet = $scope.spreads[index].getActiveSheet();
currentSheet.options.isProtected = false;
for (var rowIndex = 0; rowIndex < currentSheet.getRowCount(); rowIndex++) {
for (var columnIndex = 0; columnIndex < currentSheet.getColumnCount(); columnIndex++) {
var cellStyle = currentSheet.getActualStyle(rowIndex, columnIndex, GC.Spread.Sheets.SheetArea.viewport, true);
currentSheet.setStyle(rowIndex, columnIndex, cellStyle, GC.Spread.Sheets.SheetArea.viewport);
}
}
mainSpread.sheets.push(currentSheet);
}
var excelIo = new GC.Spread.Excel.IO();
// here is excel IO API
excelIo.save(mainSpread.toJSON(), function (blob) {
if ('export' == $scope.evenType) {
saveAs(blob, vatSessionService.project.name + '-' + vatSessionService.month + '-纳税申报.xlsx');
$('#busy-indicator-container').hide();
}
}, function (e) {
alert(e);
});
$('.export-container').html('');
$('#export').html('');
$log.debug(mainSpread);
}, 500);
vatReportService.manyExport(JSON.stringify(param)).success(function(res){ vatReportService.manyExport(JSON.stringify(param)).success(function(res){
}).error(function(error){ }).error(function(error){
...@@ -3013,11 +3055,37 @@ ...@@ -3013,11 +3055,37 @@
}); });
}; };
//机构下拉设置
$scope.selectOrgOptions = {
displayExpr: 'name',
valueExpr: 'id',
width: '95%',
bindingOptions: {
value: 'relation.orgId',
dataSource: 'companyList'
},
height: '30px',
placeholder: $translate.instant('PleaseSelected'),
showClearButton: true,
searchEnabled: true,
noDataText: $translate.instant('RevenueNoOrgData'),
showSelectionControls: false
};
var initCompanyList = function () {
orgService.getOrgListByUserId().success(function (data) {
if (data) {
$scope.companyList = data;
}
});
};
// ---------------------------------------end ------------------------------------------- // ---------------------------------------end -------------------------------------------
(function initialize() { (function initialize() {
vatReportCacheService.initReportCache(); vatReportCacheService.initReportCache();
initDatePicker(); initDatePicker();
loadIndustry(); //loadIndustry();
initCompanyList();
$scope.reportApi = { $scope.reportApi = {
onCellClick: $scope.isDocumentList ? null : cellClick, onCellClick: $scope.isDocumentList ? null : cellClick,
onCellDoubleClick: $scope.isDocumentList ? null : cellDoubleClick onCellDoubleClick: $scope.isDocumentList ? null : cellDoubleClick
......
...@@ -221,6 +221,35 @@ ...@@ -221,6 +221,35 @@
}); });
}; };
/------------------------------------------kevin insert -----------------------------------------/
//机构下拉设置
$scope.selectOrgOptions = {
displayExpr: 'name',
valueExpr: 'id',
width: '95%',
bindingOptions: {
value: 'checkedCompanyCodeList',
dataSource: 'companyList'
},
height: '30px',
placeholder: $translate.instant('PleaseSelected'),
showClearButton: true,
searchEnabled: true,
noDataText: $translate.instant('RevenueNoOrgData'),
showSelectionControls: true
};
var initCompanyList = function () {
orgService.getOrgListByUserId().success(function (data) {
if (data) {
$scope.companyList = data;
}
});
};
//-----------------------------------------------------------------------------------------------
var getGridHeight = function () { var getGridHeight = function () {
if ($scope.isLoadComplete) { if ($scope.isLoadComplete) {
return { height: ($('.balance-ouput-grid-wrapper').height()) + "px" }; return { height: ($('.balance-ouput-grid-wrapper').height()) + "px" };
......
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
</div> </div>
<!--导航栏--> <!--导航栏-->
<div id="tab_total"> <div id="tab_total">
<form class="form-inline" id="navigationForm" name="navigationForm"> <!-- <form class="form-inline" id="navigationForm" name="navigationForm">
<div class="form-group" ng-style="setButtonWrapStyle()"> <div class="form-group" >
<div class="import-wrapper"> <div class="import-wrapper1">
<span class="text-bold" translate="SelectedOrganization"></span>: <span class="text-bold" translate="SelectedOrganization"></span>:
<div class="dropdown" style="margin-left:10px"> <div class="" style="margin-left:10px">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" style="width: 380px;"> data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" style="width: 380px;">
{{checkedCompanyTypeList ? ((checkedCompanyTypeList)|limitString:maxTitleLength):('PleaseSelect' | translate)}} {{checkedCompanyTypeList ? ((checkedCompanyTypeList)|limitString:maxTitleLength):('PleaseSelect' | translate)}}
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
</div> </div>
</li> </li>
</ul> </ul>
<div dx-tag-box="selectOrgOptions"></div>
</div> </div>
<span class="text-bold" translate="InvoiceQJ"></span>: <span class="text-bold" translate="InvoiceQJ"></span>:
<div class="period-picker" style="margin-left:10px"> <div class="period-picker" style="margin-left:10px">
...@@ -62,6 +63,46 @@ ...@@ -62,6 +63,46 @@
ng-click="doUploadRLIT(importEnum.CoverImport)"></button> ng-click="doUploadRLIT(importEnum.CoverImport)"></button>
</div> </div>
</div> </div>
</form>-->
<form class="form-horizontal">
<div class="form-group" style="margin-top: 10px; height: 10px;">
<label class="col-sm-1 control-label marTop">{{'SelectedOrganization' | translate}}:</label>
<div class="col-sm-3 marTop">
<div dx-tag-box="selectOrgOptions"></div>
</div>
<label class="col-sm-1 control-label marTop" style="margin-left: -80px;">{{'InvoiceQJ' | translate}}:</label>
<div class="col-sm-1 marTop" style=" width: 11%;">
<input type="text" id="periodDatepicker" class="datepicker form-control imp-subheader" style="width:120px; display: inline-block"
readonly="readonly" ng-model="UploadPeriodTime"/>
<i class="fa fa-calendar imp-subheader red-color" style="width:20px;"></i>
</div>
<div class="col-sm-3">
<button type="button"
ngf-select="" type="file" ng-model="importExcelFile" ngf-drag-over-class="'dragover'" accept=".xls,.xlsx" ngf-multiple="false"
ngf-allow-dir="false" class="btn btn-vat-third" style="margin-right:10px;margin-left:30px;margin-top: 10px;">
{{'SelectFile' | translate}}
</button>
<span ng-show="fileName" class="marTop" title="{{fileName}}">{{'FileName' | translate}}{{fileName | limitString:10}}</span>
</div>
<div class="col-sm-1">
<button type="button"
class="btn btn-vat-primary" style="float:right; margin-right: 10px;margin-left: 30px;margin-top: 8px;"
translate="TemplateBtn"
ng-click="downloadTemplate()"></button>
</div>
<div class="col-sm-1">
<button type="button"
class="btn btn-vat-primary" style="float:right; margin-right: 10px;margin-left: 30px;margin-top: 8px;"
translate="CoverImportBtn"
ng-click="doUploadRLIT(importEnum.CoverImport)"></button>
</div>
<div class="col-sm-1">
<button type="button"
class="btn btn-vat-primary" style="float:right; margin-right: 10px;margin-left: 30px;margin-top: 8px;"
translate="AddImportBtn"
ng-click="doUploadRLIT(importEnum.AddImport)"></button>
</div>
</div>
</form> </form>
<div class="dt-init-wrapper"> <div class="dt-init-wrapper">
......
...@@ -5,7 +5,9 @@ ...@@ -5,7 +5,9 @@
padding-left: 20px; padding-left: 20px;
/*min-height: 800px;*/ /*min-height: 800px;*/
height: 96%; height: 96%;
.marTop {
margin-top: 10px;
}
.nav-wrapper { .nav-wrapper {
/*padding-bottom: 5px; /*padding-bottom: 5px;
border-bottom: 1px solid #DBD8D3;*/ border-bottom: 1px solid #DBD8D3;*/
......
...@@ -1129,4 +1129,7 @@ ...@@ -1129,4 +1129,7 @@
} }
}); });
} }
/------------------------------------------------kevin insert -----------------------------------/
})(window) })(window)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment