StatKdController.php 26 KB

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