StatKdClass.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <?php
  2. namespace bizGhs\stat\classes;
  3. use biz\shop\classes\ShopAdminClass;
  4. use bizGhs\order\classes\OrderClass;
  5. use bizGhs\order\classes\OrderItemClass;
  6. use bizGhs\order\classes\StockOutOrderClass;
  7. use bizHd\order\classes\SettleClass;
  8. use common\components\dateUtil;
  9. use common\components\dict;
  10. use bizHd\order\classes\OrderClass as HdOrderClass;
  11. use bizGhs\clear\classes\ClearClass;
  12. use bizGhs\base\classes\BaseClass;
  13. use common\components\noticeUtil;
  14. use Yii;
  15. class StatKdClass extends BaseClass
  16. {
  17. public static $baseFile = '\bizGhs\stat\models\StatKd';
  18. //当天各渠道收入 ssh 20220723
  19. public static function eachChannelIncome($mainId, $shop, $contain = 1)
  20. {
  21. $ghsShopId = $shop->id ?? 0;
  22. $lsShopId = $shop->lsShopId ?? 0;
  23. //批发开单 pf 零售开单 ls 批发结账 pfJz 零售尾款 lsWk
  24. $get = Yii::$app->request->get();
  25. $searchTime = isset($get['searchTime']) && !empty($get['searchTime']) ? $get['searchTime'] : 'today';
  26. $startTime = $get['startTime'] ?? '';
  27. $endTime = $get['endTime'] ?? '';
  28. $period = dateUtil::formatTime($searchTime, $startTime, $endTime, true);
  29. $start = $period['startTime'];
  30. $end = $period['endTime'];
  31. $currentStartDate = date('Y-m-d', strtotime($start));
  32. $currentEndDate = date('Y-m-d', strtotime($end));
  33. $currentStartTime = $currentStartDate . ' 00:00:00';
  34. $currentEndTime = $currentEndDate . ' 23:59:59';
  35. $staffList = ShopAdminClass::getAllByCondition(['mainId' => $mainId, 'isPt' => 0], null, '*', 'id', true);
  36. $kf = [];
  37. if (!empty($staffList)) {
  38. foreach ($staffList as $staff) {
  39. $name = $staff->name ?? '';
  40. $staffId = $staff->id ?? 0;
  41. $kf[$staffId]['name'] = $name;
  42. $kf[$staffId]['key'] = $staffId;
  43. $kf[$staffId]['num'] = 0;
  44. $kf[$staffId]['amount'] = 0;
  45. $kf[$staffId]['itemList']['pf'] = ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0];
  46. $kf[$staffId]['itemList']['ls'] = ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0];
  47. $kf[$staffId]['itemList']['pfJz'] = ['name' => '批发结账', 'key' => 'pfJz', 'num' => 0, 'amount' => 0];
  48. $kf[$staffId]['itemList']['lsWk'] = ['name' => '零售尾款', 'key' => 'lsWk', 'num' => 0, 'amount' => 0];
  49. }
  50. }
  51. $incomeList = [
  52. //系统收入
  53. 'system' => [
  54. 'amount' => 0,
  55. 'num' => 0,
  56. 'name' => '系统收款',
  57. 'category' => [
  58. 'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
  59. 'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],
  60. 'pfJz' => ['name' => '批发结账', 'key' => 'pfJz', 'num' => 0, 'amount' => 0],
  61. 'lsWk' => ['name' => '零售尾款', 'key' => 'lsWk', 'num' => 0, 'amount' => 0],
  62. ],
  63. ],
  64. 'kfWx' => [
  65. 'amount' => 0,
  66. 'num' => 0,
  67. 'name' => '线下微信',
  68. 'class' => $kf,
  69. 'category' => [
  70. 'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
  71. 'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],
  72. 'pfJz' => ['name' => '批发结账', 'key' => 'pfJz', 'num' => 0, 'amount' => 0],
  73. 'lsWk' => ['name' => '零售尾款', 'key' => 'lsWk', 'num' => 0, 'amount' => 0],
  74. ]
  75. ],
  76. 'debt' => [
  77. 'amount' => 0,
  78. 'num' => 0,
  79. 'name' => '赊账(未结)',
  80. 'category' => [
  81. 'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
  82. 'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],
  83. ],
  84. ],
  85. 'debtClear' => [
  86. 'amount' => 0,
  87. 'num' => 0,
  88. 'name' => '赊账(已结)',
  89. 'category' => [
  90. 'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
  91. 'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],
  92. ],
  93. ],
  94. 'balancePay' => [
  95. 'amount' => 0,
  96. 'name' => '余额支付',
  97. 'num' => 0,
  98. 'category' => [
  99. 'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
  100. 'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],
  101. 'pfJz' => ['name' => '批发结账', 'key' => 'pfJz', 'num' => 0, 'amount' => 0],
  102. 'lsWk' => ['name' => '零售尾款', 'key' => 'lsWk', 'num' => 0, 'amount' => 0],
  103. ],
  104. ],
  105. 'cash' => [
  106. 'amount' => 0,
  107. 'name' => '现金',
  108. 'num' => 0,
  109. 'category' => [
  110. 'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
  111. 'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],
  112. 'pfJz' => ['name' => '批发结账', 'key' => 'pfJz', 'num' => 0, 'amount' => 0],
  113. 'lsWk' => ['name' => '零售尾款', 'key' => 'lsWk', 'num' => 0, 'amount' => 0],
  114. ],
  115. ],
  116. 'aliPay' => [
  117. 'amount' => 0,
  118. 'num' => 0,
  119. 'name' => '线下支付宝',
  120. 'category' => [
  121. 'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
  122. 'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],
  123. 'pfJz' => ['name' => '批发结账', 'key' => 'pfJz', 'num' => 0, 'amount' => 0],
  124. 'lsWk' => ['name' => '零售尾款', 'key' => 'lsWk', 'num' => 0, 'amount' => 0],
  125. ],
  126. ],
  127. 'bankCard' => [
  128. 'amount' => 0,
  129. 'name' => '银行卡',
  130. 'num' => 0,
  131. 'category' => [
  132. 'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
  133. 'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],
  134. 'pfJz' => ['name' => '批发结账', 'key' => 'pfJz', 'num' => 0, 'amount' => 0],
  135. 'lsWk' => ['name' => '零售尾款', 'key' => 'lsWk', 'num' => 0, 'amount' => 0],
  136. ],
  137. ],
  138. 'mt' => ['amount' => 0, 'num' => 0, 'name' => '美团'],
  139. 'other' => [
  140. 'amount' => 0,
  141. 'num' => 0,
  142. 'name' => '其它',
  143. 'category' => [
  144. 'pf' => ['name' => '批发', 'key' => 'pf', 'num' => 0, 'amount' => 0],
  145. 'ls' => ['name' => '零售', 'key' => 'ls', 'num' => 0, 'amount' => 0],
  146. 'pfJz' => ['name' => '批发结账', 'key' => 'pfJz', 'num' => 0, 'amount' => 0],
  147. 'lsWk' => ['name' => '零售尾款', 'key' => 'lsWk', 'num' => 0, 'amount' => 0],
  148. ],
  149. ],
  150. ];
  151. $staffAmountList = [];
  152. //批发开单
  153. $where = ['mainId' => $mainId, 'status' => ['in', [OrderClass::ORDER_STATUS_UN_SEND, OrderClass::ORDER_STATUS_SENDING, OrderClass::ORDER_STATUS_COMPLETE]]];
  154. $where['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
  155. $ghsOrderList = OrderClass::getAllByCondition($where, null, '*');
  156. if (!empty($ghsOrderList)) {
  157. foreach ($ghsOrderList as $ghsKey => $ghsOrder) {
  158. $payWay = $ghsOrder['payWay'] ?? 0;
  159. $actPrice = $ghsOrder['actPrice'] ?? 0;
  160. $getStaffId = $ghsOrder['getStaffId'] ?? 0;
  161. $debtPrice = $ghsOrder['debtPrice'] ?? 0;
  162. $remainDebtPrice = $ghsOrder['remainDebtPrice'] ?? 0;
  163. $onlinePay = $ghsOrder['onlinePay'] ?? dict::getDict('onlinePay', 'not');
  164. $status = $ghsOrder['status'] ?? 0;
  165. $book = $ghsOrder['book'] ?? 0;
  166. $staffId = $ghsOrder['shopAdminId'] ?? 0;
  167. $staffName = $ghsOrder['shopAdminName'] ?? '';
  168. if ($staffId == 0) {
  169. $staffName = '系统';
  170. }
  171. if ($status == 0 || $status == 5) {
  172. continue;
  173. }
  174. if ($book == 1 && $status == 2) {
  175. continue;
  176. }
  177. if (isset($staffAmountList[$staffId])) {
  178. $staffAmountList[$staffId]['num'] = bcadd($staffAmountList[$staffId]['num'], 1);
  179. $staffAmountList[$staffId]['amount'] = bcadd($staffAmountList[$staffId]['amount'], $actPrice, 2);
  180. } else {
  181. $staffAmountList[$staffId] = ['num' => 1, 'amount' => $actPrice, 'staffName' => $staffName, 'staffId' => $staffId];
  182. }
  183. if ($debtPrice > 0) {
  184. if ($remainDebtPrice > 0) {
  185. $incomeList['debt']['amount'] = bcadd($incomeList['debt']['amount'], $actPrice, 2);
  186. $incomeList['debt']['num'] = bcadd($incomeList['debt']['num'], 1);
  187. $incomeList['debt']['category']['pf']['amount'] = bcadd($incomeList['debt']['category']['pf']['amount'], $actPrice, 2);
  188. $incomeList['debt']['category']['pf']['num'] = bcadd($incomeList['debt']['category']['pf']['num'], 1);
  189. } else {
  190. $incomeList['debtClear']['amount'] = bcadd($incomeList['debtClear']['amount'], $actPrice, 2);
  191. $incomeList['debtClear']['num'] = bcadd($incomeList['debtClear']['num'], 1);
  192. $incomeList['debtClear']['category']['pf']['amount'] = bcadd($incomeList['debtClear']['category']['pf']['amount'], $actPrice, 2);
  193. $incomeList['debtClear']['category']['pf']['num'] = bcadd($incomeList['debtClear']['category']['pf']['num'], 1);
  194. }
  195. } else {
  196. if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
  197. //使用在线支付
  198. $incomeList['system']['amount'] = bcadd($incomeList['system']['amount'], $actPrice, 2);
  199. $incomeList['system']['num'] = bcadd($incomeList['system']['num'], 1);
  200. $incomeList['system']['category']['pf']['amount'] = bcadd($incomeList['system']['category']['pf']['amount'], $actPrice, 2);
  201. $incomeList['system']['category']['pf']['num'] = bcadd($incomeList['system']['category']['pf']['num'], 1);
  202. } else {
  203. //使用非在线支付
  204. switch ($payWay) {
  205. case dict::getDict('payWay', 'wxPay'):
  206. //员工微信总共收了多少笔多少钱
  207. $incomeList['kfWx']['amount'] = bcadd($incomeList['kfWx']['amount'], $actPrice, 2);
  208. $incomeList['kfWx']['num'] = bcadd($incomeList['kfWx']['num'], 1);
  209. //批发开单、零售开单、批发结账、零售尾款各收了多少现金
  210. $incomeList['kfWx']['category']['pf']['amount'] = bcadd($incomeList['kfWx']['category']['pf']['amount'], $actPrice, 2);
  211. $incomeList['kfWx']['category']['pf']['num'] = bcadd($incomeList['kfWx']['category']['pf']['num'], 1);
  212. //每个客服总共收了多少笔多少钱
  213. if (isset($incomeList['kfWx']['class'][$getStaffId])) {
  214. $incomeList['kfWx']['class'][$getStaffId]['amount'] = floatval(bcadd($incomeList['kfWx']['class'][$getStaffId]['amount'], $actPrice, 2));
  215. $incomeList['kfWx']['class'][$getStaffId]['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['num'], 1);
  216. }
  217. //每个客服收的明细
  218. if (isset($incomeList['kfWx']['class'][$getStaffId]['itemList']['pf'])) {
  219. $incomeList['kfWx']['class'][$getStaffId]['itemList']['pf']['amount'] = floatval(bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['pf']['amount'], $actPrice, 2));
  220. $incomeList['kfWx']['class'][$getStaffId]['itemList']['pf']['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['pf']['num'], 1);
  221. }
  222. break;
  223. case dict::getDict('payWay', 'alipay'):
  224. $incomeList['aliPay']['amount'] = bcadd($incomeList['aliPay']['amount'], $actPrice, 2);
  225. $incomeList['aliPay']['num'] = bcadd($incomeList['aliPay']['num'], 1);
  226. $incomeList['aliPay']['category']['pf']['amount'] = bcadd($incomeList['aliPay']['category']['pf']['amount'], $actPrice, 2);
  227. $incomeList['aliPay']['category']['pf']['num'] = bcadd($incomeList['aliPay']['category']['pf']['num'], 1);
  228. break;
  229. case dict::getDict('payWay', 'cash'):
  230. $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $actPrice, 2);
  231. $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
  232. $incomeList['cash']['category']['pf']['amount'] = bcadd($incomeList['cash']['category']['pf']['amount'], $actPrice, 2);
  233. $incomeList['cash']['category']['pf']['num'] = bcadd($incomeList['cash']['category']['pf']['num'], 1);
  234. break;
  235. case dict::getDict('payWay', 'balancePay'):
  236. $incomeList['balancePay']['amount'] = bcadd($incomeList['balancePay']['amount'], $actPrice, 2);
  237. $incomeList['balancePay']['num'] = bcadd($incomeList['balancePay']['num'], 1);
  238. $incomeList['balancePay']['category']['pf']['amount'] = bcadd($incomeList['balancePay']['category']['pf']['amount'], $actPrice, 2);
  239. $incomeList['balancePay']['category']['pf']['num'] = bcadd($incomeList['balancePay']['category']['pf']['num'], 1);
  240. break;
  241. case dict::getDict('payWay', 'bankCard'):
  242. $incomeList['bankCard']['amount'] = bcadd($incomeList['bankCard']['amount'], $actPrice, 2);
  243. $incomeList['bankCard']['num'] = bcadd($incomeList['bankCard']['num'], 1);
  244. $incomeList['bankCard']['category']['pf']['amount'] = bcadd($incomeList['bankCard']['category']['pf']['amount'], $actPrice, 2);
  245. $incomeList['bankCard']['category']['pf']['num'] = bcadd($incomeList['bankCard']['category']['pf']['num'], 1);
  246. break;
  247. case dict::getDict('payWay', 'unknown'):
  248. $incomeList['other']['amount'] = bcadd($incomeList['other']['amount'], $actPrice, 2);
  249. $incomeList['other']['num'] = bcadd($incomeList['other']['num'], 1);
  250. $incomeList['other']['category']['pf']['amount'] = bcadd($incomeList['other']['category']['pf']['amount'], $actPrice, 2);
  251. $incomeList['other']['category']['pf']['num'] = bcadd($incomeList['other']['category']['pf']['num'], 1);
  252. break;
  253. default:
  254. }
  255. }
  256. }
  257. }
  258. }
  259. //零售开单
  260. $payCodeIncome = 0;
  261. $lsAfterSale = 0;
  262. $hdWhere = ['mainId' => $mainId, 'status' => ['in', [HdOrderClass::ORDER_STATUS_UN_SEND, HdOrderClass::ORDER_STATUS_SENDING, HdOrderClass::ORDER_STATUS_COMPLETE]]];
  263. $hdWhere['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
  264. $hdOrderList = HdOrderClass::getAllByCondition($hdWhere, null, '*');
  265. foreach ($hdOrderList as $hdKey => $hdOrder) {
  266. $payWay = $hdOrder['payWay'] ?? 0;
  267. $mainPay = $hdOrder['mainPay'] ?? 0;
  268. $cash = $hdOrder['cash'] ?? 0;
  269. $actPrice = $hdOrder['mainPay'] ?? 0;
  270. $getStaffId = $hdOrder['getStaffId'] ?? 0;
  271. $debtPrice = $hdOrder['debtPrice'] ?? 0;
  272. $remainDebtPrice = $hdOrder['remainDebtPrice'] ?? 0;
  273. $onlinePay = $hdOrder['onlinePay'] ?? 0;
  274. $fromType = $hdOrder['fromType'] ?? 0;
  275. $staffId = $hdOrder['shopAdminId'] ?? 0;
  276. $staffName = $hdOrder['shopAdminName'] ?? '';
  277. $repeat = $hdOrder['repeat'] ?? 0;
  278. $forward = $hdOrder['forward'] ?? 0;
  279. $tkPrice = $hdOrder['tkPrice'] ?? 0;
  280. $mainPay = bcsub($mainPay, $tkPrice, 2);
  281. if ($forward == 1) {
  282. //售后付款属于支出
  283. $lsAfterSale = bcadd($lsAfterSale, $mainPay, 2);
  284. continue;
  285. }
  286. $currentAmount = 0;
  287. if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
  288. $incomeList['system']['amount'] = bcadd($incomeList['system']['amount'], $mainPay, 2);
  289. $incomeList['system']['num'] = bcadd($incomeList['system']['num'], 1);
  290. $incomeList['system']['category']['ls']['amount'] = bcadd($incomeList['system']['category']['ls']['amount'], $mainPay, 2);
  291. $incomeList['system']['category']['ls']['num'] = bcadd($incomeList['system']['category']['ls']['num'], 1);
  292. if ($repeat == 1) {
  293. $payCodeIncome = bcadd($payCodeIncome, $mainPay, 2);
  294. }
  295. if ($cash > 0) {
  296. $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $cash, 2);
  297. $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
  298. $incomeList['cash']['category']['ls']['amount'] = bcadd($incomeList['cash']['category']['ls']['amount'], $cash, 2);
  299. $incomeList['cash']['category']['ls']['num'] = bcadd($incomeList['cash']['category']['ls']['num'], 1);
  300. }
  301. $currentAmount = bcadd($mainPay, $cash, 2);
  302. } else {
  303. if ($fromType == dict::getDict('fromType', 'mt')) {
  304. //美团!!!
  305. $incomeList['mt']['amount'] = bcadd($incomeList['mt']['amount'], $actPrice, 2);
  306. $incomeList['mt']['num'] = bcadd($incomeList['mt']['num'], 1);
  307. } else {
  308. if ($debtPrice > 0) {
  309. if ($remainDebtPrice > 0) {
  310. $incomeList['debt']['amount'] = bcadd($incomeList['debt']['amount'], $remainDebtPrice, 2);
  311. $incomeList['debt']['num'] = bcadd($incomeList['debt']['num'], 1);
  312. $incomeList['debt']['category']['ls']['amount'] = bcadd($incomeList['debt']['category']['ls']['amount'], $remainDebtPrice, 2);
  313. $incomeList['debt']['category']['ls']['num'] = bcadd($incomeList['debt']['category']['ls']['num'], 1);
  314. }
  315. $clearDebt = bcsub($debtPrice, $remainDebtPrice, 2);
  316. if ($clearDebt > 0) {
  317. $incomeList['debtClear']['amount'] = bcadd($incomeList['debtClear']['amount'], $clearDebt, 2);
  318. $incomeList['debtClear']['num'] = bcadd($incomeList['debtClear']['num'], 1);
  319. $incomeList['debtClear']['category']['ls']['amount'] = bcadd($incomeList['debtClear']['category']['ls']['amount'], $clearDebt, 2);
  320. $incomeList['debtClear']['category']['ls']['num'] = bcadd($incomeList['debtClear']['category']['ls']['num'], 1);
  321. }
  322. $currentAmount = bcadd($remainDebtPrice, $clearDebt, 2);
  323. } else {
  324. $currentAmount = $mainPay;
  325. }
  326. if ($currentAmount > 0) {
  327. //使用非在线支付
  328. switch ($payWay) {
  329. case dict::getDict('payWay', 'wxPay'):
  330. //员工微信总共收了多少笔多少钱
  331. $incomeList['kfWx']['amount'] = bcadd($incomeList['kfWx']['amount'], $currentAmount, 2);
  332. $incomeList['kfWx']['num'] = bcadd($incomeList['kfWx']['num'], 1);
  333. //批发开单、零售开单、批发结账、零售尾款各收了多少现金
  334. $incomeList['kfWx']['category']['ls']['amount'] = bcadd($incomeList['kfWx']['category']['ls']['amount'], $currentAmount, 2);
  335. $incomeList['kfWx']['category']['ls']['num'] = bcadd($incomeList['kfWx']['category']['ls']['num'], 1);
  336. //客1 客2 客3各收了多少钱
  337. if (isset($incomeList['kfWx']['class'][$getStaffId])) {
  338. $incomeList['kfWx']['class'][$getStaffId]['amount'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['amount'], $currentAmount, 2);
  339. $incomeList['kfWx']['class'][$getStaffId]['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['num'], 1);
  340. }
  341. //每个客服收的明细
  342. if (isset($incomeList['kfWx']['class'][$getStaffId]['itemList']['ls'])) {
  343. $incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['amount'] = floatval(bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['amount'], $actPrice, 2));
  344. $incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['num'], 1);
  345. }
  346. break;
  347. case dict::getDict('payWay', 'alipay'):
  348. $incomeList['aliPay']['amount'] = bcadd($incomeList['aliPay']['amount'], $currentAmount, 2);
  349. $incomeList['aliPay']['num'] = bcadd($incomeList['aliPay']['num'], 1);
  350. $incomeList['aliPay']['category']['ls']['amount'] = bcadd($incomeList['aliPay']['category']['ls']['amount'], $currentAmount, 2);
  351. $incomeList['aliPay']['category']['ls']['num'] = bcadd($incomeList['aliPay']['category']['ls']['num'], 1);
  352. break;
  353. case dict::getDict('payWay', 'cash'):
  354. $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $currentAmount, 2);
  355. $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
  356. $incomeList['cash']['category']['ls']['amount'] = bcadd($incomeList['cash']['category']['ls']['amount'], $currentAmount, 2);
  357. $incomeList['cash']['category']['ls']['num'] = bcadd($incomeList['cash']['category']['ls']['num'], 1);
  358. break;
  359. case dict::getDict('payWay', 'balancePay'):
  360. $incomeList['balancePay']['amount'] = bcadd($incomeList['balancePay']['amount'], $currentAmount, 2);
  361. $incomeList['balancePay']['num'] = bcadd($incomeList['balancePay']['num'], 1);
  362. $incomeList['balancePay']['category']['ls']['amount'] = bcadd($incomeList['balancePay']['category']['ls']['amount'], $currentAmount, 2);
  363. $incomeList['balancePay']['category']['ls']['num'] = bcadd($incomeList['balancePay']['category']['ls']['num'], 1);
  364. break;
  365. case dict::getDict('payWay', 'bankCard'):
  366. $incomeList['bankCard']['amount'] = bcadd($incomeList['bankCard']['amount'], $currentAmount, 2);
  367. $incomeList['bankCard']['num'] = bcadd($incomeList['bankCard']['num'], 1);
  368. $incomeList['bankCard']['category']['ls']['amount'] = bcadd($incomeList['bankCard']['category']['ls']['amount'], $currentAmount, 2);
  369. $incomeList['bankCard']['category']['ls']['num'] = bcadd($incomeList['bankCard']['category']['ls']['num'], 1);
  370. break;
  371. case dict::getDict('payWay', 'unknown'):
  372. $incomeList['other']['amount'] = bcadd($incomeList['other']['amount'], $currentAmount, 2);
  373. $incomeList['other']['num'] = bcadd($incomeList['other']['num'], 1);
  374. $incomeList['other']['category']['ls']['amount'] = bcadd($incomeList['other']['category']['ls']['amount'], $currentAmount, 2);
  375. $incomeList['other']['category']['ls']['num'] = bcadd($incomeList['other']['category']['ls']['num'], 1);
  376. break;
  377. default:
  378. }
  379. }
  380. }
  381. }
  382. //员工业绩
  383. if (isset($staffAmountList[$staffId])) {
  384. $staffAmountList[$staffId]['num'] = bcadd($staffAmountList[$staffId]['num'], 1);
  385. $staffAmountList[$staffId]['amount'] = bcadd($staffAmountList[$staffId]['amount'], $currentAmount, 2);
  386. } else {
  387. $staffAmountList[$staffId] = ['num' => 1, 'amount' => $currentAmount, 'staffName' => $staffName];
  388. }
  389. }
  390. return ['incomeList' => $incomeList, 'staffAmountList' => $staffAmountList, 'payCodeIncome' => $payCodeIncome, 'lsAfterSale' => $lsAfterSale];
  391. }
  392. }