StatKdClass.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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. $hdWhere = ['mainId' => $mainId, 'status' => ['in', [HdOrderClass::ORDER_STATUS_UN_SEND, HdOrderClass::ORDER_STATUS_SENDING, HdOrderClass::ORDER_STATUS_COMPLETE]]];
  262. $hdWhere['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
  263. $hdOrderList = HdOrderClass::getAllByCondition($hdWhere, null, '*');
  264. foreach ($hdOrderList as $hdKey => $hdOrder) {
  265. $payWay = $hdOrder['payWay'] ?? 0;
  266. $mainPay = $hdOrder['mainPay'] ?? 0;
  267. $cash = $hdOrder['cash'] ?? 0;
  268. $actPrice = $hdOrder['mainPay'] ?? 0;
  269. $getStaffId = $hdOrder['getStaffId'] ?? 0;
  270. $debtPrice = $hdOrder['debtPrice'] ?? 0;
  271. $remainDebtPrice = $hdOrder['remainDebtPrice'] ?? 0;
  272. $onlinePay = $hdOrder['onlinePay'] ?? 0;
  273. $fromType = $hdOrder['fromType'] ?? 0;
  274. $staffId = $hdOrder['shopAdminId'] ?? 0;
  275. $staffName = $hdOrder['shopAdminName'] ?? '';
  276. $repeat = $hdOrder['repeat'] ?? 0;
  277. $forward = $hdOrder['forward'] ?? 0;
  278. $tkPrice = $hdOrder['tkPrice'] ?? 0;
  279. $mainPay = bcsub($mainPay, $tkPrice, 2);
  280. if ($forward == 1) {
  281. //售后付款不属于收入
  282. continue;
  283. }
  284. $currentAmount = 0;
  285. if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
  286. $incomeList['system']['amount'] = bcadd($incomeList['system']['amount'], $mainPay, 2);
  287. $incomeList['system']['num'] = bcadd($incomeList['system']['num'], 1);
  288. $incomeList['system']['category']['ls']['amount'] = bcadd($incomeList['system']['category']['ls']['amount'], $mainPay, 2);
  289. $incomeList['system']['category']['ls']['num'] = bcadd($incomeList['system']['category']['ls']['num'], 1);
  290. if ($repeat == 1) {
  291. $payCodeIncome = bcadd($payCodeIncome, $mainPay, 2);
  292. }
  293. if ($cash > 0) {
  294. $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $cash, 2);
  295. $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
  296. $incomeList['cash']['category']['ls']['amount'] = bcadd($incomeList['cash']['category']['ls']['amount'], $cash, 2);
  297. $incomeList['cash']['category']['ls']['num'] = bcadd($incomeList['cash']['category']['ls']['num'], 1);
  298. }
  299. $currentAmount = bcadd($mainPay, $cash, 2);
  300. } else {
  301. if ($fromType == dict::getDict('fromType', 'mt')) {
  302. //美团!!!
  303. $incomeList['mt']['amount'] = bcadd($incomeList['mt']['amount'], $actPrice, 2);
  304. $incomeList['mt']['num'] = bcadd($incomeList['mt']['num'], 1);
  305. } else {
  306. if ($debtPrice > 0) {
  307. if ($remainDebtPrice > 0) {
  308. $incomeList['debt']['amount'] = bcadd($incomeList['debt']['amount'], $remainDebtPrice, 2);
  309. $incomeList['debt']['num'] = bcadd($incomeList['debt']['num'], 1);
  310. $incomeList['debt']['category']['ls']['amount'] = bcadd($incomeList['debt']['category']['ls']['amount'], $remainDebtPrice, 2);
  311. $incomeList['debt']['category']['ls']['num'] = bcadd($incomeList['debt']['category']['ls']['num'], 1);
  312. }
  313. $clearDebt = bcsub($debtPrice, $remainDebtPrice, 2);
  314. if ($clearDebt > 0) {
  315. $incomeList['debtClear']['amount'] = bcadd($incomeList['debtClear']['amount'], $clearDebt, 2);
  316. $incomeList['debtClear']['num'] = bcadd($incomeList['debtClear']['num'], 1);
  317. $incomeList['debtClear']['category']['ls']['amount'] = bcadd($incomeList['debtClear']['category']['ls']['amount'], $clearDebt, 2);
  318. $incomeList['debtClear']['category']['ls']['num'] = bcadd($incomeList['debtClear']['category']['ls']['num'], 1);
  319. }
  320. $currentAmount = bcadd($remainDebtPrice, $clearDebt, 2);
  321. } else {
  322. $currentAmount = $mainPay;
  323. }
  324. if ($currentAmount > 0) {
  325. //使用非在线支付
  326. switch ($payWay) {
  327. case dict::getDict('payWay', 'wxPay'):
  328. //员工微信总共收了多少笔多少钱
  329. $incomeList['kfWx']['amount'] = bcadd($incomeList['kfWx']['amount'], $currentAmount, 2);
  330. $incomeList['kfWx']['num'] = bcadd($incomeList['kfWx']['num'], 1);
  331. //批发开单、零售开单、批发结账、零售尾款各收了多少现金
  332. $incomeList['kfWx']['category']['ls']['amount'] = bcadd($incomeList['kfWx']['category']['ls']['amount'], $currentAmount, 2);
  333. $incomeList['kfWx']['category']['ls']['num'] = bcadd($incomeList['kfWx']['category']['ls']['num'], 1);
  334. //客1 客2 客3各收了多少钱
  335. if (isset($incomeList['kfWx']['class'][$getStaffId])) {
  336. $incomeList['kfWx']['class'][$getStaffId]['amount'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['amount'], $currentAmount, 2);
  337. $incomeList['kfWx']['class'][$getStaffId]['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['num'], 1);
  338. }
  339. //每个客服收的明细
  340. if (isset($incomeList['kfWx']['class'][$getStaffId]['itemList']['ls'])) {
  341. $incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['amount'] = floatval(bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['amount'], $actPrice, 2));
  342. $incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['num'], 1);
  343. }
  344. break;
  345. case dict::getDict('payWay', 'alipay'):
  346. $incomeList['aliPay']['amount'] = bcadd($incomeList['aliPay']['amount'], $currentAmount, 2);
  347. $incomeList['aliPay']['num'] = bcadd($incomeList['aliPay']['num'], 1);
  348. $incomeList['aliPay']['category']['ls']['amount'] = bcadd($incomeList['aliPay']['category']['ls']['amount'], $currentAmount, 2);
  349. $incomeList['aliPay']['category']['ls']['num'] = bcadd($incomeList['aliPay']['category']['ls']['num'], 1);
  350. break;
  351. case dict::getDict('payWay', 'cash'):
  352. $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $currentAmount, 2);
  353. $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
  354. $incomeList['cash']['category']['ls']['amount'] = bcadd($incomeList['cash']['category']['ls']['amount'], $currentAmount, 2);
  355. $incomeList['cash']['category']['ls']['num'] = bcadd($incomeList['cash']['category']['ls']['num'], 1);
  356. break;
  357. case dict::getDict('payWay', 'balancePay'):
  358. $incomeList['balancePay']['amount'] = bcadd($incomeList['balancePay']['amount'], $currentAmount, 2);
  359. $incomeList['balancePay']['num'] = bcadd($incomeList['balancePay']['num'], 1);
  360. $incomeList['balancePay']['category']['ls']['amount'] = bcadd($incomeList['balancePay']['category']['ls']['amount'], $currentAmount, 2);
  361. $incomeList['balancePay']['category']['ls']['num'] = bcadd($incomeList['balancePay']['category']['ls']['num'], 1);
  362. break;
  363. case dict::getDict('payWay', 'bankCard'):
  364. $incomeList['bankCard']['amount'] = bcadd($incomeList['bankCard']['amount'], $currentAmount, 2);
  365. $incomeList['bankCard']['num'] = bcadd($incomeList['bankCard']['num'], 1);
  366. $incomeList['bankCard']['category']['ls']['amount'] = bcadd($incomeList['bankCard']['category']['ls']['amount'], $currentAmount, 2);
  367. $incomeList['bankCard']['category']['ls']['num'] = bcadd($incomeList['bankCard']['category']['ls']['num'], 1);
  368. break;
  369. case dict::getDict('payWay', 'unknown'):
  370. $incomeList['other']['amount'] = bcadd($incomeList['other']['amount'], $currentAmount, 2);
  371. $incomeList['other']['num'] = bcadd($incomeList['other']['num'], 1);
  372. $incomeList['other']['category']['ls']['amount'] = bcadd($incomeList['other']['category']['ls']['amount'], $currentAmount, 2);
  373. $incomeList['other']['category']['ls']['num'] = bcadd($incomeList['other']['category']['ls']['num'], 1);
  374. break;
  375. default:
  376. }
  377. }
  378. }
  379. }
  380. //员工业绩
  381. if (isset($staffAmountList[$staffId])) {
  382. $staffAmountList[$staffId]['num'] = bcadd($staffAmountList[$staffId]['num'], 1);
  383. $staffAmountList[$staffId]['amount'] = bcadd($staffAmountList[$staffId]['amount'], $currentAmount, 2);
  384. } else {
  385. $staffAmountList[$staffId] = ['num' => 1, 'amount' => $currentAmount, 'staffName' => $staffName];
  386. }
  387. }
  388. return ['incomeList' => $incomeList, 'staffAmountList' => $staffAmountList, 'payCodeIncome' => $payCodeIncome];
  389. }
  390. }