|
@@ -1557,11 +1557,13 @@ class common {
|
|
|
}
|
|
}
|
|
|
if (isset($_REQUEST['date_end']) && !empty($_REQUEST['date_end'])){
|
|
if (isset($_REQUEST['date_end']) && !empty($_REQUEST['date_end'])){
|
|
|
$date_end = common::dateFormatToYM($_REQUEST['date_end']);
|
|
$date_end = common::dateFormatToYM($_REQUEST['date_end']);
|
|
|
- $date_to = date('Y-m-t', strtotime("$date_end-01"));
|
|
|
|
|
|
|
+ $date_to = date('Y-m-t', strtotime($date_end."-01"));
|
|
|
}
|
|
}
|
|
|
$param = '{"user_login":"'._getLoginName().'","report_type":"ALL","date_from":"'.$date_from.'","date_to":"'.$date_to.'"}';
|
|
$param = '{"user_login":"'._getLoginName().'","report_type":"ALL","date_from":"'.$date_from.'","date_to":"'.$date_to.'"}';
|
|
|
$sql = "SELECT * FROM get_customer_revenue_report('$param');FETCH ALL FROM r2;";
|
|
$sql = "SELECT * FROM get_customer_revenue_report('$param');FETCH ALL FROM r2;";
|
|
|
|
|
+ error_log("Revenue_sql:".$sql);
|
|
|
$r2_data = common::excuteListSql($sql);
|
|
$r2_data = common::excuteListSql($sql);
|
|
|
|
|
+ //$r2_data = common::excuteListSql("select * from _test_data_table");
|
|
|
|
|
|
|
|
$barList = array();
|
|
$barList = array();
|
|
|
$groupedItems = array();
|
|
$groupedItems = array();
|
|
@@ -1572,6 +1574,15 @@ class common {
|
|
|
$groupedItems[$item['currency']][] = $item;
|
|
$groupedItems[$item['currency']][] = $item;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //补齐所有货币的月份
|
|
|
|
|
+ foreach($groupedItems as $ckey =>$cvalueArr){
|
|
|
|
|
+ $currency = array();
|
|
|
|
|
+ foreach($barList as $month){
|
|
|
|
|
+ $currency[] = common::findCurrencyByMonth($month,$ckey,$cvalueArr);
|
|
|
|
|
+ }
|
|
|
|
|
+ $groupedItems[$ckey] = $currency;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
//处理barSeries
|
|
//处理barSeries
|
|
|
$barSeries = array();
|
|
$barSeries = array();
|
|
|
//先准备4种颜色
|
|
//先准备4种颜色
|
|
@@ -1591,12 +1602,13 @@ class common {
|
|
|
$data = array();
|
|
$data = array();
|
|
|
$total = 0;
|
|
$total = 0;
|
|
|
foreach($series as $_series){
|
|
foreach($series as $_series){
|
|
|
- $data[]=$_series['total_amount'];
|
|
|
|
|
- $total = $total + $_series['total_amount'];
|
|
|
|
|
- $max = $max<$_series['total_amount'] ? $_series['total_amount'] : $max;
|
|
|
|
|
|
|
+ $invoice_amount = empty($_series['invoice_amount'])? 0 : round($_series['invoice_amount'], 4);
|
|
|
|
|
+ $data[]=$invoice_amount;
|
|
|
|
|
+ $total = $total + $invoice_amount;
|
|
|
|
|
+ $max = $max<$_series['invoice_amount'] ? $_series['invoice_amount'] : $max;
|
|
|
}
|
|
}
|
|
|
- $tem_series["label"] = $data;
|
|
|
|
|
- $tem_series["total"] = $total;
|
|
|
|
|
|
|
+ $tem_series["data"] = $data;
|
|
|
|
|
+ $tem_series["total"] = floatval(number_format($total, 4, '.', ''));
|
|
|
$barSeries[] = $tem_series;
|
|
$barSeries[] = $tem_series;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1607,12 +1619,21 @@ class common {
|
|
|
$interval = 2;
|
|
$interval = 2;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $revenueBarData = array("bar_title" =>"Total: 0","barList" => $barList,
|
|
|
|
|
|
|
+ $revenueBarData = array("bar_title" =>"Total:","barList" => $barList,
|
|
|
"barSeries" =>$barSeries,"download_name"=>"Rvenue","isShowTooltips"=>true,"Max" =>$interval*5,"interval" =>$interval);
|
|
"barSeries" =>$barSeries,"download_name"=>"Rvenue","isShowTooltips"=>true,"Max" =>$interval*5,"interval" =>$interval);
|
|
|
-
|
|
|
|
|
return $revenueBarData;
|
|
return $revenueBarData;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public static function findCurrencyByMonth($month,$ckey,$cvalueArr){
|
|
|
|
|
+ $data = array("month" =>$month,"currency"=>$ckey,"invoice_amount"=>0,"sort_month"=>"");
|
|
|
|
|
+ foreach($cvalueArr as $realmonth){
|
|
|
|
|
+ if($realmonth['month'] == $month){
|
|
|
|
|
+ $data = $realmonth;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return $data;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public static function getdefaultManagement(){
|
|
public static function getdefaultManagement(){
|
|
|
$Management = array();
|
|
$Management = array();
|
|
|
$Management[] = array("id"=>1 ,
|
|
$Management[] = array("id"=>1 ,
|