Commit 062c42aa authored by zhkwei's avatar zhkwei

CIT报表生成迁移计算逻辑

parent aa2b62ac
package pwc.taxtech.atms.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import pwc.taxtech.atms.constant.enums.EnumServiceType;
import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.service.impl.CitReportServiceImpl;
import pwc.taxtech.atms.vat.service.impl.ReportServiceImpl;
import java.util.List;
import java.util.Optional;
/**
* @author zhikai.z.wei
* @description CIT报表生成(数据处理)
*/
@RestController
@RequestMapping(value = "api/v1/citReport")
public class CitReportController {
@Autowired
ReportServiceImpl reportService;
@Autowired
CitReportServiceImpl citReportService;
/**
* 获取CIT所有要生成的报表模板相关信息,
* 注意CIT不存在月份期间
* @param projectId
* @param serviceType
* @return
*/
@RequestMapping(value = "citTemplate/{projectId}/{serviceType}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public OperationResultDto<List<ReportDto>> getCitTemplate(@PathVariable String projectId, @PathVariable int serviceType) {
return citReportService.getReportTemplate(projectId, EnumServiceType.getEnumByCode(serviceType));
}
/**
* 生成CIT所有的报表
* @param projectId
* @param generator
* @param mergeManual
* @return
*/
@RequestMapping(value = "generateByTotal/{projectId}/{mergeManual}", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity generateAllData(@PathVariable String projectId,
@RequestParam Optional<String> generator, @PathVariable Boolean mergeManual) {
return ResponseEntity.ok(citReportService.generateCitData(projectId, EnumServiceType.CIT, mergeManual,0,null, generator));
}
}
\ No newline at end of file
......@@ -95,8 +95,9 @@ public class CitDataPreviewServiceImpl extends BaseService {
* @return
*/
public PageInfo<CitJournalAdjustDto> getJournalMergeData(CitJournalAdjustDto citJournalAdjustDto) {
CitJournalEntryAdjust citJournalEntryAdjust = beanUtil.copyProperties(citJournalAdjustDto, new CitJournalEntryAdjust());
Page page = PageHelper.startPage(citJournalAdjustDto.getPageInfo().getPageIndex(), citJournalAdjustDto.getPageInfo().getPageSize());
List<CitJournalEntryAdjust> journalMerges = citJournalMapper.getJournalMerge(citJournalAdjustDto.getProjectId());
List<CitJournalEntryAdjust> journalMerges = citJournalMapper.getJournalMerge(citJournalEntryAdjust);
List<CitJournalAdjustDto> journalAdjustDtos = Lists.newArrayList();
journalMerges.forEach(journal -> {
CitJournalAdjustDto citJournalDto = new CitJournalAdjustDto();
......@@ -112,7 +113,8 @@ public class CitDataPreviewServiceImpl extends BaseService {
public int exportJournalMergeData(CitJournalAdjustDto citJournalAdjustDto, OutputStream os) {
try {
List<CitJournalEntryAdjust> journalMerges = citJournalMapper.getJournalMerge(citJournalAdjustDto.getProjectId());
CitJournalEntryAdjust citJournalEntryAdjust = beanUtil.copyProperties(citJournalAdjustDto, new CitJournalEntryAdjust());
List<CitJournalEntryAdjust> journalMerges = citJournalMapper.getJournalMerge(citJournalEntryAdjust);
Map<String, String> header = generalJMHeader();
List<JournalMergeExportDto> cellList = new ArrayList<>();
......
package pwc.taxtech.atms.service.impl;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.ss.usermodel.Workbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import pwc.taxtech.atms.common.CommonUtils;
import pwc.taxtech.atms.common.util.DataUtil;
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.enums.*;
import pwc.taxtech.atms.dao.*;
import pwc.taxtech.atms.dpo.ReportDto;
import pwc.taxtech.atms.dto.FileDto;
import pwc.taxtech.atms.dto.OperationResultDto;
import pwc.taxtech.atms.dto.ReportAttachDto;
import pwc.taxtech.atms.dto.vatdto.*;
import pwc.taxtech.atms.entity.*;
import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.exception.NotFoundException;
import pwc.taxtech.atms.vat.dao.*;
import pwc.taxtech.atms.vat.dpo.DataSourceCellDataDto;
import pwc.taxtech.atms.vat.dpo.DataSourceExtendDto;
import pwc.taxtech.atms.vat.dpo.InputVATInvoiceItemExtendDto;
import pwc.taxtech.atms.vat.entity.*;
import pwc.taxtech.atms.vat.service.impl.ReportGeneratorImpl;
import pwc.taxtech.atms.vat.service.impl.report.functions.FormulaHelper;
import java.io.File;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static pwc.taxtech.atms.dto.vatdto.WrapPeriodJobDto.*;
/**
* @author zhikai.z.wei
*/
@Component
public class CitReportServiceImpl extends BaseService {
private final static Logger logger = LoggerFactory.getLogger(CitReportServiceImpl.class);
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "PC", "JXFPMX",
"JXFP", "PSUM", "DFFS", "JFFS", "WPSR","WPNAME","WPTYPE"};
@Autowired
private OrganizationServiceTemplateGroupMapper orgServiceTemplateGroupMapper;
@Autowired
private ProjectMapper projectMapper;
@Autowired
private TemplateMapper templateMapper;
@Autowired
private PeriodJobMapper periodJobMapper;
@Autowired
private PeriodApproveMapper periodApprovalMapper;
@Autowired
private PeriodFormulaBlockMapper periodFormulaBlockMapper;
@Autowired
private PeriodCellTemplateConfigMapper periodCellTemplateConfigMapper;
@Autowired
private PeriodCellTemplateMapper periodCellTemplateMapper;
@Autowired
private PeriodTemplateMapper periodTemplateMapper;
@Autowired
private PeriodTaxRuleSettingMapper periodTaxRuleSettingMapper;
@Autowired
private PeriodTaxPayerReportRuleMapper periodTaxPayerReportRuleMapper;
@Autowired
private PeriodDataSourceDetailMapper periodDataSourceDetailMapper;
@Autowired
private PeriodDataSourceMapper periodDataSourceMapper;
@Autowired
private PeriodCellDataMapper periodCellDataMapper;
@Autowired
private PeriodCellDataSourceMapper periodCellDataSourceMapper;
@Autowired
private KeyValueConfigMapper keyValueConfigMapper;
@Autowired
private PeriodReportMapper periodReportMapper;
@Autowired
private DistributedIdService distributedIdService;
@Autowired
private CellTemplateConfigMapper cellTemplateConfigMapper;
@Autowired
private CellTemplateMapper cellTemplateMapper;
@Autowired
private EnterpriseAccountMapper enterpriseAccountMapper;
@Autowired
private ReportGeneratorImpl reportGenerator;
@Autowired
private AdjustmentTableMapper adjustmentTableMapper;
@Autowired
private JournalEntryMapper journalEntryMapper;
@Autowired
private DataValidateLogMapper dataValidateLogMapper;
@Autowired
private DataUtil dataUtil;
public OperationResultDto<List<ReportDto>> getReportTemplate(String projectId, EnumServiceType serviceType) {
OperationResultDto<List<ReportDto>> operationResult = new OperationResultDto<>();
try {
Project project = projectMapper.selectByPrimaryKey(projectId);
String organizationId = project == null ? null : project.getOrganizationId();
if (organizationId == null) {
operationResult.setResult(false);
operationResult.setResultMsg("NoOrganization");
return operationResult;
}
Long templateGroupId;
OrganizationServiceTemplateGroupExample oSTGExample = new OrganizationServiceTemplateGroupExample();
OrganizationServiceTemplateGroupExample.Criteria oSTGCriteria = oSTGExample
.createCriteria();
oSTGCriteria.andOrganizationIdEqualTo(organizationId);
oSTGCriteria.andServiceTypeIdEqualTo(serviceType.getCode().toString());
List<OrganizationServiceTemplateGroup> currentOrganizationServiceTemplateGroupList = orgServiceTemplateGroupMapper
.selectByExample(oSTGExample);
Optional<Long> tempVlaue = orgServiceTemplateGroupMapper.selectByExample(oSTGExample).stream().map(OrganizationServiceTemplateGroup::getTemplateGroupId).findFirst();
if (tempVlaue.isPresent()) {
templateGroupId = tempVlaue.get();
} else {
templateGroupId = 0L;
}
Map<String, Object> map = new HashMap<>();
map.put("period", 0);
map.put("projectId", projectId);
map.put("templateGroupID", templateGroupId);
List<ReportDto> reportDtos = templateMapper.getTemplateLeftJoinReport(map);
if (reportDtos.isEmpty()) {
operationResult.setResultMsg("No Template");
return operationResult;
}
operationResult.setResult(true);
operationResult.setData(reportDtos);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
operationResult.setResult(false);
}
return operationResult;
}
public OperationResultDto generateCitData(String projectId, EnumServiceType serviceType, Boolean isMergeManualData,
Integer periodParam, Integer reportType, Optional<String> generator) {
OperationResultDto operationResultDto = new OperationResultDto();
//验证传入的业务类型参数和后台CIT所代表的业务类型是否一致
MyAsserts.assertEq(serviceType, EnumServiceType.CIT, new NotFoundException());
MyAsserts.assertNull(periodJobMapper.getRunningJob(projectId,periodParam), Exceptions.TASK_HAS_BEGINNING);
String status = periodApprovalMapper.getStatusByProjectIdAndPeriod(projectId, periodParam);
MyAsserts.assertTrue(status == null || !status.equals(Constant.APPROVAL_COMMITTED), Exceptions.REPORT_IN_PROCESS_OR_AGREED_EXCEPTION);
try {
//根据projectId获取相关报表
List<Template> templates = getTemplatesByProjectId(projectId);
List<String> dataValidateArray= new ArrayList<String>();
/*dataValidateArray.add("DA001");
dataValidateArray.add("DA002");
dataValidateArray.add("DA003");*/
dataValidateArray.add("DA004");
PeriodJob genJob = WrapPeriodJobDto.createReportGenJob(projectId, periodParam, templates, dataValidateArray);
periodJobMapper.insert(genJob);
new Thread(new Runnable() {
@Override
public void run() {
try {
// TODO 进行数据校验
DataValidation(periodParam, projectId,genJob );
updateConfig(projectId, periodParam, isMergeManualData, templates, genJob);
PeriodResources resources = reportGenerator.getPeriodResources(projectId, periodParam,
templates.stream().map(Template::getId).collect(Collectors.toList()));
Workbook workbook = reportGenerator.createWorkBookByPeriodTemplate(resources.getPeriodTemplates(), genJob);
reportGenerator.addFunctionsAndContext(workbook, functions, reportGenerator.initContext(resources, periodParam));
reportGenerator.setConfigAndDataToWorkBook(workbook, resources);
FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
evaluator.evaluateAll();
reportGenerator.updateWorkbookCaclsValueToDb(projectId, periodParam, workbook, resources, isMergeManualData, genJob);
setStatus(genJob,STATUS_END);
periodJobMapper.updateByPrimaryKey(genJob);
} catch (Exception e) {
setStatus(genJob, STATUS_ERROR);
e.printStackTrace();
genJob.setErrorMsg("Sever error "+e.getClass().getName());
periodJobMapper.updateByPrimaryKey(genJob);
}
}
}).start();
operationResultDto.setData(new PeriodJobDto().copyFromPeriodJob(genJob));
operationResultDto.setResult(true);
} catch (Exception ex) {
operationResultDto.setResult(false);
logger.error(ex.getMessage(), ex);
}
return operationResultDto;
}
/**
* 根据projectId(卡片ID)获取模板
* @param projectId
* @return
*/
private List<Template> getTemplatesByProjectId(String projectId) {
//验证参数projectId是否为空
MyAsserts.assertNotEmpty(projectId, Exceptions.PROJECT_PROJECT_EXCEPTION);
//验证根据参数projectId获取的project是否为null
Project project = projectMapper.selectByPrimaryKey(projectId);
MyAsserts.assertNotNull(project, Exceptions.NOT_FOUND_REPORT_EXCEPTION);
//根据projectId和CIT所代表的数字类型获取报表模板ID
Long templateGroupId = projectMapper.getTemplateGroupIdByProject(projectId, EnumServiceType.CIT.getCode());
//验证查询得到的报表模板ID是否为null
MyAsserts.assertNotNull(templateGroupId, Exceptions.NOT_FOUND_TEMPLATE_GROUP_EXCEPTION);
//根据报表模板组ID查询在该组的报表模板
List<Template> templates = queryTemplateByGroup(templateGroupId);
MyAsserts.assertNotEmpty(templates, Exceptions.NOT_FOUND_TEMPLATE_EXCEPTION);
templates.sort(Comparator.comparing(Template::getOrderIndex));
return templates;
}
/**
* 根据报表模板组ID查询在该组的报表模板
* @param templateGroupId
* @return
*/
private List<Template> queryTemplateByGroup(Long templateGroupId) {
TemplateExample example = new TemplateExample();
example.createCriteria().andTemplateGroupIdEqualTo(templateGroupId).andIsActiveAssociationEqualTo(true);
return templateMapper.selectByExample(example);
}
/* @Autowired
private CitJour*/
//数据校验
private void DataValidation(Integer periodParam, String projectId, PeriodJob genJob) {
setStatus(genJob,"DA004", STATUS_BEGIN);
//本期余额表
/* TrialBalanceExample trialBalanceExample = new TrialBalanceExample();
TrialBalanceExample.Criteria criteria = trialBalanceExample.createCriteria();
criteria.andProjectIdEqualTo(projectId);
criteria.andPeriodEqualTo(periodParam);
TrialBalance trialBalances = trialBalanceMapper.selectByExample(trialBalanceExample).get(0);
//本期利润表
ProfitLossStatementExample profitLossStatementExample = new ProfitLossStatementExample();
ProfitLossStatementExample.Criteria criteria2 = profitLossStatementExample.createCriteria();
criteria2.andProjectIdEqualTo(projectId);
criteria2.andPeriodEqualTo(periodParam);
ProfitLossStatement profitLossStatements = profitLossStatementMapper.selectByExample(profitLossStatementExample).get(0);*/
//调整表
Map<String, Object> map1 = new HashedMap();
map1.put("projectId", projectId);
map1.put("period", periodParam);
if((periodParam+"").length() == 1){
map1.put("period", "0"+ periodParam);
}else{
map1.put("period", "" + periodParam);
}
List<AdjustmentTable> adjustmentTables = adjustmentTableMapper.selectBeforeAdjustData(map1);
Map<String, Object> map2 = new HashedMap();
map2.put("projectId", projectId);
if((periodParam+"").length() == 1){
map2.put("period", "0"+ periodParam);
}else{
map2.put("period", "" + periodParam);
}
Map<String, Object> map = new HashMap<>();
map.put("period", periodParam);
map.put("projectId", projectId);
Map<String, Object> mapProject = dataUtil.getProjectById(projectId);
map.put("companyCode", mapProject.get("code"));
map.put("companyName", mapProject.get("name"));
List<JournalEntry> journalEntries = journalEntryMapper.selectNowAdjustData(map2);
for(int i =0; i< adjustmentTables.size(); i++){
for(int j =0; j< journalEntries.size(); j++){
JournalEntry journalEntry = journalEntries.get(j);
AdjustmentTable adjustmentTable = adjustmentTables.get(j);
if(journalEntry.getSegment3().equals(adjustmentTable.getSegment3()) &&
journalEntry.getSegment5().equals(adjustmentTable.getSegment5())&&
journalEntry.getSegment6().equals(adjustmentTable.getSegment6()) && journalEntry.getPeriodJrMinDr() != adjustmentTable.getPeriodDrMixCr() ){
setStatus(genJob,STATUS_ERROR );
Constant.ReportDataValidateLog reportDataValidateLog = new Constant.ReportDataValidateLog(journalEntries.get(j).getSegment3(), journalEntries.get(j).getSegment5(), journalEntries.get(j).getSegment6());
//记录校验结果
//
map.put("result", reportDataValidateLog.getResult(false));
map.put("validateResult", "error");
map.put("tmsPeriod", journalEntry.getTmsPeriod());
map.put("organizationId", journalEntry.getOrganizationId());
insertDataValidateResult(map);
periodJobMapper.updateByPrimaryKey(genJob);
return;
}
}
}
setStatus(genJob, STATUS_END);
map.put("validateResult", "success");
map.put("result", "");
map.put("tmsPeriod", 0);
map.put("organizationId", mapProject.get("organization_id"));
insertDataValidateResult(map);
periodJobMapper.updateByPrimaryKey(genJob);
}
public void insertDataValidateResult(Map map){
DataValidateLog dataValidateLog = new DataValidateLog();
dataValidateLog.setCreateTime(new Date());
dataValidateLog.setPeriod((Integer) map.get("period"));
dataValidateLog.setProjectId((String)map.get("projectId"));
dataValidateLog.setValidateResult((String)map.get("validateResult"));
dataValidateLog.setResult((String)map.get("result"));
dataValidateLog.setOrganizationId((String)map.get("organizationId"));
dataValidateLog.setCompanyCode((String)map.get("companyCode"));
dataValidateLog.setCompanyName((String)map.get("companyName"));
dataValidateLog.setTmsPeriod((Integer) map.get("tmsPeriod"));
dataValidateLogMapper.insert(dataValidateLog);
}
/**
* 清除配置,复制配置
* @param projectId
* @param period
* @param isMergeManualData
* @param templates
* @param job
*/
private void updateConfig(String projectId, Integer period, Boolean isMergeManualData, List<Template> templates, PeriodJob job) {
List<Long> exceptTemplateIds = templateMapper.getIdsForExceptTemplate();
//清除配置
clearPeriodData(projectId, period, exceptTemplateIds, isMergeManualData);
//复制配置
copyTemplateAndConfigFromAdmin(projectId, templates, period);
setStatus(job, STATUS_END);
periodJobMapper.updateByPrimaryKey(job);
}
/**
* 清除配置
* @param projectId
* @param period
* @param templateIds
* @param isMergeManualData
*/
private void clearPeriodData(String projectId, Integer period, List<Long> templateIds, boolean isMergeManualData) {
if (templateIds.isEmpty()) templateIds.add(Long.MAX_VALUE);
PeriodFormulaBlockExample periodFormulaBlockExample = new PeriodFormulaBlockExample();
periodFormulaBlockExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
periodFormulaBlockMapper.deleteByExample(periodFormulaBlockExample);
PeriodTaxRuleSettingExample periodTaxRuleSettingExample = new PeriodTaxRuleSettingExample();
periodTaxRuleSettingExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
periodTaxRuleSettingMapper.deleteByExample(periodTaxRuleSettingExample);
PeriodCellTemplateExample periodCellTemplateExample = new PeriodCellTemplateExample();
periodCellTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andReportTemplateIdNotIn(templateIds);
periodCellTemplateMapper.deleteByExample(periodCellTemplateExample);
PeriodCellTemplateConfigExample periodCellTemplateConfigExample = new PeriodCellTemplateConfigExample();
periodCellTemplateConfigExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andReportTemplateIdNotIn(templateIds);
periodCellTemplateConfigMapper.deleteByExample(periodCellTemplateConfigExample);
PeriodTemplateExample periodTemplateExample = new PeriodTemplateExample();
periodTemplateExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period).andTemplateIdNotIn(templateIds);
periodTemplateMapper.deleteByExample(periodTemplateExample);
PeriodTaxPayerReportRuleExample periodTaxPayerReportRuleExample = new PeriodTaxPayerReportRuleExample();
periodTaxPayerReportRuleExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
periodTaxPayerReportRuleMapper.deleteByExample(periodTaxPayerReportRuleExample);
PeriodDataSourceExample periodDataSourceExample = new PeriodDataSourceExample();
periodDataSourceExample.createCriteria().andProjectIdEqualTo(projectId)
.andPeriodEqualTo(period);
List<PeriodDataSource> periodDataSources = periodDataSourceMapper.selectByExample(periodDataSourceExample);
Set<Long> periodDsIds = Sets.newHashSet(Long.MAX_VALUE);
List<Long> periodManualDsIds = new ArrayList<>();
if (isMergeManualData) {
periodDataSources.forEach(m -> {
if (m.getType().intValue() != FormulaDataSourceType.KeyInSource.getCode().intValue()) {
periodDsIds.add(m.getId());
} else {
periodManualDsIds.add(m.getId());
}
});
} else {
periodDsIds.addAll(periodDataSources.stream().map(m -> m.getId()).collect(Collectors.toList()));
}
PeriodDataSourceDetailExample periodDataSourceDetailExample = new PeriodDataSourceDetailExample();
periodDataSourceDetailExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period)
.andDataSourceIdIn(Lists.newArrayList(periodDsIds));
periodDataSourceDetailMapper.deleteByExample(periodDataSourceDetailExample);
PeriodCellDataSourceExample periodCellDataSourceExample = new PeriodCellDataSourceExample();
periodCellDataSourceExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
periodCellDataSourceMapper.deleteByExample(periodCellDataSourceExample);
PeriodDataSourceExample periodDataSourceDeleteExample = new PeriodDataSourceExample();
periodDataSourceDeleteExample.createCriteria().andIdIn(Lists.newArrayList(periodDsIds));
periodDataSourceMapper.deleteByExample(periodDataSourceDeleteExample);
PeriodReportExample periodReportExample = new PeriodReportExample();
periodReportExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
periodReportMapper.deleteByExample(periodReportExample);
PeriodCellDataExample periodCellDataExample = new PeriodCellDataExample();
periodCellDataExample.createCriteria().andProjectIdEqualTo(projectId).andPeriodEqualTo(period);
periodCellDataMapper.deleteByExample(periodCellDataExample);
}
/**
* 复制各种配置
* @param projectId
* @param templates
* @param period
*/
private void copyTemplateAndConfigFromAdmin(String projectId, List<Template> templates, Integer period) {
List<PeriodTemplate> periodTemplateList = new ArrayList<>();
//循环报表
for (Template template : templates) {
Long startTime = System.currentTimeMillis();
logger.debug("template copy start: " + startTime);
PeriodTemplate periodTemplate = new PeriodTemplate();
CommonUtils.copyProperties(template, periodTemplate);
periodTemplate.setId(distributedIdService.nextId());
periodTemplate.setPeriod(period);
periodTemplate.setName(template.getName());
periodTemplate.setCode(template.getCode());
periodTemplate.setPath(template.getPath());
periodTemplate.setReportType(template.getReportType());
periodTemplate.setTemplateGroupId(template.getTemplateGroupId());
periodTemplate.setOrderIndex(template.getOrderIndex());
// periodTemplate.setCreateTime(template.getCreateTime());
// periodTemplate.setUpdateTime(template.getUpdateTime());
periodTemplate.setIsSystemType(template.getIsSystemType());
periodTemplate.setIsActiveAssociation(template.getIsActiveAssociation());
periodTemplate.setParentId(StringUtils.isBlank(template.getParentId()) ? null : template.getParentId());
periodTemplate.setTemplateId(template.getId());
periodTemplate.setCreateBy(StringUtils.isBlank(template.getCreateBy()) ? "admin" : template.getCreateBy());
periodTemplate.setUpdateBy(StringUtils.isBlank(template.getUpdateBy()) ? "admin" : template.getUpdateBy());
periodTemplate.setProjectId(projectId);
periodTemplateList.add(periodTemplate);
//复制报表模板单元格定位及相关信息到卡片单元格模板
copyPeriodCellTemplateFromCellTemplate(projectId, template.getId(), period);
//复制单元格内容到卡片单元格内容
copyPeriodConfigFromCellTemplateConfig(projectId, template.getId(), period);
}
periodTemplateMapper.batchInsert(periodTemplateList);
}
/**
* 复制报表模板单元格定位及相关信息到卡片单元格模板
* @param projectId
* @param templateId
* @param period
*/
private void copyPeriodCellTemplateFromCellTemplate(String projectId, Long templateId, Integer period) {
CellTemplateExample cellTemplateExample = new CellTemplateExample();
cellTemplateExample.createCriteria().andReportTemplateIdEqualTo(templateId);
List<CellTemplate> cellTemplateList = cellTemplateMapper.selectByExample(cellTemplateExample);
List<PeriodCellTemplate> periodCellTemplateList = new ArrayList<>();
for (CellTemplate cellTemplate : cellTemplateList) {
PeriodCellTemplate periodCellTemplate = new PeriodCellTemplate();
CommonUtils.copyProperties(cellTemplate, periodCellTemplate);
periodCellTemplate.setId(distributedIdService.nextId());
periodCellTemplate.setPeriod(period);
periodCellTemplate.setReportTemplateId(templateId);
periodCellTemplate.setRowIndex(cellTemplate.getRowIndex());
periodCellTemplate.setRowName(cellTemplate.getRowName());
periodCellTemplate.setColumnIndex(cellTemplate.getColumnIndex());
periodCellTemplate.setColumnName(cellTemplate.getColumnName());
periodCellTemplate.setComment(cellTemplate.getComment());
// periodCellTemplate.setCreateTime(cellTemplate.getCreateTime());
// periodCellTemplate.setUpdateTime(cellTemplate.getUpdateTime());
periodCellTemplate.setCellTemplateId(cellTemplate.getId());
periodCellTemplate.setDataType(cellTemplate.getDataType());
periodCellTemplate.setIsReadOnly(cellTemplate.getIsReadOnly() ? 1 : 0);
periodCellTemplate.setCopyFromId(cellTemplate.getCopyFromId());
periodCellTemplate.setCreateBy(StringUtils.isBlank(cellTemplate.getCreateBy()) ? "admin" : cellTemplate.getCreateBy());
periodCellTemplate.setUpdateBy(StringUtils.isBlank(cellTemplate.getUpdateBy()) ? "admin" : cellTemplate.getUpdateBy());
periodCellTemplate.setProjectId(projectId);
periodCellTemplateList.add(periodCellTemplate);
}
CommonUtils.subListWithLen(periodCellTemplateList,CommonUtils.BATCH_NUM).forEach(batch->{
periodCellTemplateMapper.batchInsert(batch);
});
}
/**
* 复制单元格内容到卡片单元格内容
* @param projectId
* @param templateId
* @param period
*/
private void copyPeriodConfigFromCellTemplateConfig(String projectId, Long templateId, Integer period) {
//查询符合条件的单元格模板参数
CellTemplateConfigExample cellTemplateConfigExample = new CellTemplateConfigExample();
cellTemplateConfigExample.createCriteria().andReportTemplateIdEqualTo(templateId);
List<CellTemplateConfig> cellTemplateConfigList = cellTemplateConfigMapper.selectByExample(cellTemplateConfigExample);
if (cellTemplateConfigList.isEmpty()) {
return;
}
//循环单元格模板参数,并赋值给卡片单元格参数
List<PeriodCellTemplateConfig> periodCellTemplateConfigList = new ArrayList<>();
for (CellTemplateConfig cellTemplateConfig : cellTemplateConfigList) {
PeriodCellTemplateConfig periodCellTemplateConfig = new PeriodCellTemplateConfig();
CommonUtils.copyProperties(cellTemplateConfig, periodCellTemplateConfig);
periodCellTemplateConfig.setId(distributedIdService.nextId());
periodCellTemplateConfig.setPeriod(period);
periodCellTemplateConfig.setCellTemplateId(cellTemplateConfig.getCellTemplateId());
periodCellTemplateConfig.setReportTemplateId(templateId);
periodCellTemplateConfig.setDataSourceType(cellTemplateConfig.getDataSourceType());
periodCellTemplateConfig.setFormula(StringUtils.isBlank(cellTemplateConfig.getFormula()) ? null : cellTemplateConfig.getFormula());
periodCellTemplateConfig.setParsedFormula(null);
periodCellTemplateConfig.setFormulaDescription(cellTemplateConfig.getFormulaDescription());
periodCellTemplateConfig.setAccountCodes(cellTemplateConfig.getAccountCodes());
periodCellTemplateConfig.setInvoiceType(cellTemplateConfig.getInvoiceType());
periodCellTemplateConfig.setTaxRate(cellTemplateConfig.getTaxRate());
periodCellTemplateConfig.setInvoiceAmountType(cellTemplateConfig.getInvoiceAmountType());
periodCellTemplateConfig.setModelIds(cellTemplateConfig.getModelIds());
periodCellTemplateConfig.setCreateBy(StringUtils.isBlank(cellTemplateConfig.getCreateBy()) ? "admin" : cellTemplateConfig.getCreateBy());
periodCellTemplateConfig.setCreateTime(cellTemplateConfig.getCreateTime());
periodCellTemplateConfig.setUpdateBy(StringUtils.isBlank(cellTemplateConfig.getUpdateBy()) ? "admin" : cellTemplateConfig.getUpdateBy());
periodCellTemplateConfig.setUpdateTime(cellTemplateConfig.getUpdateTime());
periodCellTemplateConfig.setInvoiceCategory(cellTemplateConfig.getInvoiceCategory());
periodCellTemplateConfig.setFormulaDataSource(cellTemplateConfig.getFormulaDataSource());
periodCellTemplateConfig.setValidation(cellTemplateConfig.getValidation());
periodCellTemplateConfig.setParsedValidation(null);
periodCellTemplateConfig.setValidationDescription(cellTemplateConfig.getValidationDescription());
periodCellTemplateConfig.setVoucherKeyword(cellTemplateConfig.getVoucherKeyword());
periodCellTemplateConfig.setCellTemplateConfigId(cellTemplateConfig.getId());
periodCellTemplateConfig.setKeyValueParsedFormula(null);
//赋值projectId(卡片ID),区分是哪个卡片里面的数据
periodCellTemplateConfig.setProjectId(projectId);
fixedParsedFormula(periodCellTemplateConfig);
fixedAccountCode(periodCellTemplateConfig);
periodCellTemplateConfigList.add(periodCellTemplateConfig);
}
CommonUtils.subListWithLen(periodCellTemplateConfigList,CommonUtils.BATCH_NUM).forEach(batch->{
periodCellTemplateConfigMapper.batchInsert(batch);
});
}
/**
* 固定转换公式
* @param pctc
*/
private void fixedParsedFormula(PeriodCellTemplateConfig pctc) {
if (pctc.getFormula() != null && pctc.getFormula().contains("@")) {
String regex = "@[0-9A-Z.]+";
Pattern pp = Pattern.compile(regex);
Matcher mm = pp.matcher(pctc.getFormula());
String replace_result = pctc.getFormula();
Boolean replace = true;
while (mm.find()) {
KeyValueConfigExample keyValueConfigExample = new KeyValueConfigExample();
keyValueConfigExample.createCriteria().andKeyCodeEqualTo(StringUtils.removeStart(mm.group(), "@"));
Optional<KeyValueConfig> keyValueConfig = keyValueConfigMapper.selectByExample(keyValueConfigExample).stream().findFirst();
if (keyValueConfig.isPresent() && StringUtils.isNotBlank(keyValueConfig.get().getFormula())) {
replace_result = replace_result.replace(mm.group(), keyValueConfig.get().getFormula());
} else {
replace = false;
}
}
if (replace) {
pctc.setKeyValueParsedFormula(replace_result);
}
//todo: get the keyvalue from table add to keyvalue parsed formula
// KeyValueConfigExample skeyValueConfigExample = new KeyValueConfigExample();
// keyValueConfigExample.createCriteria().andKeyCodeEqualTo(StringUtils.removeStart(cellTemplateConfig.getFormula(), "@"));
// Optional<KeyValueConfig> keyValueConfig = keyValueConfigMapper.selectByExample(keyValueConfigExample).stream().findFirst();
// if (keyValueConfig.isPresent()) {
// periodCellTemplateConfig.setKeyValueParsedFormula(keyValueConfig.get().getFormula());
// }
}
}
/**
* 未知用途。。
* @param pctc
*/
private void fixedAccountCode(PeriodCellTemplateConfig pctc) {
if (StringUtils.isNotBlank(pctc.getAccountCodes())) {
String[] acctCodes = pctc.getAccountCodes().split(",");
EnterpriseAccountExample enterpriseAccountExample = new EnterpriseAccountExample();
enterpriseAccountExample.createCriteria().andStdCodeIn(Arrays.asList(acctCodes));
List<EnterpriseAccount> enterpriseAccounts = enterpriseAccountMapper.selectByExample(enterpriseAccountExample);
if (!enterpriseAccounts.isEmpty()) {
List<String> acctCodeList = enterpriseAccounts.stream().map(EnterpriseAccount::getCode).collect(Collectors.toList());
StringBuilder codes = new StringBuilder();
for (String code : acctCodeList) {
codes.append(code).append(",");
}
pctc.setAccountCodes(StringUtils.removeEnd(codes.toString(), ","));
}
}
}
/**
* 获取符合条件的PeriodJob以供前台判断job执行的阶段
* @param projectId
* @param period
* @param jobId
* @return
*/
public PeriodJob getJobStatus(String projectId, Integer period, String jobId) {
PeriodJob job = periodJobMapper.getJobStatus(projectId, period, jobId);
MyAsserts.assertNotNull(job, Exceptions.NOT_FOUND_EXCEPTION);
return job;
}
}
......@@ -126,8 +126,8 @@ public interface CitJournalEntryAdjustMapper extends MyMapper {
/**
* fetch data by projectId
*
* @param projectId
* @param record
* @return List<CitJournalEntryAdjust>
*/
List<CitJournalEntryAdjust> getJournalMerge(String projectId);
List<CitJournalEntryAdjust> getJournalMerge(CitJournalEntryAdjust record);
}
\ No newline at end of file
......@@ -198,6 +198,18 @@
created_by, created_date, late_updated_by,
late_updated_date, create_time, update_time
from cit_journal_entry_adjust where project_id=''
<if test="orgCode != null">
and org_code = #{orgCode,jdbcType=VARCHAR}
</if>
<if test="subjectCode != null">
and subject_code = #{record.subjectCode,jdbcType=VARCHAR}
</if>
<if test="orgName != null">
and org_name = #{orgName,jdbcType=VARCHAR}
</if>
<if test="subjectName != null">
and subject_name = #{subjectName,jdbcType=VARCHAR}
</if>
UNION ALL
select
id, organization_id, project_id, tms_period as period ,date,source, ledger_id, ledger_name, currency_code,
......@@ -206,6 +218,18 @@
segment1_name as org_name, segment3_name as subject_name, accounted_dr, accounted_cr,
created_by, created_date, late_updated_by, late_updated_date, create_time, update_time
from journal_entry where project_id=''
<if test="orgCode != null">
and segment1 = #{orgCode,jdbcType=VARCHAR}
</if>
<if test="subjectCode != null">
and segment3 = #{subjectCode,jdbcType=VARCHAR}
</if>
<if test="orgName != null">
and segment1_name = #{orgName,jdbcType=VARCHAR}
</if>
<if test="subjectName != null">
and segment3_name = #{subjectName,jdbcType=VARCHAR}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -985,7 +985,7 @@ init-row="initRow" init-col="initCol" service-type="\'6\'" is-document-list="tru
function ($scope, $stateParams, appTranslation) {
appTranslation.load([appTranslation.cit]);
}],
template: '<cit-caculate-data></cit-caculate-data>',
template: '<cit-calculate-data></cit-calculate-data>',
}
},
resolve: scriptDependencyProvider.createDependenciesMap(scriptDependencyProvider.cit),
......
......@@ -105,5 +105,6 @@
"CreditAmount": "Credit Amount",
"BeginningBalance": "Beginning Balance",
"EndingBalance": "Ending Balance",
"Attribute": "Attribute"
"Attribute": "Attribute",
"MainBodyCode": "Main Body Code"
}
\ No newline at end of file
......@@ -1140,7 +1140,8 @@
"citSalaryAdvance" : "预提重分类数据源",
"assetLabelNumber" : "资产标签号",
"compensationSaleAmount" : "赔偿/变卖金额",
"EAMDisposal" : "EAM资产处理金额"
"EAMDisposal" : "EAM资产处理金额",
"MainBodyCode": "主体代码"
}
\ No newline at end of file
<div class="popover">
<div class="popover-content">
<div>
<table class=" table table-responsive">
<tr>
<td><span translate="TaxAccountDifference"></span></td>
<td>
<!--税会差异的选择-->
<div class="input-group">
<div class="option" style="display: inline-block">
<div id="taxAccountDifferenceButton" dx-select-box="taxAccountDifferenceOptions"></div>
</div>
</div>
</td>
</tr>
<tr>
<td><span translate="AccountCode"></span></td>
<td>
<div class="input-group">
<input class="form-control " type="text" id="accountCode" placeholder=""
ng-model="filterData.accountCode">
<a class="input-group-addon btn btn-sm" ng-click="popTheParentCode()"><i
class="fa fa-columns" aria-hidden="true"></i></a>
</div>
</td>
</tr>
<tr>
<td><span translate="AccountName"></span></td>
<td><input class="form-control " type="text" id="accountName" placeholder=""
ng-model="filterData.accountName"></td>
</tr>
<tr>
<td><span translate="DebitOpeningBalance"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right;"
type="text" id="debitOpeningBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.debitOpeningBalanceFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="debitOpeningBalanceTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.debitOpeningBalanceTo">
</div>
</td>
</tr>
<tr>
<td><span translate="CreditOpeningBalance"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="creditOpeningBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.creditOpeningBalanceFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="creditOpeningBalanceTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.creditOpeningBalanceTo">
</div>
</td>
</tr>
<tr>
<td><span translate="AccumulatedDebitAmount"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="accumulatedDebitAmountFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.accumulatedDebitAmountFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="accumulatedDebitAmountTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.accumulatedDebitAmountTo">
</div>
</td>
</tr>
<tr>
<td><span translate="AccumulatedCreditAmount"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="accumulatedCreditAmountFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.accumulatedCreditAmountFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="accumulatedCreditAmountTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.accumulatedCreditAmountTo">
</div>
</td>
</tr>
<tr>
<td><span translate="DebitClosingBalance"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="debitClosingBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.debitClosingBalanceFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="debitClosingBalanceTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.debitClosingBalanceTo">
</div>
</td>
</tr>
<tr>
<td><span translate="CreditClosingBalance"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right;"
type="text" id="creditClosingBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.creditClosingBalanceFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="creditClosingBalanceTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.creditClosingBalanceTo">
</div>
</td>
</tr>
</table>
</div>
<div class="row">
<div style="float:right">
<button class="btn btn-default btn-primary" ng-click="doDataFilter()">
<span class="fa fa-chevron-down" aria-hidden="true"> </span> <span translate="Confirm"></span>
</button>
<button class="btn btn-default" style="margin-right:15px" type="button" ng-click="doDataFilterReset()">
<span class="fa fa-times" aria-hidden="true"> </span> <span translate="Reset"></span>
</button>
</div>
</div>
</div>
</div>
......@@ -989,9 +989,9 @@
//scrolling: { mode: "virtual" },
noDataText: $translate.instant('AccountVoucher_DataGrid_NoDataText'),
height: '99%',
filterRow: {
visible: true
},
// filterRow: {
// visible: true
// },
onRowUpdating: function (e) {
var data = $.extend({}, e.oldData, e.newData);
if(data.isRetain == true)
......@@ -1005,6 +1005,10 @@
targetArray.push(data);
},
onToolbarPreparing: function (e) {
e.toolbarOptions.items.unshift({
location: "after",
template: "totalGroupCount"
});
var toolbarItems = e.toolbarOptions.items;
var savebutton = _.find(e.toolbarOptions.items, function (m) { return m.name === "saveButton" });
var defaultFun = savebutton.options.onClick;
......
......@@ -6,7 +6,11 @@
<span class="active" ng-click="switchTab($event,2)">{{'FixedAssets' | translate}}</span><span
ng-click="switchTab($event,3)">{{'LongTermPrepaid' | translate}}</span><span
ng-click="switchTab($event,4)">{{'InvisibleAssets' | translate}}</span>
<!--税会差异的选择-->
<!--<div class="option" style="display: inline-block">-->
<!--<span>{{'TaxAccountDifference' | translate}}</span>-->
<!--<div id="taxAccountDifferenceButton" dx-select-box="taxAccountDifferenceOptions"></div>-->
<!--</div>-->
</div>
</div>
<!--导入界面-->
......@@ -50,19 +54,19 @@
<!--</div>-->
<div class="form-group">
<div class="col-sm-5">
<input class="form-control" type="text" name="fileName"
value="{{file ? file.name : '' | limitString :25}}" readonly placeholder="" required>
</div>
<div class="col-sm-4">
<button type="button" type="file" ngf-select ng-model="file" accept=".xls,.xlsx"
class="btn btn-secondary browse">{{'SelectFile' | translate}}
</button>
</div>
<div class="col-sm-3">
<button class="btn btn-vat-primary" style="height: 34px" translate="ImportBtn"
ng-click="importDataNew()"></button>
</div>
<div class="col-sm-5">
<input class="form-control" type="text" name="fileName"
value="{{file ? file.name : '' | limitString :25}}" readonly placeholder="" required>
</div>
<div class="col-sm-4">
<button type="button" type="file" ngf-select ng-model="file" accept=".xls,.xlsx"
class="btn btn-secondary browse">{{'SelectFile' | translate}}
</button>
</div>
<div class="col-sm-3">
<button class="btn btn-vat-primary" style="height: 34px" translate="ImportBtn"
ng-click="importDataNew()"></button>
</div>
</div>
......@@ -152,11 +156,6 @@
<!--计算结果显示界面-->
<div id="tab_Assets" ng-if="displayType >1">
<!--税会差异的选择-->
<div class="option">
<span>{{'TaxAccountDifference' | translate}}</span>
<div id="taxAccountDifferenceButton" dx-select-box="taxAccountDifferenceOptions"></div>
</div>
<!--计算结果-->
<div class="total-Wrapper">
<span>{{'TotalNumber' | translate}}<span class="total_span">{{TotalCount}}</span> {{'RecordCount' | translate}}</span>
......@@ -170,7 +169,18 @@
<!--资产清单结果集-->
<div class="dt-asset-result">
<!--<asset-list-edit-modal asset-type="displayType-1" type="0"></asset-list-edit-modal>-->
<div id="assetsResultGrid" dx-data-grid="assetsResultGridOptions"></div>
<div id="assetsResultGrid" dx-data-grid="assetsResultGridOptions">
<div style="display: inline-block" data-options="dxTemplate:{ name:'totalGroupCount' }">
<button class="filter-button"
atms-popover ng-mouseenter="prepareSummary()"
popover-container="body" popover-auto-hide="true" data-overwrite="true"
use-optimized-placement-algorithm="true"
data-placement="bottom"
data-templateurl="/app/cit/import/cit-import-asset-list/cit-import-asset-list-search.html">
<i class="fa fa-filter" aria-hidden="true"></i>
</button>
</div>
</div>
</div>
</div>
......
......@@ -43,6 +43,7 @@
.active {
background-color: #F91000;
}
}
}
......@@ -303,19 +304,6 @@
/*font-size:13px !important;*/
}
}
.option {
margin-top: 10px;
margin-bottom: 10px;
}
.option > span {
margin-right: 10px;
}
.option > .dx-selectbox {
display: inline-block;
vertical-align: middle;
}
}
.error-list-modal {
......@@ -402,3 +390,62 @@
}
}
.option {
margin-top: 10px;
margin-bottom: 10px;
}
.option > span {
margin-right: 10px;
}
.option > .dx-selectbox {
display: inline-block;
vertical-align: middle;
}
.filter-button {
width: 30px;
//margin-top: 16px;
}
.popover {
min-width: 370px;
.arrow {
left: 5% !important;
}
}
.popover-content {
td {
text-align: right;
padding: 6px;
span {
float: left;
}
}
.form-control {
display: inline-block;
&:focus {
border-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
border: 1px solid #ccc;
}
}
.input-width-small {
width: 100px;
}
.input-width-middle {
width: 217px;
}
}
......@@ -5,52 +5,35 @@
<table class="table table-responsive">
<tr>
<td>
<span translate="TBAccountCode"></span>
<input class="form-control input-width-middle" type="text" id="segment3" ng-model="queryParams.segment3" />
<span translate="AccountCode"></span>
<input class="form-control input-width-middle" type="text" id="subjectCode" ng-model="queryParams.subjectCode" />
</td>
</tr>
<tr>
<td>
<span translate="AccountName"></span>
<input class="form-control input-width-middle" type="text" id="segment3Name" ng-model="queryParams.segment3Name" />
<input class="form-control input-width-middle" type="text" id="subjectName" ng-model="queryParams.subjectName" />
</td>
</tr>
<tr>
<td>
<span translate="ProfitCenterCode"></span>
<input class="form-control input-width-middle" type="text" id="segment5" ng-model="queryParams.segment5" />
<span translate="orgCode"></span>
<input class="form-control input-width-middle" type="text" id="orgCode" ng-model="queryParams.orgCode" />
</td>
</tr>
<tr>
<td>
<span translate="ProfitCenterName"></span>
<input class="form-control input-width-middle" type="text" id="segment5Name" ng-model="queryParams.segment5Name" />
<span translate="orgName"></span>
<input class="form-control input-width-middle" type="text" id="orgName" ng-model="queryParams.orgName" />
</td>
</tr>
<tr>
<td>
<span translate="ProductCode"></span>
<input class="form-control input-width-middle" type="text" id="segment6" ng-model="queryParams.segment6" />
</td>
</tr>
<tr>
<td>
<span translate="TBProductName"></span>
<input class="form-control input-width-middle" type="text" id="segment6Name" ng-model="queryParams.segment6Name" />
</td>
</tr>
<tr>
<td>
<span translate="Summary"></span>
<input class="form-control input-width-middle" type="text" id="description" ng-model="queryParams.description" />
</td>
</tr>
<tr>
<td>
<span translate="IsContainsAdjustmentRecord"></span>
<input class="form-control input-width-middle" type="text" id="containsAdjustmentRecord" ng-model="queryParams.containsAdjustmentRecord" />
<span translate="DocumentDate"></span>
<input class="form-control input-width-middle" type="text" id="documentDate" ng-model="queryParams.documentDate" />
</td>
</tr>
<!--<tr>
<td>
<span translate="InvoiceFPLXQuery"></span>
......
......@@ -39,15 +39,11 @@
pageInfo: {},
periodStart: '',
periodEnd: '',
// orgId: '',
// segment3: null,
// segment3Name: null,
// segment5: null,
// segment5Name: null,
// segment6: null,
// segment6Name: null,
// description: null,
// containsAdjustmentRecord: null
subjectCode: null,
subjectName: null,
orgCode: null,
orgName: null,
documentDate: null,
projectId: vatSessionService.project.id
};
};
......@@ -153,39 +149,33 @@
//将选择了的查询条件显示在grid上方
var doDataFilter = function (removeData) {
// if ($scope.queryParams.periodStart > $scope.queryParams.periodEnd) {
// $scope.queryParams.periodEnd = $scope.queryParams.periodStart;
// }
if ($scope.queryParams.periodStart > $scope.queryParams.periodEnd) {
$scope.queryParams.periodEnd = $scope.queryParams.periodStart;
}
//设置需要去掉的查询条件的值为空
// if (!PWC.isNullOrEmpty(removeData)) {
// var removeItem = removeData.split("|");
// removeItem.forEach(function (v) {
// $scope.queryParams[v] = null;
//
// if ($scope.queryParams.segment3 === null) {
// $scope.queryParams.segment3 = '';
// }
// if ($scope.queryParams.segment3Name === null) {
// $scope.queryParams.segment3Name = '';
// }
// if ($scope.queryParams.segment5 === null) {
// $scope.queryParams.segment5Name = '';
// }
// if ($scope.queryParams.segment6 === null) {
// $scope.queryParams.segment6 = '';
// }
// if ($scope.queryParams.segment6Name === null) {
// $scope.queryParams.segment6Name = '';
// }
// if ($scope.queryParams.description === null) {
// $scope.queryParams.description = '';
// }
// if ($scope.queryParams.invoiceType === null) {
// $scope.InvoiceType.selected = undefined;
// }
// });
// }
if (!PWC.isNullOrEmpty(removeData)) {
var removeItem = removeData.split("|");
removeItem.forEach(function (v) {
$scope.queryParams[v] = null;
if ($scope.queryParams.subjectCode === null) {
$scope.queryParams.subjectCode = '';
}
if ($scope.queryParams.subjectName === null) {
$scope.queryParams.subjectName = '';
}
if ($scope.queryParams.orgCode === null) {
$scope.queryParams.orgCode = '';
}
if ($scope.queryParams.orgName === null) {
$scope.queryParams.orgName = '';
}
if ($scope.queryParams.documentDate === null) {
$scope.queryParams.documentDate = '';
}
});
}
loadJournalEntryDataFromDB(1);
if ($scope.criteriaList.length > 6) {
......@@ -204,14 +194,11 @@
pageInfo: {},
periodStart: '',
periodEnd: '',
// segment3: null,
// segment3Name: null,
// segment5: null,
// segment5Name: null,
// segment6: null,
// segment6Name: null,
// description: null,
// containsAdjustmentRecord: null
subjectCode: null,
subjectName: null,
orgCode: null,
orgName: null,
documentDate: null,
projectId: vatSessionService.project.id
};
$scope.queryParams.periodStart = $scope.startMonth;
......@@ -318,8 +305,10 @@
{ name: $translate.instant('JournalName'), width: 200,cellTemplate: '<div class="ui-grid-cell-contents"><span >{{row.entity.name}}</span></div>' },
{ name: $translate.instant('DocumentNo'), width: 200,cellTemplate: '<div class="ui-grid-cell-contents"><span >{{row.entity.voucherNum}}</span></div>' },
{ name: $translate.instant('Summary'), width: 200,cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.description}}</span></div>' },
{ name: $translate.instant('MainBodyCode'), width: 200,cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.orgCode}}</span></div>' },
{ name: $translate.instant('MainBodyDescription'), width: 200,cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.orgName}}</span></div>' },
// { name: $translate.instant('CostCenterDescription'), width: 200,cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.segment2Name}}</span></div>' },
{ name: $translate.instant('AccountCode'),width: 200,cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.subjectCode}}</span></div>' },
{ name: $translate.instant('SubjectDescription'),width: 200,cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.subjectName}}</span></div>' },
// { name: $translate.instant('AuxiliaryAccountDescription'), width: 200,cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.segment4Name}}</span></div>' },
// { name: $translate.instant('ProfitCenterDescription'), width: 200,cellTemplate: '<div class="ui-grid-cell-contents"><span>{{row.entity.segment5Name}}</span></div>' },
......
......@@ -5,27 +5,31 @@
<tr>
<td><span translate="AccountCode"></span></td>
<td>
<div class="input-group">
<input class="form-control " type="text" id="accountCode" placeholder="" ng-model="filterData.accountCode">
<a class="input-group-addon btn btn-sm" ng-click="popTheParentCode()"><i class="fa fa-columns" aria-hidden="true"></i></a>
</div>
</td>
<div class="input-group">
<input class="form-control " type="text" id="accountCode" placeholder=""
ng-model="filterData.accountCode">
</div>
</td>
</tr>
<tr>
<td><span translate="AccountName"></span></td>
<td><input class="form-control " type="text" id="accountName" placeholder="" ng-model="filterData.accountName"></td>
<td><input class="form-control " type="text" id="accountName" placeholder=""
ng-model="filterData.accountName"></td>
</tr>
<tr>
<td><span translate="DebitOpeningBalance"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right;" type="text" id="debitOpeningBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.debitOpeningBalanceFrom">
<input class="form-control input-width-small" style="width: 115px; text-align: right;"
type="text" id="debitOpeningBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.debitOpeningBalanceFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; " type="text" id="debitOpeningBalanceTo" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.debitOpeningBalanceTo">
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="debitOpeningBalanceTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.debitOpeningBalanceTo">
</div>
</td>
</tr>
......@@ -33,9 +37,13 @@
<td><span translate="CreditOpeningBalance"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right; " type="text" id="creditOpeningBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.creditOpeningBalanceFrom">
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="creditOpeningBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.creditOpeningBalanceFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; " type="text" id="creditOpeningBalanceTo" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.creditOpeningBalanceTo">
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="creditOpeningBalanceTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.creditOpeningBalanceTo">
</div>
</td>
</tr>
......@@ -43,9 +51,13 @@
<td><span translate="AccumulatedDebitAmount"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right; " type="text" id="accumulatedDebitAmountFrom" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.accumulatedDebitAmountFrom">
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="accumulatedDebitAmountFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.accumulatedDebitAmountFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; " type="text" id="accumulatedDebitAmountTo" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.accumulatedDebitAmountTo">
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="accumulatedDebitAmountTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.accumulatedDebitAmountTo">
</div>
</td>
</tr>
......@@ -53,9 +65,13 @@
<td><span translate="AccumulatedCreditAmount"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right; " type="text" id="accumulatedCreditAmountFrom" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.accumulatedCreditAmountFrom">
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="accumulatedCreditAmountFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.accumulatedCreditAmountFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; " type="text" id="accumulatedCreditAmountTo" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.accumulatedCreditAmountTo">
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="accumulatedCreditAmountTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.accumulatedCreditAmountTo">
</div>
</td>
</tr>
......@@ -63,9 +79,13 @@
<td><span translate="DebitClosingBalance"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right; " type="text" id="debitClosingBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.debitClosingBalanceFrom">
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="debitClosingBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.debitClosingBalanceFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; " type="text" id="debitClosingBalanceTo" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.debitClosingBalanceTo">
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="debitClosingBalanceTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.debitClosingBalanceTo">
</div>
</td>
</tr>
......@@ -73,9 +93,13 @@
<td><span translate="CreditClosingBalance"></span></td>
<td>
<div>
<input class="form-control input-width-small" style="width: 115px; text-align: right;" type="text" id="creditClosingBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.creditClosingBalanceFrom">
<input class="form-control input-width-small" style="width: 115px; text-align: right;"
type="text" id="creditClosingBalanceFrom" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.creditClosingBalanceFrom">
-
<input class="form-control input-width-small" style="width: 115px; text-align: right; " type="text" id="creditClosingBalanceTo" ng-keyup="PWC.inputNumberFormat(this);" placeholder="" ng-model="filterData.creditClosingBalanceTo">
<input class="form-control input-width-small" style="width: 115px; text-align: right; "
type="text" id="creditClosingBalanceTo" ng-keyup="PWC.inputNumberFormat(this);"
placeholder="" ng-model="filterData.creditClosingBalanceTo">
</div>
</td>
</tr>
......@@ -92,7 +116,7 @@
<button class="btn btn-default" style="margin-right:15px" type="button" ng-click="doDataFilterReset()">
<span class="fa fa-times" aria-hidden="true"> </span> <span translate="Reset"></span>
</button>
</div>
</div>
</div>
......
vatModule.controller('citCalculateDataController', ['$scope', '$log', '$timeout','$interval', '$q', '$translate', 'loginContext',
'apiInterceptor', 'Upload', 'dataImportService', 'SweetAlert', 'vatReductionService', 'vatSessionService', 'uiGridConstants',
'enums', 'modelConfigurationService', 'citReportService', 'vatCommonService', 'BSPLService', 'vatOperationLogService',
'vatWorkflowService',
function ($scope, $log, $timeout, $interval, $q, $translate, loginContext, apiInterceptor, Upload, dataImportService, SweetAlert,
vatReductionService, vatSessionService, uiGridConstants, enums, modelConfigurationService, citReportService, vatCommonService
, BSPLService, vatOperationLogService, vatWorkflowService) {
'use strict';
$log.debug('citCalculateDataController.ctor()...');
var taskList = [];
var fixedRef = [];
$scope.period = 0;
$scope.moduleid = enums.vatModuleEnum.Import_CalculateData;
var initTasks = function () {
debugger;
var task = function (id, status, name,code) {
this.id = id;
this.name = _.isEmpty(name) ? $translate.instant(id) : name;
this.status = status;
this.text = $translate.instant(status);
this.code = code;
};
task.prototype.doTask = function () {
var _this = this;
switch (_this.id) {
case 'GenerateStdTb':
//$q.all().then(function () {
// var data = { result: true };
// updateProgress(data, _this);
//}, function () {
// taskError(_this);
//});
// vatReductionService.submitAccountMappingNoLoading(enums.vatReMapType.ReMapVoucher, enums.vatReMapType.ReMapCust).success(function (data) {
// updateProgress(data, _this);
// }).error(function () {
// taskError(_this);
// });
break;
case 'GenerateFinanceReport':
//$q.all().then(function () {
// var data = { result: true };
// updateProgress(data, _this);
//}, function () {
// taskError(_this);
//});
// BSPLService.GenerateBSPLWithoutLoading(vatSessionService.project.id, vatSessionService.month).success(function () {
// var data = { result: true };
// updateProgress(data, _this);
// }).error(function () {
// taskError(_this);
// });
break;
case 'CompareUnbilled':
//$q.all().then(function () {
// var data = { result: true };
// updateProgress(data, _this);
//}, function () {
// taskError(_this);
//});
// vatReductionService.CompareOutputInvoice(vatSessionService.month).success(function (data) {
// data.result = true;
// updateProgress(data, _this);
// }).error(function () {
// taskError(_this);
// });
break;
case 'CaculateUnbilled':
//$q.all().then(function () {
// var data = { result: true };
// updateProgress(data, _this);
//}, function () {
// taskError(_this);
//});
// vatReductionService.CaculateUnbilled(vatSessionService.month, vatSessionService.project).success(function (data) {
// data.result = true;
// updateProgress(data, _this);
// }).error(function () {
// taskError(_this);
// });
break;
case 'CaculateBuildinModel':
//$q.all().then(function () {
// var data = { result: true };
// updateProgress(data, _this);
//}, function () {
// taskError(_this);
//});
modelConfigurationService.getModelResult(vatSessionService.project.id, enums.serviceType.VAT, 0).success(function (data) {
data.result = true;
updateProgress(data, _this);
}).error(function () {
taskError(_this);
});
break;
case 'CollectBuildinModelResult':
//$q.all().then(function () {
// var data = { result: true };
// updateProgress(data, _this);
//}, function () {
// taskError(_this);
//});
modelConfigurationService.migrateModelResult(vatSessionService.project.organizationID, vatSessionService.project.year, vatSessionService.project.id, vatSessionService.project.serviceTypeID).success(function (data) {
data.result = true;
updateProgress(data, _this);
}).error(function () {
taskError(_this);
});
break;
case 'UpdateReportConfig':
//$q.all().then(function () {
// var data = { result: true };
// updateProgress(data, _this);
//}, function () {
// taskError(_this);
// //});
// citReportService.updateConfig(vatSessionService.project.id, true, vatSessionService.month,
// vatSessionService.logUser.id ? vatSessionService.logUser.id : "",
// $scope.isMergeManualDataSource ).success(function (data) {
// var data = {result: true};
// updateProgress(data, _this);
//citReportService.getTemplateReferences(vatSessionService.month).then(function (refData) {
// if (refData && refData.data) {
// // 初始化resolve列表
// var newRefData = _.chain(refData.data).reject(function (x) {
// return _.isEmpty(x.referenceFromTemplateID) || _.isEmpty(x.referenceToTemplateID);
// }).map(function (x) {
// return {
// referFrom: x.referenceFromTemplateID,
// referTo: x.referenceToTemplateID,
// resolved: x.isResolved
// };
// }).value();
// $scope.resolveRef.push.apply($scope.resolveRef, newRefData);
// }
// return $q.when(data);
//}).then(function () {
// updateProgress(data, _this);
//});
// }).error(function () {
//
// taskError(_this);
// });
break;
case 'CalculateKeyValue':
//$q.all().then(function () {
// var data = { result: true };
// updateProgress(data, _this);
//}, function () {
// taskError(_this);
//});
citReportService.calculateKeyValue(vatSessionService.project.id, 0).success(function (data) {
updateProgress(data, _this);
}).error(function () {
taskError(_this);
});
break;
default:
//$q.all().then(function () {
// var data = { result: true };
// updateProgress(data, _this);
//}, function () {
// taskError(_this);
//});
//citReportService.generate(vatSessionService.project.id, _this.id, true, vatSessionService.month, vatSessionService.logUser.ID).success(function (data) {
// updateProgress(data, _this);
//}).error(function () {
// taskError(_this);
//});
if (_.some($scope.resolveRef, function (x) {
return x.referFrom === _this.id || x.referTo === _this.id;
})) {
$q.when().then(function () {
$timeout(function () {
var data = {result: true};
updateProgress(data, _this, false);
}, 2000);
});
}
else {
citReportService.generateAllCitReport(vatSessionService.project.id, true, vatSessionService.logUser.id ? vatSessionService.logUser.id : "").success(function (data) {
updateProgress(data, _this);
}).error(function () {
taskError(_this);
});
}
break;
}
};
task.prototype.name = null;
task.prototype.id = null;
task.prototype.status = null;
task.prototype.text = null;
task.prototype.code =null;
citReportService.getCitTemplate(vatSessionService.project.id, constant.serviceType.CIT).then(function (report) {
debugger;
var result = [];
// result.push({ name: $translate.instant('ProcessData'), items: [new task('GenerateStdTb', 'unstarted')] });
// result.push({ name: $translate.instant('ProcessData'), items: [new task('CompareUnbilled', 'unstarted')] });
// result.push({ name: $translate.instant('ProcessData'), items: [new task('CaculateUnbilled', 'unstarted'), new task('UpdateReportConfig', 'unstarted'), new task('GenerateFinanceReport', 'unstarted')] });
/* var dataValidateItems = [/!*"本期余额表累计数+导入调整表是否等于本期利润表累计数", "本期余额表本期数+导入调整表是否等于本期利润表本期数", "上期利润表本年累进+本期利润表本期数是否等于本期利润表本年累计",*!/ ""];
var dataValidateCode = [/!*'DA001', 'DA002', 'DA003',*!/ ''];*/
//数据配置
result.push({ name: $translate.instant('ProcessData'), items: [new task('UpdateReportConfig', 'unstarted')] });
result[result.length - 1].items.forEach(function (t) { t.seqNo = result.length - 1 });
//数据校验
var reItem = [];
reItem.push( new task(Math.ceil(Math.random()*1000000).toString(), "unstarted","上期导入调整表是否等于本期调整日记账发生额(摘要中包含“调表不调账”关键字)", "DA004"));
result.push({ name: $translate.instant('dataValidate'),isReportTask: true, items : reItem});
fixedRef = [];
if (report && report.data && report.data.data) {
result.push({
name: $translate.instant('GenerateReport'),
isReportTask: true,
items: _.map(report.data.data, function (x) {
return new task(x.templateId, 'unstarted', x.templateName, x.templateCode);
})
});
// 从第二张报表开始添加依赖
for (var i = 1; i < report.data.data.length - 1; i++) {
fixedRef.push({
referFrom: report.data.data[i] && report.data.data[i].templateId,
referTo: report.data.data[i + 1] && report.data.data[i + 1].templateId,
resolved: false
});
}
}
// result.push({ name: $translate.instant('CalculateKeyValue'), items: [new task('CalculateKeyValue', 'unstarted')] });
// result.push({ name: $translate.instant('BuildinModel'), items: [new task('CaculateBuildinModel', 'unstarted')] });
// result.push({ name: $translate.instant('ModelCollection'), items: [new task('CollectBuildinModelResult', 'unstarted')] });
var i = 0;
result.forEach(function (item) {
result[i].items.forEach(function (t) {
t.seqNo = i
});
i++;
taskList = taskList.concat(item.items);
});
$scope.tasks = result;
getInitTaskStatus();
});
};
function doStartCaculate(isMergeManualDataSource) {
$scope.readonly = true;
$scope.resolveRef.length = 0;
$scope.resolveRef.push({
referFrom: 'UpdateReportConfig',
referTo: 'UpdateReportConfig',
resolved: false
}
// , {
// referFrom: 'UpdateReportConfig',
// referTo: 'GenerateFinanceReport',
// resolved: false
// }
);
fixedRef.forEach(function (r) {
$scope.resolveRef.push(angular.copy(r));
});
taskList.forEach(function (t) {
t.status = 'unstarted';
t.text = $translate.instant(t.status);
})
$scope.tasks[0].items.forEach(function (t) {
t.doTask();
t.status = 'processing';
t.text = $translate.instant(t.status);
});
writeLog($translate.instant('startCaculateData'), null);
// $scope.tasks[1].items.forEach(function (t) {
// t.doTask();
// });
}
function doStartCaculate2(isMergeManualDataSource) {
citReportService.generateAllCitReport(vatSessionService.project.id, isMergeManualDataSource, vatSessionService.logUser.id ? vatSessionService.logUser.id : "").success(function (data) {
debugger;
$scope.readonly = true;
if(data && data.result)
updateTasksStatus(data.data);
if(data.data.jobStatus=='Begin'||data.data.jobStatus=='Running'){
if(!$scope.timer)
$scope.timer= $interval(function(){
debugger;
citReportService.getJobStatus(vatSessionService.project.id,0,data.data.id).then(function(result){
if(result.data && result.status == 200){
updateTasksStatus(result.data);
}else{
if($scope.timer)
$interval.cancel($scope.timer);
}
});
},1000);
}
}).error(function (data,status,config,statusText) {
if(status==412){
SweetAlert.error('报表提审中!');
}else if(status == 409){
SweetAlert.error('报表已在处理中!');
}
});
}
function isAllEnd(stepCode,status){
var statusList = JSON.parse(status);
var stepCodes = stepCode.split(",");
}
var startCaculate = function () {
debugger;
var a = vatSessionService.project.projectStatusList;
debugger;
if (vatSessionService.project.projectStatusList[0] >= constant.ProjectStatusEnum.Generated) {
swal({
title: "warning!",
text: $translate.instant('IsConfirmReCalcuate').formatObj({status: vatCommonService.getProjectStautsEnumDesc(vatSessionService.project.projectStatusList[vatSessionService.month])}),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Yes'),
cancelButtonText: $translate.instant('No'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
citReportService.hasManualDataSource(vatSessionService.project.id, 0).then(function (hasManual) {
if (hasManual) {
setTimeout(function () {
swal({
title: "warning!",
text: "是否保留手工数据!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Yes'),
cancelButtonText: $translate.instant('No'),
closeOnConfirm: true,
closeOnCancel: true
},
function (tmpConfirm) {
if (tmpConfirm) {
doStartCaculate(true);
} else {
doStartCaculate(false);
}
});
}, 500);
} else {
doStartCaculate(false);
}
});
} else {
swal.close();
}
});
} else {
doStartCaculate(false);
}
};
var startCaculate2 = function () {
debugger;
var a = vatSessionService.project.projectStatusList;
debugger;
if (vatSessionService.project.projectStatusList[vatSessionService.month] >= constant.ProjectStatusEnum.Generated) {
swal({
title: "warning!",
text: $translate.instant('IsConfirmReCalcuate').formatObj({status: vatCommonService.getProjectStautsEnumDesc(vatSessionService.project.projectStatusList[vatSessionService.month])}),
type: "warning",
showCancelButton: true,
confirmButtonColor: "#dd6b55",
confirmButtonText: $translate.instant('Yes'),
cancelButtonText: $translate.instant('No'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
citReportService.hasManualDataSource(vatSessionService.project.id, vatSessionService.month).then(function (hasManual) {
if (hasManual) {
setTimeout(function () {
swal({
title: "warning!",
text: "是否保留手工数据!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: $translate.instant('Yes'),
cancelButtonText: $translate.instant('No'),
closeOnConfirm: true,
closeOnCancel: true
},
function (isConfirm) {
if (isConfirm) {
doStartCaculate2(true);
} else {
doStartCaculate2(false);
}
});
}, 500);
} else {
doStartCaculate2(false);
}
});
}
else {
swal.close();
}
});
}
else {
doStartCaculate2(false);
}
};
var caculateProgress = function (task) {
var completedCnt = taskList.filter(function (t) {
return (t.status === 'completed' || t.status === 'error');
}).length;
$scope.progress = PWC.round(completedCnt / taskList.length * 100, 0);
if (!_.isEmpty($scope.resolveRef)) {
var resolveTasks = _.where($scope.resolveRef, {referFrom: task.id});
resolveTasks.forEach(function (x) {
x.resolved = true;
});
}
var finish = $scope.tasks[task.seqNo].items.every(function (t) {
return t.status === 'completed' || t.status === 'error';
});
//上一个任务完成
if (finish && task.seqNo < $scope.tasks.length - 1) {
var unstarted = $scope.tasks[task.seqNo + 1].items.every(function (t) {
return t.status === 'unstarted';
});
if (unstarted) {
var readyTasks;
var isGenedAll = false;
var isReport = false;
if (!_.isEmpty($scope.resolveRef)) {
readyTasks = _.reject($scope.tasks[task.seqNo + 1].items, function (t) {
return _.some($scope.resolveRef, function (x) {
if($scope.tasks[task.seqNo + 1].isReportTask)isReport=true;
return !x.resolved && x.referTo === t.id;
});
});
}
else {
readyTasks = $scope.tasks[task.seqNo + 1].items;
if($scope.tasks[task.seqNo + 1].isReportTask)isReport=true;
}
readyTasks.forEach(function (t) {
if(isReport&&!isGenedAll){
t.doTask();
isGenedAll=true;
}
t.status = 'processing';
t.text = $translate.instant(t.status);
});
}
}
//查找任务中剩余子任务进行处理
else {
var unstarted = _.filter($scope.tasks[task.seqNo].items, function (t) {
return t.status === 'unstarted';
});
if (unstarted.length > 0) {
var readyTasks;
if (!_.isEmpty($scope.resolveRef)) {
readyTasks = _.reject(unstarted, function (t) {
return _.some($scope.resolveRef, function (x) {
return !x.resolved && x.referTo === t.id;
});
});
} else {
readyTasks = unstarted;
}
readyTasks.forEach(function (t) {
t.doTask();
t.status = 'processing';
t.text = $translate.instant(t.status);
});
}
}
$scope.readonly = taskList.some(function (t) {
return t.status !== 'completed' && t.status !== 'error';
});
if (!$scope.readonly) {
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Generated
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
}
};
var updateProgress = function (data, task, ifWriteLog) {
if (data && data.result) {
if( $scope.tasks[task.seqNo].isReportTask){
$scope.tasks[task.seqNo].items.forEach(function (t) {
t.status = 'completed';
t.text = $translate.instant(t.status);
});
}else{
task.status = 'completed';
task.text = $translate.instant(task.status);
}
}
else {
task.status = 'error';
task.text = $translate.instant(task.status);
//SweetAlert.error($translate.instant('PleaseContactAdministrator'));
}
caculateProgress(task);
if (ifWriteLog === undefined || ifWriteLog) {
writeLog(task.name, task.text);
}
//sendMessage(task);
};
var taskError = function (task) {
task.status = 'error';
task.text = $translate.instant(task.status);
caculateProgress(task);
writeLog(task.name, task.text);
sendMessage(task);
//SweetAlert.error($translate.instant('PleaseContactAdministrator'));
};
$scope.showOperateLogPop = function () {
$scope.isShowLog = true;
};
var writeLog = function (taskName, status) {
var logDto = {};
logDto.ModuleID = $scope.moduleid;
logDto.CreatorID = vatSessionService.logUser.ID;
logDto.OperationObject = $translate.instant('vatCaculateDataDesc');
logDto.Comment = vatSessionService.project.name + " " + vatSessionService.project.year + "年" + vatSessionService.month + "月";
logDto.Period = vatSessionService.month;
logDto.ID = PWC.newGuid();
logDto.CreateTime = new Date();
logDto.UpdateTime = new Date();
logDto.OperationContent = taskName;
logDto.OperationName = taskName;
logDto.OperationType = enums.vatLogOperationTypeEnum.CalculateData;
logDto.UpdateState = status == null ? '' : status;
vatOperationLogService.addOperationLog(logDto);
};
var updateTasksStatus = function(job){
debugger;
var items = $scope.tasks;
var tasks = JSON.parse(job.status)
if(job.jobStatus == 'End'){
items.forEach(function(item,index){
item.status = 'completed';
item.text = $translate.instant('completed');
});
$scope.tasks[0].items[0].status = 'completed';
$scope.tasks[0].items[0].text= $translate.instant('completed');
if($scope.timer){
$interval.cancel($scope.timer);
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Generated
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
}
}else if(job.jobStatus=='Running'|| job.jobStatus=='Error'){
var updateConfig = tasks[0];
if(updateConfig.status == 'Error'){
$scope.tasks[0].items[0].status = 'error';
}else if(updateConfig.status == 'End'){
$scope.tasks[0].items[0].status = 'completed';
}else if(updateConfig.status == 'Begin'){
$scope.tasks[0].items[0].status = 'processing';
}
$scope.tasks[0].items[0].text= $translate.instant($scope.tasks[0].items[0].status);
/* items.forEach(function(item,index){
tasks.forEach(function(task){
if(task.code==item.code){
if(task.status == 'Error'){
item.status = 'error';
}else if(task.status == 'End'){
item.status = 'completed';
}else if(task.status == 'Begin'){
item.status = 'processing';
}
item.text = $translate.instant(item.status);
}
})
});*/
if(job.jobStatus == 'Error'){
if($scope.timer)$interval.cancel($scope.timer);
}
}
items.forEach(function(item,index){
item.items.forEach(function (_task, index) {
tasks.forEach(function(task){
if(task.code==_task.code){
if(task.status == 'Error'){
_task.status = 'error';
}else if(task.status == 'End'){
_task.status = 'completed';
}else if(task.status == 'Begin'){
_task.status = 'processing';
}
_task.text = $translate.instant(_task.status);
}
})
})
});
}
var getInitTaskStatus = function(){
citReportService.getRunningJob(vatSessionService.project.id,0).then(function (result) {
if(result.data && result.status == 200){
updateTasksStatus(result.data);
if(result.data.jobStatus=='Begin'||result.data.jobStatus=='Running'){
if(!$scope.timer)
debugger;
$scope.timer= $interval(function(){
debugger;
citReportService.getJobStatus(vatSessionService.project.id,0,result.data.id)
.then(function(result){
if(result.data && result.status == 200){
updateTasksStatus(result.data);
}else{
if($scope.timer)
$interval.cancel($scope.timer);
}
});
},1000);
}
}else{
$log.debug("not running job");
}
});
}
var sendMessage = function (task) {
var msgDto = {};
msgDto.projectId = vatSessionService.project.id;
msgDto.NodeDictKey = constant.DictionaryDictKey.DataProcess;
msgDto.TaskDictKey = constant.DictionaryDictKey.WFDataProcess;
msgDto.ExceptionDateTime = new Date();
msgDto.ExceptionMessageDetails = [];
var msgDetailDto = {};
msgDetailDto.PeriodId = 0;
msgDetailDto.ExceptionIssueTitle = constant.WorkflowMessage.Issue;
msgDetailDto.ExceptionIssueValue = constant.WorkflowMessage.ExceptionIssueValue;
msgDetailDto.ProcessDataDtTitle = constant.WorkflowMessage.CalDateTime;
msgDetailDto.ProcessDataDtValue = new Date();
msgDetailDto.ExceptionDetailTitle = constant.WorkflowMessage.MessageDetail;
msgDetailDto.ExceptionDetailValue = task.name + task.text;
msgDto.ExceptionMessageDetails.push(msgDetailDto);
vatWorkflowService.addExceptionMessage(msgDto);
};
(function initialize() {
$scope.readonly = false;
$scope.progress = 0;
$scope.resolveRef = [];
initTasks();
$scope.startCaculate = startCaculate;
$scope.startCaculate2 = startCaculate2;
$scope.$on('$destroy',function(){
if($scope.timer)$interval.cancel($scope.timer);
});
})();
}
]);
\ No newline at end of file
<div id="cit-calculate-data">
<div class="cit-calculate-data-title" ng-if="tasks.length > 0">
<!--<span translate="vatCaculateDataDesc"></span>-->
<!--<button class="btn btn-vat-primary" translate="startCaculateData" ng-disabled="readonly" ng-click="startCaculate()"></button>-->
<button class="btn btn-vat-primary" translate="startCaculateData" ng-disabled="readonly" ng-click="startCaculate2()"></button>
<span ng-click="showOperateLogPop()"><i class="fa fa-file-excel-o" aria-hidden="true"></i>{{'Remarks' | translate}}</span>
</div>
<!--<div class="vat-caculate-data-progress progress progress-striped active">
<div class="progress-bar progress-bar-warning" role="progressbar"
aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"
ng-style="{width:progress+'%'}">
<span>{{progress}}</span>
</div>
</div>-->
<div class="vat-caculate-data-progress">
<div class="Bar" ng-style="{width:progress+'%'}">
<div>{{progress}}%</div>
</div>
</div>
<div class="vat-caculate-data-list">
<perfect-scrollbar class="scroller" wheel-propagation="true" wheel-speed="1" min-scrollbar-length="20">
<div ng-repeat="group in tasks" ng-include="'group_template'" />
</perfect-scrollbar>
</div>
<script type="text/ng-template" id="group_template">
<div>
<div ng-if="group.items.length >= 1" class="task" style="margin-bottom:5px;padding-left:20px;">{{group.name}}</div>
<ul ng-if="group.items.length >= 1" ng-repeat="task in group.items track by $index">
<li ng-include="'task_template'" />
</ul>
<!-- <div ng-if="group.items.length == 1" ng-repeat="task in group.items track by $index" style="height:42px;" ng-include="'task_template'" />-->
</script>
<script type="text/ng-template" id="task_template">
<div class="task">
<span>{{task.name}}</span>
<span ng-if="task.status == 'unstarted'">{{task.text}}</span>
<span ng-if="task.status == 'unstarted'" style="align-content:center;"><i class="fa fa-hourglass-o" aria-hidden="true" style="font-size:18px;"></i></span>
<span ng-if="task.status == 'completed'">{{task.text}}</span>
<span ng-if="task.status == 'completed'" style="align-content:center;"><i class="fa fa-check" aria-hidden="true" style="color:#73BF00;font-size:28px;"></i></span>
<span ng-if="task.status == 'processing'">{{task.text}}</span>
<!--<span ng-if="task.status == 'processing'" class='loader--audioWave' />-->
<span ng-if="task.status == 'processing'" class='load' style="align-content:center;">
<span class="rect1"></span>
<span class="rect2"></span>
<span class="rect3"></span>
<span class="rect4"></span>
<spanmoduleType class="rect5"></spanmoduleType>
<!--<img src="/app-resources/images/loading.gif" alt="loading...">-->
</span>
<span ng-if="task.status == 'error'" style="color:red;">{{task.text}}</span>
<span ng-if="task.status == 'error'" style="color:red;align-content:center;"><i class="fa fa-times" aria-hidden="true" style="color:red;font-size:28px;"></i></span>
</div>
</script>
<vat-operate-log period="period" module-type="moduleid" is-show="isShowLog"></vat-operate-log>
</div>

vatModule.directive('citCalculateData', ['$log',
function ($log) {
'use strict';
$log.debug('citCalculateData.ctor()...');
return {
restrict: 'E',
templateUrl: '/app/cit/reduction/cit-calculate-data/cit-calculate-data.html' + '?_=' + Math.random(),
replace: true,
scope: {},
controller: 'citCalculateDataController',
link: function ($scope, $element, $attr) {
$scope.token = $('input[name="__RequestVerificationToken"]').val();
}
};
}
]);
\ No newline at end of file
@import "~/app-resources/less/theme.less";
#cit-calculate-data {
width: 100%;
height: 100%;
padding: 0 10px;
position: relative;
background-color: @color-white;
.cit-calculate-data-title {
margin: 20px 0;
height: 30px;
line-height: 30px;
vertical-align: middle;
/*
span {
font-weight: bold;
}
*/
button {
background-color: @color-deep-red;
color: @color-white;
}
span {
float: right;
margin: 0 0 20px 0;
cursor: pointer;
}
}
.vat-caculate-data-progress {
width: 100%;
border: 1px solid @color-light-gray;
border-radius: 8px;
height: 16px;
text-align: center;
line-height: 16px;
font-weight: bold;
color: #fff;
overflow: hidden;
.Bar {
width: 50%;
height: 16px;
background: @color-red;
}
}
.vat-caculate-data-list {
height: calc(~"100% - 100px");
width: 100%;
margin: 10px 0;
padding: 0 5px;
overflow-y: auto;
font-weight: bold;
font-size: 14px;
.scroller {
/*white-space: pre-line;*/
overflow-y: hidden;
position: relative;
height: 100%;
}
.task {
width: 100%;
height: 40px;
line-height: 40px;
vertical-align: middle;
border-bottom: 1px solid @color-light-gray;
> span:first-child {
margin-left: 20px;
width:auto;
float: left;
}
> span {
float: right;
margin-right: 20px;
width: 80px;
height: 39px;
line-height: 39px;
vertical-align: middle;
align-content:center;
}
}
li {
list-style: none;
img {
width: 28px;
height: 28px;
}
}
.loader--audioWave {
width: 3em;
height: 2em;
background: linear-gradient(@color-orange, @color-orange) 0 50%, linear-gradient(@color-orange, @color-orange) 0.625em 50%, linear-gradient(@color-orange, @color-orange) 1.25em 50%, linear-gradient(@color-orange, @color-orange) 1.875em 50%, linear-gradient(@color-orange, @color-orange) 2.5em 50%;
background-repeat: no-repeat;
background-size: 0.5em 0.25em, 0.5em 0.25em, 0.5em 0.25em, 0.5em 0.25em, 0.5em 0.25em;
animation: audioWave 1.5s linear infinite;
}
@keyframes audioWave {
25% {
background: linear-gradient(#FFD700, #FFD700) 0 50% 0.5em 2em, linear-gradient(@color-orange, @color-orange) 0.625em 50%, linear-gradient(@color-orange, @color-orange) 1.25em 50%, linear-gradient(@color-orange, @color-orange) 1.875em 50%, linear-gradient(@color-orange, @color-orange) 2.5em 50%;
background-repeat: no-repeat;
background-size: 0.5em 100%, 0.5em 0.25em, 0.5em 0.25em, 0.5em 0.25em, 0.5em 0.25em;
}
37.5% {
background: linear-gradient(@color-orange, @color-orange) 0 50%, linear-gradient(#FFD700, #FFD700) 0.625em 50%, linear-gradient(@color-orange, @color-orange) 1.25em 50%, linear-gradient(@color-orange, @color-orange) 1.875em 50%, linear-gradient(@color-orange, @color-orange) 2.5em 50%;
background-repeat: no-repeat;
background-size: 0.5em 0.25em, 0.5em 100%, 0.5em 0.25em, 0.5em 0.25em, 0.5em 0.25em;
}
50% {
background: linear-gradient(@color-orange, @color-orange) 0 50%, linear-gradient(@color-orange, @color-orange) 0.625em 50%, linear-gradient(#FFD700, #FFD700) 1.25em 50%, linear-gradient(@color-orange, @color-orange) 1.875em 50%, linear-gradient(@color-orange, @color-orange) 2.5em 50%;
background-repeat: no-repeat;
background-size: 0.5em 0.25em, 0.5em 0.25em, 0.5em 100%, 0.5em 0.25em, 0.5em 0.25em;
}
62.5% {
background: linear-gradient(@color-orange, @color-orange) 0 50%, linear-gradient(@color-orange, @color-orange) 0.625em 50%, linear-gradient(@color-orange, @color-orange) 1.25em 50%, linear-gradient(#FFD700, #FFD700) 1.875em 50%, linear-gradient(@color-orange, @color-orange) 2.5em 50%;
background-repeat: no-repeat;
background-size: 0.5em 0.25em, 0.5em 0.25em, 0.5em 0.25em, 0.5em 100%, 0.5em 0.25em;
}
75% {
background: linear-gradient(@color-orange, @color-orange) 0 50%, linear-gradient(@color-orange, @color-orange) 0.625em 50%, linear-gradient(@color-orange, @color-orange) 1.25em 50%, linear-gradient(@color-orange, @color-orange) 1.875em 50%, linear-gradient(#FFD700, #FFD700) 2.5em 50%;
background-repeat: no-repeat;
background-size: 0.5em 0.25em, 0.5em 0.25em, 0.5em 0.25em, 0.5em 0.25em, 0.5em 100%;
}
}
.load {
width: 4em;
height: 2em;
> span {
background-color: @color-red;
width: 0.5em;
height: 2em;
display: inline-block;
transform: scaleY(0.125);
animation: stretchdelay 1.5s linear infinite;
}
.rect2 {
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}
.rect3 {
-webkit-animation-delay: 0.6s;
animation-delay: 0.6s;
}
.rect4 {
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}
.rect5 {
-webkit-animation-delay: 1.0s;
animation-delay: 1.0s;
}
}
@keyframes stretchdelay {
20% {
transform: scaleY(1.0);
-webkit-transform: scaleY(1.0);
background-color: @color-yellow;
}
0%, 40%, 100% {
transform: scaleY(0.125);
-webkit-transform: scaleY(0.125);
}
}
}
}
webservices.factory('citReportService', ['$q', '$log', '$http', '$translate', 'apiConfig', 'enums', 'SweetAlert', 'vatOperationLogService',
'vatSessionService',
function ($q, $log, $http, $translate, apiConfig, enums, SweetAlert, vatOperationLogService, vatSessionService) {
'use strict';
$log.debug('vatReportService.ctor()...');
return {
// 修改保存机制后,需要添加缓存机制的方法:
// addCellManualData,并添加了一个日志参数
// deleteCellVoucher
// deleteCellInvoice
// deleteCellDatasource
// addDataSource
// addDataSourceItems
// updateDataSourceAmount
// 移除了CalculateSingleCellFormula
// 新增了updateReportCellValue
// For CIT:
// 新增了citGenerateByType
//CIT Remove(可以直接使用vat已有的):
// citGetStdAccountByIndustryID: function (industryID)
// citGenerate: function (projectId, templateId, param?, generator)
// citGetReportData: function (reportId)
// citGetCellVoucher: function (cellDataID)
// citGetCellInvoice: function (cellDataID, invoiceType)
// citAddCellManualData: function (mauanlData)
// citAddDataSource: function (dataSource)
// citAddDataSourceItems: function (dataSource)
// citDeleteCellVoucher: function (voucherId, datasourceId)
// citDeleteCellInvoice: function (invoiceId, datasourceId)
// citDeleteCellDatasource: function(datasourceID,cellID)
// citGetAllDataItems: function (dataSourceType)
// citGetCellAccountRange: function (reportTemplateId, period, rowIndex, columnIndex)
// citGetCellTemplateConfig: function (reportTemplateId, period, rowIndex, columnIndex)
// citUpdateCellAccountRangeAndSummary: function (cellTemplateId, period?, value, operation)
// citUpdateDataSourceAmount: function (datasourceId, amount)
//CIT Update(带问号参数为修改的参数,目前对于申报表可以直接传null,对于BSPL如果调用到这些API需要传period):
// citUpdateConfig: function (projectId, period?)
// citGetTemplate: function (projectId, period?)
updateConfig: function (projectId, ifDeleteManualDataSource, period, generator, isMergeManualDataSource) {
return $http.post('/Report/updateConfig/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator+ '&mergeManual='+isMergeManualDataSource, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
generate: function (projectId, templateId, ifDeleteManualDataSource, period, generator) {
return $http.post('/Report/generate/' + projectId + '/' + templateId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
generateAllCitReport: function (projectId, isMergeManualDataSource, generator) {
return $http.post('/citReport/generateByTotal/' + projectId + '/' + isMergeManualDataSource + '?generator=' + generator , {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
getRunningJob: function (projectId, period) {
return $http.get('/Report/getRunningJob/' + projectId+'/'+period, apiConfig.createVat());
},
getJobStatus: function (projectId, period, jobId) {
return $http.get('/Report/getJobStatus/' + projectId +'/'+ period +'/'+ jobId, apiConfig.createVat({ignoreLoadingBar: true}));
},
getReportData: function (reportId) {
return $http.get('/Report/reportData/' + reportId, apiConfig.createVat());
},
calculateKeyValue: function (projectId, period) {
return $http.post('/Report/calculateKeyValue/' + projectId + '/' + period, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
//CalculateSingleCellFormula: function (cellId) {
// return $http.get('/Report/formulaDataSource/byCell/' + cellId, apiConfig.createVat());
//},
updateReportCellValue: function (cellDataList, reportId, generator) {
return $http.post('/Report/updateReportCellValue/' + reportId + '?generator=' + generator, cellDataList, apiConfig.createVat());
},
getCitTemplate: function (projectId, serviceType) {
return $http.get('/citReport/citTemplate/' + projectId + '/' + serviceType, apiConfig.createVat());
},
getFilterTemplate: function (projectId, serviceType, period) {
if (!_.isNumber(period)) {
period = 0;
}
return $http.get('/Report/filterTemplate/' + projectId + '/' + serviceType + '/' + period, apiConfig.createVat());
},
getCellVoucher: function (cellDataID) {
return $http.get('/Report/cellVoucher/' + cellDataID, apiConfig.createVat());
},
getCellInvoice: function (cellDataID, invoiceType) {
return $http.get('/Report/cellInvoice/' + cellDataID + '/' + invoiceType, apiConfig.createVat());
},
addCellManualData: function (manualData, logInfo) {
return $http.post('/Report/addCellManualData', manualData, apiConfig.createVat()).then(function (data) {
logInfo.UpdateState = $translate.instant('ManualInputSuccess');
vatOperationLogService.addOperationLog(logInfo);
data.dataSourceType = enums.cellDataSourceType.KeyIn;
return $q.when(data);
},function (data) {
logInfo.UpdateState = $translate.instant('ManualInputFail');
SweetAlert.error($translate.instant('PleaseContactAdministrator'));
return vatOperationLogService.addOperationLog(logInfo);
});
},
deleteCellVoucher: function (voucherId, datasourceId) {
return $http.post('/Report/deleteCellVoucher/' + voucherId + '/' + datasourceId, {}, apiConfig.createVat());
},
deleteCellInvoice: function (invoiceId, datasourceId) {
return $http.post('/Report/deleteCellInvoice/' + invoiceId + '/' + datasourceId, {}, apiConfig.createVat());
},
deleteCellDatasource: function (datasourceID, cellID) {
return $http.post('/Report/deleteCellDatasource/' + datasourceID + '/' + cellID, {}, apiConfig.createVat());
},
getAllDataItems: function (dataSourceType) {
return $http.get('/Report/getAllDataItems/' + dataSourceType, apiConfig.createVat())
},
addDataSource: function (dataSource) {
return $http.post('/Report/addDataSource', dataSource, apiConfig.createVat());
},
addDataSourceItems: function (dataSource) {
return $http.post('/Report/addDataSourceItems', dataSource, apiConfig.createVat());
},
getCellAccountRange: function (reportTemplateId, period, rowIndex, columnIndex) {
if (!_.isNumber(period)) {
period = 0;
}
return $http.get('/Report/getCellAccountRange/' + reportTemplateId + '/' + period + '/' + rowIndex + '/' + columnIndex, apiConfig.createVat());
},
getCellTemplateConfig: function (reportTemplateId, period, rowIndex, columnIndex) {
if (!_.isNumber(period)) {
period = 0;
}
return $http.get('/Report/getCellTemplateConfig/' + reportTemplateId + '/' + period + '/' + rowIndex + '/' + columnIndex, apiConfig.createVat());
},
updateCellAccountRangeAndSummary: function (cellTemplateId, period, value, operation) {
if (!_.isNumber(period)) {
period = 0;
}
return $http.post('/Report/updateCellAccountRangeAndSummary/' + cellTemplateId + '/' + period + '/' + value + '/' + operation, {}, apiConfig.createVat());
},
updateDataSourceAmount: function (datasourceId, amount) {
return $http.post('/Report/updateDataSourceAmount/' + datasourceId + '/' + amount, {}, apiConfig.createVat());
},
getStdAccountByIndustryID: function (industryID) {
return $http.get('/Report/getStdAccountByIndustry/' + industryID, apiConfig.createVat());
},
getTemplateReferences: function (period) {
return $http.get('/Report/templateReferences/' + period, apiConfig.createVat());
},
citTryGenerateDocList: function (projectId, serviceType, generator) {
return $http.post('/Report/citTryGenerateDocList/' + projectId + '/' + serviceType + '?generator=' + generator, {}, apiConfig.createVat());
},
citUpdateConfig: function (projectId, ifDeleteManualDataSource, period, generator) {
if (!_.isNumber(period)) {
period = 0;
}
return $http.post('/Report/citUpdateConfig/' + projectId + '/' + ifDeleteManualDataSource + '/' + period + '?generator=' + generator, {}, apiConfig.createVat({ignoreLoadingBar: true}));
},
citGeneratePrepay: function (projectId, ifDeleteManualDataSource, period, generator) {
return $http.post('/Report/citGenerate/byTotal/' + projectId + '/' + ifDeleteManualDataSource + '/' + 0
// 暂时将生成预缴表的period设置为0,等待完成新的预缴表生成逻辑 + period
+ '/' + enums.reportType.prepay
+ '?generator=' + generator, {}, apiConfig.createVat({ ignoreLoadingBar: true }));
},
citGenerateByType: function (projectId, ifDeleteManualDataSource, reportType, generator) {
var paramStr = '';
if (_.isNumber(reportType)) {
paramStr = '/' + reportType;
}
return $http.post('/Report/citGenerate/byTotal/' + projectId + '/' + ifDeleteManualDataSource + '/0' + paramStr + '?generator=' + generator, {}, apiConfig.createVat({ ignoreLoadingBar: true }));
},
citGetTemplate: function (projectId, period) {
if (!_.isNumber(period)) {
period = 0;
}
return $http.get('/Report/citTemplate/' + projectId + '/' + period, apiConfig.createVat());
},
citGetTemplateTree: function (projectId) {
return $http.get('/Report/citTemplateTree/' + projectId, apiConfig.createVat());
},
vatGetTemplateTree: function (projectId, period, serviceType) {
return $http.get('/Report/vatTemplateTree/' + projectId + '/' + period + '/' + serviceType, apiConfig.createVat());
},
citCalculateKeyValue: function (projectId, reportType) {
var reportTypeParam = '';
if (_.isNumber(reportType)) {
reportTypeParam = '/' + reportType;
}
return $http.post('/Report/citCalculateKeyValue/' + projectId + '/0' + reportTypeParam, {}, apiConfig.createVat({ ignoreLoadingBar: true }));
},
getReportByTemplateId: function (templateId, period) {
if (!_.isNumber(period)) {
period = 0;
}
return $http.get('/Report/report/' + templateId + '/' + period, apiConfig.createVat());
},
getDataSourceDetailList: function (dataSourceId) {
return $http.get('/Report/getDataSourceDetailList/' + dataSourceId, apiConfig.createVat());
},
hasManualDataSource: function (projectId, period) {
return $http.get('/Report/hasManualDataSource/' + projectId+ '/' +period, apiConfig.createVat());
},
loadAttachList : function(activeSheet){
return $http.post('/Report/loadAttachList' , activeSheet, apiConfig.createVat());
},
deleteAttach : function(id){
var config = { isBusyRequest: true };
return $http.get('/Report/deleteAttach?id=' + id, apiConfig.create(config));
}
};
}]);
\ 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