Commit 5ace3d48 authored by frank.xa.zhang's avatar frank.xa.zhang

add code for jxfpmx, not finish yet

parent e1f76cee
package pwc.taxtech.atms.vat.service.impl.report.functions; package pwc.taxtech.atms.vat.service.impl.report.functions;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.OperationEvaluationContext; import org.apache.poi.ss.formula.OperationEvaluationContext;
import org.apache.poi.ss.formula.eval.NumberEval; import org.apache.poi.ss.formula.eval.NumberEval;
import org.apache.poi.ss.formula.eval.ValueEval; import org.apache.poi.ss.formula.eval.ValueEval;
import org.apache.poi.ss.formula.functions.FreeRefFunction; import org.apache.poi.ss.formula.functions.FreeRefFunction;
import pwc.taxtech.atms.constant.Constant;
import java.math.BigDecimal;
/// <summary> /// <summary>
...@@ -35,6 +39,32 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction { ...@@ -35,6 +39,32 @@ public class JXFPMX extends FunctionBase implements FreeRefFunction {
+ amountType + "," + period + ")"; + amountType + "," + period + ")";
logger.debug(formulaExpression); logger.debug(formulaExpression);
int curYear = formulaContext.getYear();
int[] yearOffSet = {};
period = getPeriod(period, yearOffSet);
curYear = curYear + yearOffSet[0];
BigDecimal taxRateVal;
if (taxRate.equals(Constant.Other)) {
taxRateVal = new BigDecimal("-1");
} else if (!taxRate.endsWith("%")) {
if (taxRate.equals("99")) {
taxRateVal = new BigDecimal("99");
} else {
return NumberEval.ZERO;
}
} else {
taxRate = StringUtils.removeEnd(taxRate, "%");
try {
taxRateVal = new BigDecimal(Double.parseDouble(taxRate));
} catch (NumberFormatException ex) {
return NumberEval.ZERO;
}
taxRateVal = taxRateVal.divide(new BigDecimal("100"), 2, BigDecimal.ROUND_HALF_UP);
}
return NumberEval.ZERO; return NumberEval.ZERO;
......
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