|
|
@@ -18,7 +18,7 @@ class StatKdClass extends BaseClass
|
|
|
public static $baseFile = '\bizGhs\stat\models\StatKd';
|
|
|
|
|
|
//当天各渠道收入 ssh 20220723
|
|
|
- public static function eachChannelIncome($mainId, $shop)
|
|
|
+ public static function eachChannelIncome($mainId, $shop, $contain = 1)
|
|
|
{
|
|
|
$ghsShopId = $shop->id ?? 0;
|
|
|
$lsShopId = $shop->lsShopId ?? 0;
|
|
|
@@ -312,137 +312,138 @@ class StatKdClass extends BaseClass
|
|
|
|
|
|
}
|
|
|
|
|
|
- //批发结帐收入
|
|
|
- $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', '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:
|
|
|
+ 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', '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, '*');
|
|
|
+ //零售尾款收入
|
|
|
+ $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')) {
|
|
|
+ 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', '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:
|
|
|
+ } 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', '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;
|
|
|
|
|
|
}
|