|
@@ -847,15 +847,20 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
salesObject.put("productCount", product.getNum());
|
|
|
salesInfo.add(salesObject);
|
|
|
}
|
|
|
+
|
|
|
// 成本价
|
|
|
Double costPrice = null;
|
|
|
-
|
|
|
/**
|
|
|
* 判断是否选中固定成本价
|
|
|
- * 版本不在使用税费,成本取消再加 机构税费
|
|
|
+ * 固定成本、比例成本都需要计算税费
|
|
|
*/
|
|
|
if (null != product.getCostPrice() && 1 == product.getCostCheckFlag() && product.getCostPrice() >= 0d) {
|
|
|
- costPrice = product.getCostPrice();
|
|
|
+ // 通过售价*比例得到成本价
|
|
|
+ double costTax = 0d;
|
|
|
+ if (taxFlag) {
|
|
|
+ costTax = MathUtil.div(MathUtil.mul(product.getCostPrice(), product.getTaxRate()), 100, 2).doubleValue();
|
|
|
+ }
|
|
|
+ costPrice = MathUtil.add(product.getCostPrice(), costTax).doubleValue();
|
|
|
}
|
|
|
// 判断是否选中比例成本价
|
|
|
if (null != product.getCostProportional() && 2 == product.getCostCheckFlag() && product.getCostProportional() > 0d) {
|
|
@@ -869,14 +874,13 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
if (null == costPrice) {
|
|
|
return ResponseJson.error("订单商品成本异常!", null);
|
|
|
}
|
|
|
- log.info("costPrice===="+costPrice);
|
|
|
product.setCostPrice(costPrice);
|
|
|
// 付供应商税费
|
|
|
if (null == product.getShopTaxRate() || product.getShopTaxRate() <= 0) {
|
|
|
product.setShopTaxRate(product.getTaxRate());
|
|
|
}
|
|
|
if (taxFlag) {
|
|
|
- shopTax = MathUtil.div(MathUtil.mul(costPrice, product.getShopTaxRate()), 100, 2).doubleValue();
|
|
|
+ shopTax = MathUtil.div(MathUtil.mul(MathUtil.div(costPrice,MathUtil.div(MathUtil.add(product.getTaxRate(), 100),100)), product.getShopTaxRate()), 100, 2).doubleValue();
|
|
|
} else if (!Integer.valueOf(1).equals(product.getIncludedTax())) {
|
|
|
// 不含税不可开票商品和未知商品,税率置为0
|
|
|
product.setShopTaxRate(0d);
|
|
@@ -2456,11 +2460,17 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
product.setAddedValueTax(discountTax);
|
|
|
product.setTotalAddedValueTax(taxFee);
|
|
|
}
|
|
|
+
|
|
|
// 成本价
|
|
|
Double costPrice = null;
|
|
|
// 判断是否选中固定成本价
|
|
|
if (null != product.getCostPrice() && 1 == product.getCostCheckFlag() && product.getCostPrice() >= 0d) {
|
|
|
- costPrice = product.getCostPrice();
|
|
|
+ // 通过售价*比例得到成本价
|
|
|
+ double costTax = 0d;
|
|
|
+ if (taxFlag) {
|
|
|
+ costTax = MathUtil.div(MathUtil.mul(product.getCostPrice(), product.getTaxRate()), 100, 2).doubleValue();
|
|
|
+ }
|
|
|
+ costPrice = MathUtil.add(product.getCostPrice(), costTax).doubleValue();
|
|
|
}
|
|
|
// 判断是否选中比例成本价
|
|
|
if (null != product.getCostProportional() && 2 == product.getCostCheckFlag() && product.getCostProportional() > 0d) {
|
|
@@ -2480,7 +2490,7 @@ public class SubmitServiceImpl implements SubmitService {
|
|
|
product.setShopTaxRate(product.getTaxRate());
|
|
|
}
|
|
|
if (taxFlag) {
|
|
|
- shopTax = MathUtil.div(MathUtil.mul(costPrice, product.getShopTaxRate()), 100, 2).doubleValue();
|
|
|
+ shopTax = MathUtil.div(MathUtil.mul(MathUtil.div(costPrice,MathUtil.div(MathUtil.add(product.getTaxRate(), 100),100)), product.getShopTaxRate()), 100, 2).doubleValue();
|
|
|
} else if (!Integer.valueOf(1).equals(product.getIncludedTax())) {
|
|
|
// 不含税不可开票商品和未知商品,税率置为0
|
|
|
product.setShopTaxRate(0d);
|