|
@@ -51,16 +51,6 @@ class ExportFileService extends Service
|
|
|
return [true, $return];
|
|
|
}
|
|
|
|
|
|
-// private function fillData($data, $column, &$return){
|
|
|
-// foreach ($data as $value) {
|
|
|
-// $tmp = [];
|
|
|
-// foreach ($column as $c_v){
|
|
|
-// $tmp[$c_v] = $value[$c_v] ?? "";
|
|
|
-// }
|
|
|
-// $return[] = $tmp;
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
private function fillData($data, $column, &$return)
|
|
|
{
|
|
|
// 预先创建包含默认值的键数组
|
|
@@ -480,60 +470,6 @@ class ExportFileService extends Service
|
|
|
return [true, $id];
|
|
|
}
|
|
|
|
|
|
- public function getListForSearch($ergs, $user){
|
|
|
- $data = $ergs['order_search'];
|
|
|
- $id = [];
|
|
|
- if($ergs['type'] == self::type_one){
|
|
|
- $service = new ProductService();
|
|
|
- $model = $service->productCommon($data, $user, ['id']);
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
- }elseif ($ergs['type'] == self::type_two){
|
|
|
- $service = new FreightService();
|
|
|
- $model = $service->freightCommon($data, $user, ['id']);
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
- }elseif ($ergs['type'] == self::type_three){
|
|
|
- $service = new StatisticsService();
|
|
|
- list($status, $model) = $service->statisticsRevenueCostCommon($data, $user, ['id']);
|
|
|
- if(! $status) return [false, $model];
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
- }elseif ($ergs['type'] == self::type_four || $ergs['type'] == self::type_five){
|
|
|
- if(empty($data['order_type'])){
|
|
|
- if($ergs['type'] == self::type_four){
|
|
|
- $data['order_type'] = RevenueCost::ORDER_ONE;
|
|
|
- }else{
|
|
|
- $data['order_type'] = RevenueCost::ORDER_TWO;
|
|
|
- }
|
|
|
- }
|
|
|
- $service = new StatisticsService();
|
|
|
- list($status, $model) = $service->statisticsRevenueCostOneAndTwoCommon($data, $user, ['id']);
|
|
|
- if(! $status) return [false, $model];
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
- }elseif ($ergs['type'] == self::type_six){
|
|
|
- $service = new StatisticsService();
|
|
|
- list($status, $model) = $service->statisticsRevenueCostThreeCommon($data, $user, ['order_id']);
|
|
|
- if(! $status) return [false, $model];
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'order_id');
|
|
|
- }elseif ($ergs['type'] == self::type_seven){
|
|
|
- $service = new GiveOutService();
|
|
|
- $model = $service->giveOutCommon($data, $user, ['id']);
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
- }elseif ($ergs['type'] == self::type_eight){
|
|
|
- $service = new StatisticsService();
|
|
|
- list($status,$model) = $service->statisticsProfitCommon($data, $user, ['employee_index.id']);
|
|
|
- if(! $status) return [false, $model];
|
|
|
- $return = $this->limitData($model,'',$data);
|
|
|
- $id = array_column($return,'id');
|
|
|
- }
|
|
|
-
|
|
|
- return [true, $id];
|
|
|
- }
|
|
|
-
|
|
|
public function saveExportData($data, $headers, $type = 'default',$file_name = ''){
|
|
|
if(empty($file_name)) $file_name = self::$filename . "_". date("Y-m-d") . "_". rand(1000,9999);
|
|
|
$filename = $file_name . '.' . 'xlsx';
|