采購訂單export 選中
This commit is contained in:
parent
657e4b5c53
commit
8286416fd4
@ -130,17 +130,20 @@ public class SaleOrderController extends DefaultBaseController {
|
||||
List<SaleOrderDetail> orderDetails=saleOrderDetailMapper.getBySaleOrderId(result.getId());
|
||||
// 计算毛利率 = 本单利润/含税总金额* 100%
|
||||
String grossMargin = CalUtils.CalGrossMargin(result.getThisOrderProfit(),result.getTotalAmount());
|
||||
result.setGrossMargin(grossMargin);
|
||||
result.setGrossMargin(grossMargin + "%");
|
||||
|
||||
List<String> productNames = new ArrayList<>();
|
||||
BigDecimal totalPurchasePrice = BigDecimal.ZERO;
|
||||
for (SaleOrderDetail orderDetail : orderDetails) {
|
||||
Product product= productService.findById(orderDetail.getProductId());
|
||||
if (product != null && product.getName() != null) {
|
||||
productNames.add(product.getName());
|
||||
}
|
||||
|
||||
//计算成本
|
||||
totalPurchasePrice = totalPurchasePrice.add(orderDetail.getTotalPurchasePrice());
|
||||
}
|
||||
result.setProductName(String.join(", ", productNames));
|
||||
result.setTotalPurchasePrice(totalPurchasePrice);
|
||||
}
|
||||
}
|
||||
return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
|
||||
@ -183,14 +186,18 @@ public class SaleOrderController extends DefaultBaseController {
|
||||
// 计算毛利率 = 本单利润/含税总金额* 100%
|
||||
result.setGrossMargin(CalUtils.CalGrossMargin(result.getThisOrderProfit(),result.getTotalAmount()) + "%");
|
||||
List<String> productNames = new ArrayList<>();
|
||||
BigDecimal totalPurchasePrice = BigDecimal.ZERO;
|
||||
|
||||
for (SaleOrderDetail orderDetail : orderDetails) {
|
||||
Product product= productService.findById(orderDetail.getProductId());
|
||||
if (product != null && product.getName() != null) {
|
||||
productNames.add(product.getName());
|
||||
}
|
||||
|
||||
//计算成本 = 商品采购单价总和
|
||||
totalPurchasePrice = totalPurchasePrice.add(orderDetail.getTotalPurchasePrice());
|
||||
}
|
||||
result.setProductName(String.join(", ", productNames));
|
||||
result.setTotalPurchasePrice(totalPurchasePrice);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user