StatKdClass.php 27 KB

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