|
|
@@ -308,7 +308,114 @@ class TestController extends PublicController
|
|
|
echo ' ghsTotal:' . $ghsTotal . ' ';
|
|
|
echo ' total:' . $total . ' ';
|
|
|
print_r($incomeList);
|
|
|
- die;
|
|
|
+
|
|
|
+ $incomeList = [];
|
|
|
+ //零售开单
|
|
|
+ $hdWhere = ['mainId' => $mainId, 'status' => ['in', [HdOrderClass::ORDER_STATUS_UN_SEND, HdOrderClass::ORDER_STATUS_SENDING, HdOrderClass::ORDER_STATUS_COMPLETE]]];
|
|
|
+ $hdWhere['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
|
|
|
+ $hdOrderList = HdOrderClass::getAllByCondition($hdWhere, null, '*');
|
|
|
+ foreach ($hdOrderList as $hdKey => $hdOrder) {
|
|
|
+ $payWay = $hdOrder['payWay'] ?? 0;
|
|
|
+ $mainPay = $hdOrder['mainPay'] ?? 0;
|
|
|
+ $cash = $hdOrder['cash'] ?? 0;
|
|
|
+ $actPrice = $hdOrder['actPrice'] ?? 0;
|
|
|
+ $getStaffId = $hdOrder['getStaffId'] ?? 0;
|
|
|
+ $debtPrice = $hdOrder['debtPrice'] ?? 0;
|
|
|
+ $remainDebtPrice = $hdOrder['remainDebtPrice'] ?? 0;
|
|
|
+ $onlinePay = $hdOrder['onlinePay'] ?? 0;
|
|
|
+ $fromType = $hdOrder['fromType'] ?? 0;
|
|
|
+
|
|
|
+ if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
|
|
|
+ //使用在线支付
|
|
|
+ $incomeList['system']['amount'] = bcadd($incomeList['system']['amount'], $mainPay, 2);
|
|
|
+ $incomeList['system']['num'] = bcadd($incomeList['system']['num'], 1);
|
|
|
+ $incomeList['system']['category']['ls']['amount'] = bcadd($incomeList['system']['category']['ls']['amount'], $mainPay, 2);
|
|
|
+ $incomeList['system']['category']['ls']['num'] = bcadd($incomeList['system']['category']['ls']['num'], 1);
|
|
|
+ if ($cash > 0) {
|
|
|
+ $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $cash, 2);
|
|
|
+ $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
|
|
|
+ $incomeList['cash']['category']['ls']['amount'] = bcadd($incomeList['cash']['category']['ls']['amount'], $cash, 2);
|
|
|
+ $incomeList['cash']['category']['ls']['num'] = bcadd($incomeList['cash']['category']['ls']['num'], 1);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ($fromType == dict::getDict('fromType', 'mt')) {
|
|
|
+ //美团!!!
|
|
|
+ $incomeList['mt']['amount'] = bcadd($incomeList['mt']['amount'], $actPrice, 2);
|
|
|
+ $incomeList['mt']['num'] = bcadd($incomeList['mt']['num'], 1);
|
|
|
+ } else {
|
|
|
+ //非美团!!!
|
|
|
+
|
|
|
+ if ($debtPrice > 0) {
|
|
|
+ if ($remainDebtPrice > 0) {
|
|
|
+ $incomeList['debt']['amount'] = bcadd($incomeList['debt']['amount'], $debtPrice, 2);
|
|
|
+ $incomeList['debt']['num'] = bcadd($incomeList['debt']['num'], 1);
|
|
|
+ $incomeList['debt']['category']['ls']['amount'] = bcadd($incomeList['debt']['category']['ls']['amount'], $debtPrice, 2);
|
|
|
+ $incomeList['debt']['category']['ls']['num'] = bcadd($incomeList['debt']['category']['ls']['num'], 1);
|
|
|
+ } else {
|
|
|
+ $incomeList['debtClear']['amount'] = bcadd($incomeList['debtClear']['amount'], $debtPrice, 2);
|
|
|
+ $incomeList['debtClear']['num'] = bcadd($incomeList['debtClear']['num'], 1);
|
|
|
+ $incomeList['debtClear']['category']['ls']['amount'] = bcadd($incomeList['debtClear']['category']['ls']['amount'], $debtPrice, 2);
|
|
|
+ $incomeList['debtClear']['category']['ls']['num'] = bcadd($incomeList['debtClear']['category']['ls']['num'], 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //付订金的情况!!
|
|
|
+ $currentAmount = $debtPrice > 0 ? bcsub($actPrice, $debtPrice, 2) : $actPrice;
|
|
|
+
|
|
|
+ //使用非在线支付
|
|
|
+ switch ($payWay) {
|
|
|
+ case dict::getDict('payWay', 'wxPay'):
|
|
|
+ //员工微信总共收了多少笔多少钱
|
|
|
+ $incomeList['kfWx']['amount'] = bcadd($incomeList['kfWx']['amount'], $currentAmount, 2);
|
|
|
+ $incomeList['kfWx']['num'] = bcadd($incomeList['kfWx']['num'], 1);
|
|
|
+ //批发开单、零售开单、批发结账、零售尾款各收了多少现金
|
|
|
+ $incomeList['kfWx']['category']['ls']['amount'] = bcadd($incomeList['kfWx']['category']['ls']['amount'], $currentAmount, 2);
|
|
|
+ $incomeList['kfWx']['category']['ls']['num'] = bcadd($incomeList['kfWx']['category']['ls']['num'], 1);
|
|
|
+ //客1 客2 客3各收了多少钱
|
|
|
+ if (isset($incomeList['kfWx']['class'][$getStaffId])) {
|
|
|
+ $incomeList['kfWx']['class'][$getStaffId]['amount'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['amount'], $currentAmount, 2);
|
|
|
+ $incomeList['kfWx']['class'][$getStaffId]['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['num'], 1);
|
|
|
+ }
|
|
|
+ //每个客服收的明细
|
|
|
+ if (isset($incomeList['kfWx']['class'][$getStaffId]['itemList']['ls'])) {
|
|
|
+ $incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['amount'] = floatval(bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['amount'], $actPrice, 2));
|
|
|
+ $incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['num'] = bcadd($incomeList['kfWx']['class'][$getStaffId]['itemList']['ls']['num'], 1);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case dict::getDict('payWay', 'alipay'):
|
|
|
+ $incomeList['aliPay']['amount'] = bcadd($incomeList['aliPay']['amount'], $currentAmount, 2);
|
|
|
+ $incomeList['aliPay']['num'] = bcadd($incomeList['aliPay']['num'], 1);
|
|
|
+ $incomeList['aliPay']['category']['ls']['amount'] = bcadd($incomeList['aliPay']['category']['ls']['amount'], $currentAmount, 2);
|
|
|
+ $incomeList['aliPay']['category']['ls']['num'] = bcadd($incomeList['aliPay']['category']['ls']['num'], 1);
|
|
|
+ break;
|
|
|
+ case dict::getDict('payWay', 'cash'):
|
|
|
+ $incomeList['cash']['amount'] = bcadd($incomeList['cash']['amount'], $currentAmount, 2);
|
|
|
+ $incomeList['cash']['num'] = bcadd($incomeList['cash']['num'], 1);
|
|
|
+ $incomeList['cash']['category']['ls']['amount'] = bcadd($incomeList['cash']['category']['ls']['amount'], $currentAmount, 2);
|
|
|
+ $incomeList['cash']['category']['ls']['num'] = bcadd($incomeList['cash']['category']['ls']['num'], 1);
|
|
|
+ break;
|
|
|
+ case dict::getDict('payWay', 'bankCard'):
|
|
|
+ $incomeList['bankCard']['amount'] = bcadd($incomeList['aliPay']['amount'], $currentAmount, 2);
|
|
|
+ $incomeList['bankCard']['num'] = bcadd($incomeList['aliPay']['num'], 1);
|
|
|
+ $incomeList['bankCard']['category']['ls']['amount'] = bcadd($incomeList['bankCard']['category']['ls']['amount'], $currentAmount, 2);
|
|
|
+ $incomeList['bankCard']['category']['ls']['num'] = bcadd($incomeList['bankCard']['category']['ls']['num'], 1);
|
|
|
+ break;
|
|
|
+ case dict::getDict('payWay', 'unknown'):
|
|
|
+ $incomeList['other']['amount'] = bcadd($incomeList['aliPay']['amount'], $currentAmount, 2);
|
|
|
+ $incomeList['other']['num'] = bcadd($incomeList['aliPay']['num'], 1);
|
|
|
+ $incomeList['other']['category']['ls']['amount'] = bcadd($incomeList['other']['category']['ls']['amount'], $currentAmount, 2);
|
|
|
+ $incomeList['other']['category']['ls']['num'] = bcadd($incomeList['other']['category']['ls']['num'], 1);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ print_r($incomeList);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
//即时配送
|