|
|
@@ -395,6 +395,8 @@ class StatSaleClass extends BaseClass
|
|
|
$packFreight = 0;
|
|
|
$onlyRefundCg = 0;
|
|
|
$onlyRefund = 0;
|
|
|
+ $totalDiscountAmount = 0;
|
|
|
+ $totalLabourCost = 0;
|
|
|
|
|
|
//采购入库
|
|
|
$tbCgIncome = [];
|
|
|
@@ -487,6 +489,10 @@ class StatSaleClass extends BaseClass
|
|
|
$actPrice = $ghsOrder['actPrice'] ?? 0;
|
|
|
$tkPrice = $ghsOrder['tkPrice'] ?? 0;
|
|
|
$pfIncome = bcadd($pfIncome, $actPrice, 2);
|
|
|
+ $labourCost = $ghsOrder['labourCost'] ?? 0;
|
|
|
+ $discountAmount = $ghsOrder['discountAmount'] ?? 0;
|
|
|
+ $totalLabourCost = bcadd($labourCost, $totalLabourCost, 2);
|
|
|
+ $totalDiscountAmount = bcadd($totalDiscountAmount, $discountAmount, 2);
|
|
|
$orderItemList = OrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true);
|
|
|
if (!empty($orderItemList)) {
|
|
|
foreach ($orderItemList as $orderItem) {
|
|
|
@@ -610,6 +616,10 @@ class StatSaleClass extends BaseClass
|
|
|
$totalExpend = bcadd($totalExpend, $packFreight, 2);
|
|
|
//总收入算上采购仅退款
|
|
|
$totalIncome = bcadd($totalIncome, $onlyRefundCg, 2);
|
|
|
+ //总收入算上人工费
|
|
|
+ $totalIncome = bcadd($totalIncome, $totalLabourCost, 2);
|
|
|
+ //总成本算上优惠金额
|
|
|
+ $totalExpend = bcadd($totalExpend, $totalDiscountAmount, 2);
|
|
|
//总成本算上销售仅退款
|
|
|
$totalExpend = bcadd($totalExpend, $onlyRefund, 2);
|
|
|
$totalProfit = bcsub($totalIncome, $totalExpend, 2);
|
|
|
@@ -625,6 +635,8 @@ class StatSaleClass extends BaseClass
|
|
|
['classId' => 0, 'className' => '物流打包费', 'income' => 0, 'expend' => $packFreight, 'profit' => -$packFreight],
|
|
|
['classId' => 0, 'className' => '采购仅退款', 'income' => $onlyRefundCg, 'expend' => $packFreight, 'profit' => $onlyRefundCg],
|
|
|
['classId' => 0, 'className' => '销售仅退款', 'income' => 0, 'expend' => $onlyRefund, 'profit' => -$onlyRefund],
|
|
|
+ ['classId' => 0, 'className' => '附加人工费', 'income' => $totalLabourCost, 'expend' => 0, 'profit' => $totalLabourCost],
|
|
|
+ ['classId' => 0, 'className' => '优惠金额', 'income' => 0, 'expend' => $totalDiscountAmount, 'profit' => -$totalDiscountAmount],
|
|
|
['classId' => 0, 'className' => '【汇总金额】', 'income' => $totalIncome, 'expend' => $totalExpend, 'profit' => $totalProfit],
|
|
|
];
|
|
|
$list = array_merge($arr, $statData);
|