搭建后台进出帐报表要求进账正数显示,出账负数显示。
当然可以直接在数据库里面直接存储正负数然后进行显示。
除此之外,
可以在数据库中只存储正数数据,然后判断进行显示。
从数据库中查询的是一个Model的list,
Model中要有对应的标识变量用来标识进出帐类型。
在action中:
List<BusPlatformBillserialExt> platformBillList=pageResult.getList();
for(BusPlatformBillserialExt p:platformBillList ) {
if(p.getBillType()==Constants.TRANCATION_TYPE_ZC) {
if(p.getCustomerPayPrice()!=null) {
p.setCustomerPayPrice(p.getCustomerPayPrice().multiply(new BigDecimal(-1)));
}
if(p.getCustomerActaulPayprice()!=null) {
p.setCustomerActaulPayprice(p.getCustomerActaulPayprice().multiply(new BigDecimal(-1)));
}
if(p.getMerchantIncome()!=null) {
p.setMerchantIncome(p.getMerchantIncome().multiply(new BigDecimal(-1)));
}
}
}