📄 accept.php
字号:
<?php
session_start();
header("Content-type: text/html");
include("resp.inc");
resp_db_connect_i();
$maxd=mysql_fetch_array(mysql_query("select max(subsum) as maxd from (select day(stime) as day,count(*) as subsum from deliver where month(stime)=month(now()) group by day ) as subtable"));
$colspan=(300>50*$maxd[0]?30*$maxd[0]:400);
$jut=$colspan*0.7/$maxd[0];
$baseline=
$rowspan=600;
$im = @imagecreate (600, $colspan+10) or die ("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 233, 14, 91);
$black = imagecolorallocate($im, 0,0,0);
imageline( $im, 20, $colspan-1, 600, $colspan-1,$text_color);
imageline( $im,20, 0,20,$colspan,$text_color);
$monthname=mysql_fetch_array(mysql_query("select month(now())"));
$str=iconv("GB2312","UTF-8",$monthname[0]."月故障趋势图");
imagettftext($im,10,0,250,15, $black, "/usr/share/fonts/zh_CN/TrueType/gbsn00lp.ttf",$str);
$tmp=mysql_query("select day(stime) as day,count(*) as subsum from deliver where month(stime)=month(now()) group by day with rollup");
while ($day=mysql_fetch_array($tmp)) {
if ($day[day]){$arr[$day[day]]=$day[subsum];}else{$monthtotal=$day[subsum];}
}
$days=mysql_fetch_array(mysql_query("select extract(day from last_day(DATE_SUB(now(), INTERVAL '1' month))) as days "));
for ($i=1;$i<=$days[0];$i++) {
if (isset($arr[$i])) {}else{$arr[i]=0;}
imagefilledrectangle($im, 20+($i-1)*12, $colspan-$colspan*0.7/$maxd[0]*$arr[$i]-1, $i*12+20, $colspan-1,$text_color);
imagettftext($im,8,0,$i*12+11,$colspan+10, $black, "/usr/share/fonts/zh_CN/TrueType/gbsn00lp.ttf",$i);
}
for ($j=1;$j<=$maxd[0];$j++){
imagedashedline($im,0,$colspan-0.7*$colspan*$j/$maxd[0]-1,600,$colspan-0.7*$colspan*$j/$maxd[0]-1,$text_color);
imagettftext($im,8,0,4,$colspan-0.7*$colspan*$j/$maxd[0]-3, $black, "/usr/share/fonts/zh_CN/TrueType/gbsn00lp.ttf",$j);
}
imagejpeg($im,"accept.png");
imagedestroy ($im);
echo "<center><caption>$monthname[0]月份故障受理趋势图</caption></center>";
echo "<table align=center width=92% BGCOLOR='lightblue' border=1px>";
echo "<tr><td>日期</td>";
for ($i=1;$i<=$days[0];$i++) {
echo "<td>$i</td>";
}
echo "<td>本月总量</td>";
echo "</tr>";
echo "<tr><td>受理数</td>";
for ($i=1;$i<=$days[0];$i++) {
if (isset($arr[$i])) {}else{$arr[i]="0";}
echo "<td>$arr[$i]</td>";
}
echo "<td>$monthtotal</td>";
echo "</tr>";
echo "</table>";
echo "<div style='position:relative; left:100px; top:20px'><img src='accept.png'></img></div>";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -