|
|
|
@ -64,14 +64,15 @@ public class BaseReceiptInvoiceServiceImpl extends MpBaseServiceImpl<BaseTDxReco |
|
|
|
|
// 查询结果封装为view
|
|
|
|
|
List<BaseInvoiceRespVO> voList = new ArrayList<>(); |
|
|
|
|
int index = 1; |
|
|
|
|
for (BaseTDxRecordInvoice record : pageInfo.getRecords()) { |
|
|
|
|
BaseInvoiceRespVO vo = convertToInvoiceView(record); |
|
|
|
|
// 序号计算 = (当前页-1)*每页条数+1
|
|
|
|
|
vo.setXh((page.getCurrent() - 1) * page.getSize() + index); |
|
|
|
|
index++; |
|
|
|
|
voList.add(vo); |
|
|
|
|
if (pageInfo.getRecords() != null && pageInfo.getRecords().size() > 0){ |
|
|
|
|
for (BaseTDxRecordInvoice record : pageInfo.getRecords()) { |
|
|
|
|
BaseInvoiceRespVO vo = convertToInvoiceView(record); |
|
|
|
|
// 序号计算 = (当前页-1)*每页条数+1
|
|
|
|
|
vo.setXh((page.getCurrent() - 1) * page.getSize() + index); |
|
|
|
|
index++; |
|
|
|
|
voList.add(vo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 设置记录总数
|
|
|
|
|
json.put("total", pageInfo.getTotal()); |
|
|
|
|
json.put("datalist", voList); |
|
|
|
@ -84,13 +85,17 @@ public class BaseReceiptInvoiceServiceImpl extends MpBaseServiceImpl<BaseTDxReco |
|
|
|
|
// 可转出金额 = 金额 - 已转出金额
|
|
|
|
|
BigDecimal bigOut = new BigDecimal(0); |
|
|
|
|
bigOut = record.getOutInvoiceAmout() == null ? bigOut : record.getOutInvoiceAmout(); |
|
|
|
|
String canOutAmount = MathUtil.sub(record.getInvoiceAmount().toPlainString(), bigOut.toPlainString()); |
|
|
|
|
if (record.getInvoiceAmount() != null){ |
|
|
|
|
String canOutAmount = MathUtil.sub(record.getInvoiceAmount().toPlainString(), bigOut.toPlainString()); |
|
|
|
|
amount = amount.add(new BigDecimal(canOutAmount)); |
|
|
|
|
} |
|
|
|
|
// 可转出税额 = 税额 - 已转出税额
|
|
|
|
|
BigDecimal bigTax = new BigDecimal(0); |
|
|
|
|
bigTax = record.getOutTaxAmount() == null ? bigTax : record.getOutTaxAmount(); |
|
|
|
|
String canOutTax = MathUtil.sub(record.getDkTaxAmount().toPlainString(), bigTax.toPlainString()); |
|
|
|
|
tax = tax.add(new BigDecimal(canOutTax)); |
|
|
|
|
amount = amount.add(new BigDecimal(canOutAmount)); |
|
|
|
|
if (record.getDkTaxAmount() != null){ |
|
|
|
|
String canOutTax = MathUtil.sub(record.getDkTaxAmount().toPlainString(), bigTax.toPlainString()); |
|
|
|
|
tax = tax.add(new BigDecimal(canOutTax)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 合计金额 and 合计税额
|
|
|
|
@ -215,7 +220,9 @@ public class BaseReceiptInvoiceServiceImpl extends MpBaseServiceImpl<BaseTDxReco |
|
|
|
|
// 销方名称
|
|
|
|
|
vo.setSellerName(fpxx.getXfName()); |
|
|
|
|
// 认证日期
|
|
|
|
|
vo.setCertDate(DateUtils.dateToStr(fpxx.getRzhDate())); |
|
|
|
|
if (fpxx.getRzhDate() != null){ |
|
|
|
|
vo.setCertDate(DateUtils.dateToStr(fpxx.getRzhDate())); |
|
|
|
|
} |
|
|
|
|
// 发票代码
|
|
|
|
|
vo.setInvoiceCode(fpxx.getInvoiceCode()); |
|
|
|
|
// 发票号码
|
|
|
|
@ -223,29 +230,44 @@ public class BaseReceiptInvoiceServiceImpl extends MpBaseServiceImpl<BaseTDxReco |
|
|
|
|
// 发票类型
|
|
|
|
|
vo.setInvoiceType(fpxx.getInvoiceType()); |
|
|
|
|
// 开票日期
|
|
|
|
|
vo.setInvoiceDate(DateUtils.dateToStr(fpxx.getInvoiceDate())); |
|
|
|
|
if (fpxx.getInvoiceDate() != null){ |
|
|
|
|
vo.setInvoiceDate(DateUtils.dateToStr(fpxx.getInvoiceDate())); |
|
|
|
|
} |
|
|
|
|
// 发票状态
|
|
|
|
|
vo.setInvoiceStatusName(dictdetaServcice.queryDictName(DictConstant.INVOICE_STATUS,fpxx.getInvoiceStatus())); |
|
|
|
|
// 税额
|
|
|
|
|
vo.setTaxAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(fpxx.getTaxAmount().toPlainString()))); |
|
|
|
|
if (fpxx.getTaxAmount() != null){ |
|
|
|
|
vo.setTaxAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(fpxx.getTaxAmount().toPlainString()))); |
|
|
|
|
} |
|
|
|
|
// 金额
|
|
|
|
|
vo.setAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(fpxx.getInvoiceAmount().toPlainString()))); |
|
|
|
|
if (fpxx.getInvoiceAmount() != null){ |
|
|
|
|
vo.setAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(fpxx.getInvoiceAmount().toPlainString()))); |
|
|
|
|
} |
|
|
|
|
// 抵扣税额
|
|
|
|
|
vo.setDkTaxAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(fpxx.getDkTaxAmount().toPlainString()))); |
|
|
|
|
if (fpxx.getDkTaxAmount() != null){ |
|
|
|
|
vo.setDkTaxAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(fpxx.getDkTaxAmount().toPlainString()))); |
|
|
|
|
} |
|
|
|
|
// 可转出金额 = 金额 - 已转出金额
|
|
|
|
|
BigDecimal bigOut = new BigDecimal(0); |
|
|
|
|
bigOut = fpxx.getOutInvoiceAmout() == null ? bigOut : fpxx.getOutInvoiceAmout(); |
|
|
|
|
String canOutAmount = MathUtil.sub(fpxx.getInvoiceAmount().toPlainString(), bigOut.toPlainString()); |
|
|
|
|
vo.setCanOutAmount(canOutAmount); |
|
|
|
|
vo.setAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(canOutAmount))); |
|
|
|
|
if (fpxx.getInvoiceAmount() != null){ |
|
|
|
|
String canOutAmount = MathUtil.sub(fpxx.getInvoiceAmount().toPlainString(), bigOut.toPlainString()); |
|
|
|
|
vo.setCanOutAmount(canOutAmount); |
|
|
|
|
vo.setAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(canOutAmount))); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 可转出税额 = 税额 - 已转出税额
|
|
|
|
|
BigDecimal bigTax = new BigDecimal(0); |
|
|
|
|
bigTax = fpxx.getOutTaxAmount() == null ? bigTax : fpxx.getOutTaxAmount(); |
|
|
|
|
String canOutTax = MathUtil.sub(fpxx.getDkTaxAmount().toPlainString(), bigTax.toPlainString()); |
|
|
|
|
vo.setCanOutTaxAmount(canOutTax); |
|
|
|
|
vo.setDkTaxAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(canOutTax))); |
|
|
|
|
if (fpxx.getDkTaxAmount() != null){ |
|
|
|
|
String canOutTax = MathUtil.sub(fpxx.getDkTaxAmount().toPlainString(), bigTax.toPlainString()); |
|
|
|
|
vo.setCanOutTaxAmount(canOutTax); |
|
|
|
|
vo.setDkTaxAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(canOutTax))); |
|
|
|
|
} |
|
|
|
|
// 价税合计
|
|
|
|
|
vo.setTotalAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(fpxx.getTotalAmount().toPlainString()))); |
|
|
|
|
if (fpxx.getTotalAmount() != null){ |
|
|
|
|
vo.setTotalAmount(AmountFormatUtil.fmtMicrometer(MathUtil.round(fpxx.getTotalAmount().toPlainString()))); |
|
|
|
|
} |
|
|
|
|
return vo; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|