Commit 3dfd1bb9 authored by eddie.woo's avatar eddie.woo

merge

parents 0ebd6219 b8504a11
...@@ -156,7 +156,7 @@ public class InputInvoiceImportController { ...@@ -156,7 +156,7 @@ public class InputInvoiceImportController {
inputInvoiceDetailExportDto.setAmount(inputInvoiceDetail.getJE() != null ? new BigDecimal(inputInvoiceDetail.getJE().replace(",","")) : BigDecimal.ZERO); inputInvoiceDetailExportDto.setAmount(inputInvoiceDetail.getJE() != null ? new BigDecimal(inputInvoiceDetail.getJE().replace(",","")) : BigDecimal.ZERO);
inputInvoiceDetailExportDto.setInvoiceCode(inputInvoiceDetail.getFPDM()); inputInvoiceDetailExportDto.setInvoiceCode(inputInvoiceDetail.getFPDM());
inputInvoiceDetailExportDto.setInvoiceNumber(inputInvoiceDetail.getFPHM()); inputInvoiceDetailExportDto.setInvoiceNumber(inputInvoiceDetail.getFPHM());
inputInvoiceDetailExportDto.setPeriodId(Integer.parseInt(item.getRZSJ().substring(5, 7))); inputInvoiceDetailExportDto.setPeriodId(Integer.parseInt(item.getRZSQ().substring(4, 6)));
inputInvoiceDetailExportDto.setProductionName(inputInvoiceDetail.getSPMC()); inputInvoiceDetailExportDto.setProductionName(inputInvoiceDetail.getSPMC());
inputInvoiceDetailExportDto.setTaxAmount(inputInvoiceDetail.getSE() != null ? new BigDecimal(inputInvoiceDetail.getSE().replace(",","")) : BigDecimal.ZERO); inputInvoiceDetailExportDto.setTaxAmount(inputInvoiceDetail.getSE() != null ? new BigDecimal(inputInvoiceDetail.getSE().replace(",","")) : BigDecimal.ZERO);
inputInvoiceDetailExportDto.setTaxRate(inputInvoiceDetail.getSLV()); inputInvoiceDetailExportDto.setTaxRate(inputInvoiceDetail.getSLV());
......
...@@ -104,6 +104,7 @@ public class OutputInvoiceController { ...@@ -104,6 +104,7 @@ public class OutputInvoiceController {
new pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto(); new pwc.taxtech.atms.dto.vatdto.OutputVATInvoiceInfoDto();
d = beanUtil.copyProperties(x,d); d = beanUtil.copyProperties(x,d);
d.setInvoiceTypeName(d.getInvoiceTypeName()); d.setInvoiceTypeName(d.getInvoiceTypeName());
d.setTaxRate(x.getTaxRate().toString() + "%");
list2.add(d); list2.add(d);
}); });
Map<String, String> header = new LinkedHashMap<>(); Map<String, String> header = new LinkedHashMap<>();
...@@ -117,13 +118,13 @@ public class OutputInvoiceController { ...@@ -117,13 +118,13 @@ public class OutputInvoiceController {
header.put("InvoiceDate", "开票日期"); header.put("InvoiceDate", "开票日期");
// header.put("CodeVersion", "商品编码版本号"); // header.put("CodeVersion", "商品编码版本号");
// header.put("DocumentNum", "单据号"); // header.put("DocumentNum", "单据号");
// header.put("ProductName", "商品名称"); header.put("ProductName", "商品名称");
// header.put("ProductStandar", "规格"); // header.put("ProductStandar", "规格");
// header.put("Unit", "单位"); // header.put("Unit", "单位");
// header.put("Quantity", "数量"); header.put("Quantity", "数量");
// header.put("UnitPrice", "单价"); header.put("UnitPrice", "单价");
header.put("Amount", "金额"); header.put("Amount", "金额");
// header.put("TaxRate", "税率"); header.put("TaxRate", "税率");
header.put("TaxAmount", "税额"); header.put("TaxAmount", "税额");
// header.put("TaxClassCode", "税收分类编码"); // header.put("TaxClassCode", "税收分类编码");
......
...@@ -30,7 +30,7 @@ public class OutputVATInvoiceInfoDto { ...@@ -30,7 +30,7 @@ public class OutputVATInvoiceInfoDto {
private Date invoiceDate; private Date invoiceDate;
// @ExcelCell(index=9) // @ExcelCell(index=9)
private String codeVersion; private String codeVersion;
// @ExcelCell(index=11) @ExcelCell(index=7)
private String productName; private String productName;
// @ExcelCell(index=10) // @ExcelCell(index=10)
private String documentNum; private String documentNum;
...@@ -38,15 +38,15 @@ public class OutputVATInvoiceInfoDto { ...@@ -38,15 +38,15 @@ public class OutputVATInvoiceInfoDto {
private String productStandard; private String productStandard;
// @ExcelCell(index=13) // @ExcelCell(index=13)
private String unit; private String unit;
// @ExcelCell(index=14) @ExcelCell(index=8)
private Integer quantity; private Integer quantity;
// @ExcelCell(index=15) @ExcelCell(index=9)
private Double unitPrice; private Double unitPrice;
@ExcelCell(index=7) @ExcelCell(index=10)
private BigDecimal amount; private BigDecimal amount;
// @ExcelCell(index=17) @ExcelCell(index=11)
private BigDecimal taxRate; private String taxRate;
@ExcelCell(index=8) @ExcelCell(index=12)
private BigDecimal taxAmount; private BigDecimal taxAmount;
private String taxClassCode; private String taxClassCode;
@JsonProperty("periodID") @JsonProperty("periodID")
...@@ -194,11 +194,11 @@ public class OutputVATInvoiceInfoDto { ...@@ -194,11 +194,11 @@ public class OutputVATInvoiceInfoDto {
this.amount = amount; this.amount = amount;
} }
public BigDecimal getTaxRate() { public String getTaxRate() {
return taxRate; return taxRate;
} }
public void setTaxRate(BigDecimal taxRate) { public void setTaxRate(String taxRate) {
this.taxRate = taxRate; this.taxRate = taxRate;
} }
......
...@@ -212,7 +212,7 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -212,7 +212,7 @@ public class TemplateGroupServiceImpl extends AbstractService {
templateGroupMapper.insertSelective(templateGroup); templateGroupMapper.insertSelective(templateGroup);
for (int i = 0; i < workbook.getNumberOfSheets(); i++) { for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
String sheetName = workbook.getSheetName(i); String sheetName = workbook.getSheetName(i);
if(!templateGroupDto.getSheetNameList().contains(sheetName)){ if(!sheetNameList.contains(sheetName)){
continue; continue;
} }
String newName = sheetName + CommonUtils.getUUID() + POIUtil.getFileSuffix(fileName).get(); String newName = sheetName + CommonUtils.getUUID() + POIUtil.getFileSuffix(fileName).get();
...@@ -347,6 +347,9 @@ public class TemplateGroupServiceImpl extends AbstractService { ...@@ -347,6 +347,9 @@ public class TemplateGroupServiceImpl extends AbstractService {
int length = templateMapper.selectByExample(t).size(); int length = templateMapper.selectByExample(t).size();
for (int i = 0; i < workbook.getNumberOfSheets(); i++) { for (int i = 0; i < workbook.getNumberOfSheets(); i++) {
String sheetName = workbook.getSheetName(i); String sheetName = workbook.getSheetName(i);
if(!sheetNameList.contains(sheetName)){
continue;
}
String newName = sheetName + CommonUtils.getUUID() + POIUtil.getFileSuffix(fileName).get(); String newName = sheetName + CommonUtils.getUUID() + POIUtil.getFileSuffix(fileName).get();
Sheet sheet = workbook.getSheetAt(i); Sheet sheet = workbook.getSheetAt(i);
Optional<Workbook> optional = POIUtil.cloneNewSheet(sheet, fileName); Optional<Workbook> optional = POIUtil.cloneNewSheet(sheet, fileName);
......
...@@ -518,8 +518,8 @@ public class ReportGeneratorImpl { ...@@ -518,8 +518,8 @@ public class ReportGeneratorImpl {
public void addFunctionsAndContext(Workbook workbook, String[] functions, FormulaContext formulaContext) { public void addFunctionsAndContext(Workbook workbook, String[] functions, FormulaContext formulaContext) {
FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext), FreeRefFunction[] functionImpls = {new SGSR(formulaContext), new FSJZ(formulaContext), new ND(formulaContext),
new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new ProjectContext(formulaContext) new BB(formulaContext), new XXFP(formulaContext), new GZSD(formulaContext), new ProjectContext(formulaContext)
, new JXFPMX(formulaContext), new JXFP(formulaContext), new PSUM(formulaContext), new DFFS(formulaContext), , new JXFPMX(formulaContext), new JXFP(formulaContext), new PSUM(formulaContext) ,new DFFS(formulaContext),
new WPSR(formulaContext)}; new JFFS(formulaContext),new WPSR(formulaContext)};
UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls); UDFFinder udfs = new DefaultUDFFinder(functions, functionImpls);
UDFFinder udfToolpack = new AggregatingUDFFinder(udfs); UDFFinder udfToolpack = new AggregatingUDFFinder(udfs);
workbook.addToolPack(udfToolpack); workbook.addToolPack(udfToolpack);
......
...@@ -51,7 +51,7 @@ public class ReportServiceImpl { ...@@ -51,7 +51,7 @@ public class ReportServiceImpl {
private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class); private final static Logger logger = LoggerFactory.getLogger(ReportServiceImpl.class);
private BlockingQueue<PeriodJob> queue = new LinkedBlockingQueue<>(); private BlockingQueue<PeriodJob> queue = new LinkedBlockingQueue<>();
private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "ProjectContext", "JXFPMX", private final static String[] functions = {"SGSR", "FSJZ", "ND", "BB", "XXFP", "GZSD", "ProjectContext", "JXFPMX",
"JXFP", "PSUM", "DFFS", "WPSR"}; "JXFP", "PSUM", "DFFS","JFFS", "WPSR"};
@Autowired @Autowired
private ReportGeneratorImpl reportGenerator; private ReportGeneratorImpl reportGenerator;
......
...@@ -95,7 +95,8 @@ public class BB extends FunctionBase implements FreeRefFunction { ...@@ -95,7 +95,8 @@ public class BB extends FunctionBase implements FreeRefFunction {
return returnEval; return returnEval;
} else if (bo.getPeriod().intValue() == 0) { } else if (bo.getPeriod().intValue() == 0) {
cellValue = getCellValue(ec, formulaContext, agent, bo.getRowIndex() - 1, bo.getColumnIndex() - 1, int index = ec.getWorkbook().getSheetIndex(bo.getReportCode());
cellValue = getCellValue(index, ec, formulaContext, agent, bo.getRowIndex() - 1, bo.getColumnIndex() - 1,
Long.parseLong(cellTemplateData.getCellTemplateId())); Long.parseLong(cellTemplateData.getCellTemplateId()));
nullCellDto.extractFromGroup(bo, formulaContext.getPeriod(), formulaContext.getYear(), cellTemplateData); nullCellDto.extractFromGroup(bo, formulaContext.getPeriod(), formulaContext.getYear(), cellTemplateData);
......
...@@ -53,12 +53,11 @@ public class DFFS extends FunctionBase implements FreeRefFunction { ...@@ -53,12 +53,11 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
period = FormulaHelper.getPeriod(period, yearOffset, formulaContext); period = FormulaHelper.getPeriod(period, yearOffset, formulaContext);
String orgId = formulaContext.getOrganizationId(); String orgId = formulaContext.getOrganizationId();
year = year + yearOffset; year = year + yearOffset;
Date date = DateUtils.strToDate(year + "-" + period + "-" + 15);
List<ReportCellDataSourceDto> dataSource = Lists.newArrayList(); List<ReportCellDataSourceDto> dataSource = Lists.newArrayList();
if(type == 0){ if(type == 0){
EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample(); EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample();
example.createCriteria().andEffectiveDateLessThanOrEqualTo(date).andExpiredDateGreaterThanOrEqualTo(date).andOrganizationIdEqualTo(orgId); example.createCriteria().andEffectiveDateLessThanOrEqualTo(DateUtils.getNow()).andExpiredDateGreaterThanOrEqualTo(DateUtils.getNow()).andOrganizationIdEqualTo(orgId);
List<EnterpriseAccountSetOrg> enterpriseAccountSetOrgs = SpringContextUtil.enterpriseAccountSetOrgMapper.selectByExample(example); List<EnterpriseAccountSetOrg> enterpriseAccountSetOrgs = SpringContextUtil.enterpriseAccountSetOrgMapper.selectByExample(example);
if(CollectionUtils.isEmpty(enterpriseAccountSetOrgs)){ if(CollectionUtils.isEmpty(enterpriseAccountSetOrgs)){
return NumberEval.ZERO; return NumberEval.ZERO;
...@@ -69,7 +68,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction { ...@@ -69,7 +68,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
double result = 0; double result = 0;
for(AccountMapping a : accountMappings){ for(AccountMapping a : accountMappings){
result += count(a.getEnterpriseAccountCode(), dataSource, period); result += count(a.getEnterpriseAccountCode(), dataSource, period, year);
} }
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.FormulaDataSourceDto, FormulaDataSourceDetailType.FormulaDataSourceDto,
...@@ -79,7 +78,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction { ...@@ -79,7 +78,7 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
return new NumberEval(result); return new NumberEval(result);
} else if(type == 1){ } else if(type == 1){
double result = count(code, dataSource, period); double result = count(code, dataSource, period, year);
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource), Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.FormulaDataSourceDto, FormulaDataSourceDetailType.FormulaDataSourceDto,
new BigDecimal(result), period, formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId()); new BigDecimal(result), period, formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
...@@ -90,10 +89,14 @@ public class DFFS extends FunctionBase implements FreeRefFunction { ...@@ -90,10 +89,14 @@ public class DFFS extends FunctionBase implements FreeRefFunction {
return NumberEval.ZERO; return NumberEval.ZERO;
} }
private double count(String code, List<ReportCellDataSourceDto> contain, int period){ private String periodName(int period, int year){
return year + "-" + (period > 9 ? period : ("0" + period));
}
private double count(String code, List<ReportCellDataSourceDto> contain, int period, int year){
GlBalanceExample glBalanceExample = new GlBalanceExample(); GlBalanceExample glBalanceExample = new GlBalanceExample();
GlBalanceExample.Criteria c1 = glBalanceExample.createCriteria().andSegment3EqualTo(code); GlBalanceExample.Criteria c1 = glBalanceExample.createCriteria().andSegment3EqualTo(code).andPeriodNameEqualTo(periodName(period, year));
GlBalanceExample.Criteria c2 = glBalanceExample.createCriteria().andSegment4EqualTo(code); GlBalanceExample.Criteria c2 = glBalanceExample.createCriteria().andSegment4EqualTo(code).andPeriodNameEqualTo(periodName(period, year));
glBalanceExample.or(c2); glBalanceExample.or(c2);
List<GlBalance> list = SpringContextUtil.glBalanceMapper.selectByExample(glBalanceExample); List<GlBalance> list = SpringContextUtil.glBalanceMapper.selectByExample(glBalanceExample);
if(CollectionUtils.isEmpty(list)){ if(CollectionUtils.isEmpty(list)){
......
...@@ -191,12 +191,12 @@ public class FunctionBase { ...@@ -191,12 +191,12 @@ public class FunctionBase {
SpringContextUtil.periodFormulaBlockMapper.insertSelective(periodFormulaBlock); SpringContextUtil.periodFormulaBlockMapper.insertSelective(periodFormulaBlock);
} }
public static BigDecimal getCellValue(OperationEvaluationContext ec, FormulaContext formulaContext, FormulaAgent agent, public static BigDecimal getCellValue(int index, OperationEvaluationContext ec, FormulaContext formulaContext, FormulaAgent agent,
int rowIndex, int columnIndex, Long cellTemplateId) throws NoSuchFieldException, IllegalAccessException { int rowIndex, int columnIndex, Long cellTemplateId) throws NoSuchFieldException, IllegalAccessException {
Field evaluatorField = OperationEvaluationContext.class.getDeclaredField("_bookEvaluator"); Field evaluatorField = OperationEvaluationContext.class.getDeclaredField("_bookEvaluator");
evaluatorField.setAccessible(true); evaluatorField.setAccessible(true);
WorkbookEvaluator evaluator = (WorkbookEvaluator) evaluatorField.get(ec); WorkbookEvaluator evaluator = (WorkbookEvaluator) evaluatorField.get(ec);
ValueEval eval = evaluator.evaluate(ec.getWorkbook().getSheet(ec.getSheetIndex()).getCell(rowIndex, columnIndex)); ValueEval eval = evaluator.evaluate(ec.getWorkbook().getSheet(index).getCell(rowIndex, columnIndex));
List<PeriodDataSource> dss = agent.queryManualDataSource(cellTemplateId, formulaContext.getProjectId(), formulaContext.getPeriod()); List<PeriodDataSource> dss = agent.queryManualDataSource(cellTemplateId, formulaContext.getProjectId(), formulaContext.getPeriod());
...@@ -208,8 +208,11 @@ public class FunctionBase { ...@@ -208,8 +208,11 @@ public class FunctionBase {
String evalStr = OperandResolver.coerceValueToString(eval); String evalStr = OperandResolver.coerceValueToString(eval);
LOGGER.debug("[Formula_debug] eval other cell value {}", evalStr); LOGGER.debug("[Formula_debug] eval other cell value {}", evalStr);
try { try {
BigDecimal bigDecimal= new BigDecimal(evalStr);
if (!dss.isEmpty()) { if (!dss.isEmpty()) {
return new BigDecimal(evalStr).add(dss.get(0).getAmount()); return bigDecimal.add(dss.get(0).getAmount());
}else {
return bigDecimal;
} }
} catch (Exception e) { } catch (Exception e) {
if (!dss.isEmpty()) if (!dss.isEmpty())
......
package pwc.taxtech.atms.vat.service.impl.report.functions;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
import pwc.taxtech.atms.common.util.DateUtils;
import pwc.taxtech.atms.common.util.SpringContextUtil;
import pwc.taxtech.atms.constant.Constant;
import pwc.taxtech.atms.constant.enums.FormulaDataSourceDetailType;
import pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto;
import pwc.taxtech.atms.entity.AccountMapping;
import pwc.taxtech.atms.entity.AccountMappingExample;
import pwc.taxtech.atms.entity.EnterpriseAccountSetOrg;
import pwc.taxtech.atms.entity.EnterpriseAccountSetOrgExample;
import pwc.taxtech.atms.vat.entity.GlBalance;
import pwc.taxtech.atms.vat.entity.GlBalanceExample;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
public class JFFS extends FunctionBase implements FreeRefFunction {
public JFFS(FormulaContext formulaContext) {
super(formulaContext);
}
@Override
public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec) {
if (args.length < 4) {
return null;
}
int type = getIntParam(args[0], ec);
String code = getStringParam(args[1], ec);
int year = getIntParam(args[2], ec);
int period = getIntParam(args[3], ec);
String formulaExpression = "JFFS(" + type + ",\"" + code + "\","
+ year + "," + period + ")";
logger.debug(formulaExpression);
year = getYear(year);
Integer yearOffset = 0;
period = FormulaHelper.getPeriod(period, yearOffset, formulaContext);
String orgId = formulaContext.getOrganizationId();
year = year + yearOffset;
List<ReportCellDataSourceDto> dataSource = Lists.newArrayList();
if(type == 0){
EnterpriseAccountSetOrgExample example = new EnterpriseAccountSetOrgExample();
example.createCriteria().andEffectiveDateLessThanOrEqualTo(DateUtils.getNow()).andExpiredDateGreaterThanOrEqualTo(DateUtils.getNow()).andOrganizationIdEqualTo(orgId);
List<EnterpriseAccountSetOrg> enterpriseAccountSetOrgs = SpringContextUtil.enterpriseAccountSetOrgMapper.selectByExample(example);
if(CollectionUtils.isEmpty(enterpriseAccountSetOrgs)){
return NumberEval.ZERO;
}
AccountMappingExample accountMappingExample = new AccountMappingExample();
accountMappingExample.createCriteria().andOrganizationIdEqualTo(orgId).andEnterpriseAccountSetIdEqualTo(enterpriseAccountSetOrgs.get(0).getEnterpriseAccountSetId());
List<AccountMapping> accountMappings = SpringContextUtil.accountMappingMapper.selectByExample(accountMappingExample);
double result = 0;
for(AccountMapping a : accountMappings){
result += count(a.getEnterpriseAccountCode(), dataSource, period, year);
}
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.FormulaDataSourceDto,
new BigDecimal(result), period, formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(result), dataSoureId, formulaContext.getProjectId());
return new NumberEval(result);
} else if(type == 1){
double result = count(code, dataSource, period, year);
Long dataSoureId = saveDataSource(ec, Collections.singletonList(dataSource),
FormulaDataSourceDetailType.FormulaDataSourceDto,
new BigDecimal(result), period, formulaContext.getReportTemplateGroupId(), formulaContext.getProjectId());
saveFormulaBlock(period, ec, formulaExpression, new BigDecimal(result), dataSoureId, formulaContext.getProjectId());
return new NumberEval(result);
}
return NumberEval.ZERO;
}
private String periodName(int period, int year){
return year + "-" + (period > 9 ? period : ("0" + period));
}
private double count(String code, List<ReportCellDataSourceDto> contain, int period, int year){
GlBalanceExample glBalanceExample = new GlBalanceExample();
GlBalanceExample.Criteria c1 = glBalanceExample.createCriteria().andSegment3EqualTo(code).andPeriodNameEqualTo(periodName(period, year));
GlBalanceExample.Criteria c2 = glBalanceExample.createCriteria().andSegment4EqualTo(code).andPeriodNameEqualTo(periodName(period, year));
glBalanceExample.or(c2);
List<GlBalance> list = SpringContextUtil.glBalanceMapper.selectByExample(glBalanceExample);
if(CollectionUtils.isEmpty(list)){
return 0.0;
}
List<GlBalance> temp = list.stream().filter(x -> code.equalsIgnoreCase(x.getSegment3())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(temp)){
temp = list;
}
for(GlBalance glBalance : temp){
ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
dto.setAmount(glBalance.getPtdDr());
dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource);
contain.add(dto);
}
return temp.stream().mapToDouble(a -> a.getPtdDr().doubleValue()).sum();
}
}
...@@ -72,7 +72,7 @@ public class PSUM extends FunctionBase implements FreeRefFunction { ...@@ -72,7 +72,7 @@ public class PSUM extends FunctionBase implements FreeRefFunction {
MyAsserts.assertNotEmpty(cellTemplateDataList, Exceptions.PSUM_CELL_TEMP_NULL); MyAsserts.assertNotEmpty(cellTemplateDataList, Exceptions.PSUM_CELL_TEMP_NULL);
CellTemplatePerGroupDto cellTemplateData = cellTemplateDataList.get(0); CellTemplatePerGroupDto cellTemplateData = cellTemplateDataList.get(0);
BigDecimal cellValue = getCellValue(ec, formulaContext, agent, pCell.rowIndex - 1, pCell.columnIndex - 1, BigDecimal cellValue = getCellValue(ec.getSheetIndex(), ec, formulaContext, agent, pCell.rowIndex - 1, pCell.columnIndex - 1,
Long.parseLong(cellTemplateData.getCellTemplateId())); Long.parseLong(cellTemplateData.getCellTemplateId()));
ReportCellDataSourceDto dto = new ReportCellDataSourceDto(); ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
dto.fixedWithGroup(cellTemplateData); dto.fixedWithGroup(cellTemplateData);
...@@ -82,8 +82,8 @@ public class PSUM extends FunctionBase implements FreeRefFunction { ...@@ -82,8 +82,8 @@ public class PSUM extends FunctionBase implements FreeRefFunction {
dto.setProjectId(formulaContext.getProjectId()); dto.setProjectId(formulaContext.getProjectId());
dto.setRowIndex(pCell.rowIndex-1); dto.setRowIndex(pCell.rowIndex-1);
dto.setColumnIndex(pCell.columnIndex-1); dto.setColumnIndex(pCell.columnIndex-1);
dto.setColumnName((pCell.columnIndex-1)+"列"); dto.setColumnName((pCell.columnIndex)+"列");
dto.setRowName((pCell.rowIndex-1)+"行"); dto.setRowName((pCell.rowIndex)+"行");
dto.setReportName(ec.getWorkbook().getSheetName(ec.getSheetIndex())); dto.setReportName(ec.getWorkbook().getSheetName(ec.getSheetIndex()));
dto.setType( FormulaDataSourceType.Report.getCode()); dto.setType( FormulaDataSourceType.Report.getCode());
......
...@@ -6,8 +6,15 @@ ...@@ -6,8 +6,15 @@
$scope.startDate = new Date($scope.project.year, 0, 1); $scope.startDate = new Date($scope.project.year, 0, 1);
$scope.endDate = new Date($scope.project.year, 11, 31); $scope.endDate = new Date($scope.project.year, 11, 31);
$scope.dateFormat = $translate.instant('dateFormat4YearMonthDay'); $scope.dateFormat = $translate.instant('dateFormat4YearMonthDay');
$scope.isReadOnly = false; $scope.isReadOnly = false;
$scope.totalBegDebitBal = 0;
$scope.totalBegCreditBal = 0;
$scope.totalDebitBal = 0;
$scope.totalCreditBal= 0;
$scope.totalEndDebitBal = 0;
$scope.totalEndCreditBal= 0;
var minDate = [1, $scope.project.year]; var minDate = [1, $scope.project.year];
var maxDate = [12, $scope.project.year]; var maxDate = [12, $scope.project.year];
var setDate = [ var setDate = [
...@@ -116,7 +123,7 @@ ...@@ -116,7 +123,7 @@
//************ EXCEL EXPORT FUNCTION ***************/ //************ EXCEL EXPORT FUNCTION ***************/
$scope.$on('ngRepeatFinished', function (ngRepeatFinishedEvent) { $scope.$on('ngRepeatFinished', function (ngRepeatFinishedEvent) {
if ($scope.isToPrint) if ($scope.isToPrint)
export_table_to_excel('exportTable', 'GL', 'xlsx', ''); export_table_to_excel('exportTable', '试算平衡表', 'xlsx', '');
$scope.isToPrint = false; $scope.isToPrint = false;
}); });
...@@ -149,7 +156,20 @@ ...@@ -149,7 +156,20 @@
if (isExportOnly !== null && isExportOnly) { if (isExportOnly !== null && isExportOnly) {
$scope.exportDataList = newTree; $scope.exportDataList = newTree;
_.each($scope.exportDataList, function(exportData){
if(exportData.begDebitBal && parseFloat(exportData.begDebitBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalBegDebitBal += parseFloat(exportData.begDebitBal.replace(/,/g, ""));
if(exportData.begCreditBal && parseFloat(exportData.begCreditBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalBegCreditBal += parseFloat(exportData.begCreditBal.replace(/,/g, ""));
if(exportData.debitBal && parseFloat(exportData.debitBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalDebitBal += parseFloat(exportData.debitBal.replace(/,/g, ""));
if(exportData.creditBal && parseFloat(exportData.creditBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalCreditBal += parseFloat(exportData.creditBal.replace(/,/g, ""));
if(exportData.endDebitBal && parseFloat(exportData.endDebitBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalEndDebitBal += parseFloat(exportData.endDebitBal.replace(/,/g, ""));
if(exportData.endCreditBal && parseFloat(exportData.endCreditBal.replace(/,/g, "")).toString() != "NaN")
$scope.totalEndCreditBal += parseFloat(exportData.endCreditBal.replace(/,/g, ""));
})
} }
else { else {
$scope.gridOptions.data = newTree; $scope.gridOptions.data = newTree;
......
...@@ -108,6 +108,16 @@ ...@@ -108,6 +108,16 @@
<td>{{exportData.endDebitBal}}</td> <td>{{exportData.endDebitBal}}</td>
<td>{{exportData.endCreditBal}}</td> <td>{{exportData.endCreditBal}}</td>
</tr> </tr>
<tr>
<td></td>
<td></td>
<td>{{totalBegDebitBal}}</td>
<td>{{totalBegCreditBal}}</td>
<td>{{totalDebitBal}}</td>
<td>{{totalCreditBal}}</td>
<td>{{totalEndDebitBal}}</td>
<td>{{totalEndCreditBal}}</td>
</tr>
</table> </table>
</div> </div>
<!--For Export ONLY--> <!--For Export ONLY-->
......
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