|
|
|
@ -132,8 +132,8 @@ public class ReceiptOutServiceImpl extends MpBaseServiceImpl<BaseReceiptOutDao, |
|
|
|
|
condRecord.setOutInvoiceAmout(record.getTotalAmount()); |
|
|
|
|
// 税款所属期
|
|
|
|
|
condRecord.setOutBelongDate(condVO.getOutTaxPeriod()); |
|
|
|
|
if(record.getTaxAmount().compareTo(new BigDecimal(condVO.getOutTax()))==0){ |
|
|
|
|
condRecord.setOutStatus("2"); |
|
|
|
|
if(record.getTaxAmount().compareTo(new BigDecimal(condVO.getOutTax()))==1){ |
|
|
|
|
condVO.setOutStatus("2"); |
|
|
|
|
} |
|
|
|
|
/*全部转出 */ |
|
|
|
|
if (JxszcZtEnum.QBZC.getZcztDm().equals(condVO.getOutStatus())) { |
|
|
|
@ -144,17 +144,20 @@ public class ReceiptOutServiceImpl extends MpBaseServiceImpl<BaseReceiptOutDao, |
|
|
|
|
} |
|
|
|
|
/*部分转出 */ |
|
|
|
|
if (JxszcZtEnum.BFZC.getZcztDm().equals(condVO.getOutStatus())) { |
|
|
|
|
/** |
|
|
|
|
// 转出金额累加
|
|
|
|
|
BigDecimal oldOutAmount = |
|
|
|
|
record.getOutInvoiceAmout() == null ? new BigDecimal(0) : record.getOutInvoiceAmout(); |
|
|
|
|
|
|
|
|
|
BigDecimal newOutAmount = oldOutAmount.add(new BigDecimal(condVO.getOutAmount())); |
|
|
|
|
// -1=小于; 0=等于; 1=大于;
|
|
|
|
|
int compareOut = newOutAmount.compareTo(record.getInvoiceAmount()); |
|
|
|
|
if (compareOut > 0) { |
|
|
|
|
throw new RRException("累计转出金额不能大于发票金额"); |
|
|
|
|
} |
|
|
|
|
**/ |
|
|
|
|
// 转出金额
|
|
|
|
|
condRecord.setOutInvoiceAmout(newOutAmount); |
|
|
|
|
condRecord.setOutInvoiceAmout(record.getInvoiceAmount()); |
|
|
|
|
|
|
|
|
|
// 转出税额累加
|
|
|
|
|
BigDecimal oldOutTax = record.getOutTaxAmount() == null ? new BigDecimal(0) : record.getOutTaxAmount(); |
|
|
|
@ -166,7 +169,7 @@ public class ReceiptOutServiceImpl extends MpBaseServiceImpl<BaseReceiptOutDao, |
|
|
|
|
// 转出税额
|
|
|
|
|
condRecord.setOutTaxAmount(newOutTax); |
|
|
|
|
|
|
|
|
|
if (compareOut == 0 && compareTax == 0) { |
|
|
|
|
if ( compareTax == 0) { |
|
|
|
|
// 金额税额已经全部转完,设为 全部转出
|
|
|
|
|
condRecord.setOutStatus(JxszcZtEnum.QBZC.getZcztDm()); |
|
|
|
|
} |
|
|
|
@ -209,17 +212,8 @@ public class ReceiptOutServiceImpl extends MpBaseServiceImpl<BaseReceiptOutDao, |
|
|
|
|
} |
|
|
|
|
/* 部分转出 */ |
|
|
|
|
if (JxszcZtEnum.BFZC.getZcztDm().equals(condVO.getOutStatus())) { |
|
|
|
|
// 转出金额累加
|
|
|
|
|
BigDecimal oldOutAmount = |
|
|
|
|
record.getOutInvoiceAmout() == null ? new BigDecimal(0) : record.getOutInvoiceAmout(); |
|
|
|
|
BigDecimal newOutAmount = oldOutAmount.add(new BigDecimal(condVO.getOutAmount())); |
|
|
|
|
// -1=小于; 0=等于; 1=大于;
|
|
|
|
|
int compareOut = newOutAmount.compareTo(invoice.getInvoiceAmount()); |
|
|
|
|
if (compareOut > 0) { |
|
|
|
|
throw new RRException("累计转出金额不能大于发票金额"); |
|
|
|
|
} |
|
|
|
|
// 转出金额
|
|
|
|
|
record.setOutInvoiceAmout(newOutAmount); |
|
|
|
|
record.setOutInvoiceAmout(invoice.getInvoiceAmount()); |
|
|
|
|
|
|
|
|
|
// 转出税额累加
|
|
|
|
|
BigDecimal oldOutTax = record.getOutTaxAmount() == null ? new BigDecimal(0) : record.getOutTaxAmount(); |
|
|
|
@ -232,7 +226,7 @@ public class ReceiptOutServiceImpl extends MpBaseServiceImpl<BaseReceiptOutDao, |
|
|
|
|
record.setOutTaxAmount(newOutTax); |
|
|
|
|
|
|
|
|
|
// 金额税额全部转完,设置状态为 全部转出
|
|
|
|
|
if (compareOut == 0 && compareTax == 0) { |
|
|
|
|
if (compareTax == 0) { |
|
|
|
|
record.setOutStatus(JxszcZtEnum.QBZC.getZcztDm()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|