|
|
@@ -116,6 +116,23 @@ class ConsoleController extends BaseController
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 汇总各渠道收入金额(与 kdIncome「合计」一致,不含采购/采购隔天)
|
|
|
+ * @param array $return StatKdClass::eachChannelIncome 返回值
|
|
|
+ * @return float
|
|
|
+ */
|
|
|
+ private static function sumChannelIncomeAmount($return)
|
|
|
+ {
|
|
|
+ $incomeList = $return['incomeList'] ?? [];
|
|
|
+ $totalIncome = '0.00';
|
|
|
+ if (!empty($incomeList)) {
|
|
|
+ foreach ($incomeList as $item) {
|
|
|
+ $totalIncome = bcadd($totalIncome, $item['amount'] ?? 0, 2);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return floatval($totalIncome);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 昨日各渠道收入合计(与 stat-kd/profile、kdIncome 页「合计」口径一致)
|
|
|
*/
|
|
|
@@ -131,15 +148,7 @@ class ConsoleController extends BaseController
|
|
|
]));
|
|
|
$contain = intval(Yii::$app->request->get('contain', 0));
|
|
|
$return = StatKdClass::eachChannelIncome($this->mainId, $this->shop, $contain);
|
|
|
- $incomeList = $return['incomeList'] ?? [];
|
|
|
- $totalIncome = '0.00';
|
|
|
- if (!empty($incomeList)) {
|
|
|
- foreach ($incomeList as $item) {
|
|
|
- $amount = $item['amount'] ?? 0;
|
|
|
- $totalIncome = bcadd($totalIncome, $amount, 2);
|
|
|
- }
|
|
|
- }
|
|
|
- util::success(['income' => floatval($totalIncome)]);
|
|
|
+ util::success(['income' => self::sumChannelIncomeAmount($return)]);
|
|
|
}
|
|
|
|
|
|
//今日概况 ssh 20220723
|
|
|
@@ -176,18 +185,13 @@ class ConsoleController extends BaseController
|
|
|
//$notice[] = ['title' => '有急事请连续打二次电话 15280215347', 'action' => '', 'page' => ''];
|
|
|
|
|
|
$mainId = $this->mainId;
|
|
|
+ // 概况仍用 profile(订单数/支出等);收入数字与 kdIncome 对齐,见 index_show_income
|
|
|
$respond = StatSaleClass::profile($mainId);
|
|
|
- $incomeList = $respond['income'] ?? [];
|
|
|
- $todaySale = 0;
|
|
|
- if (!empty($incomeList)) {
|
|
|
- //这里有二个地方同时要修改,请搜索关键词:index_show_income
|
|
|
- foreach ($incomeList as $item) {
|
|
|
- if (isset($item['id']) && $item['id'] == 'allot') {
|
|
|
- continue;
|
|
|
- }
|
|
|
- $todaySale = bcadd($todaySale, $item['amount'], 2);
|
|
|
- }
|
|
|
- }
|
|
|
+ // 工作台「收入」= 各渠道销售收入(含销售隔天扣减),不含采购/采购隔天;与 /stat-kd/profile、昨日收入同口径
|
|
|
+ // 关键词:index_show_income(ShopController 门店列表 todaySale 同步跳过 cgNextDay)
|
|
|
+ $todaySale = self::sumChannelIncomeAmount(
|
|
|
+ StatKdClass::eachChannelIncome($mainId, $this->shop, 0)
|
|
|
+ );
|
|
|
$expendList = $respond['expend'] ?? [];
|
|
|
$todayOut = 0;
|
|
|
if (!empty($expendList)) {
|