Commit 6e55d634 authored by eddie.woo's avatar eddie.woo

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

parents e39ec0d6 15c40587
...@@ -68,26 +68,25 @@ public class PSUM extends FunctionBase implements FreeRefFunction { ...@@ -68,26 +68,25 @@ public class PSUM extends FunctionBase implements FreeRefFunction {
ValueEval eval = evaluator.evaluate(ec.getWorkbook().getSheet(ec.getSheetIndex()) ValueEval eval = evaluator.evaluate(ec.getWorkbook().getSheet(ec.getSheetIndex())
.getCell(pCell.rowIndex - 1, pCell.columnIndex - 1)); .getCell(pCell.rowIndex - 1, pCell.columnIndex - 1));
List<CellTemplatePerGroupDto> cellTemplateDataList = agent.getCellTemplateGroupDto(formulaContext.getReportTemplateGroupId(), List<CellTemplatePerGroupDto> cellTemplateDataList = agent.getCellTemplateGroupDto(formulaContext.getReportTemplateGroupId(),
formulaContext.getProjectId(), ec.getWorkbook().getSheetName(ec.getSheetIndex()), pCell.rowIndex-1, formulaContext.getProjectId(), ec.getWorkbook().getSheetName(ec.getSheetIndex()), pCell.rowIndex - 1,
pCell.columnIndex-1, formulaContext.getPeriod()); pCell.columnIndex - 1, formulaContext.getPeriod());
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);
List<PeriodDataSource> dss = agent.queryManualDataSource(Long.parseLong(cellTemplateData.getCellTemplateId()), List<PeriodDataSource> dss = agent.queryManualDataSource(Long.parseLong(cellTemplateData.getCellTemplateId()),
formulaContext.getProjectId(), formulaContext.getPeriod()); formulaContext.getProjectId(), formulaContext.getPeriod());
BigDecimal cellValue = new BigDecimal(0); BigDecimal cellValue = new BigDecimal(0);
if (eval instanceof ErrorEval || eval == null || eval instanceof BlankEval) { if (eval instanceof ErrorEval || eval == null || eval instanceof BlankEval) {
LOGGER.warn("[PSUM_Exception] error eval for pcell {} and error code {} and error String {}", pCell.toString(), LOGGER.warn("[PSUM_Exception] error eval for pcell {} and error code {} and error String {}", pCell.toString(),
((ErrorEval) eval).getErrorCode(), ((ErrorEval) eval).getErrorString()); ((ErrorEval) eval).getErrorCode(), ((ErrorEval) eval).getErrorString());
if (!dss.isEmpty()) cellValue=dss.get(0).getAmount(); if (!dss.isEmpty()) cellValue = dss.get(0).getAmount();
} else { } else {
String evalStr = OperandResolver.coerceValueToString(eval); String evalStr = OperandResolver.coerceValueToString(eval);
logger.debug("[PSUM_debug] eval other cell value {}", evalStr); logger.debug("[PSUM_debug] eval other cell value {}", evalStr);
try { try {
cellValue = new BigDecimal(evalStr).setScale(4, cellValue = new BigDecimal(evalStr);
BigDecimal.ROUND_HALF_DOWN);
if (!dss.isEmpty()) if (!dss.isEmpty())
cellValue = cellValue.add(dss.get(0).getAmount()); cellValue = cellValue.add(dss.get(0).getAmount());
} catch (Exception e) { } catch (Exception e) {
...@@ -98,17 +97,17 @@ public class PSUM extends FunctionBase implements FreeRefFunction { ...@@ -98,17 +97,17 @@ public class PSUM extends FunctionBase implements FreeRefFunction {
} }
ReportCellDataSourceDto dto = new ReportCellDataSourceDto(); ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
dto.fixedWithGroup(cellTemplateData ); dto.fixedWithGroup(cellTemplateData);
dto.setAmount(cellValue); dto.setAmount(cellValue);
dto.setPeriod(formulaContext.getPeriod()); dto.setPeriod(formulaContext.getPeriod());
dto.setProjectId(formulaContext.getProjectId()); dto.setProjectId(formulaContext.getProjectId());
dto.setReportName(cellTemplateData.getReportCode()); dto.setReportName(cellTemplateData.getReportCode());
dataSource.add(dto); dataSource.add(dto);
bigDecimal=bigDecimal.add(cellValue); bigDecimal = bigDecimal.add(cellValue);
} }
return bigDecimal; return bigDecimal.setScale(4, BigDecimal.ROUND_HALF_DOWN);
} }
public static class PCell { public static class PCell {
......
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