diff --git a/common/libraries/receiver/Orders_v2_entity.php b/common/libraries/receiver/Orders_v2_entity.php index ca819219..2143bbed 100644 --- a/common/libraries/receiver/Orders_v2_entity.php +++ b/common/libraries/receiver/Orders_v2_entity.php @@ -1177,7 +1177,8 @@ class Orders_v2_entity{ * @return array */ public function aggs_biz_ding_piao_rpt($today_start='', $today_end='', $total_start='', $total_end='', - $title_today='', $title_ding_today='', $title_ding='', $title_piao_today='', $title_piao='', $create_table_image=false, $title='区域'){ + $title_today='', $title_ding_today='', $title_ding='', $title_piao_today='', $title_piao='', $create_table_image=false, $title='区域') + { !$today_start && $today_start = date('Y-m-d 00:00:00'); !$today_end && $today_end = date('Y-m-d 00:00:00', strtotime('+1 day')); !$total_start && $total_start = date('Y-m-01 00:00:00'); @@ -1192,7 +1193,7 @@ class Orders_v2_entity{ $piao = $this->aggs_biz_brand_piao_cityid($today_start, $today_end, $total_start, $total_end); $biz = $this->aggs_biz_ding_piao_cityid($today_start, $today_end, $total_start, $total_end); #var_dump($today_start);var_dump($today_end);var_dump($total_start);var_dump($total_end);var_dump($ding); var_dump($piao);var_dump($biz); - if (!$biz){ + if (!$biz) { return array(); } @@ -1202,89 +1203,62 @@ class Orders_v2_entity{ # 生成品牌对应的车系arr $series_names = array(); - foreach ($ding as $k => $v){ + foreach ($ding as $k => $v) { $series_name = $v['series_name']; $key = $v['brand_name']; - if (!$series_names[$key]){ + if (!$series_names[$key]) { $series_names[$key][] = $series_name; continue; } - if (!in_array($series_name, $series_names[$key])){ + if (!in_array($series_name, $series_names[$key])) { $series_names[$key][] = $series_name; } } - foreach ($piao as $k => $v){ + foreach ($piao as $k => $v) { $series_name = $v['series_name']; $key = $v['brand_name']; - if (!$series_names[$key]){ + if (!$series_names[$key]) { $series_names[$key][] = $series_name; continue; } - if (!in_array($series_name, $series_names[$key])){ + if (!in_array($series_name, $series_names[$key])) { $series_names[$key][] = $series_name; } } #var_dump($brand_names); var_dump($series_names); + #$series_name 先完成排序,再生成表头与数据列 + $series_names_ = array(); + foreach ($brand_names as $brand_name){ + $v = $series_names[$brand_name]; + sort($v); + $series_names_[$brand_name] = $v; + } + $series_names = $series_names_; + # 生成表头 $indexs_total = array(); $indexs_total[] = 'doc_ding'; $indexs_total[] = 'doc_piao'; $arr1 = array('city_name'=>$title, 'biz_name'=>$title_today, 'doc_ding_today'=>$title_ding_today); - /*foreach ($brand_names as $k => $v){ - foreach ($v as $k1 => $v1){ - $arr1[$k.'_'.$v1.'_ding_today'] = $k.'_'.$v1; - } - $arr1[$k.'_ding_today'] = $k; - }*/ $arr1 = array_merge($arr1, array('doc_ding'=>$title_ding)); - /*foreach ($series_names as $k => $v){ + foreach ($series_names as $k => $v){ $indexs_total[] = $k.'_ding'; $arr1[$k.'_ding'] = $k; # 品牌在系列前 foreach ($v as $k1 => $v1){ #$arr1[$k.'_'.$v1.'_ding'] = $k.'_'.$v1; $arr1[$k.'_'.$v1.'_ding'] = ' '.$v1; # 系列简写 } - }*/ - foreach ($brand_names as $brand_name){ - if ($v = $series_names[$brand_name]){ - $k = $brand_name; - sort($v); - $indexs_total[] = $k.'_ding'; - $arr1[$k.'_ding'] = $k; # 品牌在系列前 - foreach ($v as $k1 => $v1){ - #$arr1[$k.'_'.$v1.'_ding'] = $k.'_'.$v1; - $arr1[$k.'_'.$v1.'_ding'] = ' '.$v1; # 系列简写 - } - } } $arr3 = array('doc_piao_today'=>$title_piao_today); - /*foreach ($brand_names as $k => $v){ - foreach ($v as $k1 => $v1){ - $arr3[$k.'_'.$v1.'_piao_today'] = $k.'_'.$v1; - } - $arr3[$k.'_piao_today'] = $k; - }*/ $arr3 = array_merge($arr3, array('doc_piao'=>$title_piao)); - /*foreach ($series_names as $k => $v){ + foreach ($series_names as $k => $v){ $indexs_total[] = $k.'_piao'; $arr3[$k.'_piao'] = $k; # 品牌在系列前 foreach ($v as $k1 => $v1){ #$arr3[$k.'_'.$v1.'_piao'] = $k.'_'.$v1; $arr3[$k.'_'.$v1.'_piao'] = ' '.$v1; # 系列简写 } - }*/ - foreach ($brand_names as $brand_name){ - if ($v = $series_names[$brand_name]) { - $k = $brand_name; - sort($v); - $indexs_total[] = $k.'_piao'; - $arr3[$k.'_piao'] = $k; # 品牌在系列前 - foreach ($v as $k1 => $v1){ - #$arr3[$k.'_'.$v1.'_piao'] = $k.'_'.$v1; - $arr3[$k.'_'.$v1.'_piao'] = ' '.$v1; # 系列简写 - } - } } $indexs = array_merge($arr1, $arr3); #var_dump($indexs); @@ -1561,65 +1535,38 @@ class Orders_v2_entity{ } #var_dump($brand_names); var_dump($series_names); + #$series_name 先完成排序,再生成表头与数据列 + $series_names_ = array(); + foreach ($brand_names as $brand_name){ + $v = $series_names[$brand_name]; + sort($v); + $series_names_[$brand_name] = $v; + } + $series_names = $series_names_; + # 生成表头 $indexs_total = array(); $indexs_total[] = 'doc_ding'; $indexs_total[] = 'doc_piao'; $arr1 = array('biz_name'=>$title_today, 'doc_ding_today'=>$title_ding_today); - /*foreach ($brand_names as $k => $v){ - foreach ($v as $k1 => $v1){ - $arr1[$k.'_'.$v1.'_ding_today'] = $k.'_'.$v1; - } - $arr1[$k.'_ding_today'] = $k; - }*/ $arr1 = array_merge($arr1, array('doc_ding'=>$title_ding)); - /*foreach ($series_names as $k => $v){ + foreach ($series_names as $k => $v){ $indexs_total[] = $k.'_ding'; $arr1[$k.'_ding'] = $k; # 品牌在系列前 foreach ($v as $k1 => $v1){ #$arr1[$k.'_'.$v1.'_ding'] = $k.'_'.$v1; $arr1[$k.'_'.$v1.'_ding'] = ' '.$v1; # 系列简写 } - }*/ - foreach ($brand_names as $brand_name){ - if ($v = $series_names[$brand_name]){ - $k = $brand_name; - sort($v); - $indexs_total[] = $k.'_ding'; - $arr1[$k.'_ding'] = $k; # 品牌在系列前 - foreach ($v as $k1 => $v1){ - #$arr1[$k.'_'.$v1.'_ding'] = $k.'_'.$v1; - $arr1[$k.'_'.$v1.'_ding'] = ' '.$v1; # 系列简写 - } - } } $arr3 = array('doc_piao_today'=>$title_piao_today); - /*foreach ($brand_names as $k => $v){ - foreach ($v as $k1 => $v1){ - $arr3[$k.'_'.$v1.'_piao_today'] = $k.'_'.$v1; - } - $arr3[$k.'_piao_today'] = $k; - }*/ $arr3 = array_merge($arr3, array('doc_piao'=>$title_piao)); - /*foreach ($series_names as $k => $v){ + foreach ($series_names as $k => $v){ $indexs_total[] = $k.'_piao'; $arr3[$k.'_piao'] = $k; # 品牌在系列前 foreach ($v as $k1 => $v1){ #$arr3[$k.'_'.$v1.'_piao'] = $k.'_'.$v1; $arr3[$k.'_'.$v1.'_piao'] = ' '.$v1; # 系列简写 } - }*/ - foreach ($brand_names as $brand_name){ - if ($v = $series_names[$brand_name]) { - $k = $brand_name; - sort($v); - $indexs_total[] = $k.'_piao'; - $arr3[$k.'_piao'] = $k; # 品牌在系列前 - foreach ($v as $k1 => $v1){ - #$arr3[$k.'_'.$v1.'_piao'] = $k.'_'.$v1; - $arr3[$k.'_'.$v1.'_piao'] = ' '.$v1; # 系列简写 - } - } } $indexs = array_merge($arr1, $arr3); #var_dump($indexs);