Commit ed2e5e3b authored by neo's avatar neo

[dev] bb formula for refs formual cacls

parent cd15f312
package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.WorkbookEvaluator;
import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.OperandResolver;
import org.apache.poi.ss.formula.eval.StringEval;
import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction;
......@@ -18,6 +20,7 @@ import pwc.taxtech.atms.exception.Exceptions;
import pwc.taxtech.atms.exception.FormulaException;
import pwc.taxtech.atms.vat.entity.CellData;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
......@@ -88,9 +91,12 @@ public class BB extends FunctionBase implements FreeRefFunction {
return returnEval;
} else if (bo.getPeriod().intValue() == 0) {
cellValue = new BigDecimal(ec.getWorkbook().getSheet(ec.getWorkbook().getSheetIndex(bo.getReportCode()))
.getCell(bo.getRowIndex() - 1, bo.getColumnIndex() - 1).getNumericCellValue());
return cellValue;
Field evaluatorField= OperationEvaluationContext.class.getDeclaredField("_bookEvaluator");
evaluatorField.setAccessible(true);
WorkbookEvaluator evaluator=(WorkbookEvaluator)evaluatorField.get(ec);
ValueEval eval=evaluator.evaluate(ec.getWorkbook().getSheet(ec.getWorkbook().getSheetIndex(bo.getReportCode()))
.getCell(bo.getRowIndex() - 1, bo.getColumnIndex() - 1));
return cellValue=new BigDecimal(OperandResolver.coerceValueToDouble(eval));
}
......
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