|
|
@@ -5,6 +5,7 @@ namespace bizGhs\stat\classes;
|
|
|
use bizGhs\order\classes\PurchaseOrderClass;
|
|
|
use bizGhs\order\classes\PurchaseOrderItemClass;
|
|
|
use bizGhs\product\classes\ProductClass;
|
|
|
+use common\components\arrayUtil;
|
|
|
use common\components\dateUtil;
|
|
|
use Yii;
|
|
|
use bizGhs\base\classes\BaseClass;
|
|
|
@@ -31,6 +32,12 @@ class StatCgClass extends BaseClass
|
|
|
$currentStartTime = $currentStartDate . ' 00:00:00';
|
|
|
$currentEndTime = $currentEndDate . ' 23:59:59';
|
|
|
|
|
|
+ $sort = $get['sort'] ?? 'num';
|
|
|
+ $rank = 'num';
|
|
|
+ if ($sort == 'amount') {
|
|
|
+ $rank = 'amount';
|
|
|
+ }
|
|
|
+
|
|
|
$productInfo = ProductClass::getAllByCondition(['mainId' => $mainId], null, 'id,name,py', 'id');
|
|
|
|
|
|
$cgWhere = ['mainId' => $mainId, 'status' => 4];
|
|
|
@@ -66,6 +73,7 @@ class StatCgClass extends BaseClass
|
|
|
}
|
|
|
if (!empty($arr)) {
|
|
|
$arr = array_values($arr);
|
|
|
+ $arr = arrayUtil::arraySort($arr, $rank);
|
|
|
}
|
|
|
return $arr;
|
|
|
}
|