|
|
@@ -178,7 +178,7 @@ class StatKdClass extends BaseClass
|
|
|
$book = $ghsOrder['book'] ?? 0;
|
|
|
$staffId = $ghsOrder['shopAdminId'] ?? 0;
|
|
|
$staffName = $ghsOrder['shopAdminName'] ?? '';
|
|
|
- if($staffId==0){
|
|
|
+ if ($staffId == 0) {
|
|
|
$staffName = '系统';
|
|
|
}
|
|
|
if ($status == 0 || $status == 5) {
|
|
|
@@ -192,7 +192,7 @@ class StatKdClass extends BaseClass
|
|
|
$staffAmountList[$staffId]['num'] = bcadd($staffAmountList[$staffId]['num'], 1);
|
|
|
$staffAmountList[$staffId]['amount'] = bcadd($staffAmountList[$staffId]['amount'], $actPrice, 2);
|
|
|
} else {
|
|
|
- $staffAmountList[$staffId] = ['num' => 1, 'amount' => $actPrice, 'staffName' => $staffName,'staffId'=>$staffId];
|
|
|
+ $staffAmountList[$staffId] = ['num' => 1, 'amount' => $actPrice, 'staffName' => $staffName, 'staffId' => $staffId];
|
|
|
}
|
|
|
|
|
|
if ($debtPrice > 0) {
|
|
|
@@ -272,7 +272,9 @@ class StatKdClass extends BaseClass
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
//零售开单
|
|
|
+ $payCodeIncome = 0;
|
|
|
$hdWhere = ['mainId' => $mainId, 'status' => ['in', [HdOrderClass::ORDER_STATUS_UN_SEND, HdOrderClass::ORDER_STATUS_SENDING, HdOrderClass::ORDER_STATUS_COMPLETE]]];
|
|
|
$hdWhere['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
|
|
|
$hdOrderList = HdOrderClass::getAllByCondition($hdWhere, null, '*');
|
|
|
@@ -290,6 +292,8 @@ class StatKdClass extends BaseClass
|
|
|
$staffId = $ghsOrder['shopAdminId'] ?? 0;
|
|
|
$staffName = $ghsOrder['shopAdminName'] ?? '';
|
|
|
|
|
|
+ $repeat = $hdOrder['repeat'] ?? 0;
|
|
|
+
|
|
|
if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
|
|
|
|
|
|
if (isset($staffAmountList[$staffId])) {
|
|
|
@@ -306,6 +310,11 @@ class StatKdClass extends BaseClass
|
|
|
$incomeList['system']['num'] = bcadd($incomeList['system']['num'], 1);
|
|
|
$incomeList['system']['category']['ls']['amount'] = bcadd($incomeList['system']['category']['ls']['amount'], $mainPay, 2);
|
|
|
$incomeList['system']['category']['ls']['num'] = bcadd($incomeList['system']['category']['ls']['num'], 1);
|
|
|
+
|
|
|
+ if ($repeat == 1) {
|
|
|
+ $payCodeIncome = bcadd($payCodeIncome, $mainPay, 2);
|
|
|
+ }
|
|
|
+
|
|
|
if ($cash > 0) {
|
|
|
$incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $cash, 2);
|
|
|
$incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
|
|
|
@@ -410,152 +419,7 @@ class StatKdClass extends BaseClass
|
|
|
}
|
|
|
|
|
|
}
|
|
|
-
|
|
|
- if ($contain == 1) {
|
|
|
- //批发结帐收入
|
|
|
- $clearWhere = ['ghsShopId' => $ghsShopId, 'status' => 2];
|
|
|
- $clearWhere['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
|
|
|
- $clearList = ClearClass::getAllByCondition($clearWhere, null, '*');
|
|
|
- if (!empty($clearList)) {
|
|
|
- foreach ($clearList as $cKey => $clear) {
|
|
|
- $payWay = $clear['payWay'] ?? 0;
|
|
|
- $actPrice = $clear['actPrice'] ?? 0;
|
|
|
- $onlinePay = $clear['onlinePay'] ?? 0;
|
|
|
- $getStaffId = $clear['ghsShopAdminId'] ?? 0;
|
|
|
- if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
|
|
|
- $incomeList['system']['amount'] = bcadd($incomeList['system']['amount'], $actPrice, 2);
|
|
|
- $incomeList['system']['num'] = bcadd($incomeList['system']['num'], 1);
|
|
|
- $incomeList['system']['category']['pfJz']['amount'] = bcadd($incomeList['system']['category']['pfJz']['amount'], $actPrice, 2);
|
|
|
- $incomeList['system']['category']['pfJz']['num'] = bcadd($incomeList['system']['category']['pfJz']['num'], 1);
|
|
|
- } else {
|
|
|
- //使用非在线支付
|
|
|
- switch ($payWay) {
|
|
|
- case dict::getDict('payWay', 'wxPay'):
|
|
|
- //员工微信总共收了多少笔多少钱
|
|
|
- $incomeList['kfWx']['amount'] = bcadd($incomeList['kfWx']['amount'], $actPrice, 2);
|
|
|
- $incomeList['kfWx']['num'] = bcadd($incomeList['kfWx']['num'], 1);
|
|
|
- //批发开单、零售开单、批发结账、零售尾款各收了多少现金
|
|
|
- $incomeList['kfWx']['category']['pfJz']['amount'] = bcadd($incomeList['kfWx']['category']['pfJz']['amount'], $actPrice, 2);
|
|
|
- $incomeList['kfWx']['category']['pfJz']['num'] = bcadd($incomeList['kfWx']['category']['pfJz']['num'], 1);
|
|
|
- //客1 客2 客3各收了多少钱
|
|
|
- if (isset($incomeList['kfWx']['class'][$getStaffId])) {
|
|
|
- $incomeList['kfWx']['class'][$getStaffId]['amount'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['amount'], $actPrice, 2);
|
|
|
- $incomeList['kfWx']['class'][$getStaffId]['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['num'], 1);
|
|
|
- }
|
|
|
- //每个客服收的明细
|
|
|
- if (isset($incomeList['kfWx']['class'][$getStaffId]['itemList']['pfJz'])) {
|
|
|
- $incomeList['kfWx']['class'][$getStaffId]['itemList']['pfJz']['amount'] = floatval(bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['pfJz']['amount'], $actPrice, 2));
|
|
|
- $incomeList['kfWx']['class'][$getStaffId]['itemList']['pfJz']['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['pfJz']['num'], 1);
|
|
|
- }
|
|
|
- break;
|
|
|
- case dict::getDict('payWay', 'alipay'):
|
|
|
- $incomeList['aliPay']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
|
|
|
- $incomeList['aliPay']['num'] = bcadd($incomeList['aliPay']['num'], 1);
|
|
|
- $incomeList['aliPay']['category']['pfJz']['amount'] = bcadd($incomeList['aliPay']['category']['pfJz']['amount'], $actPrice, 2);
|
|
|
- $incomeList['aliPay']['category']['pfJz']['num'] = bcadd($incomeList['aliPay']['category']['pfJz']['num'], 1);
|
|
|
- break;
|
|
|
- case dict::getDict('payWay', 'cash'):
|
|
|
- $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $actPrice, 2);
|
|
|
- $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
|
|
|
- $incomeList['cash']['category']['pfJz']['amount'] = bcadd($incomeList['cash']['category']['pfJz']['amount'], $actPrice, 2);
|
|
|
- $incomeList['cash']['category']['pfJz']['num'] = bcadd($incomeList['cash']['category']['pfJz']['num'], 1);
|
|
|
- break;
|
|
|
- case dict::getDict('payWay', 'balancePay'):
|
|
|
- $incomeList['balancePay']['amount'] = bcadd($incomeList['balancePay']['amount'], $actPrice, 2);
|
|
|
- $incomeList['balancePay']['num'] = bcadd($incomeList['balancePay']['num'], 1);
|
|
|
- $incomeList['balancePay']['category']['pfJz']['amount'] = bcadd($incomeList['balancePay']['category']['pfJz']['amount'], $actPrice, 2);
|
|
|
- $incomeList['balancePay']['category']['pfJz']['num'] = bcadd($incomeList['balancePay']['category']['pfJz']['num'], 1);
|
|
|
- break;
|
|
|
- case dict::getDict('payWay', 'bankCard'):
|
|
|
- $incomeList['bankCard']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
|
|
|
- $incomeList['bankCard']['num'] = bcadd($incomeList['aliPay']['num'], 1);
|
|
|
- $incomeList['bankCard']['category']['pfJz']['amount'] = bcadd($incomeList['bankCard']['category']['pfJz']['amount'], $actPrice, 2);
|
|
|
- $incomeList['bankCard']['category']['pfJz']['num'] = bcadd($incomeList['bankCard']['category']['pfJz']['num'], 1);
|
|
|
- break;
|
|
|
- case dict::getDict('payWay', 'unknown'):
|
|
|
- $incomeList['other']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
|
|
|
- $incomeList['other']['num'] = bcadd($incomeList['aliPay']['num'], 1);
|
|
|
- $incomeList['other']['category']['pfJz']['amount'] = bcadd($incomeList['other']['category']['pfJz']['amount'], $actPrice, 2);
|
|
|
- $incomeList['other']['category']['pfJz']['num'] = bcadd($incomeList['other']['category']['pfJz']['num'], 1);
|
|
|
- break;
|
|
|
- default:
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //零售尾款收入
|
|
|
- $settleWhere = ['shopId' => $lsShopId, 'status' => 2];
|
|
|
- $settleWhere['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
|
|
|
- $settleList = SettleClass::getAllByCondition($settleWhere, null, '*');
|
|
|
-
|
|
|
- if (!empty($settleList)) {
|
|
|
- foreach ($settleList as $sKey => $settle) {
|
|
|
- $payWay = $settle['payWay'] ?? 0;
|
|
|
- $actPrice = $settle['actPrice'] ?? 0;
|
|
|
- $getStaffId = $settle['hdShopAdminId'] ?? 0;
|
|
|
- $onlinePay = $settle['onlinePay'] ?? 0;
|
|
|
- if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
|
|
|
-
|
|
|
- } else {
|
|
|
- //使用非在线支付
|
|
|
- switch ($payWay) {
|
|
|
- case dict::getDict('payWay', 'wxPay'):
|
|
|
- //员工微信总共收了多少笔多少钱
|
|
|
- $incomeList['kfWx']['amount'] = bcadd($incomeList['kfWx']['amount'], $actPrice, 2);
|
|
|
- $incomeList['kfWx']['num'] = bcadd($incomeList['kfWx']['num'], 1);
|
|
|
- //批发开单、零售开单、批发结账、零售尾款各收了多少现金
|
|
|
- $incomeList['kfWx']['category']['lsWk']['amount'] = bcadd($incomeList['kfWx']['category']['lsWk']['amount'], $actPrice, 2);
|
|
|
- $incomeList['kfWx']['category']['lsWk']['num'] = bcadd($incomeList['kfWx']['category']['lsWk']['num'], 1);
|
|
|
- //客1 客2 客3各收了多少钱
|
|
|
- if (isset($incomeList['kfWx']['class'][$getStaffId])) {
|
|
|
- $incomeList['kfWx']['class'][$getStaffId]['amount'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['amount'], $actPrice, 2);
|
|
|
- $incomeList['kfWx']['class'][$getStaffId]['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['num'], 1);
|
|
|
- }
|
|
|
- //每个客服收的明细
|
|
|
- if (isset($incomeList['kfWx']['class'][$getStaffId]['itemList']['lsWk'])) {
|
|
|
- $incomeList['kfWx']['class'][$getStaffId]['itemList']['lsWk']['amount'] = floatval(bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['lsWk']['amount'], $actPrice, 2));
|
|
|
- $incomeList['kfWx']['class'][$getStaffId]['itemList']['lsWk']['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['lsWk']['num'], 1);
|
|
|
- }
|
|
|
- break;
|
|
|
- case dict::getDict('payWay', 'alipay'):
|
|
|
- $incomeList['aliPay']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
|
|
|
- $incomeList['aliPay']['num'] = bcadd($incomeList['aliPay']['num'], 1);
|
|
|
- $incomeList['aliPay']['category']['lsWk']['amount'] = bcadd($incomeList['aliPay']['category']['lsWk']['amount'], $actPrice, 2);
|
|
|
- $incomeList['aliPay']['category']['lsWk']['num'] = bcadd($incomeList['aliPay']['category']['lsWk']['num'], 1);
|
|
|
- break;
|
|
|
- case dict::getDict('payWay', 'cash'):
|
|
|
- $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $actPrice, 2);
|
|
|
- $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
|
|
|
- $incomeList['cash']['category']['lsWk']['amount'] = bcadd($incomeList['cash']['category']['lsWk']['amount'], $actPrice, 2);
|
|
|
- $incomeList['cash']['category']['lsWk']['num'] = bcadd($incomeList['cash']['category']['lsWk']['num'], 1);
|
|
|
- break;
|
|
|
- case dict::getDict('payWay', 'balancePay'):
|
|
|
- $incomeList['balancePay']['amount'] = bcadd($incomeList['balancePay']['amount'], $actPrice, 2);
|
|
|
- $incomeList['balancePay']['num'] = bcadd($incomeList['balancePay']['num'], 1);
|
|
|
- $incomeList['balancePay']['category']['lsWk']['amount'] = bcadd($incomeList['balancePay']['category']['lsWk']['amount'], $actPrice, 2);
|
|
|
- $incomeList['balancePay']['category']['lsWk']['num'] = bcadd($incomeList['balancePay']['category']['lsWk']['num'], 1);
|
|
|
- break;
|
|
|
- case dict::getDict('payWay', 'bankCard'):
|
|
|
- $incomeList['bankCard']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
|
|
|
- $incomeList['bankCard']['num'] = bcadd($incomeList['aliPay']['num'], 1);
|
|
|
- $incomeList['bankCard']['category']['lsWk']['amount'] = bcadd($incomeList['bankCard']['category']['lsWk']['amount'], $actPrice, 2);
|
|
|
- $incomeList['bankCard']['category']['lsWk']['num'] = bcadd($incomeList['bankCard']['category']['lsWk']['num'], 1);
|
|
|
- break;
|
|
|
- case dict::getDict('payWay', 'unknown'):
|
|
|
- $incomeList['other']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
|
|
|
- $incomeList['other']['num'] = bcadd($incomeList['aliPay']['num'], 1);
|
|
|
- $incomeList['other']['category']['lsWk']['amount'] = bcadd($incomeList['other']['category']['lsWk']['amount'], $actPrice, 2);
|
|
|
- $incomeList['other']['category']['lsWk']['num'] = bcadd($incomeList['other']['category']['lsWk']['num'], 1);
|
|
|
- break;
|
|
|
- default:
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return ['incomeList' => $incomeList, 'staffAmountList' => $staffAmountList];
|
|
|
+ return ['incomeList' => $incomeList, 'staffAmountList' => $staffAmountList, 'payCodeIncome' => $payCodeIncome];
|
|
|
|
|
|
}
|
|
|
|