|
|
@@ -192,14 +192,20 @@ public class PaybalanceServiceImpl implements PaybalanceService {
|
|
|
//更新账户资料金额
|
|
|
Bankinformation bankinformation = new Bankinformation();
|
|
|
Bankinformation nowBankInformation = paybalanceMapper.selectBankInformationByPrimaryKey(det.getPd_bankid());
|
|
|
- bankinformation.setBk_thisamount((nowBankInformation.getBk_thisamount() == null ? new Double(0) : nowBankInformation.getBk_thisamount())
|
|
|
- + (det.getPd_amount() == null ? 0.0 : det.getPd_amount()));
|
|
|
+ Double amount = det.getPd_amount() == null ? new Double(0) : det.getPd_amount();
|
|
|
+ Double preamount = nowBankInformation.getBk_beginamount() ==null ? new Double(0):nowBankInformation.getBk_beginamount();//期初金额
|
|
|
+ Double incoming = nowBankInformation.getBk_income() ==null ? new Double(0):nowBankInformation.getBk_income();
|
|
|
+ Double spending = nowBankInformation.getBk_spending() ==null ? new Double(0):nowBankInformation.getBk_spending();
|
|
|
+ bankinformation.setBk_spending(spending+amount);
|
|
|
+ bankinformation.setBk_thisamount(preamount+incoming-(spending+amount));
|
|
|
+ bankinformation.setId(Long.valueOf(String.valueOf(det.getPd_bankid())));
|
|
|
paybalanceMapper.updateBankByPrimaryKeySelective(bankinformation);
|
|
|
+
|
|
|
}
|
|
|
//更新主表pb_pbdamount=从表二金额合计
|
|
|
Double amountTotal2 = new Double(0);
|
|
|
for (Paybalancedetail detail : paybalancedetail){
|
|
|
- amountTotal2 = amountTotal2 + detail.getPbd_amount();
|
|
|
+ amountTotal2 = amountTotal2 + detail.getPbd_nowbalance();
|
|
|
}
|
|
|
updatePay.setId(pay.getMain().getId());
|
|
|
updatePay.setPb_pdamount(amountTotal);
|
|
|
@@ -218,20 +224,25 @@ public class PaybalanceServiceImpl implements PaybalanceService {
|
|
|
Double payamount = vendorData.getVe_payamount()==null?new Double(0):vendorData.getVe_payamount();
|
|
|
|
|
|
Vendor vendor = new Vendor();
|
|
|
+ Double recbalancePreamount = paybalance.getPb_preamount();
|
|
|
vendor.setId(Long.valueOf(String.valueOf(paybalance.getPb_vendid())));
|
|
|
- vendor.setVe_preamount(preamount+amountTotal);
|
|
|
+ vendor.setVe_preamount(preamount+recbalancePreamount);
|
|
|
vendor.setVe_payamount(payamount-amountTotal2);
|
|
|
- vendor.setVe_leftamount(beginapamount-beginprepayamount+payamount-amountTotal2-preamount-amountTotal);
|
|
|
+ vendor.setVe_leftamount(beginapamount-beginprepayamount+payamount-amountTotal2-preamount-recbalancePreamount);
|
|
|
paybalanceMapper.updateVendorByPrimaryKeySelective(vendor);
|
|
|
|
|
|
for (Paybalancedetail detail: paybalancedetail) {
|
|
|
- Subledger newsubledger = new Subledger();
|
|
|
+ Subledger subledger1 = new Subledger();
|
|
|
Subledger nowSubledger = subledgerMapper.selectByPrimaryKey(detail.getPbd_slid());
|
|
|
- newsubledger.setId(Long.valueOf(String.valueOf(detail.getPbd_slid())));
|
|
|
- newsubledger.setSl_yamount(detail.getPbd_nowbalance()+nowSubledger.getSl_yamount());//已核销
|
|
|
- newsubledger.setSl_namount(nowSubledger.getSl_namount()-detail.getPbd_nowbalance());//未核销
|
|
|
- subledgerMapper.updateByPrimaryKeySelective(newsubledger);
|
|
|
+ subledger1.setId(Long.valueOf(String.valueOf(detail.getPbd_slid())));
|
|
|
+ Double yamount = nowSubledger.getSl_yamount()==null?new Double(0):nowSubledger.getSl_yamount();
|
|
|
+ Double namount = nowSubledger.getSl_namount()==null?new Double(0):nowSubledger.getSl_namount();
|
|
|
+ Double nowBalance = detail.getPbd_nowbalance()==null?new Double(0):detail.getPbd_nowbalance();
|
|
|
+ subledger1.setSl_yamount(yamount+nowBalance);//已核销
|
|
|
+ subledger1.setSl_namount(namount-nowBalance);//未核销
|
|
|
+ subledgerMapper.updateByPrimaryKeySelective(subledger1);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -260,10 +271,16 @@ public class PaybalanceServiceImpl implements PaybalanceService {
|
|
|
//更新账户资料金额
|
|
|
List<Paybalancedet> paybalancedet = paybalancedetMapper.selectByPrimaryKey(id);
|
|
|
for (Paybalancedet det:paybalancedet) {
|
|
|
+ //更新账户资料金额
|
|
|
Bankinformation bankinformation = new Bankinformation();
|
|
|
Bankinformation nowBankInformation = paybalanceMapper.selectBankInformationByPrimaryKey(det.getPd_bankid());
|
|
|
- bankinformation.setBk_thisamount((nowBankInformation.getBk_thisamount() == null ? new Double(0) : nowBankInformation.getBk_thisamount())
|
|
|
- - (det.getPd_amount() == null ? new Double(0) : det.getPd_amount()));
|
|
|
+ Double amount = det.getPd_amount() == null ? new Double(0) : det.getPd_amount();
|
|
|
+ Double bkpreamount = nowBankInformation.getBk_beginamount() ==null ? new Double(0):nowBankInformation.getBk_beginamount();//期初金额
|
|
|
+ Double bkincoming = nowBankInformation.getBk_income() ==null ? new Double(0):nowBankInformation.getBk_income();
|
|
|
+ Double bkspending = nowBankInformation.getBk_spending() ==null ? new Double(0):nowBankInformation.getBk_spending();
|
|
|
+ bankinformation.setBk_spending(bkspending-amount);
|
|
|
+ bankinformation.setBk_thisamount(bkpreamount+bkincoming-(bkspending-amount));
|
|
|
+ bankinformation.setId(Long.valueOf(String.valueOf(det.getPd_bankid())));
|
|
|
paybalanceMapper.updateBankByPrimaryKeySelective(bankinformation);
|
|
|
}
|
|
|
|
|
|
@@ -272,8 +289,11 @@ public class PaybalanceServiceImpl implements PaybalanceService {
|
|
|
Subledger subledger1 = new Subledger();
|
|
|
Subledger nowSubledger = subledgerMapper.selectByPrimaryKey(detail.getPbd_slid());
|
|
|
subledger1.setId(Long.valueOf(String.valueOf(detail.getPbd_slid())));
|
|
|
- subledger1.setSl_yamount(nowSubledger.getSl_yamount()-detail.getPbd_nowbalance());//已核销
|
|
|
- subledger1.setSl_namount(nowSubledger.getSl_namount()+detail.getPbd_nowbalance());//未核销
|
|
|
+ Double yamount = nowSubledger.getSl_yamount()==null?new Double(0):nowSubledger.getSl_yamount();
|
|
|
+ Double namount = nowSubledger.getSl_namount()==null?new Double(0):nowSubledger.getSl_namount();
|
|
|
+ Double nowBalance = detail.getPbd_nowbalance()==null?new Double(0):detail.getPbd_nowbalance();
|
|
|
+ subledger1.setSl_yamount(yamount-nowBalance);//已核销
|
|
|
+ subledger1.setSl_namount(namount+nowBalance);//未核销
|
|
|
subledgerMapper.updateByPrimaryKeySelective(subledger1);
|
|
|
}
|
|
|
|