|
@@ -148,7 +148,14 @@ class MOrderStatistics extends MBaseModel
|
|
|
return ResultWrapper::success($return);
|
|
|
}
|
|
|
|
|
|
- $sql = "SELECT outStatus,customerId,customerName,salesManId,salesManName,goodsBasicId,goodsId,goodsCode,goodsName,skuId,unitName,shopId,shopName,SUM(detailsBuyNum) AS num,SUM(detailsTotalMoney) AS totalMoney,originPrice,SUM(outCostPrice * detailsBuyNum) AS totalCost, SUM(outCostPrice * detailsBuyNum) / SUM(detailsBuyNum) AS costPrice,SUM(detailsTotalMoney - (outCostPrice * detailsBuyNum)) AS totalProfit, SUM(detailsTotalMoney - (outCostPrice * detailsBuyNum)) / SUM(detailsBuyNum) AS profit, SUM(otherNum) AS otherNum FROM " . $this->orderStatisticsTableName . '_' . $this->enterPriseId . ' WHERE deleteStatus = ' . StatusCode::$standard . ' AND detailsDeleteStatus = ' . StatusCode::$standard . ' AND outStatus = ' . StatusCode::$standard . $whereSql . ' ' . $returnWhere . $groupBySql . ' ORDER BY detailsCreateTime DESC LIMIT ' . $offset . ',' . $limit;
|
|
|
+ $sql = "SELECT outStatus,customerId,customerName,salesManId,salesManName,goodsBasicId,goodsId,goodsCode,goodsName,skuId,unitName,shopId,shopName,SUM(detailsBuyNum) AS num,SUM(detailsTotalMoney) AS totalMoney,originPrice,SUM(outCostPrice * detailsBuyNum) AS totalCost, SUM(outCostPrice * detailsBuyNum) / SUM(detailsBuyNum) AS costPrice,SUM(detailsTotalMoney - (outCostPrice * detailsBuyNum)) AS totalProfit, SUM(detailsTotalMoney - (outCostPrice * detailsBuyNum)) / SUM(detailsBuyNum) AS profit, SUM(otherNum) AS otherNum "
|
|
|
+ . "FROM " . $this->orderStatisticsTableName . '_' . $this->enterPriseId . ' '
|
|
|
+ . 'WHERE deleteStatus = ' . StatusCode::$standard . ' AND detailsDeleteStatus = ' . StatusCode::$standard . ' AND outStatus = ' . StatusCode::$standard
|
|
|
+ . $whereSql . ' '
|
|
|
+ . $returnWhere
|
|
|
+ . $groupBySql . ' '
|
|
|
+ . 'ORDER BY detailsCreateTime DESC '
|
|
|
+ . 'LIMIT ' . $offset . ',' . $limit;
|
|
|
|
|
|
$databaseName = Factory::config()->get('db')['default']['dbname'];
|
|
|
|
|
@@ -180,7 +187,6 @@ class MOrderStatistics extends MBaseModel
|
|
|
self::exportOrderStatistics($orderData);
|
|
|
exit;
|
|
|
}
|
|
|
- var_dump($sql);
|
|
|
$dbResult = $this->objDOrderGoods->query($sql);
|
|
|
|
|
|
if ($dbResult === false) {
|