File: C:/xampp/htdocs/FograCT9x/lineGraph.php
<?php
extract($_REQUEST);
session_start();
//error_reporting(E_ALL ^ E_NOTICE);?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5"><title>PSA Production Report--</title>
</head>
<?php
$host="127.0.0.1";
$user="root";
$pass="fredsql";
$db="tvicheck-st";
error_reporting(0);
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_query("SET NAMES 'utf8'");
//$link = mssql_connect("MACBOOK7", "sa", "fred5697");
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
$query = "SELECT * from production where po='$po' order by id";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// if records present
$i=0;
// iterate iii through resultset
// print title with links to edit and delete scripts
$timear= array();
$dekar = array();
$decar = array();
$demar = array();
$deyar = array();
$dek50ar = array();
$dec50ar = array();
$dem50ar = array();
$dey50ar = array();
$degar = array();
while($row = mysql_fetch_object($result))
{
$i=$i+1;
$tm=$row->pdate;
$press=$row->press;
$paper=$row->paper;
$remark=$row->cmmt;
//echo $i."-".$tm."__";
array_push($timear, $tm);
$dek=$row->dek;
array_push($dekar, $dek);
$dek50=$row->dek50;
array_push($dek50ar, $dek50);
$dec=$row->decc;
array_push($decar, $dec);
//echo $i."-".$dec."__";
$dec50=$row->dec50;
array_push($dec50ar, $dec50);
$dem=$row->dem;
array_push($demar, $dem);
$dem50=$row->dem50;
array_push($dem50ar, $dem50);
$dey=$row->dey;
array_push($deyar, $dey);
$dey50=$row->dey50;
array_push($dey50ar, $dey50);
$deg=$row->deg;
array_push($degar, $deg);
}
$max=$i;
//echo "maxi:".$i."-__";
date_default_timezone_set('Asia/Taipei');
function timeDiff($firstTime,$lastTime)
{
// convert to unix timestamps
$firstTime=strtotime($firstTime);
$lastTime=strtotime($lastTime);
// perform subtraction to get the difference (in seconds) between times
$timeDiff=$lastTime-$firstTime;
// return the difference
return $timeDiff;
}
//echo "Job id: ".$po."<br>";
?>
<table width="300" align="center"> <font color="green">
<tr>
<td> Date of press run: </td><td><?php echo $tm;?></td></tr><tr>
<td> Paper: </td><td><?php echo $paper;?></td></tr><tr>
<td> Press: </td><td><?php echo $press;?></td></tr><tr>
<td> Remark: </td><td><?php echo $remark;?></td></tr><tr>
<td> Job id: </td><td><?php echo $po;?></td>
</tr>
</table>
<p>
<table width="200" border="1" align="center"> <font color="green">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php');
unlink('CMYSID.png');
$datay1 = $decar;
$datay2 = $demar;
$datay3 = $deyar;
// Setup the graph
$graph = new Graph(550,430);
//$graph->SetScale("textint",0,6,0,0);
$graph->SetScale("textint");
$theme_class= new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->title->Set('CMY 100');
$graph->SetBox(false);
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p2 = new LinePlot($datay2);
$graph->Add($p2);
//$ADR=92.04-5.9;
//$BDR=91.12-6.32;
$p3 = new LinePlot($datay3);
$graph->Add($p3);
$p1->SetColor("#55bbdd");
$p1->SetLegend('C100');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#55bbdd');
$p1->mark->SetFillColor('#55bbdd');
$p1->SetCenter();
$p2->SetColor("#fcbffb");
$p2->SetLegend('MC100');
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#fcbffb');
$p2->mark->SetFillColor('#fcbffb');
$p2->value->SetMargin(14);
$p2->SetCenter();
$p3->SetColor("#dce72a");
$p3->SetLegend('Y100');
$p3->mark->SetType(MARK_DIAMOND,'',1.0);
$p3->mark->SetColor('#dce72a');
$p3->mark->SetFillColor('#dce72a');
$p3->value->SetMargin(14);
$p3->SetCenter();
$sline = new PlotLine(HORIZONTAL,1.5,'#146f02',1.1);
$sline->SetLineStyle('dashed');
$sline->SetLegend("Level A");
$sline2 = new PlotLine(HORIZONTAL,2.4,'black',1.1);
$sline2->SetLineStyle('dashed');
$sline2->SetLegend("Level B");
$sline3 = new PlotLine(HORIZONTAL,4,'red',1.1);
$sline3->SetLineStyle('dashed');
$sline3->SetLegend("Level C");
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);
$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);
// Output line
$graph->Stroke('CMYSID.png');
?>
<img src="CMYSID.png">
</div></td></tr>
</table>
<p><p> <p><p> <p><p>
<table width="200" border="1" align="center">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php');
unlink('KSID.png');
$datay1 = $dekar;
// Setup the graph
$graph = new Graph(550,430);
//$graph->SetScale("textint",0,6,0,0);
$graph->SetScale("textint");
$theme_class= new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->title->Set('K100');
$graph->SetBox(false);
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p1->SetColor("#aaaaaa");
$p1->SetLegend('K100');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#aaaaaa');
$p1->mark->SetFillColor('#aaaaaa');
$p1->SetCenter();
$sline = new PlotLine(HORIZONTAL,2.4,'#146f02',1.1);
$sline->SetLineStyle('dashed');
$sline->SetLegend("Level A");
$sline2 = new PlotLine(HORIZONTAL,3.6,'black',1.1);
$sline2->SetLineStyle('dashed');
$sline2->SetLegend("Level B");
$sline3 = new PlotLine(HORIZONTAL,6,'red',1.1);
$sline3->SetLineStyle('dashed');
$sline3->SetLegend("Level C");
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);
$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);
// Output line
$graph->Stroke('KSID.png');
?>
<img src="KSID.png">
</div></td></tr>
</table>
<p>
<table width="200" border="1" align="center"> <font color="green">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php');
unlink('CMYK50.png');
$datay1 = $dec50ar;
$datay2 = $dem50ar;
$datay3 = $dey50ar;
$datay4 = $dek50ar;
// Setup the graph
$graph = new Graph(550,430);
//$graph->SetScale("textint",0,6,0,0);
$graph->SetScale("textint");
$theme_class= new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->title->Set('CMYK 50');
$graph->SetBox(false);
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p2 = new LinePlot($datay2);
$graph->Add($p2);
//$ADR=92.04-5.9;
//$BDR=91.12-6.32;
$p3 = new LinePlot($datay3);
$graph->Add($p3);
$p4 = new LinePlot($datay4);
$graph->Add($p4);
$p1->SetColor("#55bbdd");
$p1->SetLegend('C50');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#55bbdd');
$p1->mark->SetFillColor('#55bbdd');
$p1->SetCenter();
$p2->SetColor("#fcbffb");
$p2->SetLegend('MC50');
$p2->mark->SetType(MARK_UTRIANGLE,'',1.0);
$p2->mark->SetColor('#fcbffb');
$p2->mark->SetFillColor('#fcbffb');
$p2->value->SetMargin(14);
$p2->SetCenter();
$p3->SetColor("#dce72a");
$p3->SetLegend('Y50');
$p3->mark->SetType(MARK_DIAMOND,'',1.0);
$p3->mark->SetColor('#dce72a');
$p3->mark->SetFillColor('#dce72a');
$p3->value->SetMargin(14);
$p3->SetCenter();
$p4->SetColor("#aaaaaa");
$p4->SetLegend('Y50');
$p4->mark->SetType(MARK_DIAMOND,'',1.0);
$p4->mark->SetColor('#aaaaaa');
$p4->mark->SetFillColor('#aaaaaa');
$p4->value->SetMargin(14);
$p4->SetCenter();
$sline = new PlotLine(HORIZONTAL,1.5,'#146f02',1.1);
$sline->SetLineStyle('dashed');
$sline->SetLegend("Level A");
$sline2 = new PlotLine(HORIZONTAL,2,'black',1.1);
$sline2->SetLineStyle('dashed');
$sline2->SetLegend("Level B");
$sline3 = new PlotLine(HORIZONTAL,2.5,'red',1.1);
$sline3->SetLineStyle('dashed');
$sline3->SetLegend("Level C");
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);
$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);
// Output line
$graph->Stroke('CMYK50.png');
?>
<img src="CMYK50.png">
</div></td></tr>
</table>
<p><p> <p><p> <p><p>
<table width="200" border="1" align="center">
<tr>
<td><div align="center">
<?php // content="text/plain; charset=utf-8"
require_once ('../jpgraph/jpgraph.php');
require_once ('../jpgraph/jpgraph_line.php');
require_once ('../jpgraph/jpgraph_plotline.php');
unlink('gray.png');
$datay1 = $degar;
// Setup the graph
$graph = new Graph(550,430);
//$graph->SetScale("textint",0,6,0,0);
$graph->SetScale("textint");
$theme_class= new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->title->Set('50/40/40');
$graph->SetBox(false);
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
//$graph->xaxis->SetTickLabels(array('0','5','10','20','30','40','50','60','70','80','90','95'));
$graph->ygrid->SetFill(false);
//$graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLFRAME);
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p1->SetColor("#aaaaaa");
$p1->SetLegend('50/40/40');
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#aaaaaa');
$p1->mark->SetFillColor('#aaaaaa');
$p1->SetCenter();
$sline = new PlotLine(HORIZONTAL,3,'#146f02',1.1);
$sline->SetLineStyle('dashed');
$sline->SetLegend("Level A");
$sline2 = new PlotLine(HORIZONTAL,3.5,'black',1.1);
$sline2->SetLineStyle('dashed');
$sline2->SetLegend("Level b");
$sline3 = new PlotLine(HORIZONTAL,5,'red',1.1);
$sline3->SetLineStyle('dashed');
$sline3->SetLegend("Level c");
$graph->Add($sline);
$graph->Add($sline2);
$graph->Add($sline3);
$graph->legend->SetFrameWeight(1);
$graph->legend->SetColor('#4E4E4E','#00A78A');
$graph->legend->SetMarkAbsSize(8);
// Output line
$graph->Stroke('gray.png');
?>
<img src="gray.png">
</div></td></tr>
</table>
<p> </p>
<p> </p>
<table border="1" align="center" cellpadding="1" cellspacing="1">
<col width="87">
<col width="83">
<col width="71" span="2">
<col width="83">
<col width="56">
<col width="53">
<col width="83">
<col width="53">
<col width="56">
<tr>
<td width="87">Tol CIEDE00</td>
<td width="83" align="center" bgcolor="#00CCFF">C100</td>
<td width="71" align="center" bgcolor="#FFCCFF">M100</td>
<td width="71" align="center" bgcolor="#FFFF99">Y100</td>
<td width="83" align="center" bgcolor="#CCCCCC">K100</td>
<td width="56" align="center" bgcolor="#00CCFF">C50</td>
<td width="53" align="center" bgcolor="#FFCCFF">M50</td>
<td width="83" align="center" bgcolor="#FFFFCC">Y50</td>
<td width="53" align="center" bgcolor="#CCCCCC">K50</td>
<td width="56" align="center" bgcolor="#CCCCCC">50/40/40</td>
</tr>
<tr>
<td>Level A</td>
<td align="right" bgcolor="#00CCFF">1.50</td>
<td align="right" bgcolor="#FFCCFF">1.50</td>
<td align="right" bgcolor="#FFFF99">1.50</td>
<td align="right" bgcolor="#CCCCCC">2.40</td>
<td align="right" bgcolor="#00CCFF">1.50</td>
<td align="right" bgcolor="#FFCCFF">1.50</td>
<td align="right" bgcolor="#FFFFCC">1.50</td>
<td align="right" bgcolor="#CCCCCC">1.50</td>
<td align="right" bgcolor="#CCCCCC">3.00</td>
</tr>
<tr>
<td>Level B</td>
<td align="right" bgcolor="#00CCFF">2.4</td>
<td align="right" bgcolor="#FFCCFF">2.4</td>
<td align="right" bgcolor="#FFFF99">2.4</td>
<td align="right" bgcolor="#CCCCCC">3.6</td>
<td align="right" bgcolor="#00CCFF">2</td>
<td align="right" bgcolor="#FFCCFF">2</td>
<td align="right" bgcolor="#FFFFCC">2</td>
<td align="right" bgcolor="#CCCCCC">2</td>
<td align="right" bgcolor="#CCCCCC">3.5</td>
</tr>
<tr>
<td>Level C</td>
<td align="right" bgcolor="#00CCFF">4</td>
<td align="right" bgcolor="#FFCCFF">4</td>
<td align="right" bgcolor="#FFFF99">4</td>
<td align="right" bgcolor="#CCCCCC">6</td>
<td align="right" bgcolor="#00CCFF">2.5</td>
<td align="right" bgcolor="#FFCCFF">2.5</td>
<td align="right" bgcolor="#FFFFCC">2.5</td>
<td align="right" bgcolor="#CCCCCC">2.5</td>
<td align="right" bgcolor="#CCCCCC">5</td>
</tr>
<?php
for ( $i = 1; $i <= $max; $i+= 1) {
?>
<tr>
<td><?php echo $i;?></td>
<td align="right" bgcolor="#FFFFFF"><?php echo $decar[$i-1];?></td>
<td align="right" bgcolor="#FFFFFF"><?php echo $demar[$i-1];?></td>
<td align="right" bgcolor="#FFFFFF"><?php echo $deyar[$i-1];?></td>
<td align="right" bgcolor="#FFFFFF"><?php echo $dekar[$i-1];?></td>
<td align="right" bgcolor="#FFFFFF"><?php echo $dec50ar[$i-1];?></td>
<td align="right" bgcolor="#FFFFFF"><?php echo $dem50ar[$i-1];?></td>
<td align="right" bgcolor="#FFFFFF"><?php echo $dey50ar[$i-1];?></td>
<td align="right" bgcolor="#FFFFFF"><?php echo $dek50ar[$i-1];?></td>
<td align="right" bgcolor="#FFFFFF"><?php echo $degar[$i-1];?></td>
</tr>
<?php } ?>
</table>
<p> </p>
<!-- graph code ends here-->