Skip to content

Commit

Permalink
Merge pull request #430 from nanasess/fix-draw_image
Browse files Browse the repository at this point in the history
GDを使用しない場合でもグラフ出力していたのを修正
  • Loading branch information
okazy authored Feb 16, 2021
2 parents 72bce9e + 0a0b481 commit afa8069
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions data/class/pages/admin/total/LC_Page_Admin_Total.php
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,8 @@ public function lfGetOrderMember($type, $sdate, $edate)
}
}

$tpl_image = $this->lfGetGraphPie($arrTotalResults, 'member_name', 'member', '(売上比率)', $sdate, $edate);
$tpl_image = DRAW_IMAGE ? $this->lfGetGraphPie($arrTotalResults, 'member_name', 'member', '(売上比率)', $sdate, $edate) : '';


return array($arrTotalResults, $tpl_image);
}
Expand Down Expand Up @@ -598,7 +599,7 @@ public function lfGetOrderProducts($type, $sdate, $edate)
$objQuery->setOrder('total DESC');
$arrTotalResults = $objQuery->select($col, $from, $where, $arrWhereVal);

$tpl_image = $this->lfGetGraphPie($arrTotalResults, 'product_name', 'products_' . $type, '(売上比率)', $sdate, $edate);
$tpl_image = DRAW_IMAGE ? $this->lfGetGraphPie($arrTotalResults, 'product_name', 'products_' . $type, '(売上比率)', $sdate, $edate) : '';

return array($arrTotalResults, $tpl_image);
}
Expand Down Expand Up @@ -635,7 +636,8 @@ public function lfGetOrderJob($type, $sdate, $edate)
}

}
$tpl_image = $this->lfGetGraphPie($arrTotalResults, 'job_name', 'job_' . $type, '(売上比率)', $sdate, $edate);

$tpl_image = DRAW_IMAGE ? $this->lfGetGraphPie($arrTotalResults, 'job_name', 'job_' . $type, '(売上比率)', $sdate, $edate) : '';

return array($arrTotalResults, $tpl_image);
}
Expand Down Expand Up @@ -672,7 +674,8 @@ public function lfGetOrderAge($type, $sdate, $edate)
}

}
$tpl_image = $this->lfGetGraphBar($arrTotalResults, 'age_name', 'age_' . $type, '(年齢)', '(売上合計)', $sdate, $edate);

$tpl_image = DRAW_IMAGE ? $this->lfGetGraphBar($arrTotalResults, 'age_name', 'age_' . $type, '(年齢)', '(売上合計)', $sdate, $edate) : '';

return array($arrTotalResults, $tpl_image);
}
Expand Down Expand Up @@ -726,8 +729,9 @@ public function lfGetOrderTerm($type, $sdate, $edate)
$arrTotalResults = $objQuery->select($col, 'dtb_order', $where, $arrWhereVal);

$arrTotalResults = $this->lfAddBlankLine($arrTotalResults, $type, $sdate, $edate);
// todo GDない場合の処理
$tpl_image = $this->lfGetGraphLine($arrTotalResults, 'str_date', 'term_' . $type, $xtitle, $ytitle, $sdate, $edate, $xincline);

$tpl_image = DRAW_IMAGE ? $this->lfGetGraphLine($arrTotalResults, 'str_date', 'term_' . $type, $xtitle, $ytitle, $sdate, $edate, $xincline) : '';

$arrTotalResults = $this->lfAddTotalLine($arrTotalResults);

return array($arrTotalResults, $tpl_image);
Expand Down Expand Up @@ -815,7 +819,10 @@ public function lfAddTotalLine($arrResults)
}
}
// 平均値の計算
$arrTotal['total_average'] = $arrTotal['total'] / $arrTotal['total_order'];
$arrTotal['total_average'] = 0;
if ($arrTotal['total_order'] > 0) {
$arrTotal['total_average'] = $arrTotal['total'] / $arrTotal['total_order'];
}
if (is_nan($arrTotal['total_average'])) {
$arrTotal['total_average'] = 0;
}
Expand Down

0 comments on commit afa8069

Please sign in to comment.