|
- $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 "
|