Commit abf857d5 authored by chase's avatar chase

修复tbm调整表计算bug

parent e3c6ed6c
......@@ -137,32 +137,31 @@ public class TBM extends FunctionBase implements FreeRefFunction {
c1.andOrganizationIdEqualTo(organization.getId());
}
List<AdjustmentTable> list = SpringContextUtil.adjustmentTableMapper.selectByExample(glBalanceExample);
if (CollectionUtils.isEmpty(list)) {
return 0.0;
}
BigDecimal amount = new BigDecimal(0);
//计算本期发生
for (AdjustmentTable balance : list) {
ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
if (eventType == 1) {
if (calculateType == 1) {
dto.setAmount(balance.getPeriodCrBeq().subtract(balance.getPeriodDrBeq()));
} else if (calculateType == 2) {
dto.setAmount(balance.getPeriodDrBeq().subtract(balance.getPeriodCrBeq()));
}
} else if (eventType == 2) {
if (calculateType == 1) {
dto.setAmount(balance.getEndBalBeq());
} else if (calculateType == 2) {
dto.setAmount(balance.getEndBalBeq().multiply(new BigDecimal(-1)));
if (CollectionUtils.isNotEmpty(list)) {
//计算本期发生
for (AdjustmentTable balance : list) {
ReportCellDataSourceDto dto = new ReportCellDataSourceDto();
if (eventType == 1) {
if (calculateType == 1) {
dto.setAmount(balance.getPeriodCrBeq().subtract(balance.getPeriodDrBeq()));
} else if (calculateType == 2) {
dto.setAmount(balance.getPeriodDrBeq().subtract(balance.getPeriodCrBeq()));
}
} else if (eventType == 2) {
if (calculateType == 1) {
dto.setAmount(balance.getEndBalBeq());
} 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();
......
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