diff --git a/src/main/java/com/yem/wm/es/declaredocx/convert/DeclareDocxToExportinvoiceConvert.java b/src/main/java/com/yem/wm/es/declaredocx/convert/DeclareDocxToExportinvoiceConvert.java index 665f359c..74c9d40f 100644 --- a/src/main/java/com/yem/wm/es/declaredocx/convert/DeclareDocxToExportinvoiceConvert.java +++ b/src/main/java/com/yem/wm/es/declaredocx/convert/DeclareDocxToExportinvoiceConvert.java @@ -59,37 +59,6 @@ public class DeclareDocxToExportinvoiceConvert extends AbstractConvertPlugIn { yem_sumamt = yem_sumamt.add(str.getBigDecimal("yem_cusamount")); } } - /** - * 1、出口报关单下推出口发票时,出口发票-报关商品页签分摊金额,计算逻辑: - * (1)分摊金额=金额/金额合计*((海运费结算币别+保费结算币别+佣金结算币别) - * (2)开票金额=金额-分摊金额; - * (3)开票单价=开票金额/数量; - * 2、分摊金额的合计值 与 海运费结算币别+保费结算币别+佣金结算币别 需一致,如果分摊产生的尾差,统一调整在报关商品分录的最后一行; - */ - BigDecimal yem_seabase = dataEntity.getBigDecimal("yem_seabase");//海运费(结算币别) - BigDecimal yem_insurefeecurrba = dataEntity.getBigDecimal("yem_insurefeecurrba");//保费(结算币别) - BigDecimal yem_commission = dataEntity.getBigDecimal("yem_commission");//佣金(结算币别) - BigDecimal sum = yem_seabase.add(yem_insurefeecurrba).add(yem_commission); - BigDecimal sumyem_shareamt = BigDecimal.ZERO; -// for (Iterator iterator = yemExportinvoiceC.iterator(); iterator.hasNext(); ) { -// DynamicObject yemExportinvoiceCs = iterator.next(); -// BigDecimal yem_shareamt=yemExportinvoiceCs.getBigDecimal("yem_cusamount").divide(yem_sumamt,4).multiply(sum); -// yemExportinvoiceCs.set("yem_shareamt",yem_shareamt);//分摊金额 -// sumyem_shareamt=sumyem_shareamt.add(yem_shareamt); -// -// BigDecimal yem_invoiceamt=yemExportinvoiceCs.getBigDecimal("yem_cusamount").subtract(yem_shareamt); -// yemExportinvoiceCs.set("yem_invoiceamt",yem_invoiceamt);//开票金额 -// -// BigDecimal yem_invoiceprice=yem_invoiceamt.divide(yemExportinvoiceCs.getBigDecimal("yem_cusqty")); -// yemExportinvoiceCs.set("yem_invoiceprice",yem_invoiceprice);//开票单价 -// -// if (!iterator.hasNext()) -// { -// yemExportinvoiceCs.set("yem_shareamt", sum.subtract(sumyem_shareamt).add(yem_shareamt));//分摊金额 -// } -// -// } - calculatePremium(dataEntity); } @@ -209,11 +178,11 @@ public class DeclareDocxToExportinvoiceConvert extends AbstractConvertPlugIn { //报关单(海运费/金额) BigDecimal yem_count = dataEntity.getBigDecimal("yem_count"); - //销售金额合计值 1,295,997.50 + //销售金额合计值 BigDecimal yem_localamountsum = BigDecimal.ZERO; DynamicObjectCollection yem_exportinvoice_c = dataEntity.getDynamicObjectCollection("yem_exportinvoice_c"); for (DynamicObject yem_exportinvoice : yem_exportinvoice_c) { - BigDecimal yem_localamount = yem_exportinvoice.getBigDecimal("yem_localamount"); + BigDecimal yem_localamount = yem_exportinvoice.getBigDecimal("yem_cusamount"); yem_localamountsum = yem_localamountsum.add(yem_localamount); } //汇率 @@ -226,7 +195,7 @@ public class DeclareDocxToExportinvoiceConvert extends AbstractConvertPlugIn { BigDecimal yem_commissionba = dataEntity.getBigDecimal("yem_commissionba"); BigDecimal ybz = yem_seatransfeebase.add(yem_insurefeebase).add(yem_commissionba); for (DynamicObject exportinvoice : yem_exportinvoice_c) { - BigDecimal yem_localamount = exportinvoice.getBigDecimal("yem_localamount"); + BigDecimal yem_localamount = exportinvoice.getBigDecimal("yem_cusamount"); if (yem_localamount.compareTo(BigDecimal.ZERO) == 1) { BigDecimal yem_localassessedamo = ybz.multiply(yem_localamount).divide(yem_localamountsum, 10, BigDecimal.ROUND_HALF_UP); exportinvoice.set("yem_localassessedamo", yem_localassessedamo); @@ -234,7 +203,6 @@ public class DeclareDocxToExportinvoiceConvert extends AbstractConvertPlugIn { BigDecimal localamount = exportinvoice.getBigDecimal("yem_localamount"); // 金额(本位币)\ BigDecimal localinvoicedamo = localamount.subtract(yem_localassessedamo); exportinvoice.set("yem_localinvoicedamo", localinvoicedamo); - // yem_localinvoicingunit = yem_localinvoicedamo / yem_cusqty // 开票单价(本位币) = 开票金额(本位币) / 数量 BigDecimal cusqty = exportinvoice.getBigDecimal("yem_cusqty"); exportinvoice.set("yem_localinvoicingunit", BigDecimalUtils.div(localinvoicedamo, cusqty, 2));