Commit abf857d5 authored by chase's avatar chase

修复tbm调整表计算bug

parent e3c6ed6c
...@@ -137,32 +137,31 @@ public class TBM extends FunctionBase implements FreeRefFunction { ...@@ -137,32 +137,31 @@ public class TBM extends FunctionBase implements FreeRefFunction {
c1.andOrganizationIdEqualTo(organization.getId()); c1.andOrganizationIdEqualTo(organization.getId());
} }
List<AdjustmentTable> list = SpringContextUtil.adjustmentTableMapper.selectByExample(glBalanceExample); List<AdjustmentTable> list = SpringContextUtil.adjustmentTableMapper.selectByExample(glBalanceExample);
if (CollectionUtils.isEmpty(list)) {
return 0.0;
}
BigDecimal amount = new BigDecimal(0); BigDecimal amount = new BigDecimal(0);
//计算本期发生 if (CollectionUtils.isNotEmpty(list)) {
for (AdjustmentTable balance : list) { //计算本期发生
ReportCellDataSourceDto dto = new ReportCellDataSourceDto(); for (AdjustmentTable balance : list) {
if (eventType == 1) { ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
if (calculateType == 1) { if (eventType == 1) {
dto.setAmount(balance.getPeriodCrBeq().subtract(balance.getPeriodDrBeq())); if (calculateType == 1) {
} else if (calculateType == 2) { dto.setAmount(balance.getPeriodCrBeq().subtract(balance.getPeriodDrBeq()));
dto.setAmount(balance.getPeriodDrBeq().subtract(balance.getPeriodCrBeq())); } else if (calculateType == 2) {
} dto.setAmount(balance.getPeriodDrBeq().subtract(balance.getPeriodCrBeq()));
} else if (eventType == 2) { }
if (calculateType == 1) { } else if (eventType == 2) {
dto.setAmount(balance.getEndBalBeq()); if (calculateType == 1) {
} else if (calculateType == 2) { dto.setAmount(balance.getEndBalBeq());
dto.setAmount(balance.getEndBalBeq().multiply(new BigDecimal(-1))); } else if (calculateType == 2) {
dto.setAmount(balance.getEndBalBeq().multiply(new BigDecimal(-1)));
}
} }
amount = amount.add(dto.getAmount() == null ? (new BigDecimal(0)) : dto.getAmount());
dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource);
dto.setType(FormulaDataSourceType.TrialBalanceSource.getCode());
contain.add(dto);
} }
amount = amount.add(dto.getAmount() == null ? (new BigDecimal(0)) : dto.getAmount());
dto.setPeriod(period);
dto.setIsOnlyManualInput(Boolean.FALSE);
dto.setName(Constant.DataSourceName.ReportDataSource);
dto.setType(FormulaDataSourceType.TrialBalanceSource.getCode());
contain.add(dto);
} }
//计算往期发生 //计算往期发生
glBalanceExample = new AdjustmentTableExample(); glBalanceExample = new AdjustmentTableExample();
......
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