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 {
ValueEval eval = evaluator.evaluate(ec.getWorkbook().getSheet(ec.getSheetIndex())
.getCell(pCell.rowIndex - 1, pCell.columnIndex - 1));
List<CellTemplatePerGroupDto> cellTemplateDataList = agent.getCellTemplateGroupDto(formulaContext.getReportTemplateGroupId(),
formulaContext.getProjectId(), ec.getWorkbook().getSheetName(ec.getSheetIndex()), pCell.rowIndex-1,
pCell.columnIndex-1, formulaContext.getPeriod());
List<CellTemplatePerGroupDto> cellTemplateDataList = agent.getCellTemplateGroupDto(formulaContext.getReportTemplateGroupId(),
formulaContext.getProjectId(), ec.getWorkbook().getSheetName(ec.getSheetIndex()), pCell.rowIndex - 1,
pCell.columnIndex - 1, formulaContext.getPeriod());
MyAsserts.assertNotEmpty(cellTemplateDataList, Exceptions.PSUM_CELL_TEMP_NULL);
CellTemplatePerGroupDto cellTemplateData = cellTemplateDataList.get(0);
List<PeriodDataSource> dss = agent.queryManualDataSource(Long.parseLong(cellTemplateData.getCellTemplateId()),
formulaContext.getProjectId(), formulaContext.getPeriod());
BigDecimal cellValue = new BigDecimal(0);
BigDecimal cellValue = new BigDecimal(0);
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(),
((ErrorEval) eval).getErrorCode(), ((ErrorEval) eval).getErrorString());
if (!dss.isEmpty()) cellValue=dss.get(0).getAmount();
if (!dss.isEmpty()) cellValue = dss.get(0).getAmount();
} else {
String evalStr = OperandResolver.coerceValueToString(eval);
logger.debug("[PSUM_debug] eval other cell value {}", evalStr);
try {
cellValue = new BigDecimal(evalStr).setScale(4,
BigDecimal.ROUND_HALF_DOWN);
cellValue = new BigDecimal(evalStr);
if (!dss.isEmpty())
cellValue = cellValue.add(dss.get(0).getAmount());
} catch (Exception e) {
......@@ -98,17 +97,17 @@ public class PSUM extends FunctionBase implements FreeRefFunction {
}
ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
dto.fixedWithGroup(cellTemplateData );
dto.fixedWithGroup(cellTemplateData);
dto.setAmount(cellValue);
dto.setPeriod(formulaContext.getPeriod());
dto.setProjectId(formulaContext.getProjectId());
dto.setReportName(cellTemplateData.getReportCode());
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 {
......
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