|
|
@@ -400,6 +400,7 @@ class StatSaleClass extends BaseClass
|
|
|
|
|
|
//采购入库
|
|
|
$tbCgIncome = [];
|
|
|
+ $tbCgIncomeStaff = [];
|
|
|
$cgWhere = ['mainId' => $mainId, 'status' => 4];
|
|
|
$cgWhere['entryTime'] = ['between', [$currentStartTime, $currentEndTime]];
|
|
|
$cgList = PurchaseOrderClass::getAllByCondition($cgWhere, null, '*');
|
|
|
@@ -410,6 +411,8 @@ class StatSaleClass extends BaseClass
|
|
|
$longCharge = $cgItem['longCharge'] ?? 0;
|
|
|
$pickCharge = $cgItem['pickCharge'] ?? 0;
|
|
|
$localCharge = $cgItem['localCharge'] ?? 0;
|
|
|
+ $cgStaffId = $cgItem['cgStaffId'] ?? 0;
|
|
|
+ $cgStaffName = $cgItem['cgStaffName'] ?? '';
|
|
|
$packFreight = bcadd($packFreight, $packingCharge, 2);
|
|
|
$packFreight = bcadd($packFreight, $shortCharge, 2);
|
|
|
$packFreight = bcadd($packFreight, $longCharge, 2);
|
|
|
@@ -452,6 +455,12 @@ class StatSaleClass extends BaseClass
|
|
|
} else {
|
|
|
$tbCgIncome[$productId] = ['num' => $remainNum, 'name' => $name, 'price' => $amount];
|
|
|
}
|
|
|
+ if (isset($tbCgIncomeStaff[$productId]) && isset($tbCgIncomeStaff[$productId][$cgStaffId])) {
|
|
|
+ $tbCgIncomeStaff[$productId][$cgStaffId]['num'] = bcadd($tbCgIncomeStaff[$productId][$cgStaffId]['num'], $remainNum);
|
|
|
+ $tbCgIncomeStaff[$productId][$cgStaffId]['price'] = bcadd($tbCgIncomeStaff[$productId][$cgStaffId]['price'], $amount, 2);
|
|
|
+ } else {
|
|
|
+ $tbCgIncomeStaff[$productId][$cgStaffId] = ['num' => $remainNum, 'name' => $name, 'price' => $amount, 'cgStaffName' => $cgStaffName,];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if ($tkPrice > 0) {
|
|
|
@@ -471,6 +480,7 @@ class StatSaleClass extends BaseClass
|
|
|
//批发开单
|
|
|
$pfIncome = 0;
|
|
|
$tbSaleIncome = [];
|
|
|
+ $tbSaleIncomeStaff = [];
|
|
|
$where = ['mainId' => $mainId, 'status' => ['in', [OrderClass::ORDER_STATUS_UN_SEND, OrderClass::ORDER_STATUS_SENDING, OrderClass::ORDER_STATUS_COMPLETE]]];
|
|
|
$where['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
|
|
|
$ghsOrderList = OrderClass::getAllByCondition($where, null, '*');
|
|
|
@@ -485,6 +495,8 @@ class StatSaleClass extends BaseClass
|
|
|
if ($status == 0 || $status == 5) {
|
|
|
continue;
|
|
|
}
|
|
|
+ $shopAdminId = $ghsOrder['shopAdminId']??0;
|
|
|
+ $shopAdminName = $ghsOrder['shopAdminName']??'';
|
|
|
$orderSn = $ghsOrder['orderSn'] ?? '';
|
|
|
$actPrice = $ghsOrder['actPrice'] ?? 0;
|
|
|
$tkPrice = $ghsOrder['tkPrice'] ?? 0;
|
|
|
@@ -513,6 +525,7 @@ class StatSaleClass extends BaseClass
|
|
|
$arr[$classId]['expend'] = 0;
|
|
|
$arr[$classId]['income'] = $amount;
|
|
|
}
|
|
|
+
|
|
|
//单独统计
|
|
|
$belongCost = $orderItem->belongCost ?? 0;
|
|
|
if ($belongCost == 1) {
|
|
|
@@ -522,6 +535,12 @@ class StatSaleClass extends BaseClass
|
|
|
} else {
|
|
|
$tbSaleIncome[$productId] = ['name' => $name, 'num' => $remainNum, 'price' => $amount];
|
|
|
}
|
|
|
+ if(isset($tbSaleIncomeStaff[$productId]) && isset($tbSaleIncomeStaff[$productId][$shopAdminId])){
|
|
|
+ $tbSaleIncomeStaff[$productId][$shopAdminId]['num'] = bcadd($tbSaleIncomeStaff[$productId][$shopAdminId]['num'], $remainNum);
|
|
|
+ $tbSaleIncomeStaff[$productId][$shopAdminId]['price'] = bcadd($tbSaleIncomeStaff[$productId][$shopAdminId]['price'], $amount, 2);
|
|
|
+ }else{
|
|
|
+ $tbSaleIncomeStaff[$productId][$shopAdminId] = ['name' => $name, 'num' => $remainNum, 'price' => $amount,'staffName'=>$shopAdminName];
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if ($tkPrice > 0) {
|
|
|
@@ -649,6 +668,8 @@ class StatSaleClass extends BaseClass
|
|
|
'totalProfit' => $totalProfit,
|
|
|
'tbSaleIncome' => $tbSaleIncome,
|
|
|
'tbCgIncome' => $tbCgIncome,
|
|
|
+ 'tbCgIncomeStaff'=>$tbCgIncomeStaff,
|
|
|
+ 'tbSaleIncomeStaff'=>$tbSaleIncomeStaff,
|
|
|
'totalLabourCost' => $totalLabourCost,
|
|
|
'totalDiscountAmount' => $totalDiscountAmount,
|
|
|
]);
|